Summary: Parametric polymorphism through run-time sealing
or, Theorems for low, low prices!
Jacob Matthews1 and Amal Ahmed2
1 University of Chicago email@example.com
2 Toyota Technological Institute at Chicago firstname.lastname@example.org
Abstract. We show how to extend System F's parametricity guarantee to a Matthews-
Findler-style multi-language system that combines System F with an untyped
language by use of dynamic sealing. While the use of sealing for this purpose
has been suggested before, it has never been proven to preserve parametricity. In
this paper we prove that it does using step-indexed logical relations. Using this
result we show a scheme for implementing parametric higher-order contracts in
an untyped setting which corresponds to a translation given by Sumii and Pierce.
These contracts satisfy rich enough guarantees that we can extract analogues to
Wadler's free theorems that rely on run-time enforcement of dynamic seals.
There have been two major strategies for hiding the implementation details of one part
of a program from its other parts: the static approach and the dynamic approach.
The static approach can be summarized by the slogan "information hiding = para-
metric polymorphism." In it, the language's type system is equipped with a facility
such as existential types so that it can reject programs in which one module makes un-