Fall 99, CSE 520: Lectures 1 and 2


The Lambda Calculus

Some history

Type-Free Lambda Calculus

Sintax

The terms of the lambda calculus are constructed over variables and two basic operations:

Formal syntax

Variables: V ::= x | y | z | ...
Lambda-Terms: M ::= V | (\V M) | (M M)

Notational convention

M1M2 ... Mk stands for ( ... (M1M2) ... Mk)
\x1x2 ... xk.M stands for (\x1(\x2 ... (\xk M) ... ))

Free and Bound variables

An occurrence of x is free in M if it is not in the scope of a \x (i.e. is not in a subterm of M of the form \x.N). Is is bound (by the innermost such \x) otherwise. The free variables of M are all the variables which occur free in M. Formally:
FV(x) = {x}
FV(\x.M) = FV(M) - {x}
FV(M N) = FV(M) union FV(N)

Alpha conversion

The alpha conversion (or alpha renaming) axiom formalizes the concept that "the names of bound variables don't matter". Formally:
\x.M =alpha \y.M[y/x]
provided that y is neither free nor bound in M.

Substitution

Given a term M, a variable x, and a term N which does not contain free any of the bound variables of M, the term M[N/x] (also denoted by M[x:=N]) is the term obtained from M by replacing every free occurrence of x by N. Formally:
x[N/x] = N
y[N/x] = y
(\y.M)[N/x] = \x.M[N/x]
(M P)[N/x] = (M[N/x])(P[N/x])

The condition "N does not contain free variables which occur bound in M" is meant to avoid "variable capture". For example, given M = \y.zx, and N = y, if we simply replaced x by N in M, we would obtain the term \y.zy, which is intuitively incorrect since y, which was free in N, would become bound in M[N/x]. (Or in other words, M was constant on y and would become not constant.)

Variable assumption: To avoid the problems related to the "variable capture", we will assume that the free variables are different from the variables which occur bound. Note that this assumption is not restrictive since we can always alpha-rename the bounded variables. Another solution would be to define the notion of substitution so that it renames the variables automatically when needed. For this approach see for instance Hindley and Seldin, Definition 1.1.

Beta conversion

The beta axiom formalizes the concept of transformation which takes place when a function is applied to an argument. Formally:
(\x.M) N =beta M[N/x]
where the variable convention is adopted so to avoid variable capture.

Example: (\x. x+1) 5 =beta 5+1 = 6

The theory of lambda calculus

We will say that M = N is provable in the lambda calculus, or that M and N are lambda-convertible (notation: |- M = N or simply M = N) if M = N can be derived using the alpha axiom, the beta axiom, associativity, reflexivity, transitivity, and the following rules: