arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2610.14925cs.PL
收藏

反变宇宙子类型化:形式化与机械化

Contravariant Universe Subtyping, Formalized, Mechanized

The University of Hong Kong(香港大学);Amazon(亚马逊)

Shengyi Jiang, Jason Z. S. Hu

AI总结:

本文针对核心马丁-洛夫类型理论,在Rocq的McTT内核基础上,形式化并机械化研究反变宇宙子类型化,提出两种子类型化算法,通过互模拟关系证明其完备性,完善了类型检查器的已验证流水线。

摘要:

在具有累积宇宙层级的类型理论中,通常会引入子类型化以将较低宇宙层级提升至较高层级。实践中,证明助手的内核通常保守地实现宇宙子类型化:子类型化仅协变地传播到Π类型的输出类型,而输入类型必须等价。全面的子类型化关系还会反变地比较输入类型。然而,反变子类型化未被现有的集合论模型证明合理,且给完整子类型化算法的开发带来挑战。我们提出了\ucdaclttsub,这是对核心马丁-洛夫类型理论(MLTT)的反变宇宙子类型化的完整机械化研究,作为Rocq中已验证的McTT内核的扩展。我们重新建立了句法元理论,以及求值归一化(NbE)算法的可靠性和完备性。为完成类型检查器的已验证流水线,我们给出两种完整且可靠的子类型化算法:第一种算法在每次Π迭代中对输出类型进行重归一化,尽管其完备性证明简单,但会产生额外计算成本;第二种算法因此通过完全避免重归一化来规避该成本,仅递归地结构比较两个已归一化的类型。不过,该算法的语义方法完备性证明需要对子上下文中的归一化进行推理,这超出了当前语义工具的能力范围。相反,我们通过互模拟关系进行程序等价性证明,利用该技术证明NbE算法在子上下文中返回的归一化形式在宇宙层级上相等,并成功得出子类型化算法的完备性。

英文摘要:

In a type theory with a cumulative universe hierarchy, \emph{subtyping} is often incorporated to lift lower universe levels to higher ones. In practice, kernels of proof assistants typically implement universe subtyping conservatively: subtyping only propagates covariantly into the output types of $Π$ types, while input types must be equivalent. A full-blown subtyping relation also compares the input types contravariantly. However, contravariant subtyping is not justified by the existing set-theoretic model, and poses challenges in the development of a complete subtyping algorithm. We present \mclttsub, a complete mechanized study of contravariant universe subtyping for a core Martin-Löf type theory (MLTT), built as an extension of the verified McTT kernel in Rocq. We re-establish the syntactic meta-theory and the soundness and completeness properties of the normalization-by-evaluation (NbE) algorithm. To complete the verified pipeline for a type-checker, we give two complete and sound subtyping algorithms. The first one \emph{renormalizes} output types in every $Π$ iteration. Despite a simple completeness proof, this algorithm incurs additional computational cost. The second algorithm hence circumvents this cost by avoiding the renormalization at all. It simply recursively compares two already normalized types structurally. Nevertheless, a completeness proof of this algorithm in a semantic approach requires to reason about normalization in sub-contexts, a capability beyond what the current semantic gadget offers. Instead, we conduct a program equivalence proof through bisimulation relations. Using this technique, we prove that the NbE algorithm returns equal normal forms in sub-contexts up to universe levels, and successfully conclude the completeness of the subtyping algorithm.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑