Algorithm Search⌘K

Proofs: Rewriting induction

These are the human proofs of Rewriting induction, at full length.

Rewriting induction is sound for proofs and for disproofs full

This proof shows: correctness.

We use the definitions and the pseudocode of the page. RR is a constructor system, sufficiently complete, and l>rl > r for each rule, where >> is the lexicographic path ordering: it is well-founded, closed under contexts and substitutions, contains the proper subterm relation, and l>rl > r implies that every variable of rr occurs in ll. An equation s≐ts \doteq t is valid if sσ↔R∗tσs\sigma \leftrightarrow^*_R t\sigma for every ground substitution σ\sigma. Let HH be the final set of hypotheses; HH only grows during the run, and every rule l→rl \to r added at line L10 satisfies l>rl > r by line L9. So →R∪H⊆>\to_{R \cup H} \subseteq {>}, and the normalizations at line L5 stop.

Lemma 1 (constructor normal forms). Every ground term ww has w→R∗w^w \to_R^* \hat w for a ground constructor term w^\hat w.

Proof. →R\to_R terminates, so ww has a normal form w^\hat w. If w^\hat w had a defined symbol, an innermost one would be the root of a ground basic term f(c1,…,cn)f(c_1, \ldots, c_n) with constructor terms cic_i, which is reducible by sufficient completeness. □\square

Lemma 2 (followed instances). Suppose the run returns at line L12. Let ee be an equation in EE at some time, θ\theta a ground substitution, and MM either a ground term with M>eθM > e\theta, meaning MM is greater than both sides of eθe\theta, or the symbol ∞\infty, taken to be above every ground term. Suppose every ground instance l′ρ→r′ρl'\rho \to r'\rho of a rule of HH with l′ρ<Ml'\rho < M satisfies l′ρ↔R∗r′ρl'\rho \leftrightarrow^*_R r'\rho. Then eθe\theta holds modulo RR.

Proof. The run removes ee at line L4 at some later time, since EE is empty at line L12. Consider what happens to e=(s≐t)e = (s \doteq t) there. Line L5 turns it into s′≐t′s' \doteq t' by steps of R∪HR \cup H; applied to θ\theta, each step is a step on a ground term below MM, since the terms decrease from sθs\theta or tθt\theta. A step with RR is in ↔R∗\leftrightarrow^*_R. A step with a rule of HH rewrites an instance l′ρl'\rho that is a subterm of a term below MM, so l′ρ<Ml'\rho < M and the step is in ↔R∗\leftrightarrow^*_R by assumption. So sθ↔R∗s′θs\theta \leftrightarrow^*_R s'\theta and tθ↔R∗t′θt\theta \leftrightarrow^*_R t'\theta. Line L12 is reached, so the equation is not handled by lines L3, L7 or L9 with a return. Then either s′=t′s' = t' at line L6, and eθe\theta holds, or s′≐t′s' \doteq t', possibly swapped, becomes a rule s′→t′s' \to t' of HH at line L10. Its instance has left side s′θ<Ms'\theta < M, so by assumption s′θ↔R∗t′θs'\theta \leftrightarrow^*_R t'\theta, and again eθe\theta holds. □\square

Lemma 3 (hypotheses). If the run returns at line L12, every rule l→rl \to r of HH is valid.

Proof. We show lσ↔R∗rσl\sigma \leftrightarrow^*_R r\sigma for every rule l→rl \to r of HH and every ground σ\sigma, by well-founded induction on the ground term lσl\sigma with respect to >>, over all rules and substitutions at once.

If some variable xx of ll has xσx\sigma not a constructor term, let σ^\hat\sigma map each variable yy to yσ^\widehat{y\sigma} from Lemma 1. Then lσ→R+lσ^l\sigma \to_R^+ l\hat\sigma, so lσ^<lσl\hat\sigma < l\sigma and by induction lσ^↔R∗rσ^l\hat\sigma \leftrightarrow^*_R r\hat\sigma; also rσ→R∗rσ^r\sigma \to_R^* r\hat\sigma. So lσ↔R∗rσl\sigma \leftrightarrow^*_R r\sigma.

Otherwise σ\sigma maps the variables of ll to ground constructor terms. When l→rl \to r was added, line L10 took the basic subterm u=l∣pu = l|_p. Then uσu\sigma is a ground basic term, so some rule l1→r1l_1 \to r_1 of RR has uσ=l1ρu\sigma = l_1\rho at the root. With l1l_1 renamed apart, θ=σ∪ρ\theta = \sigma \cup \rho unifies uu and l1l_1, so they have an idempotent mgu τ\tau, and θ=τθ\theta = \tau\theta because every unifier is an instance of an idempotent mgu in this way. Line L11 put e=(l[r1]pτ≐rτ)e = (l[r_1]_p\tau \doteq r\tau) into EE. Now lσ→Rlσ[r1ρ]p=l[r1]pτθl\sigma \to_R l\sigma[r_1\rho]_p = l[r_1]_p\tau\theta, and rτθ=rσr\tau\theta = r\sigma because the variables of rr occur in ll. Both sides of eθe\theta are below M=lσM = l\sigma: the left side by one RR step and the right side because l>rl > r. By the induction hypothesis every ground instance of a rule of HH with left side below lσl\sigma holds modulo RR, so Lemma 2 applies and l[r1]pτθ↔R∗rσl[r_1]_p\tau\theta \leftrightarrow^*_R r\sigma. Hence lσ↔R∗rσl\sigma \leftrightarrow^*_R r\sigma. □\square

Theorem 1 (proved). If the run returns PROVED, every conjecture of E0E_0 is valid.

Proof. Let e∈E0e \in E_0 and σ\sigma ground. By Lemma 3 every ground instance of a rule of HH holds modulo RR, so Lemma 2 applies with M=∞M = \infty, and eσe\sigma holds modulo RR. ■\blacksquare

Theorem 2 (disproved). If RR is ground confluent and the run returns DISPROVED, some conjecture of E0E_0 is not valid.

Proof. Suppose every conjecture is valid. We show that every equation ever in EE and every rule ever in HH is valid, by induction on the run. Equations of E0E_0 are valid. Line L5 rewrites with RR and with rules of HH, which are valid by induction, so validity of s≐ts \doteq t passes to s′≐t′s' \doteq t' by closure of ↔R∗\leftrightarrow^*_R under ground instances and contexts. Line L10 adds a valid equation as a rule. At line L11, a ground instance of l[r1]pτ≐rτl[r_1]_p\tau \doteq r\tau is reached from the instance of l≐rl \doteq r by one RR step, so it is valid. So the equation s≐ts \doteq t at line L7 is valid, and so is its ground instance sθ≐tθs\theta \doteq t\theta that the search found. But sθs\theta and tθt\theta are different ground constructor terms, which are RR-normal forms because every left side has a defined root; in a ground confluent system two different normal forms are not equal modulo RR. This is a contradiction. ■\blacksquare

Termination. Each iteration of line L2 removes an equation and increases the step count, so the loop ends at line L3, L7, L9 or L12 after at most BB iterations. Each normalization at line L5 stops because →R∪H⊆>\to_{R \cup H} \subseteq {>} and >> is well-founded, and the search at line L7 is finite. ■\blacksquare

Back to Rewriting induction