Quotient Complexity of Ideal Languages

Size: px
Start display at page:

Download "Quotient Complexity of Ideal Languages"

Transcription

1 Quotient Complexity of Idel Lnguges Jnusz Brzozowski,1 Glin Jirásková Biyu Li Dvid R. Cheriton School of Computer Science, University of Wterloo, Wterloo, ON, Cnd N2L 3G1 Mthemticl Institute, Slovk Acdemy of Sciences, Grešákov 6, Košice, Slovki Astrct A lnguge L over n lphet Σ is right (left) idel if it stisfies L = LΣ (L = Σ L). It is two-sided idel if L = Σ LΣ, nd n ll-sided idel if L = Σ L, the shuffle of Σ with L. Idel lnguges re not only of interest from the theoreticl point of view, ut lso hve pplictions to pttern mtching. We study the stte complexity of common opertions in the clss of regulr idel lnguges, ut prefer to use the equivlent term quotient complexity, which is the numer of distinct left quotients of lnguge. We find tight upper ounds on the complexity of ech type of idel lnguge in terms of the complexity of n ritrry genertor nd of the miniml genertor, nd lso on the complexity of the miniml genertor in terms of the complexity of the lnguge. Moreover, tight upper ounds on the complexity of union, intersection, set difference, symmetric difference, conctention, str, nd reversl of idel lnguges re derived. Key words: finite utomton, idel, opertion, quotient complexity, regulr lnguge, stte complexity This work ws supported y the Nturl Sciences nd Engineering Reserch Council of Cnd grnt OGP nd y VEGA grnt 2/0111/09. Emil ddresses: rzozo@uwterloo.c (Jnusz Brzozowski), jirskov@sske.sk (Glin Jirásková), 5li@student.cs.uwterloo.c (Biyu Li). URLs: rzozo/ (Jnusz Brzozowski), jirskov/ (Glin Jirásková), 5li/ (Biyu Li). 1 Corresponding uthor. Preprint sumitted to Theoreticl Computer Science 22 Octoer 2012

2 1 Introduction A lnguge is right idel if it is closed under conctention on the right with n ritrry word. Left idels nd two-sided idels re defined in similr wy. A lnguge is n ll-sided idel if it is closed under the insertion of n ritrry word in ny position in ny word of the lnguge. Idel lnguges need not e regulr, ut our interest is in regulr idels only. Idels re studied for severl resons. They re fundmentl ojects in semigroup theory [26,37]. They pper in the theoreticl computer science literture s erly s 1965 [32] nd continue to e of interest in the present [2,3,12,13]. Idel lnguges re complements of prefix-, suffix-, fctor-, nd suword-closed lnguges, nd closed lnguges constitute nother interesting clss [2,10]. Idel lnguges re closed with respect to the hs word s prefix (respectively, suffix, fctor, suword) reltion [2]. They re specil cses of convex lnguges [2,38], which form much lrger clss. Finlly, esides eing of theoreticl interest, idels lso ply role in lgorithms for pttern mtching. Left nd right idels were studied y Pz nd Peleg [32] in 1965 under the nmes ultimte definite nd reverse ultimte definite events ; their results include closure properties, decision procedures, nd cnonicl representtions for these lnguges. All-sided idels were used y Hines [18] (not under tht nme) in 1969 in connection with suword-free nd suword-closed lnguges, nd y Thierrin [38] in 1973 in connection with suword-convex lnguges. De Luc nd Vrricchio [27] showed in 1990 tht lnguge is fctor-closed (or fctoril ) if nd only if it is the complement of twosided idel. The 1994 work of Yu, Zhung nd Slom in [42] contins two results out left nd right idels. In 2001 Shyr [37] studied right, left, nd twosided idels nd their genertors in connection with codes. In 2007 Okhotin [31] presented result concerning ll-sided idels. Complexity issues of conversion of nondeterministic finite utomt (nf s) to deterministic finite utomt (df s), where these utomt recognize right, left, nd two-sided idels were studied in 2009 y Bordihn, Holzer, nd Kutri [3], who used the nmes ultimte definite, reverse ultimte definite, nd centrl definite lnguges, respectively. The sizes of ll-sided idels were studied in 2009 y Gruer, Holzer nd Kutri [17]. In 2009 ll four types of idels nd their closure properties were considered y Ang nd Brzozowski [2] in the frmework of lnguges convex with respect to ritrry inry reltions. Decision prolems for vrious clsses of convex lnguges, including idels, were ddressed in 2011 y Brzozowski, Shllit nd Xu [12]. The sizes of the syntctic semigroups of right, left, nd two-sided idels were studied in 2011 y Brzozowski nd Ye [13]. 2

3 As mentioned ove, idels lso pper in the importnt re of pttern mtching. For this ppliction, text is represented y word w over some lphet Σ. A pttern cn e s simple s word or finite set of words, or it cn e n ritrry lnguge L over Σ descried y regulr expression. An occurrence of pttern represented y L in text w is triple (u, x, v) such tht w = uxv nd x is in L. Serching text w for words in L is equivlent to looking for prefixes of w tht elong to the lnguge Σ L, which is the left idel generted y L [15]. Algorithms such s tht of Aho nd Corsick [1] cn e used to determine ll possile occurrences of words from finite set L in given input w. For exmple, in Unix-style editor, such s sed, if L is just single word x, then /.*x$/, /^x.*/, nd /.*x.*/, or their simplified versions /x$/, /^x/, nd /x/, find ll the words ending in x (tht is, ll the words of the left idel Σ x) tht occur in w; ll the words eginning with x (tht is, ll the words of the right idel xσ ) tht occur in w; nd ll the words tht hve x s fctor (tht is, ll the words of the two-sided idel Σ xσ ) tht occur in w, respectively. The lnguge Σ x cn e used to find susequences occurring in the given text, for exmple, to determine whether report hs ll the required sections nd tht they re in the correct order. For more detils we refer the reder to [1,15,16]. For nother exmple of pplictions of pttern mtching with regulr lnguges see the recent work of Yu, Chen, Dio, Lkshmn nd Ktz [39]. They consider the prolem of scnning t high speed the content of pckets, which re units of inry dt routed through computer communiction network; this is crucil for network monitoring nd security pplictions. In such cses nf s re often used, ecuse the exponentil size of the nive df s requires excessive memory. Rewriting techniques on regulr expressions re used to mke fst df-sed pttern mtching fesile. Idels, though not so nmed, pper often is this work. In this pper we study idel lnguges from the descriptionl complexity point of view. The fct tht the four clsses of idels re relted to ech other permits us to otin mny complexity results using similr methods. 1.1 Stte Complexity versus Quotient Complexity The study of stte complexity of opertions on regulr lnguges is wellestlished re of reserch in theoreticl computer science. The stte complexity of regulr lnguge L is the numer of sttes in the (complete) miniml df recognizing L. For suclsses C nd C of regulr lnguges, the stte complexity of n op- 3

4 ertion f : C C C is function of the stte complexities of lnguges K nd L from C tht returns the mximl stte complexity of the lnguge f(k, L). If f is n opertion f : C C, then the stte complexity of f returns the mximl stte complexity of f(l), for L in C, s function of the stte complexity of L. A notion equivlent to stte complexity is tht of the quotient complexity of lnguge. For lnguge L over finite lphet Σ nd word w Σ, the (left) quotient of L y w is the lnguge L w = {x wx L}. The quotient complexity of lnguge L is the numer of distinct quotients of L. A lnguge L is regulr if nd only if it hs finite numer of quotients, nd this numer is precisely the stte complexity of L. The quotient complexity of n opertion is function, similr to the stte complexity function defined ove, ut here it returns the mximl numer of quotients of f(k, L) or of f(l), which, of course, is the sme s the stte complexity of f(k, L) or of f(l). Although the two concepts of stte nd quotient complexity re equivlent in the numericl sense, they provide different points of view for the sme sic ide. The stte complexity pproch is utomton-oriented nd leds to constructions of utomt recognizing the lnguge resulting from n opertion. The quotient pproch is lnguge-oriented nd leds to opertions on lnguges. In prticulr pplictions one pproch my e more convenient thn the other. For exmple, it is often esy to derive n upper ound on the stte/quotient complexity of n opertion using quotients. On the other hnd, to show tht the stte/quotient complexity of n opertion meets n upper ound it is often more pproprite to use utomt. These techniques re illustrted severl times in the present pper. In this pper we use either one pproch or the other, s is convenient. The terminology is question of personl preference, nd we prefer to use quotient complexity, since it is lnguge property defined in lnguge-theoretic terms. However, since we do not discuss ny other type of complexity in this work, we will simply use the term complexity. 1.2 Previous Work on Complexity The ound mn on the complexity of intersection ws noted in 1959 y Rin nd Scott [36]. In 1963 Lupnov [28] proved tht the ound 2 n for the conversion of nf s to df s is tight. In 1966 Mirkin [30] showed tht the 2 n ound for the reversl of df is ttinle. The stte complexities of union, product, nd str were first studied in 1970 y Mslov [29]. He stted upper ounds on the complexity of these opertions nd gve exmples of lnguges meeting these ounds, ut provided no proofs. 4

5 In 1994 Yu, Zhung, nd Slom [42] exmined in detil the complexities of conctention, str, left nd right quotients, reversl, intersection, nd union in the clss of regulr lnguges. Since then, there hve een mny ppers on this suject; see, for exmple, the 2001 survey y Yu [41] nd the reference lists in tht work. Quotient complexity ws introduced in 2010 y Brzozowski [6]; tht pper lso contins short updted survey. There hs lso een considerle mount of work done on the complexity of opertions in proper suclsses of regulr lnguges: in unry lnguges in 1994 y Yu, Zhung nd Slom [42] nd in 2002 y Pighizzini nd Shllit [34]; in finite lnguges in 2001 y Yu [41] nd Câmpenu, Culik, Slom nd Yu [14]; in prefix-free lnguges in 2009 y Hn, Slom nd Wood [20]; in suffix-free lnguges in 2009 y Hn nd Slom [19]; in closed lnguges in 2010 y Brzozowski, Jirásková nd Zou [10]; in union-free lnguges in 2010 y Jirásková nd Msopust [23]; in ifix-, fctor- nd suword-free lnguges in 2011 y Brzozowski, Jirásková, Li nd Smith [9]; nd in str-free lnguges in 2011 y Brzozowski nd Liu [11]. In generl, these studies of suclsses show tht the complexity cn e significntly lower in suclss thn in the generl cse. There re, however, some surprises: Brzozowski nd Liu [11] showed tht ll the ounds on opertions on regulr lnguges, with some smll exceptions, re lso met y str-free lnguges very restricted clss of regulr lnguges. Anlogous results were proved y Holzer, Kutri nd Meckel [21] who showed tht, in most cses, exctly the sme tight sttecomplexity ounds re reched y opertions on nf s recognizing str-free lnguges s on generl nf s. This motivtes us to study suclsses of regulr lnguges to determine their complexity chrcteristics. Here we continue this study in four relted clsses of regulr lnguges: right, left, two-sided, nd ll-sided idels. 1.3 Outline In Section 2 we define our terminology nd nottion. The complexities of idel lnguges in terms of their genertors nd miniml genertors, nd the complexities of genertors in terms of idels re studied in Section 3. The complexities of sic opertions on idels re then exmined in Section 4. The specil cse of unry lnguges is treted in Section 5, nd Section 6 concludes the pper. An erlier version of this work ppered t rxiv [7], nd much shorter version ws pulished in the LATIN 2010 conference proceedings [8]. 5

6 2 Preliminries We ssume tht the reder is fmilir with sic concepts of regulr lnguges nd finite utomt, s descried in [33,40], for exmple, or in mny textooks. For generl properties of idel lnguges we refer the reder to [26,37]. If Σ is non-empty finite lphet, then Σ is the free monoid generted y Σ. A word is ny element of Σ, nd the empty word is ε. The length of word w Σ is w. A lnguge over Σ is ny suset of Σ. The following set opertions re defined on lnguges: complement (L = Σ \ L), union (K L), intersection (K L), difference (K \ L), nd symmetric difference (K L). To indicte ny one of these four oolen opertions with two rguments we use K L. We lso define the product, usully clled conctention or ctention, K L = {w Σ w = uv, u K, v L}, positive closure L + = i 1 L i, nd str L = i 0 L i. The reverse w R of word w in Σ is defined s follows: ε R = ε, nd (w) R = w R for letter nd word w. The reverse of lnguge L is defined s L R = {w R w L}. Regulr lnguges over n lphet Σ re lnguges tht cn e otined from the sic lnguges, {ε}, nd {}, Σ, using finite numer of opertions of union, product, nd str. Such lnguges re usully denoted y regulr expressions. For exmple, E = (ε ) denotes L = ({ε} {}) {}. We use the symols, (usully omitted), nd for union, product, nd str of oth regulr expressions nd lnguges, rther thn using + in expressions nd for lnguges. A deterministic finite utomton (df) is quintuple D = (Q, Σ, δ, q 0, F), where Q is finite, non-empty set of sttes, Σ is finite, non-empty lphet, δ : Q Σ Q is the trnsition function, q 0 Q is the initil stte, nd F Q is the set of finl sttes. The trnsition function is nturlly extended to the domin Q Σ. The lnguge ccepted y df D is L(D) = {w Σ δ(q 0, w) F }. The lnguge ccepted from stte q of df is the lnguge ccepted y the df D q = (Q, Σ, δ, q, F). Two sttes of df re distinguishle if there exists word w which is ccepted from one of the sttes nd rejected from the other. Otherwise, the two sttes re equivlent. A df is miniml if ll of its sttes re rechle from the initil stte nd no two sttes re equivlent. A nondeterministic finite utomton (nf) is quintuple N = (Q, Σ, δ, S, F), where Q, Σ, nd F re defined the sme wy s in df, S is the set of initil sttes 2, nd δ is the nondeterministic trnsition function tht mps Q Σ to 2 In contrst to some uthors, we use set of initil sttes, since we require the reverse of n nf to e n nf. 6

7 2 Q. The trnsition function is extended to 2 Q Σ. The lnguge ccepted y nf N is L(N) = {w Σ δ(s, w) F }. The lnguge ccepted from stte q of n nf is the lnguge ccepted y the nf (Q, Σ, δ, {q}, F). Every nf (Q, Σ, δ, S, F) cn e converted to n equivlent df (2 Q, Σ, δ, S, F ) y the well-known suset construction [36]: The trnsition function δ is defined y δ (R, ) = r R δ(r, ), nd stte R in 2 Q is in F if R F. We cll the resulting df the suset utomton corresponding to the given nf. This utomton need not e miniml, since some of its sttes my e unrechle or equivlent. The following two lemmt re used often to show rechility nd distinguishility of sttes of suset utomton. Lemm 1 (Rechility) Consider n nf with initil stte q 0, in which there re trnsitions on inputs nd in sttes q 0, q 1,..., q n 2 s shown in Fig. 1. Then ech suset of {q 0, q 1,..., q n 1 } contining q 0 is rechle in the corresponding suset utomton. q 0 q1 q n 2 q n 1 Fig. 1. Rechility of ll the susets of {q 0,q 1,...,q n 1 } contining stte q 0. PROOF. The proof is y induction on the size of susets. Suset {q 0 } is the initil stte of the suset utomton. Every suset {q 0, q i2, q i3...,q ik } of size k, where 2 k n nd 1 i 2 < i 3 < < i k n 1, is reched from the suset {q 0, q i3 i 2,...,q ik i 2 } of size k 1 y i2 1. Lemm 2 (Distinguishility) If for every stte q of n nf there exists word w q tht is ccepted y the nf from stte q nd rejected from ny other stte, then ll the sttes of the corresponding suset utomton re pirwise distinguishle. PROOF. Two distinct susets of the suset utomton must differ in some stte q of the given nf. These two susets re distinguished y word w q, which is ccepted y the nf only from stte q. Next, we recll some properties of quotients. The quotient complexity of L is the numer of distinct quotients of L, nd is denoted y κ(l). 7

8 The quotients of regulr lnguge cn e computed s follows. First, the ε-function L ε of regulr lnguge L is defined y L ε = if ε / L nd L ε = ε if ε L. The quotient y letter in Σ is computed y induction:, if {, ε}, or Σ nd, = ε, if = ; (L) = L ; (K L) = K L ; (KL) = K L K ε L ; (K ) = K K. The quotient y word w Σ is computed y induction on the length of w: L ε = L; L w = (L w ). Quotients computed this wy re indeed the left quotients of regulr lnguge [5,6]. A quotient L w is finl if ε L w ; otherwise it is non-finl. We use the following formuls [5,6] for quotients of regulr lnguges to estlish upper ounds on quotient complexity: Proposition 3 If K nd L re regulr lnguges, nd u nd v re in Σ +, then (L) w = L w ; (K L) w = K w L w ; (1) ) (KL) w = K w L K ε L w ( Ku ε L v w=uv. (2) The formuls for oolen opertions re ovious. The quotient of product KL y w consists of the quotient of K y w conctented with L, of the quotient of L y w if the empty word is in K, nd of the quotients of L y non-empty suffixes v of w, where the quotients of K y the corresponding prefixes u of w contin the empty word. The quotient df of regulr lnguge L is D = (Q, Σ, δ, q 0, F), where Q = {L w w Σ }, δ(l w, ) = L w, q 0 = L ε = L, nd F = {L w ε L w }. So the numer of sttes in the quotient utomton of L is the quotient complexity of L. The quotient df of L is isomorphic to the complete miniml df of L, nd these terms re used here synonymously. 8

9 If u, v, w Σ nd w = uxv, then u is prefix of w, v is suffix of w, nd x is fctor of w. If w = u 1 v 1 u 2 v 2 u k v k u k+1, where the u i nd v i re in Σ, then v 1 v 2 v k is suword of w. A prefix (suffix, fctor, suword) of w is proper if it not equl to w. A lnguge L is prefix-free (prefix-closed) if w L implies tht no proper prefix of w is in L (tht every prefix of w is in L). In the sme wy, we define suffixfree, fctor-free, nd suword-free lnguges, nd the corresponding closed versions. The shuffle u v of two words u, v Σ is defined s follows: u v = {u 1 v 1 u k v k u = u 1 u k, v = v 1 v k, u 1,...,u k, v 1,...,v k Σ }. The shuffle of two lnguges K nd L is defined y K L = u v. u K,v L Note tht these opertions re commuttive. 3 Idels, Genertors, nd Miniml Genertors A lnguge L Σ is right idel (left idel, two-sided idel, ll-sided idel) if it is non-empty nd stisfies L = LΣ (L = Σ L, L = Σ LΣ, L = Σ L, respectively). We refer to ll four types s idel lnguges or simply idels. If L is right (respectively, left, two-sided, ll-sided) idel, ny lnguge G Σ such tht L = GΣ (respectively, L = Σ G, L = Σ GΣ, L = Σ G) is genertor of L. The quotients of idels GΣ, Σ G, nd Σ GΣ re derived from Eqution (2) nd given elow, where words u, v, x, nd y re in Σ + : (GΣ ) w = (G w G ε G ε u )Σ ; (3) w=uv (Σ G) w = Σ G G w w=uv (Σ GΣ ) w = Σ (GΣ ) (GΣ ) w [Σ G (G w G v ; (4) w=uv G v ) (GΣ ) v = w=uv w=uv v=xy [G ε u ( G ε x )]]Σ. (5) We use these formuls to estlish upper ounds on the complexity of the idels G Σ, Σ G, nd Σ G Σ generted y G. 9

10 Theorem 4 (Complexity of Idels in Terms of Genertors) Let G e ny genertor of the right idel GΣ (left idel Σ G, two-sided idel Σ GΣ, or ll-sided idel Σ G) with κ(g) = n. Then (1) For n 1, κ(gσ ) n, nd the ound is tight if Σ 1; (2) κ(σ G) 2 n 1, nd the ound is tight if Σ = 1 for n = 1, nd Σ 2, otherwise; (3) For n = 1, κ(σ GΣ ) = 1, nd for n 2, κ(σ GΣ ) 2 n nd the ound is tight if Σ 2; (4) For n = 1, κ(σ G) = 1, nd for n 2, κ(σ G) 2 n nd the ound is tight if Σ n 2, nd cnnot e met using ny smller lphet. PROOF. The first two items follow from the results in [42]. We give short proofs using quotients. 1. If n = 1, then G = Σ nd κ(gσ ) = 1. If n 2, then G is non-empty. From Eqution (3), if w hs no prefix in G, then (GΣ ) w = G w Σ. As κ(g) = n, there cn e t most n 1 such quotients, for there must e t lest one quotient G w with w G. However, for every word w with prefix x in G, we hve (GΣ ) w = (GΣ ) x = Σ. Hence there re t most n different quotients. The unry lnguge G = n 1 meets the ound. 2. One of the n quotients of G, nmely G ε = G, lwys ppers on the righthnd side of Eqution (4). Thus there re t most 2 n 1 susets of quotients of G to e dded to Σ G, nd so Σ G hs t most 2 n 1 distinct quotients. For tightness, if n = 1, then G = Σ meets the ound. For n 2, let G e the lnguge ccepted y the df in Fig. 2. To get n nf for Σ G, dd loop on in the initil stte 0. By Lemm 1, every suset of {0, 1,..., n 1} contining stte 0 is rechle in the corresponding suset utomton. Since for ech stte i, the word n 1 i is ccepted y the nf only from stte i, distinguishility follows y Lemm n 2 n 1 Fig. 2. The df of G with κ(g) = n nd κ(σ G) = 2 n Since quotient G is lwys present in the expression in Eqution (5), there re t most 2 n 1 distinct unions of quotients of lnguge G. Since G is nonempty, it hs t lest one finl quotient. If the finl quotient is G, then the 10

11 resulting lnguge is Σ. Otherwise, t lest 2 n 2 unions contin finl quotient of G, nd the corresponding quotients of two-sided idel Σ GΣ re Σ. Thus 2 n is n upper ound. To prove the tightness of the ounds, for n = 1 use Σ nd for n = 2 use the lnguge ( ). For n 3 consider the lnguge G defined y the df in Fig. 3. To get n nf for Σ GΣ, dd loop on in the initil stte 0. By Lemm 1, every suset of {0, 1,..., n 2} contining stte 0 is rechle in the corresponding suset utomton. For ech stte i in {0, 1,..., n 2}, the word n 2 i is ccepted y the nf only from sttes i nd n 1. It follows tht the susets of {0, 1,..., n 2} re pirwise distinguishle. All of them re non-finl sttes of the suset utomton. Also, the finl stte {0, n 1} is reched from {0, n 2} y. The lower ound 2 n follows. 0 1 n 3 n 2 n 1 Fig. 3. The df of G with κ(g) = n nd κ(σ GΣ ) = 2 n If n = 1, then G = Σ nd κ(σ G) = 1. For n 2, since n llsided idel is two-sided idel, the upper ound 2 n pplies. For n = 2, the lnguge meets the ound. For n 3, Okhotin [31] used the lphet Σ = { 1,..., n 2 } nd the lnguge G = n 2 i=1 i Σ i Σ to prove the tightness of the ound. He lso showed tht the ound cnnot e met if n 3 letters re used. In Theorem 4, notice the lck of symmetry in the complexities of right nd left idels, nd the equlity of complexities of two-sides nd ll-sided idels. Note lso tht provly growing lphet is required for ll-sided idels [31]. As n nonymous referee correctly points out, in such sitution it is no longer cler whether stte complexity is n pproprite mesure of complexity. This result should perhps e restted s follows. Let G e ny genertor of the ll-sided idel Σ G with κ(g) = n 2, nd Σ n 2. Then κ(σ G) 2 n 2 + 1, nd this ound is tight. Here the mesure of complexity of G should e some function of oth the stte complexity nd the lphet size perhps their product ecuse the ound cnnot e reched if the lphet size is ounded y constnt. Conversely, if the size of the lphet is fixed, then the ound for tht lphet though it my e hrd to find surely exists, nd is gurnteed to e smller thn 2 n [31]. 11

12 Next, we consider the complexities of idels in terms of their miniml genertors. The following re well-known properties of idels [26]. (1) If L is right idel, the miniml genertor of L is M = L \ (LΣ + ), nd M is prefix-free. If M is prefix-free, then it is the miniml genertor of MΣ. (2) If L is left idel, the miniml genertor of L is M = L \(Σ + L), nd M is suffix-free. If M is suffix-free, then it is the miniml genertor of Σ M. (3) If L is two-sided idel, the miniml genertor of L is M = L\(Σ + LΣ Σ LΣ + ), nd M is fctor-free. If M is fctor-free, then it is the miniml genertor of Σ MΣ. (4) If L is n ll-sided idel, the miniml genertor of L is the set M of ll words of L tht hve no proper suwords in L, nd thus M is suwordfree. If M is suword-free, then it is the miniml genertor of Σ M. Theorem 5 (Complexity of Idels in Terms of Miniml Genertors) Let M e the miniml genertor of the right idel MΣ, (left idel Σ M, twosided idel Σ MΣ, or ll-sided idel Σ M) with κ(m) = n 3. Then (1) κ(mσ ) n nd the ound is tight if Σ 2; (2) κ(σ M) 2 n 2 nd the ound is tight if Σ 2; (3) κ(σ MΣ ) 2 n nd the ound is tight if Σ 2; (4) κ(σ M) 2 n 3 + 1, nd the ound is tight if Σ n 3. PROOF. 1. The upper ound n follows from Theorem 4. Let Σ = {}, nd let M = Σ n 3. The df for M is shown in Fig. 4. Then M hs n quotients nd genertes the right idel L = Σ n 3 Σ, which lso hs n quotients. Since M is prefix-free, it is the miniml genertor. 0 1 n 3 n 2 n 1 Fig. 4. The df of miniml genertor M with κ(mσ ) = n nd κ(σ M) = 2 n Replce G y M in Eqution (4). One of the n quotients of M, nmely M ε = M, lwys ppers in the union. Thus there re t most 2 n 1 susets of quotients of M to e dded to Σ M. Moreover, since M is suffix-free, M hs the empty quotient [19]. Consider the n 1 quotients other thn M. Ech union of suset of such quotients tht contins the empty quotient is equivlent to union without the empty quotient; hence there re t most 2 n 2 quotients of Σ M. For tightness, let Σ = {}, nd consider the suffix-free lnguge M = Σ n 3 12

13 ccepted y the df in Fig. 4. To get n nf for the generted left idel Σ M, omit the ded stte n 1 nd ll trnsitions incident to it, nd dd loop in stte 0 on letters. By Lemm 1, ll the susets of {0, 1,..., n 2} contining stte 0 re rechle in the corresponding suset utomton. These rechle sttes re pirwise distinguishle since for ech stte i, the word n 2 i is ccepted y the nf only from stte i. This gives 2 n 2 rechle nd pirwise distinguishle sttes, nd proves the lower ound. 3. Replce G y M in Eqution (5). Since M ε = M is lwys present, there re t most 2 n 1 susets of quotients of M to dd to M ε. Since M is the miniml genertor of L, it is fctor-free, nd hence prefix-free. Thus it hs only one finl quotient, ε, nd lso hs the empty quotient, nd so we hve t most 2 n 2 susets. Finlly, hlf of those 2 n 2 susets contin Σ, nd hence re equivlent to Σ. This leves 2 n susets, nd so κ(l) 2 n For n = 3, let Σ = {} nd M = ; then M is the miniml genertor of nd meets the ound. For n 4, consider the fctor-free lnguge M = Σ n 4 given y the df of Fig. 5. To get n nf for the generted two-sided idel Σ MΣ, omit the ded stte n 1 nd dd loops on letters in sttes 0 nd n 2. By Lemm 1, ll the susets of {0, 1,..., n 3} contining stte 0 re rechle in the corresponding suset utomton. For sttes 0, 1,..., n 3, the word n 2 i is ccepted y the nf only from stte i. Therefore, the non-finl susets of {0, 1,..., n 3} re pirwise distinguishle. The finl suset {0, 1, n 2} is reched from {0, n 3} y, nd the lower ound 2 n follows. 0 1 n 3 n 2 n 1 Fig. 5. The df of miniml genertor M with κ(σ MΣ ) = 2 n Since n ll-sided idel is two-sided idel, the ound of 2 n pplies. If n = 3, then M = meets the ound. For n 4, consider the suword-free lnguge M = 1 1 n 3 n 3 over the lphet { 1,..., n 3 }. Figure 6 shows the df for M; ll the undefined trnsitions go to the ded stte n 1 (not shown in the figure). To get n nf for Σ M, dd loops on every i in every stte. In the corresponding suset utomton, ech suset {0, i 1,...,i k } of {0, 1,..., n 3} is reched from the initil stte {0} y i1 ik. Since i with 1 i n 3 is ccepted y the nf only from sttes i nd n 2, the non-finl susets of {0, 1,..., n 3} re pirwise distinguishle. One of the finl susets, {0, 1, n 2}, is reched from {0, 1} y 1 1. This proves the rechility nd 13

14 1 1 1 i 0 i i n 2 n 3 n 3 n 3 Fig. 6. The df of miniml genertor M of ll-sided idel N with κ(n) = 2 n distinguishility of 2 n susets, nd concludes the proof. Theorem 5 shows tht using the miniml genertor does not ffect the complexity of the resulting right idel, ut reduces the complexity of the other idels roughly y fctor of 2 for lrge n. There is still lck of left-right symmetry, nd the ounds for two-sided nd ll-sided idels re gin equl. We now consider the converse prolem: Given n idel L of quotient complexity n, wht is the quotient complexity of its miniml genertor? We will need the next oservtion out left idels which follows from the fct tht vw L implies uvw L if L is left idel. Remrk 1 If L is left idel nd u, v Σ, then L v L uv. Theorem 6 (Complexity of Miniml Genertors) Let L e n idel with κ(l) = n, nd let M e its miniml genertor. (1) If L is right idel, then κ(m) n+1, nd the ound is tight if Σ 1. (2) If L is left idel, then κ(m) n(n 1)/2 + 2, nd the ound is tight if Σ 2. (3) If L is two-sided idel nd n = 1, then κ(m) = 2. Otherwise 3 κ(m) 3 + (n 1)(n 2)/2; the ound is tight if Σ 1 when n {2, 3}, nd if Σ 3 when n 4. PROOF. If n = 1, then L = Σ, M = ε, κ(m) = 2, nd the ounds re stisfied in ll three cses. Assume from now on tht n > 1, which implies tht ε L. 1. Let L e right idel nd M its miniml genertor. Then M is prefix-free, nd therefore the miniml df for M hs exctly one finl stte, which goes 3 We re grteful to Mrcus Holzer nd Sestin Jkoi for pointing out two errors in n erlier version of our pper nd for providing the witness tht stisfies the ound stted here. 14

15 to the ded stte under ech letter. To get df for L = MΣ, we remove ll the trnsitions going from the finl stte to the ded stte, nd dd loop on ech letter in the finl stte. In the resulting df, the ded stte my e unrechle; however, ll the remining sttes re rechle nd pirwise distinguishle. It follows tht κ(m) n + 1. The ound is met y the right idel L = n 1 with κ(l) = n. The miniml genertor is M = n 1 nd κ(m) = n If L is left idel nd u, v Σ, then L v L uv y Remrk 1. Since L = Σ L, we hve ΣL = Σ + L, showing tht M = L\ΣL. Let L hve quotients L 1, L 2,...,L n. If w = v is nonempty word, then M w = L v \ L v, which is difference of two quotients of L. Next, we hve L v L v. This mens, tht if i j, then t most one of L i \L j nd L j \L i my e non-empty quotient of M. Also, L i \L i = for ll i. Hence there re t most n(n 1)/2+2 quotients of M: M ε, t most one quotient for ech i j, nd. If n = 2, the unry lnguge meets the ound. For Σ = {}, n 3, let L = ( ) ( ) n 3 Σ. The df for L is shown in Fig. 7(). Note tht w L if nd only if w = x( ) n 3 y for some words x nd y, ecuse every quotient of L contins ( ) n 3, or, equivlently, the lnguge ( ) n 3 is ccepted from every stte of the df. Thus L is left idel with κ(l) = n. L n 1 n () ΣL n 1 n () Fig. 7. The df s of left idel L nd of the lnguge ΣL. The df of ΣL is shown in Fig. 7(). Let M = L \ ΣL, nd construct the cross-product utomton for M; see Fig. 8 for n = 5. The initil stte (1, 0) goes y to stte (1, 1), which turns out to e ded stte, nd y to stte (2, 1). Every stte (i, 1) with i 3 in column 1 is reched from stte (2, 1) y () i 2. Then every stte (i, j) with i > j 2 is reched from stte in column 1 y word in, nd there re n(n 1)/2 such sttes. Adding the initil stte nd the ded stte we get n(n 1)/2 + 2 rechle sttes. Now consider only the ove mentioned rechle sttes. Two sttes (i, j) nd (k, l) with i < k, tht is, sttes in different rows, re distinguished y n k, 15

16 1, 0 1, 1 1, 2 1, 3 1, 4 1, 5 2, 0 2, 1 2, 2 2, 3 2, 4 2, 5 3, 0 3, 1 3, 2 3, 3 3, 4 3, 5 4, 0 4, 1 4, 2 4, 3 4, 4 4, 5 5, 0 5, 1 5, 2 5, 3 5, 4 5, 5 Fig. 8. The df s of left idel L nd of the lnguge ΣL. which is ccepted from (k, l) nd rejected from (i, j). Two sttes (i, j) nd (i, l) with j < l, tht is, two distinct sttes in the sme row, go to two sttes (n, j ) nd (n, l ) with j < l in row n y n i. The ltter sttes re distinguished y n l, which is rejected from (n, l ) nd ccepted from (n, j ). Thus the rechle sttes re pirwise distinguishle, nd our proof is complete. 3. Since M = L \ (Σ + LΣ Σ LΣ + ) nd L = Σ LΣ, the miniml genertor is M = L \ (ΣL LΣ), nd M w = L w \ ( (ΣL) w (LΣ) w ) for every w in Σ. If w = ε, then M w = M; otherwise, w = v = u for some words u, v in Σ nd letters in Σ. We hve Next, (ΣL) w = (ΣL) v = {x vx ΣL} = {x vx L} = L v. (6) There re now two cses: (LΣ) w = (LΣ) u = {x ux LΣ}. (7) (1) If u L, then (LΣ) u = Σ since L is two-sided idel nd therefore u L implies uz L for every word z. (2) If u L, then (LΣ) u = {x = x c ux L nd c Σ} = L w Σ. Let us now return to M w. If u L, then (LΣ) w = Σ nd M w = L w \ Σ =. If u L, then M w = L w \ (L v L w Σ). Since L is lso left-idel, we hve L v L v = L w. Suppose the quotients of L re L 1,...,L n, where L n = Σ. Then for ny pir (i, j), i j, t most one of L i \(L j L i Σ) nd L j \(L i L j Σ) my e nonempty. In prticulr, for ny j n, since L j Σ, we must hve ε L j ; so L n \(L j L n Σ) = Σ \(L j Σ + ) = ε. We lso hve L j \(L n L j Σ) =. Therefore, there re t most 3+(n 1)(n 2)/2 distinct quotients of M: M ε, ε,, nd t most one quotient for ech pir (i, j), with i j nd i, j n. 16

17 If n = 2 (n = 3), the unry idel L = (L = ) hs miniml genertor M = (M = ), which meets the ound 3 (4). It ws conjectured y Mrcus Holzer nd Sestin Jkoi 4 tht the lnguge L ccepted y the df in Fig. 9 might hve the highest complexity; we now prove this conjecture., c, c 1, c 2 3 n 2 c c n 1 Fig. 9. The df of two-sided idel L meeting the ound for miniml genertor. Construct the dfs for the lnguges ΣL nd LΣ s shown in Fig. 10. The miniml genertor of L is M = L \ (ΣL LΣ) = ΣL L LΣ., c, c 0, c c 1, c 2 3 n 2 n 1 n c c c n, c, c c, c 1, c 2 3 n 2 n 1 n n + 1 c c Fig. 10. The df s for ΣL nd LΣ. Construct the direct product of ΣL, L, nd LΣ with initil stte (0, 1, 1); this is the only stte with first component 0. From stte (0, 1, 1) we rech stte (1, 2, 2) y. By pplying () j 2, we rech (1, j, j) for j = 3,...,n 1. Thus we cn rech n 2 sttes of the form (1, j, j). From (1, 2, 2) we rech (2, 3, 3) y, nd then (2, j, j) y () j 3, for j = 4,..., n 1. Thus we cn rech n 3 sttes of the form (2, j, j). Hving reched (i, j, j), we rech (i+1, j +1, j +1) y for i = 2,..., n 3 nd j = 3,...,n 2. So fr, we hve reched stte (0, 1, 1) nd (n 1)(n 2)/2 sttes of the form (i, j, j) with i = 1,...,n 2 nd j = i + 1,...,n 1. All these sttes re non-finl, ecuse the second component is less thn n, which is the only finl stte of the df for L. From (n 2, n 1, n 1), we rech (1, n, n), which is finl, ecuse stte 1 is non-finl in the df for L, stte n is finl in in the df for ΣL, nd non-finl in the df for LΣ. From the initil stte, we rech (1, 1, 1) y. From ny stte of the form (i, i, i), we cn only rech nother stte with ll three components equl or the stte (n, n, n + 1). All these sttes re non-finl, nd hence empty. 4 personl communiction 17

18 In summry, we hve shown tht the following 3 + (n 1)(n 2) sttes re rechle: the initil stte (0, 1, 1), the finl stte (1, n, n), the (n 1)(n 2)/2 sttes given ove, nd n empty stte. We now prove tht ll these sttes re distinguishle. The initil stte (0, 1, 1) is the only stte ccepting () n 3 c, (1, 1, 1) is empty, nd (1, n, n) is the only finl stte. Thus we re left with the remining (n 1)(n 2)/2 sttes. For ny two different sttes (i, j, j) nd (i, j, j ), where 1 i < j n 1 nd 1 i < j n 1, we hve two cses: (1) j j : Assume tht j < j without loss of generlity. Then stte (i, j, j ) ccepts w = n 1 j c, ut stte (i, j, j) rejects w. (2) j = j nd i i : Assume tht i < i. Then stte (i, j, j ) ccepts w = n 2 i c, ut stte (i, j, j) rejects w. Thus (i, j, j) nd (i, j, j ) re distinguishle in oth cses. Therefore the quotient complexity of M n is (n 1)(n 2)/ The construction of the miniml genertor of L cn e viewed s n opertion on L, s hs een done y Privkin nd Rodro [35]. They define the following opertors on n ritrry regulr lnguge L Σ + nd derive their complexities: (1) The prefix opertor L p = L \ LΣ + ; complexity n + 1. (2) The suffix opertor L s = L \ Σ + L; complexity (n 1)2 n (3) The infix opertor L i = L\(Σ + LΣ Σ LΣ + ); complexity (n 2)2 n (4) The hypercode opertor L h = L \ 1 2 n L Σ 1 Σ 2 Σ n Σ ; complexity (n 2)2 n Our results show tht the complexity is lso n+1 if L is right idel. However, the results differ considerly for left nd two-sided idels, since the complexity of the suffix opertion is only n(n 1)/2 + 2 for left idels, nd tht of the infix is only 3 + (n 1)(n 2)/2 for two-sided idels. We do not know the complexity of the hypercode opertor for ll-sided idels. 4 Bsic Opertions on Idels We now exmine the complexity of common opertions on idel lnguges. For regulr lnguges, the ounds re known, nd they re tight in the inry cse; references will e given for ech opertion lter. In this section, we show tht the ounds for idels re generlly lower, nd tight for lnguges over 18

19 smll fixed lphets, except for reversl of ll-sided idels, which requires growing lphet. 4.1 Boolen Opertions For the oolen opertions of union [29,42], intersection [36,42], difference [6] nd symmetric difference [6], the ound for regulr lnguges is mn, nd it is tight for ll four opertions for inry lphets. We show first tht the ounds for right, two-sided, nd ll-sided idels re still mn for intersection nd symmetric difference. However, the ound for union is decresed y (m + n 2), nd tht for difference, y m 1. To prove the tightness of these ounds, the sme two lnguges cn e used for ll four opertions, s is shown in the next theorem. Theorem 7 (Boolen Opertions: Right, 2-Sided, All-Sided Idels) Let K nd L e right idels (respectively, two-sided idels, or ll-sided idels) over n lphet Σ with κ(k) = m 1 nd κ(l) = n 1. Then (1) κ(k L), κ(k L) mn, (2) κ(k L) mn (m + n 2), (3) κ(k \ L) mn (m 1), nd ll the ounds re tight if Σ 2. PROOF. The upper ound mn for intersection nd symmetric difference holds since it holds for regulr lnguges. Since K nd L oth hve Σ s quotient, κ(k L) mn (m + n 2) nd κ(k \ L) mn (m 1) y Theorem 6 (iv) of [6]. For tightness of ll four ounds, consider the ll-sided idels K nd L ccepted y df s in Fig. 11. Construct the corresponding cross-product utomton with stte set {0,..., m 1} {0,..., n 1}, with (0, 0) s the initil stte. By, ech stte (i, j) goes to (i + 1, j), except for sttes (m 1, j) tht go to themselves. By, ech stte (i, j) goes to (i, j + 1), except for sttes (i, n 1) tht go to themselves. In this cross-product utomton, ech stte (i, j) is reched from the initil stte (0, 0) y i j. The cross-product utomton for the symmetric difference of K nd L is shown in Fig. 12 for m = 4 nd n = 5. For the other opertions only the finl sttes chnge. In the cse of intersection, the sole finl stte is (m 1, n 1). Consider two sttes in different rows, tht is sttes (i, j) nd (k, l) with i < k. By word n, 19

20 K 0 1 m 2 m 1 L 0 1 n 2 n 1 Fig. 11. The ll-sided idels meeting the upper ounds for oolen opertions. 0, 0 0, 1 0, 2 0, 3 0, 4 1, 0 1, 1 1, 2 1, 3 1, 4 2, 0 2, 1 2, 2 2, 3 2, 4 3, 0 3, 1 3, 2 3, 3 3, 4 Fig. 12. Cross-product utomton for symmetric difference; m = 4, n = 5. they go to distinct sttes (i, n 1) nd (k, n 1) in the column n 1. The ltter sttes re distinguished y word m 1 k, since it is ccepted from (k, n 1) ut rejected from (i, n 1). Symmetriclly, two sttes in different columns re distinguished y word in m. In the cse of symmetric difference, ll the sttes in row m 1 nd column n 1, except for stte (m 1, n 1) re finl. Consider two sttes in different rows, tht is sttes (i, j) nd (k, l) with i < k. Then the word n m 1 k is rejected from (k, l) nd ccepted from (i, j). Symmetriclly, two sttes in different columns re distinguished y word in m. In the cse of union, ll the sttes in row m 1 nd in column n 1 re finl. All of them ccept Σ. Therefore, these finl sttes re equivlent. The non-finl sttes re distinguished y word in. In the cse of difference, ll the sttes in row m 1, except for stte (m 1, n 1) re finl. All the sttes in column n 1 re equivlent to the ded stte (m 1, n 1). Consider the remining sttes. The sttes in different rows re distinguished y word in. Sttes (i, j) nd (i, l) with j < l re distinguished y m n 1 l since it is rejected from (i, l) ut ccepted from (i, j). 20

21 Now we turn to left idels. The next theorem shows tht the complexity of ll four opertions is the sme s for regulr lnguges, nd inry lphets suffice for tightness for intersection nd symmetric difference. However, n lphet of four letters is needed for union nd three, for difference. Theorem 8 (Boolen Opertions: Left Idels) Let K nd L e left idels over n lphet Σ with κ(k) = m 1, κ(l) = n 1, Then (1) κ(k L), κ(k L) mn, nd the ound is tight if Σ 2; (2) κ(k L) mn, nd the ound is tight if Σ 4; (3) κ(k \ L) mn, nd the ound is tight if Σ 3. PROOF. All the upper ounds hold since they hold for regulr lnguges. Let us prove the lower ounds. 1. Since lnguges K nd L ccepted y df s in Fig. 11 re ll-sided idels, the lower ounds for intersection nd symmetric difference follow y Theorem Consider left idels K nd L ccepted y the df s in Fig. 13. In the corresponding cross-product utomton for union, ech stte (i, j) is reched from the initil stte (0, 0) y i j. Notice tht ech stte (i, j) goes to stte (i, 0) y c, nd to stte (0, j) y d. All the sttes in row m 1 nd in column n 1 re finl. Two distinct sttes in different rows re distinguished y word in c, nd two distinct sttes in different columns re distinguished y word in d., c, d, c, c, c K 0 1 m 2 d d d m 1, c, d, d, d, d L 0 1 n 2 n 1 c c c Fig. 13. The left idels meeting the ound mn for union. 3. Consider left idels K nd L ccepted y df s in Fig. 13, ut restricted to letters, c. In the corresponding cross-product utomton for difference, ech stte (i, j) is reched from the initil stte (0, 0) y i j. All the sttes in row m 1, except for stte (m 1, n 1), re finl. Two distinct sttes in different rows re distinguished y word in c. Two sttes (i, j) nd (i, l) with j < l re distinguished y n 1 l m 1 i since stte (i, l) goes to non-finl 21

22 stte (m 1, n 1) y this word, while stte (i, j) goes to finl stte in row m Product The ound for product (ctention, conctention) of regulr lnguges is (m 1)2 n + 2 n 1, nd it is tight in the inry cse [22,29,42]. We show tht the ound for right idels is still exponentil in n, nd cn e met y inry lnguges. In contrst to this, the ound for the other three idels is only m + n 1 nd it is met y unry lnguges. Theorem 9 (Product) Let K nd L e idels of the sme type with κ(k) = m 1 nd κ(l) = n 1. Then (1) If K nd L re left, two-sided, or ll-sided idels, then κ(kl) m+n 1; (2) If K nd L re right idels nd n 2, then κ(kl) m + 2 n 2. The first ound is tight if Σ 1, nd the second, if Σ 2. PROOF. 1. If m = 1, then K = Σ, nd κ(kl) = κ(σ L) = n = m + n 1. Hence suppose tht m 2, K nd L re left idels, nd A nd B re the df s for K nd L, respectively. Construct df C from df s A nd B y omitting ll the finl sttes of A nd ll the trnsitions going from the finl sttes, nd y redirecting ll the trnsitions tht go from non-finl stte to finl stte of A to the initil stte of B. Let us show tht df C ccepts KL. If word w is ccepted y C, then it is in KL. Now let w e word in KL. Then w = uv for some words u nd v such tht df A ccepts u nd df B ccepts v. Let u e the shortest prefix of u such tht df A is in finl stte fter reding u. Then u = u u for some word u. Since L is left idel nd v is in L, the word u v is in L s well, nd therefore B ccepts u v. It follows tht df C ccepts u u v since the ccepting computtion of C on u u v consists of the computtion of A on u, in which the lst trnsitions is redirected to the initil stte of B, nd of the ccepting computtion of B on u v. Hence C ccepts KL nd hs t most m + n 1 sttes. Since every ll-sided or two-sided idel is lso left idel, the upper ound pplies in these cses s well. The ound is met y unry ll-sided idels m 1 nd n If K nd L re right idels, then KL = KΣ LΣ = K Σ LΣ, where Σ LΣ is left idel. The quotient complexity of this left idel is t most 2 n 2 +1 y 22

23 Theorem 4. In the sme wy s ove, we cn construct df for K Σ LΣ of t most m + 2 n 2 sttes. For tightness, consider the right idels K nd L given y df s in Fig. 14; if m = 1, then K = ( ) nd if n = 2, then L = ( ). To get n nf for KL, dd loop on in stte p 0, nd redirect trnsitions on from stte m 2 to stte p 0. K 0 1 m 2 m 1 L p 0 p 1 p n 2 p n 1 Fig. 14. The right idels meeting the ound m + 2 n 2 for product. In the corresponding suset utomton, ll the susets of {p 0, p 1,...,p n 2 } contining stte p 0 re rechle y Lemm 1, nd two such distinct susets re distinguished y word in. The singleton sets {0}, {1},..., {m 2} re rechle s well, nd re distinguished y word in. The singleton set {i} with 0 i n 2 nd suset of {p 0, p 1,..., p n 2 } contining stte p 0 re distinguished y the word n 2 tht is rejected from {i} ut ccepted from ny such suset, since stte p 0 goes to the ccepting stte p n 1 y n 2. All these susets re non-finl sttes of the suset utomton. The finl stte {p 0, p n 1 } is reched from {p 0, p n 2 } y. This gives m + 2 n 2 rechle nd pirwise distinguishle sttes. 4.3 Str For the str opertion, the ound for regulr lnguges [29,42] is 2 n n 2, nd it is met y inry lnguge. In shrp contrst to this, the corresponding ound for idels is only n + 1, nd it is lso met y inry lnguge. Theorem 10 (Str) Let L e n idel lnguge with κ(l) = n 2. Then κ(l ) n + 1, nd the ound is tight if Σ 2. PROOF. If L is n idel nd i 1, then L i L. It follows tht L = {ε} L. To get df for L from the quotient utomton for L, we only need to dd new initil nd finl stte going y every letter to stte L corresponding to the quotient of L y. Therefore, κ(l ) n

24 For tightness, consider the inry ll-sided idel ccepted y the df of Fig. 15. Construct df for L y dding new initil nd finl stte going to stte 1 y nd to stte 0 y. The resulting (n + 1)-stte df is miniml since the new initil nd finl stte is distinguished from finl stte n 1 y, while two distinct non-finl sttes re distinguished y word in. n 2 L 0 1 n 1 Fig. 15. The ll-sided idel meeting the ound n + 1 for str. 4.4 Reversl To del with reversl, we strt with the quotient df of L nd reverse it y mking ll the finl sttes initil, mking the initil stte into finl stte, nd reversing ll the trnsitions. We then use the suset construction to otin df for L R with t most 2 n sttes. By theorem of Brzozowski [4], if df hs no unrechle sttes then the suset construction pplied to its reverse nd restricted to the rechle sttes lwys yields miniml df. Therefore, the complexity of the reverse of regulr lnguge is the sme s the numer of rechle sttes in the suset construction for its reverse, nd distinguishility need not e verified. In the cse of regulr lnguges, the ound for reversl [25,30] is 2 n, nd it is met y inry lnguge. The ounds for idels re still exponentil, ut with somewht reduced exponents. The witness is inry for right idels, ternry for left nd two-sided idels, nd requires growing lphet of 2n 4 letters for ll-sided idels. Since the reverse of ny lnguge recognized y 1-stte df is the sme lnguge, we ssume tht n 2 in the next theorem. Theorem 11 (Reversl) Let L e lnguge with κ(l) = n 2. (1) If L is right idel, then κ(l R ) 2 n 1. (2) If L is left idel, then κ(l R ) 2 n (3) If L is two-sided idel, then κ(l R ) 2 n (4) If L is n ll-sided idel, then κ(l R ) 2 n The ound is tight for right idels if Σ = 1 for n = 2 nd if Σ 2 otherwise, for left nd two-sided idels if Σ 3, nd for ll-sided idels if Σ 2n 4. 24

25 PROOF. 1. Since L is right idel, it hs only one finl quotient Σ. This quotient ecomes the initil stte of the nf for L R. Since this initil stte goes to itself y every letter, it ppers in every rechle suset of the corresponding suset utomton. Hence there re t most 2 n 1 rechle sttes in the corresponding suset utomton. For tightness, if n = 2, then L = meets the ound. For n 3, consider the inry right idel ccepted y the df in Fig. 16. In the suset utomton corresponding to the reverse of this df, every suset of {0, 1,..., n 1} contining stte n 1 is rechle y Lemm 1. This gives 2 n 1 rechle susets nd proves the lower ound. 0 1 n 3 n 2 n 1 Fig. 16. The right idel meeting the ound 2 n 1 for reversl. 2. The initil stte of the quotient utomton of left idel L is the only finl stte in the nf for L R. In the corresponding suset utomton, this stte ppers in 2 n 1 susets. All these susets re finl sttes of the suset utomton nd ll ccept Σ, since L R is right idel. Hence κ(l R ) 2 n Let us prove the tightness of the ound. If n = 2, then the ound is met y the lnguge ( ). If n 5, consider the ternry left idel ccepted y the df shown in Fig. 17, where ll the trnsitions under c from sttes 1, 2,..., n 1 go to stte 1. Notice tht the utomton restricted to sttes 1, 2,..., n 1 nd inputs nd is Šeej s (n 1)-stte utomton [24] meeting the upper ound for reversl. Therefore, every suset of {1, 2,..., n 1} is rechle in the suset utomton corresponding to the reverse of the df in Fig 17. Next, stte {0, 1,..., n 1} is reched from stte {1} y c. For n = 4, input mps stte 3 to itself in the df of Fig. 17 nd the remining trnsitions re not chnged. For n = 3, input mps 0 to itself nd trnsposes 1 nd 2, nd input is unchnged. 0 c n 2 n 1 Fig. 17. The left idel meeting the ound 2 n 1 +1 for reversl. Sttes 1,2,...,n 1 go to stte 1 under c. 25

26 3. Since L is right idel, its quotient utomton hs exctly one finl stte, which ccepts Σ. Therefore the suset utomton for L R hs t most 2 n 1 rechle sttes. Since L is lso left idel, ll finl sttes of the suset utomton for L R ccept Σ. Hence κ(l R ) 2 n If n = 2, the ound is met y unry two-sided idel. For n 3, consider the ternry two-sided idel ccepted y the df in Fig. 18. By Lemm 1, every suset of {1, 2,..., n 1} contining stte n 1 is rechle in the suset utomton corresponding to the reverse of the df. Moreover, stte {0, 1,..., n 1} is reched from stte {1, n 1} y c. This gives 2 n rechle susets nd proves the lower ound. c c c c c n 2, c n 1 Fig. 18. The two-sided idel meeting the ound 2 n for reversl. 4. Since n ll-sided idel is two-sided idel, the ound 2 n pplies. If n = 2, then the ound is 2, nd it is met y the unry ll-sided idel. If n 3, consider the lnguge L over the lphet { 1,..., n 2, 1,..., n 2 } ccepted y the df in Fig. 19. Here the initil stte 0 goes to stte i y i nd to itself y ll j s. Every stte i goes to stte n 1 y i nd y ll j s, nd to itself y every other letter. The sole finl stte n 1 goes to itself y every letter. After dding loops on every letter in every stte of the df, nd pplying the suset construction nd minimiztion to the resulting nf, we get df isomorphic to the originl one. It follows tht L is n ll-sided idel. In the suset utomton corresponding to the reverse of the df for L, {n 1} is the initil stte, every one of the 2 n 2 1 susets {n 1, i 1, i 2,...,i k }, where 1 k n 2 nd 1 i 1 < i 2 < < i k n 2, is reched from the initil stte {n 1} y word i1 i2 ik. The set {0, 1,..., n 1} is reched from {n 1} y 1 1. This completes the proof. 5 Unry Lnguges Unry lnguges hve specil properties ecuse the product of unry lnguges is commuttive. Let Σ = {}. If L is unry right idel, let i e its shortest word. Then L i, nd so L = i, nd every unry right idel is principl (generted y single element). In fct, L = i = i = i = i ; hence left, right, two-sided nd ll-sided idels coincide. 26

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

More information

Lecture 09: Myhill-Nerode Theorem

Lecture 09: Myhill-Nerode Theorem CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

More information

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information

Theory of Computation Regular Languages

Theory of Computation Regular Languages Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of

More information

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38 Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Finite-State Automata: Recap

Finite-State Automata: Recap Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under

More information

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun: CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce

More information

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

More information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

More information

Model Reduction of Finite State Machines by Contraction

Model Reduction of Finite State Machines by Contraction Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016 CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages lgorithms & Models of omputtion S/EE 374, Spring 209 NFs continued, losure Properties of Regulr Lnguges Lecture 5 Tuesdy, Jnury 29, 209 Regulr Lnguges, DFs, NFs Lnguges ccepted y DFs, NFs, nd regulr expressions

More information

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Converting Regular Expressions to Discrete Finite Automata: A Tutorial Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert

More information

Tutorial Automata and formal Languages

Tutorial Automata and formal Languages Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we

More information

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Closure Properties of Regular Languages

Closure Properties of Regular Languages Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

1 From NFA to regular expression

1 From NFA to regular expression Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work

More information

Closure Properties of Regular Languages

Closure Properties of Regular Languages of Regulr Lnguges Dr. Neil T. Dntm CSCI-561, Colordo School of Mines Fll 2018 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll 2018 1 / 50 Outline Introduction Closure Properties Stte Minimiztion

More information

Regular Languages and Applications

Regular Languages and Applications Regulr Lnguges nd Applictions Yo-Su Hn Deprtment of Computer Science Yonsei University 1-1 SNU 4/14 Regulr Lnguges An old nd well-known topic in CS Kleene Theorem in 1959 FA (finite-stte utomton) constructions:

More information

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

Lecture 9: LTL and Büchi Automata

Lecture 9: LTL and Büchi Automata Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

More information

Deterministic Finite Automata

Deterministic Finite Automata Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite

More information

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck. Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers 80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES 2.6 Finite Stte Automt With Output: Trnsducers So fr, we hve only considered utomt tht recognize lnguges, i.e., utomt tht do not produce ny output on ny input

More information

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA RIGHT LINEAR LANGUAGES. Right Liner Grmmr: Rules of the form: A α B, A α A,B V N, α V T + Left Liner Grmmr: Rules of the form: A Bα, A α A,B V N, α V T

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

More information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

Lecture 3: Equivalence Relations

Lecture 3: Equivalence Relations Mthcmp Crsh Course Instructor: Pdric Brtlett Lecture 3: Equivlence Reltions Week 1 Mthcmp 2014 In our lst three tlks of this clss, we shift the focus of our tlks from proof techniques to proof concepts

More information

I F I G R e s e a r c h R e p o r t. Minimization, Characterizations, and Nondeterminism for Biautomata. IFIG Research Report 1301 April 2013

I F I G R e s e a r c h R e p o r t. Minimization, Characterizations, and Nondeterminism for Biautomata. IFIG Research Report 1301 April 2013 I F I G R e s e r c h R e p o r t Institut für Informtik Minimiztion, Chrcteriztions, nd Nondeterminism for Biutomt Mrkus Holzer Sestin Jkoi IFIG Reserch Report 1301 April 2013 Institut für Informtik JLU

More information

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite

More information

DFA minimisation using the Myhill-Nerode theorem

DFA minimisation using the Myhill-Nerode theorem DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter,

More information

The size of subsequence automaton

The size of subsequence automaton Theoreticl Computer Science 4 (005) 79 84 www.elsevier.com/locte/tcs Note The size of susequence utomton Zdeněk Troníček,, Ayumi Shinohr,c Deprtment of Computer Science nd Engineering, FEE CTU in Prgue,

More information

Myhill-Nerode Theorem

Myhill-Nerode Theorem Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014 CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

State Complexity of Union and Intersection of Binary Suffix-Free Languages

State Complexity of Union and Intersection of Binary Suffix-Free Languages Stte Complexity of Union nd Intersetion of Binry Suffix-Free Lnguges Glin Jirásková nd Pvol Olejár Slovk Ademy of Sienes nd Šfárik University, Košie 0000 1111 0000 1111 Glin Jirásková nd Pvol Olejár Binry

More information

GNFA GNFA GNFA GNFA GNFA

GNFA GNFA GNFA GNFA GNFA DFA RE NFA DFA -NFA REX GNFA Definition GNFA A generlize noneterministic finite utomton (GNFA) is grph whose eges re lele y regulr expressions, with unique strt stte with in-egree, n unique finl stte with

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Mehryr Mohri Cournt Institute nd Google Reserch mohri@cims.nyu.com Preliminries Finite lphet Σ, empty string. Set of ll strings over

More information

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30 Tlen en Automten Test 1, Mon 7 th Dec, 2015 15h45 17h30 This test consists of four exercises over 5 pges. Explin your pproch, nd write your nswer to ech exercise on seprte pge. You cn score mximum of 100

More information

Nondeterministic Biautomata and Their Descriptional Complexity

Nondeterministic Biautomata and Their Descriptional Complexity Nondeterministic Biutomt nd Their Descriptionl Complexity Mrkus Holzer nd Sestin Jkoi Institut für Informtik Justus-Lieig-Universität Arndtstr. 2, 35392 Gießen, Germny 23. Theorietg Automten und Formle

More information

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

More information

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-* Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion

More information

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7 CS103 Hndout 32 Fll 2016 Novemer 11, 2016 Prolem Set 7 Wht cn you do with regulr expressions? Wht re the limits of regulr lnguges? On this prolem set, you'll find out! As lwys, plese feel free to drop

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions

More information

Let's start with an example:

Let's start with an example: Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte

More information

Operations on Unambiguous Finite Automata

Operations on Unambiguous Finite Automata Opertions on Unmbiguous Finite Automt Jozef Jirásek, Jr., Glin Jirásková, 2,, nd Jurj Šebej Mthemticl Institute, Slovk Acdemy of Sciences Grešákov 6, 4 Košice, Slovki jirsekjozef@gmil.com, jirskov@sske.sk

More information

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy: Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes

More information

Bases for Vector Spaces

Bases for Vector Spaces Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything

More information

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!) CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

Worked out examples Finite Automata

Worked out examples Finite Automata Worked out exmples Finite Automt Exmple Design Finite Stte Automton which reds inry string nd ccepts only those tht end with. Since we re in the topic of Non Deterministic Finite Automt (NFA), we will

More information

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA) Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr

More information

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

Torsion in Groups of Integral Triangles

Torsion in Groups of Integral Triangles Advnces in Pure Mthemtics, 01,, 116-10 http://dxdoiorg/1046/pm011015 Pulished Online Jnury 01 (http://wwwscirporg/journl/pm) Torsion in Groups of Integrl Tringles Will Murry Deprtment of Mthemtics nd Sttistics,

More information

State Minimization for DFAs

State Minimization for DFAs Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid

More information

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010 CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v. 1 Exercises Chpter 1 Exercise 1.1. Let Σ e n lphet. Prove wv = w + v for ll strings w nd v. Prove # (wv) = # (w)+# (v) for every symol Σ nd every string w,v Σ. Exercise 1.2. Let w 1,w 2,...,w k e k strings,

More information

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers Speech Recognition Lecture 2: Finite Automt nd Finite-Stte Trnsducers Eugene Weinstein Google, NYU Cournt Institute eugenew@cs.nyu.edu Slide Credit: Mehryr Mohri Preliminries Finite lphet, empty string.

More information

A negative answer to a question of Wilke on varieties of!-languages

A negative answer to a question of Wilke on varieties of!-languages A negtive nswer to question of Wilke on vrieties of!-lnguges Jen-Eric Pin () Astrct. In recent pper, Wilke sked whether the oolen comintions of!-lnguges of the form! L, for L in given +-vriety of lnguges,

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

Matrix Algebra. Matrix Addition, Scalar Multiplication and Transposition. Linear Algebra I 24

Matrix Algebra. Matrix Addition, Scalar Multiplication and Transposition. Linear Algebra I 24 Mtrix lger Mtrix ddition, Sclr Multipliction nd rnsposition Mtrix lger Section.. Mtrix ddition, Sclr Multipliction nd rnsposition rectngulr rry of numers is clled mtrix ( the plurl is mtrices ) nd the

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's Journl of utomt, Lnguges n Combintorics u (v) w, x{y c OttovonGuerickeUniversitt Mgeburg Tight lower boun for the stte complexity of shue of regulr lnguges Cezr C^mpenu, Ki Slom Computing n Informtion

More information

How Deterministic are Good-For-Games Automata?

How Deterministic are Good-For-Games Automata? How Deterministic re Good-For-Gmes Automt? Udi Boker 1, Orn Kupfermn 2, nd Mich l Skrzypczk 3 1 Interdisciplinry Center, Herzliy, Isrel 2 The Herew University, Isrel 3 University of Wrsw, Polnd Astrct

More information

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

More information

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution Tehnishe Universität Münhen Winter term 29/ I7 Prof. J. Esprz / J. Křetínský / M. Luttenerger. Ferur 2 Solution Automt nd Forml Lnguges Homework 2 Due 5..29. Exerise 2. Let A e the following finite utomton:

More information

Lexical Analysis Finite Automate

Lexical Analysis Finite Automate Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions

More information