paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Distributing intersection and union types with splits and duality (functional pearl)

用分裂与对偶分配交类型和并类型(函数式珍珠)
ICFP 5(ICFP)2021匹配度 2/10 · 该论文属于类型系统与逻辑中的子类型判定算法,虽与程序语言理论相关,但并未涉及静态分析在机器学习/Agentic 程序中的应用、LLM 辅助静态分析/形式化验证、浮点程序分析或贝叶斯程序分析等用户核心研究方向。引用 4 inbox
Xuejing Huang, Bruno C. d. S. Oliveira
crossref: 2026-09-10

AI 速览

一句话:提出直接作用于源类型的交/并/函数子类型算法,基于 duotyping 与可分裂类型,可判定且实现简洁。

交类型和并类型在现代编程语言中很常见;从逻辑看,子类型问题等价于判定逻辑蕴涵,但同时处理交、并、蕴含及分配律的算法非常复杂。本文提出一种新的子类型(与逻辑蕴涵)算法,直接作用于源类型,无需先做范式化。核心基于两个近期思想:以语言构造对偶性为基础的 duotyping,以及可分裂类型(splittable types),即能分解为两个更简单类型的类型。作者证明该算法相对于基于最小相关逻辑 B+ 的声明式子类型定义是可靠、完备且可判定的,并用不到 50 行函数式代码实现了该算法。

问题
在交、并、函数类型及其分配律同时存在时,如何直接判定子类型与逻辑蕴涵,避免先对类型做范式化。
方法
基于 duotyping 和 splittable types,给出直接作用于源类型的子类型(与逻辑蕴涵)算法。
评估
相对于基于最小相关逻辑 B+ 的声明式子类型定义,证明算法可靠、完备且可判定,并给出不到 50 行函数式代码的简洁实现。
原文摘要(Abstract)

Subtyping with intersection and union types is nowadays common in many programming languages. From the perspective of logic, the subtyping problem is essentially the problem of determining logical entailment : does a logical statement follow from another one? Unfortunately, algorithms for deciding subtyping and logical entailment with intersections, unions and various distributivity laws can be highly non-trivial. This functional pearl presents a novel algorithmic formulation for subtyping (and logical entailment) in the presence of various distributivity rules between intersections, unions and implications (i.e. function types). Unlike many existing algorithms which first normalize types and then apply a subtyping algorithm on the normalized types, our new subtyping algorithm works directly on source types. Our algorithm is based on two recent ideas: a generalization of subtyping based on the duality of language constructs called duotyping ; and splittable types , which characterize types that decompose into two simpler types. We show that our algorithm is sound, complete and decidable with respect to a declarative formulation of subtyping based on the minimal relevant logic B + . Moreover, it leads to a simple and compact implementation in under 50 lines of functional code.

链接与引用

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

BibTeX
@article{paperbot1110,
  title = {Distributing intersection and union types with splits and duality (functional pearl)},
  author = {Xuejing Huang and Bruno C. d. S. Oliveira},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {5},
  number = {ICFP},
  year = {2021},
  doi = {10.1145/3473594}
}