Abstract. The ISO standard for Standard Generalized Markup Language (SGML) provides a syntactic

Size: px
Start display at page:

Download "Abstract. The ISO standard for Standard Generalized Markup Language (SGML) provides a syntactic"

Transcription

1 Deterministic Regulr Lnguges Anne Bruggemnn-Klein Institut fur Informtik Universitt Freiburg Rheinstr. 10{12, 7800 Freiburg Germny Derick Wood Deprtment of Computer Science University of Wterloo Wterloo, Ontrio N2L 3G1 Cnd Abstrct The ISO stndrd for Stndrd Generlized Mrkup Lnguge (SGML) provides syntctic met-lnguge for the denition of textul mrkup systems. In the stndrd the right hnd sides of productions re clled content models nd they re bsed on regulr expressions. The llowble regulr expressions re those tht re \unmbiguous" s dened by the stndrd. Unfortuntely, the stndrd's use of the term \unmbiguous" does not correspond to the two well known notions, since not ll regulr lnguges re denoted by \unmbiguous" expressions. Furthermore, the stndrd's denition of \unmbiguous" is somewht vgue. Therefore, we provide precise denition of \unmbiguous expressions" nd renme them deterministic regulr expressions to void ny confusion. A regulr expression E is deterministic if the cnonicl -free nite utomton ME recognizing L(E) is deterministic. A regulr lnguge is deterministic if there is deterministic expression tht denotes it. We give Kleene-like theorem for deterministic regulr lnguges nd we chrcterize them in terms of the structurl properties of the miniml deterministic utomt recognizing them. The ltter result enbles us to decide if given regulr expression denotes deterministic regulr lnguge nd, if so, to construct n equivlent deterministic expression. Clssiction: Automt nd forml lnguges, esp. forml models in document processing 1 Introduction Document processing systems like editors, formtters, nd retrievl systems del with mny different types of documents, like books, rticles, memos, dictionries, or letters, in ddition to user-dened document types or customized versions of \public" types. Recently, the Stndrd Generlized Mrkup Lnguge (SGML) [ISO86] hs been estblished s common pltform for the syntctic speciction of document types nd conforming documents. SGML is n ISO stndrd nd hs been endorsed by number of publishing houses throughout North Americ nd Europe, by the Europen Community, nd by the U.S. Deprtment of Defense. Document types in SGML re dened by context free grmmrs tht re mixture of Hrrison nd Ginsburg's brcketed grmmrs [GH67] nd LLonde's regulr right side grmmrs [LL77]. Regulr expressions form the right-hnd sides of productions, but not ll regulr expressions re llowed, only those tht re \unmbiguous" in the sense of Cluse of the stndrd. The intent of the stndrd is to mke it esier for humn to write regulr expressions tht cn be interpreted unmbiguously. To chieve this the stndrd requires ech regulr expression to be \unmbiguous" in the sense tht \n element : : : tht occurs in the document instnce must be

2 ble to stisfy only one primitive content token without looking hed in the document instnce." In other words, only such regulr expressions re vlid tht permit us to uniquely determine which ppernce of symbol in n expression should mtch symbol in n input word without looking beyond tht symbol in the input word. This requirement species exctly the clss of deterministic expressions tht we investigte here. An lterntive motivtion for our study is tht the theory of regulr lnguges hs become cornerstone in prcticl pplictions involving e.g. speciction, pttern mtching, nd the construction of scnners nd prsers. Perhps the most frequently occurring tsk is to construct, to speciction in the form of regulr expression, n utomton tht cn recognize the specied objects. Usully, one rst constructs non-deterministic nite utomton with -trnsitions (-NFA) in time liner in the size of E, elimintes the -trnsitions in qudrtic time, nd nlly converts the resulting NFA into deterministic nite utomton (DFA) [HU79]. The intermedite step cn be voided by directly constructing n -free utomton [BEGO71, ASU86]. It hs been climed [BS86] tht this NFA is the cnonicl representtion becuse it hs nturl connection with the derivtives [Brz64] of the originl expression. Since it tkes exponentil time in the worst cse to convert n NFA into DFA, it is nturl to sk for which regulr expressions E the cnonicl NFA M E is lredy deterministic. Such expressions re exctly wht we hve clled deterministic bove. It cn be tested in liner time whether regulr expression is deterministic, nd if so, the cnonicl deterministic utomton cn lso be constructed in liner time [Bru92]. In this pper, we rst give rigorous denition of deterministic regulr expressions. Then, we investigte the deterministic regulr lnguges, i.e. regulr lnguges tht cn be denoted by deterministic expression. As we will see, the deterministic regulr lnguges re proper subclss of the regulr lnguges; for exmple, for ech n 1, the expression (0 + 1) 0(0 + 1) n denotes regulr lnguge tht is not deterministic. First, we stte Kleene-like theorem for the clss of deterministic regulr lnguges. Next, we chrcterize the deterministic regulr lnguges in terms of the miniml deterministic utomt tht recognize them. To ech regulr lnguge L, the miniml deterministic nite utomton M L recognizing L is uniquely determined. We show tht deterministic regulr lnguges L cn be symbolized by structurl properties of M L. For stte q of M L, let the orbit O(q) of q denote the strongly connected component of q, i.e. the sttes of M L tht cn be reched from q nd vice vers. Some sttes of O(q), clled gtes, connect the orbit to the outside world. Now L is deterministic if nd only if ll orbits of M L dene deterministic regulr lnguges nd if for ech orbit O(q), ll gtes of O(q) hve identicl connections to the outside. Then we show tht ny deterministic regulr lnguge dened by DFA M with single orbit is of the form vnl, where L is deterministic nd vnl denotes the set of words w such tht vw is in L (the Brzozowski derivtive of L by v). Furthermore, miniml DFA recognizing L cn be constructed from M. Together, these results yield n lgorithm tht decides, given DFA M, whether its lnguge is deterministic nd, if so, constructs n equivlent deterministic expression. The decision lgorithm runs in time qudrtic in the size of M, but the corresponding deterministic expression cn be exponentil in the size of M. To give n exmple, for ech word w, the lnguge w of ll words over contining w s subword is deterministic regulr lnguge. Most proofs in this pper re just sketches. The complete proofs cn be found in the full version [BW91].

3 Figure 1 The Glushkov utomt corresponding to ( + b) + = ( 1 + b 2 ) 3 + nd (b ) = (b 1 2 ). 2 Deterministic regulr expressions The notion of symbol in word being stised or mtched by symbol in regulr expression hs been explined by number of uthors [BEGO71, ASU86, Hen68]. We prphrse here the description of Hennie [Hen68]. If word is denoted by n expression, it must be possible to spell out tht word by trcing n pproprite \pth" through the expression. If we indicte positions in expressions by subscripts, then the word bb is denoted by the expression (+b) + = ( 1 +b 2 ) 3 + becuse it corresponds to the pth tht strts t 1, visits b 2 twice, nd nlly rrives t 3. The set of subscripted symbols in n expression E is denoted by pos(e). Of course, the structure of the expression restricts the positions djcent symbols of word cn be mtched with. For instnce, if symbol in word is mtched by 3 in ( 1 + b 2 ) 3 +, then no further symbol of the word cn be mtched with symbol in the expression. These restrictions hve rst been formlized by Glushkov [Glu61]. This description suggests viewing regulr expression E s n utomton M E whose sttes correspond to the positions or occurrences of symbols in E nd whose trnsitions connect positions tht cn be consecutive on pth through E. We cll M E the Glushkov utomton of E. Figure 1 shows the two Glushkov utomt corresponding to the expressions (+b) + = ( 1 +b 2 ) 3 + nd (b ) = (b 1 2 ). In ddition to the sttes of M E tht correspond to positions in E, the true sttes, there is one unnmed stte in the Glushkov utomt of Figure 1 which cts s the initil stte. In generl, Glushkov utomt re non-deterministic, s (+b) + = ( 1 +b 2 ) 3 + illustrtes. After mtching n input symbol with 1, further cn either be mtched by 1 or 3. Thus, there is trnsition on from 1 to 1 nd to 3 in the Glushkov utomton. This exmple leds nturlly to precise denition of wht the SGML stndrd mens by deterministic expression. Denition 2.1 A regulr expression E is deterministic if M E is deterministic, i.e., if M E is DFA. A regulr lnguge is deterministic if there is some deterministic expression tht denotes it. Figure 1 illustrtes tht ( + b) + is not deterministic expression. Nevertheless, the lnguge denoted by ( + b) + is deterministic regulr lnguge, since it is lso denoted by (b ), which is deterministic expression. We dene M E inductively, rther thn in terms of the formlism introduced by Glushkov [Glu61] tht hs been used by number of uthors [BEGO71, ASU86, BS86].

4 M E hs the form M E = (Q E _[fq I g; ; E ; q I ; F E ), with Q E comprising the true sttes corresponding to positions in E, q I the new initil stte, the input lphbet, E : (Q E [ fq I g)?! 2 Q E the trnsition function, nd F E Q E [ fq I g the set of nl sttes. To simplify the discussion, we follow the generl convention tht regulr expressions re built from symbols in nd the empty string symbol, but not the empty set symbol ;. (Nevertheless, we consider the empty set to be deterministic regulr lnguge.) To identify two sttes in n utomton mens to replce them by new stte tht hs exctly the trnsitions tht both of the old ones hd. Denition 2.2 Given regulr expression E, we dene the construction of M E, illustrted in Figure 2, inductively s follows. [E = or ] M nd M re illustrted in Figure 2. [E = F + G] In M E the initil sttes of M F nd M G re identied. Let Q E = Q F _[ Q G ; (disjoint union, possibly fter renming sttes) F E = F F [ F G ; E (q; ) = 8 >< >: F (q; ) if q 2 Q F G (q; ) if q 2 Q G F (q I ; ) [ G (q I ; ) if q = q I : [E = F G] In M E copy of the initil stte of M G is identied with ech nl stte of M F. Let Q E = Q F _[ Q G ; (disjoint union, possibly fter renming sttes) ( FF [ (F F E = G n fq I g) if q I 2 F G, otherwise, F G E (q; ) = 8 >< >: F (q; ) if q 2 (Q F [ fq I g) n F F, F (q; ) [ G (q I ; ) if q 2 F F, G (q; ) if q 2 Q G. [E = F ] In M E ll trnsitions from q I in M F re dded to the nl sttes of M E. Let Q E = Q F ; F E = F F [ fq I g; ( F (q; ) [ E (q; ) = F (q I ; ) if q 2 F F, F (q; ) otherwise. Proposition 2.1 M E recognizes the lnguge denoted by E. Glushkov utomt hve some peculir structurl properties tht re worth investigting. First, the initil stte of M E hs no incoming trnsitions. This mkes the construction correct in the sense of Proposition 2.1. Furthermore, the sttes directly connected to the initil stte correspond exctly to the positions of E tht cn mtch the rst chrcter of word of E, nd the nl sttes in M E (besides s I ) correspond exctly to the ones tht mtch the lst chrcter of word of E. Thus, the initil stte hs trnsitions to rst positions in E, nd the nl sttes in M E (besides s I ) re nl positions of E. Second, for subexpression F of E, the structure of M F is retined in M E. Ech true stte of M F is lso true stte of M E, nd ll trnsitions between true sttes in M F belong lso to M E. Furthermore, mong ll positions of F, exctly the nl ones re nl sttes of M E or hve trnsitions in M E to positions outside of F. These conditions re even fullled uniformly, mening tht either ll or none of the nl positions of F re nl in E, nd tht either ll or

5 Figure 2 The inductive denition of M E.

6 none hve trnsition in M E on n 2 to position y of E outside of F. Hence, the nl positions of F re n interfce of M F to the surrounding prts of M E. Finlly, we will be especilly interested in mximl strred subexpressions of E, i.e. subexpressions of the form F tht re not subexpressions of nother strred subexpression G of E. For such n F, ny trnsitions in M E between positions of F re lredy trnsitions in M F. In this sense, M F is closed within M E. Proposition 2.2 Given regulr expression E, we cn decide if it is deterministic in time liner in the size of E. Proof The Glushkov utomton cn be constructed from E in such wy tht new trnsition is introduced t ech computtion step [Bru92]. As soon s we encounter trnsition tht mkes the utomton under construction non-deterministic, we stop nd report E to be non-deterministic. At this point, only time liner in the size of E hs been spent. 2 Book et l. [BEGO71] hve dened regulr expression E to be unmbiguous if the Glushkov utomton M E is unmbiguous, i.e. if for ech word w there is t most one computtion of M E tht ccepts w, or, equivlently, t most one pth through E tht spells out w. They hve shown tht ech regulr lnguge cn be denoted by n unmbiguous regulr expression. A deterministic expression E is n unmbiguous one where for ech word w the corresponding pth through E cn be computed incrementlly from w with just one symbol of look-hed. Thus, deterministic regulr expressions re relted to unmbiguous ones in the sme wy tht LL(1) grmmrs re relted to unmbiguous context-free grmmrs. This nlogy cn be mde precise: It is possible to trnslte regulr expression E in nturl wy into n equivlent context-free grmmr G E such tht E is deterministic if nd only if G E is LL(1). 3 The chrcteriztion theorem We rst stte without proof Kleene-like theorem for deterministic regulr lnguges. We then consider the cyclic structure of M E tht we cpture in terms of orbits. The structure of the orbits is essentilly preserved under minimiztion, nd, hence, orbits turn out to be exctly the right tool for chrcterizing deterministic regulr lnguges. We begin by dening three functions for lnguges tht cn lso be dpted to pply to regulr expressions. These functions re: rst(l), the set of symbols tht pper s the rst symbol of some word in L; lst(l), the set of symbols tht pper s the lst symbol of some word in L; nd followlst (L), the set of symbols tht follow prex of some word in L, where the prex is lso word in L. More formlly we hve: Denition 3.1 For L, let rst(l) = f 2 j w is in L for some word wg; lst(l) = f 2 j w is in L for some word wg; followlst (L) = f 2 j vw is in L; for some word v in L n fg nd some word wg: Theorem 3.1 stises the following conditions. 1. ;,, nd fg re in D. The deterministic regulr lnguges re the smllest clss D of lnguges tht 2. If A; B 2 D nd rst(a) \ rst(b) = ;, then A [ B 2 D. 3. If A; B 2 D, =2 A, nd followlst (A) \ rst(b) = ;, then AB 2 D.

7 4. If A 2 D, then A n fg 2 D. 5. If A 2 D nd followlst (A) \ rst(a) = ;, then A 2 D. It is well known tht, for ech regulr lnguge L, the minimum-stte deterministic utomton M L recognizing L is uniquely determined. We rgue tht, by exmining the cyclic structure of M L, we cn decide whether L is deterministic. Furthermore, for deterministic regulr lnguge L, we cn construct deterministic expression for L from M L. For ech DFA M = (Q; ; ; q 0 ; F ) recognizing L, the equivlence clss construction [ASU86] results in DFA M = (Q; ; ; [q 0 ]; F) which is isomorphic to M L. 1 For deterministic expression E denoting lnguge L, minimum-stte DFA M L cn be constructed directly from M E vi the equivlence clss construction. For non-deterministic expression E, however, the NFA M E hs rst to be converted to DFA vi the subset construction [ASU86]. Thus, we re looking for properties of M E tht re preserved under stte minimiztion, but not under subset construction. We strt from the structurl properties of M E noted in Section 2. Denition 3.2 Let M = (Q; ; ; q I ; F ) be n NFA. For q 2 Q, the strongly connected component of q, i.e. the sttes of M tht cn be reched from q nd from which q cn be reched s well, is clled the orbit of q nd denoted by O(q). We consider the orbit of q to be trivil if O(q) = fqg nd there re no trnsitions from q to itself in M. Denition 3.3 A stte q in n NFA M = (Q; ; ; q I ; F ) is clled gte of its orbit if either q is nl stte or there re q 0 2 Q n O(q) nd 2 with q?! q 0. The NFA M hs the orbit property if ech orbit of M is homogeneous with respect to its gtes, i.e. if, for ll gtes q 1 nd q 2 with O(q 1 ) = O(q 2 ), we hve: q 1 is nl stte if nd only if q 2 is nl stte. q 1?! q if nd only if q 2?! q, for ll q 2 Q n O(q 1 ) = Q n O(q 2 ) nd for ll 2. In Figure 3, both utomt hve three orbits, nmely f1g, f2; 3g, nd f4g. The singleton orbits re trivil, nd ech stte is gte of its orbit. The left utomton fullls the orbit property, the right one does not. Now we cn formulte necessry condition for regulr lnguge to be deterministic. Theorem 3.2 The miniml DFA M L recognizing deterministic regulr lnguge L hs the orbit property. This gives us our rst exmple of regulr lnguge tht is not deterministic. The rightmost utomton in Figure 3 is the miniml DFA for the lnguge denoted by ( + b) (c + bd), nd it does not hve the orbit property. Thus, this lnguge cnnot be deterministic. The proof of Theorem 3.2 is in two steps. First, we describe the orbits of the Glushkov NFA M E constructed in Denition 2.2 nd show tht M E hs the orbit property for ll regulr expressions. Next, we show tht the orbit property is preserved under stte minimiztion. Thus, if lnguge L is symbolized by deterministic regulr expression E, the miniml utomton M L = M E hs the orbit property. Lemm 3.3 Let E be regulr expression nd x 2 pos(e). If there is no strred subexpression F of E with x 2 pos(f ), then O(x) = fxg nd O(x) is trivil. On the other hnd, if F is the mximl strred subexpression of E with x 2 pos(f ), then O(x) = pos(f ), nd O(x) is not trivil. Finlly, the orbit of the initil stte q I is trivil. 1 Some minor techniclities re involved here, becuse the trnsition functions of M nd M re only prtilly dened. The detils re in the full version.

8 1 b 4 1 b 4 ( + b) 2 ( + b) (c + bd) 2 c Figure 3 Two NFAs, one fullls the orbit property, the other one does not. Lemm 3.4 Let E be regulr expression. Then, 1. M E hs the orbit property nd 2. if F is mximl strred subexpression of E with pos(f ) 6= ;, then the lst positions of F re the gtes of the orbit pos(f ). Figure 4 shows the Glushkov utomton for (bc ) = 1 (b 2 c 3 4. The gtes of orbit f2; 3; 4g re ) the sttes 3 nd 4, i.e. the lst position of the mximl strred subexpression (bc ) = (b 2 c 3 4). Now, consider deterministic utomton M nd its minimiztion M. If sttes p 1 ; : : : ; p n of M form n orbit in M, then the equivlence clsses [p 1 ]; : : : ; [p n ] belong to the sme orbit in M, which my, however, contin further elements. Figure 4 shows the Glushkov utomton M E for E = (bc ) = 1 (b 2 c 3 4) nd the miniml utomton M E. All sttes of M E besides stte 2 re equivlent, f1g is n orbit of M E, but [1] does not form complete orbit in M E. Nevertheless, the orbit of [1] in M E is completely generted by nother orbit of M E, nmely f2; 3; 4g. This is generl phenomenon, nmely, for ech orbit K of M, there is n orbit C of M tht fully genertes K, i.e. K = f[q] j q 2 Cg. C is clled lift of K. Now, if lifted orbit C is homogeneous with respect to its gtes, then so is K. Thus, we hve the following lemm, which concludes the proof of Theorem 3.2. Lemm 3.5 The orbit property is preserved under stte minimiztion. The orbit property hs gined us necessry condition for regulr lnguge to be deterministic. Another necessry condition evolves if we exmine the orbits themselves in isoltion. Denition 3.4 Let M be DFA. For q 2 Q M, let the orbit utomton M q of q, be the utomton obtined by restricting the stte set to O(q) with initil stte q nd nl sttes the gtes of O(q) in M. We sy the orbit of q is deterministic if L(M q ) is deterministic. A regulr lnguge L is sid to be n orbit lnguge if nd only if there is DFA M with single orbit tht recognizes L. Theorem 3.6 deterministic orbit lnguges. For ech deterministic lnguge L, the miniml DFA recognizing L hs only For the proof, gin we rst look t the orbit lnguges of Glushkov utomt nd then consider stte minimiztion. Let E be deterministic expression, nd let q be stte of M E with nontrivil orbit. Then, q is position of mximl strred subexpression F of E. Let L be the

9 Figure 4 The Glushkov utomton for the expression (bc ) = 1 (b 2 c 3 4 ) nd its minimiztion. lnguge of F, nd let v be word tht leds from the initil stte to q in M F. Since M F is closed within M E, the orbit lnguge of q in M E is lso the orbit lnguge of q in M F, which in turn is vnl := fw 2 j vw 2 Lg: The lnguge vnl is known s the derivtive of L by v [Brz64]. Thus, non-trivil orbit lnguge of M E is derivtive of lnguge denoted by mximl strred subexpression of E. The proof of the next proposition is in the full pper. Proposition 3.7 The derivtive of deterministic regulr lnguge is lso deterministic. As corollry, we hve: Lemm 3.8 Let E be deterministic regulr expression. Then, ll orbit lnguges of M E re deterministic regulr lnguges. Agin, this property is preserved under minimiztion, s cn be seen from the next lemm. Lemm 3.9 Let M be DFA nd M be its reduction. Then, for ech stte of M there is n equivlent stte q in M such tht 1. the orbit of q in M is lift of the orbit of [q] in M, nd 2. the orbit lnguges of q in M nd [q] in M re identicl. This concludes the proof of Theorem 3.6. The necessry conditions for miniml DFA to recognize deterministic regulr lnguge s given in Theorems 3.2 nd 3.6 re lso sucient: Theorem 3.10 Let L be regulr lnguge nd M be the miniml DFA recognizing L. Then, L is deterministic regulr lnguge if nd only if M hs the orbit property nd ll orbits of M re deterministic. Proof We show the impliction from right to left by induction on the number of orbits of M. Let M = (Q; ; ; q I ; F ) hve more thn one orbit. Furthermore, let q 1 ; : : : ; q n be the distinct sttes outside O(q I ) tht re rechble in one step from gte of O(q I ). All gtes of O(q I ) hve n i -trnsition to q i, nd no other outgoing trnsitions from gtes of O(q I ) to the outside exist. The i re pirwise distinct nd M qi hs no i -trnsition from nl stte. Let M i be the utomton whose sttes re the sttes of M tht re rechble from q i s the initil stte. Becuse M i hs fewer orbits thn M, M i is deterministic. Furthermore, L(M) = L(M qi )( 1 L(M 1 ) [ : : : [ n L(M n ))

10 Figure 5 An ; b-consistent DFA nd its ; b-cut. or L(M) = L(M qi )( 1 L(M 1 ) [ : : : [ n L(M n ) [ fg); nd deterministic expression for M cn be constructed from deterministic expressions for M qi nd M 1 ; : : : ; M n. 2 Theorem 3.10 is the rst step of decision lgorithm for deterministic regulr lnguges: Theorem 3.11 Given DFA M, we cn decide in time qudrtic in the size of M whether the lnguge of M is deterministic. If so, n equivlent deterministic expression cn be constructed. If miniml DFA M hs the orbit property, then its orbit utomt re lso miniml. This precludes to pply Theorem 3.10 directly for the orbit utomt. On the other hnd, we know lredy tht ech deterministic orbit lnguge of M hs the form vnl(f ), where F is deterministic expression. To conclude the proof of Theorem 3.11, we show how miniml DFA for L(F ) cn be constructed from M. Denition 3.5 A DFA M is -consistent, for 2, if there is stte f M () in M such tht ll nl sttes of M hve n -trnsition to f M (). Denition 3.6 Let M be i -consistent, for i 2, 1 i n, n 1. The 1 ; : : : ; n -cut M( 1 ; : : : ; n ) of M is constructed s follows. 1. A new stte q 0 is dded to M nd it is connected to f M ( i ) with n i -trnsition, for ll i. 2. All trnsitions with i from ech nl stte re removed from M. 3. Finlly, q 0 is mde initil nd nl. Figure 5 gives n exmple of n ; b-consistent DFA nd its ; b-cut. Theorem 3.12 Let M be miniml DFA recognizing lnguge L. Assume tht M consists of single, non-trivil orbit. Let 1 ; : : : ; n be the elements of for which M is consistent. Then, L is deterministic if nd only if 1. n L(M( 1 ; : : : ; n )) is deterministic. If L is deterministic nd 1 ; : : : ; n 2 re chosen s bove, we cn construct word v 2 L = L(M) = vnl(m( 1 ; : : : ; n )) ; with

11 Figure 6 The miniml DFA for (0 + 1) 0(0 + 1). nd deterministic expression for lnguge L cn be constructed from deterministic expression for lnguge L(M( 1 ; : : : ; n )). In lieu of proof, we illustrte Theorem 3.12 with two exmples. The lnguge recognized by the left utomton in Figure 5 is deterministic, becuse the ; b-cut is denoted by the deterministic regulr expression + b( + cc) +. One deterministic expression for the whole lnguge is c( + b( + cc)). Figure 6 shows the miniml DFA recognizing (0 + 1) 0(0 + 1). It consists of single orbit with two gtes, 00 nd 01, but is neither 0- nor 1-consistent. Thus, (0 + 1) 0(0 + 1) does not denote deterministic lnguge. The sme is true for (0 + 1) 0(0 + 1) n for ech n 1. References [ASU86] Alfred V. Aho, Rvi Sethi, nd Jerey D. Ullmn. Compilers: Principles, Techniques, nd Tools. Addison-Wesley Series in Computer Science, Addison-Wesley, Reding, Msschusetts, [BEGO71] Ronld Book, Shimon Even, Sheil Greibch, nd Gene Ott. Ambiguity in grphs nd expressions. IEEE Trnsctions on Computers, C-20(2):149{153, Februry [Bru92] Anne Bruggemnn-Klein. Regulr expressions into nite utomt. In Imre Simon, editor, Ltin '92, pges 87{98, Springer-Verlg, Berlin, Lecture Notes in Computer Scien0ce 583. [Brz64] Jnusz A. Brzozowski. Derivtives of regulr expressions. Journl of the ACM, 11(4):481{494, October [BS86] [BW91] [GH67] Gerrd Berry nd Rvi Sethi. From regulr expressions to deterministic utomt. Theoreticl Computer Science, 48:117{126, Anne Bruggemnn-Klein nd Derick Wood. On the expressive power of SGML document grmmrs. In preprtion, Seymour Ginsburg nd Michel M. Hrrison. Brcketed context-free lnguges. Journl of Computer nd System Sciences, 1(1):1{23, Mrch [Glu61] V.M. Glushkov. The bstrct theory of utomt. Russin Mthemticl Surveys, 16:1{53, [Hen68] Frederick C. Hennie. Finite-Stte Models for Logicl Mchines. John Wiley, New York, [HU79] John E. Hopcroft nd Jerey D. Ullmn. Introduction to Automt Theory, Lnguges nd Computtion. Addison-Wesley Series in Computer Science, Addison-Wesley, Reding, Msschusetts, 1979.

12 [ISO86] ISO Informtion processing text nd oce systems stndrd generlized mrkup lnguge (SGML). October Interntionl Orgniztion for Stndrdiztion. [LL77] Wilf R. LLonde. Regulr right prt grmmrs nd their prsers. Communictions of the ACM, 20(10):731{741, October 1977.

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

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions

More information

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51 Non Deterministic Automt Linz: Nondeterministic Finite Accepters, pge 51 1 Nondeterministic Finite Accepter (NFA) Alphbet ={} q 1 q2 q 0 q 3 2 Nondeterministic Finite Accepter (NFA) Alphbet ={} Two choices

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.6.: Push Down Automt Remrk: This mteril is no longer tught nd not directly exm relevnt Anton Setzer (Bsed

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

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

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

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

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

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

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1 Non-Deterministic Finite Automt Fll 2018 Costs Busch - RPI 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q q2 1 q 0 q 3 Fll 2018 Costs Busch - RPI 2 Nondeterministic Finite Automton (NFA) Alphbet

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

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

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

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

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

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

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

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

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent

More information

Automata and Languages

Automata and Languages Automt nd Lnguges Prof. Mohmed Hmd Softwre Engineering Lb. The University of Aizu Jpn Grmmr Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Regulr Lnguges Context Free Lnguges Context Sensitive

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

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

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

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

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

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

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion

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

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

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

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1 Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges

More information

Lecture 6 Regular Grammars

Lecture 6 Regular Grammars Lecture 6 Regulr Grmmrs COT 4420 Theory of Computtion Section 3.3 Grmmr A grmmr G is defined s qudruple G = (V, T, S, P) V is finite set of vribles T is finite set of terminl symbols S V is specil vrible

More information

Fundamentals of Computer Science

Fundamentals of Computer Science Fundmentls of Computer Science Chpter 3: NFA nd DFA equivlence Regulr expressions Henrik Björklund Umeå University Jnury 23, 2014 NFA nd DFA equivlence As we shll see, it turns out tht NFA nd DFA re equivlent,

More information

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir CSCI 2400 Models of Computtion, Section 3 Solutions to Homework 4 Problem 1. ll the solutions below refer to the Pumping Lemm of Theorem 4.8, pge 119. () L = f n b l k : k n + lg Let's ssume for contrdiction

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

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

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

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

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

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

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

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

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

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

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2 Alphbet ={} Two choices q1 q2 3 Alphbet ={} Two choices

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

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

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

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

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

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

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

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

1 Structural induction, finite automata, regular expressions

1 Structural induction, finite automata, regular expressions Discrete Structures Prelim 2 smple uestions s CS2800 Questions selected for spring 2017 1 Structurl induction, finite utomt, regulr expressions 1. We define set S of functions from Z to Z inductively s

More information

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn

More information

FABER Formal Languages, Automata and Models of Computation

FABER Formal Languages, Automata and Models of Computation DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte

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

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

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

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

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

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)

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

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

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks

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

Semantic reachability for simple process algebras. Richard Mayr. Abstract

Semantic reachability for simple process algebras. Richard Mayr. Abstract Semntic rechbility for simple process lgebrs Richrd Myr Abstrct This pper is n pproch to combine the rechbility problem with semntic notions like bisimultion equivlence. It dels with questions of the following

More information

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1 CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother

More information

How to simulate Turing machines by invertible one-dimensional cellular automata

How to simulate Turing machines by invertible one-dimensional cellular automata How to simulte Turing mchines by invertible one-dimensionl cellulr utomt Jen-Christophe Dubcq Déprtement de Mthémtiques et d Informtique, École Normle Supérieure de Lyon, 46, llée d Itlie, 69364 Lyon Cedex

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

1.9 C 2 inner variations

1.9 C 2 inner variations 46 CHAPTER 1. INDIRECT METHODS 1.9 C 2 inner vritions So fr, we hve restricted ttention to liner vritions. These re vritions of the form vx; ǫ = ux + ǫφx where φ is in some liner perturbtion clss P, for

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

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

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

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

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model? CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction

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

The Regulated and Riemann Integrals

The Regulated and Riemann Integrals Chpter 1 The Regulted nd Riemnn Integrls 1.1 Introduction We will consider severl different pproches to defining the definite integrl f(x) dx of function f(x). These definitions will ll ssign the sme vlue

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

This lecture covers Chapter 8 of HMU: Properties of CFLs

This lecture covers Chapter 8 of HMU: Properties of CFLs This lecture covers Chpter 8 of HMU: Properties of CFLs Turing Mchine Extensions of Turing Mchines Restrictions of Turing Mchines Additionl Reding: Chpter 8 of HMU. Turing Mchine: Informl Definition B

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

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa CS:4330 Theory of Computtion Spring 208 Regulr Lnguges Equivlences between Finite utomt nd REs Hniel Brbos Redings for this lecture Chpter of [Sipser 996], 3rd edition. Section.3. Finite utomt nd regulr

More information

Semantic Reachability. Richard Mayr. Institut fur Informatik. Technische Universitat Munchen. Arcisstr. 21, D Munchen, Germany E. N. T. C. S.

Semantic Reachability. Richard Mayr. Institut fur Informatik. Technische Universitat Munchen. Arcisstr. 21, D Munchen, Germany E. N. T. C. S. URL: http://www.elsevier.nl/locte/entcs/volume6.html?? pges Semntic Rechbility Richrd Myr Institut fur Informtik Technische Universitt Munchen Arcisstr. 21, D-80290 Munchen, Germny e-mil: myrri@informtik.tu-muenchen.de

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

CSC 311 Theory of Computation

CSC 311 Theory of Computation CSC 11 Theory of Computtion Tutoril on DFAs, NFAs, regulr expressions, regulr grmmr, closure of regulr lnguges, context-free grmmrs, non-deterministic push-down utomt, Turing mchines,etc. Tutoril 2 Second

More information

Global Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

Global Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems Globl Types for Dynmic Checking of Protocol Conformnce of Multi-Agent Systems (Extended Abstrct) Dvide Ancon, Mtteo Brbieri, nd Vivin Mscrdi DIBRIS, University of Genov, Itly emil: dvide@disi.unige.it,

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

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004 Advnced Clculus: MATH 410 Notes on Integrls nd Integrbility Professor Dvid Levermore 17 October 2004 1. Definite Integrls In this section we revisit the definite integrl tht you were introduced to when

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

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems

Centrum voor Wiskunde en Informatica REPORTRAPPORT. Supervisory control for nondeterministic systems Centrum voor Wiskunde en Informtic REPORTRAPPORT Supervisory control for nondeterministic systems A. Overkmp Deprtment of Opertions Reserch, Sttistics, nd System Theory BS-R9411 1994 Supervisory Control

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

Handout: Natural deduction for first order logic

Handout: Natural deduction for first order logic MATH 457 Introduction to Mthemticl Logic Spring 2016 Dr Json Rute Hndout: Nturl deduction for first order logic We will extend our nturl deduction rules for sententil logic to first order logic These notes

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

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

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

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

Global Session Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

Global Session Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems Globl Session Types for Dynmic Checking of Protocol Conformnce of Multi-Agent Systems (Extended Abstrct) Dvide Ancon, Mtteo Brbieri, nd Vivin Mscrdi DIBRIS, University of Genov, Itly emil: dvide@disi.unige.it,

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

1 Structural induction

1 Structural induction Discrete Structures Prelim 2 smple questions Solutions CS2800 Questions selected for Spring 2018 1 Structurl induction 1. We define set S of functions from Z to Z inductively s follows: Rule 1. For ny

More information