Approximate Normalization for Gradual Dependent Types

06/15/2019
by   Joseph Eremondi, et al.
0

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, with an emphasis on 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.

READ FULL TEXT
research
07/10/2021

Approximate Normalization and Eager Equality Checking for Gradual Inductive Families

Harnessing the power of dependently typed languages can be difficult. Pr...
research
05/02/2022

Propositional Equality for Gradual Dependently Typed Programming

Gradual dependent types can help with the incremental adoption of depend...
research
07/01/2019

The Semantics of Rank Polymorphism

Iverson's APL and its descendants (such as J, K and FISh) are examples o...
research
08/28/2020

Effectiveness of Annotation-Based Static Type Inference

Benefits of static type systems are well-known: they offer guarantees th...
research
08/06/2019

A Dependently Typed Multi-Stage Calculus

We study a dependently typed extension of a multi-stage programming lang...
research
04/27/2023

Traced Types for Safe Strategic Rewriting

Strategy languages enable programmers to compose rewrite rules into stra...
research
10/27/2020

Abstracting Gradual Typing Moving Forward: Precise and Space-Efficient (Technical Report)

Abstracting Gradual Typing (AGT) is a systematic approach to designing g...

Please sign up or login with your details

Forgot password? Click here to reset