On alternating ω-automata

On alternating ω-automata

JOURNAL OF COMPUTER AND SYSTEM SCIENCES 36, 16-24 (1988) On Alternating w-Automata PETER A. LINDSAY Computer Science Department, Manchester Man...

456KB Sizes 3 Downloads 87 Views

JOURNAL

OF COMPUTER

AND SYSTEM SCIENCES 36,

16-24 (1988)

On Alternating

w-Automata

PETER A. LINDSAY Computer

Science Department, Manchester Manchester Ml3 9PL, England

University,

Received September 11, 1985; revised May 6, 1986

Deterministic and nondeterministic automata on o-strings have been studied extensively under six different acceptance conditions. Miyano and Hayashi extended the study to alternating automata, but two of the conditions were not considered; the present paper completes the gap by showing that alternating o-automata accept precisely the w-regular languages under these conditions. 0 1988 Academic Press. Inc

1, INTRODUCTION

AND PRELIMINARIES

The investigation of o-languages (sets of infinite sequences of symbols chosen from a finite alphabet) has been going on for over a quarter of a century, and the results have proven to be slightly more subtle than those of finite string languages. The o-languages accepted by finite state automatadeterministic and nondeterministic-are now well understood; the notion of w-regular language turns out to be a natural and useful one (see [7] for a survey of results). Many different acceptance conditions have been proposed and an implicit agreement seems to have been reached that there are six natural conditions to study. The classes of o-languages accepted by alternating o-automata under four of these conditions were characterized in [3]; the present paper deals with the two remaining cases. Let ,Z be a finite alphabet with at least two elements. Denote by Z” the set of all infinite sequences over C. A subset L of 2” is called an w-language. Given a set S let P’(S) denote the set of nonempty subsets of S. DEFINITIONS. An alternating M = (Q, f, C, 6, qo, Y) where:

finite

state

automaton

(afa)

is a sextuple

1. Q is a finite set of states; 2. f is a mapping from Q to the set { IJ, fi}-states which map to U (resp. n) are sometimes called or-states (resp. and-states); 3. 6 is a transition function from Q x .Z to P’(Q); 4. q. is a state in Q called the initial state; and 5. F is a family of subsets of Q called the designated sets. 16 002ZOObO/88 $3.00 Copyright 0 1988 by Academic Press, Inc. All rights of reproducllon in any form reserved.

ALTERNATING

O-AUTOMATA

17

Given x = x0x1 x2... in P”, a computation tree T(M, x) of M on x is an infinite tree with nodes labelled from Q such that: 1. the root (at level 0) is labelled qO, and 2. if node v at level n is labelled u, then either: f(u) = n and v has a child labelled v for each v in 6(u, x,)-and no other children-or f(u) = u and v has a unique child, labelled v, for some v in 6(u, x,). l

l

An infinite path CI in T(M, x) beginning at the root is called a run in T(M, x), We define 1. Z(a) = {q: state q occurs in a infinitely often}, 2. O(a) = (q: state q occurs in a}. For an afa M as above, i between 1 and 6, and x in Z:“, we say M accepts x in the sense of Ci if there exists a computation tree T(M, x) satisfying the following condition on each of its runs a: a satisfies condition

Ci for some set F from Y,

where . Cl is Z(a)nF#@ l

l

l

l

l

C2 is C3 is C4 is C5 is C6 is

Z(a)s F O(a)nF#@ O(a)GF Z(a)= F O(a) = F.

Of course, these last two definitions are better stated as Z(a) E Y and O(a) E 5. The w-language accepted by M in the sense of Ci is denoted Li(M). A nondeterministic finite automaton (nfa) is an afa such that f(q) = U for all q in Q; thus its computation trees consist of a single infinite path each. A deterministic finite automaton (dfa) is an nfa whose transition function has only singleton sets as values; thus on each input x from Z” it has a unique computation tree, and this tree is actually a single infinite path. These definitions are clearly equivalent to the usual ones (cf. [7]). For i = 1, .... 6 we define 1. Ai= {Li(M): 2. Ni = {Li(M): 3. Di = {Li(M):

M is an afa}, M is an nfa}, M is an dfa}.

An w-language L is w-regular iff L is a finite union of o-languages of the form U. V” with U and V regular. Let 93 denote the class of w-regular languages. In this

18

PETER

A. LINDSAY TABLE

Summary

i

12

Di Ni Ai

Gb R R

I of Results

3

4

5

F;

G’

F’

R

F;

G'

R

G’

F' F'

R '%

6 GbnF; 6 9z

notation, an early result of Biichi’s is that Nl = ‘R Muller proposed that D5 = % and McNaughton later provided the proof. Complete characterizations-both topologically and in set-representative terms-of the classes Di and Ni for each value of i are given in [7], together with bibliographic references. The classes Ai for i=l , .... 4 are characterized in [3], to which the reader is referred for proofs. We prove below that A5 = A6 = ‘R The results are summarized in Table I. In Table I, G’, F, Gk, and F0 denote the classes of w-regular open, closed, Ggand FO-sets, respectively, in the usual product topology on C” (see [7] for details). Of course, there are open o-languages which are not w-regular: for example, (O”lO”0: nEw, 0ECW).

2. A5=%

In this section we prove that the o-languages accepted by afa’s in the sense of C5 are w-regular, using Gurevich and Harrington’s “forgetful determinacy” result (Theorem 5 of Cl]). This characterizes the class A5 since, from above, !R=D~GA~. Let M = (Q, f, X’, 6, qO, F)

be an arbitrary afa. We shall give an alternative definition of acceptance in game-theoretic terms so that we can use the results from [ 11. Given x = x0x1 ... from P’, let T(M, x) be the following infinite game of perfect information for two players, called Mr 0 and Mr 1, who between them decide the run of M on x. As usual, M starts in state qO scanning symbol x,,. Suppose that after n moves M is in state qn scanning symbol x,: the next state is from 6(q,, x,) and is chosen by Mr 0 if f(q,) = lJ, and by Mr 1 if f(q,) = n. (In particular, Mr 0 might be called the nondeterministic player.) A play of T(M, x) is an infinite sequence of moves, and thus corresponds to a run of M, say a E Q”. We say that Mr 0 wins play a iff Z(a) E Y. Clearly computation trees correspond to strategies for Mr 0, and vice versa, so M accepts x in the sense of C5 iff Mr 0 has a winning strategy in T(M, x).

For the next part we assume that the reader has a copy of Cl] in front of him/her open to Section 3; we use their notation freely. Let MOVE = Q, and let A be the arena induced by T’(M, x) in the following sense: A is a subtree of Q* without

ALTERNATING

19

W-AUTOMATA

leaves. The root of A is the empty string E. Suppose p is a position of length 2n in A, with last symbol u (or if p = E let u = qO); then either 1. f(u) = u, p’s children are pv for each v in &II, x,) and each pv has a single child pvv, or 2. f(u) = 0, p has a single child pu, and pu’s children are puv for each v in &u, x,). This unusual definition includes a trick to ensure that Mr 0 makes all the even moves and Mr 1 makes all the odd moves in A. There is an obvious one-one correspondence between the plays of T(M, x) and the infinite paths in A. In the notation of [ 11, the alphabet S of Theorem 5 is Q, and for SEQ: c” = {positions p in A with last symbol s}. When s = qO the empty string E is added to c”. Now T(M, x) is a game (A, 0, W) in the form required for “forgetful determinancy,” where W is a boolean combination of the sets [Cs] = {paths in A which hit c” infinitely often} W is defined from F in the obvious way. The later appearance record (LAR) for position p, denoted LAR(p), lists the states (once each) visited along the path from E to p, with the most recently seen states rightmost. For example, LAR(abcadcac) = bdac. Several observations can be made at this point: 1. p and LAR(p) always agree on their last symbol, 2. the initial state qO appears in every LAR for A, 3. by construction, the correspondence between even positions in A and positions in T(M, x) preserves LARs. We denote by B the set of all LARs containing qo. If Q has n elements, then B has l+

f

k(n-

l)(n-2)..*(n-k+

1)

k=2

elements; in particular, n! < [El < (n + l)!. We are now ready to apply “forgetful determinancy” to prove that one of the players has a very uniform winning strategy, so uniform in fact that it can be simulated by a finite state automaton. More accurately, one of the players has a winning strategy which respects a certain equivalence relation (see [ 1 ] for details); such a strategy also respects the finer equivalence relation p = ((p, p’): p and p’ are positions in A having the same length and LAR(p) = LAR(p’)}.

20

PETER A. LINDSAY

The rest of the proof involves the construction in two stages of an nfa N which accepts L5(M) in the sense of C5. The first stage makes use of the nondeterminism to “guess” a strategy 4 for Mr 0 respecting p. The idea is to have a nondeterministic finite state o-transducer N’ move along the input x, outputting the LARs of “all” the branches of the computation tree T(M, x) corresponding to 4. It deals with the unbounded number of branches of T(M, x) by superimposing those nodes at the same level whose LARs agree, since only the LAR and not the complete history of the path is relevant to Mr O’s strategy. It is also necessary to keep track of the transitions between LARs involved in moving from one level in the tree to the next, so that the existence of losing plays is revealed. Let the output alphabet for N’ be P”(B x B), hereafter denoted A, and let its stateset be PO(B), where B is defined above. The technical details of the construction of N’ are straightforward but messy, and are left to the dedicated reader. Hopefully the following example will be sufficient explanation. EXAMPLE

1. 2. 3. 4. 5.

1.

Let M = (Q, f, C, 6, qo, F) where:

Q= {a, b,c} and qO=a, f(a)= U and f(b)=f(c)= (7, c= (a}, 6(.,a):aH{a,b},bw{a,c),andcw{a,b},and F={((a,b},

{b,c)}.

The reader is invited to show that M does not accept x = rY’ in the sense of C5. Figure 1 illustrates levels O-4 of a possible computation tree for M on x respecting 63. Let B denote the set of LARs containing a-there are eleven of them. Then N’ is the nondeterministic o-transducer (Q’, Z, A, 8, qb), where 1. the stateset Q’ is P’(B), 2. Z is the input alphabet,

a

I

b,

FIG.

1.

The

first

few levels

of a computation

tree for M on x.

ALTERNATING

3. A = P”(B x B) is the output alphabet, 4. 6’: Q’ x ,E + PO(Q’ x A) is the nondeterministic 5. qb is the initial state {a} in Q’. The run of N’ corresponding

21

O-AUTOMATA

to the computation

transition function, and

tree in Fig. 1 begins as follows:

state sequence: {a}, (ab}, {ba, abc}, { ba, bca, acb}, {ab, bca, cba, abc), ... . output sequence: ([a, ab]}, { [ab, ba], [ab, abc]}, ( [ba, ba], [abc, bca], [abc, acb]}, { [ba, ab], [bca, bca], [acb, cba], [acb, abc]}, ... . l

l

The second stage of the construction of N involves testing the “computation tree” produced by N’ to see whether Mr 1 has any winning plays. Let ZZ: B --) Q map LARs onto their last symbols, and let

Let y be the output during a run of N’. Then if y E K, via /? say, Mr 1 can win simply by following p. Conversely, if Mr 1 has a winning play then y E K. Clearly K is w-regular: for example, it is accepted by an nfa in the sense of C5. Thus so also is its complement, and there must be a dfa, N” say, which accepts A” - K in the sense of C5. Let N be the composition of N’ with N”: that is, N is an nfa which, on input x in P’, simulates N’ on x and N” on the output of N’ in parallel. Since there is a one-one correspondence between runs of N’ and strategies for Mr 0 respecting 8, the following are equivalent: 1. 2. 3. 4. 5.

M accepts x in the sense of C5; Mr 0 has a winning strategy in Z(M, x); Mr 0 has a winning strategy respecting 63 in ZJM, x); N’ has a run on x with output y # K; N accepts x in the sense of C5.

Finally, the language L5(N) is o-regular.

3. A6=% It is a simple exercise to show that A6c_A5: for example, by having an afa simulate another while keeping track (in its finite control) of the set of states the latter has passed through. It remains to show that each w-regular language L is accepted by an afa in the sense of C6. Since L =LS(M) for some dfa M, say (Q, C, 6, qo, F), it suflices to construct an afa N which simulates M. Before giving the technical details we describe N in the game-theoretic terminology of Section 2. At the start of the game Mr 0 chooses the set F from Y which he thinks will be M’s accepting set. Thereafter the game has (up to) three

22

PETER A. LINDSAY

stages. In the first stage Mr 0 has to say at each step of M’s computation whether or not the last non-F state has been seen. The winning condition is defined so that Mr 0 loses if he incorrectly answers yes, or if he always says no. The second stage begins if Mr 0 answers yes. There will be an ongoing check that no non-F states are seen again, so let us assume Mr 0 answered correctly. Then M rejects iff one (or more) of F’s states is not seen infinitely often. The ball is now in Mr l’s court and at each step he must say whether or not there is an F-state which will never be seen again. Mr 1 wins iff he eventually correctly answers yes (or if Mr O’s answer was incorrect). The third stage begins if Mr 1 answers yes, and simply involves checking that Mr l’s answer was correct. The technical details follow. Suppose Y = {F,, .... F,}. Let N be (Q’, f, Z, p, qi, Y’), where Q’ has initial state qi, absorbing rejecting state qr (in case Mr 0 incorrectly answers yes), and the following pairwise disjoint subsets: 1. n copies of Q, denoted Qt, .... QA; 2. a copy of F, denoted Q?, for each j= 1, .... n; 3. a copy of F, x P”(Fj) denoted Q,‘, for each j = 1, .... n. The superscript denotes the stage of the game, while the subscript indicates Mr O’s choice of designated set. In the following, a,! will denote the element of ?,! corresponding to u in Q, and so on. Let f and p be defined as in Table II; where f 1s irrelevant it has been omitted. Finally, Y’ consists of the sets S of the following forms: 1. S~{qi}uQ,!uQ,Y 2.

S~{q,}uQ,fuQ;uQJ3

with SnQj#@ for some j; such that S has an element of the form [u, Fj]j for

some j. Sets of the first (resp. second) form are exactly those which arise if Mr 0 correctly answers yes but Mr 1 always answers no (resp. incorrectly answers yes). Clearly Mr 0 has a winning strategy (in the sense of C6) iff x is in L5(M), and the proof is complete. TABLE

II

N’s Transition Functon and State Types

q

Case

6(&J,0) = u All S(u,u)=uEF, 6(u,0)=u~F, s(u,a)=uEF, S(u,u)=o$F, s(u,a)=oEF, S(u,a)=v$F,

f(q)

P(%0)

ALTERNATINGW-AUTOMATA

23

4. CONCLUSION

Together the results of Sections 2 and 3 give a good indication of the “power” of alternating w-automata. On the one hand, even under the strongest condition (C5) w-regular languages still result. On the other hand, all o-regular languages can be obtained under the essentially finite condition C6. Condition C6 is one which has often been overlooked, but can be very interesting. For example, the author has shown [2] that alternating w-Turing acceptors (o-TAs) accept precisely the arithmetical o-languages in the sense of C6, while the deterministic w-TAs accept precisely the boolean combinations of Cy o-languages. The various classes of o-languages accepted by the different types of o-TAs (deterministic, nondeterministic, and alternating) under each of the conditions Ci (i = 1, .... 6) are characterized in the recursion-theoretic hierarchy in [2], with one exception: the class accepted by alternating w-TAs in the sense of C5. It is shown, however, that this class lies properly between the boolean closure of Ci and Al. It is sometimes preferable (cf. [4]) to allow a slightly more general notion of alternation whereby the transition function takes positive boolean expressions as values, i.e., those built up from states using the binary connectives v and A . (Negation, which would reverse the winning condition, cannot be allowed; it would be nonsensical to declare either player the winner in the event of a play in which infinitely many negations occur.) The method in Section 2 still works with this more general notion upon reducing the expressions to disjunctive normal form. Moreover, it extends easily--essentially by applying the construction to each branch of the tree-to show that (general) alternating tree automata accept (in the sense of C5) precisely the same tree languages as do Rabin’s tree automata, namely those definable by second-order monadic formulae in the (logical) language of two successor functions (see [6]). Of course, the o-regular languages are precisely those defined analogously but in the language of one successor function.

ACKNOWLEDGMENTS The author thanks David Muller and Paul Schupp for many useful conversations on this subject. David Muller claims [S] to have a proof that A5 = R which does not rely on “forgetful determinancy.”

REFERENCES AND L. HARRINGTON, Trees, automata, and games, in “Conference Record of the 14th Annual Symposium on Theory of Computing, San Francisco, 1982,” pp. -5. 2. P. A. LINDSAY, Alternation and w-type Turing acceptors, Theoret. Comput. Sci. 43 (1986) 107-l 15. 3. S. MIYANO AND T. HAYASHI, Alternating finite automata on o-words, Theoret. Comput. Sci. 32 (1984), 321-330. 1. Y. GUREVICH

24

PETER

MULLER AND P. SCHUPP, Alternating automata on infinite objects, determinancy and Rabin’s theorem, Lxcf. Notes in Compuf. Sci. Vol. 192, pp. 100-107, Springer-Verlag, New York/Berlin, 1985. D. MULLER, personal communication. M. 0. RABIN, Decidability of second order theories and automata on infinite trees, Trans. Amer. Math. Sot. 141 (1969), i-35. K. WAGNER, On o-regular sets, Inform. and Control 43 (1979), 123-177.

4. D. 5. 6. 7.

A. LINDSAY