# Consistency of the Lambda Calculus

We will show that the Lambda Calculus is consistent, in the sense that not all terms are lambda-convertible. In particular, different Church's numerals are not lambda-convertible. Note that if the Church's numerals were all identified by lambda-conversion, then the result of lambda-definability would not be of any interest.

In order to prove the consistency of the lambda calculus, it is convenient to introduce the notion of beta-reduction.

### Beta reduction

The notion of conversion is symmetric, but from a computational point of view the beta rule has a direction. This directionality is captured in the concept of beta-reduction.

The one-step beta reduction, denoted by ->, is the least relation such that:

• (\x. M) N -> M[N/x],
• M =alpha N, N -> N', and N' alpha M' => M -> M'
• M -> N => M P -> N P
• M -> N => P M -> P N
• M -> N => \x. M -> \x. N
Note: The second rule expresses the fact that we want to reason modulo alpha-renaming, i.e. to identify terms which are alpha-convertible.

The multi-step beta reduction, denoted by ->>, is the reflexive and transitive closure of ->, namely:

• M -> N => M ->> N
• M ->> M   (reflexivity)
• M ->> N and N ->> P => M ->> P   (transitivity)
We will say that M is in beta normal form if there exist no N such that M -> N. Note that M is in beta normal form iff M contains no beta-redexes, i.e. no terms of the form (\x. M') N. If M ->> N, and N is in beta normal form, we say that N is the beta normal form of M.

Let us now consider the relation between conversion and reduction. Clearly, by their definitions, we have the following:

Proposition: the lambda-conversion is the reflexive, symmetric, and transitive closure of -> (or equivalently, of ->>).

Let us illustrate what are the difficulties in proving the consistency of the lambda calculus. Intuitively, M = N holds iff one of the following cases hold:
1. M ->> N, or
2. N ->> M, or
3. there exists P such that M ->> P and N ->> P
4. there exists P such that P ->> M and P ->> N
5. a combination of the above cases.
Suppose that we want to prove that [0] and [1] are not lambda convertible. Since [0] and [1] are both in normal form (they contain no beta-redexes), and they are not alpha convertible, then cases (1), (2) and (3) are not possible. Case (5) can be reduced to the others. The only difficult case is (4). In fact, there are infinitely many terms which reduce to [0] and [1]. For example, [plus] [0] [0] ->> [0] and [plus] [1] [0] ->> [1]. Thus, we should now prove that [plus] [0] [0] and [plus] [1] [0] are not lambda convertible, which is a problem more difficult than the original one.

Fortunately, case (4) can be reduced to (3) thanks to the following theorem:

Theorem (Church-Rosser) ->> is confluent. Namely, if P ->> M and P ->> N, then there exists Q such that M ->> Q and N ->> Q.

The property of confluence is also called "diamond property", because of the shape of the diagram that illustrates the property.

Confluence means, essentially, that it does not matter in which order we reduce the beta-redexes inside a term: we can always "rejoin" towards the same term. ("all roads bring to Rome" :-)

Example Consider P =def= [plus] ([times] [1] [2]) ([plus] [3] [4]). Then we have P ->> M and P ->> N, where M =def= [plus] [2] ([plus] [3] [4]) and N =def= [plus] ([times] [1] [2]) [7], i.e. M and N are obtained by reducing different parts of P. Now, by reducing, in both M and N, the other part, we get M ->> [plus] [2] [7] and N ->> [plus] [2] [7].

The example of reduction of operations on numerals is particularly simple; things are much more complicated when we consider reduction of higher-order terms. In that context the confluence property is not so obvious. The proof of this important result, in fact, is rather involved, and we will not see it in the course. The interested reader can find it on the Barendregt's references.

From the confluence property, we have the following:

Corollary If M = N then there exists P such that M ->> P and N ->> P.

Proof. Remember that = is the reflexive, symmetric and transitive closure of ->. This means that = is the least relation such that

1. M -> N => M = N
2. M = M
3. N = M => M = N
4. M = Q and Q = N => M = N
We prove now the statement of the corollary. By induction:
• 1 (Base case). Assume M -> N. Then the statement holds for P =def= N. In fact N ->> N.
• 2 (Base case). Assume M and N are identical. Then define P =def= M and observe that M ->> M.
• 3 (Inductive case). Assume N = M. By inductive hypothesis, we have that here exists P such that N ->> P and M ->> P.
• 4 (Inductive case). Assume M = Q and Q = N. By inductive hypothesis, we have that there exist P1 and P2 such that M ->> P1, Q ->> P1, Q ->> P2, and N ->> P2. Again by confluence, we have that there exists P such that P1 ->> P and P2 ->> P. Therefore we have M ->> P and N ->> P.

As a consequence of the above corollary we have:

Theorem The Lambda Calculus is consistent. In particular, different Church's numerals are not lambda-convertible.

Proof. If [m] = [n], then from previous corollary there must exist P such that [m] ->> P and [n] ->> P. However, Church's numerals are in normal form, i.e. they cannot be reduced. Hence we mush have that [m], P and [n] are identical (modulo alpha-renaming). But, by definition, [m] and [n] are identical only if m and n are the same number.

## On the existence of normal forms

The above results give a method to prove whether two terms M and N are lambda-convertible or not: try to reduce reduce them to their normal forms, say P and Q, and check whether P and Q are identical (modulo alpha conversion). Of course, if a term has a normal form, then it is unique (by confluence).

This method however is not complete, because there exist terms which do not have a normal form. One example of such term is the fixpoint operator Y=def= \y.(\x.y(xx))(\x.y(xx)). In fact, we have

\y.(\x.y(xx))(\x.y(xx)) -> \y.y((\x.y(xx))(\x.y(xx))) -> \y.y(y((\x.y(xx))(\x.y(xx)))) -> ... -> \y.yn ((\x.y(x x))(\x.y(xx))) -> ...

Another example is the term Omega =def= (\x.xx)(\x.xx). We have in fact

Omega -> Omega -> Omega -> ...

In general lambda conversion is semi-decidable, but not decidable. In other words, it is not provable, in general, that two terms are not lambda convertible. The exceptions are, of course, the terms which have a normal form, like the numerals.

Note that there are terms which have a normal form, but also the possibility of an infinite chain of reductions. For example, take the term M =def= [true] [0] Omega. We have M ->> [0], but also M -> M -> M ->... because of the possibility of reducing the last term, Omega. A term which only gives rise to finite chains of reductions (obviously resulting in the same normal form) is called strongly normalizing. A term which has a normal form, but also infinite chains of reductions, is called weakly normalizing.