Professional Documents
Culture Documents
Notes de Cours 02
Notes de Cours 02
14-31 (1990)
1. INTRODUCTION
Knuth and Bendix (1970) gave a test for checking the confluence (or
Church-Rosser) property of a Noetherian (or finitely terminating) term
rewriting system. Based on this test, they also described a procedure which
often generates an equivalent Noetherian and confluent (also called canoni-
cal or complete) system from the original term rewriting system. This
procedure is usually referred to as the Knuth-Bendix completion
procedure. A complete term rewriting system possesses nice properties
including the one that every congruence class of terms induced by the
rewriting system has a unique normal form. Because of this property, there
has been considerable interest in complete term rewriting systems and the
Knuth-Bendix completion procedure due to their applications in
automated theorem proving, solving of word problems, analysis and
reasoning about abstract data type specifications, etc.
There are, however, examples of Noetherian term rewriting systems that
are not confluent and which cannot be completed in a finite number of
steps (Kapur and Narendran, 1985). On the other hand, the requirement
* Partially supported by the National Science Foundation under Grant DCR-8408461. This
work was done when the authors were at General Electric Research and Development Center,
Schenectady, NY.
+ Present address: Department of Mathematics, University of Kassel. 3500 Kassel, Federal
Republic of Germany.
14
0890-5401/90 $3.00
Copyright c> 1990 by Academic Press, Inc.
All rights of reproduction in any form reserved.
TERM REWRITING SYSTEMS 15
2. PRELIMINARIES
free term algebra generated by F and V, and G = T(F, a) denotes the set
of ground-terms over F. The depth d(t) of a term t E T is defined inductively
as follows: d(t) = 0 if t E V or t E F with c((t) = 0, i.e., if t is a variable or a
constant, and d(t)= 1 +max{d(t,), d(tz), .... d(t,)) if t=f(t,, t,, .... t,),
where fe F with cc(f)=n, and f,, t,, .... t, E T. Obviously, G# @ if and
only if F contains at least one constant. In the following we shall only be
dealing with sets of function symbols F containing at least one constant.
A term rewriting system R on T is a set of pairs of terms
R= ((li,ri)li~Z} such that, for all (I, r) E R, if a variable v E V occurs in r,
then it also occurs in 1. A term rewriting system R induces a single-step
reduction relation aR on T, the reflexive transitive closure of which is the
reduction relation =i induced by R, and the reflexive, symmetric, and
transitive closure of which is the congruence HZ generated by R. As usual
R is called Noetherian, if there is no infinite chain of reductions
t,*. t, ==-Rtl*R..., it is called confluent, if for ail t,, t,, t, E T, t, 32 t,
and t, *z t, imply that t, *z t, and t, *g t4 for some t4 E T, and it is
called canonical or complete, if it is both Noetherian and confluent.
If R is complete, then every congruence class [tlR modulo +-+f contains
a unique irreducible term, which can then be taken as the normal form of
its class.
In general it is undecidable whether or not a finite term rewriting system
R is Noetherian (Huet and Lankford, 1978), and it is undecidable whether
or not it is confluent (Bauer and Otto, 1984). However, if R is Noetherian,
then its confluence can be checked by considering its critical pairs (Knuth
and Bendix, 1970).
Here we are interested in the following decision problem:
INSTANCE: A finite Noetherian term rewriting system R on T= T(F, V).
QUESTION: Is R ground-confluent?
A term rewriting system R on T= T(F, V) is called ground-confluent if, for
all ground-terms t, E G = T(F, a), the following condition holds: whenever
t, =X t, and t, *s t,, then there exists a term t, such that t,az t4 and
f, $2 rd. Observe that since t , is a ground-term, also t2, t3, and t, are
ground-terms. Thus, we are actually dealing only with the reduction rela-
tion *i restricted to ground-terms. Before turning to the above decision
problem, we want to derive a characterization for ground-confluent
systems.
For t E T, V(t) denotes the set of variables occurring in t. Two terms
u, v E Tare called joinable, if they have a common descendant modulo =-g,
and they are called ground-joinabfe, if rr(u) and a(v) are joinable for each
ground-substitution g: V(u) u V(v) + G.
THEOREM 2.1. Let R be a Noetherian term rewriting system on T. R is
TERM REWRITING SYSTEMS 17
ground-confluent tf and only if, for each critical pair (u, v) of R, u and v are
ground-joinable.
The proof of this theorem is essentially parallel to the one showing that
a Noetherian system is confluent if and only if each of its critical pairs is
joinable. Here it is enough to notice that whenever we apply a rule (l, r) E R
to some ground-term t, then we actually substitute o(l) by a(r) for some
ground-substitution cr.
In order to check for ground-confluence it is sufficient to concentrate on
those critical pairs of R that are not joinable, since if a critical pair (u, v)
of R is joinable, then (u, v) is in particular ground-joinable. The converse,
however, does not hold in general as shown by the following example.
EXAMPLE 2.2. Let F = {L g, c >, where f and g are unary function sym-
bols, and c is a constant, and let R be the following term rewriting system
R = {f(g(f(x))) -, g(f(g(x))), f(c) -+ c, g(c) + c}. Using the result of
(Kapur and Narendran, 1985) it can be shown that R has no equivalent
finite complete rewriting system, i.e., there does not exist a finite complete
rewriting system R, on T= T(F, V) such that the congruences c--)X and
+-+z, coincide. But R is ground-confluent, since f(c) =X c and g(c) -s c
implying that all ground-terms reduce to c.
3. RESULTS
While it is very easy to show that the system R given in the above
example is ground-confluent, it turns out that it is undecidable in general
whether or not a finite Noetherian term rewriting system is ground-
confluent. More exactly, we have the following undecidability results.
#dd+d#
# $-+$
# ab+O for a,bEr-{##,O}, ab#dd
# a$-+O$ for aET-{#,O}
Oa+O for all aET
aO-+O for all a E IY
h,h,$+O$
h,h,d$+O$.
The letter d is used in the rules of group (a) to restrict the number of
simulation steps that can be performed by S. The last four rules of (a) shift
d’s to the left. Observe that a d can be shifted left across a letter s, EZ, or
a word h, h, only if a letter si or a word sjd with s, EC, u {h2) is preceding
sj or h, h2, respectively. Each simulation step costs two d’s, while each shift
costs one d.
Obviously, S is finite and length-reducing, for each rule (I, Y) ES,
r,I~r*ur*{$}, and if 1Ef*{$}, then also rsT*{$}.
CLAIM 1. S is confluent.
element on r*. There also are a few overlaps between rules of group (b)
and rules from (b) and (c), but it can be checked easily that all the
resulting critical pairs resolve. Thus, S is in fact confluent. 1
h,q,xh,h, # d2k+2”+3$
+z h,u~q,vh,hzd2m’2$=hou~q,a,a2~~~a,,h,h~d’m’Z$
For all .YE.X*. x$ L if and only if, for all WET*, h,q,.uh, h> # w$ ++~~OW$.
22 KAPUR, NARENDRAN, AND OTTO
are reduced to the constant &. In what follows let s, y, z, and u denote
distinct variables:
The system R, contains the following rules:
fk g,(y), 2, $) + &.
TERM REWRITING SYSTEMS 25
Let in (1,2 ,..., n}, and let ~~=a~a,~~~a~~,a~,a~ ,... ,u,EC. For
j= 1,2 , .... li, let ui,j = a, a, . . -a,- I. Then, for all j= 1, 2, .... l,, R,, contains
the rules
LEMMA 6.3. Let t,, t,, t,, tqe T(F- if, h), 0). Thenf(t,, t2, t,, t4)=;
& or.flt,, t2, t,, f4) =X $.
Proof: Let t,, t,, t,, t,E T(F- if; hJ, @), i.e., t,, t,, t,, t, are ground-
terms not containing any occurrences of the function symbols f and h. By
case analysis one can verify
COROLLARY 6.4. Let t,, tz, t,, t, E T(F - {J h), 0) such that
f(tl, t,, t,, t4)*l?; $. Then there exist integers i, E (1, 2, .... n- 1) and
.
12% 13, ..., i, E j2, 3, .... n-l> such that t,=uiluj~...ujnu,($), tz=gi,gi2...
g,g,,($), c~=u~,u~~...L~,~u,($), and t,= # ifi, = 1 or t,=$ ifi, > 1.
Using this observation we see that the pair (f(x, y, x, # ), &) being not
ground-joinable modulo R implies that (A, B) has a solution. Since
(f(x, y, X, # ), 8~) is the only unresolved critical pair of R,, this yields the
following.
fk y, -x, # ) -+ &,
h(x, y) + &.
,f(u,(x), g,(y), u,(z), #)-f(?c, J’, Z, $) of R,. As can be seen easily the
resulting critical pair is not ground-joinable if (A, B) has a solution. On the
other hand, Lemma 6.3 and Corollary 6.4 still apply, and hence, if R, is
not ground-confluent, then (A, B) has a solution. This proves part (b) of
Theorem 3.3.
show that this is decidable for systems in which every rule satisfies property
W).
From condition (PP) we can immediately infer the following.
LEMMA 1.1. Let R be a term rewriting system such that every rule of R
satisfies (PP), and let s and t be two terms. Then it is decidable whether s
and t are ground I-joinable modulo R.
If such a substitution does exist, then s and t are not ground I-joinable.
So assume that no such substitution exists. If s and t are not ground
I-joinable, then there exists a normalized ground-substitution 6’ such that
e(s) and Q(t) are not I-joinable as otherwise s and t would be ground
I-joinable. The existence of such a ground-substitution 8 can now be
decided using narrowing (see Hullot, 1980 for definitions).
By Lemma 7.5, for any normalized ground-substitution 0, innermost
reduction sequences to obtain normal forms of e(s) and d(t) involve reduc-
tions only at positions of s and t, respectively, and at every one of these
positions at most one step is applied. Hullot (1980) proved a technical
result (Theorem 1) which he informally described as follows: for any term
172and a normalized substitution rr, any reduction sequence from a(m) can
be “projected” on a narrowing sequence from m and conversely, any
narrowing sequence from m may be considered as the “projection” of a
certain class of reduction sequences. From that result, it follows that
corresponding to the innermost reduction sequences on 8(s) and e(t)
discussed above, there are narrowing sequences involving the same
positions and the same rules.
Consider the positions in s and in t in innermost order. For each of these
positions we can choose a rule to use in narrowing, thus obtaining a sub-
stitution (T that is the composition of the substitutions found in the single
steps of narrowing. Since there are only finitely many choices involved
(determined by the number of rules of R), it is possible to generate all
possible narrowing sequences and their corresponding substitutions.
For each substitution c so obtained, compute the normal forms n, and
n, of a(s) and o(t), respectively, that are obtained by the corresponding
reduction sequences. If s and t are not ground I-joinable, then there is at
least one such substitution G for which the corresponding normal forms n,
and n2 have the following property: there exists a ground-substitution p
such that p(nl) and p(n2) are irreducible with respect to R, and
p(nl) #p(q). The composition p 0 (i then is the desired ground-substitution
8. Since by Lemma 7.6 it is decidable whether or not such a ground-
substitution p exists, this completes the proof of Lemma 7.7. 1
30 KAPUR, NARENDRAN, AND OTTO
ACKNOWLEDGMENTS
We thank Professor R. V. Book for helpful discussions at an early stage of this work and
the referees for useful suggestions.
REFERENCES
BAUER, G. AND OTTO, F. (1984), Finite complete rewriting systemsand the complexity of the
word problem, Acta Inform. 21. 521-540.
FRIBOURG, L. (19861, A strong restriction of the inductive completion procedure, in
“Proceedings, ICALP,” Rennes, France.
BOOK, R. V. (1982), Confluent and other types of Thue systems,J. Assoc. Comput. Mach. 29,
171-182.
GALLIER, J. H. AND BOOK, R. V. (1985), Reductions in tree replacement systems, Theoret.
Comput. Sci. 31, 123-150.
GOEBEL, R. (1985), A specialized Knuth-Bendix algorithm for inductive proofs. in
“Proceedings of a Workshop on Combinatorial Algorithms in Algebraic Structures,”
Otzenhausen, Fed. Rep. Germany, Sept. 3cOct. 4, 1985, (J. Avenhaus and K. Madlener,
Eds.), Fachbereich Informatik, Universitaet Kaiserslautern.
HOPCROFT, J. E. AND ULLMAN, J. D. (1979) “Introduction To Automata Theory, Languages,
and Computation,” Addison-Wesley. Reading, MA.
TERM REWRITING SYSTEMS 31
HUET, G. ANU LANKFORD. D. S. (1978), “On the Uniform Halting Problem for Term
Rewriting Systems,” Lab. Rep. No. 283, INRIA. Le Chesnay, France.
HULLOT. J. M. (1980), Canonical forms and unification, in “5th Conf. on Automated
Deduction,” Lect. Notes in Comput. Sci.. Vol. 87, pp. 318-334.
JOUANNAUU, J. P. ANU KOUNALIS. E. Proofs by induction in equational theories without
constructors, in “IEEE Symp. on Logic in Comput. Science,” Cambridge, Mass.. June
1986. pp. 358-366.
KAPUR, D. AND MUSSER, D. R. “Proof by Consistency,” G. E. R & D Center Report
GEN84008, April 1984; Artif: Infell. J., in press.
KAPUR, D. AND NARENDRAN. P. (1985), A finite Thue system with decidable word problem
and without equivalent finite canonical system, Theoret. Comput. Sci. 35, 337-344.
KAPUR, D., NARENDRAN, P. AND ZHANG. H. (1986), On sufficient-completenes and related
properties of term rewriting systems. Acta Inform. 24, 395416.
KAPUR, D.. NARENDRAN. P. AND ZHANG. H. (1986). Complexity of sufficient completeness, in
“Proceedings. 6th Conf. on Foundations of Software Technology and Theoretical Comput.
Sci.,” New Delhi, India. Dec. 18-20, Lecture Notes Computer Science, Vol. 241,
pp. 42&442.
KNUTH. D. AND BENDIX. P. ( 1970), Simple word problems in universal algebra, in “Computa-
tional Problems in Abstract Algebra,” (J. Leech. Ed.), pp. 263-297, Pergamon. Elmsford,
NY.
KUECHLIN. W. (1986), “Equational Completion by Proof Simplification.” Report No. 86-02,
ETH Zurich, Switzerland, May.
LEWIS. H. R. AND PAPADIMITRIOU. C. H. (1981). “Elements of the Theory of Computation,”
Prentice-Hall, Englewood Cliffs, NJ.
OTTO, F. (1986), On two problems related to cancellativity, in “Semigroup Forum 33,”
pp. 331-356.
PADAWITZ, P. (1980). New results on completeness and consistency of abstract data types, in
“Mathematical Foundations of Computer Science 1980,” Lect. Notes in Comput. Sci..
Vol. 88, pp. 46&473. Springer-Verlag. New York/Berlin.
PLAISTED, D. A. (1985), Semantic confluence tests and completion methods, Infortn. und
Control 65. 182-215.
&MY. J. L. (1982), “etude des Systtmes de ReCcriture Conditionnels et Application aux
Types Abstraits Algtbriques.” Tht%e d’l?tat, Nancy.
ZHANG, H. AND REMY, J. L. (1985). Contextual rewriting; in “Rewriting Techniques and
Applications,” (J. P. Jouannaud, Ed.), pp. 46-62, Lect. Notes in Comput. Sci., Vol. 202,
Springer-Verlag. New York/Berlin.