paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Making a Type Difference: Subtraction on Intersection Types as Generalized Record Operations

制造类型差异:交集类型上的减法作为广义记录操作
POPL 7(POPL)2023匹配度 2/10 · 论文属于类型系统与语言设计,研究交集类型上的通用类型差运算并用 Coq 形式化,与用户聚焦的 PL→AI 静态分析、AI→PL 形式化验证、LLM/Agent、浮点程序分析或贝叶斯程序分析均无直接交集,仅在广义 PL 理论上相关。引用 5 inbox
Han Xu, Xuejing Huang, Bruno C. d. S. Oliveira
crossref: 2026-09-10

AI 速览

一句话:提出基于子类型与不相交关系的通用类型差运算,将记录上的删除/更新操作推广到函数与交集类型。

在带记录、对象或 trait 的语言中,删除、更新、重命名组件的操作常见,但既有研究多限于记录类型。本文提出:给定子类型关系和不相交关系,可规约并推导通用类型差算子的算法实现,使其适用于函数类型、记录类型和交集类型。该类型差代数具备减法算子的期望性质,并与通用合并算子结合,统一泛化文献中的多种记录操作。作者构造了一个可对任意类型表达式使用丰富算子的中间演算,并在面向组合式编程的原型语言 CP 中展示应用;其语义通过精化为带不相交交集类型与合并算子的演算给出。类型差及所有算子已在 CP 中实现,相关演算与证明均在 Coq 中机器化。

问题
如何将记录、对象或 trait 中删除、更新、重命名组件的操作,在保持预期代数性质的前提下推广到函数类型、记录类型和交集类型等更一般的类型。
方法
利用子类型与不相交关系给出通用类型差算子的规约与算法实现,设计含丰富算子的中间演算,并通过精化为不相交交集类型加合并算子给出语义;在 CP 中实现并用 Coq 机器化证明。
评估
在 CP 原型语言中实现类型差及相关算子,以组合式编程应用展示实用性,并在 Coq 中机器化验证全部演算与证明。
原文摘要(Abstract)

In programming languages with records, objects, or traits, it is common to have operators that allow dropping, updating or renaming some components. These operators are useful for programmers to explicitly deal with conflicts and override or update some components. While such operators have been studied for record types, little work has been done to generalize and study their theory for other types. This paper shows that, given subtyping and disjointness relations, we can specify and derive algorithmic implementations for a general type difference operator that works for other types, including function types, record types and intersection types. When defined in this way, the type difference algebra has many desired properties that are expected from a subtraction operator. Together with a generic merge operator, using type difference we can generalize many operations on records formalized in the literature. To illustrate the usefulness of type difference we create an intermediate calculus with a rich set of operators on expressions of arbitrary type, and demonstrate applications of these operators in CP , a prototype language for Compositional Programming . The semantics of the calculus is given by elaborating into a calculus with disjoint intersection types and a merge operator. We have implemented type difference and all the operators in the CP language. Moreover, all the calculi and related proofs are mechanically formalized in the Coq theorem prover.

链接与引用

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

BibTeX
@article{paperbot2066,
  title = {Making a Type Difference: Subtraction on Intersection Types as Generalized Record Operations},
  author = {Han Xu and Xuejing Huang and Bruno C. d. S. Oliveira},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {7},
  number = {POPL},
  year = {2023},
  doi = {10.1145/3571224}
}