Lemma Sub.3

Let E1 and E2 be expressions of the -calculus Let x be a variable, and let y FV(E1) be a variable. Then E1[x:=E2] = (E1[x:=y])[y:=E2]

Proof.

If y=x then using Lemma Sub.2

Otherwise, if x y we proceed by induction on the height of the expression being substituted in.

Base Case Let E1 be an expression of height 0. Then we have the following cases:

Inductive step:

Suppose for some n, for all i n

Consider an expression E of height n+1. We must show that our result holds for E. E can be formed by application (case S4) of the definition of substitution, or by -abstraction (cases S5-S7).

-reduction

We observed early on that the meaning of

and the meaning of (+ 5) were both the function "add 5". This observation can be generalised and encoded as a reduction rule.

For the pure -calculus, the rule can be stated:

In an impure -calculus, it is customary to restrict the -rule to the case in which E denotes a function.

-reduction and laws

When we originally defined the -calculus we specified that it could (and indeed would) contain constants, including the natural numbers 0,1,2,3.... However, we haven't said how to do anything with these constants. For example, we can form the expression (+ 2 3), but have no rules for reducing it further. Since being able to perform arithmetic is a capability built-in to all real computers it makes sense to extend the - calculus to allow expressions which correspond to standard computations that are built-in to computers to be performed. It is the role of -reduction to do this. we have to admit -reduction, and its inverse, into our rules for equality, together with the laws of the algebra(s) to which the constants belong. Thus