Basics of the Untyped Lambda Calculus
1Introduction
This lecture explains the syntax and beta-reduction of the untyped lambda calculus. It reviews free variables and alpha-equivalence before beta-reduction because substitution must avoid variable capture. No typing judgment is introduced here.
21. Syntax and association conventions
Let the set of variables be countably infinite. Lambda terms are defined inductively by
The term is a lambda abstraction that binds , and is an application. Application associates to the left, and the body of an abstraction extends as far right as possible. Thus and .
32. Free variables and alpha-equivalence
The set of free variables is defined by
Terms that differ only by a consistent renaming of bound variables are alpha-equivalent. For example, . A binder cannot, however, be renamed to when occurs free in its body.
43. Capture-avoiding substitution
The term replaces every free occurrence of in with . If , then . Its variable and application cases follow the term structure. The abstraction case is
where the last case chooses a fresh variable that differs from and does not occur anywhere in either or . For example, directly producing from would capture the free of the substituted term. Alpha-renaming first gives .
54. Beta-reduction and normal forms
A subterm of the form is a beta-redex. Capture-avoiding substitution contracts it as follows:
A beta-redex at any position in a term may be contracted in one step. A term containing no beta-redex is a beta-normal form.
In contrast, the only beta-redex of is the whole term, and contracting it returns . Hence no reduction sequence reaches a beta-normal form. The untyped lambda calculus does not guarantee termination in general.
65. Evaluation strategies
Beta-reduction does not prescribe an order for selecting redexes. Normal order selects the leftmost outermost redex, whereas applicative order selects the leftmost innermost redex; the two strategies can have different termination behavior. Consider
Normal order contracts the outer redex first and reaches . Applicative order repeatedly reduces and does not terminate. This is a difference in strategy termination, not a difference in the beta-reduction rule. If a term has a beta-normal form, normal-order reduction reaches it.
76. Distinguishing eta-conversion
When , the eta-conversion expresses extensional identification of functions. It is distinct from beta-reduction, which performs function application.
8Summary
Computation in the untyped lambda calculus is beta-reduction by capture-avoiding substitution, considered modulo alpha-equivalence. The existence of a normal form must be distinguished from termination under a particular evaluation strategy.
data/lecture/information/programming-languages/foundation/substitution-and-alpha-equivalence-basics.lecture.n.md