This repository contains mechanizations of different semantics for monotonic references to enable efficient gradual typing. To handle correctness in the case of cyclic casts for structural types, monotonic references write cast expressions to the heap that is reduced using a small-step reduction relation where intermediate redexes are also written to the heap. Another approach is to write values only to the heap and maintain a queue of casts on addresses. We mechanize both approaches, both with simple coercions and with space-efficient coercions.
You will need to have the following dependencies installed:
Agda standard library++ is part of the Metaborg project and is used in the work presented by POPL'18 paper Intrinsically-Typed Interpreters for Imperative Languages. I maintain a fork to work with the latest version of Agda standard library, which can be installed by executing make lib
.
-
Simple Semantics With Evolving Stores: Type safety proof for a space-inefficient variation of monotonic references with evolving stores. Type preservation is proved by construction for all reduction rules. On the other hand, the progress proof consists of two parts, progress proof for when the store contains values only and one for when there is at least one delayed cast expression that is not a value.
-
Efficient Semantics With Evolving Stores: Type safety proof for a space-efficient variation of monotonic references. To establish space efficiency, a normal form grammar for coercions is defined along with a composition operator. The termination of composition is also established by reasoning about the sizes of coercions in each case. A height bound on coercion creation and composition is also provided. Type preservation and progress for both cases of a normal store and evolving store are proved.
-
Simple Semantics With A Queue: A space-inefficient variation of monotonic references with a queue on the side. Type preservation is proved by construction for all reduction rules. On the other hand, the progress proof consists of two parts, progress proof for when the queue is empty and one for when the queue is not empty.
-
Efficient Semantics With A Queue: A space-efficient variation of monotonic references with a queue on the side. Coercions are the same as the ones in the efficient semantics with evolving stores. Type preservation and progress for both cases of an empty queue and not an empty queue are proved.