paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Sound and complete bidirectional typechecking for higher-rank polymorphism with existentials and indexed types

高阶多态、存在类型与索引类型的可靠且完备的双向类型检查
POPL 3(POPL)2019匹配度 2/10 · 论文属于类型系统与双向类型检查的形式化工作,与用户关注的 PL 与 LLM/Agent 交叉、静态分析工具落地、浮点程序分析或贝叶斯程序分析没有直接关系。虽同属程序语言与形式化验证大方向,但不命中当前核心研究问题。引用 23 inbox
Jana Dunfield, Neelakantan R. Krishnaswami
crossref: 2026-09-10

AI 速览

一句话:基于聚焦(focalization)给出支持高阶多态、存在类型与索引类型(GADT)的双向类型检查声明式规范与算法规则,并证明其可靠完备。

双向类型检查因适用范围广、错误报告友好、易于实现而流行,但其在索引类型(广义代数数据类型,GADT)上的原则尚不清晰。本文基于等式的证明论处理,用聚焦(focalization)给出声明式类型规范:既给出模式匹配覆盖的声明式规则,也通过聚焦的子类型判定支持一阶存在类型;并用精化类型避免在项语法中显式传递等式证明,使演算接近 Haskell 与 OCaml。作者进一步加入判定类型是否为主类型(principal)的规则,使带大量类型推断的丰富类型系统获得完备的声明式规范。最后给出算法类型规则,并证明其相对声明式系统可靠且完备,证明需要若干技术创新,包括以互相递归的方式证明可靠性与完备性。

问题
双向类型检查的原则在索引类型(GADT)上尚不清晰,难以同时支持高阶多态、存在类型与模式匹配覆盖,并兼顾类型推断的完备性。
方法
借鉴等式的证明论处理,以聚焦(focalization)构造声明式类型规范,用精化类型隐藏等式证明,并加入判定主类型的规则;随后给出对应的算法类型规则。
评估
通过互相递归的可靠性与完备性证明,论证算法规则相对于声明式规范的正确性。
原文摘要(Abstract)

Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its applicability to a variety of type systems, its error reporting, and its ease of implementation. Following principles from proof theory, bidirectional typing can be applied to many type constructs. The principles underlying a bidirectional approach to indexed types (generalized algebraic datatypes) are less clear. Building on proof-theoretic treatments of equality, we give a declarative specification of typing based on focalization. This approach permits declarative rules for coverage of pattern matching, as well as support for first-class existential types using a focalized subtyping judgment. We use refinement types to avoid explicitly passing equality proofs in our term syntax, making our calculus similar to languages such as Haskell and OCaml. We also extend the declarative specification with an explicit rules for deducing when a type is principal, permitting us to give a complete declarative specification for a rich type system with significant type inference. We also give a set of algorithmic typing rules, and prove that it is sound and complete with respect to the declarative system. The proof requires a number of technical innovations, including proving soundness and completeness in a mutually recursive fashion.

链接与引用

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

BibTeX
@article{paperbot667,
  title = {Sound and complete bidirectional typechecking for higher-rank polymorphism with existentials and indexed types},
  author = {Jana Dunfield and Neelakantan R. Krishnaswami},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {3},
  number = {POPL},
  year = {2019},
  doi = {10.1145/3290322}
}