一句话:提出 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.
@article{paperbot599,
title = {Approximate normalization for gradual dependent types},
author = {Joseph Eremondi and Éric Tanter and Ronald Garcia},
journal = {Proceedings of the ACM on Programming Languages},
volume = {3},
number = {ICFP},
year = {2019},
doi = {10.1145/3341692}
}