User:Thepigdog/Church-Rosser Theorem

This theorem says that reduction may proceed in different orders, and still arrive at the same expression. The theorem allows us to think of Lambda Calculus expressions as representing a value.

The Church-Rosser Theorem states that if you start with an initial expression and perform two different series of reductions on it, to reach two different expressions, there is always a set of reduction for each expression that will reduce it to the same expression. This gives the basis for considering reductions as evaluating expressions. If lambda expressions reduced too different expressions in normal form then it would not be possible to consider the normal form as the value of the function.

However Deductive lambda calculus shows that Lambda Calculus is mathematical under certain conditions, and that under those conditions each expression represents a value. This makes the Church-Rosser Theorem less important, but it does not prove the theorem.

Church-Rosser Theorem
If L is a lambda expression, and M and N are both obtained from L by a series of beta or eta reductions then there exists a series of reductions for M and N that will reduce them to the same expression Z.

Etymology of the proof
The proof given below varies slightly from the proof given in due to Tait and Martin-L¨of. That proof combines multiple reduction steps into a single step, and then considers the "Maximal one step reduction" as the point in the diamond. The theorem is then proved by combining the diamonds, to form a larger diamond like structure, the top of which is the original lambda expression, the edge points are the two expressions derived from it, and the bottom point is the Z which brings the values back together again.

This proof creates a definition of a beta reduction step based on the name of the variable in the lambda abstraction. This also allows multiple beta reduction steps to be considered as one step. With this definition, the reduction is commutative, but with some conditions. The conditions do not restrict the construction of the diamond structure as for the above proof.

This proof is given because I found the existing proof long and hard to follow. Also I found it disconcerting that the actual series of reductions to obtain Z was not constructed. Thirdly I like the fact that the reductions are commutative (under conditions), and I thing this gives a clearer intuitive insight into why the Church-Rosser Theorem is true.

Outline of the proof
Each beta reduction is a function that transforms a lambda expression into another lambda expression. If we have an initial expression L and M and N obtained from L by beta reductions then,
 * $$ M = m_1 \circ m_2 ... \circ m_r(L) $$
 * $$ N = n_1 \circ n_2 ... \circ n_s(L) $$

where
 * $$m_1, m_2, ... m_r, n_1, n_2, ... n_s $$ are beta reductions.

then,
 * $$ O = m_1 \circ m_2 ... \circ m_r(N) = m_1 \circ m_2 ... \circ m_r \circ n_1 \circ n_2 ... \circ n_s(L)$$
 * $$ P = n_1 \circ n_2 ... \circ n_s(L) = n_1 \circ n_2 ... \circ n_s \circ m_1 \circ m_2 ... \circ m_r(L)$$

and the Church-Rosser Theorem is proved if O = P.

If we could prove that the order of the application of beta reductions does not effect the result then we would have proved that O = P. So this would mean that if two reductions as x and y are composed then,
 * $$ x \circ y = y \circ x $$

This result will be proved but with restrictions on when it is valid. However with the restrictions will not block the proof that O = P.

Beta and Eta Reduction Functions
The definitions of beta and eta reductions do not give us an explicit representation of a specific beta or eta reduction. The proof will proceed by creating functions that represent reductions. A beta reduction is defined as being applied to any lambda abstraction in the expression. But the function should be a beta reduction applied to a particular lambda abstraction. How is the sub-expression the beta or eta reduction is to be applied to identified?

If canonical renaming is applied then every lambda expression expression has it's own unique variable. Then the name of the variable can be used to identify the lambda expression to which to apply the reduction. Two functions will be defined,


 * $$ \beta_{f} [x] $$ performs a beta reduction $$ \beta_{r} $$ on all lambda abstractions with the name $$x$$
 * $$ \eta_{f} [x] $$ performs an eta reduction $$ \eta_{r} $$ on all lambda abstractions with the name $$x$$

But after a beta reduction a lambda abstraction may have been substituted a number of times. The $$ \beta_{f} $$ and $$ beta_{f} $$ functions are defined to reduce all lambda abstractions matching the name. A proof that this definition implies $$x \circ y = y \circ x $$ is given later, but there are conditions, and the definition needs to be refined further.

Valid reductions
A lambda abstraction without a parameter is a function. A beta reduction may substitute a lambda expression for a variable, giving it a parameter. This would mean that the $$ \beta_{f} $$ applied before the beta reduction cannot be applied, because there is no parameter, but after the beta reduction the $$ \beta_{f} $$ can be applied. This would break $$x \circ y = y \circ x $$.

To avoid this situation we define valid application of a beta or eta reduction,
 * For a $$ \beta_{f} [x]$$ be validly applied, every lambda expression matching the name x must have a parameter.

A problem with names
A betaredexf is defined to perform all reductions on lambda abstractions matching the variable name. But this does not define a single beta reduction. For the first beta reduction a canonical renaming can be performed first. But for the second step a beta reduction may have created multiple copies of the lambda abstraction all with the same name.

We want to keep the names so that the betaredexf can be re-ordered, but change them so that they are distinct.

To achieve this add a name qualification scheme. An alpha renaming can change a name by adding a suffix after a period. So x is renamed to x#a.

Betaredexf is redefined to beta reduce all lambda abstractions matching the prefix.

A new kind of canonical renaming is defined that keeps the existing name but adds the unique name as a suffix. Then the betaredexf is the same before and after the canonical renaming.

Defintion of beta redex function

 * 1) $$\beta _{f} [x][(\lambda w.y)\ z] = \beta _{r} [(\lambda w.\beta _{f} [x][y])\ \beta _{f} [x][z]] \and (x = w \or x\#s = w) $$
 * 2) $$\beta _{f} [x][\lambda w.y] = \lambda w.\beta _{f} [x][y] \and \neg (x = w \or x\#s = w) $$
 * 3) $$\beta _{f} [x][y \  z] = \beta _{f} [x][y]\  \beta _{f} [x][z] $$
 * 4) $$\beta _{f} [x][v] = v $$

Note there is no case for $$(x = w \or x\#s = w) \and \beta _{f} [x][\lambda w.y] $$, with no application of the function to a parameter. If this condition occurs it is not a valid reduction.

Defintion of eta redex function

 * 1) $$\eta _{f} [x][\lambda w.y\ w] = \eta _{f} [x][y] \and (x = w \or x\#s = w) $$
 * 2) $$\eta _{f} [x][\lambda w.y\ z] = \lambda w.\eta _{f} [x][y]\ \eta _{f} [x][z] \and (w \ne z \or \neg (x = w \or x\#s = w)) $$
 * 3) $$\eta _{f} [x][y\ z] = \eta _{f} [x][y]\  \eta _{f} [x][z] $$
 * 4) $$\eta _{f} [x][v] = v $$

Proof that valid beta reduction functions commute
$$ \beta _{f} $$ applied with $$ \beta _{f} $$.
 * $$ \neg (x = y\#t \or y = x\#u) $$
 * $$ X = \beta _{f} [x] $$
 * $$ Y = \beta _{f} [y] $$
 * $$ X \circ Y = Y \circ X $$

or
 * $$ X[ Y[ l ]] = Y[ X[ l ]] $$

Note that $$ (x = y\#t \or y = x\#u) $$ is a condition where commutativity does not hold.

Proof by induction on all the cases of the lambda expression $$l$$. In each inductive case assume that the theorem holds for the parameters.

The proof is summarized in the following table with columns,
 * Case name - The type of lambda expression, and any logical pre-conditions
 * Lambda abstraction
 * Application
 * Variable
 * Expression - The expression that needs to be shown true
 * Simplified Expression - The expression re-arranged to show that it is true if the dependent cases, and inductive preconditios are true.
 * Dependent case - Conditions that must be proven separately.
 * Inductive preconditions - Conditions that are assumed true for the purpose of induction.

Proof of the substitution case

 * $$ Y = \beta _{f} [y] $$
 * $$ Y[m][v := Y[n]] = Y[ m[v := n] ] \and \neg (y = v \or y = v\#r) $$

The dependent case,
 * $$ [y := Y[c]][v := Y[n]] = [v := Y[n]][y := Y[c][v := Y[n]]] $$

can be written as,
 * $$ [y := A][v := B] = [v := B][y := A[v := B]] $$

Proof omitted.

Proof that valid eta reduction functions commute
$$ \eta _{f} $$ applied with $$ \eta _{f} $$.
 * $$ X = \eta _{f} [x] $$
 * $$ Y = \eta _{f} [y] $$
 * $$ X \circ Y = Y \circ X $$

or
 * $$ X[ Y[ l ]] = Y[ X[ l ]] $$

Proof by induction on all the cases of the lambda expression $$l$$.

Proof that valid beta reduction functions commute with eta
$$ \beta _{f} \!$$ applied with $$ \eta _{f} \!$$.
 * $$ X = \beta _{f} [x] \!$$
 * $$ Y = \eta _{f} [y] \!$$
 * $$ X \circ Y = Y \circ X \!$$

or
 * $$ X[ Y[ l ]] = Y[ X[ l ]] \!$$

Proof by induction on all the cases of the lambda expression $$l$$.

Links

 * Lambda Calculus