Lambda Calculus — Definition, Formula & Example
Lambda calculus is a tiny formal language in which every object is a function, and the only way to compute is to plug an input into a function and simplify. Despite having almost no built-in features, it can express any computation a computer can perform.
Fix a countably infinite set of variables. The lambda terms are generated by the grammar : a variable, an abstraction, or an application. Terms that differ only in the names of bound variables are identified (-equivalence). Computation is the -reduction relation , applied to any subterm. Here denotes capture-avoiding substitution. A term with no reducible subterm is in normal form. Application associates to the left, so means . The body of a extends as far right as possible.
Key Formula
Where:
- = An abstraction: a function with parameter x and body M
- = The argument the function is applied to
- = The body M with every free occurrence of x replaced by N, renaming bound variables when needed to avoid capture
- = One step of beta reduction
Worked Example
Problem: In lambda calculus, the Church numeral for a whole number n is the function that applies f to x exactly n times. So . The successor function is . Reduce to normal form.
Step 1: Apply SUCC to its argument. Substitute the numeral for n in the body. The numeral has no free variables, so nothing can be captured.
Step 2: Inside the parentheses, the numeral is applied to f first, because application associates to the left. Substitute the outer f for the numeral's own bound f.
Step 3: Now apply the remaining abstraction to x. No redex is left, so the term is in normal form. Count the applications of f: one from SUCC plus two from the numeral.
Answer: reduces to . This term applies f three times, so it is the Church numeral . Arithmetic emerges from substitution alone.
Why It Matters
In 1936 Alonzo Church used lambda calculus to prove that no algorithm can decide every statement of first-order logic. The same result is known as the unsolvability of the Entscheidungsproblem. Lambda calculus is the core of functional languages such as Haskell, Lisp, and OCaml. Its typed versions underlie proof assistants like Lean and Rocq (formerly Coq), which you meet in theory of computation and programming languages courses.
Common Mistakes
Mistake: Substituting blindly and letting a free variable get captured. For example, reducing to .
Correction: The free y in the argument would become bound, turning a constant function into the identity. Rename the bound variable first: .
