Argument Filtering Transformation Keiichirou Kusakari, Masaki Nakamura, Yoshihito Toyama March 23, 1999 IS-RR-99-0008F
School of Information Science Japan Advanced Institute of Science and Technology, Hokuriku Asahidai 1{1, Tatsunokuchi Nomi, Ishikawa, 923-1292, JAPAN fkusakari, masaki-n,
[email protected]
c Keiichirou Kusakari, Masaki Nakamura and Yoshihito Toyama, 1998 ISSN 0918-7553
Argument Filtering Transformation Keiichirou Kusakari
Masaki Nakamura
Yoshihito Toyama
School of Information Science, JAIST Tatsunokuchi, Ishikawa, 923-1292, Japan e-mail:fkusakari, masaki-n,
[email protected] To simplify the task of proving termination of term rewriting systems, several elimination methods, such as the dummy elimination, the distribution elimination, the general dummy elimination and the improved general dummy elimination, have been proposed. In this paper, we show that the argument ltering method combining with the dependency pair technique is essential in all the above elimination methods. We present remarkable simple proofs for the soundness of these elimination methods based on this observation. Moreover, we propose a new elimination method, called the argument ltering transformation, which is not only more powerful than all the other elimination methods but also especially useful to make clear the essential relation hidden behind these methods. abstract:
1 Introduction Term Rewriting Systems (TRSs) can be regarded as a model for computation in which terms are reduced, using a set of directed equations. They are used to represent abstract interpreters of functional programming languages and to model formal manipulating systems used in various applications, such as program optimization, program veri cation and automatic theorem proving [5, 9, 10]. Termination is one of the most fundamental properties of term rewriting systems. While in general termination of TRSs is an undecidable property, several methods for proving termination have been developed. To simplify the task of proving termination of TRSs to which these methods cannot be directly applied, several elimination methods have been proposed. Elimination methods try to transform a given TRS into a TRS whose termination is easier to prove than the original one. The dummy elimination [6], the distribution elimination [14, 17], the general dummy elimination [7] and the improved general dummy elimination [16] are examples of elimination methods. Recently, Arts and Gisel proposed a new attractive method for simplifying the task of proving termination of TRSs based on the notion of dependency pairs [1, 2, 3]. Since this method compares rewrite rules and dependency pairs by a weak reduction order instead of a reduction order, to nd an appropriate weak reduction order for a given TRS is necessary. For this purpose, the argument ltering method was introduced [4, 8, 12], which allows us to make a weak reduction order from an arbitrary reduction order. In this paper, we study the relation between the argument ltering method and various elimination methods. The key of our result is the observation that the argument ltering method combining with the dependency pair technique is essential in all the above elimination methods. Indeed, we present remarkable simple proofs for the soundness of these elimination methods based on this observation, though the original proofs presented in the literatures [6, 7, 14, 17] are complicated and treated as rather dierent methods respectively. This observation also leads us to a new powerful elimination method, called the argument ltering transformation, which is not only more powerful than all the other elimination methods but also especially useful to make clear the essential relation hidden behind these methods. The main contribution of this paper are as follows: 1
(1) We show that the argument ltering method combining with the dependency pair technique can clearly explain in a uniform framework why various elimination methods work well. (2) A new powerful elimination method, called the argument ltering transformation, is proposed. Since the transformation is carefully designed by removing all unnecessary rewrite rules generated by other elimination methods, it is the most powerful among these elimination methods. (3) We make the relation clear among various elimination methods through comparing them with corresponding restricted argument ltering transformation. For example, the dummy elimination method can be seen as a restricted argument ltering transformation in which each argument ltering always removes all arguments, and the distribution elimination method restricts each argument ltering into collapsing one. The remainder of this paper is organized as follows. The next section gives the de nition of term rewriting systems. In section 3, we explain the argument ltering method and the dependency pair technique, and prove several important properties concerning to these notions. Using these results, we show that a general and essential property for elimination techniques to be sound with respect to termination or to simply termination. In section 4, we proposes the argument ltering transformation method and shows the soundness of this method. In section 5, we compare various elimination methods with the argument ltering transformation method, and give simple proofs for the soundness of these elimination methods.
2 Preliminaries We assume that the reader is familiar with notions of term rewriting systems [5]. Let 6 be a nite set of function symbols and V be an enumerable set of variables with 6 \ V 6= ;. The set of terms constructed from 6 and V is written by T (6; V ). V ar(t) is the set of variables in t. We de ne root(f (t1 ; . . . ; tn )) = f . Identity of terms is denoted by . A substitution : V ! T (6; V ) is a mapping. A substitution over terms is de ned as a homomorphic extension. We write t instead of (t). A context is a term which has a special constant 2, called a hole. A term C [t] denotes the result of replacing t in the hole of C . A term s is called a subterm of t, written by t sub s, if t C [s] for some context C . A subterm s of t is called a proper subterm, written by t >sub s, if the context is not a hole, i.e. s 6 t. A rewrite rule is a pair of terms, written by l ! r, with l 62 V and V ar(l) V ar(r). A term rewriting system (TRS) is a set of rules. The set of de ned symbols in a TRS R is denoted by DF (R) = froot(l) j l ! r 2 Rg. A reduction relation ! R is de ned as follows: def s ! t () 9 l ! r 2 R; 9C [ ]; 9 (s C [l] ^ t C [r]). We often omit the subscript R R whenever no confusion arises. A TRS R is terminating if there is no in nite sequence such that t0 ! t1 ! t2 ! 1 1 1. The transitive-re exive closure and the transitive closure of ! are denoted R R R + , respectively. by !3 and ! Let be a binary relation on a set A. We write a1 a2 instead of (a1; a2 ) 2 . A binary relation is transitive if 8a1; a2; a3 2 A: a1 a2 ^ a2 a3 ) a1 a3 , re exive if 8a 2 A:a a, irre exive if 8a 2 A::(a a), symmetric if 8a1; a2 2 A: a1 a2 ) a2 a1, and antisymmetric if 8a1; a2 2 A: a1 a2 ^ a2 a1 ) a1 = a2 . A binary relation on terms is monotonic if 8C:s t ) C [s] C [t]. A binary relation on terms is stable if 8:s t ) s t. A binary relation > is a strict order if > is transitive and irre exive. A binary relation is a partial order if is re exive, transitive and antisymmetric. A binary relation > is a quasi-order if > is transitive and re exive. An extension of a strict order > is de ned as = (> [ ). A strict part of a quasi-order > is de ned as > = ( > n is a reduction order if > is well-founded, monotonic and stable. A reduction order > is a simpli cation order if C [t] > t for all t and C (6 2). We de ne an embedding TRS Emb by ff (x1 ; . . . ; xn ) ! xi j f 2 6; 1 i ng. A TRS R is simply terminating if R [ Emb is terminating. Proposition 2.1 [5, 9, 10] A TRS R is terminating i there exists a reduction order > that satis es l > r for all l ! r 2 R. A TRS R is simply terminating i there exists a simpli cation order > that satis es l > r for all l ! r 2 R.
3 Soundness Conditions for Transformation In this section, we rst explain the dependency pair [1, 2, 3] and the argument ltering method [4, 8, 12], whose notions have been greatly extended to the provable class of termination. The set of dependency pairs itself is a term rewriting system. Thus, so is the union of a term rewriting system and its dependency pairs. We discuss the relations about the termination property between a term rewriting system R and the union of R and its dependency pairs. Using these result, we show that a general and essential property for elimination techniques to be sound with respect to termination or to simply termination. De nition 3.1 A quasi-order > is a weak reduction order if the strict part > is well-founded and stable, and > is monotonic and stable. De nition 3.2 6# = ff # j f 2 6g is the set of marked symbols disjoint from 6. We de ne the root-marked terms by (f (t1 ; 1 1 1 ; tn ))# = f # (t1 ; 1 1 1 ; tn ). The set of the dependency pairs of R, written by DP # (R), is fhu# ; v# i j u ! C [v] 2 R; root(v ) 2 DF (R)g. The set of the unmarked dependency pairs, written by DP (R), is obtained by erasing marks of symbols in DP # (R). Example 3.3 Let R = fadd(x; 0) ! x; add(x; s(y)) ! s(add(x; y))g. Then, DP (R) = fhadd(x; s(y )); add(x; y )ig and DP # (R) = fhadd# (x; s(y )); add# (x; y )ig. Proposition 3.4 [1, 2, 3] Let R be a TRS. If there exists a weak reduction order > such that l > r for all l ! r 2 R,
u# > v #
for all
hu#; v#i 2 DP #(R),
then R is terminating.
Proposition 3.5 [11, 15] Let R be a TRS. If there exists a weak reduction order > such that l > r for all l ! r 2 R,
u>v
for all
hu; vi 2 DP (R),
then R is terminating.
On the notion of the dependency pair, a weak reduction order plays an important role. For this purpose, the argument ltering method was introduced [4, 8, 12], which allows us to make a weak reduction order from an arbitrary reduction order. De nition 3.6 [4, 8, 12] An argument ltering function is a function such that for any f 2 6, (f ) is either an integer i or a list of integers [i1 ; . . . ; im ] (m 0) where those integers i; i1 ; . . . ; im are positive and not more than arity (f ). We say that (f ) is collapsing if (f ) is
3
an integer i, and (f ) is non-collapsing if not collapsing. We can naturally extend over terms as follows:
8 >< (x) = x if (f ) = i >: ((ff ((tt1;; .. .. .. ;; ttn)))) == f((ti()t ); . . . ; (t )) if (f ) = [i1 ; . . . ; im ] 1 n i1 im Example 3.7 Let t f (e(e0(0; 1); 2); e00 (3; 4; 5)), (e) = 1, (e0 ) = [] and (e00 ) = [1; 3]. Then, (t) = f (e0 ; e00 (3; 5)).
Proposition 3.8 [4, 8, 12] Let > be an arbitrary reduction order. Then, the binary relation > , de ned as s > t i (s) (t), is a weak reduction order. proof. We prove only the monotonicity of > by induction on C . Let s > t. If C 2 then C [s] > C [t] is trivial. Let C f (. . . ; ti01 ; C 0 ; ti+1 ; . . .). From induction hypothesis, 0 0 0 C 0 [ s] > C [t]. Thus (C [s]) (C [t]). In the cases (f ) = j 6= i or (f ) = [i1 ; . . . ; in ] 63 i, it is
trivial. In the case (f ) = i, it follows that (C [s]) (C 0 [s]) (C 0 [t]) (C [t]). In the case (f ) = [i1 ; . . . ; in ] 3 i, from the monotonicity of it follows that (C [s]) f (. . . ; (C 0 [s]); . . .) f (. . . ; (C 0 [t]); . . .) (C [t]). 2
The set of dependency pairs itself makes a term rewriting system. Thus, the union of a term rewriting system and its dependency pairs gives an extended term rewriting system. The following two propositions guarantee that termination of R coincides with termination of the extended R with its dependency pairs. Proposition 3.9 [4, 13] R is terminating if and only if R [ DP # (R) is terminating. proof. (() Trivial. ()) We denote by jtj# the maximal nesting number of marked symbols in t. We write C [ t1 ; 1 1 1 ; tn] if each root symbol of ti is a marked symbol and C (6 2) has no marked symbol. We denote (C [ t1 ; 1 1 1 ; tn ] )# by C # [ t1 ; 1 1 1 ; tn] . Let R0 = R [ DP # (R). We
prove that any t is terminating in R0 by induction on jtj# . In the case jtj# = 0, it is trivial from termination of R. Suppose that jtj# > 0. We assume that t is not terminating in R0 . (i) root(t) is a marked symbol. Let t C1# [ t11 ; . . . ; t1n1 ] . From induction hypothesis, each t1j is terminating in R0 . Since each marked symbol occurs only at the root positions of paired terms in DP # (R), any in nite reduction sequence starting from t is expressed by t C1# [ t11 ; . . . ; t1n1 ] 3 C #[ t0 ; . . . ; t0 ] ! 1 1 1 such that ft0 ; . . . ; t0 g 3 C # [ t0 ; . . . ; t0 ] ! C # [ t ; . . . ; t ] ! ! 21 2 n2 2n2 R 11 1 n1 ini i1 2 1 R 2 21 R R 3 0 fti+1;1 ; . . . ; ti+1;ni+1 g and tij ! t for all i and j . From the distribution of occurrences of R ij marked symbols, we obtain an in nite reduction sequence C1# ! C # ! C # ! 1 1 1. Since R R 2 R 3 R 3 3 3 # is terminating, there are some Cij such that C1# ! Ci#3 ! Ci#4 000! Ci#5 ! Ci#6 R R R Ci2 000! # # DP (R) DP (R) 000! 1 1 1 . Since rules of DP # (R) are applied at only the root position in this in nite reDP # (R) 3 3 duction sequence, there are some Ci such that C1 ! R C3 [Ci3 ] ! R C3 [Ci4 ] ! R C3 [C5 [Ci5 ]] R C i2 ! !R3 C3[C5[Ci6 ]] !R 1 1 1. It is a contradiction to the termination of R. 0
0
0
0
0
0
0
0
(ii) root(t) is an unmarked symbol. Let t C1 [ t11 ; . . . ; t1n1 ] . From jt1j j# jtj# and (i), each t1j is terminating in R0. Therefore, it is a contradiction as similar to (i). 2
Proposition 3.10 [13] R is simply terminating if and only if R [ DP (R) is simply terminating.
4
+
proof. (() Trivial. ()) We de ne s > t by s 000! t. Since R is simply terminating, > is a R Emb
simpli cation order. It is easily checked that s > t for all (s; t) 2 R [ DP (R). From proposition 2.1, R [ DP (R) is simply terminating. 2 [
For the following discussion, this proposition is extended to the following theorem. Theorem 3.11 terminating.
R
is simply terminating if and only if
fl ! r j l ! C [ r ] 2 R g
is simply
proof. As similar to proposition 3.10. 2
Under these preparations, we show the following two theorems, which make a general and essential property clear for transformations of TRSs to be sound with respect to termination or to simply termination. Theorem 3.12 Let R be a TRS, R0 a terminating TRS and an argument ltering function. If (R [ DP # (R)) R0 [ DP # (R0 ) then R is terminating. proof. From proposition 3.9, R0 [ DP # (R0) is terminating. Thus, there is a reduction order
compatible with R0 [ DP # (R0 ). From proposition 3.8 and the assumption, > is a weak reduction order whose strict part > is compatible with R[DP # (R). Therefore, R is terminating from proposition 3.4. 2 >
Theorem 3.13 Let R be a TRS, R0 a simply terminating TRS and an argument ltering function. If (R [ DP (R)) fl ! r j l ! C [r] 2 R0g then R is terminating. proof. From theorem 3.11, fl ! r j l ! C [r] 2 R0 g is terminating. Thus, there is a reduction
order > compatible with fl ! r j l ! C [r] 2 R0g. From proposition 3.8 and the assumption, > is a weak reduction order whose strict part > is compatible with (s; t) 2 R [ DP (R). Therefore, R is terminating from proposition 3.5. 2 In the following sections, we will explain that the above two theorems simplify the requirement conditions in elimination techniques into acceptable one.
4 Argument Filtering Transformation In this section, We design a more powerful transformation, called argument ltering transformation, than other elimation techniques [6, 7, 14, 16, 17]. This transformation is designed based on theorems 3.12 and 3.13, which are essential condisions for elimination techniques. De nition 4.1 (Argument Filtering Transformation)
8 >< succ (x) = ; > succ (f (t1; 1 1 1 ; tn )) = SSj6=(f )ftj g [ Ssucc (ti ) : succ (f (t1; 1 1 1 ; tn )) = j62(f )ftj g [ j 2(f ) succ (tj ) f
g [ Sfdec (s) j s 2 succ (t)g
dec (t) = (t)
pick (T ) = t
f 2 T j t 62 T (6nDF (R); V )g 5
if (f ) = i otherwise
f
AF T (R) = (l )
! r0 j l ! r 2 R; r0 2 f(r)g [ pick(dec (r))g
Example 4.2 Let
! f (e(e0 (0; 1; 2); 3); e00(4; 5)); 1 ! 4g: Here, DF (R) = ff; 1g. Let (e) = [], (e0) = [1; 3], (e00 ) = 2 and t f (e(e0 (0; 1; 2); 3); e00 (4; 5)). f
R = f (x; x)
Then, we obtain AF T (R) as follows (Fig.1): succ (t) = fe0 (0; 1; 2); 3; 4g dec (t) = ff (e; 5); e0 (0; 2); 3; 4; 1g
= ff (e; 5); 1g AF T (R) = ff (x; x) ! f (e; 5); f (x; x) ! 1; 1 ! 4g
pick (dec (t))
The termination of AF T (R) is easily proved. Thus, if the argument ltering transformation is sound then R is terminating. This soundness is showed in this section. Note that the termination of R is not easily proved because R is not simply terminating.
f e t =
0
e"
e’
3
1
2
4
5
e’ succπ (t) = { 0
1
2,
3,
}
e’
f dec π (t) = { e
4
5,
0
2, 3 ,
4, 1 }
f pick( dec π (t)) = { e
5 , 1 }
Figure 1: Argument Filtering Transformation Lemma 4.3 Let C be a context and t a term. Then, there exists a context D such that D[(t)] (C [t]) or C [t] >sub D [t] 2 succ (C [t]).
6
proof. We prove the claim by induction on the structure of C . In the case C 2, (C [t])
(t) D [ (t)] for D 2. Suppose that C f (. . . ; C 0 ; . . .). If (f ) = i or i (f ) then C [t] >sub D [t] succ (C [t]) for D = C 0 . Otherwise, from induction hypothesis, there exists a context D0 such that D0 [(t)] (C 0[t]) or C 0 [t] >sub D0[t] succ (C 0 [t]). In the former case, it follows that if (f ) = i then D[(t)] (C 0[t]) (C [t]) for D D0 , and if i (f ) then D [ (t)] f (. . . ; (C 0 [t]); . . .) (C [t]) for D f (. . . ; D0 ; . . .). In the latter case, C [t] >sub D [t] succ (C 0 [t]) succ (C [t]) for D D 0 . 2
2
2
6
2
62
2
Lemma 4.4 Let C be a context and t a term. Then, there exists a context D such that D[(t)] 2
dec (C [t]).
proof. We prove the claim by induction on the structure of C . In the case C 2, D[(t)]
(t) 2 dec (t) = dec (C [t]) for D = 2. Suppose that C 6 2. From lemma 4.3, there exists a context D such that D[(t)] (C [t]) or C [t] >sub D[t] 2 succ (C [t]). In the former case, D [ (t)] (C [t]) 2 dec (C [t]) from the de nition of dec . In the latter case, there exists D0 such that D0 [(t)] 2 dec (D[t]) dec (C [t]) from the induction hypothsis and the de nition of dec . 2
Lemma 4.5 Let C be a context and t a term such that root(t) = f 2 DF (R) and (f ) is non-collapsing. Then, there exists a context D such that D[(t)] 2 pick(dec (C [t])).
2 dec (C [t]). Since (f ) is non-collapsing, root( (t)) = f 2 DF (R). Thus, D [ (t)] includes a de ned symbol. Therefore, D [ (t)] 2 pick (dec (C [t])) from the de nition of pick . 2 proof. From lemma 4.4, it follows that D[ (t)]
Theorem 4.6 If AF T (R) is terminating and (f ) is non-collapsing for all R is terminating.
f
2 DF (R) then
proof. It is trivial that (R) AF T (R). Since (f ) is non-collapsing for all f 2 DF (R), we
have root(l) = root((l)) for any l ! r 2 R. Thus, DF (R) = DF (AF T (R)). From lemma 4.5, (DP # (R)) DP # (AF T (R)). Thus, (R [ DP # (R)) AF T (R) [ DP # (AF T (R)). From theorem 3.12, R is terminating. 2 Theorem 4.7 If AF T (R) is simply terminating then R is terminating. proof. Let R0 = fl ! r j l ! C [r] 2 AF T (R)g. It is trivial that (R) R0. Let h(u); (v)i 2
!
2 !
(DP (R)) corresponding to u C [v ] R. From lemma 4.4, there exists a context D such that D [ (v )] dec (C [v ]). Thus, (u) D[ (v )] AF T (R). From the construction of R0 , (u) (v ) R0 . Thus, (R DP (R)) R0 . From theorem 3.13, R is terminating. 2
!
2
2
[
2
From the proofs of two theorems above, It is obvious that functions succ , dec and pick are used only to keep information of dependency pairs. Thus, introducing redundancy context does not destroy the soundness of argument ltering transformation. Therefore, we can replace pick with pick+ de ned as pick+(T ) = fC [t] j t 2 pick(T )g where C is a convenient context. We denote by AF T+ the argument ltering transformation obtained by replacing pick with pick+ in the de nition of AF T . Corollary 4.8 If AF T+ (R) is terminating and (f ) is non-collapsing for all f R is terminating. Corollary 4.9 If AF T+ (R) is simply terminating then R is terminating.
7
2 DF (R) then
5 Comparison with Other Elimination For proving termination, several transformation methods, which simplify that task, have been proposed. As examples of such transformations the dummy elimination [6], the distribution elimination [14, 17], the general dummy elimination [7] and the improved general dummy elimination [16], were proposed. In this section, we compare these elimination techniques to the argument ltering transformation. As a result, we conclude that the argument ltering transformation is a generalization of these elimination techniques. 5.1
Dummy Elimination
De nition 5.1 (Dummy Elimination)[7]
8> cape (x) = x < > cape (e(t1; 1 1 1 ; tn)) = 5 : cape (f (t1; 1 1 1 ; tn)) = f (cape(t1); 1 1 1 ; cape (tn)) if f =6 e 8 >< dece (x) = ; > dece (e(t1; 1 1 1 ; tn)) = SSni=1 (fcape (ti )g [ dece (ti )) : dece (f (t1; 1 1 1 ; tn)) = ni=1 dece (ti ) if f =6 e ! r0 j l ! r 2 R; r0 2 fcape (r)g [ dece (r)g Example 5.2 Let t f (e(0; g (1; e(2; 3))); 4). Then, cape(t) = f (5; 4) and dece (t) = f0; 2; 3; g (1; 5)g. (Fig.2.)
f
DEe (R) = cape (l)
f e
4 f
t =
g
0
cap e (t) = 4
e
1 2
3 g
dec e (t) = { 0, 2, 3, 1
}
Figure 2: Dummy Elimination Proposition 5.3 [7] If DEe (R) is terminating then R is terminating.
8
For (e) = [], we can treat the constant (e(1 1 1)) as 5. Theorem 5.4 For (e) = [], AF T (R) DEe (R). dec (t) fcape (t)g [ dece (t) by induction on the structure of t. From the de nition of dec , dec (t) = f (t)g[ Sfdec (s) j s 2 succ (t)g. It is trivial that (t) 2 fcape(t)g [ dece(t) from (t) = cape (t). Suppose that s 2 succ (t). It is trivial that cape (s) 2 dece (t) and dece (s) dece (t). From induction hypothsis, dec (s) fcape (s)g[ dece (s) dece (t). 2
proof. It suces to show that
This theorem means that the argument ltering transformation is a proper extension of the dummy elimination, because AF T (R) is terminating whenever DEe(R) is terminating. Example 5.5 Consider TRS R = ff (f (x)) ! f (g(f (x)))g to which the distribution elimination cannot be applied. Let (g) = []. Then,
f
DEg (R) = AF T (R) = f (f (x))
! f (g); f (f (x)) ! f (x)g:
Termination of DEg (R) and AF T (R) is easily proved. Note that termination of R is not easily proved, because R is not simply terminating. 5.2
Distribution Elimination
De nition 5.6 (Distribution Elimination)[17] A rule l ! r is a distribution rule for e if l C [e(x1 ; . . . ; xn )] and r e(C [x1 ]; . . . ; C [xn ]) for some non-empty context C in which e does not occur and pairwise dierent variables x1 ; . . . ; xn .
8> < ftg Ee (t) = > Sni=1 Ee (ti ) : ff (s1; . . . ; sn ) j si 2 Ee(ti )g
if if if
t t t
2V e(t1; . . . ; tn) f (t1; . . . ; tn)
with f = 6 e
f ! r0 j l ! r 2 R is not a distribution rule for e, r0 2 Ee (r)g
DISe (R) = l
Example 5.7 Let t f (e(0; g (1; e(2; 3))); 4). Then, Ee (t) = ff (0; 4); f (g (1; 2); 4); f (g(1; 3); 4)g (Fig.3).
In general, the distribution elimination is not sound with respect to termination, i.e., in general, termination of DISe (R) does not ensure termination of R. Thus, the distribution elimination requires suitable restrictions to ensure the soundness. Proposition 5.8 [14, 17] (a) If DISe (R) is terminating and right-linear then R is terminating. (b) If DISe (R) is terminating and non-constant symbol e does not occur in the left-hand sides of R then R is terminating. Lemma 5.9 Let (e) be collapsing, say (e) = 1. Under the condition (b), for any AF T (R), there exists a context C such that l ! C [r ] 2 DISe (R).
9
l
!r2
f e t =
4 g
0
e
1 2
3
f E e (t) = { 0
f g
4 , 1
f g
4 , 2
1
4
}
3
Figure 3: Distribution Elimination proof. It suces to show that for any r 0 2 dec (r) there exists a context C such that C [r0] 2
Ee (r ). some t
Let r0 2 dec (r). From the de nitions of dec and succ , it follows that r0 (t) for sub r. From the de nition of Ee, there exists a context C such that C [(t)] 2 Ee(r). 2
Theorem 5.10 Let (e) be collapsing, say (e) = 1. Under the condition (b), the following properties hold. (i) If DISe (R) is simply terminating then AF T (R) is terminating.
(ii) AF T+ (R) DISe(R).
proof. It is trivial from lemma 5.9. 2
This theorem means that the argument ltering transformation is more general than the distribution elimination under the condition (b), because AF T+ (R) is terminating whenever DEe (R) is terminating. Example 5.11 Consider TRS R = ff (x; x) ! f (g(a); g(b))g, Let (g) = 1. Then,
f
DISg (R) = AF T (R) = f (x; x)
! f (a; b)g:
The termination of DISg (R) and AF T (R) is easily proved. Note that the dummy elimination cannot be applied, because DEg (R) = ff (x; x) ! f (5; 5); f (x; x) ! a; f (x; x) ! bg is not terminating. 5.3
General Dummy Elimination
De nition 5.12 (General Dummy Elimination)[7] For any e 2 6, an e-status is de ned by (e) = (;; 0) or (I; i) with i 2 I .
10
8> >< tf (cap (t ); . . . ; cap (t )) i n capi (t) = > capi(tii ) 1 >: 5
if if if if
8 >< ftg Ei (t) = > ff (s1; . . . ; sn) j sj 2 Ei(tj )g : E (ti ) 8> < ftg E (t) = > Sfcap0 (t)g : j2I Ej (t)
if if if
t I I
2V f (t1; . . . ; tn) ^ f 6= e e(t1; . . . ; tn) ^ i 6= 0 e(t1; . . . ; tn) ^ i = 0
t t t t
if if if
t t t
2V f (t1; . . . ; tn) ^ f 6= e e(t1; . . . ; tn)
2V =; 6 ; =
8 >< ;S dec(t) = > Snj=1 dec(tj ) S : nj=1 dec(tj ) [ j62I E (tj )
if if if
t t t
2V f (t1; . . . ; tn) ^ f 6= e e(t1; . . . ; tn)
! r0 j l ! r 2 R; r0 2 E (r) [ dec(r)g Example 5.13 Let t f (0; e(f (1; e(2; 3; 4)); 5; 6)) and (e) = (f1; 3g; ). Then, E (t) = ff (0; 6); f (0; f (1; 2)); f (0; f (1; 4))g and dec(t) = f5; 3g (Fig.4).
f
GDEe (R) = capi (l)
f e
0 t =
f
5
6
e
1 2
3
4
f E (t) = { 0
6 ,
0
, 0
f 1
dec(t) =
f
f
2
f 1
{ 5, 3 }
Figure 4: General Dummy Elimination 11
} 4
Proposition 5.14 [7] If GDEe(R) is terminating then R is terminating. Theorem 5.15 Let (e) = (I; i) such that if e 2 DF (R) then i = 0. In the case (e) = (;; 0), we de ne (e) = []. In the case (e) = (I; i) with i 2 I , we de ne (e) = i. Then, the following properties hold. (i) If GDEe (R) is simply terminating then AF T (R) is terminating.
(ii) AF T+ (R) GDEe (R).
proof. In the case (e) = (;; 0), it is trivial that DEe(R) = GDEe (R) by taking the constant
1 1 1)) as 5. Thus, AF T (R) GDEe (R). In the case (e) = (I; i) with i 2 I , as similar to theorem 5.10 by replacing Ee (r) with dec(r) [ E (r). 2
(e(
This theorem means that the argument ltering transformation is more general than the general dummy elimination, because AF T+(R) is terminating whenever GDEe (R) is terminating. Example 5.16 Consider TRS R = ff (x; x) ! f (g(a; b); g(b; b))g. Let (g ) = (f1g; 1) and (g) = 1. Then,
f
GDEg (R) = AF T (R) = f (x; x)
! f (a; b); f (x; x) ! bg:
The termination of GDEg (R) and AF T (R) are easily proved. Note that the dummy elimination and the distribution elimination cannot be applied, because both DEg (R) = ff (x; x) ! f (5; 5); f (x; x) ! a; f (x; x) ! bg and DISg (R) = ff (x; x) ! f (a; a); f (x; x) ! f (a; b); f (x; x) ! f (b; b)g are not terminating. 5.4
Improved General Dummy Elimination
De nition 5.17 (Improved General Dummy Elimination)[16] The functions capi, Ei , E and dec are same as that of the general dummy elimination, and the function pick is same the argument ltering transformation. In the case e 2 DF (R), we take IGEDe (R) = GDEe (R). Otherwise, E 0(t) = pick(E (t))
dec0 (t) = pick (dec(t))
IGDEe (R) = capi (l)
f
! r0 j l ! r 2 R; r0 2 fcapi (r)g [ E 0 (r) [ dec0 (r)g
Proposition 5.18 [16] If IGDEe (R) is terminating then R is terminating. Theorem 5.19 Let (e) = (I; i) such that if e 2 DF (R) then i = 0. In the case (e) = (;; 0), we de ne (e) = []. In the case (e) = (I; i) with i 2 I , we de ne (e) = i. Then, the following properties hold. (i) If IGDEe (R) is simply terminating then AF T (R) is terminating.
(ii) AF T+ (R) IGDEe(R).
12
proof. As similar to theorem 5.15 2
This theorem means that the argument ltering transformation is more general than the improved general dummy elimination, because AF T+(R) is terminating whenever IGDEe (R) is terminating. Example 5.20 Consider TRS R = ff (a) ! f (b); Then,
f
b
! g(a)g.
IGDEg (R) = AF T (R) = f (a)
Let (g) = (;; 0) and (g) = [].
! f (b); b ! 5g:
The termination of IGDEg (R) and AF T (R) are easily proved. Note that the general dummy elimination cannot be applied, because both GDEg (R) = ff (a) ! f (b); b ! 5; b ! ag with (g ) = (;; 0) and GDEg (R) = ff (a) ! f (b); b ! ag with (g ) = (f1g; 1) are not terminating.
References [1] T.Arts, Automatically proving termination and innermost normalization of term rewriting systems, PhD thesis, Univ. of Utrecht, 1997. [2] T.Arts, J.Giesl, Automatically proving termination where simpli cation orderings fail, LNCS 1214 (TAPSOFT 97), 261-272, 1997. [3] T.Arts, J.Giesl, Proving innermost normalization automatically, LNCS 1232 (RTA 97), 157171, 1997. [4] T.Arts, J.Giesl, Termination of term rewriting using dependency pairs, to appear in Theoretical Computer Science. [5] F.Baader, T.Nipkow, Term Rewriting and All That, Cambridge University Press, 1998. [6] M.Ferreira, H.Zantema, Dummy Elimination: Making termination easier, LNCS 965, 243252, 1995. [7] M.Ferreira, Termination of Term Rewriting, Well-foundedness, Totality and Transformations, PhD thesis, Utrecht University, 1995. [8] J.Giesl, E.Ohlebusch, Pushing the Frontiers of Combining Rewrite Systems Farther Outwards, In Proceedings of the Second International Workshop on Frontiers of Combining Systems, FroCos '98, Applied Logic Series, Amsterdam, The Netherlands, October 1998. [9] G.Huet, J.-J.Levy, Computations in orthogonal rewriting systems, I and II, in Computational Logic, Essays in Honor of Alan Robinson, eds. J.-L.Lassez and G.Plotkin, 396-443, MIT Press, 1991. [10] J.W.Klop, Term Rewriting Systems, Handbook of Logic in Computer Science II, 1-112, Oxford University Press, 1992. [11] K.Kusakari, Y.Toyama, On Proving AC-Termination by AC-Dependency Pairs, Research Report IS-RR-98-0026F, School of Information Science, JAIST, 1998. [12] K.Kusakari, Y.Toyama, On Proving AC-Termination by Argument Filtering Method, Research Report IS-RR-99-0006F, School of Information Science, JAIST, 1999. [13] K.Kusakari, Y.Toyama, The Hierarchy of Dependency Pairs, Research Report IS-RR-990007F, School of Information Science, JAIST, 1999. 13
[14] A.Middeldorp, H.Ohsaki, H.Zantema, Transforming Termination by Self-Labelling, Proceedings of the 13th International Conference on Automated Deduction, New Jersey, Lecture Notes in Arti cial Intelligence 1104, 373-387, 1996. [15] C.Marche, X.Urbain, Termination of Associative-Commutative Rewriting by Dependency Pairs, LNCS, 1379 (RTA 98), 241-255, 1998. [16] M.Nakamura, Y.Toyama, On Proving Termination by General Dummy Elimination, Tech. Rep. of IEICE, COMP98-58, 57-64, 1998 (in Japanese). [17] H.Zantema, Termination of term rewriting: Interpretation and type elimination, Jounal of Symbolic Computation 17, 23-50, 1994.
14