通向DOT的途径:形式化完全依赖于路径的类型
A Path To DOT: Formalizing Fully Path-Dependent Types
摘要:
依赖对象类型(DOT)演算旨在形式化Scala编程语言,重点关注路径依赖类型$-$类型,例如依赖于对象路径$x.a_1\dots a_n$的运行时值的$x.a_1\dots a_n.T$。不幸的是,现有的DOT公式只能对依赖于变量而不是一般路径的$x.A$形式的类型进行建模。这种限制使得无法对嵌套的模块依赖进行建模。将小组件嵌套在大组件中是模块化、可伸缩语言的必要组成部分。因此,DOT的变量限制削弱了它完全形式化各种编程语言特性的能力,包括Scala的模块系统、家族多态性和协变专门化。本文介绍了pDOT演算,它将DOT推广到支持依赖于任意长度路径的类型,以及跟踪路径相等的单例类型。我们表明,天真的方法添加路径DOT本质上是不健全的,并提出了必要的条件,这样的微积分是健全的。我们讨论了必要的关键变化,以适应技术的DOT可靠性证明,使它们可以应用于pDOT。我们的论文附带了pDOT的Coq机械化类型安全证明。通过对任意长度路径的支持,pDOT可以实现DOT在形式化类Scala-like演算方面的全部潜力。
英文摘要:
The Dependent Object Types (DOT) calculus aims to formalize the Scala programming language with a focus on path-dependent types $-$ types such as $x.a_1\dots a_n.T$ that depend on the runtime value of a path $x.a_1\dots a_n$ to an object. Unfortunately, existing formulations of DOT can model only types of the form $x.A$ which depend on variables rather than general paths. This restriction makes it impossible to model nested module dependencies. Nesting small components inside larger ones is a necessary ingredient of a modular, scalable language. DOT's variable restriction thus undermines its ability to fully formalize a variety of programming-language features including Scala's module system, family polymorphism, and covariant specialization. This paper presents the pDOT calculus, which generalizes DOT to support types that depend on paths of arbitrary length, as well as singleton types to track path equality. We show that naive approaches to add paths to DOT make it inherently unsound, and present necessary conditions for such a calculus to be sound. We discuss the key changes necessary to adapt the techniques of the DOT soundness proofs so that they can be applied to pDOT. Our paper comes with a Coq-mechanized type-safety proof of pDOT. With support for paths of arbitrary length, pDOT can realize DOT's full potential for formalizing Scala-like calculi.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。