Expressions
Start by defining possible expressions, whether meaningful or not. Definition The expressions of the simply-typed λ-calculus are given by the following BNF: A ::= Z | bool | A × A | A ⇒ A M ::= x | n | M op M | true | false | if M then M else M | M, M | π(M) | π′(M) | λx:A.M | MM where n is an integer, op is an arithmetic operation, and x is a variable. We call an expression A a type, and an expression M a term.
Eike Ritter Typed Lambda-Calculus MGS 2010 7
α-equivalence
Functions which differ only in the name of the argument have the same effect and should be identified. Captured by so-called α-equivalence: Definition (i) Let x be a variable. An occurrence of x in M is called bound by the binder λ in λx:A.M′ if the following conditions are satisfied: the term λx:A.M′ is a subterm of M; the occurrence of x is also an occurrence of x in M′; there exists no proper subterm N = λx:B.Q of λx:A.M′ such that the occurrence of x in M is also an occurrence
- f x in N.
(ii) An occurrence of x in M is called free if it is not a bound
- ccurrence.
Eike Ritter Typed Lambda-Calculus MGS 2010 8
Renaming
Definition Let M be a term and let x and y be variables. We define the renaming of x to y in M, which is a term written as M[y/x], by induction over the structure of M as follows: z[y/x]
def
= y if z = x z
- therwise
n[y/x]
def
= n (M op N)[y/x]
def
= M[y/x] op N[y/x] similarly for all other terms except λ (λz:A.M)[y/x]
def
= λz:A.M if z = x λu:A.((M[u/z])[y/x]) if z = y λz:A.(M[y/x])
- therwise
Eike Ritter Typed Lambda-Calculus MGS 2010 9
Use of renaming
Using renaming, we can always ensure that each binder binds a different variable all bound variables differ from all free variables Formally: Theorem Let M be a term. Then there exists a term N which is α-equivalent to M such that if there exists an occurrence x which is bound by a binder λ all occurrences of x are bound by the same binder λ. From now on, consider terms up to α-equivalence. Hence will always make this assumption about bound and free variables.
Eike Ritter Typed Lambda-Calculus MGS 2010 10