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. is a constructor system, sufficiently complete, and for each rule, where is the lexicographic path ordering: it is well-founded, closed under contexts and substitutions, contains the proper subterm relation, and implies that every variable of occurs in . An equation is valid if for every ground substitution . Let be the final set of hypotheses; only grows during the run, and every rule added at line L10 satisfies by line L9. So , and the normalizations at line L5 stop.
Lemma 1 (constructor normal forms). Every ground term has for a ground constructor term .
Proof. terminates, so has a normal form . If had a defined symbol, an innermost one would be the root of a ground basic term with constructor terms , which is reducible by sufficient completeness.
Lemma 2 (followed instances). Suppose the run returns at line L12. Let be an equation in at some time, a ground substitution, and either a ground term with , meaning is greater than both sides of , or the symbol , taken to be above every ground term. Suppose every ground instance of a rule of with satisfies . Then holds modulo .
Proof. The run removes at line L4 at some later time, since is empty at line L12. Consider what happens to there. Line L5 turns it into by steps of ; applied to , each step is a step on a ground term below , since the terms decrease from or . A step with is in . A step with a rule of rewrites an instance that is a subterm of a term below , so and the step is in by assumption. So and . Line L12 is reached, so the equation is not handled by lines L3, L7 or L9 with a return. Then either at line L6, and holds, or , possibly swapped, becomes a rule of at line L10. Its instance has left side , so by assumption , and again holds.
Lemma 3 (hypotheses). If the run returns at line L12, every rule of is valid.
Proof. We show for every rule of and every ground , by well-founded induction on the ground term with respect to , over all rules and substitutions at once.
If some variable of has not a constructor term, let map each variable to from Lemma 1. Then , so and by induction ; also . So .
Otherwise maps the variables of to ground constructor terms. When was added, line L10 took the basic subterm . Then is a ground basic term, so some rule of has at the root. With renamed apart, unifies and , so they have an idempotent mgu , and because every unifier is an instance of an idempotent mgu in this way. Line L11 put into . Now , and because the variables of occur in . Both sides of are below : the left side by one step and the right side because . By the induction hypothesis every ground instance of a rule of with left side below holds modulo , so Lemma 2 applies and . Hence .
Theorem 1 (proved). If the run returns PROVED, every conjecture of is valid.
Proof. Let and ground. By Lemma 3 every ground instance of a rule of holds modulo , so Lemma 2 applies with , and holds modulo .
Theorem 2 (disproved). If is ground confluent and the run returns DISPROVED, some conjecture of is not valid.
Proof. Suppose every conjecture is valid. We show that every equation ever in and every rule ever in is valid, by induction on the run. Equations of are valid. Line L5 rewrites with and with rules of , which are valid by induction, so validity of passes to by closure of under ground instances and contexts. Line L10 adds a valid equation as a rule. At line L11, a ground instance of is reached from the instance of by one step, so it is valid. So the equation at line L7 is valid, and so is its ground instance that the search found. But and are different ground constructor terms, which are -normal forms because every left side has a defined root; in a ground confluent system two different normal forms are not equal modulo . This is a contradiction.
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 iterations. Each normalization at line L5 stops because and is well-founded, and the search at line L7 is finite.