An approach to the classification of the loops of finite automata. Part I: Long corresponding loops
B. F. Melnikov, A. A. Melnikova
Abstract—In this paper, we considered questions of the possible classification of the states and loops of a nondeterministic finite automaton.
For the development of algorithms for equivalent transformation of nondeterministic finite automata, we consider the basis finite automaton for the given regular language and the paths and loops of its transition graph. We also consider the paths and loops of the transition graph of another nondeterministic automaton that defines the same language. On the basis of this, we define corresponding paths and loops of two mentioned automata and the questions of their classification. This classification gives, for example, the possibilities for describing some heuristic algorithms for minimization of nondeterministic automata.
For the last thing, we describe the following objects. For each state of the basis automaton, we consider the states of the given automaton corresponding to this state of the basis automaton, and give their classification as a function of the loops passing through the same state of the basis automaton. Their subset is the set of so-called including loops, on the basis of which we determine so-called partially complete loops. For any chosen vertex of the basic automaton, we call the vertices of the considered nondeterministic automaton, through which all possible partially complete loops pass, by complete cyclic states.
At the end of the paper, we formulate the hypothesis that if for any state of the considered nondeterministic automaton, there exists at least one corresponding state of the basis automaton, such that the first one is a complete cyclic state for the second one, then all the corresponding states of the basis automaton are such ones.
In the presented Part I of the paper, we consider the issues related to corresponding loops of the given nondeterministic automaton and equivalent basis automaton.
Keywords—nondeterministic finite automata, basis automaton, transition graph, path, loop, algorithms for equivalent transformation, universal automaton.
I. INTRODUCTION AND MOTIVATION
We continue the series of papers of equivalent transformation of nondeterministic finite automata (NFAs); let us mention some of them: [1]-[7]. One (but not the only) goal of such publications is the description of algorithms for NFA-minimization. Speaking of this, we mean simultaneously some following dichotomies (trichotomies, etc.).
• The search for an equivalent automaton with a minimum number: - of states, see [8], [9] etc.;
Received August 14, 2018.
Boris F. Melnikov, Russian State Social University (email: bf-melnikov@ yandex.ru).
Aleksandra A. Melnikova, National Research Nuclear University "MEPhI" (email: [email protected]).
- of edges, see [2], [4] etc.;
- or of the star-height value, see [10], [11] etc. More than that, it is possible to minimize by some mixed criteria; we are going to consider such options for minimization in one of the following publications.
• We consider both exact and heuristic algorithms; and among the last ones, we consider:
- "usual" heuristic algorithms;
- and so-called anytime algorithms, [12] etc.
It is important to note, that for all resulting classes of algorithms, we use the same auxiliary algorithms of equivalent transformation of NFA.
In this paper, we continue to consider the basis finite automaton for the given regular language, and also the paths and loops of its transition graph. We also consider the corresponding paths of the transition graph of some NFA that defines the given language.
Considered in this paper questions of the possible classification of the states and loops of a NFA give additional possibilities for describing algorithms mentioned before. For this thing, we consistently describe the following objects.
• For each state of the basis automaton, we consider the states of the given automaton corresponding to this state of the basic automaton. We give their classification as a function of the loops passing through them corresponding to the same state of the basis automaton.
• Then we formulate two special properties of the automaton K related to all their states; for different NFAs defining the same regular language, these properties can either be fulfilled or not fulfilled.
• The special subset of loops of the given automaton corresponding to the same state of the basis automaton is the set of so-called including loops.
• On the basis of the last definition, we determine so-called partially complete loops.
• For any chosen vertex of the basic automaton, we call the vertices of the considered nondeterministic automaton through which all possible partially complete loops pass, by complete cyclic states.
• At the end of the paper, we formulate the following hypothesis. If for any state of the considered NFA, there exists at least one corresponding state of the basic automaton, such that the first one is a complete cyclic state for the second one, then all the corresponding states of the basic automaton are such ones.
These objects and hypothesis are the main subject of this paper.
Like [11], the parts of the subject of this paper have been already published in Russian, see [6], [13]. However, due to the termination of Samara State University in 2015, the website of the electronic journal [13] is now unavailable, and in [6], we published only a little part (i.e. the material of Section III of this paper). Besides, this paper is the only English presentation of this subject, and we are going to use the objects introduced here in further publications.
II. Preliminaries
The main designations used in this paper were described in detail in [4], [6], [7]; let us repeat very briefly the most basic and important of them.
A nondeterministic finite automaton is a 5-tuple
K = ( Q, E,S, S,F ),
and
L = (Qn, £, Sn, {sn}, Fn)
LR = (Qp, E,S„, {sp}, Fp).
i.e.
Vk : Q ^ P(Qn) and
binary relation # Ç Qn x Qp; the basis automaton
V>T : Q ^ P(Q
p)i
BA(L) = (Q, E,S, S,F);
A
Some examples of the defined objects were given in [4], [7]. Let us consider one of examples once again.
Let us consider the language accepted either by automaton given on Fig. 1 ...
(1)
where:
• Q is the set of states of K;
• E is the considered alphabet;
• S : Q x E ^ P(Q) is the transition function (P is the set of subsets); we shall consider automata without e-transitions only;
• S,F C Q are the sets of initial and final states respectively.
Sometimes, to denote the transition from state q1 to state q2 in accordance with the transition function S, we shall use notation
a
q i q2.
0
And like [6] (and unlike [4]), we shall not denote the language of an automaton K by L; the details can be read in [6], however, this paper can be read without these details.
We shall denote the canonical automata for languages L and LR (the last one is the mirror language for L) by
Fig. 1
... or by equivalent automaton in canonical form given on Fig. 2.
Fig. 2
And the following Fig. 3 and Table 1 (see also [4, Tab. 12]) show corresponding automaton LR . . .
Let us list the remaining notation defined for automaton (1) in [4], [6], [7] (see the details in these papers):
• the input and output languages of state q G Q, notation LKn(q) and C°IUt(q);
• state-marking functions
Fig. 3
and binary relation # for the considered language:
Tab. 1
(2)
# X Y Z U
A - # # -
B # - # -
C # # # #
D # # # -
for its state q= A G Q, we shall write a(q) = A and
¡3(q) = X.
• if for some two states q G Q (of automaton (1)) and q = A G Q (of automaton (2)), we have
<p%(q) 3 a(q) and ^(q) ^ ¡3(q) ,
then we shall write [q 3 q];
• the universal automaton COM(L), see [5], [14]. Note that in the works cited above, we also give the algorithms for constructing all these objects; certainly, the algorithms are based on the given regular language L only.
We also obtain the following automaton BA(L), see Tab. 2 below. Remark that it was not considered in [4], and was considered in [7]; we repeat the table of the last paper. Also, for the usability, we write
A x
instead of A#X,
etc. Also we do not write symbols of sets (braces), i.e., we write
A#X, A#Y instead of { A, A },
etc.
Tab. 2
BA(L) a b
^ A#Y B#Z, B#X C#U
^ A#Z - C#Y, C#Z, C#X
^ B#X - -
B#Z - D#Y, D#Z, D#X
D#Y B#Z, B#X C#U
^ C#X - -
C #Y C#Z, C#X C#U
C #Z - C#Y, C#Z, C#X
C#U C#Y, C#U -
^ D#X - -
D#Z - C#Y, C#Z, C#X
III. PATHS OF THE BASIS AUTOMATON AND CORRESPONDING PATHS OF AN EQUIVALENT AUTOMATON
In this section and following ones, we consider a "natural" correspondence between loops of some automaton (1) defining the given regular language L and equivalent basis automaton BA(L). As we said before, a part of the material in this section was already published in Russian in [6].
For the considered language L and its basis automaton BA(L) (2), let us consider the transition function S of BA(L) as the set of its edges
A = {Si = (pi,ai,ri) |
Pi,ri e Q, ai e E, S (pi, ai) 3 h, i e {1,...,m}}
(where m is the number of edges of automaton (2)). Thus, we have numbered ("colored") the edges of automaton BA(L).
And the transition function of automaton (1) can also be considered as the set of edges
A = {ej=(Pj ,aj ,rj) 1
Pj,rj € Q, ajeE, S(pj,aj)3rj, je{1,...,m}}
(where m is the number of edges of automaton (1)).
Let us mark each edge of automaton (1) by a set of possible (already used) "colors", i.e., let us consider function
Q : A ^ P(A )
constructed in the following way. For the edge
= (Pj
j ),
[Pj 3 pi] ; aj =
[rj 3 ri].
v = (vi,...,eufi),
(3)
of automaton K. The value n is the same as in (3) (remember that both K and BA(L) do not contain e-edges), and its k-th edge is
ek = (Pk, ak, rfc)
for each possible k. Let us say, that this path corresponds to v, if for each k e {1,..., n},
Q(ek) 3 S^ .
(I.e., if each edge can be "colored by the color" of the edge of path v with the same number.) We shall also say, that for such paths, the states pvk and pvk are corresponding for each
k e {1,... ,n}.
Let us consider some examples. Consider the language which can be defined by regular expression
(a + ab + ba)*
(5)
we set Q(ej) 3 êj (where i G {1,..., m}) if and only if the following conditions hold:
Let us consider the set of paths of automaton BA(L); it is important to remark, that we consider not only simple paths. We can denote a path of automaton (2) by ê and consider it as the sequence
where n is the number of its edges. Its k-th edge ek will be denoted by
^fc = (pfc, afc, rk)
(k e {1,..., n}). Certainly, pkk+1 = rkk for each possible k.
For the path (3), let us define the set of v-corresponding paths of automaton K. Thus, consider a path
Let us now consider the graphical description of the following automata.
• L, see Fig. 4 below. Remark that in this example, we have L = LR. Therefore considering Fig. 4 and changing marks A, B and C for X, Y and Z respectively, we obtain automaton LR.
Fig. 4
BA(L), see Fig. 5:
= (e
)
(4)
Fig. 5
e
a-, r
j
a
V
V
e
l
The equivalent automaton K, see Fig. 6 below. Like the agreements of [7], we write here also the values of state-marking functions.
Fig. 6
For example, let us consider only two the following edges of automaton BA(L): the "green" edge
A a B
and the "blue" edge
Y i X
B a B
Y Ä
A a B a B b A
Y * Y s X s Y .
We shall use this loop in some next examples.
(6)
Fig. 7
Remark that we can think here, that automaton on Fig. 7 is simultaneously:
• L;_
• (Lr)r (changing mark A for X);
• BA(L) (changing mark A for X).
This automaton defines the whole language E* (we can think that E = {a, b}). And both the states of equivalent automaton K on Fig. 8 ...
Therefore (Fig. 6), the following edges of automaton K (and only they) can be "green":
a a a
qi -T qi , qi -T q2 and q3 -T qi ,
On On On
and the following edges (and only they) can be "blue":
aa
qi -t qi and qi -t q2.
On On
Therefore we obtain, e.g., that the edge
a
qiqi
can be "colored" in both "green" and "blue" colors (and, maybe, in some other ones).
Let us also remark, that the set of simple loops of automaton BA(L) includes the loop
Fig. 8
have the same values of vK
■m and vT (i.e., {A} and
{B} respectively), but neither of states of K has both loops corresponding to the loops of BA(L) with labels a and b.
V. LONG CORRESPONDING LOOPS
Let us define long loops. Firstly, let a path (3) defined in Section III be the loop. Then let us define its n-loop (i.e., long loop) for each n > 1 in the usual way.
Definition 1: For n > 1, the n-loop of the loop q =
(e\,..., en) is defined by
(el
êpn )
(7)
where for each possible i (i.e., i G {1,..., (n-1)-£}) we think that
'i+n'
□
IV. The first property of an automaton
In the example considered before, for each state XA of BA(L) there was a corresponding state of K containing all the corresponding loops. In other words, the following fact held in previous example.
Property 1: For each state X of BA(L), there exists a state q of K (where [q 3 X ]), such that for each loop v of state X, there exists a loop of K corresponding to v. □
The next example shows, that there exist some automata where Property 1 does not hold.1 Thus, let us consider such example briefly, the considered automaton is given on Fig. 7:
1 In the next sections, also in Part II, we shall consider some other examples for this thing. Certainly, for each such example, K has to contain a path corresponding to v.
For this definition, let us remark the following things. Firstly,
-vn _ -vn
Pi •
Secondly, we used notation e, z>, etc; but we can assume, that we defined such long loops not only for basis automaton, but also for each automaton (for example, for the given automaton (1)).
For such long loops, we consider corresponding paths of automaton (1) as we did in Section III. We shall call such path
v — (e1,..., en-n)
(8)
by "long n-path" of automaton (1) corresponding to loop (3) of automaton (2).
By [15], path (8) is a loop if rn n = pl[; then we shall call it by (long) n-loop. (In fact, we have already considered some examples of such long loops in previous section.)
Let us consider once again regular language defined by (5) and its automaton BA(L) on Fig. 5. We describe the possible method of duplicating the loop. Let us remark in advance,
b
a
n
n
n
that we can simply consider Fig. 11 only (i.e., consider it as the given automaton), proving the equivalence of that automaton and automaton on Fig. 9.
marking a state means the mark
Thus, let us add the duplicate of the loop (6); we obtain automaton on Fig. 9. Then using a simple operation (see Fig. 10, heavy and deleted lines there), we change:
• edse (AX(B), f°redse (AX(B)2
(remark that we cannot use the notation S for transition function here, therefore we simply omit the name of this function);
• edge ( A)2 ^ (B), >oredge (A)2 -A (!
and obtain automaton on Fig. 11. (We think, that there is no need to describe such operation detailed.)
Fig. 9
(Remark also, that on the three following figures considered in this section, the right numbers mean indices: e.g., the notation
A1
Y 1
Certainly, the values of state-marking functions of such states are {A} and {Y}; such facts also can be simply proved.)
Fig. 11
The last automaton has, e.g., the long loop
i vX/1 corresponding to the long loop
A Y
B Y
B X
A Y
B Y
Y
B X
A Y
Fig. 10
of the given basis automaton BA(L).
We shall continue to consider the last automaton in Part II of this paper.
VI. The second property of an automaton
Let us complicate the condition formulated in Section III. Thus, in the examples considered before (automata on all the figures considered before, excepting Fig. 8), the following condition held: for each state X of BA(L), there was a corresponding state of K containing all the corresponding long loops. (Recall that before the similar condition, i.e. Property 1, for corresponding loops only, not for long loops.) In other words, the following fact held in all previous examples of Section V.
Property 2: For each state X of BA(L), there exists a state q of K (where [q 3 X ]),
i
i
2
2
A
i
such that for each loop v of state X,
there exists a number n > 1,
such that there exists a q-loop corresponding to v'
□
However. the considered before automaton on Fig. 8 shows, that there exist some automata where this fact also does not hold. (As before, K contains a path corresponding to v n for each n > 1.) And the following simplest Table 3 shows all the possibilities of fulfilling or not fulfilling the formulated properties for NFAs and corresponding examples of the automata considered before.
Tab. 3
Automaton Property 1 Property 2
Fig. 7 + +
Fig. 11 - +
Fig. 8 - -
In the following proposition, we consider the first of the properties of corresponding loops.
Proposition 1: For each loop of automaton BA(L) there exists n > 1, and for it there exists a corresponding n-loop of automaton K.
(Notice that we do not require that the given loop of automaton BA(L) is simple.)
Proof. Consider a loop
v = (êi,...,ên)
of automaton BA(L), starting and finishing in state
P 1 = r n .
Let v be its label (v = e, because BA(L) has no e-edges), let also
u GLAWPf) and w G£gf(L)(rf);
remark that uviw G L for each i > 0.
Let n be greater than the number of states of automaton K. Consider word
x = uvnw G L;
because automaton BA(L) is unambiguous, it accepts x passing (n times) loop q. Automaton K is equivalent (i.e., it defines L), then it accepts x.
Consider one of possible paths for automaton K defining x; by definition, some its sub-paths correspond to considered loop q of automaton BA(L). For this path of K, consider the set of states passed before reading the first letter of v in the word x; we have n such cases of reading v. Because the number of states of automaton K is less than n, we obtain the coincidence for at least 2 states of this set, and, therefore, the existence of corresponding long loop. □
We shall continue to consider long corresponding loops in Part II of this paper. Besides, we shall consider there some other properties of the states and loops of an arbitrary finite automaton, completing our approach to their classification. We also shall define so-called including loops, partially complete loops and complete cyclic states, consider some their properties and formulate an important hypothesis about
them; in Introduction, we already gave brief information on these objects.
Remark in the conclusion of Part I, that in [6] we also considered cases, when a NFA defines not the given language (i.e., language of BA(L) according to the terminology used here), but some its own subset; in both parts of this paper, we shall not consider these issues.
References
[1] Melnikov B. and Vakhitova A. Some more on the finite automata. The Korean Journal of Computational and Applied Mathematics (Journal of Applied Mathematics and Computing). 1998, vol.5, no.3. pp.495-506.
[2] Melnikov B. and Melnikova A. Edge-minimization of non-deterministic finite automata. The Korean Journal of Computational and Applied Mathematics (Journal of Applied Mathematics and Computing). 2001, vol. 8, no. 3. pp. 469-479.
[3] Melnikov B. and Sayfullina M. O nekotoryh algoritmah ekviva-lentnogo preobrazovaniya nedeterminirovannyh konechnyh avtoma-tov [On some algorithms for the equivalent transformation of nondeterministic finite automata]. Izvestiya of Higher Educational Institutions. Mathematics. 2009, no. 4, pp. 67-72. (in Russian, https://elibrary.ru/item.asp?id=11749888)
[4] Melnikov B. Once more on the edge-minimization of nondeterministic finite automata and the connected problems. Fundamenta Informaticae. 2010, vol. 104, no. 3. pp. 267-283.
[5] Dolgov V. and Melnikov B. Postroenie universal'nogo konechnogo avtomata . . . [The construction of a universal finite automaton. Part I: From theory to practical algorithms]. Vestnik of Voronezh State University. 2013, no. 2, pp. 173-181. (in Russian, https://elibrary.ru/item.asp?id=2 02 67 92 4)
[6] Dolgov V., Melnikov B. and Melnikova A. Cikly grafa perehodov bazisnogo avtomata . . . [Loops of the transition graph of a basic automaton and related questions]. Vestnik of Voronezh State University. 2016, no. 4, pp. 95-111. (in Russian, https://elibrary.ru/item.asp?id=27257800)
[7] Melnikov B. The complete finite automaton. International Journal of Open Information Technologies. 2017, vol.5, no. 10. pp.9-17.
[8] Melnikov B. A new algorithm of the state-minimization for the nonde-terministic finite automata. The Korean Journal of Computational and Applied Mathematics (Journal of Applied Mathematics and Computing). 1999, vol.6, no.2. pp.277-290.
[9] Geldenhuys J., van der Merwe A. and van Zijl L. Reducing Nonde-terministic Finite Automata with SAT Solvers. Proceedings of 8th International Workshop on Finite State Methods and Natural Language Processing, Lecture Notes in Artificial Intelligence. July 2009, vol. 6062, pp. 81-92.
[10] Kirsten D. Distance desert automata and the star height problem. Informatique Theorique et Applications. 2005, vol.39, no.3. pp.455509.
[11] Melnikov B. The star-height of a finite automaton and some related questions. International Journal of Open Information Technologies. 2018, vol.6, no.7. pp. 1-5.
[12] Bender E. Mathematical Methods in Artificial Intelligence. Wiley-IEEE Computer Society Press (Los Alamitos), 1996, 656 p.
[13] Melnikov B. O zvyozdnoy vysote regulyarnogo yazyka ... [On the star-height ofa regular language. Part II: Auxiliary constructions]. Heuristic algorithms and distributed computations. 2014, no. 2, pp. 69-81. (in Russian, https://elibrary.ru/item.asp?id=22030666)
[14] Lombardy S. and Sakarovitch J. The Universal Automaton. Logic and Automata, Texts in Logic and Games, Amsterdam Univ. Press. 2008, vol. 2, pp. 457-504.
[15] Harary F. Graph Theory. Addison Wesley (Boston), 1969, 274 p.
Boris Feliksovich MELNIKOV, Professor of Russian State Social University
(http://www.rgsu.net/), email: [email protected], mathnet.ru: personid=27967, elibrary.ru: authorid=15715, scopus.com: authorId=55954 04 030 0.
Aleksandra Aleksandrovna MELNIKOVA,
Associated Professor (Docent)
of National Research Nuclear University "MEPhI"
(https://mephi.ru/),
email: [email protected],
elibrary.ru: authorid=14 3351.