Undecidability of the Equivalence of Finite Substitutions ... - CiteSeerX

2 downloads 0 Views 197KB Size Report
TUCS - Turku Centre for Computer Science,. Department of Mathematics, University of Turku,. FIN-20014 Turku, Finland. E-mail: vehalava@utu.fi. Tero Harju.
Undecidability of the Equivalence of Finite Substitutions on Regular Language

Vesa Halava

TUCS - Turku Centre for Computer Science, Department of Mathematics, University of Turku, FIN-20014 Turku, Finland. E-mail: vehalava@utu.

Tero Harju

Department of Mathematics, University of Turku, FIN-20014 Turku, Finland. E-mail: harju@utu.

Turku Centre for Computer Science TUCS Technical Report No 160 February 1998 ISBN 952-12-0157-6 ISSN 1239-1891

Abstract A simplied proof is given for the following result due to L. Lisovik: It is undecidable for two given "free nite substitutions, whether they are equivalent on the regular language bf0; 1gc.

Keywords: nite substitution, integer weighted nite automaton, equivalence problem, undecidability

TUCS Research Group

Theory Group: Mathematical Structures in Computer Science

1 Introduction We give a simplied proof for the result due to L. Lisovik [4]. We also present an undecidability result considering whether a periodic morphism is included in nite substitution on regular language. Let  and  be two nite alphabets and denote by " the empty word.     A mapping ' :  ! 2 , where 2 denotes the power set of , is called substitution if 1. '(") = f"g and 2. '(xy) = '(x)'(y) for all x and y in . These conditions mean that a substitution is a monoid morphism from    into 2 . A substitution ' is called "free if " 2= '(a) for all a 2 , and nite if, for all a 2 , the set '(a) is a nite subset of  . Let L   be a language. Two substitutions ';  :  ! 2 are equivalent on L if for all w 2 L, '(w) =  (w). We shall concentrate on "free nite substitutions and prove that the equivalence of two such substitutions on the regular language bf0; 1gc is undecidable. The undecidability of the equivalence problem is not trivial, since it is known that there are decidable special cases. For example, for nite prex substitutions the equivalence problem on regular language is known to be decidable, see Karhumäki [2]. This follows from the fact that the monoid of all prex codes is free and from the pumping property of regular languages. There also exists some other undecidability results on "free nite substitutions, see Turakainen [5]. In the undecidability proofs we use the undecidability of the universe problem for the integer weighted nite automata. Consider a (nondeterministic) nite automaton A = (Q; ; ; q0 ) without nal states with the states Q, the alphabet , the transition function  : Q   ! 2Q, and the initial state q0 . A transition p 2 (q; a), where q; p 2 Q and a 2 , will also be written as (q; a; p) (in which case   Q    Q is regarded as a relation and sometimes also as an alphabet). Note that we allow only transitions that read a single letter. Let (Z; +; 0) be the additive group of integers. An integer weighted nite automaton A consists of a nite automaton A as above, and a weight function :  ! Z of the transitions. To simplify the notation, we will write (p; (t)) 2 (q; a) 1

for each transition t = (q; a; p) 2 . Let  = t0 t1 : : : tn be a path of A, where ti = (qi; ai; qi+1) for 0  i  n ? 1. Dene a morphism k  k :  !  by setting k(q; a; p)k = a. The weight of the path  is the element

() = (t0) + (t1) +    + (tn) : Further, we let L(A ) = k ?1 (0)k, that is L(A ) = fw 2  j w = kk; () = 0g ; be the language accepted by A . In other words, a word w 2  is accepted by A if there is a path t reading w and having the weight 0. An integer weighted nite automata is denoted by FA(Z). Next lemma is from [1]. Lemma 1.1. The universe problem, asking whether L(A ) is the universal language  , is undecidable. Actually, in [1] it was proved that the universe problem is undecidable for a rather restricted type of 4-state integer weighted nite automata. We note that the model of nite automata dened above is closely related to the counter automata. In our model the counter is replaced by a weight function of the transitions, and while doing so, the nite automaton becomes independent of the counter. The next corollary follows from Lemma 1.1. We shall use it in the proof of the main result. Corollary 1.2. The universe problem is undecidable for an FA(Z) over binary alphabet. Proof. We shall construct an FA(Z) B over a binary alphabet fa; bg from A over an alphabet  such that L(B ) = fa; bg if and only if L(A ) = . First we encode the alphabet  = fa1 ; : : : ; ang to a binary alphabet. One such encoding is provided by (ai ) = aib for ai 2 A. Each transition in A is divided in a way that, for all q 2 Q, we have new states q1; q2; : : : ; qn and a transition function 0 of B is dened so that  0(q; a) = f(q1; 0)g, 0 (qk ; a) = (qk+1; 0) for 1  k  n ? 1, and, for all 1  i  n, 0(qi; b) = f(p; z) j (p; z) 2 (q; ai)g. Clearly B accepts a word w 2 (A) if and only if w is accepted in A . Finally, we add a part that accepts the words in the regular language fa; bg n (). Clearly each regular language is accepted by an FA(Z) and FA(Z) languages are closed under union. 2

2 A special inclusion problem In this section we prove the undecidability of a special inclusion problem. Fix alphabets A = fb; 0; 1; cg and B = fa; bg. Let h : A+ ! B + be a periodic non-erasing morphism, i.e. there exists w 2 B + such that h(u) 2 w+ for all u 2 A+. Theorem 2.1. Let h : A+ ! B + be a periodic morphism as above and  : A ! 2B be an "free nite substitution. It is undecidable, whether h(u) 2 (u) for all u 2 b f0; 1g c. Proof. Let A = (Q; f0; 1g; ; q1) be an FA(Z). We shall dene h and  such that h(u) 2 (u) for all u 2 bf0; 1gc if and only if L(A ) = f0; 1g. As usual we shall identify a singleton set fug with its sole member u. Let s = jQj + 1, for Q = fq1; : : : ; qs?1g, where q1 is the initial state of A . Further, let

r = j minfz j 9(p; z) 2 (q; x) for some p; q 2 Q; x 2 f0; 1ggj; i.e. r is the absolute value of the minimal weight of the transitions in A . We write hk; x; z; j i for (qj ; z) 2 (qk ; x). Dene w = asb;

N=

s[ ?1 k=1

ak b; and Tx =

[ hk;x;z;j i

as?k bwz+r aj ;

(2.1)

Here Tx encodes the rules of A . Dene

(b) = a; (c) = Nw; (x) = Tx; for x 2 f0; 1g, and

h(b) = w; h(c) = w; h(x) = wr+1: Let L = bf0; 1gc. Clearly, for all u 2 f0; 1g, h(buc) = w  wjuj(r+1)  w, and we shall prove that wjuj(r+1)+2 2 (buc) for u 2 f0; 1g if and only if u 2 L(A ). Let u = x1 : : : xm , xi 2 f0; 1g for 1  i  m, and v 2 (buc). We know that

v = a  as?k1 bwz1+r aj1  as?k2 bwz2+r aj2    as?km bwzm +r ajm  a`bw; for the sequence hki; xi; zi; ji i, 1  i  m. Assume that v 2 w+. Then necessarily k1 = 1, ki+1 = ji , for 1  i  m ? 1, and ` = s ? jm . This means that the sequence is a computation of u 3

in A starting from the initial state q1 and ending in the state qjm . It follows that P P v = w1+ mi=1(zi +r+1)+1 = w mi=1 zi+m(r+1)+2 : P Now v = wjuj(r+1)+2 if and only if mi=1 zi = 0. The latter condition is equivalent to saying that the sequence hki; xi; zi; ji i, 1  i  m, is an accepting computation of u in A . The claim follows from the undecidability of the universe problem of the FA(Z) A .

3 The equivalence problem In this section we shall prove that the equivalence problem of nite substitutions is undecidable for the regular language b f0; 1g c. The proof we present modies the proof of Lisovik [4]. In the original proof Lisovik used the undecidability of the reliability of defense systems, cf. [3]. The undecidability of the reliability of defense systems has a long proof using the undecidability of a special inclusion problem for nondeterministic nite transducers over alphabet f0; 1g  c , which also has a somewhat involved proof. We shall use the undecidability of the universe problem for nite integer weighted automata over a binary alphabet. This model of an automaton is simple and the undecidability proofs for it are elementary.

Theorem 3.1. The equivalence problem for "-free nite substitutions on the regular language bf0; 1g c is undecidable. Proof. Let A = (Q; f0; 1g; ; q1 ) be an FA(Z). We shall dene two nite substitutions ';  : fb; 0; 1; cg ! fa; bg such that ' and  are equivalent on bf0; 1gc if and only if L(A ) = f0; 1g. As in the proof of Theorem 2.1, let s = jQj + 1, for Q = fq1 ; : : : ; qs?1g, where q1 is the initial state of A , and r = j minfz j 9(p; z) 2 (q; x) for some p; q 2 Q; x 2 f0; 1ggj: We write hk; x; z; j i for (qj ; z) 2 (qk ; x), and dene w, N and Tx, for x 2 f0; 1g, as in (2.1). Further, for x 2 f0; 1g, dene

Cx =

[

hk;x;z;j i

as?k bwz+r+1:

4

Finally we dene the substitutions  and ',

 (b) = a [ wN;  (c) = (" [ N )w;  (x) = wr+1 [ (" [ N )(Tx [ CxN ); for x 2 f0; 1g, and

'(b) =  (b) [ w; '(c) =  (c); '(x) =  (x): Let L = bf0; 1gc. Clearly  (v)  '(v) for all v 2 L, since  (x)  '(x) for all letters x 2 fb; 0; 1; cg. Therefore to prove that the equivalence of  and ' is undecidable, we need to show that '(v)   (v) for all v 2 L if and only if L(A ) = f0; 1g. Assume rst that L(A ) 6= f0; 1g. Let u 2 f0; 1g, u 2= L(A ), and assume that h and  are as in the proof of Theorem 2.1. Clearly h(buc) 2 '(buc) and (buc)   (buc), and by the proof of Theorem 2.1, and the form of N , h(buc) 2  (buc) if and only if u 2 L(A ). By our assumption, h(buc) = wjuj(r+1)+2 6=  (buc). It follows that if L(A ) 6= f0; 1g, then '(x) 6=  (x) for some x 2 bf0; 1gc. Assume next that L(A ) = f0; 1g and let x = x0 : : : xn+1 2 L, u = u0 : : : un+1, where xi 2 fb; 0; 1; cg and ui 2 '(xi) for all 0  i  n + 1. Note that x0 = b and xn+1 = c. We have to show that there exists vi 2  (xi) for all 0  i  n + 1 such that v0 : : : vn+1 = u. First, we note that the only dierence in the images of  and ' is in the image of b, and  (b) n '(b) = w. If u0 6= w, then we have a trivial solution ui = vi for all 0  i  n + 1. Therefore we assume that u0 = w. We shall use parenthesis to illustrate the factorizations by ' and  to ui's and vi's, respectively. We divide our consideration into three cases: (i) If n = 0, then x = bc and we have two subcases: (1) If u1 = w 2 '(c), then u0u1 = (w)(w) = (a)(as?1bw) 2  (x). (2) If u1 2 Nw  '(c), i.e. for some 1  k  s ? 1, u0u1 = (w)(as?k bw) = (was?k b)(w) 2  (x). (ii) If n  1 and u1 6= wr+1, then we show that there is a factorization such that ui = vi for 2  i  n + 1 and u0u1 = v0 v1. For this, there are four subcases: (1) If u1 2 Tx1 then, for hk; x1; z; j i,

u0u1 = (w)(as?kbwz+r aj ) = (a)(as?1bas?k bwz+r aj ) = v0v1 2 a  NTx1 : 5

(2) If u1 2 NTx1 then, for hk; x1 ; z; j i and 1  `  s ? 1,

u0u1 = (w)(as?`bas?k bwz+r aj ) = (was?`b)(as?k bwz+r aj ) = v0 v1 2 wN  Tx1 : (3) If u1 2 Cx1 N then, for hk; x1; z; j i and 1  `  s ? 1,

u0u1 = (w)(as?k bwz+r+1as?`b) = (a)(as?1bas?k bwz+r+1as?`b) = v0 v1 2 a  NCx1 N: (4) If u1 2 NCx1 N then, for hk; x1 ; z; j i and 1  `; t  s ? 1,

u0u1 = (w)(as?`bas?k bwz+r+1as?t b) = (was?`b)(as?k bwz+r+1as?t b) = v0 v1 2 wN  Cx1 N: (iii) If n  1 and u1 = wr+1 then we need the fact that L(A ) = f0; 1g. Let t = minfi j i  1; ui 2= B g. Now u0u1 : : : ut?1 = w(wr+1)    (wr+1) = w(t?1)(r+1)+1 . By our assumption, for the sequence x0 = x1 : : : xt?1 2 f0; 1g, we have transitions (qji ; zi) 2 (qji?1 ; xi ); i = f1; : : : ; t ? 1g ; in A , where 1  ji  s ? 1 and j0 = 1, and t?1 X i=1

zi = 0;

(3.1)

since x0 2 L(A ). Therefore there exists

vi0 = as?ji?1 bwzi+r aji 2 Txi ; for 1  i  t ? 1, and by setting v0 = a, we get

v0 v10 : : : vt0?1 = aas?1 bwz1+r aj1 as?j1 bwz2 +r aj2 : : : as?jt?2 bwzt?1+r ajt?1 = wwz1+r wwz2+r w : : : wwzt?1+r ajt?1 : By (3.1)

v0v10 : : : vt0?1 = w(t?1)r+(t?1) ajt?1 = w(t?1)(r+1) ajt?1 ; and therefore u0u1 : : : ut?1 = v00 v10 : : : vt0?1 as?jt?1 b. We may already assume that vi = vi0 for 1  i  t ? 2. Now there are two cases depending on t. First if t = n + 1 then we have two subcases: 6

(1) If un+1 = w then vt?1 = vt0?1 and vn+1 = as?jt?1 bw 2 Nw 2  (c) and we get that u = v. (2) If un+1 = as?k bw 2 Nw, for some 1  k  s ? 1, then set vt?1 = vn = as?jt?2 bwzt?1+r+1as?k b 2 Cxn N and vn+1 = w: This yields that u = v. The second case is that t  n. Then set vi = ui for t + 1  i  n + 1 and there are four subcases for vt?1 and vt depending on ut: (1) If ut = as?k bwz+r aj 2 Txt , for some hk; x; z; j i, then set vt?1 = vt0?1 and vt = as?jt?1 bas?k bwz+r aj 2 NTxt ; to obtain u = v. (2) If ut = as?`bas?k bwz+r aj 2 NTxt , for some hk; x; z; j i and 1  `  s ? 1, then set vt?1 = as?jt?2 bwzt?1+r ajt?1 as?jt?1 bas?` b = as?jt?2 bwzt?1+r+1as?`b 2 Cxt N and vt = as?k bwz+r aj 2 Txt ; to obtain u = v. (3) If ut = as?k bwz+r+1as?`b 2 Cxt N , for some hk; x; z; j i and 1  `  s ? 1, then set vt?1 = vt0?1 and vt = as?jt?1 bas?k bwz+r+1as?`b 2 NCxt N; to obtain u = v. (4) If ut = as?`bas?k bwz+r+1as?hb 2 NCxt N , for some hk; x; z; j i and 1  `; h  s ? 1, then set vt?1 = as?jt?2 bwzt?1+r ajt?1 as?jt?1 bas?` = as?jt?2 bwzt?1+r+1as?`b 2 Cxt N and vt = as?k bwz+r+1as?hb 2 Cxt N; to obtain u = v. We have proved that if L(A ) = f0; 1g then '(L)   (L). The undecidability follows from the undecidability of the universe problem for FA(Z) over a binary alphabet, Corollary 1.2. In the previous proof we actually proved that it is undecidable, whether the inclusion '(x)   (x); holds for all word x 2  . This also follows from Theorem 3.1. 7

References [1] V. Halava and T. Harju, Undecidability in integer weighted nite automata, Tech. Report 158, Turku Centre for Computer Science, January 1998. [2] J. Karhumäki, Equations over nite sets of words and equivalence problems in automata theory, Theoret. Comput. Sci. 108 (1993), no. 1, 103 118. [3] L. P. Lisovik, An undecidable problem for countable Markov chains, Kibernetika (1991), no. 2, 16. [4] , Nondeterministic systems and nite substitutions on regular language, Bulletin of the EATCS, no. 63, October 1997, pp. 156160. [5] P. Turakainen, The undecidability of some equivalence problems concerning ngsm's and nite substitutions, Theoret. Comput. Sci. 174 (1997), no. 1-2, 269274.

8

Turku Centre for Computer Science Lemminkäisenkatu 14 FIN-20520 Turku Finland http://www.tucs.abo.

University of Turku  Department of Mathematical Sciences

Åbo Akademi University  Department of Computer Science  Institute for Advanced Management Systems Research

Turku School of Economics and Business Administration  Institute of Information Systems Science