The genericity theorem and parametricity in the polymorphic λ-calculus (original) (raw)

Type reconstruction in finite-rank fragments of the polymorphic λ-calculus

1990

It is proven that the problem of type reconstruction in the polymorphic λ-calculus of rank two is polynomial-time equivalent to the problem of type reconstruction in ML, and is therefore DEXPTIME-complete. It is also proven that for every k>2, the problem of type reconstruction in the polymorphic λ-calculus of rank k, extended with suitably chosen constants with types of rank one, is undecidable

Parametricity, type equality, and higher-order polymorphism

2010

Propositions that express type equality are a frequent ingredient of modern functional programming-they can encode generic functions, dynamic types, and GADTs. Via the Curry-Howard correspondence, these propositions are ordinary types inhabited by proof terms, computed using runtime type representations. In this paper we show that two examples of type equality propositions actually do reflect type equality; they are only inhabited when their arguments are equal and their proofs are unique (up to equivalence.) We show this result in the context of a strongly normalizing language with higher-order polymorphism and primitive recursion over runtime type representations by proving Reynolds's abstraction theorem. We then use this theorem to derive "free" theorems about equality types.

Formal parametric polymorphism

Proceedings of the 20th ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '93, 1993

A polymorphic function is parametric if its behavior does not depend on the type at which it is instantiated. Starting with Reynolds' work, the study of parametricity is typically semantic. In this paper, we develop a syntactic approach to parametricity, and a formal system that embodies this approach: system Z. Girard's system F deals with terms and types; !Ris an extension of F that deals also with relations between types. In %, it is possible to derive theorems about functions from their types, or "theorems for free", as Wadler calls them. An easy "theorem for free" asserts that the type V(X)X+Bool contains only constant functions; this is not provable in F. There are many harder and more substantial examples. Various metatheorems can also be obtained, such as a syntactic version of Reynolds' abstraction theorem.

The typed polymorphic label-selective λ-calculus

Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '94, 1994

Formal calculi of reeord structures have recently been a focus of active mearch. However, scamely anyone has studied formally the dual notion-+. e., argument-passing to functions by keywords, and its harmonization with currying. We have. Recently, we introduced the label-selective A-calculus, a conservative extension of A-calculus that uses a labeling of abstractions and applications to perform unordered cttmying. In other words, it enables some form of commutation between arguments, This improves program legibility, thanks to the presence of labels, and efficiency, thanks to argument commuting. In this paper, we propose a simply typed version of the calculus, then extend it to one with ML-like polymo~hic types. For the latter calculus, we establish the existence of principal types and we give an algorithm to compute them. Thanks to the fact that label-selective A-calculus is a conservative extension of A-calculus by adding numeric labels to stand for argument positions, its polymoqhic typing provides us with a keyword argument-passing extension of ML obviating the need of I-CCO*. In this contex~conventional ML syntax can be seenas a restriction of the mo~geneml keyword-oriented syntax limited to using only implicit positions instead of keywords.

Type Assignment for the Computational lambda-Calculus

arXiv (Cornell University), 2019

We study polymorphic type assignment systems for untyped lambda-calculi with effects. We introduce an intersection type assignment system for Moggi's computational lambda-calculus, where a generic monad T is considered, and provide a concrete model of the calculus via a filter model construction. We prove soundness and completeness of the type system, together with subject reduction and expansion properties.

Theorems for free for free: parametricity, with and without types

Proceedings of the ACM on Programming Languages

The polymorphic blame calculus integrates static typing, including universal types, with dynamic typing. The primary challenge with this integration is preserving parametricity: even dynamically-typed code should satisfy it once it has been cast to a universal type. Ahmed et al. (2011) employ runtime type generation in the polymorphic blame calculus to preserve parametricity, but a proof that it does so has been elusive. Matthews and Ahmed (2008) gave a proof of parametricity for a closely related system that combines ML and Scheme, but later found a flaw in their proof. In this paper we present an improved version of the polymorphic blame calculus and we prove that it satisfies relational parametricity. The proof relies on a step-indexed Kripke logical relation. The step-indexing is required to make the logical relation well-defined in the case for the dynamic type. The possible worlds include the mapping of generated type names to their types and the mapping of type names to relat...

Rewriting with extensional polymorphic λ-calculus

1996

We provide a confluent and strongly normalizing rewriting system, based on expansion rules, for the extensional second order typed lambda calculus with product and unit types: this system corresponds to the Intuitionistic Positive Calculus with implication, conjunction, quantification over proposition and the constant True.

Strong Normalization for the Parameter-Free Polymorphic Lambda Calculus Based on the Ω-Rule

2016

Following Aehlig [3], we consider a hierarchy F = {Fn}n∈N of parameter-free subsystems of System F, where each Fn corresponds to IDn, the theory of n-times iterated inductive definitions (thus our Fn corresponds to the n + 1th system of [3]). We here present two proofs of strong normalization for Fn, which are directly formalizable with inductive definitions. The first one, based on the Joachimski-Matthes method, can be fully formalized in IDn+1. This provides a tight upper bound on the complexity of the normalization theorem for System Fn. The second one, based on the Gödel-Tait method, can be locally formalized in IDn. This provides a direct proof to the known result that the representable functions in Fn are provably total in IDn. In both cases, Buchholz’ Ω-rule plays a central role. 1998 ACM Subject Classification F4.1 Mathematical Logic

Lambda-calculus types and models

2002

Remark. Clearly, if x is a free variable of t , we cannot have t = λx u. If λx u = λx u , then u[x /x] = u [x /x ] = u by lemma 1.15. We prove now that, if u = u[x /x], then λx u = λx u. We may assume that x and x are different, the result being trivial otherwise. Let u be a representative of u, in which the variable x is not bound. Then u = u<x /x> is a representative of u. It is sufficient to show that λx u ≡ λx u , that is to say u<y/x> ≡ u <y/x > for every variable y but a finite number. Now u <y/x > = u<x /x><y/x >. By corollary 1.3, we get : Indeed, (Y)F (G)G, where G = λx(F)(x)x ; therefore : (Y)F (λx(F)(x)x)G (F)(G)G β (F)(Y)F. Q.E.D. Y is known as Curry's fixed point combinator. Note that we have neither (Y)F (F)(Y)F , nor even (Y)F β (F)(Y)F. Proposition 2.10. Let Z be the term (A)A, where A ≡ λaλ f (f)(a)a f. Then, for any term F , we have (Z)F (F)(Z)F. The notation DΩ t : A will mean that t is of type A in the empty context. Note that, because of rule 6, there are terms which are typable in the context Γ, while not all of their free variables are declared in that context.