Graduality from Embedding-projection Pairs (Extended Version)

07/08/2018
by   Max S. New, et al.
0

Gradually typed languages allow statically typed and dynamically typed code to interact while maintaining benefits of both styles. The key to reasoning about these mixed programs is Siek-Vitousek-Cimini-Boyland's (dynamic) gradual guarantee, which says that giving components of a program more precise types only adds runtime type checking, and does not otherwise change behavior. In this paper, we give a semantic reformulation of the gradual guarantee called graduality. We change the name to promote the analogy that graduality is to gradual typing what parametricity is to polymorphism. Each gives a local-to-global, syntactic-to-semantic reasoning principle that is formulated in terms of a kind of observational approximation. Utilizing the analogy, we develop a novel logical relation for proving graduality. We show that embedding-projection pairs (ep pairs) are to graduality what relations are to parametricity. We argue that casts between two types where one is "more dynamic" (less precise) than the other necessarily form an ep pair, and we use this to cleanly prove the graduality cases for casts from the ep-pair property. To construct ep pairs, we give an analysis of the type dynamism relation (also known as type precision or naive subtyping) that interprets the rules for type dynamism as compositional constructions on ep pairs, analogous to the coercion interpretation of subtyping.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

11/06/2018

Gradual Type Theory (Extended Version)

Gradually typed languages are designed to support both dynamically typed...
08/12/2018

Typed Closure Conversion for the Calculus of Constructions

Dependently typed languages such as Coq are used to specify and verify t...
03/28/2020

First-order Gradual Information Flow Types with Gradual Guarantees

Gradual type systems seamlessly integrate statically-typed programs with...
06/15/2019

Approximate Normalization for Gradual Dependent Types

Dependent types help programmers write highly reliable code. However, th...
01/28/2021

Putting gradual types to work

In this paper, we describe our experience incorporating gradual types in...
11/11/2021

Avoiding a pair of patterns in multisets and compositions

In this paper, we study the Wilf-type equivalence relations among multis...
07/12/2018

Gradual Parametricity, Revisited (with Appendix)

Bringing the benefits of gradual typing to a language with parametric po...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.