INTRODUCTION TO AUTOMATA THEORY

Size: px
Start display at page:

Download "INTRODUCTION TO AUTOMATA THEORY"

Transcription

1 Chpter 3 INTRODUCTION TO AUTOMATA THEORY In this hpter we stuy the most si strt moel of omputtion. This moel els with mhines tht hve finite memory pity. Setion 3. els with mhines tht operte eterministilly for ny given input while Setion 3. els with mhines tht re more flexile in the wy they ompute (i.e., noneterministi hoies re llowe). 3. Deterministi Finite-Stte Mhines A omputer s ility to reognize speifie ptterns is esirle for mny pplitions suh s text eitors, ompilers, n tses. We will see tht mny of these ptterns n e effiiently reognize with the simple finite-stte mhines isusse in this Chpter. 3.. The hep engineer s elevtors Wht kin of mhine hs only finite mount of memory? Of ourse, you my first think tht esk top omputer s memory (e.g., one with 64M RAM) is finite. But this is not extly true sine we hve externl memory (hr rives, tpe rives, n floppy isks) tht oul exten the memory pity to n ritrry lrge limit. We hve muh simpler moel in min where mhine is viewe s lose omputtion ox with only re-only tpe he (or toggle swithes) for externl input. Tht is, the internl prt of the mhine n e in one of finite numer of sttes. A ertin suset of these sttes, lle epting sttes, will inite tht the omputtion hs een suessful. If the mhine hlts in n epting stte, we ept (or reognize) the input s vli. 75

2 76 COMPSCI.FT To illustrte this further we onsier n over-simplifie onstrution of n elevtor ontrol mehnism. Of ourse, in this exmple, we re not plnning to reognize vli input, just to show how rel-worl finite-stte evie opertes. First onsier n elevtor tht moves etween two levels. We will uil evie with two sttes f g, where the stte numer orrespons with wht floor the elevtor is urrently lote. To sve ost we hve two types of inputs UP n DOWN; utton on eh floor initing tht person on one of the floors wnts to go to the other. The stte hnges, lle trnsitions, of this elevtor n e epite in the following tle formt or grphil igrm formt. The entries in the tle enote new stte of mhine fter n input is reeive (the iretionl rs on the igrph igrm enotes the sme thing). There re four ses to onsier. E.g., if the elevtor is on floor n the DOWN utton is presse then the elevtor shoul move to floor. UP/DOWN (input uttons) Sttes DOWN UP DOWN/UP We n exten this low uget elevtor exmple to hnle more levels. With one itionl floor we will hve more omintions of uttons n sttes to el with. At floor we nee oth n up utton, U, n own utton, D. For floor we just nee n up utton, U, n likewise for floor 3, we just nee own utton, D3. This prtiulr elevtor with three sttes is represente s follows: (input uttons) Sttes U U D D U, U, D U, D U, D3 D3 U 3 U, D, D3 One my see tht the ove elevtor proly lks in funtionlity sine to trvel two levels one hs to press two uttons. Nevertheless, these two smll exmples shoul inite wht we men y finite-stte mhine. 3.. Finite-stte mhines tht ept/rejet strings We now onsier finite-stte mhines where the input is from some finite hrter lphet. Our exmples will minly use simple hrter sets suh s = f g or = f g ut in prtie they my e s ig s the set of 7-it ASCII hrters

3 COMPSCI.FT 77 ommonly use y omputers. To o rel omputtions we nee notion of n initil or strting stte; we lso nee some mens to etermine whether the result of our omputtion is suessful or not. To hieve this we nee to esignte n unique strting stte n lssify eh stte s n epting or rejeting stte. A forml efinition of our (first) finite-stte omputtion moel is given next. Definition 4. A eterministi finite utomton (DFA) is five-tuple M =(Q s F) where. Q is the finite set of mhine sttes.. is the finite input lphet. 3. is trnsition funtion from Q to Q. 4. s Q is the strt stte. 5. F Q is the epting (memership) sttes. Notie tht the set of rejeting sttes is etermine y the set ifferene Q n F. Other uthors sometimes efine the next stte funtion s prtil funtion (i.e., not ll sttes ept ll inputs). Exmple 4. A very simple DFA exmple is M = (Q = f g = f g s = F = fg), where is represente in two ifferent wys elow. (input ) Sttes In the grphil representtion we use oule irles to enote the epting sttes F of Q. Also the initil stte s Q hs n isolte rrow pointing t it. Exmple 4. A more omplite DFA exmple is M elow with Q = f eg, =f 3 4g, s =, F = f eg n is represente y the following trnsition tle. (input ) Sttes 3 4 e e e,

4 78 COMPSCI.FT It is esy to generte irete grph (self-loops llowe) representtion from ove. We just view s n r reltionship on the sttes Q. Notie how we omine rs (into one) with ifferent lels etween the sme two sttes for ese of presenttion, s one for this view of DFA M.,3 4, 3,4,3,4, 3,4 e 3, Reognizing ptterns with DFA There re two min questions we hve t this point onerning DFA n the proess of pttern reognition of strings of hrters. For given DFA, wht strings oes it ept? For given set of strings, n we uil DFA tht reognizes just them? Before proeeing we nee nme for the set of inputs epte y some utomton. Definition 43. For DFA M, the set of strings (wors) epte y M is lle the lnguge L(M ) eie (reognize) y M. The set L(M ) is simply s suset of, ll hrter sequenes of the input lphet. We will see lter in Setion 3.4 tht the lnguges reognizle y finite utomt re extly those expressile s regulr expressions. Exmple 44. For the DFA M liste elow, L(M ) is the set of strings (over =f 3g) tht ontin the sustring 3.,3 3 3,,3

5 COMPSCI.FT 79 To ompute L(M ) we nee to lssify ll possile strings tht yiel stte trnsitions to n ept stte from the initil stte. When looking t grphil representtion of M, the strings re tken from the hrter sequene of trverse rs. Note tht more thn one string my orrespon to given pth euse some rs hve more thn one lel. Exmple 45. We onstrut DFA tht epts ll wors with n even numer of s n n o numer of s. A / prity guie for eh of the four sttes of the DFA is given on the right. Even/Even O/Even Even/O O/O We en this setion y mentioning tht there re some lnguges suh s L = f n n j n > g tht re not epte y ny finite-stte utomton. Why is L not reognize y ny DFA? Well, if we h DFA M of m sttes then it woul hve prolems epting just the set L sine the utomton hs to keep ifferent stte for eh ount of the s it res efore it res the s. If two ifferent ounts i n j, i < j, of s shre the sme stte then j i woul e epte y M, whih is not in L. 3. Noneterministi Finite-Stte Mhines Noneterminism llows mhine to selet one of severl stte trnsitions rnomly. This inlues hoie for initil stte. This flexiility mkes it esier (for humn esigner) to uil n utomton tht reognizes strings in prtiulr lnguge. Below we formlly efine this relxe moel of omputtion. We will see in the next setion how to (lgorithmilly) proue n equivlent eterministi mhine from noneterministi one. Definition 46. A noneterministi finite utomton (NFA) is five-tuple (Q S F) where. Q is the finite set of mhine sttes.. is the finite input lphet. 3. is funtion from Q to Q, the set of susets of Q. 4. S Q is set of strt (initil) sttes.

6 8 COMPSCI.FT 5. F Q is the epting (memership) sttes. Notie tht the stte trnsition funtion is more generl for NFA s thn DFA s. Besies hving trnsitions to multiple sttes for given input symol, we n hve (q ) unefine for some q Q n. This mens tht tht we n esign utomt suh tht no stte moves re possile for when in some stte q n the next hrter re is (i.e., the humn esigner oes not hve to worry out ll ses). An NFA epts string w if there exists noneterministi pth following the legl moves of the trnsition funtion on input w to n ept stte. Other uthors sometimes llow the next stte funtion for NFA to inlue epsilon trnsitions. Tht is, NFA s stte my hnge to nother stte without neeing to re the next hrter of the input string. These stte jumps o not mke NFA s ny more powerful in reognizing lnguges euse we n lwys more trnsitions to ypss the epsilon moves (or further strt sttes if n epsilon leves from strt stte). For this introution, we o not onsier epsilon trnsitions further. 3.. Using noneterministi utomt We now present two exmples of noneterministi finite-stte utomt (NFA s). Exmple 47. An NFA N with four sttes Q = f g, input lphet = f 3g, strt sttes S = fg, epting sttes F = fg n trnsition funtion is given elow: (input ) Sttes 3 f,g f,g fg f,g fg fg fg fg fg Note tht there re no legl trnsitions from stte on input (or from stte on inputs or ) in the ove NFA. The orresponing grphil view is given elow.,,3 3 3,,3

7 COMPSCI.FT 8 We n see tht the lnguge L(N ) epte y this NFA N is the set of strings tht strt with ny numer of s n s, followe y or 33 or( n( s n/or 3 s) n 3). We will see how to esrie lnguges suh s L(N ) more esily when we over regulr expressions in Setion 3.4 of these notes. Exmple 48. An exmple NFA with multiple strt sttes is N with six sttes Q = f e fg, input lphet = f 3g, strt sttes S = f g, epting sttes F = f g n trnsition funtion is given elow: (input ) Sttes 3 f,g fg feg fg fg feg f eg e ff g fg fg f feg e,3 f The ove exmple is somewht omplite. Wht set of strings will this utomt ept? Is there nother NFA of smller size (numer of sttes) tht reognizes the sme lnguge? We hve to evelop some tools to nswer these questions more esily. 3.. The reverse R(L) of lnguge L If we hve n utomton (either DFA or NFA) M tht reognizes lnguge L we n systemtilly onstrut n NFA M tht reognizes the reverse lnguge R(L). The reverse of string w = 3 ::: n is the string w = n n; :::. If M epts w then M epts w. Definition 49. The reverse or ul mhine M of n NFA M is onstrute s follows:. The strt sttes of M re the ept sttes of M.. The ept sttes of M re the initil sttes of M. 3. If (q )=q is in M then (q )=q is in M. I.e., ll trnsitions re reverse. It is esy to see tht the ul mhine M of n utomton M reognizes the reverse strings tht M epts. Exmple 5. The ul mhine of Exmple 44 is given elow.

8 8 COMPSCI.FT,3 3 3,,3 Notie tht the ul mhine my not e the simplest mhine for reognizing the reverse lnguge of given utomton The losure C(L) of lnguge L We wnt to introue nother useful NFA ssoite with given utomton. The losure, C(L) of lnguge L is efine to e the set of strings tht n e forme y ontenting together ny numer of strings of L. Given DFA (or NFA) M tht reognizes lnguge L we n uil n NFA M tht reognizes the losure of L y simply ing trnsitions from ll ept stte(s) to the neighors of the initil stte(s). Exmple 5. The DFA isplye on the left elow epts only the wor. The losure of this lnguge, C(L) =f k j k g, is epte y the NFA on the right.,,,, In the ove exmple only one trnsition r ( ) = ws e sine the trnsition ( ) = lrey existe. 3.3 Reognition Cpilities of NFA s n DFA s Although NFA s re esier thn DFA s for the humn to esign, they re not s usle y (eterministi) omputer. This is euse noneterminism oes not give preise steps for exeution. This setion shows how one n tke vntge of oth the onveniene of NFA s n the prtility of DFA s. The following lgorithm n e use to onvert n NFA N to DFA M tht epts the sme set of strings. lgorithm NFAtoDFA(NFA N, DFA M) The initil stte s M of M is the set of ll initil sttes of N, S N. Q M = fs M g

9 COMPSCI.FT 83 while Q M hs not inrese in size for eh new stte q M = f ::: k gq M o for eh input x o M (q M x) is the set q M of ll sttes of N rehle from i on input x. (I.e., q M = f j j N ( i x)= j i kg) Q M = Q M [fq Mg enfor enfor enwhile 3 The epting sttes F M is the set of sttes tht hve n epting stte of N. (I.e., F M = fq M j i q M n i F N g) en The ie ehin the ove lgorithm is to rete potentilly stte in M for every suset of sttes of N. Mny of these sttes re not rehle so the lgorithm often termintes with smller eterministi utomton thn the worst se of jnj sttes. The running time of this lgorithm is O(jQ M jjj) if the orret t strutures re use. The lgorithm NFAtoDFA shows us tht the reognition pilities of NFA s n DFA s re equivlent. We lrey knew tht ny DFA n e viewe s speil se of n NFA; the ove lgorithm provies us with metho for mpping NFA s to DFA s. Exmple 5. For the simple NFA N given on the left elow we onstrut the equivlent DFA M on the right, where L(N ) = L(M ). fg f g f g, fg f g Notie how the resulting DFA from the previous exmple hs only 5 sttes ompre with the potentil worst se of 8 sttes. This often hppens s is evient in the next exmple too. Exmple 53. For the NFA N given on the left elow we onstrut the equivlent DFA M on the right, where L(N) = L(M).

10 84 COMPSCI.FT fg f g, fg, f g f g In the ove exmple notie tht the empty suset is stte. This is sometimes lle the e stte sine no trnsitions re llowe out of it (n it is non-ept stte). 3.4 Regulr Expressions In this setion we present metho for representing sets of strings over fixe lphet. We egin with some forml efinitions. Definition 54. A wor w over given lphet is n element of = S i= i. The empty wor ontins no symols of. A lnguge L is suset of wors. The ontention of two wors w n w, enote w w, is forme y juxtposing the symols. A prout of lnguges L n L is L L = fw w j w L w L g. The (Kleene) losure of lnguge L is efine y L = S i= L i. The following property hols for the empty wor n ny wor w, w = w = w. For ny lnguge L, L = fg, L = L n L = LL. Exmple 55. If =f g n L = f g then L is the set of wors, inluing, tht hve t lest one following eh. Definition 56. The stnr regulr expressions over lphet (n the sets they esignte) re s follows:. Any is regulr expression (set fg).. If E (for some set S ) n E (for some set S ) re regulr expressions then so re: E je (union S [ S ). Often enote E + E. E E (lnguge ontention S S ). E (Kleene losure S ).

11 COMPSCI.FT 85 The following tle illustrtes severl regulr expressions over the lphet =f g n the sets of strings, whih we will shortly ll regulr lnguges, tht they represent. regulr expression j (j) (jj) j j (j )( ) regulr lnguge fg fg f g f g f :::g f g f :::g f ::: ::: :::g Definition 57. A regulr lnguge (set) over n lphet is either the empty set, the set fg, or the set of wors esignte y some regulr expression The UNIX extensions to regulr expressions For the users onveniene, the UNIX operting system extens (for progrms suh s vi, sh, grep, lex n perl) the regulr expressions mentione ove for pttern mthing. However, these new opertors o not exten the sets of lnguges tht re reognizle. Some of the most ommon new fetures re liste elow for the lphet eing the set of ASCII hrters. Chrter Clsses n Wil Cr Symol. A rnge of hrters n e enlose in squre rkets. For exmple [-z] woul enote the set of lower se letters. A perio. is wil r symol use to enote ny hrter exept newline. Line Beginning n Ening. To mth string tht egins the line use the ht ˆ s the first hrter of the pttern string. To mth string tht ens the line use the ollr sign $ s the lst hrter of the pttern string. For exmple ˆ[-9]*$ will mth oth empty lines or lines ontining only igits. Aitionl Opertors. Let E e regulr expression. The regulr expression E? enotes extly or mthes of E. This is shorthn for the regulr expression ( je). The regulr expression E + enotes EE, tht is, or more ourrenes of E. Note to mth one of the speil symols ove like * or. (inste of invoking its speil feture) we hve to espe it with preeing kslsh n hrter. For exmple, ig.*\. will mth igest. n iggy. where the perio is mthe. The line eginning n ening hrters were e sine, y efult, most UNIX progrms o sustring mthing.

12 86 COMPSCI.FT 3.5 Regulr Sets n Finite-Stte Automt We now wnt to present hrteriztion of the omputtionl power of finite stte utomt. We hve lrey seen tht DFA s n NFA s hve the sme omputtionl power. The set of lnguges epte/eie y utomt re preisely the set of regulr lnguges (sets). We show how to uil n NFA tht reognizes the set of wors epite y ny regulr expression. Theorem 58 (Kleene s Theorem). For ny regulr lnguge L there is DFA M suh tht L(M )=L. Proof. It suffies to fin NFA N tht epts L sine we hve lrey seen how to onvert NFA s to DFA s. (See Setion 3.3.) An utomton for L = n n utomton for L = fg re given elow. Now suppose E is regulr expression for L. We onstrut N se on the length of E. If E = fg for some we n use the following utomton. ;fg By inution we only nee to show how to onstrut N for E eing one of E + E, E E or E, for smller regulr expressions E n E. Let use ssume we hve orret utomt M n M for E n E. Cse : E = E + E We onstrut (noneterministi) utomton N representing E simply y tking the union of the two mhines M n M. Cse : E = E E We onstrut n utomton N representing E s follows. We o this y ltering slightly the union of the two mhines M n M. The initil sttes of N will e the initil sttes of M. The the initil sttes of M will only initil sttes of N if t lest one of M s initil sttes is n epting stte. The finl sttes of N will e the finl sttes of M. (I.e., the finl sttes of M eome orinry sttes.) For eh trnsistion (q q ) to finl stte q of M we trnsitions to the initil sttes of M. Tht is, for, ifq j (q i ) for some finl stte q j F then q k N (q ) for eh strt stte q k S. Cse 3: E = E

13 COMPSCI.FT 87 The losure of n utomton ws seen in Setion An utomton representing E is the union of the losure C(M ) n the utomton representing fg given ove. Kleene s Theorem is tully stronger thn wht we mentione ove. He lso prove tht for ny finite utomton M there exists regulr expression tht represents the lnguge eie y M. The onstrution is simple, ut etile, n is less useful so we omit it. Exmple 59. For the regulr expression () + we onstrut n utomton tht epts the strings mthe. First we uil utomt M n M tht ept the simple lnguges fg n fg. M: M: We next onstrut n utomton M tht epts the lnguge fg. We n esily reue the numer of sttes of M to rete n equivlent utomton M3. M: M3: We next onstrut n utomton M4 tht epts the lnguge represente y the regulr expression (). M4: The union of the utomt M n M4 is n utomton N tht epts the regulr lnguge epite y the expression () +. In the next setion we show how to minimize utomt to proue the following finl eterministi utomton (from the output of lgorithm NFADFA on N) tht epts this lnguge.

14 88 COMPSCI.FT e Usully more omplite (longer length) regulr expressions require utomt with more sttes. However, this is not true in generl. Exmple 6. The DFA for the regulr expression () ( +), isplye elow, hs one fewer stte thn the previous exmple. 3.6 Minimizing Deterministi Finite-Stte Mhines There re stnr tehniques for minimizing eterministi utomt. We present n effiient lgorithm se on fining (n eliminting) equivlent sttes. Definition 6. For DFA M = (Q s F) n ny q Q efine the DFA M q = (Q q F), tht is, s is reple with q in M q. We sy two sttes p n q of M re istinguishle (k-istinguishle) if there exists string w (of length k) suh tht extly one of M p or M q epts w. If there is no suh string w then we sy p n q re equivlent. Note tht the empty string my lso e use to istinguish two sttes of n utomton. Lemm 6. IfDFAM hs two equivlent sttes p n q then there exists smller DFA M suh tht L(M )=L(M ). Proof. Assume M = (Q s F) n p 6= s. We rete n equivlent DFA M = (Q nfpg s F nfpg) where is with ll instnes of (q i ) = p reple with (q i ) = q n ll instnes of (p ) = q i elete. The resulting utomton M is eterministi n epts lnguge L(M ).

15 COMPSCI.FT 89 Lemm 63. Two sttes p n q re (not) k-istinguishle if n only if for eh, the sttes (p ) n (q ) re (not) (k ; )-istinguishle. Proof. Consier ll strings w = w of length k. If (p ) n (q ) re (k ; )- istinguishle y some string w then p n q must e k-istinguishle y w. Likewise, p n q eing k-istinguishle y w implies there exists two sttes (p ) n (q ) tht re (k ; )-istinguishle y the shorter string w. Algorithm MinimizeDFA: Our lgorithm to fin equivlent sttes of DFA M =(Q s F) egins y efining series equivlent reltions,,...onthesttes of Q. p q if oth p n q re in F or oth not in F. p k+ q if p k q n, for eh, (p ) k (q ). We stop generting these equivlene lsses when n n n+ re ientil. Lemm 63 gurntees no more non-equivlent sttes. Sine there n e t most jqj non-equivlent sttes this ouns the numer of equivlene reltions k generte. We n eliminte one stte from M (using Lemm 6) whenever there exists two sttes p n q suh tht p n q. In prtie, we often eliminte more thn one (i.e., ll ut one) stte per equivlene lss. Theorem 64. There exists polynomil-time lgorithm to minimize ny DFA M. Proof. To ompute k+ from k we hve to etermine the equivlene (or non-equivlene) for t most = O(jQj ) possile pirs of sttes p n q. Eh equivlene hek jqj requires jj trnsitions look-ups. Sine we hve to ompute this for t most n jqj ifferent equivlene lsses k, the preeing lgorithm MinimizeDFA runs in time O(jjjQj 3 ). Currently there re no iret, effiient minimiztion lgorithms for the noneterministi ounterprts of DFA. Note tht the minimize equivlent DFA for n NFA my e lrger then the originl (nonminimize) NFA. We en our introution to utomt theory y showing how to use this minimiztion lgorithm. The first exmple shows how to verify tht n utomton is miniml n the seon shows how to fin equivlent sttes for elimintion. Exmple 65. We use the lgorithm MinimizeDFA to show the following utomton M hs the smllest numer of sttes for the regulr lnguge it represents.

16 9 COMPSCI.FT e f The initil equivlent reltion is f fgf eg se solely on the finl sttes of M. We now lulte using the reursive efinition: ( ) = 6 ( ) = e ) 6. ( ) = e 6 ( ) = f ) 6. ( ) = 6 (f ) = e ) 6 f. ( ) = 6 ( ) = f ) 6. (( ) = (f ) = e n ( ) = e (f ) = e) ) f. ( ) = f 6 (f ) = e ) 6 f. ( ) = 6 (e ) = ) 6 e. So is fgfgf fgfgfeg. We now lulte to hek the two possile remining equivlent sttes: ( ) = 6 (f ) = e ) 6 f: This shows tht ll sttes of M re non-equivlent (i.e., our utomton is minimum). Exmple 66. We use the lgorithm MinimizeDFA to show tht the following utomton M n e reue. e The initil equivlent reltion is f gf eg. We now lulte : ( ) = 6 ( ) = ) 6. ( ) = 6 ( ) = ) 6. (( ) = ( ) = n ( ) = ( ) = e) ). (( ) = (e ) = e n ( ) = e (e ) = e) ) e.

17 COMPSCI.FT 9 So is fgf gf eg. We lulte in the sme fshion n see tht it is the sme s. This shows tht we n eliminte, sy, sttes n e to yiel the following minimum DFA tht reognizes the sme lnguge s M oes. To test ones unerstning, we invite the reer reproue the finl utomton of Exmple 59 y using the lgorithms NFADFA n MinimizeDFA.

18 9 COMPSCI.FT

2.4 Theoretical Foundations

2.4 Theoretical Foundations 2 Progrmming Lnguge Syntx 2.4 Theoretil Fountions As note in the min text, snners n prsers re se on the finite utomt n pushown utomt tht form the ottom two levels of the Chomsky lnguge hierrhy. At eh level

More information

Automata and Regular Languages

Automata and Regular Languages Chpter 9 Automt n Regulr Lnguges 9. Introution This hpter looks t mthemtil moels of omputtion n lnguges tht esrie them. The moel-lnguge reltionship hs multiple levels. We shll explore the simplest level,

More information

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6 CS311 Computtionl Strutures Regulr Lnguges nd Regulr Grmmrs Leture 6 1 Wht we know so fr: RLs re losed under produt, union nd * Every RL n e written s RE, nd every RE represents RL Every RL n e reognized

More information

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs

Counting Paths Between Vertices. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs. Isomorphism of Graphs Isomorphism of Grphs Definition The simple grphs G 1 = (V 1, E 1 ) n G = (V, E ) re isomorphi if there is ijetion (n oneto-one n onto funtion) f from V 1 to V with the property tht n re jent in G 1 if

More information

CS 573 Automata Theory and Formal Languages

CS 573 Automata Theory and Formal Languages Non-determinism Automt Theory nd Forml Lnguges Professor Leslie Lnder Leture # 3 Septemer 6, 2 To hieve our gol, we need the onept of Non-deterministi Finite Automton with -moves (NFA) An NFA is tuple

More information

Finite State Automata and Determinisation

Finite State Automata and Determinisation Finite Stte Automt nd Deterministion Tim Dworn Jnury, 2016 Lnguges fs nf re df Deterministion 2 Outline 1 Lnguges 2 Finite Stte Automt (fs) 3 Non-deterministi Finite Stte Automt (nf) 4 Regulr Expressions

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministi Finite utomt The Power of Guessing Tuesdy, Otoer 4, 2 Reding: Sipser.2 (first prt); Stoughton 3.3 3.5 S235 Lnguges nd utomt eprtment of omputer Siene Wellesley ollege Finite utomton (F)

More information

CS 491G Combinatorial Optimization Lecture Notes

CS 491G Combinatorial Optimization Lecture Notes CS 491G Comintoril Optimiztion Leture Notes Dvi Owen July 30, August 1 1 Mthings Figure 1: two possile mthings in simple grph. Definition 1 Given grph G = V, E, mthing is olletion of eges M suh tht e i,

More information

Lecture 6: Coding theory

Lecture 6: Coding theory Leture 6: Coing theory Biology 429 Crl Bergstrom Ferury 4, 2008 Soures: This leture loosely follows Cover n Thoms Chpter 5 n Yeung Chpter 3. As usul, some of the text n equtions re tken iretly from those

More information

NON-DETERMINISTIC FSA

NON-DETERMINISTIC FSA Tw o types of non-determinism: NON-DETERMINISTIC FS () Multiple strt-sttes; strt-sttes S Q. The lnguge L(M) ={x:x tkes M from some strt-stte to some finl-stte nd ll of x is proessed}. The string x = is

More information

Nondeterministic Automata vs Deterministic Automata

Nondeterministic Automata vs Deterministic Automata Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n

More information

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4

CSE 332. Sorting. Data Abstractions. CSE 332: Data Abstractions. QuickSort Cutoff 1. Where We Are 2. Bounding The MAXIMUM Problem 4 Am Blnk Leture 13 Winter 2016 CSE 332 CSE 332: Dt Astrtions Sorting Dt Astrtions QuikSort Cutoff 1 Where We Are 2 For smll n, the reursion is wste. The onstnts on quik/merge sort re higher thn the ones

More information

= state, a = reading and q j

= state, a = reading and q j 4 Finite Automt CHAPTER 2 Finite Automt (FA) (i) Derterministi Finite Automt (DFA) A DFA, M Q, q,, F, Where, Q = set of sttes (finite) q Q = the strt/initil stte = input lphet (finite) (use only those

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 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

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of: 22: Union Fin CS 473u - Algorithms - Spring 2005 April 14, 2005 1 Union-Fin We wnt to mintin olletion of sets, uner the opertions of: 1. MkeSet(x) - rete set tht ontins the single element x. 2. Fin(x)

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

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

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

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

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite!

Solutions for HW9. Bipartite: put the red vertices in V 1 and the black in V 2. Not bipartite! Solutions for HW9 Exerise 28. () Drw C 6, W 6 K 6, n K 5,3. C 6 : W 6 : K 6 : K 5,3 : () Whih of the following re iprtite? Justify your nswer. Biprtite: put the re verties in V 1 n the lk in V 2. Biprtite:

More information

Factorising FACTORISING.

Factorising FACTORISING. Ftorising FACTORISING www.mthletis.om.u Ftorising FACTORISING Ftorising is the opposite of expning. It is the proess of putting expressions into rkets rther thn expning them out. In this setion you will

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

Lecture 2: Cayley Graphs

Lecture 2: Cayley Graphs Mth 137B Professor: Pri Brtlett Leture 2: Cyley Grphs Week 3 UCSB 2014 (Relevnt soure mteril: Setion VIII.1 of Bollos s Moern Grph Theory; 3.7 of Gosil n Royle s Algeri Grph Theory; vrious ppers I ve re

More information

Compression of Palindromes and Regularity.

Compression of Palindromes and Regularity. Compression of Plinromes n Regulrity. Kyoko Shikishim-Tsuji Center for Lierl Arts Eution n Reserh Tenri University 1 Introution In [1], property of likstrem t t view of tse is isusse n it is shown tht

More information

Prefix-Free Regular-Expression Matching

Prefix-Free Regular-Expression Matching Prefix-Free Regulr-Expression Mthing Yo-Su Hn, Yjun Wng nd Derik Wood Deprtment of Computer Siene HKUST Prefix-Free Regulr-Expression Mthing p.1/15 Pttern Mthing Given pttern P nd text T, find ll sustrings

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

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition

Data Structures LECTURE 10. Huffman coding. Example. Coding: problem definition Dt Strutures, Spring 24 L. Joskowiz Dt Strutures LEURE Humn oing Motivtion Uniquel eipherle oes Prei oes Humn oe onstrution Etensions n pplitions hpter 6.3 pp 385 392 in tetook Motivtion Suppose we wnt

More information

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

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their

More information

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

Project 6: Minigoals Towards Simplifying and Rewriting Expressions MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy

More information

CSE 401 Compilers. Today s Agenda

CSE 401 Compilers. Today s Agenda CSE 401 Compilers Leture 3: Regulr Expressions & Snning, on?nued Mihel Ringenurg Tody s Agend Lst?me we reviewed lnguges nd grmmrs, nd riefly strted disussing regulr expressions. Tody I ll restrt the regulr

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

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point

Numbers and indices. 1.1 Fractions. GCSE C Example 1. Handy hint. Key point GCSE C Emple 7 Work out 9 Give your nswer in its simplest form Numers n inies Reiprote mens invert or turn upsie own The reiprol of is 9 9 Mke sure you only invert the frtion you re iviing y 7 You multiply

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

Subsequence Automata with Default Transitions

Subsequence Automata with Default Transitions Susequene Automt with Defult Trnsitions Philip Bille, Inge Li Gørtz, n Freerik Rye Skjoljensen Tehnil University of Denmrk {phi,inge,fskj}@tu.k Astrt. Let S e string of length n with hrters from n lphet

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

A Disambiguation Algorithm for Finite Automata and Functional Transducers

A Disambiguation Algorithm for Finite Automata and Functional Transducers A Dismigution Algorithm for Finite Automt n Funtionl Trnsuers Mehryr Mohri Cournt Institute of Mthemtil Sienes n Google Reserh 51 Merer Street, New York, NY 1001, USA Astrt. We present new ismigution lgorithm

More information

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

Compiler Design. Spring Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Siene Deprtment Compiler Design Spring 7 Lexil Anlysis Smple Exerises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sienes Institute 47 Admirlty Wy, Suite

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

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005

CARLETON UNIVERSITY. 1.0 Problems and Most Solutions, Sect B, 2005 RLETON UNIVERSIT eprtment of Eletronis ELE 2607 Swithing iruits erury 28, 05; 0 pm.0 Prolems n Most Solutions, Set, 2005 Jn. 2, #8 n #0; Simplify, Prove Prolem. #8 Simplify + + + Reue to four letters (literls).

More information

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014 S 224 DIGITAL LOGI & STATE MAHINE DESIGN SPRING 214 DUE : Mrh 27, 214 HOMEWORK III READ : Relte portions of hpters VII n VIII ASSIGNMENT : There re three questions. Solve ll homework n exm prolems s shown

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

Regular languages refresher

Regular languages refresher Regulr lnguges refresher 1 Regulr lnguges refresher Forml lnguges Alphet = finite set of letters Word = sequene of letter Lnguge = set of words Regulr lnguges defined equivlently y Regulr expressions Finite-stte

More information

CIT 596 Theory of Computation 1. Graphs and Digraphs

CIT 596 Theory of Computation 1. Graphs and Digraphs CIT 596 Theory of Computtion 1 A grph G = (V (G), E(G)) onsists of two finite sets: V (G), the vertex set of the grph, often enote y just V, whih is nonempty set of elements lle verties, n E(G), the ege

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

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

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

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

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

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

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233,

Surds and Indices. Surds and Indices. Curriculum Ready ACMNA: 233, Surs n Inies Surs n Inies Curriulum Rey ACMNA:, 6 www.mthletis.om Surs SURDS & & Inies INDICES Inies n surs re very losely relte. A numer uner (squre root sign) is lle sur if the squre root n t e simplifie.

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

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

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

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

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 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides. 1 PYTHAGORAS THEOREM 1 1 Pythgors Theorem In this setion we will present geometri proof of the fmous theorem of Pythgors. Given right ngled tringle, the squre of the hypotenuse is equl to the sum of the

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

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

CSC2542 State-Space Planning

CSC2542 State-Space Planning CSC2542 Stte-Spe Plnning Sheil MIlrith Deprtment of Computer Siene University of Toronto Fll 2010 1 Aknowlegements Some the slies use in this ourse re moifitions of Dn Nu s leture slies for the textook

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

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge

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

Chapter 4 State-Space Planning

Chapter 4 State-Space Planning Leture slides for Automted Plnning: Theory nd Prtie Chpter 4 Stte-Spe Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Motivtion Nerly ll plnning proedures re serh proedures Different

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

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

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106

18.06 Problem Set 4 Due Wednesday, Oct. 11, 2006 at 4:00 p.m. in 2-106 8. Problem Set Due Wenesy, Ot., t : p.m. in - Problem Mony / Consier the eight vetors 5, 5, 5,..., () List ll of the one-element, linerly epenent sets forme from these. (b) Wht re the two-element, linerly

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

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

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

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

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

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

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

Logic, Set Theory and Computability [M. Coppenbarger]

Logic, Set Theory and Computability [M. Coppenbarger] 14 Orer (Hnout) Definition 7-11: A reltion is qusi-orering (or preorer) if it is reflexive n trnsitive. A quisi-orering tht is symmetri is n equivlene reltion. A qusi-orering tht is nti-symmetri is n orer

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

The DOACROSS statement

The DOACROSS statement The DOACROSS sttement Is prllel loop similr to DOALL, ut it llows prouer-onsumer type of synhroniztion. Synhroniztion is llowe from lower to higher itertions sine it is ssume tht lower itertions re selete

More information

Running an NFA & the subset algorithm (NFA->DFA) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/

Running an NFA & the subset algorithm (NFA->DFA) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ Running n NFA & the suset lgorithm (NFA->DFA) CS 350 Fll 2018 gilry.org/lsses/fll2018/s350/ 1 NFAs operte y simultneously exploring ll pths nd epting if ny pth termintes t n ept stte.!2 Try n exmple: L

More information

I 3 2 = I I 4 = 2A

I 3 2 = I I 4 = 2A ECE 210 Eletril Ciruit Anlysis University of llinois t Chigo 2.13 We re ske to use KCL to fin urrents 1 4. The key point in pplying KCL in this prolem is to strt with noe where only one of the urrents

More information

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α Disrete Strutures, Test 2 Mondy, Mrh 28, 2016 SOLUTIONS, VERSION α α 1. (18 pts) Short nswer. Put your nswer in the ox. No prtil redit. () Consider the reltion R on {,,, d with mtrix digrph of R.. Drw

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

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

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

Total score: /100 points

Total score: /100 points Points misse: Stuent's Nme: Totl sore: /100 points Est Tennessee Stte University Deprtment of Computer n Informtion Sienes CSCI 2710 (Trnoff) Disrete Strutures TEST 2 for Fll Semester, 2004 Re this efore

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

@#? Text Search ] { "!" Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata

@#? Text Search ] { ! Nondeterministic Finite Automata. Transformation NFA to DFA and Simulation of NFA. Text Search Using Automata g Text Serh @#? ~ Mrko Berezovský Rdek Mřík PAL 0 Nondeterministi Finite Automt n Trnsformtion NFA to DFA nd Simultion of NFA f Text Serh Using Automt A B R Power of Nondeterministi Approh u j Regulr Expression

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

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA

Common intervals of genomes. Mathieu Raffinot CNRS LIAFA Common intervls of genomes Mthieu Rffinot CNRS LIF Context: omprtive genomis. set of genomes prtilly/totlly nnotte Informtive group of genes or omins? Ex: COG tse Mny iffiulties! iology Wht re two similr

More information

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 )

Necessary and sucient conditions for some two. Abstract. Further we show that the necessary conditions for the existence of an OD(44 s 1 s 2 ) Neessry n suient onitions for some two vrile orthogonl esigns in orer 44 C. Koukouvinos, M. Mitrouli y, n Jennifer Seerry z Deite to Professor Anne Penfol Street Astrt We give new lgorithm whih llows us

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

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

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

Section 2.3. Matrix Inverses

Section 2.3. Matrix Inverses Mtri lger Mtri nverses Setion.. Mtri nverses hree si opertions on mtries, ition, multiplition, n sutrtion, re nlogues for mtries of the sme opertions for numers. n this setion we introue the mtri nlogue

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

Thoery of Automata CS402

Thoery of Automata CS402 Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...

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

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

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

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

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