Approximate Normalization and Eager Equality Checking for Gradual Inductive Families

07/10/2021
by   Joseph Eremondi, et al.
0

Harnessing the power of dependently typed languages can be difficult. Programmers must manually construct proofs to produce well-typed programs, which is not an easy task. In particular, migrating code to these languages is challenging. Gradual typing can make dependently-typed languages easier to use by mixing static and dynamic checking in a principled way. With gradual types, programmers can incrementally migrate code to a dependently typed language. However, adding gradual types to dependent types creates a new challenge: mixing decidable type-checking and incremental migration in a full-featured language is a precarious balance. Programmers expect type-checking to terminate, but dependent type-checkers evaluate terms at compile time, which is problematic because gradual types can introduce non-termination into an otherwise terminating language. Steps taken to mitigate this non-termination must not jeopardize the smooth transitions between dynamic and static. We present a gradual dependently-typed language that supports inductive type families, has decidable type-checking, and provably supports smooth migration between static and dynamic, as codified by the refined criteria for gradual typing proposed by Siek et al. (2015). Like Eremondi et al. (2019), we use approximate normalization for terminating compile-time evaluation. Unlike Eremondi et al., our normalization does not require comparison of variables, allowing us to show termination with a syntactic model that accommodates inductive types. Moreover, we design a novel a technique for tracking constraints on type indices, so that dynamic constraint violations signal run-time errors eagerly. To facilitate these checks, we define an algebraic notion of gradual precision, axiomatizing certain semantic properties of gradual terms.

READ FULL TEXT
research
06/15/2019

Approximate Normalization for Gradual Dependent Types

Dependent types help programmers write highly reliable code. However, th...
research
05/02/2022

Propositional Equality for Gradual Dependently Typed Programming

Gradual dependent types can help with the incremental adoption of depend...
research
01/28/2021

Putting gradual types to work

In this paper, we describe our experience incorporating gradual types in...
research
12/17/2019

Decidable Tag-Based Semantic Subtyping for Nominal Types, Tuples, and Unions

Semantic subtyping enables simple, set-theoretical reasoning about types...
research
07/02/2018

Shallow Types for Insightful Programs: Grace is Optional, Performance is Not

Languages with explicit dynamic type checking are increasing in populari...
research
02/23/2023

Do Machine Learning Models Produce TypeScript Types That Type Check?

Type migration is the process of adding types to untyped code to gain as...
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