Deepak Kapur Hantao Zhang: Key Words
Deepak Kapur Hantao Zhang: Key Words
Abstract
RRL (Rewrite Rule Laboratory) was originally developed as an environment for ex-
perimenting with automated reasoning algorithms for equational logic based on rewrite
techniques. It has now matured into a full-
edged theorem prover which has been used
to solve hard and challenging mathematical problems in automated reasoning literature
as well as a research tool for investigating the use of formal methods in hardware and
software design. We provide a brief historical account of development of RRL and its de-
scendants, give an overview of the main capabilities of RRL and conclude with a discussion
of applications of RRL.
Key words. RRL, rewrite techniques, equational logic, discrimination nets
1 Introduction
The theorem prover RRL (Rewrite Rule Laboratory) is an automated reasoning program based
on rewrite techniques. The theorem prover has implementations of completion procedures for
generating a complete set of rewrite rules from an equational axiomatization, associative-
commutative matching and unication, algorithms for orienting equations into terminating
rewrite rules, refutational methods for rst-order theorem proving, and, most important, meth-
ods for proving rst-order equational formulas by induction. RRL has served for us as well as
our colleagues as an excellent test bed for developing new ideas in automated reasoning, trying
them out to assess their eectiveness, thus weeding out bad and insignicant ideas from good
ones. When the project to build a rewrite rule laboratory was initiated in 1982, we did not
expect that an outcome of this project would be powerful theorem provers that could be used
for attacking mathematically challenging problems as well as for application in specication
analysis, verication, and experimentation with formal methods in system design. For us, that
is yet another vindication of experimental approach to automated reasoning that emphasizes
implementing ideas and building systems.
Partially supported by the National Science Foundation Grant no. CCR-9303394.
y Partially supported by the National Science Foundation Grants nos. INT-9016100, CCR-9202838, and CCR-
9357851.
1
Short system abstracts of RRL and its descendants outlining extensions to RRL have
appeared in the proceedings of CADE [33, 36, 16, 61] and RTA conferences [38, 1]. In this
paper, we give a more detailed overview of the system and its capabilities, and we discuss some
applications for which the theorem prover has been successfully used.
2
of the literature on Hoare's axiomatic semantics formalism. Properties of programs in the
modeling language can be proved in Tecton (a sample transcript appears in [24]). Presburger
arithmetic has been integrated into the rewriting inference mechanism of the theorem prover.
More details about RRL's descendants and their capabilities are given in later sections.
(i(x1) x1 ) z2
(2) . & (3)
(e z2 ) i(x1) (x1 z2):
(x1 z2 )i constitutes a critical pair generated from rules (2) and (3). As should be obvious,
this pair is in the congruence relation generated by the above three axioms. The process of
computing critical pairs is called superposition. In fact, if we repeatedly apply rewriting and
superposition to rules (1){(3) and the generated new rules, we will obtain a canonical rewrite
system that consists of ten rewrite rules.
Besides from rules (1){(3), a canonical rewrite system for the free group theory can be also
generated from the single axiom
i(z i(z)) (i(i((x w) y ) x) i(y )) = w:
The following RRL commands are sucient:
add i(x * i(x)) * (i(i((y * z) * u) * y) * i(u)) == z ]
operator status * left-to-right
operator precedence i *
kb
The precedence commands are given to specify a well-founded ordering used for orienting
equations into rewrite rules. Below is a partial transcript generated, which illustrates how new
operators are introduced by RRL:
Type Add, Auto, Break, Cmd, Close, Delete, Gc, Grammar, Init, Kb, List,
Makerule, Option, Operator, Prove, Quit, Read, Stats, Test, Write or Help.
5
HERKY-> kb
Add Rule: [1] (i((x * i(x))) * (i((i(((y * z) * u)) * y)) * i(u))) ---> z
... ...
Add Rule: [3] (i((x * i(x))) * (i((i((u * y)) * i((z * i(z))))) * i(y))) ---> f1(u)
... ...
For equations that cannot be oriented into terminating rewriting rules, as well as for special
equational theories (i.e., when function symbols satisfy certain properties such as an operator
being commutative or associative and commutative, etc.), rewriting and critical pair computa-
tion may be done modulo an equational theory (see [43, 51] for extensions of the Knuth-Bendix
completion procedure to associative-commutative theories). For rst-order theorem proving,
rewriting and critical pair computations are dened dierently, making use of the properties
of the representations of the formulas.
f (e ; x) = x
j for 1 j n:
f (x; i (x)) = e
j j for 1 j n:
That is, each A denes a binary operator f that is associative, and has n left-units and n
n
right-inverses. 2
We have tried to complete A for n = 10i, 1 i 10, in three theorem provers: OTTER
n
[45], Hiper [7], and Herky, a descendent of RRL. Table 1 gives the statistics of these runs. All
the run times are collected using a Sun SPARCstation 1 (16-megabyte memory).
In all these runs, the same termination ordering was used, and, as a result, all the three
theorem provers produced the same canonical rewrite system for each A . (The number of
n
the rules in each canonical system is given in the second column of the table.) OTTER is
a well-engineered, fast resolution-based theorem prover implemented in C by Bill McCune at
Argonne National Laboratory [45]. OTTER supports a rich set of inference rules, including
the Knuth-Bendix completion procedure. Hiper was claimed by its creator Jim Christian as
\the fastest completion procedure in the world" [7]. Both Hiper and Herky are written in
Common Lisp. For A50, Hiper fails to produce a complete system because the theorem prover
ran out of memory. This is not surprising because, according to Christian, Hiper's speedup
comes at the price of extra memory consumption|typically ve to six times that required for
the ordinary version.
Both OTTER and Hiper were implemented with the performance as the main consideration.
As a result, in terms of the number of equations processed per second, OTTER is the fastest
7
theorem prover and, in contrast, Herky is the slowest of the three. Since Herky generates far
less critical pairs as a result of the numerous critical pair criteria used to identify unnecessary
critical pairs as well as dierent ways of selecting rules to generate critical pairs, Herky can
complete A100 while both OTTER and Hiper have diculty in completing A60 .
It is worth mentioning that soon after Hyper was implemented in 1988, Christian ap-
proached us to run some of his benchmark problems on RRL for comparison. At that time,
RRL did not use discrimination nets and term indexing for representing rules, etc. Hyper
performed much better than RRL but at the same time, RRL did not fare poorly primarily
because its good critical pair computation and selection strategies. An older version of RRL
which does not have implementations of discrimination nets for term-indexing managed to
complete A60 on a SPARC 10 with 32 MB of memory in about 2200 seconds, and A120 on a
SPARC 2 with 16 MB of memory.
8
examples (see example 2.1). For associative-commutative operators, identifying redundant
critical pairs becomes all the more important because of numerous uniers generated by an
associative-commutative unication procedure [27]. We consider this to be one of the major
strengths of RRL because of which it is possible to tackle challenging mathematical problems
such as ring commutativity problems. An interested reader may consult [71, 60] for more
details.
Are there situations under which it is more ecient to make the search in the discrimi-
nation net deterministic (by duplicating some nodes of the net)? Similarly under what
conditions, is it better to use nondeterministic search in the net (so that the space is
saved)? Currently, all of the three provers OTTER, Hiper, and RRL, use nondetermin-
istic search.
Under what conditions, is it better to maintain several discrimination nets (one for the
left-hand sides of rewrite rules, one for subterms in equations and rules, etc.), and under
what conditions is it more eective to use a single discrimination tree (the distinction of
dierent items is made at the leaf of each path)? Currently, Hiper uses several discrimi-
nation nets, whereas RRL uses a single discrimination net.
Should distinct variables be represented dierently in a discrimination net, or is it more
eective to consider all variables as a single wild-card symbol? In OTTER, distinction is
made among dierent variables. In Hiper and RRL, all variables are treated as a single
wild-card symbol.
Should variable bindings (i.e., substitution) be constructed as discrimination nets are
searched through? Under what conditions is it better to separate the matching algorithm
into two phases: the rst phase checks only function symbol compatibility, and the second
9
phase checks variable binding consistency? OTTER builds variable bindings along the
path; Hiper and RRL use a two-phase matching algorithm.
We are also interested in the problem of handling associative and commutative (AC) func-
tion symbols in discrimination nets. One crucial assumption in the implementation of discrim-
ination nets is that every function has a xed arity (the number of arguments). The
attened
AC terms do not have such a property. That could perhaps be a major obstacle to using dis-
crimination nets for indexing AC terms. In Herky, a preliminary implementation of AC-term
indexing has been tried, and its performance is not very satisfactory. Developing an ecient
data structure for discarding paths not leading to a match should be explored because of the
importance of AC theories in tackling challenging mathematical problems.
Our experience in the use of kbo has been quite positive. On the other hand, we were not
impressed with the performance of constrained rewrite rules generated using lrpo as reported
in [50]. A further investigation is, however, needed into the issue of an appropriate ordering
for constrained rewrite rules in constrained completion procedures: we believe that a choice of
an appropriate ordering is crucial for its adequate performance.
10
consideration the rewrite rules of the theory and analyzing their interaction to ensure that
the result is likely to be a non-redundant inference. This theory and its subsets are useful for
attacking mathematically challenging problems including problems over nonassociative rings,
ring commutativity problems, and problems over commutative Thue systems. In fact, this
approach is used for the theory of Boolean rings also to obtain a refutational procedure for
rst-order theorem proving (this is brie
y discussed in a later subsection).
For illustration, consider problems over alternative rings. An alternative ring is a special
case of nonassociative rings (the associativity of the multiplication is not present) in which
both (x y ) y = x (y y ) and (x x) y = x (x y ) hold.
Example 2.2 Consider the following two rules (where (2) is derived from (1) and (x y) y !
x (y y )):
(1) (x * (y + z)) ---> ((x * y) + (x * z))
(2) ((x * y) * z) + ((x * z) * y) ---> (x * (y * z)) + (x * (z * y))
There are four critical pairs between (1) and (2); if the Abelian groups (for +) and the
distributivity laws are built in, no critical pairs will be generated from these two rules because
each variable in (2) is linear in each product and all critical pairs can be shown to be trivial.
In general, the number of critical pairs between a rule r and a distributivity law is linear to the
size of the left-hand side of r; using the built-in procedure, the number of generated critical
pairs is equal to the number of distinct variables that appear more than once in a product
term. 2
In Table 2, six theorems about alternative rings are listed; Equations 3, 4, and 5 are the
famous Moufang Identities. The denitions of a and f are as follows:
a(x; y; z) = (x y ) z + (x (y z))
f (w; x; y; z) = a(w x; y; z) + (x a(w; y; z)) + (a(x; y; z) w):
The table also gives some experimental results of running these problems on RRL. For com-
parison, related results from Anantharaman and Hsiang [2] are reported. (We are not aware
of other general theorem provers on which these problems have been successfully solved.) The
timings of SBR2 were measured on a Sun 3/60 and those of of RRL are on a Sun SPARC-
station 1 (in seconds). SBR2 proofs used theorems previously proved to obtain proofs of new
theorems, whereas all proofs on RRL were obtained directly from the axioms about alternative
rings.
Many extensions of the Knuth-Bendix completion procedure for special equational theories
have been proposed over the years. Most of these extensions have aimed at extending the scope
of problems accepted by the completion procedure by building nonterminating or nonconver-
gent equations into the matching and unication procedures. We get the impression from the
literature that most of these approaches have failed to prove any interesting nontrivial theorem
in reasonable amount of time. We believe that our approach of carefully identifying relevant
critical pair computations from the rewrite rules of the special theory is one of the few attempts
of building a theory into the completion procedure with the sole objective of improving the
performance of the completion procedure. Our experimental results suggest that this approach
is very promising. An interesting subcase is that of commutative monoids, as there appear
to be interesting problems in this theory. We are also considering building into RRL theories
other than the theory of Abelian groups and distributivity laws.
11
SBR2 Herky
Problem time pairs rules time pairs rules
1. (x y ) x = x (y x) 32 67 15 0.58 19 9
2. a(x; y; z ) + a(y; x; z ) = 0 48 127 19 0.48 12 8
3. x (y (x z )) = ((x y ) x) z 2:30:49 452 41 16.08 172 48
4. ((z x) y ) x = z ((x y ) x) 1:56:36 427 39 15.91 172 48
5. (x y ) (z x) = (x (y z )) x 1:56:09 638 47 16.03 172 48
6. f (x; x; y; z ) = 0 2:07:58 463 39 22.10 190 59
Table 2: Statistics of SBR2 and Herky on alternative ring problems
12
RRL supports two methods of the Boolean-ring-based approach: The Grobner base method
developed by Kapur and Narendran [20] and the so-called odd-strategy method developed by
Zhang [64]. In the Grobner base method, a rewrite rule is made from each polynomial such
that the left side of the rewrite rule consists of the maximal monomials. New polynomials are
generated from any two polynomials by unifying their maximal monomials. Many benchmark
problems have been eectively solved using the Grobner basis method. More details about the
Grobner basis approach can be found in [20]. Some of earlier work on hardware verication
work to be mentioned later in the section on applications was done using this method.
In the odd-strategy method, new polynomials are generated from two polynomials only if
one of the two polynomials has odd number of monomials; only maximal atoms from the odd
polynomial are considered for critical pair computation. The odd-strategy is an extension of
the N-strategy [12]. One advantage of the odd-strategy over the N-strategy is that there is
no need to convert input formulas into clauses before transforming them into polynomials. If
all the polynomials are derived from clauses, then the odd-strategy reduces to the N-strategy
because in this case, N-rules are the only polynomials with odd number of monomials.
In general, if a p1 + p2 = 0, where a is a maximal atom, p1 and p2 are two polynomials
not containing a, and a p1 denotes a m1 + + a m for p1 = m1 + + m , consists of an
n n
odd number of monomials, then the new polynomial generated by the odd-superposition from
a p1 + p2 = 0 and another polynomial a q1 + q2 = 0 is q2 (p1 + p2) = 0.
Example 2.3 Suppose f (x) > g(x) > h(x) for any x and the following three polynomials are
given:
(1) f (x) g (x) + g (x) h(x) + h(x) f (x) = 0
(2) g (c) + 1 = 0
(3) h(c) + 1 = 0
In the Grobner base method, the rule f (x) g (x) ! g (x) h(x) + h(x) f (x) is made from
(1) and g (c) ! 1 is from (2). The new polynomial f (c) = g (c) h(c) + h(c) f (c) is then
generated by overlapping the left-hand sides of these two rules (i.e., f (c) g (c)), which gives a
contradiction after rules corresponding to polynomials (2) and (3) are applied for rewriting.
In the odd-strategy method, (1) is reformulated as f (x) (g (x) + h(x)) + g (x) h(x) = 0.
Because (1) is the only odd polynomial and f does not appear in (2) and (3), no new polyno-
mials will be generated from (1) and (2) (or from (1) and (3)). However, a new polynomial can
be generated from (1) and itself: g (x) h(x)(g(x)+ h(x)+ g (x) h(x)) = 0, which is equivalent
to g (x) h(x) = 0. From g (x) h(x) = 0, (2) and (3), 1 = 0 can be easily generated. Note that
the N-strategy does not work here because there are no N-rules ((1) is not clausal). 2
We have not been able to experiment extensively with the two methods; consequently,
these implementations are not fast. There is a need to study ecient data structures for
polynomials that minimize duplication of atoms. For instance, for the odd-strategy, it is
natural to present a polynomial a p + q recursively by a triple ha; p; q i. This data structure
is ecient for computing odd-superpositions but may not be good for rewriting. A complete
implementation of rewriting requires set matching, an NP-complete step (because subsumption
can be implementing by rewriting using polynomials) [25]. It might be better to designate only
a small subset of rules for rewriting.
13
2.4 Clausal Superposition Theorem Proving
The so-called clausal superposition method [70] is implemented in RRL to support the second
approach for rst-order theorem proving. The input for this method is a set of clauses. Every
clause is transformed into a conditional rewrite rule (or a nite set of rewrite rules), with a
maximal literal being the head of the rule and the negation of the remaining literals being
the condition or the premises of the rule. A well-founded ordering on terms and atoms is
used to select maximal literals in a clause. Conditional rules are superposed to generate new
rules (or clauses). This denition of superposition between two rules subsumes both resolution
and paramodulation on the maximal literals of the corresponding two clauses. Resolution and
paramodulation can thus be treated uniformly.
Conditional (contextual) rewriting [70] is used to simplify clauses with the rewrite rules
made from other clauses. If a rule (clause) gets reduced, the new rule (clause) is kept and
the old is thrown away. This rewriting is more powerful than subsumption and demodulation
together.
Below we use two examples to illustrate clausal superposition and contextual rewriting.
Example 2.4 If the input includes a clause p(a) or :q(b) or (a = b), or equivalently, the
conditional equation, p(a) if q (b) and :(a = b): For making a rewrite rule from a clause, it is
better to think of each literal as an equation and a clause as a disjunction of equations. As in
the case of equational theories, RRL uses the lexicographic recursive path ordering to compare
terms and atoms. For example, the above clause can be considered as
(p(a) , true) or (q (b) , false) or (a = b):
A maximal equation is chosen as the head of the rule, and the negation of the remaining
equations is included in the condition of the rule. For instance, if an ordering on atoms is
chosen in which q (b) > p(a) > b > a, then the above clause gives the following rule
1: q (b) ! false if (p(a) , false) and ((a = b) , false):
The superposition of rule 1 above with the following rule,
2: q (b) ! true if p(b);
is:
(p(a) , true) or (a = b) or (p(b) , false):
Superposition of rule 1 with the following rule,
3: b ! c if (a = b);
is:
(q (c) , false) or (p(a) , true) or (a = b) or ((a = b) , false);
which is trivial after simplication. This superposition is equivalent to a paramodulation. 2
Example 2.5 We illustrate contextual rewriting by simplifying :istiger(y) or :isanimal(y)
using rule
isanimal(x) ! true if istiger(x):
14
To simplify : isanimal(y ), the remaining literal of the clause, f: istiger(y )g, is rst negated to
give fistiger(y ) = trueg, which is called the context of the literal : isanimal(y ). The left side
of the rule, isanimal(x), is matched against isanimal(y ) using the substitution = fx=y g.
The condition of the rule under is istiger(y ), which is simplied to true by the context, i.e.
by fistiger(y ) = trueg. So the rule is applicable, and isanimal(y ) is reduced to true. The
clause is simplied to :istiger(y ).
Note that neither subsumption nor demodulation can simplify the above clause to :istiger(y )
(which can be obtained by resolution). 2
The idea of simplifying one literal while using the remaining literals in a clause as its context
comes from Boyer and Moore's theorem prover [6]. A formal analysis of contextual rewriting
is given in [63], where it is shown that this rewriting is useful not only for inductive theorem
proving, but also for deductive theorem proving when each clause is viewed as a (conditional)
rewrite rule.
Experimental results about the clausal superposition method were reported for a number
of examples including Schubert's Steamroller problem, SAM's lemma, and problems from set
theory. The power of the clausal superposition method is evident from the fact that it can
be used to easily prove the three isomorphism theorems in group theory (Wos identied the
rst (the easiest) of these three as a challenge problem in [57, pp. 138, Test Problem 5]); see
[62] for more details. Other theorems about automorphisms of groups, products of groups,
and homomorphisms of rings can also be proved without much diculty. Compared with
other methods, the clausal superposition method works particularly well if the input involves
non-Horn clauses with equality.
15
proof by induction based on well-founded orderings.
In the next two subsections, the implementations of these approaches in RRL are brie
y
discussed.
16
Example 3.1 The test set method is illustrated by using a simple example over integers.
Integers are generated by nonfree constructors 0, suc and pre together with the following
rewrite rules:
1: suc(pre(x)) ! x;
2: pre(suc(x)) ! x:
The set of irreducible constructor ground terms is f0; suc (0); pre (0) j i > 0; j > 0g. That is,
i j
each integers is represented by 0, or suc (0), i > 0, for positive integers, or pre (0), j > 0, for
i j
negative integers. The test set for this example is f0; suc(0); suc(suc(x)); pre(0); pre(pre(y ))g.
Inconsistency in this case would mean two distinct integers being made equivalent.
A unary function neg is dened on integers, giving the negative of its argument.
3: neg (0) ! 0;
4: neg (suc(x)) ! pre(neg (x)):
One may get the impression that the above denition of neg is not complete because the pre(x)
case is not being explicitly considered, even though it is suciently complete. Completion can
be performed to check the sucient completeness of neg . Using rules 1 and 4, a new rule is
generated:
5: pre(neg (pre(x))) ! neg (x):
From rules 2 and 5, another rule is generated:
6: neg (pre(x)) ! suc(neg (x));
which deletes rule 5. Rules f1; 2; 3; 4; 6g constitute a canonical rewriting system.
To check whether neg (neg (x)) = x is an inductive theorem, we add the conjecture as
another rule:
7: neg (neg (x)) ! x:
It turns out that the rule set f1; 2; 3; 4; 6; 7g is a canonical rewriting system. Since its test set
is the same as the original test set, the conjecture is indeed a theorem by induction. Critical
pair computation in this case essentially performs basis step and two induction steps for the
induction variable x, and veries that each of these three subgoals follow from the denition
of neg and the induction hypothesis.
Now consider another conjecture that is obviously not a theorem,
neg (neg (neg (x))) = x;
since the equality does not hold if x is dierent from 0 (we are not assuming neg (neg (x)) = x
is in the system). If we add the conjecture as a rule,
8: neg (neg (neg (x))) ! x;
we get new rules from rules 4 and 8:
9: pre(x) ! suc(x):
Rule 9 reduces the term pre(pre(y )) in the test set, which means that at least two distinct
irreducible constructor ground terms were made equivalent by the conjecture. The new test
set, f0; suc(0); suc(suc(x))g, is not equivalent to the original test set. This implies that the
conjecture is not a theorem. By instantiating the term reduced in the test set, we also get
a counterexample, pre(pre(0)), to the conjecture. In fact, we obtain an innite family of
counterexamples. 2
17
One of the major advantages of the proof by consistency approach is that it is a semi-
decision procedure for determining whether a conjecture is not an inductive theorem. For a
false conjecture, a counterexample can also be determined using this approach. The approach
works quite well on simple examples, especially when functions are dened using constructors
in primitive recursion style. For such denitions, it is often possible to generate a canonical
rewriting system. The approach, if it works, does not need much user interaction.
The proof by consistency approach is, however, not widely applicable. When functions
are not dened directly using constructors and are instead dened using other already dened
functions (see the gcd example below), two diculties may arise in its applicability. First, it
may not be possible to obtain a nite canonical rewriting system (or even a ground con
uent
rewriting system) from such function denitions, as one simply may not exist. Second, even
if a canonical rewriting system for the denitions exists, it may not be possible to generate
a nite canonical rewriting system (or even a ground con
uent rewriting system) when the
conjecture being proved is also included.
20
the variable selected for induction)
1: (0 + y ) + z = 0 + (y + z );
2: (x + y ) + z = x + (y + z ) ) (suc(x) + y ) + z = suc(x) + (y + z ):
Note that y and z are the same in the induction hypothesis as well as the subgoal. All the
variables in the two subgoals are assumed to be universally quantied.
This way of using the induction hypothesis is dierent from a typical hand proof. For the
induction step, a hand proof consists of proving
8x8y8z[(8y08z0(x + y0) + z0 = x + (y0 + z0)) ) (suc(x) + y) + z = suc(x) + (y + z)]; (1)
It should be noted that this equation is dierent from the second subgoal generated in the
cover set induction method because the hypothesis above has universally quantied variables
y 0 and z 0 dierent from y and z of the subgoal.
Now let us illustrate how the induction step is set up in the proof by consistency approach
and what induction hypothesis is used. Three rewrite rules are made from the denition of +
and the conjecture, that is,
0+y ! y (2)
suc(x) + y ! suc(x + y ) (3)
(x + y ) + z ! x + (y + z ): (4)
The superposition between the left sides of (2) and (4) (i.e., unifying x + y of (4) with the left
side of (2) generates y1 + z1 = 0 + (y1 + z1 ), which corresponds to the basis case of the proof
(the rst goal in the cover set method). The superposition between the left sides of (3) and
(4) generates suc(x2 + y2 ) + z2 = suc(x2) + (y2 + z2 ), which corresponds to the inductive case
of the proof. The proof is completed by showing that
E [ f(x + y ) + z = x + (y + z)g ` suc(x2 + y2) + z2 = suc(x2) + (y2 + z2): (5)
In the above formula, distinct variable names denote distinct variables, and every variable is
assumed to be universally quantied. The induction hypothesis ((x + y ) + z = x + (y + z ))
does not share any variable with the subgoal suc(x2 + y2 ) + z2 = suc(x2) + (y2 + z2).1 2
The induction hypotheses used in the cover set method are weaker than the corresponding
induction hypotheses in the proof by consistency method. Because of this, we call the cover set
method as using the instantiated induction hypothesis technique, and the proof by consistency
as using the quantied induction hypothesis technique.
The instantiated hypothesis technique has an advantage that it releases the theorem prover
from the burden of handling quantiers in the condition of a conditional equation. However, it
limits the use of the induction hypotheses by xing the values of the free variables in them. In
some cases, some special or several dierent instances of an induction hypothesis are needed to
complete a proof. With the instantiated hypothesis technique, these instantiations will have
to be given explicitly through some hint mechanism or a user-dened induction scheme; this
approach is adopted, for instance, in the Boyer-Moore theorem prover.
1
The soundness of this proof is ensured by the fact that (x + y) + z = x + (y + z ) can apply only to (an
equation simplied from) suc(x2 + y2 )+ z2 = suc(x2 )+(y2 + z2 ), not to (suc(x2)+ y2 )+ z2 = suc(x2)+(y2 + z2 ).
21
The quantied hypothesis technique is used nicely in the proof by consistency approach, in
which proper instantiations for free variables in an induction hypothesis are found by matching
the rewrite rule corresponding to the induction hypothesis against a subgoal. One, however,
loses
exibility in the use of an induction hypothesis. An induction hypothesis can be used only
from left to right. Using the instantiated hypothesis technique, in contrast, oers considerable
exibility in the sense that induction hypotheses as well as lemmas can be used in either
direction.
We implemented in RRL the quantied hypothesis technique in conjunction with the cover
set method. We compared the performance of the two implementations of the cover set
method|one using the instantiated hypothesis technique and the other using the quantied
hypothesis technique, on the proofs of some theorems including the pigeonhole principle in set
theory.
One of the major advantages of the quantied hypothesis technique over the instantiated
hypothesis technique is that proofs needing special or several dierent instances of an induction
hypothesis can be automated using the quantied hypothesis technique. In contrast, the
instantiated hypothesis technique invariably require considerable user assistance. Further, the
number of additional lemmas needed with the instantiated hypothesis technique are much
more than in the case when the quantied hypothesis technique is used. With the instantiated
hypothesis technique, more subgoals may be generated if many instances of an induction
hypothesis are used. In a proof of the pigeonhole theorem done with RRL using the cover
set method, the instantiated hypothesis technique generated six subgoals (excluding all the
lemmas), while the quantied hypothesis technique generates only two. Often, more subgoals
are generated, more computer time RRL takes to nish a proof. There are, however, examples
in which it is an advantage to have more subgoals, as doing case analysis is helpful when proofs
need additional lemmas.
An interested reader can nd a more detailed comparison of the two techniques in [39].
Further detailed investigations are necessary to examine the use of the quantied hypothesis
technique in the cover set method.
4 Applications
One of the main ideas behind the development of RRL has been to have access to an environ-
ment in which one can experiment with ideas and algorithms in automated reasoning based
on rewriting. RRL has been very useful for this application; a strong evidence is the fact that
we and our colleagues have written over thirty research papers related to RRL.
Another important use of RRL has been as a teaching aid. Since its development in 1984,
RRL has also been used in a course on theorem proving based on rewrite techniques taught by
us as well as other colleagues. Having access to RRL provides students with an opportunity
to try methods and approaches discussed in the course.
Below, we discuss other applications of RRL, in particular its use as a theorem prover
in specication and verication analysis of hardware and software, as well as for attacking
mathematically challenging problems.
22
4.1 Hardware Verication
In 1986, RRL was successfully used at GECRD for hardware verication. RRL was integrated
into a VHSIC Hardware Description Language (VHDL) workstation environment. For small
combinational and sequential circuits, as well as leaf cells of a bit-serial compiler, RRL was
demonstrated to be eective for automatically proving that the behavioral specication written
as a rst-order formula was realized by a structural specication of a circuit written also as a
rst-order formula and generated from the circuit layout. More details can be found in [47].
In 1987, RRL was used to analyze the input-output behavior of a SOBEL image-processing
chip being designed at Research Triangle Institute, Raleigh, North Carolina. Our colleague
Paliath Narendran was provided with a VHDL description of the chip, which had about 10,000
transistors, implementing Sobel's edge detection algorithm for image processing. The VHDL
description of the chip was used to manually generate its rst-order structural specication.
The behavioral specication was generated from a description of the algorithm in a book
on image processing. Using rst-order theorem-proving capabilities of RRL, Narendran and
Stillman detected two bugs in the chip design, one of which was not known to the chip designers
despite extensive testing and simulation of the chip. See [48] for more details.
Recently, Hua and Zhang enriched VHDL to provide a common language for specifying,
designing, and verifying hardware circuits. Based on a denotational semantics of VHDL pro-
posed by Hua in his thesis [13], a prototype translator was implemented that automatically
translates VHDL specications into algebraic specications accepted by RRL. Hua and Zhang
have successfully veried using RRL the correctness of various circuit designs, including an
ALU, a generic decoder, a trac light controller and a systolic array multiplier [15].
23
System), for the structured external display format to present proofs to the user, using tables,
graphics, and hypertext links.
The inference engine of Tecton has been extended to support in the reduction mechanism of
RRL, a decision procedure for a subclass of Presburger arithmetic with uninterpreted function
symbols. Integers and operations and relations on them are used extensively in the mathematics
of computer programming. The built-in procedure eliminates the need to explicitly state
some axioms for integers such as transitivity axioms for inequality relations. The proofs of
verication conditions obtained using the linear arithmetic procedure are shorter and more
compact than those obtained without the use of the linear arithmetic procedure.
Tecton has been used to prove properties of simple (but ecient) programs on integers,
equational programs for sorting and searching, and simple programs using abstract data types.
More details about the Tecton system can be found in [24, 23].
n = 4, and 270 seconds for n = 6; see also [54]. To our knowledge, RRL was used to generate
the rst computer proof of this theorem for n = 6 [71]. Using algebraic techniques, Zhang was
able to prove this theorem for many even values of n [59].
The key idea that helped in obtaining fast proofs of ring commutativity problems was that
very many inferences in completion-based-approaches were unnecessary and redundant in the
presence of associative-commutative theories. We emphasize the importance not only of imple-
menting primitive steps eciently, but also of identifying redundant inferences inexpensively
so they can be skipped without much penalty.
In 1987{88, RRL was also used to prove the equivalence of dierent nonclassical axioma-
tizations of free groups developed by Higman and Neumann to the classical three-law charac-
terization [37].
Herky was recently used by Zhang to win a competition on equality problems announced
in 1990 by Ross Overbeek of Argonne National Laboratory. Herky was used to solve 9 out of
10 equality problems proposed in the competition (the tenth problem is an open question in
algebra). We are not aware of any theorem prover that has been successful in solving these 9
problems. Details about the competition as well as Herky's solution to the problems can be
found in [65]. The special completion procedure in RRL has also been used to prove over 30
dicult theorems in the theory of alternative rings, a special kind of nonassociative rings [66].
The cover set induction method was developed and implemented in RRL in 1987 as a part
of Zhang's dissertation work. Since then, many interesting challenging problems proposed in
24
theorem proving by induction have also been successfully attempted in RRL. The problems
include the unique prime factorization theorem for numbers, Ramsey's theorem, the Chinese
remainder theorem, and Gilbreath's card trick. Preliminary comparison of proofs obtained on
RRL with proofs of these problems on Boyer-Moore's theorem prover suggest that RRL proofs
require less user interaction and fewer user-supplied intermediate lemmas.
Acknowledgments: A number of people have contributed to this project in many dierent
ways. We particularly acknowledge G. Sivakumar, D. Musser, P. Narendran, D. Cyrluk, X. Nie,
G.H. Hua, and R. Harris for their contributions. Thanks also to R. Overbeek, E. Lusk,
W. McCune, L. Wos, W. Pase, R. Boyer, J. Rushby, D. Lankford, M. Stickel, and N. Dershowitz
for encouragement and support of the RRL project.
References
[1] Agarwal, R., Kapur, D., Musser, D. R., and Nie, X., Tecton proof system. In: Proc.
Fourth International Conference on Rewriting Techniques and Applications, Milan, Italy,
1991.
[2] Anantharaman, S., and Hsiang, J., Automated proofs of the Moufang identities in alter-
native rings, J. Automated Reasoning 6 (1990): 79{109.
[3] Basin, D., and Kaufmann, M., The Boyer-Moore prover and Nuprl: An experimental
comparison. In: Proc. BRA Logical Frameworks Workshop, 1990.
[4] Benanav, D., Kapur, D., and Narendran, P., Complexity of matching problems, J. Sym-
bolic Computation 3 (1987) 203{216.
[5] Boyer, R. S., and Moore, J S., A computational logic. New York: Academic Press, 1979.
[6] Boyer, R. S., and Moore, J S., A computational logic handbook. New York: Academic
Press, 1988.
[7] Christian, J., Fast Knuth-Bendix completion: Summary. In: Proc. Third International
Conference on Rewriting Techniques and Applications, Lecture Notes in Computer Sci-
ence, Vol. 355, Springer-Verlag, 1989, pp. 548{510.
[8] Dershowitz, N., Termination of rewriting. J. Symbolic Computation 3 (1987) 69{116.
[9] Erickson, R. W., and Musser, D. R., The AFFIRM theorem prover: Proof forests and
management of large proofs. In: Proc. 7th International Conference on Automated De-
duction, 1980.
[10] Goguen, J. A., How to prove algebraic inductive hypotheses without induction. In: Proc.
Fifth Conference on Automated Deduction, W. Bibel and R. Kowalski (eds.), Lecture
Notes in Computer Science, Vol. 87, Springer-Verlag, 1980, pp. 356{373.
[11] Guttag, J. V., Kapur, D., and Musser, D. R., eds., In: Proc. NSF Workshop on the
Rewrite Rule Laboratory, Sept. 6{9, 1983.
[12] Hsiang, J., Refutational theorem proving using term-rewriting systems. Articial Intelli-
gence 25 (1985) 255{300.
25
[13] Hua, G. X., Formal Verication of Circuit Designs in VHDL. Ph.D thesis, Department of
Computer Science, The University of Iowa, 1992.
[14] Hua, G. X., and Zhang, H., Axiomatic semantics of a hardware specication language.
In Proc. Second IEEE Great Lakes Symposium on VLSI Design, Kalamazoo, Michigan,
1992, pp. 183{190.
[15] Hua, G. X., and Zhang, H., Formal semantics of VHDL for verication of circuit designs.
In: Proc. IEEE International Conference on Circuit Designs, 1993.
[16] Hua, G. X., and Zhang, H., FRI: Failure Resistant Induction in RRL. In: Proc. 1992 Inter-
national Conference of Automated Deduction, D. Kapur (ed.), Lecture Notes in Articial
Intelligence, Vol. 607, Springer-Verlag, 1992, pp. 691{695.
[17] Huet, G., and Hullot, J. M., Proofs by induction in equational theories with constructors.
In: 21st IEEE Symposium on Foundations of Computer Science, Syracuse, N.Y., 1980,
pp. 96{107.
[18] Jouannaud, J., and Kounalis, E., Automatic proofs by induction in equational theories
without constructors. In: Proc. Symposium on Logic in Computer Science, 1986, pp.
358{366.
[19] Knuth, D., and Bendix, P., Simple word problems in universal algebras. In: Computational
Problems in Abstract Algebra, Leech (ed.), New York: Pergamon Press, 1970, pp. 263{
297.
[20] Kapur, D., and Narendran, P., An equational approach to theorem proving in rst-order
predicate calculus. In: Proc. 9th IJCAI, 1985.
[21] Kapur, D., and Musser, D. R., Proof by consistency. Articial Intelligence 31 (1984)
125{157.
[22] Kapur, D., Musser, D. R., and Narendran, P., Only prime superpositions need be consid-
ered for the Knuth-Bendix completion procedure. J. Symbolic Computation 4 (1988).
[23] Kapur, D., and Musser, D. R. (1992): Tecton: A Framework for Specifying and Verifying
Generic System Components. Invited talk at TPCD Conf. 1992 (Theorem Provers in
Circuit Design), University of Nijmegen, The Netherlands, June 22{24, 1992.
[24] Kapur, D., Musser, D. R., and Nie, X., Tecton proof system. In: In: Proc. Workshop on
Formal Methods in Databases and Software Engineering, Alagar, Lakshmanan, and Sadri
(eds.), Workshop in Computing Series, Springer-Verlag, 1992, pp. 54{79.
[25] Kapur, D., and Narendran, P., Matching, unication and complexity, SIGSAM Bulletin,
1987.
[26] Kapur, D., and Narendran, P., Complexity of unication problems with associative-
commutative operators, J. Automated Reasoning 9 (1992) 261{288.
[27] Kapur, D., and Narendran, P., Double-exponential complexity of computing a complete
set of AC-uniers. In: Proc. Logic in Computer Science, Santa Cruz, June 1992.
[28] Kapur, D., Narendran, P., Rosenkrantz, D., and Zhang, H., Sucient-completeness, quasi-
reducibility and their complexity, Acta Informatica, 28 (1991) 311{350.
26
[29] Kapur, D., Narendran, P., and Zhang, H., On sucient completeness and related proper-
ties of term rewriting systems, Acta Informatica 24, Fasc. 4 (August 1987) 395{416.
[30] Kapur, D., Narendran, P., and Zhang, H., Proof by induction using test sets. In: Proc.
Eighth International Conference on Automated Deduction, Lecture Notes in Computer
Science, Vol. 230, Springer-Verlag, New York, 1986, pp. 99{117.
[31] Kapur, D., Narendran, P., and Zhang, H., Automating inductionless induction by test
sets, J. Symbolic Computation 11 (1991) 83{111.
[32] Kapur, D., and Sivakumar, G., Architecture of and experiments with RRL, a Rewrite
Rule Laboratory. In: Reference [11], pp. 33{56.
[33] Kapur, D., Sivakumar, G., and Zhang, H., RRL: A Rewrite Rule Laboratory. In: Proc.
Eighth International Conference on Automated Deduction, Lecture Notes in Computer
Science, Vol. 230, Springer-Verlag, Berlin, 1986, pp. 692{693.
[34] Kapur, D., Sivakumar, G., and Zhang, H., A new method for proving termination of AC-
rewrite systems. In: Proc. Tenth Conference on Foundations of Software Technology and
Theoretical Computer Science, Bangalore, India, 1990.
[35] Kapur, D., and Zhang, H., RRL: A Rewrite Rule Laboratory { User's Manual. GE Corpo-
rate Research and Development Report, Schenectady, N.Y., April 1987. A revised version
appears as Report 89-03, Dept. of Computer Science, The University of Iowa.
[36] Kapur, D., and Zhang, H., RRL: a Rewrite Rule Laboratory. In: Proc. Ninth International
Conference on Automated Deduction, E. Lusk and R. Overbeek (eds.), Lecture Notes in
Computer Science, Vol. 310, Springer-Verlag, Berlin, 1988, pp. 768{769.
[37] Kapur, D., and Zhang, H., Proving equivalence of dierent axiomatizations of free groups,
J. Automated Reasoning 4 (1988) 331{352.
[38] Kapur, D., and Zhang, H., An overview of RRL: Rewrite Rule Laboratory. In: Proc. Third
International Conference on Rewriting Techniques and Its Applications, Lecture Notes in
Computer Science, Vol. 355, Springer-Verlag, Berlin, 1989, pp. 513{529.
[39] Kapur, D., and Zhang, H., Automating induction: Explicit vs. inductionless. In: Proc.
Third International Symposium on Articial Intelligence and Mathematics, Fort Laud-
erdale, Florida, Jan. 2{5, 1994.
[40] Kaufmann, M., An interactive enhancement to the Boyer-Moore theorem prover. In: Proc.
Ninth International Conference on Automated Deduction, Lecture Notes in Computer
Science, Vol. 310, Springer-Verlag, Berlin, 1988, pp. 735{736.
[41] Knuth, D. E., and Bendix, P. B., Simple word problems in universal algebras. In: Com-
putational Problems in Abstract Algebras, J. Leech (ed.), Pergamon Press, 1970, pp.
263{297.
[42] Kuchlin, W., Inductive completion by ground proof transformation. In: Rewriting Tech-
niques: Resolution of Equations in Algebraic Structures, II, H. At-Kaci and M. Nivat
(eds.), Academic Press, New York, 1989, pp. 211{244.
27
[43] Lankford, D. S., and Ballantyne, A. M., Decision Procedures for Simple Equational The-
ories with Commutative-Associative Axioms: Complete Sets of Commutative-Associative
Reductions. Report ATP-39, Dept. of Math. and Computer Science, University of Texas,
Austin, Texas, 1977.
[44] Lankford, D. S., and Ballantyne, A. M., The refutational completeness of blocked permu-
tative narrowing and resolution. In: Proc. Fourth Conference on Automated Deduction,
1979.
[45] McCune, W., OTTER 2.0 Users Guide. ANL-90/9, Argonne National Laboratory, Ar-
gonne, Ill., 1990.
[46] Musser, D. R., On proving inductive properties of abstract data types. In: Proc. Seventh
Principles of Programming Languages, 1980.
[47] Narendran, P., and Stillman, J., Hardware verication in the Interactive VHDL Worksta-
tion. In: VLSI Specication, Verication and Synthesis, G. Birtwistle and P. A. Subrah-
manyam (eds.), Kluwer Academic Publishers, Dordrecht, 1988, pp. 217{235.
[48] Narendran, P., and Stillman, J., Formal verication of the Sobel image processing chip.
In: Proc. Design Automation Conference, 1988.
[49] Overbeek, R., A proposal for a competition. Argonne National Laboratory, Argonne, Ill.,
1990.
[50] Peterson, G. L., Complete sets of reductions with constraints. In: Proc. Tenth Interna-
tional Conference on Automated Deduction, Lecture Notes in Articial Intelligence, Vol.
449, Springer-Verlag, Berlin, 1990, pp. 381{395
[51] Peterson, G. L., and Stickel, M. E., Complete sets of reductions for some equational
theories, J. ACM 28 (1981) 233{264.
[52] Stickel, M. E., A case study of theorem proving by the Knuth-Bendix method: Discovering
that x3 = x implies ring commutativity. In: Proc. Seventh Conference on Automated
Deduction, Lecture Notes in Computer Science, Vol. 170, Springer-Verlag, Berlin, 1984,
pp. 248{258.
[53] ero, R. L., Canonicalization and Demodulation. ANL-81-6, Argonne National Labora-
tory, Argonne, Ill., 1981.
[54] Wang, T. C., Case studies of Z-module reasoning: Proving benchmark theorems for ring
theory. J. Automated Reasoning 3 (1987) 437{451.
[55] Winkler, F., and Buchberger, B., A criterion for eliminating unnecessary reductions in
the Knuth-Bendix algorithm. In: Proc. Colloquium on Algebra, Combinatorics and Logic
in Computer Science, Gyor, Hungary, 1983.
[56] Wos, L., Automated reasoning: 33 basic research problems. Prentice Hall, Englewood
Clis, N.J., 1988.
[57] Wos, L., Overbeek, R., Lusk, E., and Boyle, J., Automated reasoning: Introduction and
applications. 2nd ed. McGraw-Hill, New York, 1992.
28
[58] Zhang, H., Reduction, Superposition and Induction: Automated Reasoning in an Equa-
tional Logic. Ph.D. thesis, Department of Computer Science, Rensselaer Polytechnic In-
stitute, Troy, N.Y., 1988.
[59] Zhang, H., Automated proof of ring commutativity problems by algebraic methods, J.
Symbolic Computation 9 (1990) 423{427.
[60] Zhang, H., Criteria of critical pair criteria: A practical approach and a comparative study,
J. Automated Reasoning, to appear.
[61] Zhang, H., Herky: High-performance rewriting techniques in RRL. In: Proc. Interna-
tional Conference of Automated Deduction, D. Kapur (ed.), Lecture Notes in Articial
Intelligence, Vol. 607, Springer-Verlag, Belrin, 1992, pp. 696{700.
[62] Zhang, H., Implementing contextual rewriting. In: Proc. Third International Workshop
on Conditional Term Rewriting Systems, J. L. Remy and M. Rusinowitch (eds.), Lecture
Notes in Computer Science, Vol. 656, Springer-Verlag, Berlin, 1992, pp. 363{377.
[63] Zhang, H., Proving group isomorphism theorems: A case study of conditional completion.
In: Proc. Third International Workshop on Conditional Term Rewriting Systems, J. L.
Remy and M. Rusinowitch (eds.), Lecture Notes in Computer Science, Vol. 656, Springer-
Verlag, Berlin, 1992, pp. 302{306.
[64] Zhang, H., A new strategy for the Boolean ring based approach to rst order theorem
proving, J. Symbolic Computation, to appear.
[65] Zhang H., Automated Proofs of Equality Problems in Overbeek's Competition. Report
92-06, Department of Computer Science, The University of Iowa, 1993.
[66] Zhang, H., A case study of completion modulo distributivity and Abelian groups. In:
Proc. International Conference on Rewrite Techniques and Applications, C. Kirchner (ed.),
Lecture Notes in Computer Science, Vol. 690, Springer-Verlag, 1993, pp. 32{46.
[67] Zhang, H., Guha, A., and Hua, G. X., Using algebraic specications in Floyd-Hoare asser-
tions. In: Proc. Second International Conference on Algebraic Methodology and Software
Technology, T. Rus (ed.), Iowa City, Iowa, 1991.
[68] Zhang, H., and Hua, G. X., Proving Ramsey theorem by the cover set induction: A case
and comparison study. In: The Annals of Mathematics and Articial Intelligence, Vol. 8,
No. 3{4, 1992.
[69] Zhang, H., and Hua, G. X., Proving the Chinese remainder theorem by the cover ste
induction. In: Proc. International Conference of Automated Deduction, D. Kapur (ed.)
Lecture Notes in Articial Intelligence, Vol. 607, Springer-Verlag, Berlin, 1992, pp. 431{
445.
[70] Zhang, H., and Kapur, D., First-order logic theorem proving using conditional rewrite
rules. In: E. Lusk and R. Overbeek (eds.), Proc. Ninth International Conference on Auto-
mated Deduction, Lecture Notes in Computer Science, Vol. 310, Springer-Verlag, Berlin,
1988, pp. 1{20.
[71] Zhang, H., and Kapur, D., Unnecessary inferences in associative-commutative completion
procedures, J. Mathematical System Theory 23 (1990) 175{206.
29
[72] Zhang, H., Kapur, D., and Krishnamoorthy, M. S., A mechanizable induction principle
for equational specications. In: Proc. Ninth International Conference on Automated De-
duction, E. Lusk and R. Overbeek (eds.), Lecture Notes in Computer Science, Vol. 310,
Springer-Verlag, Berlin, 1988, pp. 250{265.
30