freetheorem
Free theorems are theorems about polymorphic functions that can be derived from a function’s type signature alone, under the principle of relational parametricity. They describe how such functions must behave uniformly across all instantiations of their type variables, without relying on the concrete values they process. The concept, developed in the study of parametric polymorphism, was popularized by Philip Wadler in Theorems for Free, building on Reynolds’ work on relational parametricity. These theorems let programmers reason about generic functions and libraries without knowing their implementations, expressing laws that must hold for all possible definitions.
A classic example is a function f with the type forall a. a -> a. By parametricity, f
Free theorems are used to reason about abstract interfaces, verify simple properties of polymorphic code, and
For further reading, see Reynolds’ relational parametricity and Wadler’s Theorems for Free.