computability
Lambda Calculus
You should know: church turing thesis
Overview
The lambda calculus is a formal system, introduced by Alonzo Church in the 1930s, for expressing computation purely in terms of function abstraction and application — there are no built-in numbers, loops, or data structures, only variables, functions of one argument, and the act of applying one term to another. Despite this austerity, it is Turing-complete: every effectively computable function can be encoded as a lambda term, with the reduction rules of the calculus (chiefly beta-reduction, substituting an argument into a function body) serving as its notion of 'computation step.' Lambda calculus predates electronic computers and today underlies the theoretical foundations of functional programming languages (Lisp, Haskell, ML) and the semantics of anonymous functions ('lambdas') found in nearly every modern programming language.
Intuition
Think of a lambda term as an anonymous recipe with one blank to fill in: λx. x + 1 is the recipe 'take a number and add one,' with no name attached. Applying it to an argument — plugging 5 into the blank — is beta-reduction: (λx. x + 1) 5 reduces to 5 + 1. Everything in the calculus — numbers, booleans, pairs, loops via recursion — is built by nesting these anonymous, single-argument function recipes and repeatedly substituting arguments into bodies until no more substitutions are possible (or the process runs forever, which is itself a meaningful outcome: divergence).
Formal Definition
The set of lambda terms (Λ) is defined by three grammar rules, together with the beta-reduction rule that gives the calculus its computational content:
Notation
| Notation | Meaning |
|---|---|
| Abstraction: a function of one argument x with body M | |
| Application: apply function M to argument N | |
| One step of beta-reduction | |
| Substitution of N for free occurrences of x in M |
Theorems
Applications
Worked Examples
Apply the outer abstraction: substitute (λy. y) for x in the body 'x x'.
Now apply (λy. y) to the argument (λy. y): substitute (λy. y) for y in the body 'y'.
Answer: The term reduces to λy. y (the identity function) in exactly two beta-reduction steps; no further reductions apply, so this is the normal form.
Practice Problems
Beta-reduce (λx. λy. x) A B (the Church encoding of TRUE applied to A then B) to normal form.
What does the Church-Rosser theorem guarantee about a lambda term that has a normal form, even if two different reduction strategies are used to reach it?
A student claims they can write a general-purpose lambda term EQUAL that takes any two lambda terms and always correctly decides (returning TRUE or FALSE, and always halting) whether they are beta-equivalent. Is this possible?
Common Mistakes
Thinking lambda calculus needs built-in numbers, booleans, or loops to be a full model of computation.
Church encodings represent all of these purely as lambda terms (e.g. Church numerals for naturals, λx.λy.x / λx.λy.y for TRUE/FALSE) — the untyped lambda calculus with only variables, abstraction, and application is already Turing-complete.
Believing beta-reduction order affects the final answer when a normal form exists.
The Church-Rosser theorem guarantees confluence: whichever reduction order is used, if a normal form is reached at all, it is the same normal form (up to renaming bound variables) — though some orders (like normal-order/call-by-name) are guaranteed to find it when one exists, while others (like call-by-value) may loop forever even though a normal form exists elsewhere.
Quiz
Flashcards
Historical Background
Alonzo Church developed the lambda calculus in the early 1930s as part of an attempt to build a foundational system for logic, originally intending it as a full foundation for mathematics before contradictions (Kleene-Rosser paradox) forced him to isolate the purely computational fragment now called the (untyped) lambda calculus. In 1936, Church used it to give a negative answer to Hilbert's Entscheidungsproblem by showing no algorithm can decide, in general, whether two lambda terms are equivalent — the same year Alan Turing gave an independent negative answer using Turing machines. Stephen Kleene and J.B. Rosser later proved Church's lambda-definable functions and Turing's computable functions coincide exactly.
- 1932
Alonzo Church introduces the lambda calculus as part of a foundational logic system
Alonzo Church
- 1935
The Kleene-Rosser paradox shows Church's full system is inconsistent; the pure lambda calculus (computation only) survives
Stephen Kleene, J.B. Rosser
- 1936
Church proves the Entscheidungsproblem is unsolvable using lambda-definability; Turing does so independently with Turing machines
Alonzo Church, Alan Turing
- 1936
Kleene proves lambda-definable functions coincide with the general recursive functions
Stephen Kleene
Summary
- Lambda calculus builds all computation from just three constructs: variables, function abstraction (λx.M), and application (M N).
- Beta-reduction, (λx.M) N →β M[x := N], is the calculus's sole computation rule.
- The Church-Rosser theorem guarantees confluence: reduction order never changes the final normal form, if one exists.
- Lambda calculus is Turing-complete (Kleene, 1936) and beta-equivalence of arbitrary terms is undecidable, mirroring the halting problem.
- It underlies functional programming languages and the anonymous 'lambda' functions found in most modern languages.
References
- WebsiteWikipedia — Lambda calculus
Mathematics