Proof that orthogonal systems are confluent, by multi-step reduction full
This proof shows: statement.
Let R be an orthogonal term rewriting system: every left side is linear and not a variable, and no two rules overlap. R may be infinite, and it need not terminate. We use the notation of the term rewriting pages: terms T(Σ,V), positions as sequences of positive integers, t∣p, substitutions σ applied as tσ, rules l→r with Var(r)⊆Var(l), and →∗ for the reflexive transitive closure of →R. PosΣ(l) is the set of non-variable positions of l.
Multi-step reduction
Define the relation ⇒ on terms inductively by three rules.
- (V) x⇒x for every variable x.
- (F) If si⇒ti for i=1,…,n, then f(s1,…,sn)⇒f(t1,…,tn).
- (R) If l→r∈R and xσ⇒xτ for every x∈Var(l), then lσ⇒rτ.
So s⇒t contracts a set of redexes of s, possibly nested, from the inside out.
Lemma 1 (reflexivity). u⇒u for every term u.
Proof. Induction on u, with (V) for variables and (F) otherwise. ■
Lemma 2 (sandwich). →R⊆⇒⊆→∗.
Proof. Let s→Rt by the rule l→r at position p, so s∣p=lσ and t=s[rσ]p. Induction on p. If p=ε, then lσ⇒rσ by (R), since xσ⇒xσ by Lemma 1. If p=i.q, then s=f(s1,…,sn), t differs from s only in argument i, si⇒ti by induction, and (F) with Lemma 1 for the other arguments gives s⇒t.
For the second inclusion, use induction on the derivation of s⇒t. Case (V) is trivial. In case (F), rewrite the arguments one after the other. In case (R), rewrite each occurrence of each x in lσ from xσ to xτ, which gives lσ→∗lτ, and then lτ→Rrτ. ■
Lemma 3 (substitution). If xτ⇒xτ′ for every x∈Var(r), then rτ⇒rτ′.
Proof. Induction on r. For a variable this is the hypothesis. For r=f(r1,…,rn) use the induction hypothesis on each ri and (F). ■
The complete development
Lemma 4 (at most one root redex). If s=l1σ1=l2σ2 for rules l1→r1 and l2→r2 of R, then the two rules are the same and σ1, σ2 agree on Var(l1).
Proof. Rename the second rule apart from the first. The substitution that acts as σ1 on the variables of l1 and as σ2 on those of l2 unifies l1 and l2, an overlap at ε. Orthogonality only allows this when the two rules are the same. Then l1σ1=l1σ2 forces xσ1=xσ2 for every x∈Var(l1). ■
Define the complete development s∗ by induction on s:
- x∗=x;
- if s=lσ for a rule l→r, then s∗=rσ∗, where xσ∗=(xσ)∗ for x∈Var(l);
- otherwise f(s1,…,sn)∗=f(s1∗,…,sn∗).
By Lemma 4 the second clause does not depend on a choice. Each xσ is a proper subterm of s, because l is not a variable, so the definition is well-founded. s∗ contracts all redexes of s, from the inside out.
Lemma 5 (redex survives). Let s=lσ for a rule l→r, and let s⇒t by a derivation whose last rule is (F). Then t=lτ for a substitution τ such that xσ⇒xτ by a sub-derivation, for every x∈Var(l).
Proof. We show by induction on the length of q: for every position q of l, the derivation contains a sub-derivation of (l∣q)σ⇒t∣q, and if q∈PosΣ(l), the last rule of that sub-derivation is (F). For q=ε this is the hypothesis. Let q∈PosΣ(l) with last rule (F); then (l∣q)σ and t∣q have the same root, and for each argument position q.i of l the derivation contains (l∣q.i)σ⇒t∣q.i. If q.i∈PosΣ(l), the last rule of this sub-derivation is not (V), since (l∣q.i)σ is not a variable. It is not (R) either: otherwise (l∣q.i)σ=l′ρ for a rule l′→r′, and l∣q.i, a non-variable subterm of l at a position other than ε, unifies with a renamed copy of l′. That is an overlap, which orthogonality forbids, also when l′→r′ is the rule l→r itself. So it is (F).
Hence t agrees with l at every position of PosΣ(l), and at the position qx of a variable x of l there is a sub-derivation xσ⇒t∣qx. Since l is linear, each variable x has exactly one position qx, so xτ=t∣qx defines a substitution with t=lτ. ■
Without linearity, two occurrences of x could be rewritten to different terms and τ would not exist; without the overlap condition, a step inside the pattern of l could destroy the redex. These are exactly the two hypotheses of the theorem.
Lemma 6 (triangle). If s⇒t, then t⇒s∗.
Proof. Induction on the size of s, with a case analysis on the last rule of the derivation of s⇒t.
- (V): s=t=x and s∗=x, so t⇒s∗ by (V).
- (R): s=lσ, t=rτ and xσ⇒xτ for x∈Var(l). By Lemma 4, s∗=rσ∗ with this rule and this σ. Each xσ is smaller than s, so by induction xτ⇒(xσ)∗=xσ∗. By Lemma 3, since Var(r)⊆Var(l), t=rτ⇒rσ∗=s∗.
- (F), and s is not of the form lσ: s=f(s1,…,sn), t=f(t1,…,tn) with si⇒ti, and s∗=f(s1∗,…,sn∗). By induction ti⇒si∗, and (F) gives t⇒s∗.
- (F), and s=lσ for a rule l→r: by Lemma 5, t=lτ with xσ⇒xτ for each x∈Var(l). By induction xτ⇒xσ∗. Then (R) gives t=lτ⇒rσ∗=s∗. ■
Confluence
Lemma 7 (diamond). If s⇒t1 and s⇒t2, then t1⇒s∗ and t2⇒s∗. This is Lemma 6 applied twice. ■
Lemma 8 (tiling). If a relation ⇒ has the diamond property, then so does ⇒∗.
Proof. First, if a⇒b and a⇒nc, there is d with b⇒nd and c⇒d. For n=0 take d=b. For a⇒c1⇒n−1c, the diamond gives e with b⇒e and c1⇒e, and induction applied to c1⇒e and c1⇒n−1c gives d with e⇒n−1d and c⇒d; then b⇒nd. Second, if a⇒mb and a⇒nc, use induction on m: for a⇒b1⇒m−1b, the first part gives e with b1⇒ne and c⇒e, and induction on b1 gives d with b⇒∗d and e⇒∗d, so c⇒∗d. ■
Theorem. →R is confluent.
Proof. By Lemma 2, →∗⊆⇒∗⊆(→∗)∗=→∗, so ⇒∗=→∗. By Lemmas 7 and 8, ⇒∗ has the diamond property, which for a reflexive transitive relation is confluence. So →∗ has the diamond property, that is, →R is confluent. ■
No step used termination or finiteness of R, and the proof gives more: from any term s, every multi-step reduct of s reaches s∗ in one multi-step.