Information Processing Letters 16 (1983) 147North-Holland Publishing Company
POLYNOMIAL
COMPLETE
151
15 April 1983
PROBLEMS
IN AUTOMATA
THEORY
I.K. RYSTSOV Institute of Cybernetics,
Ukrainian Academy
of Science, 252207 Kiev - 207, U.S..%R.
Communicated by A. Ershov Received 17 August 1982 Kozen (1977) proved that the emptiness problem for regular languages intersection is polynomial complete. In this paper we show that many other problems concerning deterministic finite state automata are polynomial complete and therefore intractable for solution. On the other hand, simplified versions of these problems can be solved in polynomial time by deterministic algorithms. This work is a part of the research on automata theory carried out at the Institute of Cybernetics headed by academician V.M. Glushkov.
Keywords:
Automata
theory.
computational
complexity,
1. Introduction A weakb-initial automaton A is specified by objects, A = (S, X, f, I, F), where S is a finite set of states, X a finite set of inputs, f a transition function which maps S x X into S, I c S a nonempty set of initial states and F c S a nonempty set of final states. A non-initial automaton is a weakly-initial automaton in which I = S. In [2] a non-initial automaton is called a multiple-entry automaton and is specified by four objects, A = (S, X, f, F). We denote the sets of weakly-initial and non-initial automata by WIA and NlA respectively. Of course NIA may be considered to be the subset of WIA. X* denotes the set of all input words. The transition function is extended by induction on S x X and its value is denoted by f(s, p) or simply sp for s E S and p E X* [3]. The transition function is also extended on subsets of states by the formula five
Tp = {sp / s E T)
problems
subautomaton of global automaton ‘21, = (B2(S), X, F) defined on all subsets with at most two states is called a pair automaton for A [4]. The cardinality of a finite set V is denoted by IV]. The transition function of an automaton is described by a table with IX] rows and IS] columns. The number ]A] = IS]. IX] is called the size of automaton A. The transition function and subset of states of an automaton are coded as a string of symbols in some finite alphabet. Thus, a weaklyinitial automaton may be considered as a string of symbols, and (A) denotes the code of A. In this paper the reader is assumed to be familiar with the definitions of the classes P, PSPACE and with the notion of polynomial complete problems [5]. We consider, for the sake of simplicity, only polynomial time reduction but all the results also hold for logarithmic space reduction.
2. Global inclusion problem Let the following set of input words be associated with a weakly-initial automaton A:
for T c S. The automaton 8 = (B(S), X, F) where B(S) is the set of all subsets of S and F(T, x) = TX is called the global automaton for A [4]. The 0020-O 190/83/$03.00
complete
0 1983 North-Holland
I(A) = {p 1Ip c F). In the case ]I] = 1 this is the regular
set of words 147
Volume
16, Number
INFORMATION
3
PROCESSING
accepted by an initial automaton [6]. The problem of whether I(A) is empty for given A is called the global inclusion problem or in short the inclusion problem. The inclusion problem for initial automata is solved by a deterministic algorithm in linear time [6]. This algorithm can be applied to global automaton to solve the global inclusion problem but this requires exponential time and space of the size of a given automaton. Our futher aim is to prove polynomial completeness of the inclusion problem in class PSPACE which consists of the problems solved by deterministic algorithms in polynomial space. It is easy to see that the inclusion problem can be solved by a simple nondeterministic algorithm in linear space; therefore, from Savitch’s theorem [5] it follows that the inclusion problem belongs to PSPACE. This reasoning can be applied to each problem considered in this paper; therefore, in sequel we shall omit the proofs of the problems belonging to PSPACE. Theorem
2.1. The global inclusion problem for noninitial automata is PSPACE-complete.
Proof. We reduce problem. Let
Kozen’s
problem
[l]
to our
1
Ai = (Si, X, fi, {si}, Fi),
be an initial automata with common input alphabet and let L be an intersection of languages accepted by these automata. Without loss of generality, assume Si n S, = 8 if i * j. Let S be a union of all states Si, and F a union of all states F,. Let t ,> be the new states t i G?S and let z T=(t,,..., be the new input symbol z 4 X. Define non-initial automata
LE-ITERS
15 April 1983
constructed in linear time of the sum of sizes ]A i 1< i < If p E then, definition of A, it follows that zp E
Theorem
2.2. The inclusion problem for non-initial automata from NIA, belongs to class P. Proof. We sketch the algorithm of solution. Let A be the given non-initial automaton with IFI < k and < k}. It is easy to determine that let N(A) = (P ) ISPIL N(A) = g or to find some word p E N(A) in polynomial time of /A] using reset words. We can determine the absence of a reset word for states s and t or we can find such a word in polynomial time using the pair automaton [4]. If N(A) = 8, then I(A) = 0. Otherwise, the subautomaton (Bk(S), X, I) of global automaton is constructed on the subsets with at most k states in O(]Alk) time. Let B(F) be the set of all subsets of F and p E N(A). Consider the initial automaton
A, = (Bk(S),
X, I, {Sp), B(F)).
It is evident that I(A) = $9 iff I(A,) = 0 but the latter question can be solved in polynomial time of ]Ak].
A = (S u T, X u {z}, f, F) in the following
Contrary to this theorem we shall shown in the next section that the inclusion problem for WIA, is PSPACE-complete.
way:
f(s, x) = fi(s, x)
for all s E Si and x E X,
f(s, z) = s;
for all s E Si, 1 < i Q m,
f(t;, x) = t;
for all x E X and 1 < i < m,
f(ti, z) = s;
for all i, 1 < i Q m.
It is obvious 148
that
the
automaton
(A)
can
3. Reachability
be
and equivalence
problems
The set of input words R(A) is associated with each weakly-initial automaton A = (S, X, f, I, F) as
Volume
16. Number
INFORMATION
3
PROCESSING
IS April 1983
LETTERS
Corollary 3.3. The reachability and inclusion problems for WIA, are PSPACE-complete.
follows: R(A)={P(Ip=F}. The problem of emptiness of R(A) for given A is called the global reachability problem or, in short, the reachability problem. The reachability and inclusion problems are equivalent in the case IF] = 1 because ]Ip] > 1 for any p. Therefore, Theorem 2.2 implies the following. Corollary 3.1. The reachability belongs to the class P.
problem
The following theorem shows that cannot be improved if P * PSPACE.
L(A)=
for NIA,
this bound
Theorem 3.2. The reachability problem for NIA, PSPACE-complete.
We note without proof that the reachability and inclusion problems are PSPACE-complete for partial non-initial automata with (F( = 1. Let the following set of input words L(A) also be associated with each automaton:
is
Proof. ft suffices to reduce the inclusion problem to this problem in polynomial time and this theorem will be proved according to Theorem 2.1. Let A = (S, X, f, F) be a given automaton. We shall add to it new states t ,, t 2, t 3 %ZS and a new input symbol z @ X and consider a non-initial automaton
Theorem 3.4. The complement emptiness problem for non-initial automata is PSPACE-complete. Proof. Let A = (S, X, f, F) be the given automaton; then consider the automaton B = (S, X, f, S\ F). From the definitions it is easy to see that L(B) = X* \ I(A). Therefore, I(A) = 8 iff L(B) = X* and the theorem is proved. Corollary 3.5. The equivalence problem for non-initial automata is PSPACE-complete.
B = (S u {ti, t,, t)), X u {z>, g, {t,> t,>> where g is defined
in the following
way:
g(s, x) = f(s, x)
for all s E S and x E X,
g(ti,x)=g(ti,z)=t,
forallxEX,
t,
g(s, z) = i
12
This corollary directly follows from Theorem 3.4 because the complement emptiness problem may be treated as the equivalence problem with one state automaton.
1
ifsEF, ifs@F.
It is obvious that automaton B can be constructed in linear time in ]A]. Suppose that p E I(A); then from the construction of B it follows that pz E R(B). Conversely, if q E (X u z)* is the shortest word in R(B), then q must be equal to pz and p E I(A). Thus I(A) * 8 iff R(B) f g and the theorem is proved. Putting I = S and F = (t ,} in the automaton B described in this theorem we shall have the following.
4. Automata with outputs An automaton objects,
Ql with outputs
is defined
by five
9l = (s, x, Y, 8, X) where S, X and 6 are the same as in weakly-initial automata, Y is a finite set of outputs, and X an output function which maps S x X into Y. As usually X is extended to S x X* and the output word is denoted by X(s, p) [7]. Recall that two states are called equivalent if they produce identical output words for every input word. 149
Volume
16, Number
The following with each ‘U: E(g)
3
INFORMATION
set of experiments
= {(P> q) I@)
PROCESSING
LETTERS
15 April 1983
Proof.
is associated
Let A = (S, X, f, F) be a non-initial tomaton and let S = (s,, sZ,. . ., s,,). Define automaton with outputs
authe
X(s, P> = q>. 9I = ({1,2,...,
We call two automata 9l, and 9l, weakly-equivalent if E( 9I,) = E( 91Z). Moore [8] proved that in two weakly equivalent strongly-connected automata for each state in one automaton there is an equivalent state in the other automaton. Therefore, the weak equivalence problem is solved in polynomial time in this case [7]. Now we shall see that in general this problem is intractable. Theorem 4.1. The PSPACE-complete.
weak
equivalence
problem
is
2n), X U {z), Y, 61)
where zex,
Y={Yo,Y,?...?Y”)
as follows: 6(i,x)=j,
6(i+n,x)=j+n
if f(s,, x) = s,,
and 6(i, z) = 6(i + n, z) = 1
for all i, 1 < i < n.
Moreover, Proof. Let Ai = (Si, X, f,, Fi), i = 1, 2, be two given non-initial automata with common input alphabet. Let us consider two automata with outputs
X(i,x)=X(i+n,x)=y, X(i,z)=y,
6,(s,x)=f,(s,x)
forallsESi,xEX,i=
1,2,
and a,(., .)= t, on all other states and inputs, i = 1, 2. Define an output function Xi(s, z) = 1 for s E Fi and A,(., .)= 0 on all other states and inputs, i = 1, 2. Obviously, an automaton with outputs ,U, can be constructed in linear time of the size of a given automaton Ai. It is easy to verify that L(A,)=L(A,)
iff
E(‘U,)=E(‘U,)
ifsiEF
and X (i, z) = yl
where t i 6 Si, z @ X and Y = (0, l}, and the transition functions are defined as follows:
forallxandi,
on all other states i, 1 < i < 2n.
It is evident that the automaton 9I can be constructed in linear time in ]A]. If p is a nonempty word in I(A), then from construction of $21 it follows that pz E D( $I). Conversely, if q E (X U z)* is the shortest word in D(%), then q must be equal to pz where p E I(A). Thus I(A) * 8 iff D( %) * p and the theorem is proved. Finally we shall consider the homogeneous problem. Recall that the word p is called homing for the automaton QI if x (s, P> * i(t9
P>
or
S(s, p) = s(t, p)
for all s, t E S. and therefore, according rem is proved.
to Corollary
3.5, the theo-
Input word p is called diagnostic for the automaton rU if X(s, p) * x(t, p) for all different states s and t [7]. Denote by D(%) the set of diagnostic words for 9l and call the problem of emptiness of D( %!I) the diagnosing problem.
An automaton with outputs is called a reduced automaton if there are no two equivalent states in it. In [8] Moore proved the existence of homing words for every reduced automaton but as far as the author knows the following simple result is not known. Theorem
Theorem
complete. 150
4.2. The diagnosing problem
is PSPACE-
4.3. A homing word exists /or the automaton if and only if there is a reset word for every pair of equivalent states.
Volume
16, Number
3
INFORMATION
PROCESSING
Proof. Necessity is evident. Sufficiency is proved by simple modification of the method which was described in Theorem 2.2. Corollary 4.4. The homogeneous problem tomata with outputs belongs to class P.
for au-
5. Conclusion New polynomial complete problems concerning finite automata are presented in this paper. Some of these problems such as diagnostic and weak equivalence problems have been investigated for a long time by many authors, and great efforts have been expended in order to find the effective solution. It is interesting to note that in these problems there is no obvious quantifier alternation such as in well-known PSPACE-complete problems from logic and game theory [9].
LETTERS
15 April 1983
References [l] D. Kozen, Lower bounds for natural proof systems, Proc. 18th Ann. Symp. on Foundations of Computer Science (1977) 254-266. finite automata, J. 121A. Gill and L. Kou, Multiple-entry Comput. Syst. Sci. 9 (1974) l-19. teoria avtomatov, Uspehi Mat. 131 V.M. Glushkov, Abstractnaja Nauk 16(5) (1961) I-70 (in Russian). Finite-State Models for Logical Machines [41 F.C. Hennie, (Wiley. New York, 1968). and J.D. Ullman, The Design and [51 A.V. Aho, J.E. Hopcroft Analysis of Computer Algorithms (Addison-Wesley, Reading, MA, 1974). and their deci[cl M.O. Rabin and D. Scott, Finite automata sion problems, IBM J. Res. Develop. 3 (1959) 114-125. to the Theory of Finite-State Mac[71 A. Gill, Introduction hines (McGraw-Hill, New York, 1962). experiments on sequential macPI E.F. Moore, Gedanken hines, in: Automata Studies (Princeton University Press, Princeton, 1956). and Intractabil[91 M.R. Carey and D.S. Johnson, Computers ity (Freeman, San Francisco, CA, 1979).
Acknowledgment The author is grateful to J.V. Kapitonova and A.A. Letichevski and A.N. Chebotarev for helpful discussions.
151