On A. V. Anisimov's problem for finding a polynomial algorithm checking inclusion of context-free languages in group languages

The work investigates the problem of whether a context-free language is a subset of a group language. A.~V. Anisimov has shown that the problem of determining the unambiguity of finite automata is a special case of this problem. Then the question of …

Authors: Krasimir Yordzhev

On A. V. Anisimov's problem for finding a polynomial algorithm checking inclusion of context-free languages in group languages
On A. V. Anisimo v’s problem for finding a p olynomial algorithm c hec king inclusion of con text-free languages in group languages Krasimir Y ordzhev T rakia Univ ersity , Stara Zagora, Y ambol, Bulgaria Email address: krasimir.y ordzhev@gmail.com Abstract The w ork in vestigates the problem of whether a context-free language is a subset of a group language. A. V. Anisimo v has shown that the problem of determining the unambiguit y of finite automata is a sp ecial case of this problem. Then the question of finding p olynomial algorithm v erifying the inclusion of context-free languages in group languages nat- urally arises. The article fo cuses on this open problem. F or the purpose, the pap er describes an unconv entional metho d of description of context- free languages, namely a representation with the help of a finite digraph whose arcs are labelled with a sp ecially defined monoid U . Also, we de- fine a semiring S U whose elements are the set 2 U of all subsets of U and with op erations - pro duct and union of the elements of 2 U . The describ ed algorithm executes no more than O ( n 3 ) op erations in S U . 1 In tro duction The work is a contin uation and significant improv emen t of the results obtained in the publication [22]. Let G b e a group with the iden tity e and with the set of generators Σ = X ∪ X ′ = { x 1 , x 2 , ..., x m } ∪ { x ′ 1 , x ′ 2 , ..., x ′ m } , X ∩ X ′ = ∅ (1) and the set of defining relations Θ such that { x i x ′ i = x ′ i x i = e | i = 1 , 2 , . . . , m } ⊆ Θ . (2) Definition 1.1 If L ( G ) = { ω ∈ Σ ∗ | ω ≡ e ( mo d G ) } ⊆ Σ ∗ , then L ( G ) we wil l c al l a gr oup language r epr esenting G , wher e Σ ∗ is a fr e e monoid over Σ and e is the identity in G . 1 A. V. Anisimo v in tro duces the concept of group language in [2]. In just cited article, Anisimov prov ed that L ( G ) is regular if and only if the group G is finite (See also [4, Theorem 5.17]). A somewhat different definition of the concept of group language is given in [12], namely a regular language whose syntactic monoid is a finite group. In our w ork, we will s tic k to the first definition given b y A.V. Anisimo v. In [3] A. V. Anisimo v has show ed that the problem of determining the unam- biguit y of finite automata is a sp ecial case of the problem of determining whether a con text-free language is a subset of a group language. Then the problem of finding p olynomial algorithms verifying the inclusion of con text-free languages in group languages naturally arises. This problem is solved in its particular cases for regular and linear languages (whic h are sp ecial cases of con text-free languages) in [22], where it is shown that the inclusion of a regular or a linear language in a group language can be decided in p olynomial time. In [3] A. V. Anisimov gives an algorithm to chec k whether the inclusion L ⊆ L ( G ) is true. Unfortunately , this algorithm is not polynomial. The aim of the presen t work is to describe a p olynomial algorithm that solv es the problem formulated by A. V. Anisimov for an arbitrary con text-free language. 2 Preliminaries Let Σ b e a finite and non-empt y set, which we will call alphab et . The elements of this set we will call letters . W e will call a wor d over the alphab et Σ each finite string of letters from Σ. A word that do es not con tain any letter is called an empty wor d , which we will mark with ε . Σ ∗ denotes the fr e e monoid with the iden tity ε , i.e. the set of all words o ver Σ, including empt y set with op eration c onc atenation . Σ + = Σ ∗ \ { ε } . The term length of a wor d refers to the num b er of letters in it. The length of the w ord α will b e expressed by | α | . By definition | ε | = 0. Eac h subset L ⊆ Σ ∗ is called formal language (or only language ) ov er alphab et Σ. According to [14] a c ontext-fr e e gr ammar Γ we will call the triple Γ = ⟨N , Σ , Π ⟩ , where N , Σ are finite sets of non terminals and terminals, respectively , N ∩ Σ = ∅ and Π is a finite subset of the Cartesian pro duct N × ( N ∪ Σ) ∗ , whose elemen ts are called pr o ductions or rules . The elemen ts of Π are denoted A → ω , where A ∈ N , ω ∈ ( N ∪ Σ) ∗ . The notation A ⇒ ω indicates that there exists a sequence A → α 1 A 1 β 1 , A 1 → α 2 A 2 β 2 , . . . , A t − 2 → α t − 1 A t − 1 β t − 1 , A t − 1 → γ , where A i ∈ N and α i , β i ∈ ( N ∪ Σ) ∗ for ev ery i = 1 , 2 , . . . t − 1, γ ∈ ( N ∪ Σ) ∗ and ω = α 1 α 2 · · · α t − 1 γ β t − 1 β t − 2 · · · β 1 . This sequence is called a derivation with length t. Let Γ = ⟨N , Σ , Π ⟩ b e a context-free grammar an let A ∈ N . Then the set L (Γ , A ) = { α ∈ Σ ∗ | A ⇒ α } is the c ontext–fr e e language generated b y the grammar Γ with the starting symb ol A . Throughout this article, we will assume that every nonterminal symbol A ∈ N is essen tial, i.e. L (Γ , A )  = ∅ for every A ∈ N . 2 It is w ell kno wn [6, 19, 20] that any context-free language can b e gener- ated b y some grammar in Chomsky normal form , i.e. a grammar in whic h all the productions hav e the form A → B C or A → a , where A, B , C ∈ N are non terminals and a ∈ Σ is a terminal. Let M b e a finitely generated monoid with the set of generators Σ, the set of defining relations Ψ, unit elemen t e and with decidable word problem. Then the set of w ords L ( M ) = { ω = a i 1 a i 2 . . . a i k ∈ Σ ∗ | ω = e is satisfied in M } (3) w e will call a monoidal language , which specifies the monoid M . The monoid M is sp ecified by a con text-free language, if the relev an t monoidal language L ( M ) is context-free. The monoid M in this case is called a c ontext-fr e e monoid . In the case, that the monoid M has the set of generators (1) and the set of defining relations Ψ = { x i x ′ i = e | i = 1 , 2 , . . . , n } , (4) then L ( M ) is called r estricte d Dyck language on the 2 n letters fr om Σ, which w e will denote b y D 2 n . In this case, x i is called an op ening br acket and x ′ i is the corresp onding closing br acket . F or more information on automata and language theory w e refer the reader to [1, 8, 13]. F or the mathematical foundations and algebraic approach of formal language theory w e refer to [14, 18]. F or the connections b et ween formal lan- guage theory and group theory we recommend the source [4]. A list of problems related to the discussed in this paper topics is given in [9]. Let L b e a context-free language and let p and q b e the constan ts of the pumping lemma ( xuw v y -theorem) for L (see [8, Lemma 3.1.1], [13, Theorem 7.18], or [19, Theorem 5.3] ). W e define the sets: Ω 1 = { ω ∈ L | | ω | ≤ p } ; Ω 2 = { uwv w ′ | | uw v | ≤ q , uv  = ε, ∃ A ∈ N : A ⇒ uAv , A ⇒ w } ; W 1 = Ω 1 ∪ Ω 2 . The following theorem is pro ved in [3]: Theorem 2.1 (A. V. Anisimov [3]) L et L b e a c ontext-fr e e language and let G b e a gr oup with the set of gener ators (1), and the set of defining r elations Θ satisfying the c ondition (2). Then L ⊆ L ( G ) if and only if W 1 = Ω 1 ∪ Ω 2 ⊆ L ( G ) . 2 Theorem 2.1 giv es an algorithm to chec k whether the inclusion L ⊆ L ( G ) is true. Unfortunately , this algorithm is not polynomial. The works [22] mo dify Anisimo v’s algorithm so that it w orks p olynomially in sp ecial cases when L is a regular or a linear language. Recall that a dir e cte d gr aph (or digr aph for short) D is a pair D = ⟨ V , R ⟩ where V is a nonempty set, and R is a multiset of ordered pairs of elemen ts from V . The elements of V are the vertic es (or no des ) of the digraph D , the 3 elemen ts of R are its ar cs (or oriente d e dges ). An arc whose b eginning coincides with its end is called a lo op . A walk of length t in a digraph D = ⟨ V , R ⟩ is a sequence ρ 1 ρ 2 . . . ρ t of arcs ρ i , such that ρ i ∈ R , i = 1 , 2 , . . . t and the end of ρ i coincides with the begin of ρ i +1 , i = 1 , 2 , . . . t − 1. A walk whose b eginning coincides with its end is called a cycle. F or more details on graph theory see [7, 10] for example. The widespread use of graph theory in different areas of science and tec hnol- ogy is well known. F or example, graph theory is a go o d tool for the mo delling of computing devices and computational pro cesses and in some non-traditional areas, such as so cial science or mo delling some pro cesses in education and other h umanitarian activities [11, 15, 16]. So, many of graph algorithms ha ve been dev elop ed [21]. A tr ansition diagr am is a 4-tuple H = ⟨ V , R, S , l ⟩ , where ⟨ V , R ⟩ is a directed graph with the set of v ertices V and the multiset of arcs R ; S is a semigroup whose elemen ts will b e called lab els and l is a mapping from R to S , which we will call lab eling mapping . If π = p 1 p 2 · · · p k is a walk in H, p i ∈ R , i = 1 , 2 , . . . k suc h that the end of p i coincides with the begin of p i +1 , i = 1 , 2 , . . . k − 1, then l ( p 1 p 2 · · · p k ) = l ( p 1 ) l ( p 2 ) . . . l ( p k ) . If P is a set of walks in H , then l ( P ) = [ π ∈ P l ( π ) = { ω ∈ S | ∃ π ∈ P : l ( π ) = ω } . 3 A graph represen tation of con text-free lan- guages A classic example of the represen tation of con text-free languages using finite digraphs is the transition diagram of pushdown automaton - recognizer of the corresp onding con text-free language. The pap er [23] describes a qualitativ ely new recognizer of con text-free languages, based on some op erations from graph theory . In the present article, w e contin ue the work started in the mentioned ab o v e paper b y improving the model and making it more user-friendly by adding new features and new useful to ols. Definition 3.1 L et Σ and N b e finite sets, Σ ∩ N = ∅ and let Σ ∗ b e the fr e e monoid over Σ with the identity ε , wher e ε is the empty wor d. We define the set N ′ = { A ′ | A ∈ N } , N ′ ∩ N = ∅ . We define the monoid T with the set of gener ators N ∪ N ′ ∪ { e } , the identity e and the set of defining r elations AA ′ = e, X e = eX = X , A ∈ N , A ′ ∈ N ′ , X ∈ N ∪ N ′ . (5) 4 L et U = Σ ∗ × T = {⟨ α, ω ⟩ | α ∈ Σ ∗ , ω ∈ T } . In U we define the op er ation ⟨ α 1 , ω 1 ⟩ ◦ ⟨ α 2 , ω 2 ⟩ = ⟨ α 1 α 2 , ω 1 ω 2 ⟩ , (6) wher e α 1 , α 2 ∈ Σ ∗ , ω 1 , ω 2 ∈ T . It is e asy to se e that U with the op er ation define d ab ove is a monoid with unity element 1 U = ⟨ ε, e ⟩ . (7) Ob viously if ω ∈ T , then ω = e ⇐ ⇒ ω ∈ D 2 n , where n = |N | and D 2 n is restricted Dyck language on the 2 n letters from N ∪ N ′ . Definition 3.2 L et Γ = ⟨N , Σ , Π ⟩ b e a gr ammar in Chomsky normal form. L et U b e the monoid define d by Definition 3.1. We c onstruct the tr ansition diagr am H Γ = ⟨ V , R, U , l ⟩ with the set of vertices V = N ∪ { Z } , Z / ∈ N and the multiset of arcs R ⊆ n − − → AB | A, B ∈ V o . We lab el the ar cs of H Γ using the function l : R → {⟨ a, e ⟩ | a ∈ Σ } ∪ {⟨ ε, Y ⟩ | Y ∈ N ∪ N ′ } ⊂ U . Each ar c in H Γ satisfies one of the fol lowing c onditions: (a) F or every pr o duction A → a ∈ Π , wher e A ∈ N and a ∈ Σ ∪ { ε } , ther e is an ar c − → AZ ∈ R lab ele d l ( − → AZ ) = ⟨ a, e ⟩ ; (b) F or every pr o duction A → B C ∈ Π , wher e A, B , C ∈ N , ther e ar e ar cs − − → AB ∈ R and − → Z C ∈ R with lab els r esp e ctively l ( − − → AB ) = ⟨ ε, C ⟩ and l ( − → Z C ) = ⟨ ε, C ′ ⟩ ; (c) Ther e ar e no other ar cs in H Γ exc ept describ e d in c onditions (a) and (b). 5 Theorem 3.3 L et Γ = ⟨N , Σ , Π ⟩ b e a gr ammar in Chomsky normal form and let H Γ b e the tr ansition diagr am obtaine d ac c or ding to Definition 3.2. L et A ∈ N , α ∈ Σ ∗ . Then α ∈ L (Γ , A ) if an only if ther e is a walk π with b e gin vertex A , end vertex Z ( Z / ∈ N ) and having lab el l ( π ) = ⟨ α, ω ⟩ = ⟨ α, e ⟩ , wher e e is the identity of monoid T define d in Definition 3.1, e quation (5), i.e. ω ∈ D 2 n , wher e D 2 n is r estricte d Dyck language on the 2 n letters fr om N ∪ N ′ , n = |N | = |N ′ | . Pro of. Necessity . Let A ∈ N and let α ∈ L (Γ , A ). Then there is a deriv ation A ⇒ α . Let the length of this deriv ation be equal to t ≥ 1. W e will pro ve the necessit y by induction on t . Let t = 1. Since Γ is a grammar in Chomsky normal form, then α = a , where a ∈ Σ ∪ { ε } , and A → a is a pro duction from Γ. According to condition (a) in Definition 3.2, in H Γ there is an arc − → AZ with lab el l ( − → AZ ) = ⟨ a, e ⟩ = ⟨ α, e ⟩ . Therefore, when t = 1 the necessity is fulfilled. Supp ose that for all A ∈ N and for all α ∈ L (Γ , A ) for whic h there is a deriv ation A ⇒ α with length not greater than t , in H Γ there is a walk with the start vertex A , the final vertex Z and having lab el ⟨ α, ω ⟩ = ⟨ α, e ⟩ , where ω ∈ D 2 n . Let A ⇒ α is a deriv ation in Γ whic h length is equal to t + 1 and let A → B C , A, B , C ∈ N be the first pro duction in this deriv ation. Then in Γ there exist deriv ations B ⇒ α 1 and C ⇒ α 2 with lengths not greater than t , where α 1 , α 2 ∈ Σ ∗ and α 1 α 2 = α . By the inductive assumption, in H Γ there are: i) a walk π 1 with the start v ertex B , final v ertex Z , labeled l ( π 1 ) = ⟨ α 1 , e ⟩ and ii) a w alk π 2 with start v ertex C , final vertex Z and lab eled l ( π 2 ) = ⟨ α 2 , e ⟩ . According to Definition 3.2, condition (b), in H Γ there are arcs − − → AB and − → Z C with labels l ( − − → AB ) = ⟨ ε, C ⟩ and l ( − → Z C ) = ⟨ ε, C ′ ⟩ respectively . Then the walk π = − − → AB π 1 − → Z C π 2 has start vertex A , final vertex Z and lab el: l ( π ) = l ( − − → AB ) ◦ l ( π 1 ) ◦ l ( − → Z C ) ◦ l ( π 2 ) = ⟨ ε, C ⟩ ◦ ⟨ α 1 , e ⟩ ◦ ⟨ ε, C ′ ⟩ ◦ ⟨ α 2 , e ⟩ = ⟨ εα 1 εα 2 , C eC ′ e ⟩ = ⟨ α 1 α 2 , C C ′ ⟩ = ⟨ α, e ⟩ . This prov es the nec essit y . Sufficiency . Let A ∈ N and let in H Γ there is a w alk π with start v ertex A ∈ N , final vertex Z / ∈ N an label l ( π ) = ⟨ α, ω ⟩ = ⟨ α, e ⟩ , where α ∈ Σ ∗ , ω ∈ D 2 n . W e will prov e the sufficiency b y induction on the length | α | of the w ord α . If | α | = 0 or | α | = 1, then α = a for some a ∈ Σ ∪ { ε } . Hence π = − → AZ (see Definition 3.2) and π is an arc with lab el l ( π ) = ⟨ a, e ⟩ . Then according to Definition 3.2, condition (a), in Γ there is a production A → a , i.e. α = a ∈ L (Γ , A ). Let t is a positive integer, suc h that for ev ery v ertex A ∈ N and every walk π in H Γ with start v ertex A , final v ertex Z and lab el l ( π ) = ⟨ α, ω ⟩ = ⟨ α , e ⟩ , α ∈ Σ ∗ , ω ∈ D 2 n , from | α | ≤ t follo ws α ∈ L (Γ , A ). Let α ∈ Σ + , where | α | = t + 1 ≥ 2 and let π b e a w alk in H Γ with start v ertex A ∈ N , final v ertex Z and lab el l ( π ) = ⟨ α , ω ⟩ = ⟨ α , e ⟩ , where ω ∈ D 2 n , 6 and therefore there is not A ′ ∈ N ′ suc h that A ′ is the first letter of ω . Since | α | ≥ 2, there exists a v ertex B ∈ N (i.e. B  = Z ), suc h that the first arc of π is − − → AB and let l ( − − → AB ) = ⟨ ε, C ⟩ , where C ∈ N . But l ( π ) = ⟨ α, e ⟩ . Therefore, in order for the letter C to disappear from the label of π , it follows that in H Γ there exist an arc − → Z C with the label ⟨ ε, C ′ ⟩ and w alks π 1 and π 2 , where π 1 has start v ertex B , final vertex Z and π 2 has start v ertex C , final vertex Z , suc h that the path π is represented in the form π = − − → AB π 1 − → Z C π 2 (see Figure 1). Figure 1: Let l ( π 1 ) = ⟨ α 1 , ω 1 ⟩ , l ( π 2 ) = ⟨ α 2 , ω 2 ⟩ , where α 1 , α 2 ∈ Σ ∗ and ω 1 , ω 1 ∈ ( N ∪ N ′ ) ∗ . Then w e get: l ( π ) = l ( − − → AB π 1 − → Z C π 2 ) = l ( − − → AB ) ◦ l ( π 1 ) ◦ l ( − → Z C ) ◦ l ( π 2 ) = = ⟨ ε, C ⟩ ◦ ⟨ α 1 , ω 1 ⟩ ◦ ⟨ ε, C ′ ⟩ ◦ ⟨ α 2 , ω 2 ⟩ = = ⟨ α 1 α 2 , C ω 1 C ′ ω 2 ⟩ . Without loss of generality , we can assume that the vertex C is not con tained inside the walk π 2 and therefore C ′ / ∈ ω 2 . F rom l ( π ) = ⟨ α, ω ⟩ we obtain α 1 α 2 = α and ω = C ω 1 C ′ ω 2 ∈ D 2 n . As ω ∈ D 2 n and C ′ / ∈ ω 2 , then ω 1 is enclosed b y the pair of opening brack et C and corresp onding closing brack et C ′ . Then it is easy to see that ω 1 = e and therefore ω 2 = e . Since | α 1 | ≥ 1, | α 2 | ≥ 1 and | α 1 | + | α 2 | = | α | , we hav e | α 1 | < | α | = t + 1 and | α 2 | < | α | = t + 1, i.e. | α 1 | ≤ t and α 2 ≤ t . By the inductive hypothesis, α 1 ∈ L (Γ , B ) and α 2 ∈ L (Γ , C ), i.e. in Γ there exist deriv ations B ⇒ α 1 and C ⇒ α 2 . Therefore in Γ there is a deriv ation A → B C ⇒ α 1 C ⇒ α 1 α 2 = α . This pro ves the sufficiency . 2 Example 3.4 Consider the con text-free grammar in Chomsky normal form Γ = ⟨{ S, A, B , C, D } , { a, b } , { S → S S , S → AB , S → B A , S → AD , S → B C , C → S A , D → S B , A → a , B → b }⟩ . It is easy to prov e that L (Γ , S ) is the language of all words in { a, b } ∗ \ { ε } in whic h the num b er of letters ” a ” is equal to the n umber of letters ” b ”. The corresponding graph H Γ is shown in Figure 2. 7 Figure 2: F rom Theorem 3.3 follows the next theorem formulated and pro ved by Chom- sky and Sch¨ utzen b erger in [5]. Theorem 3.5 [5] (See also [14, Theorem 5.14] or [17, Theorem 11.9]) A lan- guage L ⊆ Σ ∗ is c ontext-fr e e if and only if ther e ar e a p ositive inte ger n , a r e gular language L 1 over the alphab et T = N ∪ N ′ , |N | = n and N ′ = { A ′ | A ∈ N } and homomorphism h : T ∗ → Σ ∗ such that L = h ( D 2 n ∩ L 1 ) , wher e D 2 n is the r estricte d Dyck language on the 2 n letters fr om the set T . 2 4 Inclusion of context-free languages in group languages Let N , N ′ , X , X ′ and Σ b e finite sets, where N = { A 1 , A 2 , . . . , A n } , N ′ = { A ′ 1 , A ′ 2 , . . . , A ′ n } , N ∩ N ′ = ∅ , X = { x 1 , x 2 , ..., x m } , X ′ = { x ′ 1 , x ′ 2 , ..., x ′ m } , X ∩ X ′ = ∅ and Σ = X ∪ X ′ . Let a ∈ N ∪ N ′ ∪ X ∪ X ′ . Then by definition , we put: ( a ′ ) ′ = a. If α = y 1 , y 2 , . . . , y l ∈ ( X ∪ X ′ ) ∗ and ω = a 1 a 2 . . . a k ∈ ( N ∪ N ′ ) ∗ 8 then by definition α ′ = y ′ l y ′ l − 1 . . . y ′ 2 y ′ 1 and ω ′ = a ′ k a ′ k − 1 . . . a ′ 2 a ′ 1 . Let U b e the monoid obtained according to Definition 3.1 and let u = ⟨ α, ω ⟩ ∈ U . Then by definition u ′ = ⟨ α ′ , ω ′ ⟩ . Let Γ = ⟨N , Σ , Π ⟩ b e a grammar in Chomsky normal form. W e construct the transition diagram H Γ = ⟨ V , R, U , l ⟩ obtained according to Definition 3.2. W e will assume that every nonterminal sym b ol in Γ is essen tial and therefore ev ery vertex in H Γ is ess en tial. Let G ⊆ Σ ∗ = ( X ∪ X ′ ) ∗ b e a group with decidable word problem, the set of generators Σ = X ∪ X ′ , identit y ε (the empty w ord) and the set of defining relations Θ such that { x i x ′ i = x ′ i x i = ε | i = 1 , 2 , . . . , m } ⊆ Θ . The next theorem is a direct consequence of Theorem 3.3 and Theorem 3.5: Theorem 4.1 With the ab ove notation let A i ∈ N , i = 1 , 2 , . . . , n . Then the wor d α ∈ L (Γ , A i ) and α ∈ L ( G ) if an only if ther e is a walk π in the tr ansition diagr am H Γ with b e gin vertex A i , end vertex Z ( Z / ∈ N ) and having lab el l ( π ) = ⟨ α, ω ⟩ = 1 U , i.e. α = ε in the gr oup G and ω ∈ D 2 n , wher e D 2 n is r estricte d Dyck language on the 2 n letters fr om N ∪ N ′ , n = |N | = |N ′ | . 2 W e consider the semiring S U =  2 U , ∪ , · , ∅ , { 1 U }  , where 2 U is the set of all subsets of U . Operations in S U are respectively the union ∪ of sets and if M 1 , M 2 ∈ 2 U then b y definition M 1 · M 2 = M 1 M 2 = { u ◦ v ∈ U | u ∈ M 1 , v ∈ M 2 } (see equation (6)), the zero is the e mpt y set ∅ and the iden tity is the set { 1 U } that con tains only the identit y 1 U = ⟨ ε, e ⟩ of the monoid U (according to equation (7)). In H Γ , by definition , we put A n +1 = Z, i . e . V = { A 1 , A 2 , . . . , A n , A n +1 } = N ∪ { A n +1 } . W e consider the following sets of walks in H Γ : 9 P ij – the set of all w alks π ∈ H Γ with the initial v ertex A i ∈ V and the final v ertex A j ∈ V , 1 ≤ i, j ≤ n + 1; c P ij – the set of all walks π ∈ H Γ with the initial vertex A i ∈ V , the final vertex A j ∈ V , 1 ≤ i, j ≤ n + 1, and in whic h all vertices are distinct, except p ossibly A i = A j . c P ij ⊆ P ij ; P iZ – the set of all w alks π ∈ H Γ with the initial v ertex A i ∈ V and the final v ertex Z = A n +1 , 1 ≤ i ≤ n + 1. P iZ ⊆ P ij ; d P iZ – the set of all w alks π ∈ H Γ with the initial v ertex A i ∈ V , the final vertex Z = A n +1 , 1 ≤ i ≤ n + 1, and in whic h all vertices are distinct, except p ossibly the initial and final v ertices. d P iZ ⊆ P iZ as well as d P iZ ⊆ c P ij ; O i – the set of all w alks π ∈ H Γ with the initial v ertex and the final v ertex A i ∈ V , 1 ≤ i ≤ n + 1, and in which all vertices are distinct, except initial and final vertices which are A i . O i = c P ii . Ob viously L = L (Γ , A i ) ⊆ L ( G ) ⇐ ⇒ l ( P iZ ) = { 1 U } = {⟨ ε, e ⟩} , i = 1 , 2 , . . . n. (8) W e consider the next elemen ts of the semiring S U : Ω 3 = n l ( π )    π ∈ d P 1 Z o = l  d P 1 Z  ; Ω 4 = n w ′ v w    ∃ j ∈ { 1 , 2 , . . . , n + 1 } : ∃ π 1 ∈ P 1 j , v ∈ l ( O j ) , w ∈ l ( d P j Z ) o ; W 2 = Ω 3 ∪ Ω 4 ∈ S U . W e define the sets of w alks K k ij in H Γ , where i, j ∈ { 1 , 2 , ..., n + 1 } , k ∈ { 0 , 1 , 2 , ..., n + 1 } n = |N | as follows: K 0 ij =  { ρ | ρ = ⟨ A i , A j ⟩ is an arc in R } if j  = i { ρ | ρ = ⟨ A i , A i ⟩ is a loop in R } if j = i and K k ij = K k − 1 ij ∪ K k − 1 ik K k − 1 kj . By definition K k ij consists only of walks with the initial vertex A i ∈ V the final vertex A j ∈ V , and may not pass through a vertex A s when s ≥ k , or that passes along a w alk π 1 from A i to A k , then passes along a walk π 2 from A k to A j . None of these walks π 1 or π 2 passes along an in terior vertex A s where s ≥ k . So, for all k ∈ { 0 , 1 , . . . , n + 1 } none of the walks π ∈ K k ij passes along an interior vertex A s where s ≥ k + 1. Prop osition 4.2 The sets K k ij ar e finite. 10 Pro of. By induction, it is easy to see that if π ∈ K k ij , i, j = 1 , 2 , . . . , n + 1, k = 0 , 1 , . . . , n + 1 then the length of π is less than or equal to 2 k , i.e every path π ∈ K k ij has a finite length. Therefore the sets K k ij are finite. 2 W e consider the following elements of the semiring S U : Ω 5 =  l ( π ) | π ∈ K n +1 1 , n +1  = l  K n +1 1 , n +1  ; Ω 6 =  w ′ v w   ∃ j ∈ { 1 , 2 , . . . , n + 1 } : ∃ π 1 ∈ K n +1 1 j , v ∈ l  K n +1 j j  , w ∈  K n +1 j, n +1   ; W 3 = Ω 5 ∪ Ω 6 ∈ S U . It is not difficult to see that Ω 3 ⊆ Ω 5 ⊆ l ( P 1 Z ) and Ω 4 ⊆ Ω 6 . (9) Therefore W 2 ⊆ W 3 (10) As in K k ij is p ossible existence of a walk containing a cycle or a lo op, then in the general case Ω 3  = Ω 5 and Ω 4  = Ω 6 . Theorem 4.3 L et Γ = ⟨N , Σ , Π ⟩ b e a gr ammar in Chomsky normal form, and let L = L (Γ , A 1 ) , wher e N = { A 1 , A 2 , . . . , A n } , Σ = X ∪ X ′ = { x 1 , x 2 , ..., x n } ∪ { x ′ 1 , x ′ 2 , ..., x ′ n } , X ∩ X ′ = ∅ . L et G b e a gr oup with the set of gener ators Σ , and the set of defining r elations Θ satisfying the c ondition (2). Then with the ab ove notations and definitions, the fol lowing c onditions ar e e quivalent: (i) L ⊆ L ( G ) ; (ii) W 1 = Ω 1 ∪ Ω 2 = { ε } ; (iii) W 2 = Ω 3 ∪ Ω 4 = { 1 U } = {⟨ ε, e ⟩} ; (iv) W 3 = Ω 5 ∪ Ω 6 = { 1 U } = {⟨ ε, e ⟩} . Pro of. The equiv alence of conditions (i) and (ii) w as prov ed b y A.V. Anisi- mo v in [3] (Theorem 2.1). Condition (i) ⇒ (iv) follows from the equations (8) and (9). Condition (iv) ⇒ (iii) follows from the equation (10). T o pro ve the theorem, it remains to prov e the condition (iii) ⇒ (i). Let W 2 = Ω 3 ∪ Ω 4 = { 1 U } = {⟨ ε, e ⟩} and let α ∈ L . Then there is a w alk π ∈ P 1 Z suc h that l ( π ) = ⟨ α, e ⟩ ∈ U . If π do es not con tain cycles and loops, then l ( π ) ∈ l ( d P 1 Z ) = Ω 3 = { 1 U } = {⟨ ε, e ⟩} and therefore α = ε in G , i.e. α ∈ L ( G ). If π con tains a cycle or a lo op then there is A j ∈ V suc h that π can b e ex- pressed as π = π 1 π 2 π 3 , where π 1 ∈ P 1 j , π 2 ∈ O j , π 3 ∈ d P j Z and ( l ( π 3 )) ′ l ( π 2 ) l ( π 3 ) ∈ Ω 4 = { 1 U } . Therefore, l ( π 2 ) l ( π 3 ) = l ( π 3 ) and l ( π 1 π 2 π 3 ) = l ( π 1 π 3 ). Since π 2 ∈ O j , then the length of π 2 is greater than 1. Consequently , in H Γ there is a w alk with length less than the length of π , whose lab el is equal to l ( π ) = ⟨ α, e ⟩ in the semiring U . This pro cess of reduction may pro ceed a finite num b er of times 11 as the length of π is finite. A t the end of this pro cess we obtain a w alk in H Γ with the initial v ertex A 1 and the final v ertex A Z = A n +1 without cycles and without lo ops with lab el equal to ⟨ α, e ⟩ ∈ U . But l ( d P 1 Z ) = Ω 3 = { 1 U } = {⟨ ε, e ⟩} . Hence α = ε in the group G and therefore L ⊆ L ( G ). 2 Let M 1 , M 2 ∈ 2 U . In the semiring S U w e define the next binary op eration: M 1 ⋆ M 2 = { w ′ v w | v ∈ M 1 , w ∈ M 2 } (11) The follo wing algorithm is based on the equiv alence (i) and (iv) of Theorem 4.3. F or conv enience, g k ij , i, j, k ∈ { 1 , 2 , . . . , n + 1 } will mean l ( K k ij ). Here, k in g k ij is a sup erscript and do es not mean an exp onen t. Algorithm 4.4 V erifies the inclusion L ⊆ L ( G ) for a r e gular language L , and a gr oup language L ( G ) , wher e G is a gr oup with de cidable wor d pr oblem. Input: g 0 ij = l ( K 0 ij ) , i, j = 1 , 2 , ..., n + 1 Output: Bo olean v ariable T , which receives the v alue T rue if L ⊆ L ( G ), and the v alue F alse , otherwise. The algorithm will stop immediately after the v alue of T := F alse . Begin 1. T := T rue ; 2. F or 1 ≤ k ≤ n + 1 Do 3. F or 1 ≤ i, j ≤ n + 1 Do 4. g k ij := g k − 1 ij ∪ g k − 1 ik g k − 1 kj ; 5. End Do; 6. End Do; 7. If g n +1 1 n +1  = ∅ and g n +1 1 n +1  = {⟨ ε, e ⟩} Then 8. Begin T := F alse ; Halt; End; 9. F or 1 ≤ j ≤ n + 1 Do 10. If g n +1 1 j  = ∅ and g n +1 j j  = ∅ and g n +1 j n +1  = ∅ Then 11. If g n +1 j j ⋆ g n +1 j n +1  = {⟨ ε, e ⟩} Then 12. Begin T := F alse ; Halt; End; 13. End Do; End. Theorem 4.5 Algorithm 4.4 che cks the inclusion L ⊆ L ( G ) , wher e L is a c ontext-fr e e language gener ate d by a gr ammar in Chomsky normal form with n nonterminals, L ( G ) is a gr oup language, which sp e cifies the gr oup G with de cidable wor d pr oblem. Algorithm 4.4 exe cutes at most O ( n 3 ) op er ations ∪ and · , and at most O ( n 2 ) op er ations ⋆ in the semiring S U , wher e the binary op er ation ⋆ is define d using the e quation (11). Pro of. According to Theorem 4.3 and considering axioms of the semiring S U , then in ro ws 8 and 12 of Algorithm 4.4, the bo olean v ariable T gets the v alue F alse if and only if L is not included in L ( G ). Otherwise, T gets the v alue 12 T rue . Hence the algorithm correctly chec ks whether the inclusion L ⊆ L ( G ) is true. It is easy to see that line 4 executes no more than ( n + 1) 3 times. During eac h iteration, the operations ∪ and · p erform in the semiring S U once eac h of them. Lines 10 and 11 is executed at most ( n + 1) 2 times each. Therefore, Algorithm 4.4 p erforms no more than O ( n 3 ) operations ∪ and · , and no more than O ( n 2 ) op erations ⋆ in the semiring S U . The theorem is prov ed. 2 Corollary 4.6 If the op er ations ∪ , · and ⋆ in the semiring S U c an b e done in a p olynomial time, then A lgorithm 4.4 is p olynomial. 2 Remark 4.7 A c c or ding to Pr op osition 4.2 the sets l ( K k ij ) ∈ S U ar e finite and henc e they c an b e c o de d using a Bo ole an ve ctor of finite length. In this c ase, to evaluate algorithm 4.4 mor e ac cur ately, it is c onvenient to use bitwise op er ations [24, 25]. References [1] A.V. Aho and J.D. Ullman. The the ory of p arsing, tr anslation and c om- puting , volume 1,2. Pren tice-Hall, 1972. [2] A. V. Anisimov. Group languages. Cyb ernetics and Systems Analysis , 7:594–601, 1971. [3] A. V. Anisimo v. Finite-automaton semigroup mappings. Cyb ernetics and Systems Analysis , 17:571–578, 1981. [4] I. Chiswell. A c ourse in formal languages, automata and gr oups . Springer- V erlag, London, 2009. [5] N. Chomsky and M.P . Sc h ¨ utzen b erger. The algebraic theory of context-free languages. In P . Braffort and D. Hirsc hberg, editors, Computer Pr o gr am- ming and F ormal Systems , volume 35 of Studies in L o gic and the F ounda- tions of Mathematics , pages 118 – 161. Elsevier, 1963. [6] Y. Denev and S. Shtrak ov. Discr ete mathematics . South-W est Univ ersity ”N.Rilski”, Blago evgrad, 1995. in Bulgarian. [7] R. Diestel. Gr aph The ory . Springer-V erlag, Heidelb erg, New Y ork, 5th electronic edition, 2010. [8] S. Ginsburg. The mathematic al the ory of c ontext-fr e e languages . Mc Gra w- Hill, 1966. [9] R. I. Grigorch uk, V. V. Nekrashevic h, and V. I. Sushc hanskii. Automata, dynamical systems, and groups. Pr o c e e dings of the Steklov Institute of Mathematics , 231:128–203, 2000. (T ranslated from T rudy Matematich- esk ogo Instituta imeni V.A. Steklo v a, V ol. 231, 2000, pp. 134-214). 13 [10] F. Harary . Gr aph The ory . Addison-W esley , Massac husetts, 1998. [11] F. Harary and R. Z. Norman. Gr aph the ory as a mathematic al mo del in so cial scienc e . Num b er 2. Universit y of Mic higan, Institute for So cial Re- searc h Ann Arbor, 1953. [12] P .-C. H ´ eam. On the complexit y of computing the profinite closure of a ra- tional language. The or etic al Computer Scienc e , 412(41):5808 – 5813, 2011. [13] J.E. Hop croft, R. Mot wani, and J.D. Ullman. Intr o duction to automata the ory, languages, and c omputation . Addison-W esley , 2001. [14] G. Lallemen t. Semigr oups and c ombinatorial applic ations . John Wiley & Sons, New Y ork-Chichester-Brisbane, 1979. [15] D. Orozov a and K. Atanasso v. Generalized net mo del of the pro cess of selection and usage of an in telligent e-learning system. Comptes r endus de l’A c ad´ emie bulgar e des Scienc es , 65(5):591–598, 2012. [16] D. Orozo v a, K. A tanassov, and M. T o doro v a. Generalized net model of the pro cess of p ersonalization and usage of an e-learning environmen t. In Pr o c e e dings of the Jangje on Mathematic al So ciety , volume 19, pages 615– 624, 2016. [17] A. E. Pen tus and M. R. Pen tus. F ormal languages the ory . Mosk ow Univ er- sit y , 2004. in Russian. [18] D. P errin and J.-E. Pin. Infinite wor ds. Automata, semigr oups, lo gic and games . Elsevier, 2004. [19] V. J. Ra yward-Smith. A first c ourse in formal language the ory . McGraw- Hill, 2nd edition, 1995. [20] S. Sh trako v, K. Y ordzhev, and M. T odorov a. Guide for solving of tasks in discr ete mathematics . South-W est Univ ersity ”N.Rilski”, Blagoevgrad, 2004. in Bulgarian. [21] M. Swami and K. Thulasirman. Gr aphs, networks and algorithms . John Wiley & Sons, 1981. [22] K. Y ordzhev. Still on the problem of inclusion of regular and linear lan- guages in group languages. Filomat , 9(3):699–710, 1995. in Russian. [23] K. Y ordzhev. A represen tation of con text-free grammars with the help of finite digraphs. Americ an Journal of Applie d Mathematics , 1(1):8–11, 2013. [24] K. Y ordzhev. Bitwise Op er ations and Combinatorial Applic ations . LAM- BER T Academic Publishing, 2019. [25] K. Y ordzhev. On the concept of bit wise operations in the programming courses. Mathematics and Informatics , 62(3):325–339, 2019. 14

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment