|
Logic & Semantics |
Reynolds introduced a semantical notion of parametric polymorphism, involving binary logical relations, in his study of models of the second order lambda calculus (Girard's system F). It is known from the work of Abadi, Cardelli, Curien, Hasegawa, Plotkin, and others, that equality in models of second order lambda calculus has very strong properties if the model supports a Reynolds-style logical relation. (For example, Wadler's "theorems for free" (Wadler 1989) hold.) Unfortunately, second order lambda calculus is a theory of *total* polymorphic functions, and the above results are not immediately applicable to Turing-powerful programming languages combining recursion with polymorphism. Here it is shown how to overcome this problem and reap the rather rich consequences of relational parametric polymorphism for proving contextual equivalences between programs in such languages.