Notes On Lambda Calculus: Tytus Metrycki
Notes On Lambda Calculus: Tytus Metrycki
Tytus Metrycki
Definition 1. Pre-terms
Let
V = {vi : i ∈ N}
denote an infinite alphabet. The set Λ− (pre-terms) is defined by following
grammar
Λ− ::= V | (Λ− Λ− ) | (λ V Λ− )
Remark 1. The expression will be surrounded by parenthesis when needed
to avoid ambiguity. Otherwise: the convection I use is left-to-right function
application.
• (λ v0 . v0 )(λ v1 . v1 v1 )
Notation 1. I will use uppercase letter to denote arbitrary elements of Λ− and
lowercase to denote arbitrary elements of V
Notation 2. I will write λ v0 . . . vn . M for λv0 . . . vn M
F V (x) := {x}
F V (λ x. M ) := F V (P ) \ {x}
F V (P Q) := F V (P ) ∪ F V (Q)
1
Definition 5. Substitution
For M, N ∈ Λ− and x ∈ V the substation of N for x in M , written M [x :=
N ] ∈ Λ− is defined as follows
x[x := N ] ≡ N
y[x := N ] ≡ y
(P Q)[x := N ] ≡ P [x := N ]Q[x := N ]
(λ x. P )[x := N ] ≡ λ x. P
(λ y. P )[x := N ] ≡ λ y. P [x := N ] if y 6∈ F V (N ) or x 6∈ F V (P )
(λ y. P )[x := N ] ≡ λ z. P [y := z][x := N ] if y ∈ F V (N ) and x ∈ F V (P )
∀ P ∈ Λ− : P =α P
∀ y 6∈ F V (P ) : λ x. P =α λ y. P [x := y]
P =α P 0 =⇒ ∀ x ∈ V : λ x. P =α λ x. P 0
P =α P 0 =⇒ ∀ Z ∈ Λ− : P Z =α P 0 Z
P =α P 0 =⇒ ∀ Z ∈ Λ− : ZP =α ZP 0
Definition 7. λ−terms
The set of lambda term is defined as an equivalence relation α on Λ− .
Symbolically:
Λ = Λ− / =α = {[M ]α : M ∈ Λ− }
Remark 3. From now on we will informally write M instead of [M ]α since we
don’t care much about pre-terms. Except when explicitly stated otherwise.
Definition 8. Free variables in Λ
Let M ∈ Λ. We define F V (M ) ⊆ V (free variables) as follows:
F V (x) := {x}
F V (λ x. M ) := F V (P ) \ {x}
F V (P Q) := F V (P ) ∪ F V (Q)
2
is defined as follows
x[x := N ] ≡ N
y[x := N ] ≡ y if x 6= y
(P Q)[x := N ] ≡ P [x := N ]Q[x := N ]
(λ y. P )[x := N ] ≡ λ y. P [x := N ] if y 6∈ F V (N ) or x 6∈ F V (P )
(λ x. P )Q →β P [x := Q]