Termination transformation by tree lifting ordering Takahito Aoto and Yoshihito Toyama
School of Information Science, JAIST Tatsunokuchi, Ishikawa 923-12, Japan faoto,
[email protected] An extension of a modular termination result for term rewriting systems (TRSs, for short) by A. Middeldorp (1989) is presented. We intended to obtain this by adapting the dummy elimination transformation by M. C. F. Ferreira and H. Zantema (1995) under the presence of a non-collapsing non-duplicating terminating TRS whose function symbols are all to be eliminated. We propose a tree lifting ordering induced from a reduction order and a set G of function symbols, and use this ordering to transform a TRS R into R ; termination of R implies that of R[S for any non-collapsing non-duplicating terminating TRS S whose function symbols are contained in G , provided that for any l ! r in R (1) the root symbol of r is in G whenever that of l is in G ; and (2) no variable appears directly below a symbol from G in l when G contains a constant. Because of conditions (1) and (2), our technique covers only a part of the dummy elimination technique; however, even when S is empty, there are cases that our technique has an advantage over the dummy elimination technique. Abstract.
0
0
1 Introduction Modular aspects of properties of term rewriting systems (TRSs, for short), in particular those of termination of TRSs, have been investigated in many papers. In this paper, we present a technique that is useful to infer termination of the union of two TRSs provided that one of them does not contain collapsing rules nor duplicating rules. It is worth mentioning that our result also admits the hierarchical combination (i.e. a combination such that de ned symbols in one TRS may occur in the other TRS), for which a few results have been obtained; see [2][3][8][10]. We propose a tree lifting ordering induced from a reduction order and a set ^; G of function symbols, and use this ordering to transform a TRS R into R ^ termination of R implies that of R [ S for any non-collapsing non-duplicating terminating TRS S whose function symbols are contained in G , provided that for any l ! r 2 R (1) root(l) 2 G implies root(r ) 2 G and (2) no variable appears directly below a symbol from G in l when G contains a constant. Here root(t) denotes the root symbol of a term t. Our approach to infer termination of the union of two TRSs R and S is dierent from others in a point that we infer the termination of R[S not directly
^ (depending on the from that of R and S , but instead we rst transform R to R set of function symbols appearing in S ) and infer the termination of R [ S from that of R^ and S . In particular, when the sets of function symbols appearing in ^ and hence our result covers a modular R and S are disjoint, we can take R as R termination result [9] by A. Middeldorp. We intended to obtain our result by adapting the dummy elimination transformation [6] by M. C. F. Ferreira and H. Zantema under the presence of a non-collapsing non-duplicating terminating TRS whose function symbols are all to be eliminated. Indeed, under conditions (1) and (2), the dummy elimination ^ above. transformation is a particular case of the transformation from R to R Although it is naturally expected that the dummy elimination transformation is sound without these conditions, but this is not true under the presence of a nonempty S ; see Example 2 in Section 3. Thus, to admit non-empty S we require the conditions also on R, and consequently our technique covers only a part of the dummy elimination technique. However, even when S is empty, there are cases that our technique has an advantage over the dummy elimination technique; see Example 5 in Section 4. The rest of this paper is organized as follows. In Section 2, we x notations on term rewriting and orderings used in this paper. In Section 3, we introduce a tree lifting ordering and show its properties. Also, our main theorem (Theorem 13) is established at the end of Section 3. In Section 4, we discuss our result in the light of related works.
2
Preliminaries
Let V be a set of countably in nite variables (denoted by x; y; z; : : :) and F a set of arity- xed function symbols (denoted by f; g; h; : : :). Then the set of terms (denoted by s; t; u; : : :) built from F and V is written as T (F ; V ), or as just T when F is obvious from the context. V (t) and Var(t) are the set and the multiset of variables occurring in t, respectively. We denote by the syntactical equality. We assume familiarity with the context formalism. A term s is a subterm of a term t (denoted by s E t) if t C [s] for some context C with precisely one hole; it is a proper subterm (denoted by s / t) if s / t. A substitution on T is a mapping from V to T with nite dom( ) = fx 2 V j (x ) / xg. A substitution is extended to a homomorphism from T to T . For a substitution and a term t, we conventionally write t instead of (t). A substitution with dom( ) = fx1 : : : ; xn g and (xi ) = ui for i = 1; : : : ; n is also denoted by fx1 7! u1 ; : : : ; xn 7! un g. Given a binary relation R on a set W , the re exive transitive closure and transitive closure of R are denoted by R3 and R+ , respectively. A binary relation R on T is said to be closed under contexts if sRt implies C [s]RC [t] for every terms s; t and every context C ; it is closed under substitutions if sRt implies (s )R(t ) for every terms s; t and every substitution . A rewrite relation is a binary relation on T closed under contexts and substitutions. A strict partial order > on a set W is a transitive irre exive relation on W ; it is well-founded if
there is no in nite sequence a1 > a2 > 1 1 1 of elements from W . A rewrite order is a rewrite relation that is a strict partial order. A rewrite order is a reduction order if it is well-founded. Note that, for any reduction order >, s > t implies V (s) V (t). A pair hl; r i of terms is called a rewrite rule. We conventionally write l ! r instead of hl; r i. A rewrite rule l ! r is collapsing if r 2 V ; it is duplicating if Var(l) + Var(r). A term rewriting system is a set of rewrite rules1 . A TRS is said to be non-collapsing (non-duplicating) if it contains no collapsing (duplicating, respectively) rules. Given a TRS R, we denote by !R the smallest rewrite relation on T that includes R. A TRS R is compatible with a rewrite order > if l > r for any l ! r 2 R. A TRS R is said to be terminating if it is compatible with a reduction order. We denote by Mult(W ) the set of nite multisets of elements taken from a set W . We use 2 for the membership relation and [ ] for the empty multiset. The multiset sum and the multiset minus are denoted by + and n, respectively; e.g. [a; b; b; c] + [b; c; c; d] = [a; b; b; b; c; c; c; d], and [a; b; b; c] n [b; c; c; d] = [a; b]. For a natural number n and a multiset M , M 3 n stands for M 1 1 + M . For } | + 1{z n-times M 2 Mult(W ) and a 2 W , #(a; M ) is the number of a in M , and jM j the number of elements in M ; e.g. #(a; [a; b; a; b; a; c]) = 3, and j[a; b; a; b; a; c]j = 6. A quasi-order & on a set W is a transitive re exive relation on W . Given a quasi-order &, the equivalence relation = (& \ .) is called the equivalence relation of &, and the strict partial order > = (& \ . = ) is called the strict part of &. The quasi-order is well-founded if so is its strict part. Given a quasi-order & on a set W , we denote by &mult the multiset quasimult ordering on Mult(W ) induced from &; we denote by its strict part; see e.g. [11]. We denote by Tr(W ) the set of nite (unordered) trees whose nodes are labeled with elements taken from a set W . Formally, ah0 i 2 Tr(W ) if a 2 W and 0 2 Mult(Tr(W )). We abbreviate ah[T1 ; : : : ; Tn ]i to ahT1 ; : : : ; Tn i and ah[ ]i to a. Given a strict partial order > on a set W , we denote by >rpo the recursive path ordering on Tr(W ) induced from >; see e.g. [11].
3 Tree lifting ordering In this section, let us x sets F , G of function symbols such that G F , a constant symbol } such that } 2= F , and a reduction order > on T (F nG [ f}g; V ).
De nition 1. 1. The root of a term t 2 T (F ; V ) is de ned by t if t 2 V , root(t) = f if t f (t1 ; : : : ; t ). n
1
We omit the usual restrictions on a TRS R. For, they are implied by termination of
R.
2. Let t C [t1; : : : ; tn ] (n 0) be a term in T (F ; V ) with root(t) 2 G . We write t C [[t1 ; : : : ; tn ]] if C 2 C (G ; ;) and root(t1 ); : : : ; root(tn ) 2= G . 3. Let t C [t1 ; : : : ; tn ] (n 0) be a term in T (F ; V ) such that C 2 C (F nG ; V ) and root(t1 ); : : : ; root(tn ) 2 G . Suppose that ti Ci [[si;1 ; : : : ; si;mi ]] for i = 1; : : : ; n. We denote by suc(t) the multiset [s1;1 ; : : : ; sn;mn ], and by cap(t) the term C [}; : : : ; }]. 4. The rank of a term t 2 T (F ; V ) is de ned by 1 if suc(t) = [ ], rank(t) = 1 + maxfrank(ti ) j ti 2 suc(t)g otherwise. 5. For any term t 2 T (F ; V ), put 8 if suc(t) = [ ], < cap(t) tree(t) = cap(t)htree(t1 ); : : : ; tree(tn )i : if suc(t) = [t1 ; : : : ; tn ] with n 1, 8 if suc(t) = [ ], < [cap(t)] P nodes(t) = [cap(t)] + 1in nodes(ti ) : if suc(t) = [t ; : : : ; t ] with n 1. 1
n
De nition 2. Let = (> [ .)+ . We de ne binary relations on T (F ; V ) by
G)
tlo(
s s>
G) t G) t
and >tlo (G ) 0
if and only if tree(s) = tree(t); if and only if tree(s) rpo tree(t):
tlo(
tlo0 (
Clearly, tlo(G ) is an equivalence relation. Also, since is a well-founded strict partial order, so is >tlo (G ) . We put &tlo (G ) = (>tlo (G ) [ tlo(G ) ). It follows from s tlo(G ) s0 >tlo (G ) 0 t tlo(G) t implies s >tlo (G) t that &tlo (G) is a quasi-order with tlo(G) as its equivalence relation and >tlo (G ) as its strict part. Thus, alternatively, we can de ne >tlo (G ) as follows: s >tlo (G ) t if and only if either 0
0
0
0
0
0
0
0
0
TLO':1 cap(s)(> [ .)+ cap(t), and s > (G ) v for any v 2 suc(t), TLO':2 u & (G) t for some u 2 suc(s), or TLO':3 cap(s) cap(t), and suc(s) (G) suc(t). tlo0
tlo0
mult tlo0
Here, mult is the strict part of multiset quasi-ordering induced from &tlo (G ) . tlo (G ) We will mainly use this de nition in the proofs hereafter. The following lemma is readily checked. 0
0
Lemma 3. 1. s > (G ) u for any u 2 suc(s); 2. s > (G ) a for any a 2 nodes(s) provided that j nodes(s)j > 1. tlo0
tlo0
At rst sight, it may seem strange to include the (proper) subterm relation \ . " in De nition 2 (and in TLO':1). But without \ . ", we can not generally guarantee that the tree lifting ordering is closed under contexts; see Figure 1.
f
()
f x
>rpo
g
(} )
by f (x) > g(}) f (x ) > h
=)
f
?
()
f x
>rpo
( ( )) > f (g(})) but f (f (x)) > h? Why is \." required? f f x
h Fig. 1.
g
(} ) h
De nition 4. The tree lifting ordering > (G ) on T (F ; V ) induced from > and G is de ned as follows: s > (G ) t if and only if either tlo
tlo
TLO:1 cap(s) > cap(t), and s > (G ) v for any v 2 suc(t), or TLO:2 cap(s) cap(t), and suc(s) (G) suc(t). tlo0
mult tlo0
It is clear that >tlo(G ) >tlo (G ) . 0
We are going to give here an explanation why >tlo (G ) itself is not suitable for our purpose and have introduced an alternative relation >tlo(G ) . The rst dierence is that TLO':2 is omitted in >tlo(G ) at the rst stage of comparison. For, otherwise the tree lifting ordering can not be closed under contexts; see Figure 2. We also can not use \ . " at the rst stage of comparison to make sure that the tree lifting ordering is closed under contexts; see Figure 3. Accordingly, we omit \ . " in TLO:1. 0
f f
(} )
( ( ))
g f x
()
g x
Lemma 5. Proof.
=)
rpo
by g(f (x)) g(x)
The relation
>
G)
tlo(
(} )
( ( ))
tlo0 (G )
()
?
g x
rpo
g f x
Why is \>
Fig. 2.
f
f
Do we have g (f (x)) f (g(x))?
" not suitable? (1)
is transitive.
The claim can be proved using the fact >tlo(G ) >tlo (G ) .
Lemma 6.
0
The relation
>
G)
tlo(
is a well-founded strict partial order.
u t
f g
()
f x
.
f
g
=)
()
f x
.=
()
()
f x
f x Fig. 3.
Why is \>
tlo0 (G )
" not suitable? (2)
Proof. By Lemma 5, it suces to show >tlo(G ) is well-founded (because irre exivity follows from well-foundedness). But this follows from >tlo(G ) >tlo (G ) since >tlo (G) is well-founded. u t 0
0
Henceforth, tlo(G ) [ >tlo(G ) is denoted by &tlo(G ) . It is readily checked that G ) is a quasi-order with tlo(G ) as its equivalence relation and >tlo(G ) as its strict part.
&
tlo(
Lemma 7.
For any substitution
, if s
G)
tlo(
t then s
G)
tlo(
t.
Proof. The claim can be proved from the de nition of tlo(G ) and the fact that tree(u) = x i u x. u t
Lemma 8.
dom().
be a substitution such that (x) s > (G) t implies s > (G) t.
Let
Then
tlo0
2 T
(F nG ; V )
for any
x
2
tlo0
One easily shows that u(> [ .)+ v implies u(> [ .)+ v for any u; v 2 T (F nG [ f}g; V ). Also, note that cap(w ) cap(w ) and suc(w ) = [u j u 2 suc(w)] for any term w 2 T (F ; V ). Now the statement can be proved by induction on rank(s) + rank(t). u t Proof.
Lemma 9. Suppose s > (G ) t, and let be a substitution with dom() = fxg. Suppose x 2 = nodes(s) when G contains a constant. Then s & (G) t; furthermore, s > = G , root(s) 2= G or t / x. (G ) t if either root( (x)) 2 tlo0
tlo0
tlo0
Proof. We only consider here the case (x) 2 = V . Also, we can assume root(s) 2= V (because otherwise there is no such t). We distinguish two cases:
1. root( (x)) 2 F nG . Then we have cap(w ) cap(w)fx 7! cap( (x))g suc(w ) = [u j u 2 suc(w )] + suc( (x)) 3 #(x; Var(cap(w)))
(1) (2)
for any term w 2 T (F ; V ). We show that s >tlo (G ) t implies s >tlo (G ) t , by induction on rank(s) + rank(t). Suppose that s >tlo (G ) t. 0
0
0
For the base step, suppose that rank(s) = rank(t) = 1. Then s >tlo (G ) t is due to TLO':1, and hence we have cap(s)(> [ .)+ cap(t). From the assumption that > is a reduction order, one easily shows that cap(s)(> + [ .) cap(t) for any with (x) 2 T (F nG [ f}g; V ) for any x 2 dom( ). Thus, using equation (2), we get cap(s ) cap(s)fx 7! cap( (x))g(> + [ .) cap(t)fx 7! cap( (x))g cap(t ). Next, suppose v 2 suc(t ). Then, since suc(t) = [ ], we have v 2 suc( (x)) 3 #(x; Var(cap(t))) by equation (2) i.e. v 2 suc( (x)) and x 2 V (cap(t)). Since > is a reduction order, we have V (cap(t)) V (cap(s)), and so x 2 V (cap(s)). Then, again using equation (2), we obtain v 2 suc( (x)) 3 #(x; Var(cap(s))) = suc(s ), and so s >tlo (G ) v by Lemma 3. Thus we have shown s >tlo (G ) v for any v 2 suc(t ). Hence by TLO':1 we conclude that s >tlo (G ) t . For the induction step, we distinguish three cases: (a) s >tlo (G ) t by TLO':1. Then cap(s)(> [ .)+ cap(t) and s >tlo (G ) u for any u 2 suc(t). We have cap(s )(> [ .)+ cap(t ) using equation (2). Let v 2 suc(t). To show s >tlo (G) v, we distinguish two cases according to equation (2): i. v u for some u 2 suc(t). Since root( (x)) 2= G , we can apply the induction hypothesis to s >tlo (G ) u; thus, we obtain s >tlo (G ) u v. ii. v 2 suc( (x)) 3 #(x; Var(cap(t))). Then x 2 V (cap(s)), and so v 2 suc(s ). Hence s >tlo (G ) v by Lemma 3. Thus, s >tlo (G ) t by TLO':1. (b) s >tlo (G ) t by TLO':2. Then u &tlo (G ) t for some u 2 suc(s). Then, by induction hypothesis and Lemma 7, u &tlo (G ) t . Since root( (x)) 2 F nG , we have u 2 suc(s ), and so s >tlo (G ) t by TLO':2. (c) s >tlo (G ) t by TLO':3. Then cap(s) cap(t) and suc(s) mult suc(t). tlo (G ) We have cap(s ) cap(s)fx 7! cap( (x))g cap(t)fx 7! cap( (x))g cap(t ). Also, by induction hypothesis and Lemma 7, we get [u j u 2 [v j v 2 suc(t)]. Thus, suc(s)] mult tlo (G ) 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
suc(s ) = [u j u 2 suc(s)] + suc( (x)) 3 #(x; Var(cap(s))) = [u j u 2 suc(s)] + suc( (x)) 3 #(x; Var(cap(t))) mult [v j v 2 suc(t)] + suc( (x)) 3 #(x; Var(cap(t))) tlo (G ) = suc(t ): 0
Hence, s >tlo (G ) t by TLO':3. 2. root( (x)) 2 G . Then we have 0
cap(w ) cap(w)fx 7! }g suc(w ) = [u j u 2 suc(w ); u / x] + suc( (x)) 3 #(x; Var(cap(w)) + suc(w)):
(3) (4)
for any term w 2 T (F ; V ). For the base step, suppose that rank(s) = rank(t) = 1. Then s >tlo (G ) t is due to TLO':1, and hence we have cap(s)(> [ .)+ cap(t). From this follows 0
cap(s )(> [ .)+ cap(t ) using equation (4). Furthermore, since suc(t) = [ ] and V (cap(t)) V (cap(s)), v 2 suc(t ) implies v 2 suc(s ) by equation (4). Hence, s >tlo (G ) v for any v 2 suc(t ) by Lemma 3. Thus, s >tlo (G ) t by TLO':1. For the induction step, we distinguish three cases: (a) s >tlo (G ) t by TLO':1. Then cap(s)(> [ .)+ cap(t) and s >tlo (G ) u for any u 2 suc(t). We have cap(s )(> [ .)+ cap(t ) using equation (4). Let v 2 suc(t). To show s >tlo (G ) v, we distinguish three cases according to equation (4): i. v u for some u 2 suc(t) with u / x. Since u / x, we can apply the induction hypothesis to s >tlo (G ) u; thus, we obtain s >tlo (G ) u v. ii. v 2 suc( (x)) 3 #(x; Var(cap(t))). Then x 2 V (cap(t)), and so x 2 + V (cap(s)) by cap(s)(> [ .) cap(t), since (> [ .)+ is well-founded and closed under substitutions. Thus, v 2 suc(s ) by equation (4). Hence s >tlo (G ) v by Lemma 3. iii. v 2 suc( (x)) 3 #(x; suc(t)). Since x 2 nodes(t), there exists u 2 nodes(s) such that x 2 V (u). Thus v 2 nodes(s ) and j nodes(s )j > 1, and hence s >tlo (G ) v by Lemma 3. Thus, s >tlo (G ) t by TLO':1. (b) s >tlo (G ) t by TLO':2. Then v &tlo (G ) t for some v 2 suc(s). By / x, then Lemma 7 and induction hypothesis, we get v &tlo (G ) t . If v v 2 suc(s ), and so s >tlo (G ) t by TLO':2. Suppose otherwise i.e. v x. Then, since v &tlo (G ) t, we have t x. Also, since suc(s) 6= [ ], cap(s) D }. i. root(s) 2 F nG . Then cap(s ) / }, and hence we have cap(s ) . }. By suc( (x)) = suc(t ) suc(s ), we have s >tlo (G ) t by TLO':1 and Lemma 3. ii. root(s) 2 G . Then cap(s ) } cap(t ). By suc( (x)) = suc(t ) suc(s ), we have s &tlo (G ) t . (Note that in this case it is not necessary to have s >tlo (G ) t because the condition of the lemma is not satis ed.) suc(t). (c) s >tlo (G ) t by TLO':3. Then cap(s) cap(t) and suc(s) mult tlo (G ) From the former, we obtain cap(s ) cap(t ) using equation (4). We suc(t ). Since cap(s) cap(t), we are going to show suc(s ) mult tlo (G ) have 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
suc( (x)) 3 #(x; Var(cap(s))) = suc( (x)) 3 #(x; Var(cap(t))): Thus, it remains to show [v j v 2 suc(s); v / x] + suc( (x)) 3 #(x; suc(s)) mult [ v j v 2 suc(t); v / x] + suc( (x)) 3 #(x; suc(t)): tlo (G ) 0
Let k suc(w)k be [tree(u) j u 2 suc(w)] for any w 2 T (F ; V ). When k suc(s)k + k suc(t)k, it suces to show that for any tree(w ) 2 k suc(s)k n
k suc(t)k and tree(v ) 2 k suc(t)k n k suc(s)k such that w > (G ) v , (i) w > (G) v when x / v , and (ii) [w ] (G ) suc(v ) when x v . i. x / v . Since x / v , it follows from the induction hypothesis. ii. x v . Since root(w ) 2= G , w > (G ) v by induction hypothesis; hence [w ] (G ) [v ] (G ) suc(v ) using Lemma 3. Otherwise, since suc(s) (G ) suc(t), we have k suc(s)k ) k suc(t)k. Then, since cap(s ) cap(t ), we clearly have k suc(s )k k suc(t )k; hence, it remains to show k suc(s )k n k suc(t )k 6= [ ]. If there exists tree(v ) 2 k suc(s)k n k suc(t)k with v / x, then tree(v ) 2 k suc(s )k n k suc(t )k; otherwise, i.e. when v x for any tree(v ) 2 k suc(s)k n k suc(t)k, we need to show suc( (x)) 6= [ ]. But if x 2 = nodes(s) then there is no such case; and if G contains no constant then (x) contains at least one non-G -symbol, and so suc( (x)) 6= [ ] holds. Thus, we conclude k suc(s )k ) k suc(t )k. Hence, s > (G ) t by TLO':3. tlo0
mult tlo0
tlo0
tlo0
mult tlo0
mult tlo0
mult tlo0
tlo0
u t
Remark. The conditions in Lemma 9 can not be dropped: Suppose G = fa; bg. Then a(x) >tlo (G ) x and a(a(y )) tlo(G ) a(y ). If G additionally contains a constant c then f (a(x; y )) >tlo (G ) f (b(y )) and f (a(c; y )) tlo(G ) f (b(y )); also note that x 2 nodes(f (a(x; y ))). 0
0
Lemma 10.
Let
be a substitution, and suppose that nodes(s) contains no varis > (G) t implies s > (G) t.
able when G contains a constant. Then,
tlo
tlo
Proof. Similar to the proof of Lemma 9. (Replace \induction hypothesis" by \Lemma 9" and omit the cases 1(b) and 2(b).) u t
Lemma 11. For any C 2 C (F nG ; V ), if s > (G ) t then C [s] > (G) t. Proof. Let C 2 C (F nG ; V ) and suppose s > (G ) t. The case where C 3 is trivial; so we assume C / 3. Then, cap(C [s]) C [cap(s)](> [ .)+ cap(s). Also, since suc(C [s]) = suc(s), C [s] > (G ) v for any v 2 suc(s) by Lemma 3. Thus, by TLO':1 and our assumption, we get C [s] > (G ) s > (G ) t. u t Lemma 12. If root(s) 2 G implies root(t) 2 G , then, for any C 2 C (F ; V ), s > (G) t implies C [s] > (G ) C [t]. Proof. Let w1 ; : : : ; w 2 T (F ; V ). We prove this by showing that s > (G ) t implies e(w1 ; : : : ; s; : : : ; w ) > (G ) e(w1; : : : ; t; : : : ; w ) for any e 2 F . Then by induction on the length of C , the statement of the lemma follows. Suppose s > (G) t, and let s~ e(w1 ; : : : ; s; : : : ; w ) and t~ e(w1 ; : : : ; t; : : : ; w ). 1. e = f 2 F nG . Then we have cap(f (w1 ; : : : ; u; : : : ; w )) f (cap(w1); : : : ; cap(u); : : : ; cap(w )) (5) X suc(w ) (6) suc(f (w1 ; : : : ; u; : : : ; w )) = suc(u) + tlo0
tlo0
tlo0
tlo0
tlo0
tlo
tlo0
tlo
n
tlo
n
n
tlo
n
tlo
n
n
n
i
n
1in
for any u 2 T (F ; V ). We distinguish two cases:
(a) s >tlo(G ) t by TLO:1. Then cap(s) > cap(t) and s >tlo (G ) v for any v 2 suc(t). Since > is a reduction order, we have cap(~s) > cap(t~) using equation (6). Suppose v 2 suc(t~). i. v 2 suc(t). Then we have s >tlo (G ) v , and so, by Lemma 11, f (z1 ; : : : ; s; : : : ; zn ) >tlo (G) v with new variables z1; : : : ; zn . Let i = fzi 7! wi g (i = 1; : : : ; n). Since f 2 = G and zi / v for all i, we can apply Lemma 9 to obtain (1 1 1 (f (z1 ; : : : ; s; : : : ; zn )1 ) 1 1 1)n >tlo (G ) (1 1 1 (v1 ) 1 1 1)n . Thus, s~ f (w1 ; : : : ; s; : : : ; wn ) >tlo (G ) v . ii. v 2 suc(wi ) for some i. Then v 2 suc(~s) by equation (6), and so s~ >tlo (G) v by Lemma 3. (b) s >tlo(G ) t by TLO:2. Then cap(s) cap(t) and suc(s) mult suc(t). tlo (G ) From the former cap(~s) cap(t~) follows using equation (6), and from the latter suc(~s) mult suc(t~) using equation (6). Thus s~ >tlo(G ) t~ by tlo (G ) TLO:2. 2. e = a 2 G . Then we have 0
0
0
0
0
0
0
0
cap(a(w1 ; : : : ; u; : : : ; wn )) } suc(a(w1 ; : : : ; u; : : : ; wn )) = [ 2 [w1 ; : : : ; u; : : : ; wn ] j root( ) 2= G ] X + [suc( ) j 2 [w1; : : : ; u; : : : ; wn ] and root( ) 2 G ]
(7) (8)
for any u 2 T (F ; V ). By equation (8), it remains to show suc(~s) mult tlo (G ) suc(~t). By the condition, it suces to distinguish three cases: (a) root(s); root(t) 2= G . Since s >tlo(G ) t, we have s >tlo (G ) t, and so suc(~s) mult suc(~t) by equation (8). tlo (G ) (b) root(s); root(t) 2 G . Then s >tlo(G ) t is due to TLO:2, and so we have suc(t~) by equation (8). suc(t). Hence suc(~s) mult suc(s) mult tlo (G ) tlo (G ) (c) root(s) 2= G and root(t) 2 G . Since s >tlo(G ) t, we have s >tlo (G ) t, and so [s] mult [t]. Also, by Lemma 3, t >tlo (G ) u for any u 2 suc(t), and tlo (G ) mult so [t] tlo (G ) suc(t). Thus, we obtain [s] mult [t] mult suc(t), and tlo (G ) tlo (G ) mult hence suc(~s) tlo (G ) suc(t~) by equation (8). 0
0
0
0
0
0
0
0
0
0
0
0
u t
The condition in Lemma 12 can not be dropped: Let G = fag and suppose } > 1 > 0. Then a(0; 0) >tlo(G ) 1 and a(1; 0) >tlo(G ) a(a(0; 0); 0).
Remark.
Theorem 13. Let G be a set of function symbols and R a TRS such that 1. root(l) 2 G implies root(r ) 2 G and 2. no variable appears directly below a symbol from G in l when G contains
a
constant for any
l
such that
r l>
!
2 R. If there exists a reduction order
G)
tlo(
r
for any
l
!
r
>
on T
(F nG [ f}g; V )
2 R, then S [ R is terminating for any
non-collapsing non-duplicating terminating TRS S whose function symbols are contained in G .
We show that s !S t implies s &tlo(G ) t. Suppose s !S t, then s C [r ] for some l ! r 2 S . Since S is non-collapsing and nonduplicating, l ! r must be of the form Cl [x1 ; : : : ; xn ] ! Cr [xi1 ; : : : ; xim ] with some subsequence i1 ; : : : ; im (m n) of a permutation of 1; : : : ; n and nonempty contexts Cl ; Cr . Thus, if m = n then tree(s) = tree(t); and if m < n then s >tlo(G) t, since tree(s) rpo tree(t) and cap(s) cap(t). Suppose there exists an in nite reduction sequence of S [ R. Since S is 3 3 3 terminating, the sequence has the form t0 ! S s0 !R t1 !S s1 !R t2 !S s2 !R 1 1 1. Then we have t0 &tlo(G) s0 >tlo(G) t1 &tlo(G) s1 >tlo(G ) t2 &tlo(G) s2 >tlo(G) 1 1 1 by Lemma 10, Lemma 12 and our assumptions; thus t0 >tlo(G) t1 >tlo(G) t2 >tlo(G) 1 1 1. This contradicts Lemma 6 that states >tlo(G) is wellfounded. u t Proof.
C [l] and t
The following example addresses how to apply our result. Let
8 (1) < f (f (x)) ! f (a(b(f (x)))) f (a(g(x))) ! b(x) (2) : b(x) ! a(x) (3) be a TRS. We show this TRS is terminating via our technique. For this, let G = fa; bg. Since (3) is a non-duplicating non-collapsing rule consisting of G symbols, we let R = f(1); (2)g, S = f(3)g. Now, what we want is a reduction order > satisfying Example 1.
f (f (x)) > (G) f (a(b(f (x)))) f (a(g(x))) > (G ) b(x) tlo
tlo
(4) (5):
We rst compare cap(f (f (x))) f (f (x)) and f (}) cap(f (a(b(f (x))))). Since f (f (x)) / f (}), in order to satisfy (4), we have to impose f (f (x)) > f (}) to our ordering >. Thus, (4) should be due to TLO:1; and so we require f (f (x)) >tlo (G) f (x), which immediately follows from TLO':1. To satisfy (5), we rst need cap(f (a(g (x)))) f (}) > } cap(b(x)). Thus, (5) should be due to TLO:1, and so we require f (a(g (x))) >tlo (G ) x. For this, by TLO':2, it suces to show g (x) >tlo (G ) x, which immediately follows from TLO':1. To conclude, we need a reduction order satisfying f (f (x)) > f (}) and f (}) > ^ = ff (f (x)) ! f (}); f (}) ! }g and }. But this can be obtained by taking R + >=!R^ , since R^ is terminating. Thus, we can apply Theorem 13, and we conclude the termination of the TRS f(1); (2); (3)g. 0
0
0
As the example above, we can conclude termination of a given TRS + by choosing a reduction order >=! ^ for some suitable terminating TRS R ^ ^ R. Further, such R can be computed eectively (when R is nite); below we describe this taking a single rule TRS for an example. Suppose now that we are requested to detect termination of a TRS R = fl ! r g. It is clear that the number of choices of G is nite. Fix an arbitrary G ; Remark. R
make tree(l) and tree(r ). Let P and Q be the sets of nodes of tree(l) and tree(r ), respectively. Since P and Q are nite, and so is the powerset P (P 2 Q) of the ^. direct product of P and Q. This set P (P 2 Q) is the set of candidates for R ^ 2= P (P 2 Q) then we can alternatively take as R^ the terminating Indeed, if R + 0 0 0 TRS fl0 ! r0 j l0 ! ^ r ; l 2 P; r 2 Qg 2 P (P 2 Q), which has the same eect R ^ for our technique. as R Further, if we are given with a decision procedure D which returns 'yes' for inputs of some terminating TRSs (e.g. a procedure which returns 'yes' for TRSs whose rules are all directed w.r.t. rpo induced from a given precedence), then we have a procedure which decides whether our technique is eective: For each member R0 of P (P 2 Q), check that whether D(R0 ) is 'yes.' If positive then check + 0 whether l >tlo(G ) r for >=! R ; this check can be done in a nite time when R + is terminating, because the set ft j s(> [ .) tg is nite for each s by Konig's ^ (= R0 ) if it exists. Lemma. Thus, through this procedure, we can nd R 0
The conditions in Theorem 13 can not be dropped: Example 2.
Let G = fa; bg, 8 a(x) ! f; R
S
8
b(x; x) ! b(x; a(x)):
Note that S is a terminating non-collapsing non-duplicating TRS and that R ^ = f} ! f g satis es condition 2 of the theorem but not condition 1. Now, let R + and take >=!R^ . Clearly, R^ is terminating, and so > is a reduction order. Also, we have a(x) >tlo(G ) f . But R [ S is not terminating since b(f; f ) !R[S b(f; a(f )) !R[S b(f; f ). Example 3.
Let G = fa; b; cg, 8 a(x) ! c; R
S
8
b(c; x) ! b(a(x); a(c)):
Note that S is a terminating non-collapsing non-duplicating TRS and that R satis es condition 1 of the theorem but not condition 2. Now, take > as the empty order, which is a reduction order. Then, we have a(x) >tlo(G ) c. But R [ S is not terminating, since b(c; a(c)) !R[S b(a(c); a(c)) !R[S b(c; a(c)).
4
Related works
A modular termination result in [9] follows from our result.
Corollary 14.
Let R, S
be terminating TRSs, and suppose that S
is non-
collapsing non-duplicating and that the sets of function symbols that appear in R and S are disjoint. Then R [ S is also terminating.
Let G be the set of function symbols that appear in S . By assumption, + no symbol from G appears in R. Thus, by putting >=! R , we obviously have l >tlo(G) r for all l ! r 2 R. Since l does not contain function symbols from G , the conditions of Theorem 13 are trivially satis ed, and hence the corollary follows. u t Proof.
Now we compare our result with hierarchical modular termination results [2][3] [8][10]. Let
Example 4.
8 =! E (R) . It is easy to see l >tlo(G ) r for all l ! r 2 R, by applying TLO:1 and TLO':1. u t
Proof.
Because of additional restrictions 1 and 2, our result covers only a part of dummy elimination technique. But the next example shows that even when S = ;, there are cases that our technique has an advantage over the (general) dummy elimination. Example 5.
R1
R2
R3
8 8
Let G = fag and
f (f (x)) ! f (a(f (x))) f (a(g(x))) ! a(x);
0 R
1
0
8
0
8
a(g(g(x))) ! a(g(a(g(x))));
R2
f (f (a(x))) ! f (a(f (a(x))));
R3
f (f (x)) ! f (}) f (} ) ! } ;
g(g(x)) ! g(}); f (f (})) ! f (}):
Termination of Ri can be shown using termination of R0i (i 2 f1; 2; 3g), respectively, while the (general) dummy elimination is not eective. Similar to the dummy elimination technique, when S = ; eliminating more than one symbol simultaneously just weaken the power of the technique; successive elimination of symbols works better; see [4]. But in Example 1 it is witnessed that there is a case that successive elimination of a and b is not eective, while the simultaneous elimination of a and b is. It should be remarked here that a much simpler proof for the correctness of the dummy elimination transformation appeared in [10]. But it seems that their proof technique is not directly applicable to our case. Very recently, M. C. F. Ferreira et al. showed in [7] that the dummy elimination is sound under the AC-theory for dummy symbols, S i.e. termination of H(R) implies termination of R modulo E where H(R) = l!r2R fcap(l) ! s j s 2 nodes(r )g and E = fa(x; y ) a(y; x) j a 2 Gg [ fa(x; a(y; z )) a(a(x; y ); z ) j a 2 Gg. Our technique can be applied in a similar way:
Theorem 16. 1.
root(l) 2 G
Let G be a set of function symbols and R a TRS such that
implies
root(r ) 2 G
and
2. no variable appears directly below a symbol from G in
l
when G contains a
constant
l ! r 2 R. If there exists a reduction order > on T (F nG [ f}g; V ) such l > (G) r for any l ! r 2 R, then R is terminating modulo E for any
for any that
tlo
non-collapsing variable-preserving equational system E whose function symbols are contained in G .
5
Concluding remarks
We have proposed a tree lifting ordering >tlo(G ) induced from a reduction order > and a set G of function symbols. We have shown that for a given TRS R such that for any l ! r 2 R (1) root(l ) 2 G implies root(r ) 2 G and (2) no variable appears directly below a symbol from G in l when G contains a constant, if l >tlo(G) r for any l ! r 2 R then R [ S is terminating for any non-collapsing non-duplicating terminating TRS S whose function symbols are contained in G . Furthermore, the reduction order > that works on our technique is eectively obtained from R when R is nite. Also, we have shown that our result covers a modular termination result [9] and that there are cases that our technique has an advantage over the (general) dummy elimination [6]([4]).
Acknowledgments The authors are grateful to Maria C. F. Ferreira and Aart Middeldorp for detecting errors in the previous version [1] of the paper. Thanks are due to the RTA'98 referees for corrections, improvements and constructive comments. This work is partially supported by Grants from Ministry of Education, Science and Culture of Japan, #09245212 and #07680347.
References
1. T. Aoto and Y. Toyama. Tree lifting orderings for termination transformations of term rewriting systems. Research Report IS-RR-97-0033F, School of Information Science, JAIST, 1997. 2. N. Dershowitz. Hierarchical termination. In Proceedings of the 4th International Workshop on Conditional (and Typed) Rewriting Systems (CTRS-94), LNCS 968, pages 89{105. Springer-Verlag, 1995. 3. M. Fernandez and J.-P. Jouannaud. Modular termination of term rewriting systems revisited. In Proceedings of the 10th Workshop on Speci cation of Abstract Data Types, LNCS 906, pages 255{272. Springer-Verlag, 1995. 4. M. C. F. Ferreira. Termination of term rewriting. PhD thesis, Utrecht University, 1995. 5. M. C. F. Ferreira. Dummy elimination in equational rewriting. In Proceedings of the 7th International Conference on Rewriting Techniques and Applications (RTA96), LNCS 1103, pages 78{92. Springer-Verlag, 1996. 6. M. C. F. Ferreira and H. Zantema. Dummy elimination: making termination easier. In Proceedings of the 10th International Conference on Foundamentals of Computation Theory (FCT'95), LNCS 965, pages 243{252. Springer-Verlag, 1995. 7. M. C. F. Ferreira, D. Kesner and L. Puel. Reducing AC-termination to termination. Manuscript, 1997. 8. M. R. K. Krishna Rao. Modular proofs for completeness of hierarchical term rewriting systems. Theoretical Computer Science, 151:487{512, 1995. 9. A. Middeldorp. A sucient condition for the termination of the direct sum of term rewriting systems. In Proceedings of the 4th annual IEEE Symposium on Logic in Computer Science (LICS'89), pages 396{401. IEEE Computer Society Press, 1989. 10. A. Middeldorp, H. Ohsaki and H. Zantema. Transforming termination by selflabelling. In Proceedings of the 13th International Conference on Automated Deduction (CADE-13), LNAI 1104, pages 373{387. Springer-Verlag, 1996. 11. A. Middeldorp and H. Zantema. Simple termination of rewrite systems. Theoretical Computer Science, 175(1):127{158, 1997.
This article was processed using the LaTEX macro package with LLNCS style