Algorithm Search⌘K

Proofs: Church-Rosser theorem

These are the human proofs of Church-Rosser theorem, at full length.

Proof of the Church-Rosser theorem by parallel reduction full

This proof shows: statement.

We prove that →β\to_\beta is confluent. Terms are taken up to α\alpha-conversion, and in each step the bound variables are chosen different from the free variables of the other terms involved (the variable convention). We use one fact about syntactic substitution, proved by induction on MM in Barendregt, Chapter 2:

(S) If x≠yx \ne y and x∉FV(L)x \notin \mathrm{FV}(L), then M[x:=N][y:=L]=M[y:=L][x:=N[y:=L]]M[x := N][y := L] = M[y := L][x := N[y := L]].

Parallel reduction. Let ⇒\Rightarrow be the least relation on lambda terms closed under these four rules:

  1. x⇒xx \Rightarrow x for each variable xx;
  2. if M⇒M′M \Rightarrow M' then λx. M⇒λx. M′\lambda x.\, M \Rightarrow \lambda x.\, M';
  3. if M⇒M′M \Rightarrow M' and N⇒N′N \Rightarrow N' then M N⇒M′ N′M\,N \Rightarrow M'\,N';
  4. if M⇒M′M \Rightarrow M' and N⇒N′N \Rightarrow N' then (λx. M) N⇒M′[x:=N′](\lambda x.\, M)\,N \Rightarrow M'[x := N'].

So ⇒\Rightarrow contracts any set of redexes that are present in the term at the start, in one go.

Lemma 1. M⇒MM \Rightarrow M for each MM.

Proof. Induction on MM, with rules 1, 2 and 3. □\square

Lemma 2. →β⊆⇒⊆↠β{\to_\beta} \subseteq {\Rightarrow} \subseteq {\twoheadrightarrow_\beta}. Hence ⇒∗\Rightarrow^* and ↠β\twoheadrightarrow_\beta are the same relation.

Proof. First inclusion: induction on the derivation of M→βM′M \to_\beta M'. A root step (λx. P) Q→βP[x:=Q](\lambda x.\, P)\,Q \to_\beta P[x := Q] is rule 4 with P⇒PP \Rightarrow P and Q⇒QQ \Rightarrow Q (Lemma 1). A step inside a context is rule 2 or 3, with Lemma 1 for the part that does not change. Second inclusion: induction on the derivation of M⇒M′M \Rightarrow M'. Rules 1 to 3 follow because ↠β\twoheadrightarrow_\beta is reflexive and closed under the term constructors. For rule 4, by induction M↠βM′M \twoheadrightarrow_\beta M' and N↠βN′N \twoheadrightarrow_\beta N', so (λx. M) N↠β(λx. M′) N′→βM′[x:=N′](\lambda x.\, M)\,N \twoheadrightarrow_\beta (\lambda x.\, M')\,N' \to_\beta M'[x := N']. Taking reflexive transitive closures of →β⊆⇒⊆↠β{\to_\beta} \subseteq {\Rightarrow} \subseteq {\twoheadrightarrow_\beta} gives ↠β⊆⇒∗⊆↠β\twoheadrightarrow_\beta \subseteq \Rightarrow^* \subseteq \twoheadrightarrow_\beta. □\square

Lemma 3 (substitution). If M⇒M′M \Rightarrow M' and N⇒N′N \Rightarrow N', then M[x:=N]⇒M′[x:=N′]M[x := N] \Rightarrow M'[x := N'].

Proof. Induction on the derivation of M⇒M′M \Rightarrow M'.

  • Rule 1, M=M′=yM = M' = y. If y=xy = x, both sides are NN and N′N', and N⇒N′N \Rightarrow N'. If y≠xy \ne x, both sides are yy.
  • Rule 2, λy. P⇒λy. P′\lambda y.\, P \Rightarrow \lambda y.\, P' with P⇒P′P \Rightarrow P'. By the convention y≠xy \ne x and y∉FV(N)∪FV(N′)y \notin \mathrm{FV}(N) \cup \mathrm{FV}(N'). By induction P[x:=N]⇒P′[x:=N′]P[x := N] \Rightarrow P'[x := N'], and rule 2 gives λy. P[x:=N]⇒λy. P′[x:=N′]\lambda y.\, P[x := N] \Rightarrow \lambda y.\, P'[x := N'], which are the two substituted terms.
  • Rule 3: the induction hypothesis for both parts and rule 3.
  • Rule 4, (λy. P) Q⇒P′[y:=Q′](\lambda y.\, P)\,Q \Rightarrow P'[y := Q'] with P⇒P′P \Rightarrow P' and Q⇒Q′Q \Rightarrow Q', where y≠xy \ne x and y∉FV(N′)y \notin \mathrm{FV}(N'). The left side becomes (λy. P[x:=N]) (Q[x:=N])(\lambda y.\, P[x := N])\,(Q[x := N]). By induction P[x:=N]⇒P′[x:=N′]P[x := N] \Rightarrow P'[x := N'] and Q[x:=N]⇒Q′[x:=N′]Q[x := N] \Rightarrow Q'[x := N'], so rule 4 gives
(λy. P[x:=N]) (Q[x:=N])⇒P′[x:=N′][y:=Q′[x:=N′]].(\lambda y.\, P[x := N])\,(Q[x := N]) \Rightarrow P'[x := N'][y := Q'[x := N']].

By (S) with the roles of the two variables exchanged (y≠xy \ne x, y∉FV(N′)y \notin \mathrm{FV}(N')), this term equals P′[y:=Q′][x:=N′]P'[y := Q'][x := N'], the right side with the substitution applied. □\square

Complete development. Define M∗M^*, the result of contracting all redexes of MM at once, by recursion on MM:

  • x∗=xx^* = x;
  • (λx. M)∗=λx. M∗(\lambda x.\, M)^* = \lambda x.\, M^*;
  • ((λx. M) N)∗=M∗[x:=N∗]((\lambda x.\, M)\,N)^* = M^*[x := N^*];
  • (M N)∗=M∗ N∗(M\,N)^* = M^*\,N^* when MM is not an abstraction.

Lemma 4 (triangle). If M⇒M′M \Rightarrow M', then M′⇒M∗M' \Rightarrow M^*.

Proof. Induction on the derivation of M⇒M′M \Rightarrow M'.

  • Rule 1: M=M′=x=M∗M = M' = x = M^*, and x⇒xx \Rightarrow x.
  • Rule 2: λx. P⇒λx. P′\lambda x.\, P \Rightarrow \lambda x.\, P' with P⇒P′P \Rightarrow P'. By induction P′⇒P∗P' \Rightarrow P^*, so λx. P′⇒λx. P∗=(λx. P)∗\lambda x.\, P' \Rightarrow \lambda x.\, P^* = (\lambda x.\, P)^*.
  • Rule 3: P Q⇒P′ Q′P\,Q \Rightarrow P'\,Q' with P⇒P′P \Rightarrow P' and Q⇒Q′Q \Rightarrow Q'. By induction Q′⇒Q∗Q' \Rightarrow Q^*.
    • If PP is not an abstraction, by induction P′⇒P∗P' \Rightarrow P^*, and rule 3 gives P′ Q′⇒P∗ Q∗=(P Q)∗P'\,Q' \Rightarrow P^*\,Q^* = (P\,Q)^*.
    • If P=λx. P0P = \lambda x.\, P_0, then P⇒P′P \Rightarrow P' can only come from rule 2, so P′=λx. P0′P' = \lambda x.\, P_0' with P0⇒P0′P_0 \Rightarrow P_0', a shorter derivation. By induction P0′⇒P0∗P_0' \Rightarrow P_0^*. Rule 4 gives (λx. P0′) Q′⇒P0∗[x:=Q∗]=(P Q)∗(\lambda x.\, P_0')\,Q' \Rightarrow P_0^*[x := Q^*] = (P\,Q)^*.
  • Rule 4: (λx. P) Q⇒P′[x:=Q′](\lambda x.\, P)\,Q \Rightarrow P'[x := Q'] with P⇒P′P \Rightarrow P' and Q⇒Q′Q \Rightarrow Q'. By induction P′⇒P∗P' \Rightarrow P^* and Q′⇒Q∗Q' \Rightarrow Q^*. Lemma 3 gives P′[x:=Q′]⇒P∗[x:=Q∗]=((λx. P) Q)∗P'[x := Q'] \Rightarrow P^*[x := Q^*] = ((\lambda x.\, P)\,Q)^*. □\square

Lemma 5 (diamond). If M⇒M1M \Rightarrow M_1 and M⇒M2M \Rightarrow M_2, then M1⇒M∗M_1 \Rightarrow M^* and M2⇒M∗M_2 \Rightarrow M^*.

Proof. Lemma 4, applied twice. □\square

Lemma 6 (tiling). If a relation ⇒\Rightarrow has the diamond property, so does ⇒∗\Rightarrow^*.

Proof. First, if M⇒M1M \Rightarrow M_1 and M⇒nM2M \Rightarrow^n M_2, then M1⇒nPM_1 \Rightarrow^n P and M2⇒PM_2 \Rightarrow P for some PP: by induction on nn, close the first diamond, then apply the induction hypothesis to the remaining n−1n - 1 steps. Next, if M⇒mM1M \Rightarrow^m M_1 and M⇒nM2M \Rightarrow^n M_2, then M1⇒nPM_1 \Rightarrow^n P and M2⇒mPM_2 \Rightarrow^m P for some PP: by induction on mm, using the first claim for the first step of the mm steps and the induction hypothesis for the rest. □\square

Theorem. →β\to_\beta is confluent.

Proof. Let M↠βM1M \twoheadrightarrow_\beta M_1 and M↠βM2M \twoheadrightarrow_\beta M_2. By Lemma 2, M⇒∗M1M \Rightarrow^* M_1 and M⇒∗M2M \Rightarrow^* M_2. By Lemmas 5 and 6 there is PP with M1⇒∗PM_1 \Rightarrow^* P and M2⇒∗PM_2 \Rightarrow^* P. By Lemma 2 again, M1↠βPM_1 \twoheadrightarrow_\beta P and M2↠βPM_2 \twoheadrightarrow_\beta P. ■\blacksquare

The proof also bounds the length of the join: if M1M_1 and M2M_2 are reached by mm and nn parallel steps, they meet after nn and mm parallel steps.

Back to Church-Rosser theorem