Lambda Calculus
Formal Definition
The syntax of LC defines some expressions (sequence of symbols allowed in LC) as valid and some as invalid. Lambda term is a valid LC expression.
These rules give an inductive definition that can be applied to build all syntactically valid lambda terms:
0: a variable (e.g. x) is a valid lambda term
1: if x and M are lambda terms, then (λx.M) is a lambda term
2: if M and N are lambda terms, then (MN) is a lambda term
nothing else is a lambda term.
Variables Above, the zero rule just states that x is a lambda term, which would imply that x on its own is a lambda term, but that's pretty vague; that x alone is obviously not a function, and it couldn't stand for (represent) some other lambda term (that would be external binding). It can only be a free variable, meaning we're not seeing the entire expression; we have to zoom out to see the acual binding site for that x.
, called a lambda abstraction. , called an application (function application, lambda application).
Application, MN, associate to the left: fxyz is ((fx)y)z
Abstraction, λx.M, associate to the right: λf.xyz λf.(xyz)
Assume given an infinite set V of variables, denoted by x,y,z… The set of lambda terms is given by the following Backus-Naur Form (M and N are lambda terms, x is a variable):
Traditional definition:
Assume given an infinite set V of variables
Let A be an alphabet consisting of the elements of V and the special symbols, λ,
.,(,)Let A∗ be the set of strings (finite sequences) over the alphabet A
The set of lambda terms is the smallest subset Λ⊆A∗ such that:
Whenever x∈V then x∈Λ
Whenever M,N∈Λ then (MN)∈Λ
Whenever x∈V and M∈Λ then λx.M∈Λ
Examples:
Variables:
x,yApplications:
xx,xy,(λx.(xx))(λy.(yy))Abstractions:
λx.x,λf.ff,λf.(λx.(f(fx)))Abstraction and application:
(λx.x)(2),((λf.f(f))(λx.x+2))(3)
This, λx.x+1, defines an anonymous function that takes a parameter x and evaluates (returns) it to x+1. This applies this function to the argument 5: (λx.x+1)(5); the 5 replaces the x in the function's body, so this expression evaluates to 6.
Last updated