Note on Minimal Finite Automata

Note on Minimal Finite Automata
Galina Jirásková
Mathematical Institute, Slovak Academy of Sciences
Grešákova 6, 040 01 Košice, Slovakia
[email protected]
Abstract. We show that for all n and α such that 1 ≤ n ≤ α ≤ 2n there
is a minimal n-state nondeterministic finite automaton whose equivalent
minimal deterministic automaton has exactly α states.
1
Introduction
Finite automata belong among the few fundamental computing models that were
intensively investigated for more then four decades. Despite on this fact there are
still several fundamental open questions about them. These open questions [3]
are mainly related to the estimation of the power of nondeterminism in finite
automata. One of these questions is considered in this paper.
The subset construction [8] shows that any nondeterministic finite automaton (NFA) can be simulated by a deterministic finite automaton (DFA). This
theorem is often stated as ”NFA’s are not stronger than DFA’s”. But we have
to be careful. The general simulation is only possible by increasing the number
of states (the size of the automata). It is known [6] that there is an NFA of n
states which needs 2n states to be simulated by a DFA. Thus, in this case NFA’s
are exponentially smaller than DFA’s. But on the other hand the DFA which
counts the number of 1’s modulo k needs k states and all equivalent NFA’s need
the same number of states. So, nondeterminism does not help in this case.
The question that arises is how many states may the minimal DFA equivalent
to a given minimal n-state NFA have? This question was first considered by
Iwama, Kambayashi and Takaki [4]. They showed that for α = 2n − 2k or α =
2n − 2k − 1, k ≤ n/2 − 2, there is an n-state NFA which needs α deterministic
states. The question has been studied also by Iwama, Matsuura and Paterson [5].
In their paper they called an integer Z, n < Z < 2n , a ”magic number” if no
DFA of Z states can be simulated by any NFA of n states. They proved that
for all integers n ≥ 7 and α such that 5 ≤ α ≤ 2n − 2, with some coprimality
condition, 2n − α cannot be a magic number. It seemed more likely for them
that there is no such magic number.
In this paper we prove their conjecture and we show that there are no such
magic numbers at all. For each integers n, α such that n ≤ α ≤ 2n we give an
example of minimal n-state NFA whose equivalent minimal DFA has exactly
α states. However, the size of the input alphabet of these NFA’s is very big,
This research was supported by VEGA grant No. 2/7007/2.
J. Sgall, A. Pultr, and P. Kolman (Eds.): MFCS 2001, LNCS 2136, pp. 421–431, 2001.
c Springer-Verlag Berlin Heidelberg 2001
422
Galina Jirásková
namely 2n−1 + 1. In the second part of this paper we show that it can be reduced
to 2n. In the third part of the paper we discuss the situation for one and twoletters alphabet. For O(n2 ) values of α we construct a minimal n-state NFA over
the alphabet {0, 1} which needs α deterministic states. The situation for unary
automata is sligtly different because of known result of Chrobak [1]
who proved
√
that any n-state unary NFA can be simulated by a DFA having O(e n ln n ) states.
The paper is organized as follows. In Section 2 the basic definitions and
notations are given. The main results are presented in Section 3. Section 4 is
devoted to the automata over one and two-letters input alphabet.
2
Definitions and Notations
A finite automaton M is determined by giving the following five items: (i) a
finite set Q of states, (ii) a finite set Σ of input symbols, (iii) an initial state
(∈ Q), (iv) a set F (⊆ Q) of accepting states, (v) a state transition function δ.
If δ is a mapping from Q × Σ into Q then M is said to be deterministic. If
δ is a mapping from Q × Σ into 2Q then M is said to be nondeterministic. The
domain of δ can be naturally extended from Q × Σ to Q × Σ ∗ . The definition
of the language accepted by M is as usual and we omit it. Two finite automata
are said to be equivalent if they accept the same language. A DFA (NFA) M is
said to be minimal if there is no DFA (NFA) M that is equivalent to M and
has fewer states than M . It is well known [8] that a DFA M is minimal if (i) all
its states are reachable from the initial state and (ii) there are no two equivalent
states (two states q1 and q2 are said to be equivalent if for all x ∈ Σ ∗ , δ(q1 , x) ∈ F
iff δ(q2 , x) ∈ F ).
For an NFA M of n states ∆(M, n) denotes the number of states of the
minimal DFA that is equivalent to M . NFA’s should also be minimal. Note that
in [4,5] the values of ∆(M, n) were large enough to guarantee the minimality
of M . This is not the case in this paper and the minimality of NFA’s has to be
proved. For this purpose let us define the notion of a generalized 1-fooling set in
the same way as in [2].
Definition 1. A set A of pairs of strings is called a generalized 1-fooling set
for a language L if for each (x, y) from A the string xy is in L and for every
different pairs (x1 , x2 ) and (y1 , y2 ) from A at least one of the strings x1 y2 , y1 x2
is not in L.
Example 2. Let L = {w | the number of 1’s in w is k}. Then the set A =
{(, 1k ), (1, 1k−1 ), (12 , 1k−2 ), . . . , (1k , )} is a generalized 1-fooling set for this language, since for all i the string 1i 1k−i is in L and for all i = j the string 1i 1k−j
is not in L.
Now, we formulate a lemma and since it will be used throughout the rest of
the paper we give the proof of it although it follows from the considerations in
the 5th chapter of [2].
Note on Minimal Finite Automata
423
Lemma 3. Let A be a generalized 1-fooling set for a regular language L. Then
any NFA for L has at least |A| states (here, |A| denotes the cardinality of A).
Proof. Let A = {(x11 , x12 ), (x21 , x22 ), . . . , (xn1 , xn2 )} be a generalized 1-fooling set
for L. That means that for all i = 1, 2, . . . , n the string xi1 xi2 is in L. Let M
be an NFA for L and let us consider an accepting computation of M on xi1 xi2 .
Denote q i the state which M enters during this accepting computation after
reading xi1 . For i = j it has to be q i = q j , otherwise there would be an accepting
computation of M on xi1 xj2 and also on xj1 xi2 which contradicts to the assumption
that A is a generalized 1-fooling set for L. So, we have obtained at least n different
states of M which proves the lemma.
According to Lemma 3 to prove that an NFA M of n states is minimal it is
sufficient to find a generalized 1-fooling set of the cardinality n for the language
accepted by M .
Let M be an NFA of n states Q = {q1 , q2 , . . . , qn }. Then an equivalent
DFA Mdet can be constructed as follows. First, all 2n subsets of Q are introduced;
each of them can be a state of Mdet . The initial state of Mdet is {q1 } if q1 is the
initial state of M . A state X ⊆ Q is an accepting state if it includes at least one
accepting state of M . The transition function δdet is defined using the transition
function δ of M as follows: δdet (X, a) = ∪q∈X δ(q, a). After determining this δdet ,
we remove all sets which cannot be reached from the initial state {q1 } of Mdet .
This procedure is usually called the ”subset construction” [8]. Note that this
DFA Mdet may still not be minimal since some two states might be equivalent.
In the following lemma we give a sufficient condition for an NFA which guarantees that no two states obtained by the subset construction are equivalent.
Lemma 4. Let M be an n-state NFA over an alphabet Σ, 1 ∈ Σ, such that
(1) q1 is the initial state and qn is the only accepting state,
(2) δ(qi , 1) = {qi+1 } for i = 1, 2, . . . , n − 1 and δ(qn , 1) = ∅ (i.e., transitions on
reading 1 look like in Fig. 1, the other transitions may be arbitrary).
Then (i) M is a minimal NFA for the language it accepts, (ii) no two reachable
states in the subset construction of Mdet are equivalent.
......................
......................
.....
...
...
......
...
...
...
...
..
...
...
...
.......
....
..............................................
.
1
2
.. ..
...
..
..................................... ..
.
...
.
..
...
.
.
.
....
.
....
..
.
.
.......
.
......... .............
.
................
....
q
1
q
1
......................
.........................................
.....
...
.......
............
...
...
.....
.......
...
..
...
.......
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
................................... ....
.................................... ...
n .........
......
... n−1 ....
.
...
.
.
...
.
.
.
.
..........
......
.....
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
................................
....................
1
• ••
q
1
q
Fig. 1. Transitions on reading 1 of the NFA M
Proof. (i) It is not difficult to see that the set A = {(, 1n−1 ), (1, 1n−2 ), . . . ,
(1n−1 , )} is a generalized 1-fooling set of the cardinality n for the language
L(M ). So, according to Lemma 3 M is a minimal NFA for the language it
accepts.
424
Galina Jirásková
(ii) Note that for all i = 1, 2, . . . , n the string 1n−i is accepted starting at the
state qi but it is not accepted starting at any other state. This immediately implies that two different reachable sets in the subset construction are unequivalent
(since there is an i such that qi is in one of them, say X, but not in the other,
say Y , and so δ(X, 1n−i ) involves qn , the only accepting state, and δ(Y, 1n−i )
does not involve qn ).
Thus, by the lemma above if a NFA M fulfils the conditions (1) and (2),
then M is a minimal NFA for its language and to obtain ∆(M, n) i.e., the size of
the minimal DFA equivalent to M , it is sufficient to find the number of reachable
sets in the subset construction for M .
3
Main Results
In this section we show that for any integers n, α such that n ≤ α ≤ 2n there is
a minimal n-state nondeterministic automaton whose equivalent minimal deterministic automaton has exactly α states.
First, we give a minimal k-state NFA Ak over the alphabet {0, 1} such that
∆(Ak , k) = 2k and Ak fulfils the conditions (1) and (2) in Lemma 4 (note that
the automaton in [6] does not fulfil these conditions, see Fig. 2, ”missing” arcs on
reading 0 from the accepting state correspond to transitions to the state ”empty
set”).
..................
.....
...
...
...
.....
.
... ........... .........
. ..........
.
.....................
.
.
.......................
.......................
.........................
.
.
.
....
....
......
.....
.....
............ ...................
...
...
....
.
...
...
...
.......
...
...
...
...
......
..
..
....
..
...
...
...
....
...
..
..............
.............
..................
..............
................................................
.
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
•••
n−1 ...
1 ...
2 ...
3 ....
n ..........
. ..
... ...
...
... ......
... ...
...
..
...
..
......
.
.
.....
...
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.....
..
.....
....
.....
.
..................................................
.........................
.........................
................................
.................. ...........
...............
....................................................
..............
.................
.
...............
..........
......................
.................. ....................
...........
.......................................
.......................
.
.
.
.
.
.
.
............
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.............
.............
....
...............
.............
.................
..............
.....................
.................
..................................
.....................
.......................................................................................
0
q
1
q
0, 1
q
0, 1
0, 1
q
0, 1
q
1
1
Fig. 2. Moore’s n-state NFA whose equivalent minimal DFA has 2n states
Using k-state automata Ak , 1 ≤ k ≤ n, we construct n-state automata Bk
over the alphabet {0, 1} with ∆(Bk , n) = 2k +n−k. Finally, the n-state NFA Mα
with ∆(Mα , n) = α will be constructed from an automaton Bk using further
letters of 2n−1 + 1 letters input alphabet.
Lemma 5. For each integer k there is a minimal k-state NFA Ak over the
alphabet {0, 1} such that Ak fulfils the conditions (1) and (2) in Lemma 4 and
∆(Ak , k) = 2k i.e., its equivalent minimal DFA has 2k states.
Proof. Let the set of states of Ak be {q1 , . . . , qk } with the initial state q1 and
the only accepting state qk . Define transition function δ as follows (see Fig.3)
δ(qi , 1) = {qi+1 }
i = 1, 2, . . . , k − 1
Note on Minimal Finite Automata
δ(qi , 0) = {q1 , qi+1 }
425
i = 1, 2, . . . , k − 1
δ(qk , 1) = δ(qk , 0) = ∅
..........
...... ........
...
...
....
...
...
.................................
.........
...........
...........
.........................
....
....... ...........
....... ..........
.......................................
...
.....
.....
.
....
....
...
.........
...
...
.......
..
...
..
..
.....
...
...
...
.....
....
...
..
..
..
......
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..............................................
.
.
.
.
.
.
.
.
.
.
.
.
.
...
.
.
.
.
.
1
2
3
k−1 ...................................... ........
k .......
.. ..
..................................... ....
..................................... .. • • • .................................... ....
...
...
.
.
...
...
...
...
.
.
.
.
.
...
.
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
........
...
...
....
.
.....
....
......
..
..
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
........ ................................................................ ........... ............
.
.
.
.
.
.
.
.
.
..
................................
.
....... .......... ........
.......
....... .....................
.....................
. ........ .........
.......
........
......... .............
..........
.........
.......... ............................................................
.........
..........
..........
.
.
.
.
.
............
.
.
.
.
..............
.........
.................
..............
...........................
.................
..........................................................................
0
q
0, 1
0
q
0, 1
q
0, 1
0, 1
q
0, 1
q
0
0
Fig. 3. The nondeterministic finite automaton Ak
Since qk is the only accepting state of Ak and transitions on reading 1 are as
in Lemma 4, Ak is minimal and to prove that ∆(Ak , k) = 2k it is sufficient to
show that each subset of {q1 , q2 , . . . , qk } is reachable in the subset construction
for Ak . It can be easily seen that ∅, {q1 }, {q2 }, . . . ,{qk } are all reachable. Suppose
X = {qi1 , qi2 , . . . , qil }, where l ≥ 2 and 1 ≤ i1 < i2 < . . . < il ≤ k. We show
that X is reachable from a set Y with the smaller cardinality than X. Let
Y = {qi2 −i1 , qi3 −i1 , . . . , qil −i1 } i.e., |Y | = |X| − 1. Since 1 ≤ ij − i1 ≤ k − 1,
j = 2, 3, . . . , l, δ(Y, 01i1 −1 ) is exactly X. Using induction on cardinality we have
proved that all subsets of {q1 , q2 , . . . , qk } are reachable in the subset construction
for Ak and so, ∆(Ak , k) = 2k .
Lemma 6. For all n, k such that 1 ≤ k ≤ n there is a minimal n-state NFA Bk
over the alphabet {0, 1} such that ∆(Bk , n) = 2k + n − k.
Proof. We construct the n-state NFA Bk from the k-state NFA Ak described in
Lemma 5 by adding new states qk+1 , qk+2 , . . . , qn and new transitions on reading
1: δ(qk+1 , 1) = q1 and δ(qi , 1) = qi−1 for i = k + 2, . . . , n (see Fig. 4). The initial
state of Bk is qn , the only accepting state is qk . Since the conditions of Lemma 4
are fulfilled, the NFA Bk is minimal and to find ∆(Bk , n) it is sufficient to count
the number of reachable sets in the subset construction for Bk . Note that {qn },
{qn−1 }, . . . ,{qk+1 } and {q1 } are reachable. Further, by Lemma 5 all subsets of
{q1 , q2 , . . . , qk } are reachable and it is not difficult to see that no other set is
reachable. Thus, there are 2k + n − k reachable sets in the subset construction
for Bk which implies that ∆(Bk , n) = 2k + n − k.
Lemma 7. For all n, k and j such that 1 ≤ k ≤ n − 1, 1 ≤ j ≤ 2k − 1, there is
a minimal n-state NFA Mk,j such that ∆(Mk,j , n) = 2k + n − k + j.
Proof. Let ai , i = 1, 2, . . . , 2n−1 − 1 be pairwise different symbols of the input
alphabet, ai = 0, ai = 1. Let S1 , S2 , . . . , S2k −1 be all subsets of {q1 , q2 , . . . , qk+1 }
involving the state qk+1 , except for {qk+1 }. We construct the n-state NFA Mk,j
426
Galina Jirásková
0
..................
...
..
.....
....
.
............................
.................
............
..................
.....................
.....................
.....................
....
...
.....
......
....................................
...
....
....
....
....
...
...
...
.
.
.
...
...
.....
.
.
.
...
...
......
.. .
....
.
.
.
..
.. ...
..
... .
... .
... ..
... .....
... .
... ..
..
.
. ..
...
n .......................................... n−1 ....................... • • • ....................... k+1 ..........................................
1 .........................................
2 ...................... • • • ....................... k−1 .............................................. k ........
...
...
...
...
...
...
.....
.
.
.
.
.
.
...
....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
....... ......
....... ......
....... .................
.
....... ......
............................
....................
.
.
........
........
.................. ........... ...................................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...
. ......... .........
........
.........
...........
.........
.................
...........
.................................................
q
1
q
1
1
q
1
q
0, 1
0
q
0, 1
0, 1
q
0, 1
q
0
Fig. 4. The nondeterministic finite automaton Bk
from the n-state NFA Bk of Lemma 6 by adding new transitions from the accepting state qk : δ(qk , ai ) = Si , i = 1, 2, . . . , j. The NFA Mk,j fulfils the conditions
(1) and (2) of Lemma 4 so, it is minimal. And it is not difficult to see that the
number of the reachable sets in the subset construction for Mk,j is 2k + n − k + j
(all subsets of {q1 , q2 , . . . , qk }, {qk+1 }, {qk+2 }, . . . ,{qn }, S1 , S2 , . . . , Sj ) which
implies (again according to Lemma 4) that ∆(Mk,j , n) = 2k + n − k + j.
Now we are ready to prove the main result.
Theorem 8. For all n and α such that n ≤ α ≤ 2n there is a minimal n-state
NFA whose equivalent minimal DFA has exactly α states.
Proof. The case α = n is trivial (the automaton accepting all strings of length at
least n−1 can be taken). For α ≥ n+1 let k be such integer that 2k +n−k ≤ α <
2k+1 + n − (k + 1). If α = 2k + n − k then the automaton Bk from Lemma 6 can
be taken. In the other case α = 2k + n − k + j, where k ≤ n − 1, 1 ≤ j < 2k − 1,
and the automaton Mk,j from Lemma 7 can be taken.
Thus, we have proved that nondeterminism can be helpful ”step by step” for
finite automata. Howewer, the automata which we used to prove it were over
many-letters alphabet (namely 2n−1 + 1). The following theorem shows that
the size of input alphabet can be decreased to 2n. Note that we only prove the
existence of such automata but we do not give the construction of them. Before
proving this we formulate a lemma which is similar to Lemma 4.
Lemma 9. Let an NFA M have the states q1 , q2 , . . . , qn , where q1 is the initial
and qn is the only accepting state of M . Let a1 , a2 , . . . an−1 be pairwise different
letters of the input alphabet. Let (see Fig. 5)
δ(qi , ai ) = {qi+1 }
δ(qi , aj ) = ∅
δ(qn , ai ) = ∅
for
for
i = 1, 2, . . . , n − 1,
i = j,
i = 1, 2, . . . , n − 1.
Then M is minimal and ∆(M, n) is equal to the number of reachable sets in the
subset construction for M .
Proof. The proof of this lemma is similar as the proof of Lemma 4. The set
A = {(, a1 a2 . . . an−1 ), (a1 , a2 a3 . . . an−1 ), . . . , (a1 a2 . . . an−1 , )} is a generalized
Note on Minimal Finite Automata
.....................
......................
.......................
....
......
.....
...
.....
...
...
...
...
...
...
...
1
2
3
..
..
...
...
...
...
..............
...
................................................
....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 ...
2 ...
3 ...............................................
. ..
... ...
...
.
.
.
...
...
..
..
.
...
.
.
.
.
.
.
.....
.....
.....
.........................
.........................
........................
q
a
q
a
q
.......................
.........................
.....
............. ...................
...
...
n−2 .....
n−1 ..........
......
..
...
.
..................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
................................................
.
n ..........
... ......
... n−1 ....
......
.....
.
.
...
.
.
.
.
.
.
.
.
.........
.
.....
........................................
......................
.....
a
a
•••
427
q
a
q
Fig. 5. Transitions on reading ai of the NFA M
1-fooling set for L(M ) of the cardinality n which implies that M is minimal.
For all i = 1, 2, . . . , n − 1 the string ai ai+1 . . . an−1 is accepted starting at the
state qi but it is not accepted starting at any other state. This implies that no
two reachable sets in the subset construction for M are equivalent.
Theorem 10. For all n and α, n ≤ α ≤ 2n , there is a minimal n-state NFA
over 2n letters input alphabet whose equivalent minimal DFA has exactly α
states.
Proof. The case α = n is trivial. For n + 1 ≤ α ≤ 2n we prove this theorem by
induction on n. The automata for n = 2 are depicted in Fig. 6.
........
...... .........
...
...
.
....
...
...
..................................
.............
....
......................................
.....
...
.
........
.......
...
....
....
...
................................................
...
2
1 .........
...
.... .......
..
.
...
......
...
.
.
.
.
.
.
.
.
....
.
..........
....... ...........
........................................
..........
.......
0
..................
.............
......
....
.......................................
....
........
......
...
.....
..
...
......
..
....
.................................................
2
1 ........
.. .....
...
..
.
......
.
.....
...
.
.
.
.
.
.
.
.
....
..........
........................................
.......... .............
.......
...
q
1
q
q
0, 1
q
Fig. 6. The two-state NFA’s whose equivalent minimal DFA’s have 3 resp. 4
states
Suppose that for all α, n + 1 ≤ α ≤ 2n , there is a minimal n-state NFA over
the input alphabet {a1 , b1 , a2 , b2 , . . . , an , bn }, with the initial state qn , the only
accepting state q1 and the transition function δ such that
δ(qi , ai ) = {qi−1 }
for
δ(qj , ai ) = ∅
δ(q1 , ai ) = ∅
for
i = n, n − 1, . . . , 2
i = j
i = n, n − 1, . . . , 2
We show that than for all α between n + 2 and 2n+1 there is a minimal
(n + 1)-state NFA over 2(n + 1) letters alphabet with ai -transitions as above
which needs α deterministic states.
Let D be the n-state NFA from the induction assumption with ∆(D, n) = α.
We construct the (n + 1)-state NFA D (see Fig. 7) from the n-state NFA D
by adding a new initial state qn+1 connected with qn through an+1 and new
transitions on reading bn+1 : δ(qi , bn+1 ) = {qi , qn+1 } for i = 1, 2, . . . , n. Note that
if X is reachable in the subset construction for D, then X ∪ {qn+1 } is reachable
in the subset construction for D and moreover, all reachable sets for D are
either equal to a reachable set for D or can be written as X ∪ {qn+1 }, where X
is reachable for D. This implies that ∆(D , n + 1) = 2 · ∆(D, n).
428
Galina Jirásková
b
b
b
b
.................n+1
................ n+1
................ n+1
.................n+1
.....
.....
...
.....
...
.....
...
...
...
...
...
...
...
...
...
...
.....
....
....
....
..
..
...
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
............................
.............................
.............................
........................................
...................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..........
....
....
....
....
..
...
...
........
.
.
.
.
....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.......
...
...
n+1 ..
n−1
...
...
n
3
2
..
..
....
....
..
...
...
.
..
..
... ..
... ..
...
... ....
.
...............................................
....
n ................................................ n−1 ............................................... • • • .............................................
2 ......................................................
1 .........
.. ..
... n+1 ...
..
...
...
.....
...
......
.
.
.
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
n+1
.
.
....
....
.........
. ...
.
.
.. ..
.....
......
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
............................................................................. .............................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..
. ..
.
.....................
..
.
.....................................
........ ..............
...................
......
....... ......... ...........
.........
........
.......
....... .......... .................... n+1...............................
........
........ .........
........
.........
...... .....
........ ............ ........
..........
........
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.........
..
..
..
......... ............................
.............
.........
n+1
..........
.......................
................
.........
..........
........................................................................................
.........
............
...........
.............
...........
.
.
.
.
.
.
.
.
.
.
................
.
.
.............
....................
....................
..........................................n+1
....................................................
q
a
q
b
a
a
q
a
q
a
q
b
b
b
Fig. 7. Transitions on reading ai and bn+1 of the NFA D
Further, if we remove the transition on bn+1 from qn to qn+1 , the set
{qn , qn+1 } becomes unreachable and for the automaton D obtained in this
way it holds ∆(D , n + 1) = 2 · ∆(D, n) − 1.
If ∆(D, n) = α, n + 1 ≤ α ≤ 2n , we have constructed the automata D
and D whose equivalent minimal deterministic automata have 2α and 2α − 1
states. Note that these automata fulfil the conditions of Lemma 9 and also the
induction assumption concerning transitions on ai . It remains to prove that
there is a minimal (n + 1)-state NFA (fulfilling the induction assumption on ai transitions) which needs α deterministic states for n + 2 ≤ α < 2n + 1. But
this is not difficult. For α = n + 2 it is the automaton in Fig. 8 with transitions
δ(qi , ai ) = {qi−1 } for i = 2, 3, . . . , n + 1. For n + 2 < α < 2n + 1 denote
β = α − (n + 2) (i.e., 1 ≤ β < n − 1) and consider the automaton obtained from
the previous one by adding the transitions δ(q1 , bi ) = {qi+1 , q1 }, i = 1, 2, . . . , β.
For this automaton the number of reachable sets is exactly n + 2 + β = α.
.....................
.....................
......
...
......
....
...
...
...
n+1 .....
n
..
...
.
..
...
....
...............................................
n ..............................................
.. ..
... n+1 ...
...
...
..
..
.
.
.
.
.
....
....
........ ...........
.......... ..............
.......
..
q
a
q
a
.....................
..................
......
....
.............. .....................
...
........
......
...
3
2
....
....
...
...
.................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
................................................
2 ...
1 ..........
.... .......
...
......
.....
...
..
.
.
.
.
.
.
.........
.....
.........................................
.........................
.......
a
• ••
q
a
q
Fig. 8. The (n + 1)-state NFA which needs n + 2 deterministic states
4
Automata over the Alphabet {0, 1} and {1}
In the first part of this section we will consider automata over the input alphabet
{0, 1}. Note that only such automata were considered in [4] and [5]. In [4] it is
shown that if α = 2n − 2k or α = 2n − 2k − 1, 0 ≤ k ≤ n/2 − 2, then there is
a minimal n-state NFA which needs α deterministic states. In [5] the same is
shown for α = 2n − k, n ≥ 7, 5 ≤ k ≤ 2n − 2 (with some coprimality condition).
In this section we prove this property for all α such that n ≤ α ≤ 1 + n(n + 1)/2
(the case α = n is again trivial). While in [4,5] the ∆(M, n) value was large
Note on Minimal Finite Automata
429
enough to guarantee the minimality of the NFA M in this case ∆(M, n) value
is small and so, the minimality of the NFA M should be proved. But we will
construct nondeterministic automata in such a way that the conditions (1) and
(2) in Lemma 4 will be fulfilled and so, the automata will be minimal. Moreover,
by Lemma 4 ∆(M, n) will be equal to the number of reachable sets in the subset
construction for M .
The following lemma shows that for any k, 0 ≤ k ≤ n − 1, there is a minimal n-state NFA over the alphabet {0, 1} whose equivalent minimal DFA has
exactly 1+n+(n−1)+(n−2)+. . .+(n−k) states. In the second lemma it is shown
that for any k and j, 0 ≤ k ≤ n−1, 1 ≤ j < n−(k+1) there is a minimal n-state
NFA over the alphabet {0, 1} which needs 1 + n + (n − 1) + . . . + (n − k) + j
deterministic states.
Lemma 11. For all n and k, 0 ≤ k ≤ n−1, there is a minimal n-state NFA Mk
over the aplhabet {0, 1} such that ∆(Mk , n) = 1 + n + (n − 1) + . . . + (n − k).
Proof. Let q1 , q2 , . . . , qn be the states of Mk , let q1 be the initial state and qn be
the only accepting state. Define transitions on reading 1 by δk (qi , 1) = {qi+1 }, i =
1, 2, . . . , n − 1 and δk (qn , 1) = ∅. The conditions (1) and (2) of Lemma 4 are
fulfilled and therefore Mk is minimal and ∆(Mk , n) is equal to the number of
reachable sets in the subset construction. Further, define transitions on reading
0 by δk (qi , 0) = {q1 , q2 , . . . , qi , qi+1 } for i = 1, 2, . . . , k and δk (qj , 0) = ∅ for
j = k + 1, k + 2, . . . , n. So, if k = 0 there are no 0-transitions and for k ≥ 1 the
NFA Mk looks like in Fig. 9
0
0
0
................
..................
..................
.....
...
....
...
....
...
..
..
.
.
....
....
....
...
...
..
...
... ......... .........
.
.
...................
......................
.
.
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...................
.
.
.
.
.
.
.
.
.
.
.
.
.
....
....
.
.
......................................
....
......
...
...
...
...
....
....
.
.........
.....
...
.
.
.
...
...
.
....
...
..
.....
..
..
..
..
..
......................................
..
............
.............
..................
............................................
.............................................
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
•
•
•
•
•
•
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 ..
2 ..
n ........
k ..
.. ..
..
.. .. k+1 ..
..
.. ..
.. ....
...
.
.
.
.
.
.
.
.
.
...
......
...
...
.
...
.
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.....
.
.
.
.
.
.
.
.
.
.
.
.
.
........ ........
................................
...........................................
..............................
.
.
.
.................................................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
..............
. ........... ..................
..................................................................................
..........
......
...........
..........
.............
....................
..............
.................................................................
q
0, 1
q
0, 1
0
0, 1
q
0, 1
q
1
1
q
0
0
Fig. 9. The nondeterministic finite automaton Mk
It is easy to see that the following sets are reachable in the subset construction
for Mk :
∅, {q1 }, {q2 }, . . . , {qn },
{q1 , q2 }, {q2 , q3 }, . . . , {qn−1 , qn },
{q1 , q2 , q3 }, {q2 , q3 , q4 }, . . . , {qn−2 , qn−1 , qn },
..
.
{q1 , q2 , . . . , qk+1 }, {q2 , q3 , . . . , qk+2 }, . . . , {qn−k , qn−k+1 , . . . , qn }.
It is not difficult to prove that no other set is reachable. Thus, ∆(Mk , n) =
1 + n + (n − 1) + (n − 2) + . . . + (n − k).
430
Galina Jirásková
Lemma 12. For all k and j, 0 ≤ k ≤ n − 1, 1 ≤ j < n − (k + 1) there is
a minimal n-state NFA Mk,j over the alphabet {0, 1} such that ∆(Mk,j , n) =
1 + n + (n − 1) + (n − 2) + . . . + (n − k) + j.
Proof. We construct the automaton Mk,j from the automaton Mk in Lemma 11
by adding the transition on reading 0 from the state qk+1 to the set
{q1 , q2 , . . . , qk , qk+1 , qn−j+1 } (note that k + 2 < n − j + 1 ≤ n). All the sets
which were reachable in the subset construction for Mk are also reachable in
the subset construction for Mk,j . Moreover, the following sets (and no other)
are reachable: {q1 , q2 , . . . , qk , qk+1 , qn−j+1 }, {q2 , q3 , . . . , qk+1 , qk+2 , qn−j+2 }, . . . ,
{qj , qj+1 , . . . , qj+k , qn }. Since Mk,j fulfils the conditions (1) and (2) of Lemma 4
it is minimal and ∆(Mk,j , n) = 1 + n + (n − 1) + (n − 2) + . . . + (n − k) + j. Corollary 13. For all n and α such that n ≤ α ≤ 1 + n(n + 1)/2 there is a
minimal n-state NFA over the input alphabet {0, 1} whose equivalent minimal
DFA has exactly α states.
Proof. The case α = n is again trivial. Since 1+n+(n−1)+(n−2)+. . .+2+1 =
1 + n(n + 1)/2, the proof for α ≥ n + 1 follows from the two lemmata above. We have O(n2 ) values of α for which there is a minimal n-state NFA over
the alphabet {0, 1} which needs α deterministic states. We are not able to prove
it for all α, n ≤ α ≤ 2n , although it seems to be true for us. We have verified it
for all n ≤ 8, but for larger n the question remains open.
The last part of the paper we devote to a few notes on the automata over
one-letter alphabet (unary automata). Again, we are interested in the value of
∆(M, n) for a minimal n-state unary NFA M . It has been pointed in [6] that this
value has to be less than 2n . If we consider Moore’s automaton from [6] using
input symbol 1 alone (see Fig. 2) we obtain the automaton whose equivalent
minimal DFA has (n − 1)2 + 2 states [6].√
Further, in [1] it is shown that O(e n ln n ) states are sufficient to simulate
an n-state NFA recognizing a unary language √by a DFA. This implies that
∆(M, n) cannot be between (approximately) e n ln n and 2n for any n-state
unary NFA M . On the √other hand in [1] it is shown that there is a unary n-state
NFA which needs Ω(e n ln n ) deteministic states. For n ≤ 10 we have verified
that for all α such that n ≤ α ≤ (n − 1)2 + 2, there is a minimal n-state unary
NFA whose equivalent minimal DFA
has exactly α states. Whether it is true for
√
larger n and all α between n and e n ln n remains open.
Acknowledgement
I would like to thank Juraj Hromkovič for his comments concerning this work. I
am also grateful to Jozef Jirásek for his helpful computer programs which enable
us to verify some of our conjectures.
Note on Minimal Finite Automata
431
References
1. M. Chrobak: Finite automata and unary languages. Theoretical Computer Science
47(1986), 149-158 422, 430
2. J. Hromkovič: Communication Complexity and Parallel Computing. Springer 1997
422
3. J. Hromkovič, J. Karhumäki, H. Klauck, S. Seibert, G. Schnitger: Measures on
nondeterminism in finite automata. In: ICALP’00, Lecture Notes in Computer
Science 1853, Springer-Verlag 2000, pp.199-210 421
4. K. Iwama, Y. Kambayashi and K. Takaki: Tight bounds on the number of states
of DFA’s that are equivalent to n-state NFA’s. Theoretical Computer Science
237(2000) 485-494 421, 422, 428
5. K. Iwama. A. Matsuura and M. Paterson: A family of NFA’s which need 2n − α
deterministic states. Proc. MFCS’00, Lecture Notes in Computer Science 1893,
Springer-Verlag 2000, pp.436-445 421, 422, 428
6. F. Moore: On the bounds for state-set size in proofs of equivalence between deterministic, nondeterministic and two-way finite automata. IEEE Trans. Comput.
C-20, pp.1211-1214, 1971 421, 424, 430
7. O. B. Lupanov: Uber der Vergleich zweier Typen endlicher Quellem. Probleme der
Kybernetik, Vol.6, pp. 329-335, Akademie-Verlag, Berlin, 1966
8. M. Rabin and D. Scott: Finite automata and their decision problems. IBM J. Res.
Develop, 3, pp. 114-129, 1959 421, 422, 423