arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1906.06469cs.PL
收藏

渐进相依类型的近似正规化

Approximate Normalization for Gradual Dependent Types

Joseph Eremondi, Éric Tanter, Ronald Garcia

摘要:

依赖类型帮助程序员编写高度可靠的代码。然而,这种可靠性是有代价的:用依赖类型的程序设计语言编写新原型(或将旧代码迁移到依赖类型的编程语言)可能是一个挑战。渐进类型使静态类型规则更加灵活,因此适当的渐进依赖类型概念可以有效地降低这种成本。然而,依赖类型对渐进类型化提出了独特的挑战。依赖类型检查涉及程序代码的执行,但渐进类型的代码可以发出运行时类型错误或发散的信号。这些运行时错误威胁着可靠性保证,而可靠性保证使依赖类型如此有吸引力,而发散则破坏了类型驱动的编程体验。本文介绍了GDTL,一个渐进的依赖类型语言,强调实用的依赖类型编程。GDTL完全嵌入了无类型和依赖类型语言,并允许两者之间的平滑过渡。除了渐变类型,我们还引入了渐变项,它允许用户在类型索引中不精确,并省略证明项;运行时检查确保类型安全。为了解释非终止和失败,我们区分编译时规范化和运行时执行:编译时规范化是近似的,但总的,而运行时执行是精确的,但可能失败或发散。我们证明了GDTL具有可判定的类型检查,并满足渐进语言的所有预期性质。特别是,GDTL满足静态和动态渐进保证:降低类型精度保持类型性,改变类型精度不会改变动态类型失败之外的程序行为。为了证明这些性质,我们建立了一个新的归一化渐进保证,该保证捕获了近似归一化相对于不精确性的单调性。

英文摘要:

Dependent types help programmers write highly reliable code. However, this reliability comes at a cost: it can be challenging to write new prototypes in (or migrate old code to) dependently-typed programming languages. Gradual typing makes static type disciplines more flexible, so an appropriate notion of gradual dependent types could fruitfully lower this cost. However, dependent types raise unique challenges for gradual typing. Dependent typechecking involves the execution of program code, but gradually-typed code can signal runtime type errors or diverge. These runtime errors threaten the soundness guarantees that make dependent types so attractive, while divergence spoils the type-driven programming experience. This paper presents GDTL, a gradual dependently-typed language that emphasizes pragmatic dependently-typed programming. GDTL fully embeds both an untyped and dependently-typed language, and allows for smooth transitions between the two. In addition to gradual types we introduce gradual terms , which allow the user to be imprecise in type indices and to omit proof terms; runtime checks ensure type safety . To account for nontermination and failure, we distinguish between compile-time normalization and run-time execution: compile-time normalization is approximate but total, while runtime execution is exact , but may fail or diverge. We prove that GDTL has decidable typechecking and satisfies all the expected properties of gradual languages. In particular, GDTL satisfies the static and dynamic gradual guarantees: reducing type precision preserves typedness, and altering type precision does not change program behavior outside of dynamic type failures. To prove these properties, we were led to establish a novel normalization gradual guarantee that captures the monotonicity of approximate normalization with respect to imprecision.

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

↑