Algorithm Search⌘K

Proofs: Orthogonal systems are confluent

These are the human proofs of Orthogonal systems are confluent, at full length.

Proof that orthogonal systems are confluent, by multi-step reduction full

This proof shows: statement.

Let RR be an orthogonal term rewriting system: every left side is linear and not a variable, and no two rules overlap. RR may be infinite, and it need not terminate. We use the notation of the term rewriting pages: terms T(Σ,V)T(\Sigma, V), positions as sequences of positive integers, t∣pt|_p, substitutions σ\sigma applied as tσt\sigma, rules l→rl \to r with Var(r)⊆Var(l)\mathrm{Var}(r) \subseteq \mathrm{Var}(l), and →∗\to^* for the reflexive transitive closure of →R\to_R. PosΣ(l)\mathrm{Pos}_\Sigma(l) is the set of non-variable positions of ll.

Multi-step reduction

Define the relation ⇒\Rightarrow on terms inductively by three rules.

  • (V) x⇒xx \Rightarrow x for every variable xx.
  • (F) If si⇒tis_i \Rightarrow t_i for i=1,…,ni = 1, \ldots, n, then f(s1,…,sn)⇒f(t1,…,tn)f(s_1, \ldots, s_n) \Rightarrow f(t_1, \ldots, t_n).
  • (R) If l→r∈Rl \to r \in R and xσ⇒xτx\sigma \Rightarrow x\tau for every x∈Var(l)x \in \mathrm{Var}(l), then lσ⇒rτl\sigma \Rightarrow r\tau.

So s⇒ts \Rightarrow t contracts a set of redexes of ss, possibly nested, from the inside out.

Lemma 1 (reflexivity). u⇒uu \Rightarrow u for every term uu.

Proof. Induction on uu, with (V) for variables and (F) otherwise. ■\blacksquare

Lemma 2 (sandwich). →R⊆⇒⊆→∗{\to_R} \subseteq {\Rightarrow} \subseteq {\to^*}.

Proof. Let s→Rts \to_R t by the rule l→rl \to r at position pp, so s∣p=lσs|_p = l\sigma and t=s[rσ]pt = s[r\sigma]_p. Induction on pp. If p=εp = \varepsilon, then lσ⇒rσl\sigma \Rightarrow r\sigma by (R), since xσ⇒xσx\sigma \Rightarrow x\sigma by Lemma 1. If p=i.qp = i.q, then s=f(s1,…,sn)s = f(s_1, \ldots, s_n), tt differs from ss only in argument ii, si⇒tis_i \Rightarrow t_i by induction, and (F) with Lemma 1 for the other arguments gives s⇒ts \Rightarrow t.

For the second inclusion, use induction on the derivation of s⇒ts \Rightarrow t. Case (V) is trivial. In case (F), rewrite the arguments one after the other. In case (R), rewrite each occurrence of each xx in lσl\sigma from xσx\sigma to xτx\tau, which gives lσ→∗lτl\sigma \to^* l\tau, and then lτ→Rrτl\tau \to_R r\tau. ■\blacksquare

Lemma 3 (substitution). If xτ⇒xτ′x\tau \Rightarrow x\tau' for every x∈Var(r)x \in \mathrm{Var}(r), then rτ⇒rτ′r\tau \Rightarrow r\tau'.

Proof. Induction on rr. For a variable this is the hypothesis. For r=f(r1,…,rn)r = f(r_1, \ldots, r_n) use the induction hypothesis on each rir_i and (F). ■\blacksquare

The complete development

Lemma 4 (at most one root redex). If s=l1σ1=l2σ2s = l_1\sigma_1 = l_2\sigma_2 for rules l1→r1l_1 \to r_1 and l2→r2l_2 \to r_2 of RR, then the two rules are the same and σ1\sigma_1, σ2\sigma_2 agree on Var(l1)\mathrm{Var}(l_1).

Proof. Rename the second rule apart from the first. The substitution that acts as σ1\sigma_1 on the variables of l1l_1 and as σ2\sigma_2 on those of l2l_2 unifies l1l_1 and l2l_2, an overlap at ε\varepsilon. Orthogonality only allows this when the two rules are the same. Then l1σ1=l1σ2l_1\sigma_1 = l_1\sigma_2 forces xσ1=xσ2x\sigma_1 = x\sigma_2 for every x∈Var(l1)x \in \mathrm{Var}(l_1). ■\blacksquare

Define the complete development s∗s^* by induction on ss:

  • x∗=xx^* = x;
  • if s=lσs = l\sigma for a rule l→rl \to r, then s∗=rσ∗s^* = r\sigma^*, where xσ∗=(xσ)∗x\sigma^* = (x\sigma)^* for x∈Var(l)x \in \mathrm{Var}(l);
  • otherwise f(s1,…,sn)∗=f(s1∗,…,sn∗)f(s_1, \ldots, s_n)^* = f(s_1^*, \ldots, s_n^*).

By Lemma 4 the second clause does not depend on a choice. Each xσx\sigma is a proper subterm of ss, because ll is not a variable, so the definition is well-founded. s∗s^* contracts all redexes of ss, from the inside out.

Lemma 5 (redex survives). Let s=lσs = l\sigma for a rule l→rl \to r, and let s⇒ts \Rightarrow t by a derivation whose last rule is (F). Then t=lτt = l\tau for a substitution τ\tau such that xσ⇒xτx\sigma \Rightarrow x\tau by a sub-derivation, for every x∈Var(l)x \in \mathrm{Var}(l).

Proof. We show by induction on the length of qq: for every position qq of ll, the derivation contains a sub-derivation of (l∣q)σ⇒t∣q(l|_q)\sigma \Rightarrow t|_q, and if q∈PosΣ(l)q \in \mathrm{Pos}_\Sigma(l), the last rule of that sub-derivation is (F). For q=εq = \varepsilon this is the hypothesis. Let q∈PosΣ(l)q \in \mathrm{Pos}_\Sigma(l) with last rule (F); then (l∣q)σ(l|_q)\sigma and t∣qt|_q have the same root, and for each argument position q.iq.i of ll the derivation contains (l∣q.i)σ⇒t∣q.i(l|_{q.i})\sigma \Rightarrow t|_{q.i}. If q.i∈PosΣ(l)q.i \in \mathrm{Pos}_\Sigma(l), the last rule of this sub-derivation is not (V), since (l∣q.i)σ(l|_{q.i})\sigma is not a variable. It is not (R) either: otherwise (l∣q.i)σ=l′ρ(l|_{q.i})\sigma = l'\rho for a rule l′→r′l' \to r', and l∣q.il|_{q.i}, a non-variable subterm of ll at a position other than ε\varepsilon, unifies with a renamed copy of l′l'. That is an overlap, which orthogonality forbids, also when l′→r′l' \to r' is the rule l→rl \to r itself. So it is (F).

Hence tt agrees with ll at every position of PosΣ(l)\mathrm{Pos}_\Sigma(l), and at the position qxq_x of a variable xx of ll there is a sub-derivation xσ⇒t∣qxx\sigma \Rightarrow t|_{q_x}. Since ll is linear, each variable xx has exactly one position qxq_x, so xτ=t∣qxx\tau = t|_{q_x} defines a substitution with t=lτt = l\tau. ■\blacksquare

Without linearity, two occurrences of xx could be rewritten to different terms and τ\tau would not exist; without the overlap condition, a step inside the pattern of ll could destroy the redex. These are exactly the two hypotheses of the theorem.

Lemma 6 (triangle). If s⇒ts \Rightarrow t, then t⇒s∗t \Rightarrow s^*.

Proof. Induction on the size of ss, with a case analysis on the last rule of the derivation of s⇒ts \Rightarrow t.

  • (V): s=t=xs = t = x and s∗=xs^* = x, so t⇒s∗t \Rightarrow s^* by (V).
  • (R): s=lσs = l\sigma, t=rτt = r\tau and xσ⇒xτx\sigma \Rightarrow x\tau for x∈Var(l)x \in \mathrm{Var}(l). By Lemma 4, s∗=rσ∗s^* = r\sigma^* with this rule and this σ\sigma. Each xσx\sigma is smaller than ss, so by induction xτ⇒(xσ)∗=xσ∗x\tau \Rightarrow (x\sigma)^* = x\sigma^*. By Lemma 3, since Var(r)⊆Var(l)\mathrm{Var}(r) \subseteq \mathrm{Var}(l), t=rτ⇒rσ∗=s∗t = r\tau \Rightarrow r\sigma^* = s^*.
  • (F), and ss is not of the form lσl\sigma: s=f(s1,…,sn)s = f(s_1, \ldots, s_n), t=f(t1,…,tn)t = f(t_1, \ldots, t_n) with si⇒tis_i \Rightarrow t_i, and s∗=f(s1∗,…,sn∗)s^* = f(s_1^*, \ldots, s_n^*). By induction ti⇒si∗t_i \Rightarrow s_i^*, and (F) gives t⇒s∗t \Rightarrow s^*.
  • (F), and s=lσs = l\sigma for a rule l→rl \to r: by Lemma 5, t=lτt = l\tau with xσ⇒xτx\sigma \Rightarrow x\tau for each x∈Var(l)x \in \mathrm{Var}(l). By induction xτ⇒xσ∗x\tau \Rightarrow x\sigma^*. Then (R) gives t=lτ⇒rσ∗=s∗t = l\tau \Rightarrow r\sigma^* = s^*. ■\blacksquare

Confluence

Lemma 7 (diamond). If s⇒t1s \Rightarrow t_1 and s⇒t2s \Rightarrow t_2, then t1⇒s∗t_1 \Rightarrow s^* and t2⇒s∗t_2 \Rightarrow s^*. This is Lemma 6 applied twice. ■\blacksquare

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

Proof. First, if a⇒ba \Rightarrow b and a⇒nca \Rightarrow^n c, there is dd with b⇒ndb \Rightarrow^n d and c⇒dc \Rightarrow d. For n=0n = 0 take d=bd = b. For a⇒c1⇒n−1ca \Rightarrow c_1 \Rightarrow^{n-1} c, the diamond gives ee with b⇒eb \Rightarrow e and c1⇒ec_1 \Rightarrow e, and induction applied to c1⇒ec_1 \Rightarrow e and c1⇒n−1cc_1 \Rightarrow^{n-1} c gives dd with e⇒n−1de \Rightarrow^{n-1} d and c⇒dc \Rightarrow d; then b⇒ndb \Rightarrow^n d. Second, if a⇒mba \Rightarrow^m b and a⇒nca \Rightarrow^n c, use induction on mm: for a⇒b1⇒m−1ba \Rightarrow b_1 \Rightarrow^{m-1} b, the first part gives ee with b1⇒neb_1 \Rightarrow^n e and c⇒ec \Rightarrow e, and induction on b1b_1 gives dd with b⇒∗db \Rightarrow^* d and e⇒∗de \Rightarrow^* d, so c⇒∗dc \Rightarrow^* d. ■\blacksquare

Theorem. →R\to_R is confluent.

Proof. By Lemma 2, →∗⊆⇒∗⊆(→∗)∗=→∗\to^* \subseteq \Rightarrow^* \subseteq (\to^*)^* = \to^*, so ⇒∗=→∗\Rightarrow^* = \to^*. By Lemmas 7 and 8, ⇒∗\Rightarrow^* has the diamond property, which for a reflexive transitive relation is confluence. So →∗\to^* has the diamond property, that is, →R\to_R is confluent. ■\blacksquare

No step used termination or finiteness of RR, and the proof gives more: from any term ss, every multi-step reduct of ss reaches s∗s^* in one multi-step.

Back to Orthogonal systems are confluent