Simply typed lambda calculus |
The simply typed lambda calculus (lambda^ o) is a typed lambda calculus whose only connective is o (function type), thus it is the canonical, and in many ways simplest example of a typed lambda calculus.
The word simple types is also used to refer to extensions of the simply typed lambda calculus such as cartesian products, coproducts or natural numbers (System T) or even full Recursion (like PCF). In contrast, systems which introduce
polymorphic types (like System F) or dependent types (like the Logical Framework) are not considered simply typed . The simply typed lambda calculus was originally introduced by Alonzo Church in 1940 as an attempt to avoid paradoxical uses of the untyped lambda calculus.
= Types =
The types of the simply typed lambda calculus are constructed from base types (or type variables) alpha,eta,gamma,dots and given types sigma, au we can construct sigma o au. Church used only two base types o for the type of propositions and iota for the type of individuals. Frequently the calculus with only one base type, usually o, is considered.
o associates to the right: we read sigma o au o
ho as sigma o( au o
ho). To each type sigma we assign a number o(sigma), the order of sigma. For base types we set o(alpha)=0 and for function types we define recursively o(sigma o au)=mbox{max}(o(sigma)+1,o( au)).
= Terms =
To define the set of well typed lambda terms of a given type, we introduce typing contexts Gamma,Delta,dots which are sequences of typing assumptions of the form x:sigma where x is a variable. We introduce the judgment Gammavdash t : sigma which means that t is a term of type sigma in context Gamma which is given by the following typing rules:
{}over{x:sigma vdash x : sigma}
{Gammavdash x:sigmaquad x
ot=y}over{Gamma.y: au vdash x : sigma}
{Gamma.x:sigmavdash t: au}over{Gammavdash lambda x : sigma.t : sigma o au}
{Gammavdash t:sigma o auquadGammavdash u:sigma}over{Gammavdash t,u : au}
Examples for closed terms are lambda x:alpha.x : alpha oalpha (I), lambda x:alpha.lambda y:eta.x:alpha o eta o alpha (K) and lambda x:alpha oeta ogamma.lambda y:alpha oeta.lambda z:alpha.x z (y z) : (alpha oeta ogamma) o(alpha oeta) ogamma (S) - these are the typed lambda calculus representations of the basic combinators of combinatory logic.
The simply typed lambda calculus is closely related to propositional intuitionistic logic using only implication ( o) as a connective (minimal logic) via the Curry-Howard isomorphism: the types inhabited by closed terms are precisely the tautologies of minimal logic.
Terms of the same type are identified via etaeta-equivalence, which is generated by the equations (lambda x:sigma.t),u =_{eta} t[x:=u], where t[x:=u] stands for t with all free occurrences of x replaced by u, and lambda x:sigma.t,x =_eta t , if x does not appear free in t. The simply typed lambda calculus (with etaeta-equivalence) is the internal language of Cartesian Closed Categories (CCCs), this was first observed by Joachim Lambek.
= Important results =
Tait showed in 1967 that eta-reduction is Normalization property (lambda-calculus). As a corollary etaeta-equivalence is decidability (logic). Statman showed in 1977 that the normalisation problem is not elementary recursive. A purely semantic normalisation proof was given by Berger and Schwichtenberg ( Normalisation by evaluation ) in 1991.
The unification problem for etaeta-equivalence is decidability (logic). Huet showed in 1973 that 3rd order unification is undecidable and this was improved upon by Goldfarb in 1981 by showing that 2nd order unification is already undecidable. Whether higher order matching (unification where only one term contains existential variables) is decidable is still open.
We can encode natural numbers by terms of the type (o o o) o(o o o) (Church numerals). Schwichtenberg showed in 1976 that in lambda^ o exactly the extended polynomials are representable as functions over Church numerals; these are roughly the polynomials closed up under a conditional operator.
A full model of lambda^ o is given by interpreting base types as sets and function types by the set-theoretic function space. Friedman showed in 1975 that this interpretation is complete for etaeta-equivalence, if the base types are interpreted by infinite sets. Statman showed in 1983 that etaeta-equivalence is the maximal equivalence which is typically ambigous ,i.e. closed under type substitutions ( Statman s Typical Ambiguity Theorem ). A corollary of this is that the finite model property holds, i.e. finite sets are sufficient to distinguish terms which are not identified by etaeta-equivalence.
Plotkin introduced logical relations in 1973 to characterize the elements of a model which are definable by lambda terms. In 1993 Jung and Tiuryn showed that a general form of logical relation (Kripke logical relations with varying arity) exactly characterizes lambda definability. Plotkin and Statman conjectured that it is decidable whether a given element of a model generated from finite sets is definable by a lambda term ( Plotkin-Statman-conjecture ). The conjecture was shown to be false by Loader in 1993.
= References =
A. Church: A Formulation of the Simple Theory of Types, JSL 5, 1940
W.W.Tait: Intensional Interpretations of Functionals of Finite Type I, JSL 32(2), 1967
G.D. Plotkin: Lambda-definability and logical relations, Technical report, 1973
G.P. Huet: The Undecidability of Unification in Third Order Logic Information and Control 22(3): 257-267 (1973)
H. Friedman: Equality between functionals. LogicColl. 73, pages 22-37, LNM 453, 1975.
H. Schwichtenberg: Functions definable in the simply-typed lambda calculus, Arch. Math Logik 17 (1976) 113-114.
R. Statman: The Typed lambda-Calculus Is not Elementary Recursive FOCS 1977: 90-94
W. D. Goldfarb: The undecidability of the 2nd order unification problem, TCS (1981), no. 13, 225- 230.
R. Statman. lambda-definable functionals and etaeta conversion. Arch. Math. Logik, 23:21--26, 1983.
J. Lambek: Cartesian Closed Categories and Typed Lambda-calculi. Combinators and Functional Programming Languages 1985: 136-175
U. Berger, H. Schwichtenberg: An Inverse of the Evaluation Functional for Typed lambda-calculus LICS 1991: 203-211
Jung, A.,Tiuryn, J.:A New Characterization of Lambda Definability, TLCA 1993
R. Loader: [http://homepages.ihug.co.nz/~suckfish/papers/Church.pdf The Undecidability of λ-definability], appeared in the Church Festschrift, 2001