Научная статья на тему 'Some more on the equivalent transformation of nondeterministic finite automata. Part II. The “deleting” algorithm'

Some more on the equivalent transformation of nondeterministic finite automata. Part II. The “deleting” algorithm Текст научной статьи по специальности «Математика»

CC BY
63
5
i Надоели баннеры? Вы всегда можете отключить рекламу.
Область наук
Ключевые слова
NONDETERMINISTIC FINITE AUTOMATA / REGULAR LANGUAGES / EQUIVALENT TRANSFORMATIONS / DELETING STATE / THE STARHEIGHT PROBLEM

Аннотация научной статьи по математике, автор научной работы — Melnikov Boris F.

This paper is a continuation of our following previous papers, where we considered some simple algorithms for combining states of the given nondeterministic finite automaton, the reduction some problems related to the star-height to considering automata, and possible classification of the states and loops of the given automaton. In this part of the paper, we shall describe an algorithm which deletes the state of a given nondeterministic finite automaton. This algorithm preserves basic properties of automata, i.e. the languages of the given and the obtained automata are the same, and the value of star-height for the obtained automaton is no more than such value for the given automaton. Like Part I, we consider two states having the same values of the state marking functions. Then we could apply the same algorithms, but, generally speaking, in the case of the initial conditions considered in this part, the application of combining algorithm of previous part increases the value of star-height of the automaton under consideration. Then we should apply another algorithm, we consider such algorithm in this part. We call it by deleting algorithm, because it deletes a state; however, we not only delete a state, but sometimes add some edges, inputs and outputs before deleting. We also consider some examples of using the described deleting algorithm.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «Some more on the equivalent transformation of nondeterministic finite automata. Part II. The “deleting” algorithm»

Some more on the equivalent transformation of nondeterministic finite automata. Part II. The "deleting" algorithm

B.F. Melnikov

Abstract—This paper is a continuation of our following previous papers, where we considered some simple algorithms for combining states of the given nondeterministic finite automaton, the reduction some problems related to the star-height to considering automata, and possible classification of the states and loops of the given automaton.

In this part of the paper, we shall describe an algorithm which deletes the state of a given nondeterministic finite automaton. This algorithm preserves basic properties of automata, i.e. the languages of the given and the obtained automata are the same, and the value of star-height for the obtained automaton is no more than such value for the given automaton.

Like Part I, we consider two states having the same values of the state marking functions. Then we could apply the same algorithms, but, generally speaking, in the case of the initial conditions considered in this part, the application of combining algorithm of previous part increases the value of star-height of the automaton under consideration. Then we should apply another algorithm, we consider such algorithm in this part. We call it by deleting algorithm, because it deletes a state; however, we not only delete a state, but sometimes add some edges, inputs and outputs before deleting.

We also consider some examples of using the described deleting algorithm.

Keywords—nondeterministic finite automata, regular languages, equivalent transformations, deleting state, the star-height problem.

VII. INTRODUCTION TO PART II

(Once more about the motivation)

This paper is the continuation of [1], i.e. Part I. Moreover, as we noted in that part, it can be considered also as a continuation of some our previous papers, i.e. [2], [3], [4], [5] etc. We continue the numeration of sections, equations, definitions, propositions, theorems, tables, and figures, but use new numbers of references and footnotes.

As we said in Part I and in [5], we already reformulated the star-height problem for regular languages in the following way: for the given regular language, we have to construct the equivalent finite automaton having the minimum possible star-height. After that, considering n! bijective "order" functions (n is the number of the states of the "minimum" automaton), we construct corresponding regular expressions and choose one having the minimum possible star-height. Thus, a possible solution of the star-height problem for regular language is constructing such "minimum" automaton.

To build such an automaton, we perform some auxiliary equivalent transformations. The description of such transformations is the main subject of this paper.

Received June 27, 2019.

Boris F. Melnikov, Shenzhen MSU-BIT University (email: bf-melnikov @yandex.ru).

In Part I, we combined two states having the same values of the state marking functions: i.e., for states q' and q'' under consideration we should have

¥#(q') = ¥#(q'') and ^r(q') = v°Kut(q"). (4)

In this part of the paper, we also could apply the same algorithms (because below, both the equations of (4) also hold). However, we shall consider in this part the case, when both (2) and (3)1 do not hold. Therefore, generally speaking, in the case of the initial conditions considered in this part, the application of combining algorithm of Part I (i.e. Theorem 1) increases the value of SH of the automaton under consideration. Then, also generally speaking, the combining algorithm is also applicable, but we should apply another one. We shall consider this algorithm below.

Thus, similarly to Part I, we shall consider an algorithm for equivalent transformation of nondeterministic finite automaton. Also similarly to Part I, we shall not fully describe why we are doing this 2: we are going to give details in some subsequent publications. Let us repeat, that we only describe algorithms for equivalent transformation and prove non-increasing the value of star-height for the obtained automaton.

This paper has the following structure. In Section IX, we consider the first stage of the deleting algorithm: we add some new inputs and outputs (i.e., initial and final states) without changing the language and value SH of the automaton under considerstion. In Section X, we give the second stage of this algorithm: we add some new edges and fulfill the same condition at the same time. In Section XI, we consider the last stage of this algorithm: this is direct deleting the state. In Section XII, we consider some examples for the deleting algorithm.

VIII. Some more on preliminaries

All designations used below were already given in [1], i.e. Part I. However, in Part I, no specific reference to designations ^ and was given (despite these designations were used). This notation can be found in [6] (cited there).

In [7], we explained our use of single and double circles to denote states. In the current paper, only "ordinary" non-deterministic finite automata are used, therefore all states in the figures are represented by double circles.

Remark also, that the terminology related to the graph theory is agreed with [8].

1 As we said before, we continue the numbering of the equations of Part I.

2 "You're far too keen on where and how, but not so hot on why".

IX. THE DELETING ALGORITHM:

THE FIRST STAGE, ADDING THE INPUTS AND OUTPUTS

Thus, in this part of the paper, we also are working with the case when at least two states have the same values of the both state-marking functions, i.e. functions <pm and ipout. Of course, we remove one of these states, namely, one of them that has the greater value of the order function t .

However, the algorithm we are describing is not simple: despite these states have the same values of the both state-marking functions, the different sets of initial/final states may correspond to them. Let us consider a simple example for this thing.

First, consider the "usual" language of the regular expression

(a + ab + ba)*. (5)

Its "usual" nondeterministic automaton is the following:

Figure 4. Automaton for the language of (5)

In the process of the most usual determinisation ([9] etc.), we obtained the automaton given by the following table:

Tab. 3. An equivalent deterministic automaton a b

~ A ~b C

<r- B B D C A -^ D B C

(see [13] and [14, Footnote 1] about total (everywhere-defined) deterministic automata).

By [9] etc., we should combine states A and D for obtaining the canonical automaton. But for this paper, we need example of Tab. 3: we have two different states A and D having the same values of state-marking functions 3, but only A (not D) in an initial state.

Proposition 6: Let L = L(K) and for the state q of automaton (1) (where q e S), condition ^Kn(q) 3 sn holds (by [13], [14], sn is the only initial state of automaton L). Then for automaton

K = ( Q, X,S,S U {q}, F ), (6)

condition L(K') = L(K) holds.

Proof. Evidently, Cju? (q) = L|Ut(q). But, generally speaking,

(q) = Ln(q) u{e},

3 In the usual designations of states of canonical automata L and LR for such language L,

<Pk(a) = <p%(D) = {A} , ^jU'(A) = ^(D) = {X, Y}.

(because, generally speaking, q ^ S). Despite this fact, the following equation is also evident:

Lr>(q) ■ Lp(q) = (Ln(q) U {£}) ■ LKut(q). (7)

Since ^Kn(q) 3 , the following holds:

(3u e )) (Vv e LKut(q)) («« e L).

Besides, because automaton L is deterministic, we obtain, that

(Vu e Lba(L)(sn)) (Vv e LKut(q)) (uv e L). We have sn e ^Kn(q), then e e Lg\(L)(sn), therefore

(Vv e LKut(q))(eveL). The last fact and (7) prove the proposition. □

The following statement about outputs is proved similarly.

Proposition 7: Let L = L(K), and for the state q of automaton (1) (where q e F), condition ^Kft(q) 3 sp holds (sp is the only initial state of automaton LR). Then for automaton

K = ( Q, E,5,S,F U{q} ), (8)

condition L(K') = L(K) holds. □

X. THE DELETING ALGORITHM: THE SECOND STAGE, ADDING THE EDGES

Like previous section, despite two states may have the same values of the both state-marking functions, the different sets of edges may correspond to them. Let us consider two simple examples for this thing.

First, let us continue to consider the automaton of Figure 4 and its language (5). We can also consider the universal automaton (automaton COM) for the same language (about the universal automaton, see details in [10], [11], [12]):

Figure 5. The second automaton for the language of (5)

Based on calculations similar to those in [13], we find that the values of functions of the same name (^>m and ^>out) are the same for two states labelled qi.

Secondly, let us consider the other language of [13], [14].

Its first automaton is given on Fig. 6. The second automaton for the same language is the following:

Figure 7. The second automaton for the second language

Like previous example, the identical states of two automata have the same values of functions and ^>out, but the set of edges of the first automaton is an own subset for the second one.

As we noted above, the algorithm described in this paper is based on the following auxiliary algorithms.

• First, we add the "missing" edges for the state having a smaller value of the order function t (see [5] and Part I of this paper for details of t).

• Secondly, we delete the the state having a greater value of t .

Proposition 8: Let the following objects be given:

• the regular language L;

• some automaton (1) defining L;

• some states qi,q2 € Q, belonging to two different highly connected components of automaton (1).

Let for some states X and B of the equivalent basis automaton BA(L) (we allow possibilities A = B and X = Y) and for some letter a € E, the following hold:

[qi 3 X ] , < 3 B ] and

b4(L)

(9)

(for notation [q 3 q] and corresponding examples, see [6]). Then automaton

K ' = K+( a ) is equivalent to the given one, i.e., the equality

L(K') = L(K )

holds.4

Besides, for each state q G Q the following conditions hold:

¥#(<) = <Pk> (q) and ^K'(q).

(10)

Proof. It is sufficient to prove, that L(K') C L(K). Let us consider any state

y' € ^Kut(q2)

and any corresponding word v', such that

™ (y').

(v')R G £;

Let u be some word of the language £~l(A). We have ua G L|"(B).

(This fact is proved simple; for example, it could be considered as the consequence of [4, Prop.2.1].) Besides, the condition

B G ^fe)

holds, then we obtain, that

uav' G L.

From the last fact, we obtain, that for automaton LR, the condition

(v')Ra glLR(X)

holds. The same fact is true for each state X' g Qp, such that A#X'. Thus,

then for each state

Lr(qi) 3

a' g ^k(qi),

4 Let us remark, that the simultaneous fulfillment of equalities A = B and

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

X = Y is impossible, because we consider two different strongly connected components of (the transition graph of) the basis automaton BA(L).

Let us also remark, that we can reformulate the condition about the difference of the strongly connected components, in the following simpler way: the transition graph of automaton BA(L) has no path from Y to ^ .

there exists some word

u' € Lf(A'), such that u'av' € L; therefore for each word u' € L>(A')

the condition u'av' € L holds.5 The last condition proves the equality L(K') = L(K), which is also explained by the following two facts:

• for each pair of states, i.e.

A' € ^°K(qi) and Y' € ^Kut(q2), and for each pair of corresponding input words, i.e.

u' €Lf(A') and (v')R €£inR(Y'),

condition u'av' € L holds;

• in automaton, the new loops (i.e. the loops, that were absent in the transition graph of automaton K) cannot appear. 6

Thus, L(K') = L. Then for automaton K', the equivalent canonical automaton is L. Therefore we can use notation, associated to L, also for automaton K'; we mean, at first, the use of subsets of their states as values of function (not only for function y>°n). Similarly, automaton LR is equivalent to (K')R, and we can use sets of their states for values of function ^°U,t.

We proved in fact, that

(VA' € ^°n(qi)) (3B' € ^°n(q2)) (A' B') ;

L

5 This fact (i.e. the possibility of replacement in this situation the word "exists" forj'for each") can be considered as a property of the canonical automaton L.

6 The impossibility of new loops is a consequence of the fact that qi and q2 belongs to the different strongly connected components.

Let us also remark, that if we did not impose such a requirement, then the condition L(K') = L(K), generally speaking, was false. However, the more detailed consideration of such examples is not included in the scope of this paper.

av

then

Similarly

(92 ) = dK (q2).

The conditions

dK (9i) = ^Kn(qi) and ^(92) = ^KMi(92), as well as (10) for q G {q1, q2}, are evident.

The non-performance of (12) implies the following fact:

U *(<&) ^ * m . (13)

qe{qm }uTm

The performance of (12) does not guarantee, that the

set

{qm}U Tm

contains a complete X -cyclic state (see [6] for this definition) for the considered states

Definition 6: We shall call such edges q1 —> q2 by inter-component edges.

We shall use this notation in the following papers.

Proposition 9: For the conditions of Proposition 8, the equality

SH(K') = SH(K )

holds.

Proof. In the transition graph of automaton K', there cannot be paths from the state q2 in the state q1 because of the following. If such a path would exist, then we obtain existing of corresponding path of automaton S4(L), i.e.

D A

a path from state Y to state X. And the last existing contradicts to the supposition we make before, i.e., that X and B belongs to different strongly connected components of automaton B4(L).

Thus considering the same order function t (it was given for automaton K) for the new automaton K', we obtain, that SH(K')= SH(K ). □

XI. The deleting algorithm:

THE THIRD STAGE, DIRECT DELETING THE STATE

We shall not explain the initial conditions necessary for the following proposition (as we noted in Introduction). An explanation of the need to fulfill these conditions for the deleting algorithm will be given in one of the following publications.

Proposition 10: Let the following condition hold:

(3i e{1,...,m-1}) (*(q¿) = *(qm)) , (11) and the following condition does not hold:

(3(A,X) G U *(®))((A,X) G *m). (12)

qe{qm}uTm

Then there exists automaton

K' = ( Q \{qm}, \{qm},F \{qm} ),

such that:

• L(K ') = L(K );

• SH(K ') = SH(K );

• for each state q G Q \ {qm}, conditions

¥#(q) = vt'(q) and ^(q) = ^(q)

hold.

Let us consider some important comments to the initial conditions.

• There is convenient to write the second condition as above, that is, as non-performance of (12).

A g Qn and X g Q

p-

Proof. Let us describe the preliminary equivalent transformation of automaton K, consisting of adding some edges.

For this, let bus consider any accepted path of automaton K, passes through the state qm. Let it be the path

k Pi

tí K

ai V P2 - Q2 K akp-l .. =p)

) "K t2 2 b2 - K . . . -> (tfct K ' =t")

\ ci > ) V r2 C2 ^ K ckr-l ... —^ K kr K ,

b'\ K

(14)

where:

• the states ti, t2, ...tkt (these ones only) belong to the strongly connected component which contains the state

qm;

• from the states t1, t2, ...tkt, at least one coincides with

qm;

• we allow the possibility = 0; in this case, the first string of the path (14) is empty, t' is some initial state (it is the first state of this path), i.e. in this case, the edge —^ is being replaced for

• we also allow the possibility kr = 0 (the comments are similar to those above).

Because t1, t2, ...tkt belong to the same strongly connected component, we can consider this sequence as a part of some loop. For instance, we can consider the loop

bkt-1.

bl t b2 K 2 K

bfct+l

K

l(tkt =t")

l(tkn =t') .

(15)

(t'=*i).

bkt bkt +1 bkn-—*ifct+1 ... —

Evidently, there exists a corresponding path of automaton BA(L) (because the automata K and BA(L) accept the same language); let this path (of automaton S4(L)) be A. Also evidently, the loops (15) and A, are, generally speaking, not simple loops.

According to the state qm selection method, there exists some other loop of automaton K, which:

• corresponds to the loop A;

• does not contain the state qm (because all the states of the set Qm are important states).7

7 The important states were defined before.

Let us explain this fact in details, i.e., we explain the existing of the loop of automaton K, possessing the properties described here.

By our suppositions (13), the condition C m holds. Considering

arbitrary pair (A, X) € >t(gm), we obtain that for some I < m, the state qi is a complete ^ -cyclic state.

Then, also by (13), for each loop of automaton BA(L) passing throw state A , there exists a corresponding loop of automaton K, which does not contain other complete ^ -cyclic states. (I.e., the such state is the already selected qi.)

i

(We again used some notation of [6].) Let this loop of automaton K be

(h' = hi) h2

K K

bkh

K

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

(hfct =h'')

bht K

Then the path

hfct+i

bkt+1 K

K

■(hfc„ =h').

(h'=h1 ) h2 v K 2 K

K

(hfct=h'')

(16)

(it also is the part of the last loop) also does not contain the state qm.

For both states h' and h'', the conditions of Proposition 8 hold. Then we can add the edges

p —>■ h K

and h''

K

without changing the accepted language and the star-height of the considered automaton. Thus, we obtain the following accepting path of the obtained automaton:

ai 02 afcp-1/ s

^ Pi V P2 "K ... "K (Pkp =P)

(h'=hi ) h2 ... K v k 2 K

, , Cl C2 ckr-1

(r=ri ) —> r2 —>• ... —> rfcr ^ K K K r

(hfct=h'') K 7 K

X

2

b4(L)

,2

(like before, the first and/or the last strings can be empty), which accepts the same word, like the path (14).

Evidently, we can make such equivalent transformation (which also does not change the value SH of the considered automaton) for each possible pairs t' and t''.8 Then for each word of the considered language, there exists corresponding accepting path, which does not contain the set qm. Thus, we obtain

£(K_,m )= L(K). Moreover, for each state q € Q \ {qm}, equalities

¥>°n(q) = (q) and ^Kut(q) = (q)

are evident. □

XII. SOME EXAMPLES FOR THE DELETING ALGORITHM

Like Part I, we shall continue to consider examples where the sets ^ (and, therefore, # etc.) consist of one element. I.e., by [6, Def.2],

ltf?(q)l = bKut(q)l = 1;

the examples for the sets ^K"(q) and/or ^K't(q) consisting of 2 or more elements are complicated. Also like [6] and Part I, all the examples are special modifications of automaton BA(L) for the language of regular expression (5). First, let us repeat automaton of [1, Fig. 1], see Figure 8. Now, unlike [1], we shall consider the other automaton:

• without an input present in Figure 8 (i.e., the state ^ 1 is now not the initial one);

• without an edge present in Figure 8 (i.e., the edge

Figure 8. The previous automaton (for the language (a + ab + ba)*)

is now absent);9 • the other order function t . For the new automaton and order function, see Figure 9.

Figure 9. The given automaton (for the language (a + ab + ba)*)

We should show, that the values of the two state-marking functions for all states coincide with those shown in the figure. We can do it in the following two ways:

• either complete the procedure of canonization for this automaton (like [13]);

• or for each state for both state-marking functions, strictly prove equality by specifying the "necessary"

8 Generally speaking, there exist infinitely many accepting paths of the 9 We especially designate the transition function as belonging to the

type (14), but the finite number of such states t' and t''. automaton BA(L), although this is not entirely correct.

r

B

input (output) words and additionally proving that there are no "extra" input (output) words.

However, both these ways need a very long time, then we shall apply the following simple method. 10

The inputs, outputs and edges of the automaton of Figure 9 are the own subsets of corresponding sets of the automaton of Figure 8; then both input and output words for all states of Figure 9 are also the own subsets for such ones of Figure 8. We know the state-marking functions for the first automaton; all their values consist of one element. Besides, the automaton of Figure 9 have neither useless nor inaccessible states, then each value of its state-marking function is not empty. Therefore, for each value we have the only possibility, which should be the same as shown in the figure.

We shall look at the last example quite briefly. Deleting the edge

X

1

b4(L)

X

1

b4(L)

instead of

X

2

b4(L)

2,

2

(the last one was already deleted for automaton on Figure 9). The last automaton for this language is depicted on Figure 10; its detailed consideration is beyond the scope of this paper.

ON THE PART III

In Part III, we are going to describe the algorithm for special adding a state. This algorithm will also have the same feature of transformations, i.e. the values of star-height for the obtained automata will be no more than such value for the given automaton.

Let us very briefly say, why we shall consider this case. We shall add not only edges (like combining case of Part I), but also states. The meaning of this addition is not the "urgent" combining states; we "improve the structure" of the automaton under consideration; this will help to subsequently apply one of the algorithms discussed in the first two parts. In other words, even the "adding" algorithm does not "complicate" the considered automaton; the details will be described later.

REFERENCES

[1]

leads to almost the same comments that we had for the previous automaton. However, in this case, we can also consider a new inter-component edge

[2]

[3]

[4]

И

[6]

[7]

[8] [9]

Figure 10. The last automaton (for the language (a + ab + ba)*)

10 Sometimes, we use this method in the computer programs, for example, in heuristic algorithms checking the equivalence of two automata, obtained by transformation of basis automata. However, this topic is beyond the scope of this paper.

Melnikov B. An approach to the classification of the loops of finite automata. Part I: Long corresponding loops // International Journal of Open Information Technologies. 2019, vol.7, no.4, pp. 1-S. Melnikov B., Melnikova A. Some properties of the basis finite automaton // The Korean Journal of Computational and Applied Mathematics (Journal of Applied Mathematics and Computing). 2002, vol. 9, no. 1. pp. 13S-1S0.

Melnikov B., Sayfullina M. 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=1174 9888) Melnikov B. Extended nondeterministic finite automata // Fundamenta Informaticae. 2010, vol. 104, no.3, pp.2SS-26S. 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-S.

Melnikov B., Melnikova A. An approach to the classification of the loops of finite automata. Part II: The classification of the states based on the loops // International Journal of Open Information Technologies. 2018, vol.6, no. 11, pp. 1-6.

Melnikov B., Melnikova A. Pseudo-automata for generalized regular expressions // International Journal of Open Information Technologies. 2018, vol.6, no. 1, pp. 1-8.

Harary F. Graph Theory. Addison Wesley (Boston), 1969, 274 p. Aho A., Ullman J. The Theory of Parsing, Translation, and Compiling, Vol. 1: Parsing. Prentice Hall (NJ), 1972, S60 p.

[10] Melnikov B., Sciarini-Guryanova N. Possible edges of a finite automaton defining a given regular language // The Korean Journal of Computational and Applied Mathematics (Journal of Applied Mathematics and Computing). 2002, vol. 9, no. 2. pp. 47S-48S.

[11] PolakL. Minimizations of NFA using the universal automaton // International Journal of Foundations of Computer Science. 200S, vol. 16, no. S. pp. 999-1010.

[12] Lombardy S., Sakarovitch J. The Universal Automaton // Logic and Automata, Texts in Logic and Games, Amsterdam Univ. Press. 2008, vol. 2, pp. 4S7-S04.

[13] 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.

[14] Melnikov B. The complete finite automaton // International Journal of Open Information Technologies. 2017, vol. S, no. 10, pp. 9-17.

Boris Feliksovich MELNIKOV,

Professor of Shenzhen MSU-BIT University, China

(http://szmsubit.ru/),

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, ORCID: orcidID=00 0 0-0 0 02-67 65-68 0 0.

B

B

B

i Надоели баннеры? Вы всегда можете отключить рекламу.