Alonzo Church (1903 - 1995)
Lambda Calculus
2
λ-calculus
: syntax
Grammar for terms :
Inductive denition for λ-terms
t, u ::= x
(variable)
tu
(application)
λx.t
(abstraction)
|
x is a variable
|
x is a λ-term
t is a λ-term
Notation :
u is a λ-term
t u is a λ-term
Application is left-associative so that t1 t2 . . . tn means
(. . . (t1 t2 ) . . . tn ).
(App)
(Var)
t is a λ-term
λx.t is a λ-term
(Lamb)
λx1 . . . xn .t means λx1 . . . . λxn .t.
3
4
Free and bound variables
Alpha-conversion
λx.(z x y (λz.z y))
The relation =α , called alpha-conversion, is the congruence
generated by the axiom ∼α . Formally,
The set of free and bound variables are dened as follows
fv(x)
= {x}
fv(t u)
= fv(t) ∪ fv(u) bv(t u)
fv(λx.t) = fv(t) \ {x}
bv(x)
λx.t ∼α λy.t[x//y] for y fresh
= ∅
λx.t =α λy.t[x//y]
= bv(t) ∪ bv(u)
bv(λx.t) = bv(t) ∪ {x}
t=α t′
But for t = x (λx.x)
λx.t=α λx.t′
t=α t′
u=α u′
t u=α t′ u′
fv(x (λx.x)) = {x} = bv(x (λx.x))
5
6
Dening the notion of fresh replacement
The operation t[x//y] means the replacement of all the free
occurrences of x in t by a fresh variable y .
x[x//y]
= y
z[x//y]
= z
(t u)[x//y]
= t[x//y] u[x//y]
Examples
λx.(λx.x z) ∼α λy.(λx.x z) =α λy.(λy.y z)
x (λx.x) =α x (λz.z)
(λx.t)[x//y] = λx.t
(λz.t)[x//y] = λz.t[x//y]
7
8
Barendregt variable convention
Operational semantics of λ-calculus
From now on we assume the following variable convention :
A one-step β -reduction is given inductively by
1. No variable is both free and bound.
2. Bound variables have all dierent names.
(λx.t) u →β t{x/u}
Example : x (λz.z) is OK, x (λx.x) is not OK, λx.λy.x z is OK
but λx.λx.x z is not OK.
t → β t′
t u → β t′ u
Theorem : For every λ-term t there is λ-term u verifying the
Barendregt convention such that t =α u.
t → β t′
λx.t →β λx.t′
u →β u ′
t u →β t u ′
What is exactly _{_/_} ?
Indeed, x (λx.x) =α x (λz.z) and λx.λx.x z =α λy.λx.x z .
9
10
A simple notion of higher-order substitution
Towards a notion of substitution : warning !
t{x/u} means replace all the free occurrences of x in t by u.
This operation is dened modulo α-conversion as follows :
(λx.(λy.x)) y →β (λy.x){x/y} = λy.y
Incorrect
(λx.(λy.x)) y =α (λx.(λz.x)) y →β (λz.x){x/y} = λz.y
x{x/u}
= u
y{x/u}
= y
(λy.v){x/u} = λy.v{x/u} if x ̸= y and y ∈
/ fv(u) (no capture holds)
Correct
(t v){x/u}
11
= (t{x/u} v{x/u})
12
A terminating β -reduction sequences
A non terminating β -reduction sequences
Let Π = λx.f (x x).
(λx.λf.x f y) (λz.z) (λw.w w) →β
(λf.x f y) {x/λz.z} (λw.w w)
=
(λf.(λz.z) f y) (λw.w w)
→β
(λf.f y) (λw.w w)
→β
(f y){f /λw.w w}
=
(λw.w w) y
→β
(w w) {w/y}
=
ΠΠ
→β
(f (x x)){x/Π}
=
f (Π Π)
→β
f (f (x x)){x/Π} =
f (f (Π Π))
..
.
(y y)
→β
13
14
Curry-Howard Isomorphism
Properties of λ-calculus
[Conuence]
The reduction relation →β is conuent.
[Free variables decrease]
Logical system
Propositions
If t →β t′ , then f v(t) ⊇ f v(t′ ).
Proofs
Proof normalisation
15
⇔
⇔
⇔
⇔
Language
Types
Programs
Program Evaluation
16
Adding (simply) types to λ-calculus
Grammar for types :
Curry'58, Howard'68
A, B ::= τ
A→B
(base types)
(functional types)
|
Notation : → is right-associative so that for example
A1 → A2 → A3 means A1 → (A2 → A3 ).
17
Typing Environment
18
Natural deduction as typed λ-calculus
A typing environment Γ is a nite function from variables to types,
usually written x1 : A1 , . . . , xn : An .
Γ, x : A ⊢ x : A
Thus for example, x : A, y : B and y : B, x : A are two dierent
notations for the same typing environment.
Γ, x : A ⊢ t : B
Γ ⊢ λx.t : A → B
The domain of Γ = x1 : A1 , . . . , xn : An , written dom(Γ), is the
set {x1 , . . . , xn }.
We write Γ, x : A for the typing environment extending Γ with the
pair x : A. It is only dened i x ∈
/ dom(Γ).
19
(→ i)
(ax)
Γ⊢t:A→B
Γ⊢u:A
Γ⊢tu:B
(→ e)
We denote by Γ ⊢ t : A the derivability/typing relation. We say
that t is typable i there is Γ and A such that Γ ⊢ t : A.
Remark : Γ ⊢ t : A denotes also a sequent !
20
Examples
Typed Properties
Example of a typable term : (λx.x)(λy.y).
[Subject Reduction]
y:σ→σ⊢y:σ→σ
x:σ⊢x:σ
⊢ λy.y : (σ → σ) → (σ → σ)
⊢ λx.x : σ → σ
Γ ⊢ t′ : A .
If Γ ⊢ t : A and t →β t′ , then
[Strong Normalization]
⊢ (λy.y)(λx.x) : σ → σ
Every typed term is normalising :
if Γ ⊢ t : A, then t ∈ SNβ .
Example of non-typable term : λx.xx.
21
22
Some General Remarks
When using typed terms, the notation t{x/u} means that x and
u have the same type.
t ∈ SNβ
i there is no innite β -reduction sequence starting at t
i every β -reduction sequence starting at t is nite
t ∈ SNβ can also be dened as follows
If t is a β -normal form, then t ∈ SNβ
If ∀t′ [(t →β t′ ) implies t′ ∈ SNβ ], then t ∈ SNβ
If t ∈ SNβ , then every subterm of t is also SNβ .
SNβ is not stable by substitution. Example : x x ∈ SNβ ,
λy.y y ∈ SNβ , but (x x){x/λy.y y} = ∆ ∆ ∈
/ SNβ .
u ∈ SNβ i λy.u ∈ SNβ .
23
u1 , . . . , un ∈ SNβ i x u1 . . . un ∈ SNβ .
Given t ∈ SNβ we dene µβ (t) as the maximal lenght of a
reduction sequence starting at t. We observe that t →β t′
implies µβ (t′ ) < µβ (t).
Every type A can be written as A1 → . . . → An → τ , where
A1 , . . . , An (n ≥ 0) are arbitrary types and τ is a base type.
The standard order between types is given by
A < A → B and B < A → B .
Thus base types are minimal with respect this order.
24
Lemma : [Basic Lemma] If t, R1 , . . . , Rn (n ≥ 1) ∈ SNβ
and
t{x/R1 }R2 . . . Rn ∈ SNβ , then (λx.t)R1 R2 . . . Rn ∈ SNβ .
First Proof of the SN property
It is sucient to show that all the reducts of
(λx.t)R1 . . . Rn are in SNβ . We reason by induction on
µ(t) + Σi µ(Ri ). The reducts are
(λx.t′ )R1 . . . Rn , where t → t′ . Then µ(t′ ) < µ(t), we conclude
by the i.h.
(λx.t)R1 . . . Ri′ . . . Rn , where Ri → Ri′ . Then µ(Ri′ ) < µ(Ri ),
we conclude by the i.h.
t{x/R1 }R2 . . . Rn . We conclude by the hypothesis.
Dénition : Let M
Proof.
be of type A = A1 → . . . → An → τ . Then
M ∈ SC i ∀Ri : Ai ∈ SC M R1 . . . Rn ∈ SNβ .
The denition implies
1. SC ⊆ SN .
2. SC is closed under β .
3. x ∈ SC for every variable x (using 1).
25
26
Lemma : Let M
be a typed term. Let σ be a type preserving
substitution mapping all the free variables of M to terms in SC.
Then M σ ∈ SC .
Proof.
We proceed by induction on the typed term M .
Lemma : Every typed term is SC.
If M = x, then xσ = σ(x) ∈ SC by hypothesis.
If M = N L, then let R⃗n ∈ SC . We have N σ and Lσ in SC by
i.h. Then (N L)σ R⃗n = N σ Lσ R⃗n ∈ SNβ by denition.
If M = λx.N , then (λx.N )σ = λx.N σ . Since σ ∪ {x/x}
veries the hypothesis of the lemma, then by the i.h.
N (σ ∪ {x/x}) = N σ ∈ SC ⊆ SNβ . To show λx.N σ ∈ SC we
show (λx.N σ)P1 . . . Pn ∈ SNβ for P1 . . . Pn ∈ SC ⊆ SNβ .
This follows from the Basic Lemma.
27
Using the previous lemma with the identity substitution
(which veries the hypothesis of the lemma).
Proof.
Theorem : Every typed term is in SNβ .
Proof.
Using the previous lemma and the fact the SC ⊆ SNβ .
28
Second proof of the SN property
1. Dene SN inductively :
M1 , . . . , Mn ∈ SN implies x M1 . . . Mn ∈ SN .
M ∈ SN implies λx.M ∈ SN .
M {x/N }P⃗n ∈ SN and N ∈ SN implies
(λx.M ) N P⃗n ∈ SN .
5. Show SN = SNβ (in fact SN ⊆ SNβ suces).
6. Show ΛA→B = ΛA → ΛB
7. Show SNA → SNB ⊆ SNA→B (easy).
2. Dene ΛA inductively :
If x is a variable of type A, then x ∈ ΛA .
If t ∈ ΛC and x is a variable of type B , then λx.t ∈ ΛB→C .
If t ∈ ΛB→A and u ∈ ΛB , then t u ∈ ΛA .
3. Dene SNA = SN ∩ ΛA .
8. If N ∈ SNA1 → SNA2 → . . . → SNAm with Am a base type
and P ∈ SNB , then P {x/N } ∈ SNB (induction on SN
using 7).
9. Show SNA→B ⊆ SNA → SNB (using 8).
10. Show that ΛA ⊆ SNA (by induction using 9).
4. Dene X → Y = {M | ∀N ∈ X (M N ) ∈ Y }
29
Third Proof of the SN property
Lemma : If t and u are typed and belong to SNβ , then
t{x/u} ∈ SNβ .
Proof.
By induction on ⟨type(u), µ(t), size(t)⟩.
The base case ⟨ base type, 0, 1 ⟩ is trivial.
Case t = λy.v is straightforward (size(t) strictly decreases).
Case t = y c⃗n with x ̸= y is straightforward (µ(t) decreases and
size(t) strictly decreases.).
Case t = x. We have x{x/u} = u ∈ SNβ by hypothesis.
Case t = x b c⃗n . By i.h. B = b{x/u} and Ci = ci {x/u} are in
SNβ . We want to show that u B C⃗n ∈ SNβ . It is sucient to
show that all its reducts are in SNβ . We reason by induction on
31
30
µ(u) + µ(B) + Σi µ(Ci ). The reducts are
u′ B C⃗n , where u → u′ . Apply the i.h.
u B ′ C⃗n , where B → B ′ . Apply the i.h.
u′ B C1 . . . Ci′ . . . Cn , where Ci → Ci′ . Apply the i.h.
u1 {y/B}C⃗n , where u = λy.u1 . But
u1 {y/B}C⃗n = (z C⃗n ){z/u1 {y/B}} and
type(u1 {y/B}) < type(u). We thus conclude by the i.h. since
z C⃗n and u1 {y/B} are typed and in SNβ by the i.h..
Case t = (λz.b) c d⃗. By i.h. B = b{x/u} and C = c{x/u} and
Di = di {x/u} are in SNβ . Suppose
t{x/u} = (λz.B) C D⃗n ∈
/ SNβ . Then B{z/C} D⃗n ∈
/ SNβ .
⃗
⃗
⃗
But B{z/C} Dn = (b{z/c}dn ){x/u} and µ(b{z/c}dn ) < µ(t).
Thus B{z/C} D⃗n ∈ SNβ by the i.h. Contradiction. Thus
t{x/u} = (λz.B) C D⃗n ∈ SNβ .
32
Fourth proof of the SN property
Theorem : If t is typable, then t ∈ SNβ .
By induction on the typing derivation of t.
Case t = x is trivial.
Case t = λy.u holds by the i.h.
For the case t = u v use the fact that t = (z v){z/u} and apply
previous lemma (verication of the hypothesis is easy).
Proof.
33
See for example Gandy's proof by Alexandre Miquel.
A combinatorial proof of strong normalisation for the simply typed
lambda-calculus.
http://www.pps.univ-paris-diderot.fr/~miquel/publis/
snlam.pdf
34
© Copyright 2026 Paperzz