View metadata, citation and similar papers at core.ac.uk brought to you by CORE
provided by Elsevier - Publisher Connector
Journal of Symbolic Computation 37 (2004) 343–376 www.elsevier.com/locate/jsc
Reduction relations for monoid semirings
Friedrich Ottoa,∗,OlgaSokratovab,1
aFachbereich Mathematik/Informatik, Universit¨at Kassel, 34109 Kassel, Germany bInstitute of Computer Science, University of Tartu, Liivi 2, 50409 Tartu, Estonia
Received 3 May 2002; accepted 2 July 2003
Abstract
In this paper we study rewriting techniques for monoid semirings. Based on disjoint and non- disjoint representations of the elements of monoid semirings we define two different reduction relations. We prove that in both cases the reduction relation describes the congruence that is induced by the underlying set of equations, and we study the termination and confluence properties of the reduction relations. © 2003 Elsevier Ltd. All rights reserved.
Keywords: Semiring; Congruence; Rewriting system; Reduction relation; Termination; Confluence; Critical pair
1. Introduction
Introduced originally by Axel Thue as a method for solving word problems, rewriting theory has become a powerful tool in symbolic computation. We refer to Baader and Nipkow (1998)andBook and Otto (1993)for background concepts and recent results on rewriting systems. On theother hand, semirings have been found useful for solving problems in different areas of applied mathematics and theoretical computer science. Recently, semirings have been applied in graph theory, optimization, coding theory, automata theory, descriptions of relational data bases, formal language theory, and the study of parallel computational systems (see, e.g., DasGupta and Sontag, 2001; Golan, 1999; HebischandWeinert, 1998). Each semiring can be presented as a factor-semiring of a certain polynomial semiring
∗ Corresponding author. Tel.: +49-561-804-4573; fax: +49-561-804-4008. E-mail addresses: [email protected] (F. Otto), [email protected], [email protected] (O. Sokratova). 1 Currently visiting the Computer Science Department, The University of Iowa, Iowa City, IA 52242-1419, USA.
0747-7171/$ - see front matter © 2003 Elsevier Ltd. All rights reserved. doi:10.1016/j.jsc.2003.07.002 344 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 modulo a congruence. In these settings one is interested in congruences on the monoid semirings that are induced by finite sets of equations (Mal’cev, 1954; Sokratova, 2001). In Mora (1985)itisshown how string rewriting can be applied to monoid rings, in this way extending Gr¨obner basis computations from commutative rings to certain non- commutative rings. Actually, if R is a ring and X ∗ denotes the free monoid over a set X of freegenerators, then a string rewriting system T ⊂ X ∗ × X ∗ yields a reduction relation ∗ T on the free monoid X as well as a reduction relation T on the free monoid ring RX∗.Infact, if u,v ∈ X ∗ are two strings, then u and v are congruent with respect to ∗ ∗ theThue congruence T on X that is induced by T ,ifand only if the polynomial u − v belongs to the two-sided ideal of RX∗ that is generated by the set of polynomials {ui − vi | (ui ,vi ) ∈ T }.Thus, string rewriting techniques can be applied to free monoid rings. It turned out that this approach works quite well in those cases, where the underlying monoids are presented by finite convergent string rewriting systems of certain restricted forms (Madlener and Reinert, 1998a,b). Nowthe question arises of whether this approach can be extended to monoid semirings. However, there are various problems that must be overcome. Anycongruence relation ρ on a ring is uniquely defined by an ideal I that is the zero class of ρ.Moreprecisely, two elements a and b are congruent with respect to ρ if and only if their difference a − b belongs to I.Thisallows us to turn any element of an ideal into a rewriting rule. The zero class of a congruence in a semiring, however, though being an ideal, does in general not uniquely determineacongruence. Thus, in semirings we have to deal with ∗ ∗ relations, not ideals. For example, the Thue congruence T on X translates into the congruence on the semiring RX∗ that is generated by the same set T . The question arises now of how to extend this to an arbitrary finitely generated congruence on RX∗.Thatis,how to define a reduction relation on RX∗ that is based on a (finite) set of polynomials and that represents a given congruence? Here we undertake a first step into the directionofcarrying (string) rewriting techniques overtomonoid semirings. If
(p, q) := (r1u1 + r2u2 + ···+rm um, s1v1 + s2v2 + ···+snvn) ∗ is apair of polynomials from the free monoid semiring RX ,whereri , s j ∈ R {0} and ∗ ∗ ui ,vj ∈ X ,andif is a term ordering on X ,thenthere is a unique term, say u1,thatis larger than all other terms ui ,vj with respect to .Now,ifR is actually a ring, that is, it admits the operation of subtraction, then we can replace the pair (p, q) by the pair
(r1u1, s1v1 + s2v2 + ···+snvn − r2u2 − ···−rmum ), and we can then define a reduction relation thatisbased on (finite) sets of rules of this particular form. In this paper we will restrict ourselves to congruences on semirings that are generated by pairs of polynomials of the form above. It appears that in this setting, we can define reduction relations. Actually, we define and study two possible kinds of reduction relations on monoid semirings. The important properties of the reduction relations that we are interested in are local confluence, confluence, and termination. The reduction relations we consider are natural extensions of string rewriting relations. This makes it possible to F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 345 usestring rewriting techniques also in the semiring setting. In particular, we are interested in theconnection between the (string) reduction relation on a free monoid and the induced reduction relation on a corresponding monoid semiring. The two reduction relations studied in this paper are based on different representations of the elements of the monoid semirings considered. For the first reduction relation, called weak reduction,weconsider a relation T ⊂ M × RM in Section 3,whereR is a semiring and M is amonoid. We present an element of the monoid semiring RM simply as a finite sumofmonomials, where several monomials containing the same term (that is, monoid element) are allowed. A reduction replaces one of these monomials by a polynomial. This relation is compatible with the operations of addition and multiplication on RM,and it captures the semiring congruence on RM that is generated by T .Hence, the weak reduction is very natural and easy to work with. Unfortunately, it is not terminating in many cases, e.g., if the underlying semiring R is actually a ring, or if R contains idempotents with respect to addition (see Section 3). Therefore, we study the weak reduction in detail only for the special case of free monoid semirings over the semiring of natural numbers N,thatis,R = N and M is a free monoid X∗ over some set X of free generators. As N is the most natural example of a semiring that is not aring, NX ∗ is probably the most basic form of a monoid semiring. For this particular case we will see that the weak reductionrelation terminates, if it is compatible with asuitably chosen admissible well-founded partial ordering on X ∗.Next,westudy the weak reduction relation for the special case that the underlying set T of rules (or equations) is a string rewriting system T ⊂ X ∗ × X ∗,andweshowthatin this case the properties of termination, local confluence, and confluence on NX∗ are inherited from the string rewrit- ∗ ing relation T on the free monoid X .Finally, we present atestfor(local) confluence for the weak reduction relation on NX ∗ for the more general case that T is a finite relation of the form T ⊂ X ∗ ×NX ∗.Unfortunately this test, which is based on the notion of critical pair, does not apply to systems that have coefficients larger than 1 on their left-hand sides. In order to get around the aforementioned termination problem we consider a more restricted reduction relation in Section 4.Thisrelation, called strong reduction,isbased on therepresentation of the elements of the monoid semiring RX∗ considered as a disjoint ∗ sum, that is, if p = r1u1 + r2u2 + ··· + rnun (ri ∈ R {0}, ui ∈ X ),thenitis required that the monoid elements ui are pairwise distinct. We concentrate again on the ∗ ∗ case that T ⊂ X × RX ,andareduction step p T q now replaces exactly one of the distinct monomials of p by a corresponding polynomial. As for a disjoint sum of the form above the weak reduction coincides with the strong reduction T,weseethat the difference between the two relations simply consists in the requirement that before the strong reduction can be applied the polynomial considered is brought into the form of a disjoint sum by applying the laws of associativity and commutativity of addition in RX∗. Hence, the strong reduction relation can be interpreted as using the weak reduction relation modulo associativity and commutativity of addition. We will see that the strong reduction relation T generates the smallest congruence on RX∗ containing T .Weprove that this reduction relation terminates if it is compatible with an admissible well-founded partial ordering on the free monoid X∗.Thenweconsider the special case of a string rewriting system T ⊂ X ∗ × X ∗,andwewill see that again termination and confluence are inherited from the free monoid. Finally, in Section 4.3 we 346 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 present a test for (local) confluence of the strong reduction relation on RX∗ that is defined by a finite relation T ⊂ X ∗ × RX∗ for the case where the semiring R is commutative with respect to multiplication. However, in contrast to the situation for weak reduction, the confluence test for the strong reduction relationrequires that this reduction relation is terminating. Finally, we describe in short the structure of normal forms with respect to a convergent, that is, terminating and confluent, reduction system on a monoid semiring RX∗,andwe address the choice of a reduction strategy to compute the normal form of a given element. The paper ends with a short discussion of theproblems one is faced with when trying to develop a Knuth–Bendix style completion procedure for free monoid semirings.
2. Preliminaries
Throughout the paper we use the following definitions. Definition 2.1. A semiring (R, +, ·, 0, 1) is defined to be a non-empty set R with binary operations of addition + and multiplication · such that (R, +) is acommutative monoid with neutral element 0, (R, ·) is a monoid with identity 1, multiplication distributes over addition from either side, and 0 · r = r · 0 = 0forallr ∈ R. Example 2.2. Any ring is a semiring. Example 2.3. The set N of non-negative integers with the usual operations of addition and multiplication is a semiring. The next example provides semirings that are idempotent with respect to addition. Example 2.4. Exotic semirings are certain subsets of R equipped with the binary operations of minimum or maximum as sum, andaddition as product. Two prime examples of such structures are the (max, +)-semiring (R ∪{−∞}, max, +, −∞, 0) and the tropical semiring (N ∪{∞}, min, +, ∞, 0) (see e.g., Pin, 1998). The definition of the monoid semiringissimilar to that of a monoid ring.
Definition 2.5. Foramonoid M,themonoid semiring RM consists of all finite sums of n ∈ ∈ the form i=1 ri ui ,whereri R, ui M,with addition and multiplication defined by the rules n n n + = ( + ) , ri ui ri ui ri ri ui i=1 i=1 i=1 n n n = ( ) . ri ui r j u j rir j ui u j i=1 j=1 i, j=1 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 347
In particular, given a set X,the free monoid semiring RX∗ consists of all polynomials over R in the non-commuting variables X. We will use the representation p = r1u1 ··· rnun for the elements of RM in order to emphasize that all ui in p are pairwise distinct. Accordinglywecall such a representation a disjoint sum.Inthiscase ri is called the coefficient of ui in p.Wewill denote the coefficient of a monomial u in p by πp(u).For a polynomial p = r1u1 ··· rnun,let TERM(p) ={u1, ...,un} be the set of terms of p. Definition 2.6. For a set ofpairsT ⊂ RM × RM, Θ(T ) denotes the congruence of RM that is generated by T .Thatis,Θ(T ) is the smallest equivalence relation on RM that contains T ,and that is closed under addition and multiplication from the left and from the right. It is congruences of RM of the form Θ(T ) that we want to study. For doing so we introduce two kinds of reduction relations in the following two sections.
3. Weak reductions for monoid semirings
Let R be a semiring, let M be a monoid, and let RM denote the monoid semiring of M over R.
Definition 3.1. Let T ⊂ M × RM be a relation, and let a, b ∈ RM.Wedefinethe(single- step) reduction relation on RM as follows:
a b iff ∃r, ri ∈ R {0}∃u,v,ui ∈ M ∃(x, z) ∈ T :
a = ruxv + r1u1 + ···+rkuk, and (1) b = ruzv + r1u1 + ···+rkuk.
The relation is the weak reduction relation that is induced by T .Itiscalled weak to contrast it with the strong reduction relation that will be defined in the next section. If a = ruxv r1u1 ··· rkuk is a disjoint sum, and if r = r0 + r for some elements r0, r ∈ R, r0 = 0, then
a r0uzv + r uxv + r1u1 + ···+rkuk, that is, the monomial ruxv of a may be replaced only partially by this reduction step. The reflexive transitive closure of is denoted by , its symmetric closure is ,andtheequivalence relation on RM generated by is denoted by .
Our first lemma states that the relation is compatible with the operations of addition and multiplication of RM.
Lemma 3.2. Let T ⊂ M × RM. For all a, b, c ∈ RM, if a b, then a + c b + c, ac bc, and ca cb. 348 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376
Proof. Let a and b be elements of RM such that a b.Wemayassume that a and b are written as in (1). Then it is obvious that
a + c = ruxv + r1u1 + ···+rkuk + c ruzv + r1u1 + ···+rkuk + c = b + c holds. Thus, and are compatible with addition. Next let s ∈ R and w ∈ M,andc := sw.Then
ac = (rs)uxvw + (r1s)u1w + ···+(rks)ukw, and
bc = (rs)uzvw + (r1s)u1w + ···+(rk s)ukw. If rs = 0, then ac = bc,otherwiseac bc.Finally, if
c = s1w1 + ···+sm wm, then
ac = as1w1 + as2w2 + ···+asmwm bs1w1 + as2w2 + ···+asmwm bs1w1 + bs2w2 + ···+asmwm ···
bs1w1 + ···+bsmwm = bc. Hence, is compatible with multiplication from the right, and by symmetry it follows that it is also compatible with multiplication from the left. Next we will see that the reduction relation captures the congruence Θ(T ) on RM that is generated by T . Theorem 3.3. Let T ⊂ M × RM. Then = Θ(T ). Proof. First, we verify that is acongruence on RM.Obviously, it is an equivalence relation. Further, it satisfies the substitution property, that is, it is compatible with addition and multiplication, as the reduction relation is (Lemma 3.2). Thus, is indeed a congruence relation on RM.SinceT ⊂ ,itfollows that Θ(T ) ⊆ . To prove that is contained in Θ(T ),wetakeanypair(a, b) with a b. Since Θ(T ) is a congruence, the definition (1)implies that (a, b) ∈ Θ(T ).SinceΘ(T ) is an equivalence relation, it follows that ⊆ Θ(T ).Hence, we see that = Θ(T ),asrequired. Unfortunately, the reduction relation defined by (1) does not seem to be an appropriate tool for many monoid semirings. This is illustrated by the following examples. Example 3.4. Let R := Z,letX := {x, y},letM be the free monoid X ∗,andlet T := {(x, y)}.OnM the system T generates the string rewriting relation T ,which F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 349 is defined by uxv T uyv for all u,v ∈ M.Obviously, this relation is terminating, that is, there is no infinite sequence of the form
w0 T w1 T ··· T wi T wi+1 T ··· in M.However,forthereduction relation the situation is totally different, as y = y + x − x y + x − y = x y. Thus, this relation is not terminating. The problem with termination in Example 3.4 stems from the fact that the underlying semiring is actually a ring, that is, it provides inverse elements with respect to addition. The next example shows that the same problem arises when the semiringcontains idempotent elements with respect to addition (cf. Example 2.4). Example 3.5. Let R be a semiring with an element r ∈ R {0} that is idempotent with respect to addition, that is, r + r = r,letX := {x, y}, M := X ∗,andT := {(x, y)}.Then rx + ry = (r + r)x + ry = rx + rx + ry rx + ry + ry = rx + (r + r)y = rx + ry, which shows that also in this case is not terminating. Therefore we investigate this reduction relation only for the special case of free monoid semirings over the natural numbers.
3.1. The reduction relation forfreemonoid semirings over N
For the rest of this section we only consider the semiring N of natural numbers, and free monoid semirings of the form NX ∗. ∗ Definition 3.6. We define the set of monomials N X as ∗ ∗ N X := {nu | n ∈ N {0}, u ∈ X }. Due to the possibility of performing division in NX ∗,weareable to consider slightly more general relations as before. ∗ ∗ ∗ Definition 3.7. Let T ⊂ N X × NX ,andleta, b ∈ NX . For a relation of thisformthe reduction relation is defined as follows: ∗ a b iff ∃r, ri ∈ N {0}∃u,v,ui ∈ X ∃(nx, z) ∈ T :
a = (r · n)uxv + r1u1 + ···+rkuk, and (2) b = ruzv + r1u1 + ···+rkuk. Thus, here we consider relations T for which the left-hand side of an element of T may have a coefficient larger than 1. It is easily seen that the relation is compatible with addition and multiplication, and that it satisfies Theorem 3.3,too. In this particular setting termination is guaranteed by the following technical result. Recall that a partial ordering on X ∗ is called admissible if, for all u,v,x, y in X ∗, u v implies xuy xvy.Apartial ordering on X ∗ is called well-founded if no infinite 350 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376
∗ chains of the form u1 u2 ···with ui ∈ X exist, where denotes the proper part of ,thatis,u v holds if u v and u = v.
Theorem 3.8. Let be an admissible well-founded partial ordering on X∗, and let ∗ ∗ ∗ T ⊂ N X × NX be a relation on NX such that the following conditions are satisfied for each pair (ru, s1v1 ··· snvn) of T :
• u vi ,forall i = 1, ...,n, and
• r > si ,whenever u = vi .
Then is terminating.
∗ Proof. Noticethat every polynomial r1u1 ··· rnun of NX can be interpreted as ∗ amultiset over X containing ri copies of ui .The well-founded partial ordering on X ∗ induces a well-founded partial ordering on the set of multisets over X ∗ (see Dershowitz and Manna, 1979). This multiset ordering then gives a well-founded partial ordering on NX ∗.This ordering compares two polynomials
p = r1u1 ··· rnun and = ··· v ··· v = q r1u1 rnun s1 1 sm m p as follows: p q iff ∀ ∈{ , ..., }∃ ∈{ , ..., } v > , i 1 m j 1 n : u j i and r j r j and ∀ ∈{ , ..., } ( ≥ ∃ ∈{ , ..., } > ). i 1 n : ri ri or j 1 n : u j ui and r j r j It is easily seen that is compatible with ,thatis, p p implies p p. Hence, is terminating.
3.2. Restricted reduction systems
We are concerned with the properties of the reduction relation that is induced by ∗ ∗ afinite relation T ⊂ N X ×NX . Theorem 3.8 givesasufficient condition for establishing termination of .If is terminating, then each element a of NX ∗ has one or more normal forms with respect to ,wherec is called a normal form of a if a c and c is irreducible mod ,thatis,c d does not hold for any d ∈ NX ∗. If, in addition to being terminating, is confluent, then each a has a unique normal form. Hence, we would like to characterize those relations T for which is confluent. We start this investigation by considering the special case where T is a string rewriting system on X ∗,thatis,T ⊂ X ∗ × X ∗.Thenthe system T induces two reduction relations: F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376 351
∗ ∗ the reduction relation T on X that is defined by
∗ u T v iff ∃x, y ∈ X ∃(w, w ) ∈ T : (3) u = xwy and v = xw y,
and the reduction relation on NX ∗ that is defined by (2). It is an immediate consequence of these definitions that the relation can simply be interpreted as an extension of the relation T .Thisismadeprecise by thefollowing proposition. Proposition 3.9. Let (X, T ) be a string rewriting system. Then the following conditions are equivalent for all strings u,v ∈ X∗: ∗ (a) u T v in X , (b) u v in NX ∗.
Under what conditions does the relation inherit properties such as termination, local confluence, or confluence from the relation T ?Inthefollowing we will address this question. Our first result deals with the termination property. Proposition 3.10. Let (X, T ) be a finite string rewriting system. Then the reduction ∗ relation on NX is terminating iff T is terminating.
Proof. If is terminating, then by Proposition 3.9 also T is terminating. ∗ Conversely, assume that T is terminating. We obtain a partial ordering on X by defining its proper part as follows: v + v. u iff u T Then is an admissible partial ordering that is well-founded. Also u v holds for each rule (u,v)∈ T .Hence, Theorem 3.8 yields that is terminating on NX ∗.
An analogous result holds for local confluence. Theorem3.11. Let (X, T ) be a finite string rewriting system. Then the reduction relation ∗ on NX is locally confluent iff T is locally confluent.
Proof. The ‘only if’ part is obvious by Proposition 3.9. To prove the ‘if’ part we take three elements a, b, c ∈ NX∗ such that a b and a c.Leta have the following representation as a disjoint sum:
a = r1u1 ··· rk uk. ≤ ≤ It follows that there exist indices i and j,natural numbers ri ri , r j r j ,andstrings , ∈ ∗ ui u j X such that ui T ui , u j T u j ,and = + ···+( − ) + + ···+ , b r1u1 ri ri ui ri ui rk uk = + ···+( − ) + + ···+ . c r1u1 r j r j u j r j u j rk uk 352 F. Otto, O. Sokratova / Journal of Symbolic Computation 37 (2004) 343–376
First, suppose that i = j.Then = + ···+( − ) + + ···+( − ) + + ···+ b r1u1 ri ri ui ri ui r j r j u j r j u j rkuk + ···+( − ) + + ···+( − ) r1u1 ri ri ui ri ui r j r j u j + + ···+ , r j u j rkuk and = + ···+( − ) + + ···+( − ) + + ···+ c r1u1 ri ri ui ri ui r j r j u j r j u j rkuk + ···+( − ) + + ···+( − ) r1u1 ri ri ui ri ui r j r j u j + + ···+ . r j u j rkuk Thus, in this case b and c have a common descendant. Secondly, suppose that i = j.Since T is locally confluent, there exists a string w ∈ ∗ ∗ w = ∗ w X such that ui T and u j ui T .Wehave = + ···+( − ) + + ···+ b r1u1 ri ri ui ri ui rk uk + ···+( − ) + + ···+ r1u1 ri ri ui ri ui rk uk = + ···+ + ···+ r1u1 ri ui rkuk r1u1 + ···+ri w + ···+rkuk and = + ···+( − ) + + ···+ c r1u1 ri ri ui ri ui rkuk + ···+( − ) + + ···+ r1u1 ri ri ui ri ui rkuk = + ···+ + ···+ r1u1 ri ui rkuk r1u1 + ···+ri w + ···+rkuk. Thus, also in this case b and c have a common descendant. Hence, is indeed locally confluent. Actually, we can explicitly describe the descendants of a polynomial. For a polynomial
a = r1u1 ··· rk uk, any descendant b of a is of the following form: