Definition
Parametricity is the principle that a polymorphic term behaves uniformly in its type arguments. Formally, one assigns to every type a logical relation , and proves an abstraction theorem of the form
Thus, related inputs are sent to related outputs.
Example
Parametricity strongly constrains a closed term of type
Since such a term has no type-specific way to manufacture or inspect an element of , it must behave uniformly, and in many theories this forces it to act like the identity.
Variants
Parametricity may be:
- external, as a metatheorem proved about a type theory
- internal, where relations or bridges are primitives of the theory
- unary, using predicates
- binary, relating two interpretations of
History
Reynolds introduced the relational account of polymorphism. Bernardy, Jansson, and Paterson extended the translation to dependent type theory.
Related Concepts
Dependent Type Theory
Logical Relation
Polymorphism
Type Theory