The reachability and related decision problems for monadic and semi-constructor TRSs

The reachability and related decision problems for monadic and semi-constructor TRSs

Information Processing Letters 98 (2006) 219–224 www.elsevier.com/locate/ipl The reachability and related decision problems for monadic and semi-cons...

136KB Sizes 0 Downloads 11 Views

Information Processing Letters 98 (2006) 219–224 www.elsevier.com/locate/ipl

The reachability and related decision problems for monadic and semi-constructor TRSs Ichiro Mitsuhashi ∗ , Michio Oyamaguchi, Toshiyuki Yamada Faculty of Engineering, Mie University, 1577 Kurimamachiya-cho, Tsu-shi 514-0102, Japan Received 8 April 2004; received in revised form 31 August 2005 Available online 30 March 2006 Communicated by L. Boasson

Abstract This paper shows that reachability is undecidable for confluent monadic and semi-constructor TRSs, and that joinability and confluence are undecidable for monadic and semi-constructor TRSs. Here, a TRS is monadic if the height of the right-hand side of each rewrite rule is at most 1, and is semi-constructor if all defined symbols appearing in the right-hand side of each rewrite rule occur only in its ground subterms. © 2006 Elsevier B.V. All rights reserved. Keywords: Theory of computation; Term rewriting systems

1. Introduction In this paper, we consider the reachability problem for confluent monadic and semi-constructor term rewriting systems (TRSs). Here, a TRS is monadic if the height of the right-hand side of each rewrite rule is at most 1, and semi-constructor if all defined symbols appearing in the right-hand side of each rewrite rule occur only in its ground subterms. The class of semi-constructor TRSs was introduced in [5] in order to explore the border between decidable and undecidable classes of unification and fundamental decision problems. This class is a minimal subclass of non-rightlinear TRSs which includes right-(ground or variable) TRSs. In [5,3], joinability and unification for confluent * Corresponding author.

E-mail address: [email protected] (I. Mitsuhashi). 0020-0190/$ – see front matter © 2006 Elsevier B.V. All rights reserved. doi:10.1016/j.ipl.2006.02.014

semi-constructor TRSs have been shown to be decidable. This extends the decidability results of joinability and unification for confluent right-(ground or variable) TRSs in [4], and it is striking in the sense that few decidability results on TRSs which may be non-rightlinear and non-terminating were known so far. This decidability result of unification is also striking compared with undecidability of unification for confluent, terminating, linear, and monadic TRSs [4]. On the other hand, reachability for confluent semiconstructor TRSs remained open in [5]. We give a negative answer to this problem in this paper. This undecidability result is interesting since no subclasses of TRSs with the undecidable reachability but decidable joinability problems have been known so far. Moreover, we show that joinability and confluence are undecidable for monadic and semi-constructor TRSs.

220

I. Mitsuhashi et al. / Information Processing Letters 98 (2006) 219–224

2. Preliminaries

tem if only the root symbol is a defined symbol for the left-hand side of each rewrite rule.

We assume that the reader is familiar with standard definitions of rewrite systems [1] and we just recall here the main notations used in this paper. Let F be a finite set of operation symbols graded by an arity function ar : F → {0, 1, 2, . . .}, Fn = {f ∈ F | ar(f ) = n}. We use x, y as variables, f as an operation symbol, r, s, t as terms. Let V(s) be the set of variables occurring in s. The height of a term is defined as follows: height(a) = 0 if a is a variable or a constant and height(f (t1 , . . . , tn )) = 1 + max{height(t1 ), . . . , height(tn )} if n > 0. The root symbol of a term is defined as root(a) = a if a is a variable and root(f (t1 , . . . , tn )) = f . A position in a term is expressed by a sequence of positive integers, and positions are partially ordered by the prefix ordering . Let s|p be the subterm of s at position p. For a string of unary function symbols u = a1 a2 . . . ak and a term t, let u(t) be an abbreviation for a1 (a2 (. . . ak (t))). A rewrite rule α → β is a directed equation over terms. A TRS R is a set of rewrite rules. Let ← be the inverse of →, ↔ = → ∪ ←, and ↓ = →∗ · ←∗ . t is reachable from s if s →∗ t. r is confluent on TRS R if s ←∗R r →∗R t implies s ↓ t, denoted confR (r). If R is clear from the context, we can omit it. A TRS R is confluent if all terms are confluent on R. Let p1

pn−1

γ : s1 ←→ s2 . . . sn−1 ←→ sn be a rewrite sequence. Here, pi is the redex position of si ↔ si+1 for every i ∈ {1, . . . , n − 1}. This sequence is abbreviated to γ : s1 ↔∗ sn . Let |γ | = n. γ is called pinvariant if q > p for any redex position q of γ , and we write p -inv ∗

γ : s1 ←→ sn . The set DR of defined symbols for a TRS R is defined as DR = {root(α) | α → β ∈ R}. A term s is semiconstructor if every subterm t of s satisfying root(t) ∈ DR has no variable. Definition 1. A rule α → β is monadic if height(β)  1, and is semi-constructor if β is semi-constructor. A TRS R is monadic if every rule in R is monadic, and is semiconstructor if every rule in R is semi-constructor. For example, {nand(x, x) → not(and(x, x)), nand(not(x), x) → t, t → nand(f, f), f → nand(t, t)} is a semi-constructor TRSs. Note that semi-constructor TRSs are different from constructor systems. Here, a TRS is a constructor sys-

3. Undecidability of joinability for monadic and semi-constructor TRSs We have shown that joinability is undecidable for linear semi-constructor TRSs [5]. In this section, we show that joinability and reachability for monadic and semi-constructor TRSs is undecidable by a reduction from the Post’s Correspondence Problem (PCP). Let P = { ui , vi ∈ Σ + × Σ + | 1  i  n} be an instance of the PCP. The corresponding TRS RP is constructed as follows. Let F = F0 ∪ F1 ∪ F2 where F0 = {0, c, d, $}, F1 = {ei | 1  i  n}(= E) ∪ Σ , F2 = {f, g}.     RP = 0 → ei (0) | 1  i  n ∪ 0 → f(c, d)   ∪ b → a(b), b → a($) | b ∈ {c, d}, a ∈ Σ   ∪ f(x, x) → g(x, x)      ∪ ei g ui (x), vi (y) → g(x, y) | 1  i  n , RP is monadic. Here, DRP = {0, c, d, f} ∪ E, so RP is semi-constructor. Lemma 2. 0 →∗RP g($, $) iff PCP P has a solution. Proof. Only if part: If 0 →∗RP g($, $) then there exist sequences a1 . . . ak ∈ Σ + and w ∈ E + such that   γ : 0 →+ w f(c, d)   →2k+2 w f a1 . . . ak ($), a1 . . . ak ($)    → w g a1 . . . ak ($), a1 . . . ak ($) →+ g($, $), where a1 . . . ak = ui1 . . . uim = vi1 . . . vim and w = eim . . . ei1 for some sequence of indexes i1 . . . im ∈ {1, . . . , n}+ . Thus, P has a solution. If part: If P has a solution i1 . . . im ∈ {1, . . . , n}+ then a sequence such as the above γ exists. Thus, 0 →∗RP g($, $). 2 Since g($, $) is a normal form, the following theorem holds. Theorem 3. Both joinability and reachability for monadic and semi-constructor TRSs are undecidable. 4. Undecidability of reachability for confluent monadic and semi-constructor TRSs We give a stronger result for reachability, that is, reachability for confluent monadic and semi-constructor

I. Mitsuhashi et al. / Information Processing Letters 98 (2006) 219–224

TRSs is undecidable. Note that joinability is decidable for the same class [5,3]. Let Fˆ = F ∪ {1}.   Rˆ P = RP ∪ {$ → 1} ∪ a(1) → 1 | a ∈ Σ     ∪ ei g 1, vi (y) → g(1, y),    ei g ui (x), 1 → g(x, 1),    ei g(1, 1) → g(1, 1) | 1  i  n , Rˆ P is monadic. Here, DRˆ P = DRP ∪ {$} ∪ Σ, so Rˆ P is semi-constructor. First, we show the confluence of Rˆ P . 4.1. Confluence of Rˆ P To show the confluence of Rˆ P , we need some definitions and lemmata. Definition 4. The set of Σ-strings is defined as follows. • 1, c, d and $ are Σ -strings. • a(t) is a Σ-string if a ∈ Σ and t is a Σ -string. In Section 4.1, → means →Rˆ P . Lemma 5. For any Σ-string s, the following properties hold. (1) For any s ↔∗ t, t is a Σ-string. (2) s →∗ 1. p

Proof. (1) It suffices to show that for any s ↔ t, t is a Σ-string. Let s = a1 . . . a|p| (s ) and t = a1 . . . a|p| (t ) ε where s ↔ t , a1 . . . a|p| ∈ Σ ∗ , and s is a Σ -string. If root(s ) ∈ / Σ then t ∈ {b, a(b) | a ∈ Σ, b ∈ {1, c, d, $}}. If root(s ) ∈ Σ then t ∈ {1, c, d}. In either case, t is a Σ-string. (2) By induction on the structure of s. 2 Corollary 6. Every Σ -string is confluent on Rˆ P . Lemma 7. Let γ : u(s) →∗ t where u ∈ Σ + . Then, if

root(s) ∈ / {1, c, d, $} ∪ Σ and u(s)|p1 = s then γ is p-in-

variant. Proof. By induction on |γ |.

2

Definition 8. The set of E-strings is defined as follows. • 0, f(t1 , t2 ) and g(t1 , t2 ) are E-strings if t1 , t2 are Σ -strings. • ei (t) is an E-string if t is an E-string and i ∈ {1, . . . , n}.

221

Lemma 9. For any E-string s, the following properties hold. (1) For any s ↔∗ t, t is an E-string. (2) s →∗ g(1, 1). p

Proof. (1) It suffices to show that for any s ↔ t, t is an E-string. Let s = e1 . . . e|p| (s ) and t = a1 . . . e|p| (t ) ε where s ↔ t , e1 . . . e|p| ∈ E ∗ , and s is an E-string. If root(s ) ∈ / E then t ∈ {ei (0), f(t1 , t2 ), g(t1 , t2 ), ei (g(t1 , t2 )) | i ∈ {1, . . . , n}, t1 , t2 are Σ-strings}. If root(s ) ∈ E then t = g(t1 , t2 ) for some Σ -strings t1 , t2 . In either case, t is an E-strings. (2) By induction on the structure of s. Basis: For any Σ -strings s1 , s2 , f(s1 , s2 ) →∗ f(1, 1) → g(1, 1) and g(s1 , s2 ) →∗ g(1, 1) by Lemma 5(2), and 0 → f(c, d) →∗ g(1, 1). Thus, s →∗ g(1, 1) if s = f(s1 , s2 ), g(s1 , s2 ) or 0. Induction step: Let s = ei (s ) for some i ∈ {1, . . . , n} and E-string s . By the induction hypothesis, ei (s ) →∗ ei (g(1, 1)) → g(1, 1). 2 Corollary 10. Every E-string is confluent on Rˆ P . The following lemma is used as a component of the proof of Lemma 12. Lemma 11. For any i ∈ {1, . . . , n} and terms r1 , r2 , the following properties hold. ε

ε -inv

(1) If s ← ei (g(r1 , r2 )) −→∗ ei (t) then there exist terms t1 , t2 such that ei (t) →∗ g(t1 , t2 ). (2) If g(s1 , s2 ) ←∗ ei (g(r1 , r2 )) →∗ g(t1 , t2 ) and g(r1 , r2 ) is confluent then g(s1 , s2 ) ↓ g(t1 , t2 ). Proof. (1) Let s = g(s1 , s2 ) and t = g(t1 , t2 ). Case: r1 , r2 are Σ -strings. By Lemma 5, t1 →∗ 1 and t2 →∗ 1, so ei (g(t1 , t2 )) → g(1, 1). Case: r1 is a Σ -string and r2 is not. By Lemma 5, ε t1 →∗ 1. By ei (g(r1 , r2 )) → g(s1 , s2 ), r2 = vi (s2 ). Since s2 is not a Σ -string, s2 = u(s ) where u ∈ Σ ∗ and s is not a Σ -string. By Lemma 7, t2 = vi (t2 ) where s2 →∗ t2 . Thus, ei (g(t1 , t2 )) → g(1, t2 ). Case: r2 is a Σ -string and r1 is not. By similar argument to the previous one, ei (g(t1 , t2 )) → g(t1 , 1) where s1 →∗ t1 . Case: r1 , r2 are non-Σ -strings. By similar argument to the previous one, ei (g(t1 , t2 )) → g(t1 , t2 ) where s1 →∗ t1 and s2 →∗ t2 . (2) By the definition of Rˆ P ,

222

I. Mitsuhashi et al. / Information Processing Letters 98 (2006) 219–224

 ε-inv







ei g(r1 , r2 ) −→∗ ei g(s1 , s2 ) → g(s1 , s2 ) ε -inv

−→∗ g(s1 , s2 ) and    ε-inv  ei g(r1 , r2 ) −→∗ ei g(t1 , t2 ) → g(t1 , t2 ) ε -inv

−→∗ g(t1 , t2 ). Thus, s1 ←∗ r1 →∗ t1 , s1 →∗ s1 and t1 →∗ t1 . First, we show that s1 ↓ t1 . Case of s1 = t1 = 1: Obviously, s1 = s1 = t1 = t1 = 1 . Case of s1 = 1 and t1 = ui (t1 ): Obviously, s1 = s1 = 1. By Lemma 5, t1 is a Σ-string. Since t1 = ui (t1 ), t1 is a Σ -string. By Lemma 5, t1 is a Σ -string and t1 →∗ 1, since t1 →∗ t1 . Case of s1 = ui (s1 ) and t1 = 1: Similar to the previous one. Case of s1 = ui (s1 ) and t1 = ui (t1 ): By confluence of g(r1 , r2 ), r1 is confluent. Thus, ui (s1 ) ↓ ui (t1 ). If s1 is a Σ-string then s1 ↓ t1 by Corollary 6. Otherwise, s1 ↓ t1 by Lemma 7. Similarly, s2 ↓ t2 . Thus, g(s1 , s2 ) ↓ g(t1 , t2 ). 2 Now, we show the confluence of Rˆ P .

Fig. 1. Proof of Lemma 12 (root(r) = f).

Lemma 12. Rˆ P is confluent. Proof. We show conf(r) by induction on the structure of r. Let γ : s ←∗ r →∗ t. Basis: If r ∈ {c, d, 1} then s ↓ t by Corollary 6, else if r = 0 then s ↓ t by Corollary 10. Otherwise, s = r = t since r is a normal form. Induction step: If γ is ε-invariant then s ↓ t by the induction hypothesis. So, we consider the case that γ has an ε-reduction. Let γs : r →∗ s and γt : r →∗ t. Without lost of generality, we assume that γs has an ε-reduction and root(r) ∈ Σ ∪ {f} ∪ E. ε -inv ∗

Case of root(r) ∈ Σ : γs : r = a(r1 ) −→ a(1) → 1 = s holds for some a ∈ Σ and r1 . By Lemma 5, t →∗ 1. ε -inv Case of root(r) = f: γs : r = f(r1 , r2 ) −→∗ f(r , r ) → ε -inv

g(r , r ) −→∗ g(s1 , s2 ) = s holds for some terms r1 , r2 , r , s1 , s2 . If γt is ε-invariant then t = f(t1 , t2 ) where r1 →∗ t1 and r2 →∗ t2 . In this case, s →∗ g(r0 , r0 ) ←∗ t

for some r0 by Fig. 1(i). If γt has an ε-reduction ε -inv

ε -inv

Case of root(r) ∈ E: γs : r = ei (r1 ) −→∗ ei (g(s1 , ε -inv

ε -inv

ε -inv

ei (g(s1 , s2 )) −→∗ ei (t ) ←−∗ t. By Lemma 11(1), ei (t ) →∗ g(t1 , t2 ) for some t1 , t2 . Here, g(s1 , s2 ) is confluent by the induction hypothesis and r1 →∗ g(s1 , s2 ). Thus, s ↓ g(t1 , t2 ) by Lemma 11(2). (See Fig. 2(i).) ε -inv

If γt has an ε-reduction then γt : r = ei (r1 ) −→∗ ε -inv

ei (g(t1 , t2 )) → g(t1 , t2 ) −→∗ g(t1 , t2 ) = t holds for

some terms t1 , t2 , t1 , t2 , t1 , t2 . There exists a term s such that s →∗ s ←∗ ei (g(t1 , t2 )) as shown in Fig. 2(i). Here, root(s ) = g by root(s) = g. By the induction hypothesis and r1 →∗ g(t1 , t2 ), g(t1 , t2 ) is confluent. Thus, s ↓ t by Lemma 11(ii). (See Fig. 2(ii).) 2 4.2. Reachability for confluent monadic and semi-constructor TRSs

ε -inv

then γt : r = f(r1 , r2 ) −→∗ f(r , r ) → g(r , r ) −→∗ g(t1 , t2 ) = t holds for some terms r , t1 , t2 . In this case, s →∗ g(r0 , r0 ) ←∗ t for some r0 by Fig. 1(ii). ε

is ε-invariant then t = ei (t1 ) where r1 →∗ t1 . By the induction hypothesis, there exists a term t such that

s2 )) → g(s1 , s2 ) −→∗ g(s1 , s2 ) = s holds for some terms r1 , s1 , s2 , s1 , s2 , s1 , s2 and i ∈ {1, . . . , n}. If γt

Lemma 13. For any γ : s →∗ˆ t, if s has 1 as its subRP term then so does t. Proof. Since for any α → β ∈ Rˆ P , V(α) = V(β) and if α has 1 as its subterm then so does β. 2

I. Mitsuhashi et al. / Information Processing Letters 98 (2006) 219–224

223

5. Undecidability of confluence of monadic and semi-constructor TRSs We show that confluence of monadic and semiconstructor TRSs is undecidable. Let F = F0 ∪ F1 where F0 = {2}, F1 = {h}.     R = h(x) → h(0), h g($, $) → 2 , Rˆ P ∪ R is monadic. Here, DR = {h}, so Rˆ P ∪ R is semiconstructor. Lemma 16. For any s with root(s) ∈ F , the following properties hold. (1) If s →Rˆ P ∪R t then root(t) ∈ F . (2) If 0 →∗RP g($, $) then s →∗RP ∪R 2. The proof is straightforward, so omitted. Definition 17. Let s[2] be the term obtained from s by replacing its each maximal subterm s (with respect to the subterm ordering1 ) that satisfies root(s ) ∈ F by 2. For example, f(h(2), e1 (x))[2] = f(2, e1 (x)). Fig. 2. Proof of Lemma 12 (root(r) ∈ E).

Lemma 14. 0 →∗ˆ g($, $) iff 0 →∗RP g($, $). RP

Proof. Only if part: Let γ : 0 →∗ˆ g($, $). We assume RP

to the contrary that γ must have Rˆ P \ RP reduction, i.e., γ : 0 →∗RP s →Rˆ P \RP t →∗ˆ g($, $) for some s, t. RP

By the definition of Rˆ P , t has 1 as its subterm. By Lemma 13, g($, $) has 1 as its subterm, a contradiction. If part: By RP ⊆ Rˆ P . 2

By Lemmata 2, 12, and 14, the following theorem holds. Theorem 15. Reachability for confluent monadic and semi-constructor TRSs is undecidable. This undecidability result is interesting since no subclasses of TRSs with the undecidable reachability but decidable joinability problems have been known so far. For almost classes of TRS, joinability and reachability problems are reducible each other [6], but the reducibility does not hold for confluent monadic and semi-constructor TRSs, because this reducibility technique does not preserve confluence of TRSs.

Lemma 18. Let s →Rˆ P ∪R t. Then, s[2] →Rˆ P t[2] or s[2] = t[2]. p

Proof. Let s →Rˆ P ∪R t. Let Os be the set of outermost positions q that satisfy root(s|q ) ∈ F , and Ot be that of t. If there exists q ∈ Os such that q  p then Os = Ot by Lemma 16(1). Thus, s[2] = t[2]. Otherwise, obviously s →Rˆ P t. Since every function symbol in F does not occur in Rˆ P , s[2] → ˆ t[2]. 2 RP

Lemma 19. Rˆ P ∪ R is confluent iff 0 →∗RP g($, $). Proof. Only if part: By h(0) ←Rˆ P h(g($, $)) →Rˆ P 2, confluence ensures that h(0) ↓Rˆ P ∪R 2. Since 2 is 2. Thus, there exists a normal form, h(0) →∗ˆ RP ∪R a shortest sequence γ that satisfies γ : h(0) →∗ˆ h(g($, $)) →R 2. Since γ is shortest, h(g($, $)). Thus, there exists γ : 0 →∗ˆ

RP ∪R ε -inv ∗ h(0) −→ ˆ RP ∪R

RP ∪R

g($, $). Ob-

viously, every function symbol occurring in γ belongs to Fˆ . Thus, 0 →∗ˆ g($, $). By Lemma 14, 0 →∗RP RP g($, $). 1 For any t and position p of t , t|  t . p

224

I. Mitsuhashi et al. / Information Processing Letters 98 (2006) 219–224

If part: Let s ←∗ˆ

RP ∪R

r →∗ˆ

RP ∪R

t. By Lemma 18,

s[2] ←∗ˆ r[2] →∗ˆ t[2]. Since Rˆ P is confluent by RP RP Lemma 12, s[2] ↓Rˆ P t[2]. By 0 →∗RP g($, $) and Lemma 16(2), both s →∗RP ∪R s[2] and t →∗RP ∪R t[2] hold. Thus, s ↓Rˆ P ∪R t. 2 By Lemmata 2 and 19, the following theorem holds. Theorem 20. Confluence of monadic and semi-constructor TRSs is undecidable. 6. Concluding remarks In this paper, we have shown that reachability is undecidable for confluent monadic and semi-constructor TRSs, and that joinability and confluence are undecidable for monadic and semi-constructor TRSs. Recently, as a related result, it has been reported that reachability, joinability and confluence are undecidable for flat TRSs [2]. Here, a TRS is flat if the heights of the leftand right-hand sides of each rewrite rule are at most 1. (Flat TRSs are monadic, but not semi-constructor.) However, we found that the proof for undecidability of confluence is incorrect; the corrected proof is expected.

Acknowledgements We would like to thank the anonymous referee of this paper for their helpful comments. This work was supported in part by Grant-in-Aid for Scientific Research Nos. 15500009 and 16700030 from Japan Society for the Promotion of Science and from Kayamori Foundation of Informational Science Advancement. References [1] F. Baader, T. Nipkow, Term Rewriting and All That, Cambridge University Press, Cambridge, 1998. [2] F. Jacquemard, Reachability and confluence are undecidable for flat term rewriting systems, Information Processing Letters 87 (2003) 265–270. [3] I. Mitsuhashi, M. Oyamaguchi, Y. Ohta, T. Yamada, The joinability and related decision problems for semi-constructor TRSs, submitted for publication. [4] I. Mitsuhashi, M. Oyamaguchi, Y. Ohta, T. Yamada, On the unification problem for confluent monadic term rewriting systems, IPSJ Transactions on Programming 44 (SIG 4 (PRO 17)) (2003) 54–66. [5] I. Mitsuhashi, M. Oyamaguchi, Y. Ohta, T. Yamada, The joinability and unification problems for confluent semi-constructor TRSs, in: Proc. 15th RTA, in: Lecture Notes in Comput. Sci., vol. 3091, Springer, Berlin, 2004, pp. 285–300. [6] R.M. Verma, M. Rusinowitch, D. Lugiez, Algorithms and reductions for rewriting problems, Fundamenta Informaticae 46 (3) (2001) 257–276.