Chew's theorem revisited - Semantic Scholar

Report 1 Downloads 112 Views
Chew's theorem revisited - uniquely normalizing property of nonlinear term rewriting systems -

Mizuhito Ogawa NTT Basic Research Laboratories 3-9-11 Midori-cho Musashino-shi Tokyo 180 Japan [email protected] This paper gives a purely syntactical proof, based on proof normalization techniques, of an extension of Chew's theorem. The main theorem is that a weakly compatible TRS is uniquely normalizing. Roughly speaking, the weakly compatible condition allows possibly nonlinear TRSs to have nonroot overlapping rules that return the same results. This result implies the consistency of CL-pc which is an extension of the combinatory logic CL with parallel-if rules. Abstract.

1 Introduction The Church-Rosser (CR) property is one of the most important properties for term rewriting systems (TRSs). When a TRS is nonterminating, a well-known condition for CR is Rosen's theorem, which states that a left-linear weakly nonoverlapping TRS is CR - or, simply, that a left-linear nonoverlapping TRS is CR[11, 13]. A pair of reduction rules is said to be overlapping if their applications interfere with each other (i.e., they are uni ed at some nonvariable position), and a TRS is said to be nonoverlapping if none of its rules are overlapping (except that a same rule overlaps itself at the root). A TRS is said to be weakly nonoverlapping if applications of an overlapping pair of rules return the same result. Without the assumption of linearity, on the other hand, CR for a nonoverlapping TRS is not guaranteed for the following two reasons: (i) A pair of nonoverlapping rules may overlap modulo equality. For instance, R1 has a sequence d(2; 2) ! d(2;f (2)) ! d(f (2); f (2)) ! d(f (2); f 2(2)) ! 1 1 1 s.t. d(2; 2), d(f (2); f (2)), 1 1 1 are reduced to 0, and d(2; f (2)); d(f (2); f 2 (2)); 1 1 1 are reduced to 1. Because 0 and 1 are normal forms, R1 is not CR[11]. (ii) A reducible expression (redex) for a nonlinear rule may not be recovered after some reduction destroys the identity of nonlinear variables. For instance, R2 has a sequence 1 ! f (1) ! d(1; f (1)) ! d(f (1); f (1)) ! 0. Thus, 1 !3 0 and 1 ! f (1) !3 f (0). Since 0 is a normal form and f (0) simply diverges to d(0; d(0; d(1 11))), R2 is not CR[3]. 8 < d(x; x)

9

!0 = R1 = : d(x; f (x)) ! 1 ; 2 ! f (2)

8 < d(x; x) ! 0

9 =

R2 = : f (x) ! d(x; f (x)) ; 1 ! f (1)

Chew and Klop have shown the sucient condition for the uniquely normalizing (UN) property instead of CR - that is, a strongly nonoverlapping TRS is UN[3, 7]. A TRS is said to be strongly nonoverlapping if its linearization (i.e., the renaming of repeated variables with fresh individual variables) is nonoverlapping. Chew also states, more generally that a compatible TRS is UN[7]. In the compatible case, however, Chew's proof is hard to recognize, and its journal version has not yet been published[4]. Several trials to get a new proof have been reported[3, 15], and they show partial answers. Their main technique is to rst transform a nonlinear TRS to a linear TRS (either unconditional or conditional) and use its weakly nonoverlapping property to prove it CR. Then, they translate the CR property of the linearized TRS to the UN property of the original nonlinear TRS[7, 8]. De Vrijer uses a similar technique to show that CL-pc (combinatory logic with parallel-if)

is UN[15] and the key of his proof is the consistency check (i.e., T 6= F ) accomplished by constructing a model of CL-pc. Finally the consistency shows that an application of Czxx ! x may overlap modulo equality with an application of either CTxy ! x or CFxy ! y, but not both. 9 9 8 8 < Sxyz ! xz (yz ) = < CTxy ! x = Kxy ! x CFxy ! y where CL = CL-pc = CL [ :

Czxx ! x ;

:

Ix ! x

;

This paper shows a purely syntactical proof for an extension of Chew's theorem. This extension states that a weakly compatible TRS is UN. Roughly speaking, this weakly compatible condition allows a pair of nonroot overlapping rules if they return the same results (whereas a compatible condition allows only root overlapping rules). The main technique of this syntactical proof is an equational proof normalization called E -normalization that shows UN directly (not by way of the CR of a linearized TRS). This normalization technique di ers those described in [2] and [9] in that it can be used even for TRSs that are nonterminating.

x

x

Ry

.

P

P

Ry



x

y

x

&

y

 ( ) Fig. 1.

Ry



x  ( )

=

 ( )

!

Ry

x

Ry

y

P

y

y

 ( )

P

P

 ( )

y

Ry

y

x

x

=

 ( )

Elimination of a reduction peak modulo equality on substitutions (Basic E -normalization)

Intuitively speaking, E -normalization is an elimination of reduction peaks modulo equality on substitutions (strongly overlapping cases, Fig. 1) and their variations (weakly compatible cases). Section 2 reviews the basic notation and terminology used in this paper, and it reviews results related to CR. Section 3 introduces a weight for proof structures that guarantees the termination of the E -normalization procedure. This weight is principally an extension of the parallel steps of an objective proof. Section 4 introduces E -normalization rules and their properties. Subsection 5.1 shows that any equality in a weakly compatible TRS has a proof in which there is no reduction peaks modulo equality (not restricted on substitutions. That is, two redexes are combined with equality that does not touch on their root symbols). Lemma 31 in subsection 5.2 then shows that a weakly compatible TRS is UN.

2 Term rewriting systems Assuming that the reader is familiar with the basic TRSs concepts in [1] and [6], we brie y explain notations and de nitions. A term set T (F; V ) is a set of terms where F is a set of function symbols and V is a set of variable symbols. 0-ary function symbols are also called constants . The term set T (F; V ) may be abbreviated by simply T . A substitution  is a map from V to T (F; V ). To avoid confusion with equality, we will use  to denote the syntactical identity between terms.

De nition 1.

A position position(M; N ) of a subterm N in a term M is de ned by 

N: position(M;N ) = i 1 u ifif uM=position (N ; N ) and M  f (N1 ; 1 1 1 ; N ): Let u and v be positions. We denote u  v if 9w 6=  s.t. v = u 1 w, we denote u  v if either u = v or u  v, u k v if neither u  v nor u  v, and we denote u 6k v if either u  v or u  v. i

n

For a set U of positions and a position v , we will denote U k v if u k v for 8u 2 U , we denote U 6k v if not U k v, and we denote v  U if v  u for 8u 2 U . The subterm N of M at position u is noted by M=u (i.e., u = position(M; N )). We say that u is a nonvariable position if M=u is not a variable. We denote a set of all positions in M by pos(M ), a set of all non-variable positions in M by posF (M ), and a set of positions of variables in M by posV (M ). A set of variables in M is denoted as V ar (M ). A variable x is linear (in M ) if x appears at most once in M . A variable x is nonlinear if it is not linear. A replacement of T=u with T 0, where u is a position in T , is denoted by T [u T 0 ].

A nite set R = f i ! ig of ordered pairs of terms is said to be a term (TRS) if each i is not a variable and V ar( i)  V ar( i ). A binary relation called reduction is de ned to be M ! N if there exist a position u and a substitution  s.t. M=u  ( i ) and N  M [u ( i )]. A subterm M=u  ( i ) in M is said to be a redex. A normal form is a term that contains no redex. A set of normal forms of R is noted as NF (R ).

De nition 2.

rewriting system

The symmetric closure of ! is noted as $. If a reduction M ! N or M $ N occurs at a position u, we will note M ! N or M $u N . The re exive transitive closure of ! is noted as u

!3 . An equality noted = is the re exive symmetric transitive closure of !. A structure with an

equality = is said to be an equational system associated to a TRS R. We will use the default notations R for a TRS and E for an associated equational system.

De nition 3. A TRS R is (CR) if M = N implies M # N (i.e., 9P s.t. M !3 P and N !3 P ). A TRS R is said to be (UN) if each set of equal terms has at most one normal form (i.e., M = N and M; N 2 NF (R) imply M  N ). Church-Rosser

uniquely normalizing

De nition 4.

A reduction rule is said to be left linear if any variable in its lhs is linear. A TRS is said to be left linear if all its reduction rules are left linear. We say a TRS is nonlinear if it is not left linear. A pair of reduction rules i ! i and j ! j is said to be overlapping if there exist both a nonvariable position u in i and substitutions ,  s.t. ( i )=u  ( j ) (i.e., i=u and j are uni able). We also say ( j ) overlaps with ( i ) at u. A TRS R is said to be nonoverlapping if no pair of rules in R are overlapping except for trivial cases (i.e., i = j ^ u = ), and a TRS R is said to be strongly nonoverlapping if R is nonoverlapping after renaming its nonlinear variables with fresh individual variables. A TRS R is said to be weakly nonoverlapping if any overlapping pair of rules returns same result (i.e., ( i )  ( i )[u ( j )]).

De nition 5.

Theorem 6 (Rosen[13]). Corollary 7 ([11]).

A left-linear weakly nonoverlapping TRS is

A left-linear nonoverlapping TRS is

CR.

CR.

This theorem and its corollary intuitively rely on the commutativity of reductions, but nonlinear TRSs have more complex situations. Firstly, the commutativity of reductions is lost because it requires synchronous applications of a reduction on each occurrences of a variable (such as those applied in term graph rewriting[5]). Moreover, consider a variable x on the lhs of a rule: which x on the lhs is inherited to an occurrence of x's on the rhs? The following compatible conditions guarantee that if a pair of linearizations of rules is overlapping it returns same result under suitable combinations of variable-inheritances. Note that when a TRS is leftlinear, a strongly nonoverlapping condition is the same as a nonoverlapping condition, and a weakly compatible condition is the same as a weakly nonoverlapping condition.

De nition 8 ([15]). (i) Let ! be a rewriting rule. A linearization of a term M is a term M 0 in which all the nonlinear variables in M are renamed to fresh individual variables. A cluster of a rewrite rule ! is f 0 ! 10 ; 1 1 1 ; 0 ! n0 g, where 0 is a linearization of and each i0 is a term obtained from by replacing each nonlinear variable in with one of the

corresponding variables.

0 1 ! 1 0 and 0 2 ! 2 be two rules of a TRS R. Let f 01 ! 110 ; 1 1 1 ; 10 ! 10 g and 2 ! 21 ; 1 1 1 ; 2 ! 2 g be the two clusters corresponding to 1 ! 1 and 2 ! 2 . We say that 1 ! 1 and 2 ! 2 are if the following holds: ( 02 ) ( 01) u C [ ]  10 [u 2] f(( 01) ! ( 10 )) j i = 1; 1 1 1 ; ng \ f((C [ 02]) !  (C [ 20 ])) j j = 1; 1 11 ; mg =6 . A TRS R is if all pairs of its reduction rules are weakly compatible. (iii) Let notations be the same as in (ii), and let 1 ! 1 and 2 ! 2 be reduction rules. We say that 1 ! 1 and 2 ! 2 are if they are weakly compatible and 10 and 02 may overlap only at the root (i.e., u = ). A TRS R is if all pairs of reduction rules

(ii) Let

f 0

n

m

weakly compatible

If

overlaps with

at a position

instance wrt a context

, then the two clusters have a common

. That is,

i

j

weakly compatible

compatible

compatible

are compatible.

Regarding a product xy in CL-pc as apply (x; y), CL-pc is a compatible TRS. CL-sp (CL with surjective pairing[12, 15]) is not weakly compatible.

Example 1.

Theorem 9 (Chew[7]).

A compatible TRS is

Corollary 10 (Klop[3]).

UN.

A strongly nonoverlapping TRS is

UN.

3 Equational proof: structure and weight 3.1 Proof structure A sequence of terms combined by the $ relation is said to be a proof structure. is a pair consisting of an equality and its proof structure, and it is denoted by M0 $ u1 M 11 1 u$ M1 $ n01 $ Mn ) M0 = Mn , where a reduction Mi01 $ Mi occurs at a position u u u2 i n n01 ui . We will omit positions ui if they are clear or unspeci ed from the context.

De nition 11.

A

proof

Instead of writing whole terms, we will use proof structure variables P ; P 0 ; P1 ; P2 ; 1 11 for proof structures. For proofs P1 ) M0 = M1 , P2 ) M1 = M2 , 1 1 1, Pn ) Mn01 = Mn , a concatenation P1 , P2 , 1 1 1, Pn is denoted by conc(P1 ; 1 1 1 ; Pn ), and the resulting proof is denoted by conc(P1 ; 1 1 1 ; Pn ) ) M0 = Mn . For a proof structure P of M1 $ M2 $ 1 1 1 $ Mn and a context C [ ], we will denote C [M1 ] $ C [M2 ] $ 1 1 1 $ C [Mn ] by C [P ]. To emphasize the speci c structure of a proof structure, we will also introduce two abbreviated notations: a sequence and a collection. A sequence of proofs [P1 ) M0 = M1 ; 11 1 ; Pn ) Mn01 = Mn] is a proof structure for M0 = Mn. It emphasizes the speci c intermediate terms M0 ; 1 1 1 ; Mn . Its proper form is obtained by the unfolding rule (S): (S) A sequence [P1 ) M0 = M1 ; 1 1 1 ; Pn ) Mn01 = Mn ] M0 = Mn . It is unfolded to conc(P1; 1 1 1 ; Pn) ) M0 = Nn .

is a proof structure for

A collection of proofs [[P1 ) M1 = M10 ; 1 1 1 ; Pn ) Mn = Mn0 ]] is a proof structure for C [M1 ; 1 1 1 ; Mn] = C [M10 ; 1 1 1 ; Mn0 ]. Consider an example of a proof structure f (g(a); h(y)) !1 f (h(a);h(y)) 1 f (h(a); g(y)) for a TRS fg(x) ! h(x)g. Parallel subproofs g(a) ! h(a) and h(y) g(y) induce an equality f (g(a); h(y)) = f (h(a); g(y)). A collection of proofs emphasizes such a situation. Its proper form is obtained by the unfolding rule (C):

u pos(M ) \ pos(N ) [[P1 ) M=u1 = N=u1 ; 1 1 1 ; P ) M=u = N=u ]] M =N conc(C1 [P1 ]; 1 1 1 ; C [P ]) ) M = N C [2]  M [u N=u 8j < i; u 2 ] (C)

Let

i be disjoint positions in n

to

n

n

i

.

n

. A collection

n

is a proof structure for , where

i

. It is unfolded

j

j for

Our technique for transforming an equational proof to a simpler one is E -normalization. This normalization (introduced in Section 4) eliminates reduction peaks modulo equality on substitutions and their variations. For instance, consider a TRS ff (x; y ) ! g (x; y; y); 1 1 1 g. Assume there exist an equality g((x); (y ); (y )) = g( (x); (y);  (y)) that is proved by g ((x); (y); (y )) f ((x); (y)), a collection of proofs [[Px ) (x) = (x); Py ) (y) = (y)]] ) f ((x); (y)) = f ((x); (y)), and f ((x); (y)) ! g((x); (y); (y)). Then a (basic) E-normalization (Fig. 1) transforms it to a simpler proof [[Px ) (x) = (x); Py ) (y) = (y); Py ) (y ) = (y )]] ) g((x); (y); (y)) = g((x); (y); (y)). To show the termination of E -normalization, the proof weight will be introduced in Subsection 3.2. This normalization decreases a parallel step of a transformed part in a proof structure, but when that part may be properly included in a whole proof, the number of parallel steps of a whole proof may not decrease. We therefore need an extension that is more sensitive to a parallel step of its proper substructure: a proof weight. Lemma 19 in Subsection 3.2 will show the termination of E -normalization procedure (Theorems 21 and 25). u1 u1 u1 M0 M M M M2 v M4 w M5 0 2 0 u2 v u2 u2 u3 u3 u3 (a) M0 = 1 1 1 Fig. 2.

(b) M0 = M2 = 1 1 1

Construction of E -graph for M0

$

u1

(c) M0 = M2 = M4 = M5

M1 $ M2 $ M3 $ M4 $ M5 . u3

u2

v

w

The graphical intuition of a proof weight is sketched by a notion of an E -graph[17]. Let M0 $1 M1 $2 M2 $3 M3 $ M4 $ M5 ) M0 = M5 . Assume that u1 , u2 , and u3 are disjoint, and that v  u1 ; u2 , v k u3 , and w  u3 ; v. Then, the E -graph is generated as follows. Since u1 , u2, and u3 are disjoint, the edges corresponding to u1 , u2 , and u3 stem in parallel from a vertex M0 (Fig. 2(a)). Since v  u1 ; u2 , the edges labeled with u1 and u2 are collected to a vertex M2 and an edge labeled v stems from M2 (Fig. 2(b)). Finally, since w  u3 ; v and u3 k v, the edges labeled u3 and v are collected to a vertex M4 and an edge labeled w stems from M4 to a vertex M5 (Fig. 2(c)). A set of proof strings (Subsection 3.2) is a set of all cycle-free paths from M0 to M5 , such as (u1 ; v; w), (u2 ; v;w ), and (u3 ; w). The proof weight of P is a multiset of their lengths f3; 3; 2g. u

u

u

v

w

3.2 Weight for proofs De nition 12. Let (u1 ; u2; 1 1 1 ; un ) be a sequence of positions and v be a position. An operation (u1 ; u2 ; 1 1 1 ; un ) v returns a set de ned by 8 < f(u1 ; u2 ; 1 1 1 ; un ; v)g

if v 6k un : if v k uj for 8j > i and v 6k ui : if v k ui for 8i:

f(u1; u2; 1 1 1 ; un ); (u1 ; u2 ; 1 11 ; ui ;v )g : f(u1; u2; 1 1 1 ; un )g

De nition 13. Let S be a set of sequences of positions, and v be a position. An operation S 8 u is de ned to be  [u2S u v if 9u 2 S s.t. u 6k v; and S [ f(v )g otherwise. Here u k v if ui k v for 8ui 2 u = (u1 ; u2 ; 1 1 1 ; un ), and u 6k v if not u k v . Let M0 $ M1 $ 1 1 1 $ Mn01 $ Mn ) M0 = Mn be a proof. A proof un un01 u2 u1 string is an element of a set S (M0 $ M1 $ 1 1 1 $ Mn01 $ Mn ) inductively de ned to be u u u u

De nition 14.

1

2

01

n

n

(



if n = 0; and otherwise.

S (M0 $ M1 $ 1 1 1 u$01 Mn01 ) 8 un u1 u2 n

For two sets S1 , S2 of sequences of positions, S1 S2 is de ned to be [(v1 ;111;v )2S2 S1 8 v1 8 1 1 1 8 vn . Thus S (conc(P1; P2)) = S (P1 ) S (P2 ). De nition 15. Let P ) M = N be a proof. A w(S (P )) is a multiset of stringlengths of proof strings in S (P ) where a string-length l(u) is a number n for u = (u1 ; u2 ; 1 1 1 ; un ). n

proof weight

The ordering on proof weights is de ned to be the multiset extension of the usual ordering on natural numbers[10]. Let P ) M = N be a proof. A boundary @ P is a set of positions de ned by min(fv j v appears in u 2 S (P )g) (i.e., a set of minimum positions appeared in each proof string in S (P )). If a proof structure P satis es 8v 2 @ P s.t. w  v , we denote P by M = N . w If 8v 2 @ P s.t. w  v, we denote P by M = N .

De nition 16.

w



Let S be a set of proof strings. S u is de ned to be fv 2 S j v 6k ug for a position u. For a set of disjoint positions U , S U is [u2U S u . For positions v; w s.t. v  w , S v=w is S v 0 S w . For a position v and a set of disjoint positions W , S v=W is S v 0 S W .

De nition 17.

De nition 18. Let w = (w1 ; 1 1 1 ; wm ) be a proof string and u be a position. We will denote (w1 ; 1 1 1 ; wi ) by w < u if wi 6k u and wj k u for 8j > i, and we will denote (wi ; 1 1 1 ; wn ) by u > w if wi 6k u and wj k u for 8j < i. For a set S of proof strings, S < u is fw < u j w 2 Sg and u > S is fu > w j w 2 Sg. Let an equality S = T have two proof structures P1 , P2 , and let u; v be positions u 6k v. Assume P1 has a form S $ S 0 =( ) T 0 $ T and P2 has a form S =( ) T . Then max(w(S (P1 ))) > max(w(S (P2 ))) implies w(S (P13 ))  w (S (P23 )), where (i) P13 is [P ) M = S ; P1 ) S = T ; P 0 ) T = N ], (ii) P23 is [P ) M = S ; P2 ) S = T ; P 0 ) T = N ], and (iii)  is the multiset extension of the ordering > on natural numbers. Proof Without loss of generality, we can assume u  v and max(u;v ) = v . We remark that if positions u; v satisfy u  v, then, for any set S of proof strings, S  S , max(w(S < u))  max(w(S < v)), and max(w(u > S ))  max(w(v > S )). We will estimate the maximum length in w(S (P13 ) 0S (P13 ) \S (P23 )) and w(S (P23 ) 0S (P13 ) \ S (P23 )). The former will be shown to be greater than the latter, and this will show that w(S (P13)  w(S (P23).

Lemma 19.

s.t.

u

max u;v

v

max u;v

u

v

(1) A proof string in S (P13 ) = S (P ) S (P1 ) S (P 0 ) has one of following forms: (1-i)

(w1 ; 1 1 1 ; wi ; u; u1 ; 1 1 1 ; us ; v;wj0 ; 1 1 1 ; wn0 )

(1-ii) (w1 ; 1 1 1 ; wi ; u; wj0 ; 1 1 1 ; wn0 ) (1-iii) (w1 ; 1 1 1 ; wi ; wj0 ; 1 1 1 ; wn0 )

for (w1 ; 11 1 ; wi) 2 S (P )u < u (u; u1 ; 1 11 ; us; v ) 2 S (P1 ) (wj0 ; 11 1 ; wn0 ) 2 v > S (P 0 )v for (w1 ; 11 1 ; wi) 2 S (P )u < u (wj0 ; 11 1 ; wn0 ) 2 u > S (P 0 )u=v for (w1 ; 11 1 ; wi) 2 S (P )=u < wj0 (wj0 ; 11 1 ; wn0 ) 2 wi > S (P 0 )=u

These sets are respectively denoted S(10i) , S(10ii) , and S(10iii) . The maximum length of S(10i) and S(10ii) are estimated as max(w(S(10i) )) = max(w(S (P ) < u)) + max(w(S (P ))) + max(w(v > S (P 0))) and max(w(S(10ii))) = max(w(S (P ) < u)) + 1 + max(w(u > S (P 0 )u=v )): (2) A proof string in S (P23 ) = S (P ) S (P2 ) S (P 0 ) has one of following forms:

(2-i) (w1 ; 1 1 1 ; wi ; u01 ; 11 1 ; u0s; wj0 ; 1 1 1 ; wn0 ) (2-ii) (w1 ; 1 1 1 ; wi ; wj0 ; 1 1 1 ; wn0 )

0

for (w1 ; 1 1 1 ; wi ) 2 S (P )u1 < u01 (u01 ; 1 1 1 ; u0s) 2 wi > S (P2 ) < wj0 0 (wj0 ; 1 1 1 ; wn0 ) 2 u0s > S (P 0)us for (w1 ; 1 1 1 ; wi ) 2 S (P )=@ P2 < wj0 (wj0 ; 1 1 1 ; wn0 ) 2 wi > S (P 0)=@P2

These sets are denoted S(20i) and S(20ii) . Then S (P13 ) \ S (P23 ) = S(10iii) and S(10iii) = . A set S(20ii)0 = S(20ii) 0 S(10iii) consists of elements of the form

S(20i) \

for (w1 ; 1 1 1 ; wi ) 2 S (P )u=@ P2 < wj0 (wj0 ; 1 1 1 ; wn0 ) 2 wi > S (P 0)u=@P2 .

(2-ii)' (w1 ; 1 1 1 ; wi ; wj0 ; 1 1 1 ; wn0 )

Since u >S (P 0)u=@P2 = u >S (P 0 )u=v [u >S (P 0)v=@ P2 , the maximum lengths max(w(S(20i) )) and max(w(S(20ii)0 )) are estimated as follows:

max(w(S(20 ) ))  max( w(S (P ) P2 < u)) + max(w(S (P2 ))) + max(w(v > S (P 0 ) P2 )) < max( w(S (P ) < u)) + max(w(S (P1 ))) + max(w(v > S (P 0))) = max( w(S(10 ) )) max(w(S(20 )0 ))  max( w(S (P ) P2 < u) + max(w(u > S (P 0 ) P2 ))  max( max(w(S (P ) < u) + max(w(u > S (P 0 ) )); max(w(S (P ) P2 < u) + max(w(u > S (P 0) P2 )) ) < max( max(w(S(10 ))); max(w(S(10 ))) ) Thus w(S (P13 ))  w(S (P23 )). @

@

i

i u=@

ii

u=@

u=v

u=v

v=@

v=@

i

ii

4 E -normalization 4.1 Basic E -normalization

Let ! be a reduction rule, and let  and  be substitutions. Then, the following transformation rule (from the upper column to the lower column) is said to be a basic E-normalization rule: 2 3 ( ) ( ) ) ( ) = ( ) ; 4 [[Pu ) ( )=u =  ( )=u for 8u 2 posV ( )]] ) ( ) =  ( ) ; 5 )  ( ) = ( ) ( ) ! ( ) ) ( ) = ( ) [[Pv ) ( )=v = ( )=v for 8v 2 posV ( )]] )  ( ) =  ( )

De nition 20.

if a proof structure Pv in the lower column is arbitrarily selected from a set of Pu's in the upper column s.t. =u  =v 2 V ar( ).

Theorem 21.

E

Each step of a basic

E

-normalization decreases the proof weight. Thus a basic

-normalization procedure for any proof always terminates.

E -normalization for a weakly compatible TRS De nition 22. Let 1 ! 1 and 2 ! 2 be reduction rules, let  and  be substitutions, and let C [ ]   ( 1 )[u 2]. Assume that ( 1 ) and C [( 2 )] are combined by a proof structure ( )u=C [( 2 )]. If @ (( 1 ) u= C [( 2 )]) \ posF ( 1 ) \ u 1 posF ( 2 ) = , then ( 1 ) and C [( 2 )] are said to be E . Assume S and S 0 to be quasi-E -normalizable. The next lemma shows that if a TRS is weakly compatible, then any pair of reduction T S and S 0 ! T 0 in a proof can be eliminated by an E-normalization. Lemma 23. Let a TRS R be weakly compatible. Assume that 1 ! 1 and 2 ! 2 are rules in R, that  and  be substitutions, and that a position u 2 posF ( 1 ) s.t. 4.2

quasi-

-normalizable

[[Pw ) ( 1 )=u 1 w = ( 2 )=w for 8w 2 min(posV ( 1 =u) [ posV ( 2 ))]] ) ( 1 ) = (C [ 2 ]) for C [ ]  1 [u 2]. Then linearizations of 1 =u and 2 overlap, and [[Pw0 ) ( 1 )=u 1 w0 = ( 2 )=w0 for 8w 0 2 min(posV ( 1 =u) [ posV ( 2 ))]] ) ( 1 ) = (C [ 2 ])

0 ; 1 1 1 ; 01 ! 10 n g and f 02 ! 21 0 ; 1 1 1 ; 02 ! 20 m g be clusters of 1 ! 1 Let f 01 ! 11 and 2 ! 2 . Let W = min(posV ( 1 =u) [ posV ( 2 )), and let C 0 [ ] be a linearization of C [ ]. Set substitutions 0 for 01 and  0 for C 0 [ 02 ] as follows: 0 0 For a variable  x in 1 s.t. w = position( 1 ; x), 2]=w) if w 2 u 1 (W \ posF ( 2 )); and 0 (x)  (( C1[=w ) otherwise.

Proof

For a variable y in C 0 [ 02] s.t. w = position(C 0 [ 02]; y),  ) if w 2 u 1 (W 0 posF ( 2 )); and  0(y)  (( C1[=w 2 ]=w) otherwise. Then linearizations 10 and 20 overlap at a position u (i.e.,  0( 01 )  0 (C [ 02 ])). Since R is weakly compatible, there exists the intersection (0 ( 10 ) !  0( 10 s ))  ( 0 (C [ 02 ]) ! 0 (C [ 20 t ])) between two clusters (i.e., 0 ( 10 s )   0 (C [ 20 t ])). Thus a set of proofs ( 1 =u 1 w ) =  ( 2 =w) for 8w 2 min(posV ( 1 =u) [ posV ( 2 )) also combines ( 1 ) and (C [ 2 ]) as  ( 1 ) = 0 ( 10 s )  0 (C [ 20 t]) = (C [ 2]).

Let 1 ! 1 and 2 ! 2 be weakly compatible. Assume 10 =u and 02 to be uni ed for u 2 posF ( 01 ), where 01 and 20 are the linearizations of 1 and 2 . Let C [ ] be a context that has a hole 2 at u s.t. C [ 02 ]  01 , and let  and  be substitutions. The following transformation rules are said to be the E -normalization rules: 2 3 ( 1) ( 1) ) ( 1) = ( 1 ) ;   6 Pw ) ( 1 )=u 1 w = ( 2 )=w 7 6 ) ( 1) = (C [ 2 ]); 75 ) ( 1 ) =  (C [ 2 ]) 4 for 8w 2 min(posV ( 1 =u) [ posV ( 2 )) ( 2) ! ( 2) ) (C[ 2]) = (C [ 2 ])  Pw0 ) ( 1=u) 1 w0 = ( 2)=w0 ) ( 1 ) =  (C [ 2 ]) for 8w 0 2 min(posV ( 1 =u) [ posV ( 2 ))

De nition 24.

and2its inverted form ( 2 ) ( 2) ) (C[ 2]) = (C [ 2 ])  6 Pw ) ( 2 )=w = ( 1 )=u 1 w 6 ) 4 for 8w 2 min(posV ( 1 =u) [ posV ( 2 )) ( 1 ) ! ( 1) ) ( 1 ) = ( 1 )  Pw0 )  ( 2 )=w0 =  ( 1 =u) 1 w0 for 8w 0 2 min(posV ( 1 =u) [ posV ( 2 ))

3 7

(C [ 2]) = ( 1); 75 ) (C [ 2 ]) = ( 1 ) ) (C [ 2 ]) = ( 1 )

Here a proof structure Pw0 in the lower column is arbitrarily selected from a set of upper column s.t. ( 1 )=u 1 w  ( 1 )=u 1 w0 and  ( 2 )=w  ( 2 )=w0.

Theorem 25. Let

R

be a weakly compatible TRS. Each step of an

the proof weight. Thus the

E

E

Pw in the

-normalization decreases

-normalization procedure for any proof always terminates.

For a product xy such as apply(x; y ), CL-pc is a compatible TRS. CL-pc has overlapping rules such as (CTxy ! x; Czxx ! x) and (CFxy ! x; Czxx ! x). The following rule is an example of an E -normalization rule in addition to the basic E -normalization rules: 2 3 22(x) C T (x) (y) 33 ) (x) = C T (x) (y) ; 6 P 1 ) T =  (z 0 ); 7 6 7 6 44 P2 ) (x) =  (x0 ); 55 ) C T (x) (y) = C  (z 0 )  (x0 ) (x0 ) ; 7 ) (x) =  (x0 ) 6 7 4 P 3 )  (y ) =  (x 0 ) 5 0 0 0 0 0 0 0 0 C  (z )  (x )  (x ) !  (x ) ) C  (z )  (x )  (x ) =  (x ) P2 ) (x) =  (x0) Example 2.

for substitutions  and .

5 Sucient condition for the UN property E -overlapping pair De nition 26. Let P ) M0 = Mn be a proof. Assume P has the form M0 $ M1 $ 1 1 1 $ Mi01 u Mi max(=u;v) Mj !v Mj+1 $ 1 1 1 $ Mn01 $ Mn. Then a pair of terms (Mi ; Mj ) is said to be an E . De nition 27. A proof is E if no E -normalization rule is applicable. An equational proof is said to be E if there are no E -overlapping pairs in it. A TRS is E if every E -normal proof is E -overlapping-pair-free. Theorem 28. R R E Proof Let P ) M = N be an E -normal proof. Assume there exists an E -overlapping pair in P . Let (S; T ) be an innermost E -overlapping pair in P . Then (S; T ) is quasi-E -normalizable (otherwise there is an inner E -overlapping pair between S and T ), and E -normalization can be applicable to (S; T ) from Lemma 23. This contradicts the E -normal assumption on P . 5.1

-overlapping pair

-normal

-overlapping-pair-free

-nonoverlapping

If a TRS

is weakly compatible, then

is

-nonoverlapping.

5.2 The UN property for an E -nonoverlapping TRS De nition 29 [11]. 

1(x) 1(f (M1 ; 1 1 1 ; M

A term-length 1(M ) for a term M is de ned to be

=1 P )) = 1 + ni=1 1(Mi ) n

for a variable x, and otherwise.

Assume that a TRS R is E -nonoverlapping. If P ) M = N is an E -normal proof and M 6 N , then there exist a position u 2 @ P , a substitution  , and a rule ! s.t. P is either M = N [u  ( )] u N [u ( )] u= N; or M u= M [u ( )] ! M [u ( )] = N: u

Proposition 30.

Proof P is a nontrivial proof because M 6 N . If P holds for neither of the cases speci ed in Proposition 30, there exist a position u 2 P , a substitution 0 , and a rule 0 ! 0 s.t. P includes M=u = ( )  ( ) = 0 ( 0 ) ! 0( 0 ) u= N=u. Then there must exist an E -overlapping pair in ( )  ( ) =  0 ( 0 ) ! 0 ( 0 ). This is contradiction. 

Lemma 31.



Assume that a TRS R is weakly compatible. Then

(i) If M = ( ) !  ( ) is an E -normal proof for some rule !  then M 62 NF (R). (ii) If N1 = N2 and N1 ; N2 2 NF (R), then N1  N2 .

2 R and a substitution ,

Proof Since R is weakly compatible, Theorem 28 implies that R is E -nonoverlapping. Assume that (i) of Lemma 31 holds, then Theorem 25 and Proposition 30 imply that if N1 = N2 and N1 6 N2 , then either N1 or N2 is not a normal form. Thus if (i) holds for 1(M ) < n, (ii) also holds for 1(N1 ); 1(N2 ) < n.

The proof of (i) is due to the induction on n = 1(M ). If n = 1, M must be a constant or a variable. Then M = ( ) implies M  ( ), and M is a redex. Let n > 1 and M = ( ) !   ( ) ) M = ( ) be an E-normal proof. Assume M 2 NF (R). Thus M 6 ( ) and according to Proposition 30 there are a position u 2 @ (M = ( )), a substitution , and a rule 0 ! 0 2 R s.t. M = ( ) ! ( ) has one of the following forms: ( (1) M = M [u ( 0 )] ! M [u  ( 0 )] =  ( ) ! ( ) u u (2) M = ( )[u ( 0 )] ( )[u ( 0)] = ( ) ! ( ) u

u



Form (1) satis es 1(M=u) < 1(M ), and M=u = ( 0) !  ( 0 ) is E -normal (because a sub proof of an E -normal proof is E -normal). Thus M=u 62 NF (R) from the induction hypothesis. This implies M 62 NF (R). Let us divide Form (2) into two cases: (a) u 2 posF ( ) and (b) u 62 posF ( ). (a) Since u 2 posF ( ), (( )[u ( 0 )]; ( )) is an E -overlapping pair. Every E -normal proof in R is E -overlapping-pair-free. Thus this is a contradiction. (b) There exist a nonlinear variable x in and positions v1 ;v2 2 position( ; x) s.t. M=v1 6 M=v2 and M=v1 = M=v2. (Otherwise, M is a redex for ! .) If M 2 NF (R), then M=v1 ; M=v2 2 NF (R) and applying the induction hypothesis to (ii) shows M=v1  M=v2 . This is a contradiction. Thus M 62 NF (R).

Theorem 32. Corollary 33.

If a TRS Let

R

R

be a weakly compatible TRS. If

then an associated equality system

Acknowledgments

R R

is weakly compatible, then

E

is

UN.

has at least two distinct normal forms,

is consistent.

I thank Dr. Yoshihito Toyama (NTT Communication Science Lab.), Dr. Aart Middeldorp (Hitachi Advanced Research Lab.), and Professor Michio Oyamaguchi (Mie Univ.) for valuable comments and discussions. I also thank my supervisor Hirofumi Katsuno for his careful reading, Professor Touru Naoi (Gifu Univ.) for informing me of references, and Dr. Satoshi Ono (NTT Software Lab.) for suggestions.

References

1. J.van Leeuwen (eds.), \Handbook of Theoretical Computer Science, Vol.B Formal models and Semantics", The MIT Press/Elservier (1990) 2. L.Bachmair, \Canonical Equational Proofs," Birkhauser (1991) 3. J.W.Klop, \Combinatory Reduction Systems", Mathematical Centre Tracts 127, CWI Amsterdam (1980) 4. D.S.Johnson (eds.), \STOC/FOCS Bibliography (Preliminary version)", ACM SIGACT (1991) 5. Barendregt,H.P., M.C.J.D.Eekelen, J.R.W.Glauert, J.R.Kennaway, M.J.Pasmeijer, and M.R.Sleep, "Term Graph Rewriting", Proc. Parallel Architectures and Languages Europe Vol.2, pp.141-158, Springer LNCS 259 (1987) 6. J.A.Bergstra,and J.W.Klop, \Conditional Rewrite Rules : Con uence and Termination," Journal of Computer and System Science, Vol.32, pp.323-362 (1986) 7. P.Chew, \Unique Normal Forms in Term Rewriting Systems with Repeated Variables",Proc. the 13th ACM Sympo. on Theory of Computing, pp.7-18 (1981) 8. P.L.Curien,and G.Ghelli, \On Con uence for Weakly Normalizing Systems," Proc. the 4th Int. Conf. on Reduction Techniques and Applications, pp.215-225, Springer LNCS 488 (1991) 9. N.Dershowitz,and M.Okada, \Proof-theoretic techniques for term rewriting theory," Proc. the 3rd IEEE Sympo. on Logic in Computer Science, pp.104-111 (1988) 10. N.Dershowitz, and Z.Manna, \Proving Termination with Multiset Orderings," Comm. of the ACM, Vol.22, No.8, pp.465-476 (1979) 11. G.Huet, \Con uent reductions : Abstract properties and applications to term rewriting systems", Journal of the ACM, Vol.27,No.4, pp.797-821 (1980) 12. J.W.Klop, and R.C.de Vrijer, \Unique normal forms for lambda calculus with surjective pairing," Information and Computation, Vol.80, pp.97-113 (1989) 13. B.K.Rosen, \Tree-manipulating systems and Church-Rosser theorems", Journal of the ACM, Vol.20, No.1, pp.160-187 (1973) 14. R.C.de Vrijer, \Extending the Lambda Calculus with Surjective Pairing is Conservative," Proc. the 4th IEEE Sympo. on Logic in Computer Science, pp.204-215 (1989) 15. R.C.de Vrijer, \Unique Normal Forms for Combinatory Logic with Parallel Conditional, a case study in conditional rewriting," Technical Report, Free University, Amsterdam (1990) 16. M.Ogawa,and S.Ono,\On the uniquely converging property of nonlinear term rewriting systems," IEICE Technical Report COMP89-7, pp.61-70 (1989) 17. M.Oyamaguchi, Private Communications (April 1992)