paperbot · PL 论文追踪

全部论文 待读 收藏

P2 The Simple Essence of Boolean-Algebraic Subtyping: Semantic Soundness for Algebraic Union, Intersection, Negation, and Equi-recursive Types

布尔代数子类型的简单本质:代数并、交、否定与等递归类型的语义可靠性
POPL 10(POPL)2026匹配度 2/10 · 论文研究布尔代数子类型的形式语义、可靠性证明与判定过程,属于纯 PL/类型论工作;与用户核心关注的 ML/Agentic 静态分析、LLM 与静态分析/形式化验证交叉、浮点或贝叶斯程序分析均无直接关联。仅可作为形式语义与类型系统背景参考。引用 1 inbox
Chun Yin Chau, Lionel Parreaux
crossref: 2026-09-10

AI 速览

一句话:用五族特征布尔同态刻画布尔代数子类型,给出语义可靠性、判定过程与 co-NP 硬度。

Boolean-algebraic subtyping(BAS)为 MLstruct 提供了分配交、并、否定与等递归类型,但原有可靠性证明冗长复杂。本文用五族定义在带上下文类型上的特征布尔同态刻画 BAS:两族映到幂集,其余在无保护共归纳假设下映回类型。这些同态足以刻画子类型——若两类型在所有同态下满足不等式,则原上下文中子类型成立。由此得到新的判定过程,避免原算法部分低效;同时证明即使无递归类型子类型问题也是 co-NP 难。文章还展示 BAS 可编码字段删除,从而以一个新项形式和一个类型规则支持可扩展记录,且无需改动子类型。

问题
BAS 虽能自然表达可扩展变体等模式,但其非典型子类型规则、相互分配律和等递归类型的共归纳推理使可靠性证明极为复杂。
方法
在带上下文的类型上定义五族特征布尔同态,两支映到幂集,其余在无保护共归纳假设下映回类型,并用它们直接证明可靠性并刻画子类型。
评估
证明 BAS 的语义可靠性、同态对子类型的完备刻画,提出新的判定过程并证明子类型即使无递归类型也是 co-NP 难;还展示可扩展记录的编码。
原文摘要(Abstract)

Boolean-algebraic subtyping (BAS) is a powerful subtyping approach introduced in 2022 as the “secret sauce” enabling backtracking-free principal type inference in the MLstruct research language, a structurally-typed functional programming language with tagged records, tag and record subtyping, and tag-based pattern matching. By supporting distributive intersection, union, negation, and equi-recursive types, MLstruct can express powerful programming patterns, such as subtyped extensible variants, without needing row variables. But the use of atypical subtyping rules that violate some interpretations of intersection and union types, the mutual distributivity between these types, and the complexity of coinductive reasoning for equi-recursive types have collectively made the study of BAS difficult. The syntactic soundness proofs provided in the original work are dauntingly complicated and long-winded, obscuring the intuitions behind the correctness of BAS. In this paper, we distill the simple essence of Boolean-algebraic subtyping: we discover that BAS can be understood through five families of characteristic Boolean homomorphisms defined on types in context. Two of these map to power sets of simpler objects; the rest map back to types, but under an unguarded coinductive assumptions context. Together, these homomorphisms let us prove rather directly that BAS is sound, in that it does not relate constructors of incompatible runtime shapes. These homomorphisms are characteristic in the sense that they are sufficient to capture the meaning of subyping: we prove that if an inequality holds between two types under all these homomorphisms, then subtyping holds between the two types in the original context. This directly suggests a new subtyping decision procedure for BAS, which avoids some inefficiencies in the original algorithm, although it still has exponential worst-case time complexity. We prove that the subtyping problem is in fact co-NP-hard even without recursive types. Finally, we discover that BAS is already powerful enough to encode the removal of a field from a type. This allows us to support extensible records through one new term form and one new typing rule, but, perhaps surprisingly, no changes to subtyping at all. Our new approach to the semantics of BAS sheds some light on the core of MLstruct’s type system. It could be adapted to other languages with algebraic flavors of subtyping, such as Scala 3 and Ceylon, making their design and verification more approachable. Tellingly, all our subtyping soundness proofs fit inside the main body of this paper, with only some administrative lemmas relegated to the appendix.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@article{ChauP26,
  title = {The Simple Essence of Boolean-Algebraic Subtyping: Semantic Soundness for Algebraic Union, Intersection, Negation, and Equi-recursive Types},
  author = {Chun Yin Chau and Lionel Parreaux},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {POPL},
  year = {2026},
  doi = {10.1145/3776689}
}