BF02573590

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Semigroup Forum Vol.

25 (1982) 83-110

RESEARCH ARTICLE

A NOETHERIAN AND CONFLUENT REWRITE SYSTEM


FOR IDEMPOTENT SEMIGROUPS

J. Siekmann a n d P. Szabb

Communicated b y K. Keimel

ABSTRACT: Let B be a semigroup with the additional relation

V w E B. ww = w

B is c a l l e d a band or an idempotent semigroup [3].

It is s h o w n in t h i s paper that the replacement rules


(rewrites) resulting from the axiom of idempotence:

xx ~ x
x ~ xx

can be replaced by the Noetherian, confluent, conditional


rewrites (i.e. a terminating replacement system having the
Church-Rosser-Property):

xx ~ x
cI' cI
xyz ~ xz if x = z and xy = z.

These rewrites are used to o b t a i n a unique normal form for


words in B a n d hence are the basis for a decision procedure
for word e q u a l i t y in B.

The proof techniques are ba~ed upon term rewriting systems


[7] rather than the usual algebraic approach. Alternative
and simpler proofs of a result reported earlier by G r e e n
and Rees [4] and Gerhardt[6] have been obtained.

0037-1912/82/0025-0083 $05.60
9 1982 Springer-Verlag New York Inc.
SIEKMANN AND SZABO

I. M O T I V A T I O N

1.1. C o n f l u e n t Noetherian rewriting systems [7] are of


considerable practical importance in c o m p u t e r science: e.g.
abstract d a t a types [5], automated theorem proving [14],
computer algebra [12] and u n i f i c a t i o n theory [16], [20].

Unfortunately any a x i o m set w h i c h includes the a x i o m of


idempotence could not so far be u s e d for a term r e w r i t i n g
s y s t e m due to the n o n - N o e t h e r i a n (i.e. n o n t e r m i n a t i n g )
nature of the r e p l a c e m e n t rule [8]:
x ~ xx.

Although it is not d i f f i c u l t to o b t a i n a c o n f l u e n t and


Noetherian rewriting system for the s i n g l e axiom of
idempotence (see s e c t i o n 4.4), the s i t u a t i o n changes if the
two axioms of i d e m p o t e n c e and a s s o c i a t i v i t y are involved.

Once a N o e t h e r i a n and c o n f l u e n t rewriting system for


associativity and i d e m p o t e n c y has b e e n o b t a i n e d , it is
possible to e x t e n d this r e s u l t to l a r g e r sets of axioms:
on the basis of [6], theorem 4.33 it is p o s s i b l e to code
the r e m a i n i n g equational axioms into a single one.

1.2. A c o n f l u e n t Noetherian rewriting system for an


equational t h e o r y T can be used to o b t a i n a unique normal
form for terms and is t h e r e f o r e o f t e n an i m p o r t a n t p r e -
r e q u i s i t e for a unification algorithm in T [19]. The T-
unification algorithm, where T consists of the a x i o m s of
associativity and idempotence [17] is b a s e d on the r e w r i t e s
proposed in this paper.

1.3. Let F A be the free semigroup generated by the


alphabet A and let BA, the free b a n d generated by A, be
FA/I, where I is the s m a l l e s t congruence on FA containing
the r e l a t i o n {(ww,w) lw 6 FA}. It is not o b v i o u s whether or
not two d i f f e r e n t w o r d s w I and w 2 in F denote the same
element in B A . An a l g o r i t h m based on the w o r k of G r e e n and
Rees [4] and G e r h a r d t [ 6 ] , which decides whether or not

84
SIEKMANN AND SZAB0

61] I = ~ 2 ] I ' is p r e s e n t e d in [9]. T h i s a l g o r i t h m is b a s e d


on the following observation: For a w o r d w s FA let {w} be
the content8 of w, i.e. the set of letters of A a p p e a r i n g
in w,

(RULE C) If {y} c {z} and {x} = {z} then

[xyz~=[xz~; x,y,z 6 FA

As RULE C is u s e d as the b a s i s for our second rewrite, we


give an a l t e r n a t i v e and simpler proof based solely on t h e
notions of t e r m r e w r i t i n g systems.

1.4. It s h o u l d be n o t e d t h a t the structure resulting


from associativity a n d the single rule

xx -~ x

(i.e. n o t r u l e x ~ xx) has been investigated under the


name of 'nonrepetitive words'[iO], chapter 1.8 . However
this is v e r y different f r o m the s t r u c t u r e investigated
here: for e x a m p l e there exists an infinite number of n o n -
repetitive words, whereas finitely generated free bands
have only a finite number of e l e m e n t s [4]. T h e r e is no
confluent rewriting system for n o n r e p e t i t i v e words either;
as d e m o n s t r a t e d below by c o u n t e r e x a m p l e 2.

1.5. In order t o p r o v i d e s a ~ e i n s i g h t i n t o t h e problems involved


we present a few e x a m p l e s , where e a c h of the n u m b e r e d l i n e s
(1.5.n) represents an i n i t i a l attempt, which is s u b -
sequently shown to be insufficient.

Given two words wl, w 2 6 FA l e t us w r i t e w[ ~ w 2 iff t h e y


constitute the same element in BA.

A word u v v w s FA m a y be r e p l a c e d by uvw, since it r e p r e s e n t s


the s a m e element in BA. We write uvvw ~ uvw for s u c h an
c
elementary c-transition a n d u ~-- w for a c h a i n of e l e m e n t a r y
c
c-transitions. Similarily: uvw ~ uvvw, and u ~ w is a
e
chain of e l e m e n t a r y c- or e - t r a n s i t i o n s . T h e n :

85
SIEKMANN AND SZABO

I * *
(I .5.1) W 1 = W 2 iff HV. W 1 ~-~ V and w 2 ~-~ v

But this is a very unsatisfactory situation. Because of the


e-transitions there is no unique element v and in general
it is not all easy to see whether such a word v exists or
not. Hence our intention to eliminate ~-~.
e

A word w 6 FA is terminal if ~ V . W ~-~ V. L e t T E R ( w ) be the


c ,
set of all terminal words obtainable from w by ~-~. T h e n
c
(1.5.1) could be replaced by:

I
(I .5.2) wI = w2 iff TER(W 1 ) D T E R ( W 2) #

Since TER is always finite this would solve the problem.

Counterexample 1:

Let w I = abc and w~_ = a b c b abc


Then TER(wl) = {abc}; T E R ( w 2) = {abc b abc}
I
and hence TER(wl) n TER(~ ) = ~, thus Wl% w 2 .
However:

w I = __abc ~-~e a b abc ~e ab abc babc ~c abc b abc = w2

and hence w I ~ w 2 , which disproves (1.5.2).

This counterexample can be generalized to the following


observation, which will be made use of later:

PROPOSITION 1.1: V U, w 6 FA
w u w ~-~ w if u is a subword of w

proof: W U W = W 1 U W2 U W 1 U W2

~e wl u wI u w2 u wI u w2

uw 2

uw2 =w

If we define w u w m--~ w as a single cc-transition, (1.5.2)


cc
can be replaced by:

86
SIEKMANN AND S Z A B O

I * *
(1.5.3) w I = w2 iff 3v. wlm-~ v and w2= ; v
where = ~ := ~ U m-~
c CC

Since both transitions terminate, this would be a basis for


a Noetherian and confluent rewriting system, but:

Counterexample 2:
w = ab abc bac acb abc acb aba
O

ab abc bac bab cac ba ba ab abc ba cac bab a

ab abc bac bab cac ba a b c ba ca cba ba

ab ab cba bca cba a b c b ac ba ba

ab ab c a c ba abc bac ba

w I = abc a cba ab cba = w2

Hence we have two words w I ,w 2 6 FA with Wo ~ wI and


Wo~ w 2 , i.e. w I I w2 however w I and w 2cannOt be further
reduced by ~ nor by r. ; and w1 * w2 .
C CC

This example leads to our final generalization, which we


shall prove later on once a notational framework has been
fixed:
V u, v, w 6 F
A
(1.5.4) UVW ~ uw if {v} c {u} = {W}

2. NOTATION AND DEFINITIONS

Let f be a binary function symbol and let A be a non-


empty set (the alphabet). We define the set of terms TERM
as the least set such that A c TERM and if s,t s TERM then
f(s,t) s TERM.

We are interested in t h e o r i e s consisting of combinations of


the following three axioms for f:

87
SIEKMANN AND SZABO

(ASS) V u, v, w 6 TERM. f(f(u,v),w) = f(u,f(v,w))


(ID) V w C TERM. f (w,w) = w
(COM) u v, w 6 TERM. f(v,w) = f(w,v)

2. I. L e t T ~ u = v denote that equation u = v is derivable


from the set of closed equations T in a suitable logical
calculus (i.e. u = v is true in T). This is abbreviated to
T
u = v; u is T-equal t o v. Since we assume (ASS) to hold
throughout the rest of this paper, we shall omit the
function symbol f and represent it as u s u a l by the
concatenation of words. That is, we identify the associative
structure on TERM with FA and represent its elements as
words i n A*, where A 9 is the least set with A c A* and if
u, v 6 A* then uv 6 A*. { (ASS), (ID), (COM) } ~ u = v is
then abbreviated to u I~ v and { (ASS), (ID) } ~ u = v is
abbreviated to u I= v, u, v s A*. Such an e q u i v a l e n c e class
method is also proposed in [13].
2.2.Let lwl be the length (number of symbols)
w 6 A*. Let V be a denumerable set, A n V = ~, (the set of
variables) and let W = A u v. A substitution o is a m a p p i n g
from V to W* with o(v) = v,v s V almost everywhere (i.e.
except for a finite number of points) and is extended to
W* by the usual endomorphism. ~ is represented as t h e finite
set of pairs ~ = { (v I lw 1 )... ( V m l W m ) } f o r v. 6 V and w 6 W*.
1 l
The set of substitutions is SUB.

We use ~ for the Occurrence relation: u occurs i n w, u~w,


iff w = w I u w2.
For w 6 W* Var(w) = {vlv s V and v ~ w} is the set of
variables occurring in w o r d w.
The set
R = {(i I - - r I if ~ T ~i ) .... ,(i n -- r n if ~n T=)_n )}
w h e r e ii , r i 6 W* and ~i _~ixiis a T-equation over W*, is
a conditional rewriting system if V a r ( r i) c_ Var(li) , for
1<_i_<n. A conditional rewriting system R is used to define
the relation - ~ c A* x A* as follows:

u -~ v iff u = u lwu 2 and if there exists ~ 6 SUB and


(i ~ r if ~ T X) s R such that w = o(i) and v = uI ~ ( r ) u 2

88
SIEKMANN AND SZABO

and s(~) T ~(~) is true, where u, Ul, u2, v, o(r), w 6 A*.

Example: Let R = {(xyx ~ x if xy C=II x ) } with t h e corresponding


relation O-~.
Then dabc b abcdO-~ dabcd, with ~ = {(xlabc) (y!b)} ,

u I = u2 = d, w = abc b abc and


~(xy) = abcb c___I a b c = o(x).

This rewriting system allows us to replace the word wvw by


w if {v} c {w}, according to (1.5.4).
Alternative definitions for conditional rewriting systems
are discussed in [I].

It should be noted that the definition of --~ r e s t s on the


fact that a 6 SUB can effectively be computed, which may
not be immediately obvious for strings in W*. However it
can be shown that the one-way unification problem for
monoids is d e c i d a b l e and there are at most a finite number
of such substitutions ~[18]. If the conditional part in R
is omitted, the set of pairs:

R = {(11 ~ rI ), (12 ~ r 2 ) , . . . , (in ~ rn )}

is c a l l e d a rewriting system, and -~ is o b t a i n e d accordingly.

-~ is the reflexive, transitive closure of -~.

We say the relation ~ is Noetherian iff there is n o infinite

sequence: u I ~ u2 ~ u3 ~ ....
A relation ~ is confluent iff

V u, v, w 6 A*: if u -~ v and u -~ w then


3z s A* with v ~ z and w ~ z.

Confluence can be illustrated diagrammatically as:

v
/A w
~, lJ

where the dotted lines represent existential quantification.

89
SIEKMANN AND SZABO

A relation ~ is locally confluent i f f

V u, v, w 6 A~: if u ~ v a n d u ~ w then
3z s A ~ w i t h v ~ z and w ~-~ z.

Diagrammatically: u

w
\ /

A Noetherian and confluent relation ~ is c a l l e d canonical


and the rewriting system R corresponding to ~ is a l s o called
Noetherian, confluent or canonical.

A canonical rewriting system allows the computation of a


unique normal form for a word w:
A word u s A~ is terminal if t h e r e d o e s n o t e x i s t a w o r d v
with u ~ v. Since ~ is N o e t h e r i a n , for every word w s A~
there exists a word v with w ~v such that v is terminal.
Since ~ is c o n f l u e n t , v is u n i q u e , v is t h e normal form of
word w, which is d e n o t e d as llw11.

If a n equational theory T has a canonical rewriting system


we have
T
U = V iff llUll= llvll

and for that reason they are an important basis for the
treatment of T - e q u a l i t y on a computer. Huet and Oppen [7]
present a survey of some general techniques of how a
canonical rewriting system can be obtained for a given T.
Unfortunately none of these general techniques apply for a
set of equational axioms which includes associativity and
idempotence, although these two axioms often occur in
practical applications [8].

In t h i s paper we have confined our attention to the special


case of associativity and idempotence, however we believe
that our method of canonicalization can be applied to o t h e r
equational theories as w e l l for which the standard methods
fail.

9@
SIEKMANN AND SZABO

3. THE PROBLEM

An obvious rewriting system for the axiom of idempotence


is:
I = { (XX ~ X), (X ~ X X ) }
o c e
where ,~ i s a step by extension
e
and ~ is a step by collapse.
C

I is used to obtain the standard relations I--,, a n d ~ and


0 C e

C e

Hence we have:

V u, V 6 A*.
I
(3.1) u = V iff H w 6 A* such that
u e-~ w and v ~ w.

But (3.1) is not a basis for a computational treatment of


I-Equality since it does not show how to compute w.

Because ~ and consequently ~ are not Noetherian, I is not


e e o
a canonical rewriting system. Hence our intention to replace
I by a canonical rewriting system I such that
o C

I
wI : W2 iff llw1! 1 : !lw211 for wl, w2 6 A*,

where the normal form nlwll is c o m p u t e d on the basis of I .


C

4. RESULTS

We now replace the obvious rewriting system I of the


O
previous section by the following conditional rewriting
system:
I := {(xx ~ x),
C

cI
(xyz ~ xz if x ~ z and
CC
cI
xy ~ z)}

Let ~-~ := O-~c U ~c' where the relations ~-~c a n d --~cco n A *


are obtained from IC The computability of ~ depends on
the decidability of CI-equality, i.e. the decidability of

91
S I E K M A N N AND SZABO

word equality in commutative bands, which is obvious:

cI
u ----- w iff {u} = {w}.

In the following paragraphs we show that I


is a c a n o n i c a l
c
rewriting system and also that the replacement of I by I
o c
is v a l i d .
On the basis of I the nontrivial problem of equality in
c
bands is reduced to the trivial problem of equality in
commutative bands.
We believe that no unconditional canonical rewriting system
exists as a valid replacement for I , which would explain
o
why the standard methods of canonicalization [7] failed in
the past [8].

4.1 Soundness of ,--~.

We have to show that I is a correct (8ound) system in


c
the sense that if w 1 o~* w 2 then w 1 ~ w2 . This is easily seen
for wI ~ w 2, but less obvious for w I c~ w2 .

LEMMA 4.1: V v, w 6 A*:


CI I
if w = wv then wvw = w.

proof: (by i n d u c t i o n on Ivl)


(i) Inductionbase: Ivl = I, i.e. v = a, a 6 A
cI
If w = wa then a ~w, let w = ~ aw 2 .
Then wvw = wlaw2awlaw 2

~ wla ~ = w by Prop. 1.1.

Hence by (3.1) :
I
wvw = w
(2) Inductionhyp.: Ivl = n, let v = ala 2 ...a n 6 A*.
CI I
If w ~- wv then wvw = w.

Suppose Ivl = n+1, i.e. let v = ua, a 6 A, lu[ = n .


wvw = wua w
I I
wuw ua wuw since w = wuw by Ind.hypothesis

92
SIEKMANN AND SZABO

~-~ w u w ua wuwu w
e
I I
= wuwu W since WU WU a WU wu = WUWU
by Ind. base

~-~ w u w
c
I
= w since w ~ wuw by Ind. hypothesis.

LEMMA 4.2: u u, V, W s A ~

If u CI W and uv CI
~- w then uvw =I u w .
cI cI
proof: If u ~ W then u ~ uw
cI
and w = wu.

Hence by lemma 4.1 we have:

(i) uwu I= u

(ii) WUW I W

Then :
I
uvw = uwu v wu w using (i) and (ii)
= ~ uvw~ defining ~ := u w
I
= W by lemma 4.1 using ~ uvw c___I
= uw

Lemma 4.2 is, in our notation, the same as Rule C, which


has also been observed in [2], [15] and [6]. We have given
an alternative proof in order to base this paper solely on
the notions of T-equality and term rewriting systems.
The standard proof (see [9]) is in contrast more complicated
and also requires substantial results from semigroup theory.

Lemma 4.1 and lemma 4.2 prove the following soundness


theorem:

THEOREM 4.1: (Soundness) V u, v 6 A~


I
If u ~-~ v then u = v.

93
SIEKMANN AND SZABO

4.2 Confluence of ~-~.


We first demonstrate the local confluence by c o n s i d e r i n g
the three possible combinations of ~ a n d ~-~. T h e p r o o f s
C CC
are rather technical and for t h a t reason are collected in
the appendix.

LEMMA 4.3: V U, v, w E A ~ .

If U ~-. V a n d u ~-~ w t h e n Bz s A ~
C C
such that v ~ z and w ~ z

LEMMA 4.4: V U, v, W 6 A ~ .

If u ' - ~ V a n d u ~-~ w t h e n Hz 6 A ~
C CC
such that v ~ z and w ~ z.

LEMMA 4.5:
V u, v, W E A ~ .

If u - -C C~ v a n d u ~-~
CC
w then Bz s A ~
e
such that v ~-~ z and w~-.-~ z.

This demonstrates the local confluence of'--~ and p r o v e s the


following theorem:

THEOREM 4.2: ,-~ is a N o e t h e r i a n , confluent relation. I

proof: It is o b v i o u s t h a t t h e r e are no i n f i n i t e c h a i n s

u ~'~c vl ~ v2 ~ c "'"

u.-. .-....
CC CC

since Ivi l>[vi+l I and I~i l>IVi+iI 9

A Noetherian, locally confluent relation is


confluent by a theorem of N e w m a n (see [ii]).

Some readers may be more familiar with the notion t h a t ~-~


"is t e r m i n a t i n g and has the Church-Rosser-Property".

94
SIEKMANN AND SZABO

4.3 A Decision Procedure B a s e d on,--*.

The following theorem states our main result; where


IIwlI is the normal form of w based o n *-~.

THEOREM 4.3: V u, v 6 A*.


I
u iff l[ull -- l[v!l

proof: "-" u ~ [lu][ by Definition,


hence u ~ ]]ull by Theorem 4.1.
v*-~ ]]VII by Definition,
hence v ~ ][vll by Theorem 4.1.
Hence v ~ IIvll= llull ~ u.

11 ml~ I1 I
If u = v then by (3.1) and due to the fact that*--* is
symmetric there exists a chain

(i) u ~ v.
The proof is by induction on n, where n = lu ~ v] i.e.
the number of rewrite steps in (i).

n = O: Then u = v and since ~-~ is confluent it follows


that ]]ul] = ]lV][.
Suppose the theorem holds for all u, w with u ~ w,
where Iu ~ w I < n.

Let u ~ v have n+1 steps, i.e.

U ~-~ W ~'-~ V .

Then by induction hypothesis llull = IIwll.

Case I : w ~-~ v. Since ~-~ is a l s o contained in .-~,


C C
~-~=~-~ , w e have by the confluence of--~:
C C
Hz. w ~ z and v ~ z. Let z be terminal, then
z = ITwll -- llvll.

Case 2: w ~-~ v. Take the reverse step v ~-~ w, and as


e c
in case I there exists z with v ~ z and w*~ z. For
z terminal, again we have z = llwlI = llvIl.

95
SIEKMANN AND SZABO

Hence in either case

llult = llwll = llvll

In applications the problem wI ~ w2 is usually not presented


in A * but in TERM. Define a homomorphism ~: TERM ~ A9 that
maps a term in its "string"-representation as mentioned
in 2.1.

Then: { (ASS) , (ID) } ~ w I = w2 iff { (ID) } ~ q0(w I ) = %0(w 2) ,


for w I, w2 6 TERM.
Hence we have as an obvious consequence:

COROLLARY: V s, t s TERM:
{(ASS),(ID)} ~ s = t iff ll~(s)II = ll~(t)II .

4.4 Idempotence without Associativity


Let 11 = {(f(x,x) ~ x)} and let ~-* b e the associated
relation on words in TERM.

~-~ is locally confluent on TERM:

PROPOSITION 4.1: V u, v, w 6 TERM with u ~-~ v and u o-~ w


there exists z 6 TERM such that

v ~-~ z and w ~ z.

proof: (by induction on the number of function symbols f


in u)

n=1: u = f(a,a) for some a s A and hence v = w = a.

Suppose the theorem is true for all terms u with at


most n function symbols f.
Let u = f(s,t) with n+1 function symbols:
I (~ ^ A
Case l:If s=t and v = s , w = f ,t) with s ~-~ s; set z = s.
A A A
Case 2: v = f(s,t) w = f(s,t) with s ~-~ s
A
t~-~ t
^ A
Set z = f(s,t).
A
A A A
Case 3: v = f(s,t), w = f(s,t) with s ~--~s

96
SIEKMANN AND SZABO

^
S ~-~ S, S # S.
Then exists by induction hypothesis A
z with
^ 9 ^ ~ ~ ^
S ~--+ Z and s o-~ z.

Set z = f(zA,t).

S i n c e o-~ i s locally confluent and Noetherian:

PROPOSITION 4.2: o-~ is confluent on TERM.

Using the confluence o f ~-~ w e have the following theorem,


which is proved analogously to Theorem 4.3:

THEOREM 4.4:

I
V u, v 6 TERM: is by ~.
{ID} ~ u: v iff llull = !Ivli
where the normal form !lull 9 obtained

Proposition 4.1 and 4.2 are also an immediate consequence


of the results in Knuth-Bendix [12]: f(x,x) ~ x is clearly
Noetherian. It is also locally confluent, since there are
no critical pairs. Hence follows confluence.
This was pointed out to u s by D. Lankford; we presented the
proof of P.4.1 in order to keep this paper selfcontained.

5. APPENDIX: PROOFS

The proofs for the three lemmas of section 4.2 are now
collected.

I n order to prove Lemma 4.3 we make use of the following four


propositions, each of which is of the form V u, v, w: if
u ~-~ v and u ~-+ w then 3z. v --~ z a n d w ~-+ z, w h e r e
c c
c cc

Diagrammatically: u = u Ixx u2 = u3yy u4

//c
v = u lx 2 u4 = w

97
SIEZ,MANN AND SZAB6

The four propositions capture the relevant situations

arising from the relative position of xx to yy. Throughout

let us assume u, u i, v, vi, x, xi, y, Yi to be words in A*.

The first proposition may be illustrated:

u I x x u2
, ~ L r ~
:x1: ,x2
I i t I
I I

u 3 Y Y u4

PJ?OPOSITION 5. I: Let u = u I xx u2 = u3 yy u4 with

u 3 = u I x I, x = x I yy x2 and u4 = x2 x u 2.
Let u~ v = u I x u2 and u~ c w
,
= u 3 y u 4.
Then: Bz. v~--~ z and w'- -" z .

proof: v = u I x u 2 with x = x I yy x2

= u I x I YY x 2 u2

u I x I y x2 u2 = z

w = u3 y u4 with u3 = u I x I

= Ul Xl Y U4 with u 4 = x2 x u 2
= u I x I y x2 x u2 with x = x I yy x2

= u I x I Y x2 x I YY x2 u2

c u I x I y x2 x I y x2 u 2~ u] x I y x2 u 2 = z

The next proposition may be illustrated:

Ul| x x u 2
I ~ 9 ~ ~, o I
,x I 'x , x~, ;x4 1
, T 2 ~ ~t I ,
i t I I
l i I t
, I ~ i $, , I
u3 Y Y u4

PROPOSITION 5.2: Let u = u I xx u 2 = u3 yy u4 with

x = x I x2 = x3 y x 4, y = x2 x 3, u3 = u I x 3, u4 = x 4 u 2.
Let u~ v = u I x u2 and u~ w = u 3 y u 4.
Then 3z. v ~-~ z and w o-~ z .

98
SIEKMANN AND SZABO

proof: w = u I x I y x4 u 2 with y = x 2 x 3

= u I x I x 2 x 3 x4 u 2 with x I x2 = x 3 y x 4

= u I x 3 Y x 4 x 3 x 4 u2 with y = x 2 x3

= u I x 3 x 2 x 3 x 4 x 3 x4 u 2 on x 3 x 4

u I x 3 x2 x 3 x4 u2 with x 2 x 3 = y

= u I x 3 Y x4 u2 with x 3 y x 4 = x

= u I x u 2 = v = z

The third proposition may be illustrated:

u I x x u 2
, : J ~ ~ It | J
IU 1 I I i
I 5 IXl I ,x21
I I I I
I t I I
I i t t
,,, L I ~ , j l
u 3 Y Y u 4

PROPOSITION 5.3: Let u = u I xx u2 = u 3 yy u 4

with u I = u 3 u5, y = u 5 Xl, x = x I y x2, u4 = x 2 x u 2.

Let u~ v = .u I x u2, u~ ~ = u 3 y u 4.
Then 3z. v~ = z and w~ ~ z.

proof: v = u I x u 2 with x = x I y x 2

= u I x I y x2 u 2 with u I = u3 u 5

= u 3 u 5 x I y x 2 u2 with u 5 x I = y

= u 3 yy x 2 u2 on y

u3 y x 2 u 2 with y = u 5 x I and u3u5=u 1

= u 3 u 5 x I x2 u2 = u I xI x 2 u 2 = z

w = u 3 y u 4 with y = u 5 x I

= u 3 u 5 x I u 4 with u 4 = x 2 x u 2

= u 3 u 5 x I x 2 x u 2 with x = x I y x2

= u 3 u 5 x I x2 x I y x2 u 2 with y = u 5 x~

= u 3 u5 x I x 2 x I u5 xI x 2 u2~u3u5xlx 2~xlx2~

~-c:U3 u5 x I x 2 u2 with u 3 u 5 = u I

= u I x I x 2 u 2 = ~ 9

The final proposition may be illustrated:

u I x x u 2
n p ! ! I
i ' I
',us :xl x2 ,'x3
! ,, 'I r'i i' i II i
u 3 Y Y u4
99
SIEKM~NN AND SZABO

PROPOSITION 5.4: Let u = u I xx u 2 = u 3 yy u 4 with

u I = u 3 u 5, y = u 5 Xl, x = x I x 2, y = x 2 x3, x = x 3 x4,

u 4 = x 4 u2 9
Let u~ v = #I x u2 and %~ w = u 3 y u 4.
Then Bz. v~ ~ z and w= ~ z.

proof: The equations x I x2 = x = x 3 x 4 of the hypoth~is

give rise to three cases:

C=8~ I: Ixll = Ix31; i.e. x I = x3, x 2 = x 4 .

Then v = u I x u2 with u I = u 3 u 5

= u 3 u5 x u 2 with x = x I x 2

= u 3 u 5 x I x 2 u 2 with x2 = x 4

= u 3 u5 x I x4 u 2 with y = u 5 xl,u 4 = x 4 u 2

= u 3 y u 4 = w

cas~ 2: Ixll > Ix31; i.e. x I : x 3 x 5 and hence

x 4 = x 5 x 2 9
Then: w = u 3 y u 4 with y = u 5 x I

= u 3 u 5 x I u 4 with u 4 = x 4 u2

= u 3 u 5 x I x~ u2 with u 3 u 5 = u 1

= u I x I x 4 u2 with x 4 = x 5 x 2

= u I x I x 5 x 2 u 2 with x I = x 3 x4

= u I x 3 x 5 x5 x 2 u2 on x 5

Ul x 3 x 5 x 2 u2 with x 3 x5 = x I

= u I x I x 2 u 2 with x I x 2 = x

= u I x u 2 = v

cas~ ~: Ixll < Ix31; i.e. x 3 = x I x5, x 2 = x 5 x4

v = u I x u 2 with u I = u 3 u 5

= u 3 u 5 x u 2 with x = x I x 2

= u3 u5 x I x 2 u2 with u 5 x I = y

= u 3 Y x 2 u 2 with y = x 2 x3,x2=x 5 x 4

= u 3 x 2 x 3 x 5 x 4 u 2 with x 3 = x I x 5

= u 3 x 2 x I x 5 x 5 x 4 u 2 on x 5

u3 x 2 x I x 5 x 4 u 2 with x I x 5 = x 3

= u 3 x 2 x 3 x 4 u 2 with x 4 u 2 = u 4

= u 3 x 2 x 3 u 4 with x 2 x 3 = y

= u 3 y u 4 = w

I00
SIEKMANN AND SZABO

These four propositions are now used to prove lemma 4.3:

proof: Let u be of the form:


u = u I xx u 2 = u 3 yy u 4 with ul,u2,u3,u4,x,y s A9
and v = u I x u2 and w = u 3 y u 4.
There are nine cases to b e considered, depending on t h e
relative position of xx and yy, i.e. depending on w h e -

ther: u I = u3 u2 = u4
lu1!>lu31 ! u 2 r < l u 4]
luII<lu31 lu21>tu41.

uI x x u2
case I: I
u~ L y 9
y u4 I ~ I~'uI = u 3, u 2 = u 4
Case 2: , u3 i, y . y . u4 , . ..... u I = UB,tU2l<lu41

Case 3: u~ t Y 9 Y ,u4 u_~-Ul = u3,1u21>lu41


i

Case 4: u 3 , iy , y u4 ,.......!uiI>lu31 , u 2 = u 4
Case 5: u 3 ~ iY Y* u4 t--.....! u I l > l u 3 1 ' 1 u 2 1 < l u 4 1
ease 6: u3 9 Y 9 Y.- u4 I- .... ! u 1 1 > l u 3 1 ' l u 2 1 > l u 4 1
Case 7: u3 9 ~ u4 i.......lu I! <!u31, u 2 = u 4
Case 8: u3 "YY"* ii u4 ,~f~.ru11 <lu3!,lu2! <lu41
Case 9: u3 k Y A [, u 4 m .... l u 1 ! < l u 3 ! , l u 2 1 > ! u 4 1

case 9: D e p e n d i n g on the relative length of y t h e r e are


exactly six cases, which c a n be p r o v e d with Prop.
5.3 and Prop. 5.4 using symmetry and exchanging
rSle of x a n d y.
Case 8: D e p e n d i n g on the relative position o f yy (insi-
de of x or overlapping) this c a s e can be proved by
Prop. 5.1 or by Prop. 5.2 respectively.

Case 7: S p e c i a l case of P r o p . 5.2 w i t h x 4 = e.


Ca8e 6: P a r a l l e l s Case 8, w h e r e the rSle of x a n d y is
exchanged.
Case 5: S y m m e t r i c to Case 9.
Case 4: S p e c i a l case of P r o p . 5.4 w i t h x 4 = e.
Case 3: S y m m e t r i c to Case 4.
Case 2: S y m m e t r i c to Case 7.
Case I: T r i v i a l , with v = w = z. 9

I01
SIEKMANN AND SZABO

In order to prove Lemma 4.4 we need two propositions:

PROPOSITION 5.5:
cI cI
Let u = rst with rs : r : t

Let r = rlr2r3, s =SlS 2 and r2 = r 3 s I.

L
r I
s !
t I

r 1 r 2 r 3 s 1 s 2 t

For u = rlr2r 3 S l S 2 t ~-~ r l r 3 SlS 2 t = v

u = rst ~-~ r t = w
cc

there exists p with v ~-~ p and w ~-~ p .

cI cI cI
Proof: S i n c e rlr2r 3 = t and r2 = r2r3: rlr2~-~-t
(5.5.1)
cI cI
Since rlr2r 3 = t : r3t : t

Now w = rt

= rlr2r 3 t
9e-c~ rlr 2 t by (5.5.1)

= p.

And v = rlr 3 SlS 2 t

= rlr 2 s2 t since r2 = r3 s1
cI
9C-C~ rlr 2 t by (5.5.1) and s2t =t

= p.

PROPOSITION 5.6 :
CI CI
Let u = ss = rxyzt with xy --~- x = z

L S L S ~ = U

r xyz t = u

For u = ss ~ s = v

u = rxyzt ~-~ rxzt = w


CC ~
there exists p with v ~-~ p and w ~-~ p .

Proof: Depending on the relative length of xyz there are

four cases:

Case 1 : s s = u
I, I I
i i i v v

r x y z t = u

102
SIEKMANN AND SZABO

u = ss ~-* s = p
c

u = rxyzt e-~ rxzt with rxy = s = zt


cc

= rx rxy

rxy = s = p.
c

Case 2: s = u
h ! i

Y x ' y ' z ' t' = u

Symmetric to case 1.

Case 3: L s ! s i = u

Yl Y2
'r ' x I ~ tz ' t " = u

Since s has Y2 as prefix and Yl as postfix,

we have s = Y2 s' Yl = rxYl = Y2 zt for some

s' 9 Hence s'y I = zt and y2 s ' = rx (5 . 6.1) .

Now u = ss ~ s = p
c

u = rxyzt--~ rxzt
cc

= y2 s' s'y I by (5.6.1)

Y2S'Yl

-- s
= p.

Case 4: l S ~ S j = U

'r ' x ' y' z I ' z2 ' t ~ = U

with z = ZlZ 2
CI CI CI
Observe: ZlZ ----- z ~ x ~ ZlX (5.6.2)

u = ss,~ s = p
c

u = rxyzt ~-~ rxzt


cc

= rxzlz2t with z2t = s = rxyz 1

= rxzlrx.y z1

~-~ rxrx y zI by (5.6.2)


cc

o-~ rx y z
c 1

= s

= p.

103
SIEKMANN AND SZABO

Proof of Lemma 4.4: The proof resembles the proof of 4.3 in


that there are the same nine cases depending o n the relative
length of Ul, u 2, u 3 and u 4. Unfortunately however,
each case has various subcases:
Each case is of the form:

U = u I SS U2~ U1 S U2 = V
CI CI
U = U 3 Xyz u 4 ~6~
c U 3 Xz U4 = W with xy ~ x ~--- z

and there exists p such that

v~-~ p and w ~-~ p.

Case I: u~ s s u~ = u
I I I i !

, D , ! !

(1.1.) u 3 x y z u 4 = u

u I ss u2 ~ uI s u2 = v = p

u 3 xyz u 4 ~c u3 xz u4 with
s=z=xy

= u 3 xxy u4

u 3 xy u4

= u 3 s u 4 = p.
(1.2.) u3 x ,y z
L u4 i

symmetric to (i.i.)
(1.3.) .u 3 x ~zY . ~
, u4 .
Y l Y2

Since xy I = s = Y2 z

we have: s = Y2 ~ Yl = Y2 ~ Yl (1.3.1.)
and hence x =

u I ss u2 ~ uI s u2 = v = p

u 3 xyz u 4 ~c u3 xz u4

= u3 Y2 xz Yl u4 by (1.3.1.)

since x =
c u3 Y2 ~ Yl u4

= u3 s u4 = p.

Case 2: uI s s u2
U ---~ I i i i I

u = ' u 3 ' xyz ~ U4 ~

]04
SIEKMANN AND SZABO

Depending on the relative length of xyz there


are three subcases each of which is an instance
of proposition 5.6 for the case r = e (i.e. r
the empty word).

u u
Case 3: u = t
1 !
s I
s !
2 I

u = ' ' xyz 'u 4 '

There are five subcases depending on the


relative length of xyz, each of which can be
proved on the basis of prop. 5.5 (for the
special case that r I is empty) and the obser-
cI
vation that if u~ v then u = v.

Case 4: Symmetric to c a s e 3.

Case 5: Symmetric to case 9.

Case 6: Depending on the relative length of xyz there


are five subcases, the only difficulty one is
shown in proposition 5.5.

Case 7: Symmetric to c a s e 2.

Case 8: There are three subcases each of which is shown


in proposition 5.6.

Case 9: Depending on the relative length of xyz there


are ten subcases:

uI s s u2

(9.1) ix,Y,Z~

(9.2) iX t yl Zl

(9.3) ,x 0 y , z ,

(9.4) ~x,y, z L

(9.5) i,
X | y i Z

(9.6) |,,,
X i Y I Z I .

(9.7) I
X
,Y i
Z
I.

(9.8) I
X
I
y , z ,

(9.9) i, x i y , Z ,1'

(9.10) I'x'y i
z
I.
)05
SIEKMANN AND SZABO

Cases 9.1, 9.2 and 9.5 are trivial.

(9.3) uI ss u2 ~ uI s u2 = v; let s = s I x Yl and

y = ylY2
uI s s I xyz u22 ~c Ul s s I xz u22 = w

w = uI s I x Yl Sl xz u22

with s = s I x Yl

e-~cc U l Sl x s I xz u22
CI cI
since y = ylY,Xy= x

uI s I xz u22

= p

v = uI s u2 = uI s I x Yl u2

= uI s I x Yl Y2 z u22

9c-~
c uI s I xz u22
= p

(9.4) This case can be shown by observing that since


y can be cut out in the second occurence of s
using a ~-~-step it can be cut out in the first
cc
occurence also.

(9.6) Similar to (9.3)


(9.7) Similar to (9.4)

(9.8) Let s = sI x YI' y = YlY2Y3 and u2 = u21 z u22.


Then

u = uI ss u2 ~ uI s u2 = v

u = u I s I xyz u22 ~c Ul Sl xz u22 = w = p.

Now v = uI s u2

= uI s I x Yl u2 " s = sI x Yl

= uI s I x Yl u21 z u22 , u 2 = u21 z u22


cI
~-~
cc
u I s I xz u22 , since Yl u21 z -~- z

= p.

(9.9) Let s = sI x YI' y = YlY2 ' s = Y2 Zl, z = ZlZ2,

u2 = z2 u22

u = u I ss u2 ~ uI s u2 = uI s I xy I z 2 u22 = v

106
SIEKMANN AND SZAB6

u = u I s I xyz u 2 2 O~c u I s I x z u22

= u I s I xz I z 2 u22 = w

if [Yl = I Zll then Yl = Zl and hence: v = w

if ]Yl > I Zll then Yl = qzl and x = xlq

hence v = u I s I x Yl z2 u22

= u I s I x I qq z I z 2 u22

uI sI xI q z I z 2 u22 = w

if ly I < IZll then zI = z I = q Yl and x = xI q

hence w = uI sI x z I z 2 u22

= Ul Sl Xl qq Yl z2 u 2 2

Ul Sl Xl q Yl z2 u22

= u I s I x Yl z2 u22 = v

(9.10) Similar to (9.7) and (9.4).

Proof of Lemma 4. 5" T h e r e are two general situations from


which all special cases can be derived by symmetry and
for interchanging the denotation of the corresponding
subwords.
Let u = u I xyz v I = u 2 rst v2, where

cI cI cI cI
x = z = yz and r = t = st.

If u--~ v = u I xz vI and
cc
u ~-~cc w = u 2 rt v2, then there exists p, such that

v ~-~ p and w~-~ p.

Case 1: y a n d s do not overlap, i.e. s is completely left


(or right) of y.
w.l.o.g, let

u = u I x yz v I = u 2 rst v 2 = u 2 rs yy z v1
then p = u2 r y z v I.

This situation may be illustrated as:


Ul x y zv
, f . i,

,
~ 2 r s t v2

107
SIEKMANN AND SZABO

u = u I xyz Vl~-~c uI xz v I = u2 rsy z vI = v and

u = u 2 rst v2 ~ c u 2 rt v2 = u 2 ryy z v I = w

(l.1) ltl-<IPl and Ix -<IYl- Then t-y, x * y and


therefore v e~c p and w ~-~ p.
cc
- cI -
(1.2) Itl-<lyl and Ix > 1 7 ! - Then s t c___I t, y = yt
- cI
implies t h a t y ----- z a n d t h e r e f o r e v ~c p and
w ~-. p.
cc
(1.3) Itl>lyl and Ix ~<191- Then xy ~cI x, x y_ e l y-
-----
cI -
implies that r ~-- y and therefore
v~-~ p and w.--~ p.
CC CC
(1.4) Itl>lyl and Ixl>IPl Then xy c___I x, xsy c_~_I s T
cI - cI -
implies that r = y and z ----- y and therefore
v--~ p and w ~-~ p.
CC CC

Case 2: y a n d s overZap; i.e. y = e and let y = Yl Y2

and s = sI s 2 with s2 = YI:

i
i
i Yl Y2
U1 X i Y ~ z v1
i a , ~ ; l o
i
i
s 2 ii s I i.
; i U
| u I I !
r s t
u2 v2

u = u I xyz v I ~c Ul xz vI = v

u = u2 rst v 2 e~c u 2 rt v2 = w

But this single cc-step can be decomposed into


two cc-steps :
u ~ v and u ~ w iff
cc cc

u = uI x Yl Y2 z vI ~ uI x Y2~Vl .-~
cc v and

u = u2 r sI s2 t v 2 "~c u 2 r sI t v 2 ~c w .

From the diagram it is easy to see that

u I x Y2 z vI = u2 r sI t v 2.

But this is just a special case of Case 1 for


= e. Hence there exists p such that

v ---* p and w ~-* p . 9


108
SIEKMANN AND SZABO

Acknowledgement: In an e a r l i e r v e r s i o n of this p a p e r we
only p r o p o s e d a specific case of RULE C as a b a s i s for the
second rewrite. We are m o s t g r a t e f u l to H. J H r g e n s e n from
the T e c h n i s c h e Hochschule Darmstadt, w h o d r e w our
attention to the r e l e v a n t literature of s e m i g r o u p theory
which greatly improved the paper 9 Thanks are also due to
P. Grund.

In p a r t i c u l a r we like to thank D. L a n k f o r d for his


interest in our w o r k and the lively c o r r e s p o n d e n c e , which
uncovered several errors and s h o r t c o m i n g s in the d r a f t of
this paper.

REFERENCES

[i] D. Brand, J. Darringer, J. J o y n e r "Completeness of


Conditional Reductions"; Proc. of the W o r k s h o p on
Automated Deduction, 1979

[2] T.C. B r o w n "On the F i n i t e n e s s of S e m i g r o u p s in w h i c h


x r = x" ; Proc C a m b r i d g e Phil. Soc. 60, 1964

[3] A.H. Clifford, G.B. Preston "The A l g e b r a i c Theory of


Semigroups"; American Math. Society, 1961

[4] J.H 9 Green, D ~ Rees "On S e m i g r o u p s in w h i c h x r = x"


Proc. Cambridge Phil. Soc. 48, 1952

[5] J.V. Guttag, E. H o r o w i t h , D.R. Musser " A b s t r a c t Data


Types and S o f t w a r e Validation"; Com. of the ACM,
vol 21, no 12, 1978

[6] J.A. Gerhardt "The L a t t i c e of E q u a t i o n a l Classes of


Idempotent Semigroups"; J. of Algebra, 15, 1970

[7] G. Huet, D. O p p e n "Equations and R e w r i t e Rules: A


Survey"; in:'Formal Language Theory: P e r s p e c t i v e s and
Open Problems'; R.V. Book (ed), A c a d e m i c Press, 1980

[8] J.M. Hullot "A C a t a l o g u e of C a n o n i c a l Term Rewriting


Systems"; Technical R e p o r t CSL-II3, Stanford Research
Institute, 1980
[9] J.M. Howie "An I n t r o d u c t i o n to S e m i g r o u p Theory",
Academic Press, 1976

109
SIEKMANN AND SZABO

[iO] M.A. Harrison "Introduction to Formal Language


Theory", Addison Wesley, 1978

[ii] G. Huet "Confluent Reductions: Abstract Properties


and Applications to Term Rewriting Systems";
JACM, vol 27, no 4, 1980

[12] D. Knuth, P. Bendix "Simple Word Problems in Universal


Algebras", in: Computational Problems in Abstract
Algebra, (ed) J. Leech, Pergamon Press, 1970

[13] D.S. Lankford, A.M. Ballantyne "Decision Procedure for


Simple Equational Theories with Permutative Axioms",
University of Texas, Report ATP-37

[14] D. Loveland "Automated Theorem Proving", North Holland


Publ. Comp., 1978

[15] D. McLean "Idempotent Semigroups", Americ. Math. Mon.


61, 1954

[16] P. Raulefs, J. Siekmann, P. Szab~, E. Unvericht "A


Short Survey on the State of the Art in Matching and
Unification Problems", Bulletin of EATC, Oct. 1978

[17] J. Siekmann, P. Szab~ "Unification in Idempotent


Semigroups"; Universit~t Karlsruhe, Institut fur Infor-
matik I (in preparation)

[18] J. Siekmann "Unification and Matching Problems",


Universit~t Karlsruhe, Institut fur Informatik I, 1978

[19] J. Siekmann, P. Szab~ "Universal Unification",


Universit~t Karlsruhe, Institut fur Informatik 1,1981

[20] P. Szab~ "Unifikationstheorie erster Ordnung",


Universit~t Karlsruhe, Ph.D. (in German)

J. Siekmann, P. Szab6
Universit~t Karlsruhe
Institut fHr Informatik I
Postfach 6380
7500 Karlsruhe 1
Federal Republic of Germany

Received January 30, 1981; in revised form April 23 and


December 17, 1981

110

You might also like