E1 = E2where E1 are E2 are expressions containing some (zero, one, or several) occurrences of x.
A solution for the above equation is any value v such that
E1[v/x] = E2[v/x] holds (i.e. this equality is a consequence of the theory)where [v/x] represents the substitution of v for x. Of course, an equation can have zero, one, or several solutions.
x = (2*x3 - 6) / 5has solution x = 2, in fact
2 = (2*23 - 6) / 5 holds.
The equation of the example above is in a particular format: it has the form
x = f(x)where f is the function defined as
f(y) =def= (2 y3 - 6) / 5Equations in this format are called fixpoint equations.
For certain theories, the solution of fixpoint equations can be obtained in a uniform way, by applying an operator to the function f of the equation. Such operator is called fixpoint operator. (This is not the case for the equations on rational numbers, unless we introduce some restrictions on the functions to be used in the equations.)
Y F = F (Y F)for every lambda term F. This means that every fixpoint equation
X = F (X)has a solution X =def= Y F.
Note that Y is not the only fixpoin operator in the lambda calculus. We have, actually, infinitely many such operators. The operator Y is due to Curry, and was called by him "paradoxical combinator". Another fixpoint operator, due to Turing, is the term (\x y. y (x x y))(\x y. y (x x y)).
Example Suppose that we want to find a term M such that, for every P, we have:
M P = P MIf we are able to reduce the above equation to a fixpoint equation, then we can use the fixpoint operator to solve this problem.
Observe that the above equation is equivalent to
M = \p. p MNow use one further abstraction step on the left, and obtain
M = (\u p. p u) MThe latter is in the format of a fixpoint equation. Then we have that a solution is
M =def= Y (\u p. p u)
g(n) =def= if n = 0 then ... else ... g(n-1) ...or equivalently
g =def= \n. if n = 0 then ... else ... g(n-1) ...what we mean by such a definition is that we want to define g as the (or better, any) solution of a fixpoint equation on g of the form
g = G (g)where G is the function defined as
G =def= (\u. \n. if n = 0 then ... else ... u(n-1) ...)The domain of the lambda-definable functions enjoys the property of the uniform solvability of fixpoint equations. One fixpoint operator is the lambda term Y defined in previous lectures. In fact, as previously proved, we have
Y G = G (Y G)which means that Y G is a solution of the equation
g = G (g).
In order to prove the consistency of the lambda calculus, it is convenient to introduce the notion of beta-reduction.
The one-step beta reduction, denoted by ->, is the least relation such that:
The multi-step beta reduction, denoted by ->>, is the reflexive and transitive closure of ->, namely:
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: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
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.
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.