FLAC Closure Properties

Size: px
Start display at page:

Download "FLAC Closure Properties"

Transcription

1 FLAC Closure Properties 1 Nondeterministic Mchines Klus Sutner Crnegie Mellon Universlity 2 Determiniztion Fll Closure Properties Where Are We? 3 The Logic Link 4 We hve definition of regulr lnguges in terms of deterministic finite utomt (DFAs). There re two killer pps for regulr lnguges: pttern mtching nd decision lgorithms. In order to get etter understnding of regulr lnguges, it turns out tht other chrcteriztions cn e very useful, oth from the theory perspective s well s for the construction of lgorithms. As lredy mentioned, we re primrily interested in using utomt to solve decision prolems in logic. To this end we hve to construct mchines for vrious lnguges, quite often over lrge lphets of the form Γ = Σ Σ... Σ This turns out to e the right environment for checking vlidity of logicl formule over certin structures. Note tht these lphets cn get quite lrge. Lnguge Opertions 5 More Opertions 6 The key to mny of these lgorithms is the fct tht regulr lnguges re closed under gret mny more opertions. To egin with, there is closure under Boolen opertions: union intersection complement This is useful for pttern mtching ut lso for decision lgorithms (one cn del with propositionl logic; in while, we will see how to hndle quntifiers). Here re some more opertions on lnguges tht do not ffect regulrity: reversl conctention Kleene str homomorphisms inverse homomorphisms Als, it is difficult to estlish these properties within the frmework of DFAs: the constructions of the corresponding mchines ecome rther complicted. One elegnt wy to void these prolems is to generlize our mchine model to llow for nondeterminism, nd show tht the generl mchines still only ccept regulr lnguges.

2 Nondeterministic FSMs 7 Trces nd Runs 8 Here is strightforwrd generliztion of DFAs tht llows for nondeterministic ehvior. Recll tht trnsition systems my well e nondeterministic. Definition A nondeterministic finite utomton (NFA) is structure A = Q, Σ, τ; I, F where Q, Σ, τ is trnsition system nd the cceptnce condition is given y I, F Q, the initil nd finl sttes, respectively. So in generl there is no unique next stte in n NFA: there my e no next stte, or there my e mny. Of course, we cn think of DFA s specil type of NFA. It is strightforwrd to lift the definition of cceptnce from DFAs to NFAs (it ll comes down to pth existence, nywy). Recll tht in ny trnsition system Q, Σ, τ run is n lternting sequence π = p 0, 1, p 1,..., r, p r where p i Q, i Σ nd τ(p i 1, i, p i) for ll i = 1,..., r. p 0 is the source of the run nd p r its trget. The length of π is r. The corresponding trce or lel is the word r. Some uthors insist tht I = {q 0}. This mkes no sense. The Ftl Definition 9 Sources of Nondeterminism 10 The cceptnce condition is essentilly the sme s for DFAs, except tht initil sttes re no longer unique (nd even if they were, there could e multiple trces). Definition An NFA A = Q, Σ, τ; I, F ccepts word w Σ if there is run of A with lel w, source in I nd trget in F. We write L(A) for the cceptnce lnguge of A. But note tht now there my e exponentilly mny runs with the sme lel. In prticulr, some of the runs strting in I my end up in F, others my not. There is hidden existentil quntifier here. Agin: ll tht is needed for cceptnce is one ccepting run. Note tht nondeterminism cn rise from two different sources: Trnsition nondeterminism: there re different trnsitions p q nd p q. Initil stte nondeterminism: there re multiple initil sttes. In other words, even if the trnsition reltion is deterministic we otin nondeterministic mchine y llowing multiple initil sttes. Intuitively, this second type of nondeterminism is less wild. Autonomous Trnsitions Epsilon Moves 11 Σ ε 12 While we re t it: there is yet nother nturl generliztion eyond just nondeterminism: utonomous trnsitions, k epsilon moves. These re trnsitions where no symol is red, only the stte chnges. This is perfectly fine considering our Turing mchines ncestors. We will encounter severl occsions where it is convenient to enlrge the lphet Σ y dding the empty word ε: Σ ε = Σ {ε} Definition A nondeterministic finite utomton with ε-moves (NFAE) is defined like n NFA, except tht the trnsition reltion hs the formt τ Q (Σ {ε}) Q. Thus, n NFAE my perform severl trnsitions without scnning symol. Hence trce my now e longer thn the corresponding input word. Other thn tht, the cceptnce condition is the sme s for NFAs: there hs to e run from n initil stte to finl stte. Of course, ε is not new lphet symol. Wht s relly going on? Σ freely genertes the monoid Σ, nd ε is the unit element of this monoid. We cn dd the unit element to the genertors without chnging the monoid. We could even dd ritrry words nd llow super-trnsitions like p q Explin why this mkes no difference s fr s lnguges re concerned.

3 Reversl Closure 13 Exmple: Third Symol 14 Here is perfect exmple of n opertion tht preserves regulrity, ut is difficult to cpture within the confines of DFAs. Let L op = { x op x L } It is very esy to uild DFA for L,3 = { x x 3 = }. We omit the sink to keep the digrm simple. e the reversl of lnguge, (x 1x 2... x n 1x n) op = x nx n 1... x 2x 1. The direction in which we red string should e of supreme irrelevnce, so for regulr lnguges to form resonle clss they should e closed under reversl.,,, Suppose L is regulr. How would we go out constructing mchine for L op? But L op,3 = { x x 3 = } = L, 3 is hrd for DFAs: we don t know how fr from the end we re. By flipping trnsitions nd interchnging initil nd finl sttes we otin mchine tht looks like so: Nondeterministic Mchines,,, Determiniztion Closure Properties It is cler tht the new mchine ccepts L, 3. Of course, it s no longer DFA. Conversion to DFA 17 Terminology 18 Our first order of usiness is to show tht NFAs nd NFAEs re no more powerful thn DFAs in the sense tht they only ccept regulr lnguges. Note, though, tht the size of the mchines my chnge in the conversion process, so one needs to e it creful. The trnsformtion is effective: the key lgorithms re For the time eing, we will refer to DFAs, NFAs nd NFAEs simply s finite utomt. Strictly speking, ll three types re distinct, ut there re nturl inclusions DFA NFA NFAE Epsilon Elimintion Convert n NFAE into n equivlent NFA. Determiniztion Convert n NFA into n equivlent DFA. The hert of the OO fntic now ets fster...

4 NFAE to NFA 19 ε-closure 20 A trnsitive closure prolem: we hve to replce chins of trnsitions Epsilon elimintion is quite strightforwrd nd cn esily e hndled in polynomil time: ε ε ε introduce new ordinry trnsitions tht hve the sme effect s chins of ε trnsitions, nd remove ll ε-trnsitions. Since there my e chins of ε-trnsitions this is in essence trnsitive closure prolem. Hence prt I of the lgorithm cn e hndled with the usul grph techniques. y new trnsitions Epsilon Elimintion 21 Determiniztion 22 Theorem For every NFAE there is n equivlent NFA. Proof. This requires no new sttes, only chnge in trnsitions. Suppose A = Q, Σ, τ; I, F is n NFAE for L. Let A = Q, Σ, τ ; I, F where τ is otined from τ s on the lst slide. I is the ε-closure of I: ll sttes rechle from I using only ε-trnsitions. Conversion of nondeterministic mchine to deterministic one ppered first in seminl pper y Rin nd Scott titled Finite Automt nd Their Decision Prolem. In fct, nondeterministic mchines were introduced there. Theorem (Rin, Scott 1959) For every NFA there is n equivlent DFA. Agin, there my e qudrtic low-up in the numer of trnsitions nd it my well e worth the effort to try to construct the NFAE in such wy tht this low-up does not occur. The ide is to keep trck of the set of possile sttes the NFA could e in. This produces DFA whose sttes re sets of sttes of the originl mchine. Generl Astrct Nonsense to the Rescue 23 Proof of Rin-Scott 24 The trnsition reltion in n NFA hs the form τ Q Σ Q Suppose A = Q, Σ, τ; I, F is n NFA. Let A = P(Q), Σ, δ; I, F By GAN we cn think of it s function: nd this function nturlly extends to τ : Q Σ P(Q) τ : P(Q) Σ P(Q) The ltter function cn e interpreted s the trnsition function of DFA on P(Q). Done. ;-) where δ(p, ) = { q Q p P τ(p,, q) } F = { P Q P F } It is strightforwrd to check y induction tht A nd A re equivlent. The mchine from the proof is the full power utomton of A, written pow f (A), mchine of size 2 n. Of course, for equivlence only the ccessile prt pow(a), the power utomton of A, is required.

5 Accessile Prt 25 Coccessile/Trim Prt 26 This is s good plce s ny to tlk out useless sttes: sttes tht cnnot pper in ny ccepting computtion nd tht cn therefore e eliminted. Definition A stte p in finite utomton A is ccessile if there is run with source n initil stte nd trget p. The utomton is ccessile if ll its sttes re. Now suppose we remove ll the inccessile sttes from utomton A (mening: djust the trnsition system nd the set of finl sttes). We otin new utomton A, the so-clled ccessile prt of A. Lemm The mchines A nd A re equivlent. There is dul notion of coccessiility: stte p is coccessile if there is t lest one run from p to finl stte. Likewise, n utomton is coccessile if ll its sttes re. An utomton is trim if it is ccessile nd coccessile. It is esy to see tht the trim prt of n utomton is equivlent to the whole mchine. Moreover, we cn construct the coccessile nd trim prt in liner time using stndrd grph lgorithms. Wrning: Note tht the coccessile prt of DFA my not e DFA: the mchine my ecome incomplete nd we wind up with prtil DFA. The ccessile prt of DFA lwys is DFA, though. Keeping Trim 27 Smrt Power Automt 28 Of course, in implementtions we would like to keep mchines smll, so mking them ccessile or trim is good ide. There re relly two seprte issues here. First, we my need to clen up mchines y running n ccessile or trim prt lgorithm whenever necessry this is esy. Much more interesting is to void the construction of inccessile sttes of mchine in the first plce: idelly ny lgorithm should only produce ccessile mchines. While ccessiility is esy to gurntee, coccessiility is not: while constructing mchine we do not usully know the set of finl sttes hed of time. So, there my y need to eliminte non-coccessile sttes. The right wy to construct the Rin-Scott utomton for A = Q, Σ, τ; I, F is to tke closure in the mient set P(Q): clos( I, (τ ) Σ) Here τ is the function P(Q) Σ P(Q) defined y τ (P ) = { q Q p P (p q) } This produces the ccessile prt only, nd, with luck, is much smller thn the full power utomton. WTF? 29 Virtul Grphs 30 Given collection f = (f 1,..., f k), of endofunctions f i : A A on set A nd suset B A, the closure of B under f is defined y clos( B, f ) := { X A B X, f i(x) X, i [k] } In other words, the closure is the lest suset of A tht contins B nd ll the imges of B under the f i. As written, the definition is impredictive, ut we cn esily turn this into n efficient lgorithm (t lest in the finite cse). Think of G = A; f 1, f 2,..., f k i s leled digrph with edges p q for f i(p) = q, the virtul grph (or mient grph) where we live. We need to compute the rechle prt of B in this grph G. This cn e done using stndrd lgorithms such s Depth-First-Serch or Bredth-First-Serch. The only difference is tht we re not given n djcency list representtion of G: we compute edges on the fly. No prolem t ll. This is very importnt when the mient grph is huge: we my only need to touch smll prt.

6 Power Automton Algorithm 31 Exmple: L, 3 32 Recll Here is slightly more hcky version of this construction. ctive = QQ = {I}; while( ctive!= empty ) P = ctive.extrct(); forech in Sigm do compute R = tu(p,) keep trck of trnsition P to R if( R notin QQ ) then dd R to QQ nd ctive L,k = { x {, } x k = }. For negtive k this mens: kth symol from the end. It is trivil to construct n NFA for L, 3:,,, Upon completion, QQ P(Q) is the stte set of the ccessile prt of the full power utomton. We write pow(a) for this mchine. Rin-Scott 33 The Digrm 34 Here is the corresponding digrm, rendered in prticulrly rillint wy. This is so-clled de Bruijn grph (inry, rnk 3). Applying the Rin-Scott construction we otin mchine with 8 sttes {1}, {1, 2}, {1, 2, 3}, {1, 3}, {1, 2, 3, 4}, {1, 3, 4}, {1, 2, 4}, {1, 4} where 1 is initil nd 5, 6, 7, nd 8 re finl. The trnsitions re given y Note tht the full power set hs size 16, our construction only uilds the ccessile prt (which hppens to hve size 8). Explin this picture in terms of the Rin-Scott construction. Acceptnce Testing 35 Memership Testing 36 Here is nturl modifiction of the DFA cceptnce testing progrm. Recll one of the key pplictions of FSMs: cceptnce testing is very fst nd cn e used to del with pttern mtching prolems. How much of computtionl hit do we tke when we switch to nondeterministic mchines? We cn use the sme pproch s in determiniztion: insted of computing ll possile sets of sttes rechle from I, we only compute the ones tht ctully occur long prticulr trce given y some input word. P = I; while( = x.next() ) // next input symol P = tu_(p); return ( P intersect F!= empty ); The updte step uses the sme mps τ : P(Q) P(Q) s in the Rin-Scott construction. Think of dirty tricks like hshing to speed things up.

7 Running Time 37 A Better Mousetrp? 38 The loop executes x times, just s with DFAs. Unfortuntely, the loop ody is no longer constnt time: we hve to updte set of sttes P Q. This cn certinly e done in O( Q 2 ) steps though smrt dt structures my sometimes give etter performnce. Actully, it seems tht in prctice (i.e. in NFAs tht pper nturlly in some ppliction such s pttern mtching) one often dels with overhed tht is liner in Q rther thn qudrtic. At ny rte, we cn check cceptnce in n NFA in O( x Q 2 ) steps. For fixed mchines this is still liner in x, ut the hidden constnt my e significnt. Acceptnce testing is slower, nondeterministic mchines re not simply ll-round superior to DFAs. Advntges: Esier to construct nd mnipulte. Sometimes exponentilly smller. Sometimes lgorithms much esier. Drwcks: Acceptnce testing slower. Sometimes lgorithms more complicted. Which type of mchine to choose in prticulr ppliction cn e hrd question, there is no esy generl nswer. Products 40 Nondeterministic Mchines Suppose we hve two trnsition systems T 1 = Q 1, Σ, τ 1 nd T 2 = Q 2, Σ, τ 2 over the sme lphet Σ. Determiniztion Construct new trnsition system T = T 1 T 2, the so-clled (Crtesin) product s follows. Q = Q 1 Q 2 τ((p, q),, (p, q )) τ 1(p,, p ) τ 2(q,, q ) 3 Closure Properties It is often helpful to think of the new trnsition system s running T 1 nd T 2 in prllel. Als, the size of T is qudrtic in the sizes of T 1 nd T 2. This cuses prolems if product mchine construction is used repetedly. Product Mchine 41 It s DFA 42 To get mchine we need to define n cceptnce condition. The new initil stte set is I 1 I 2. By selecting finl sttes in the product, we cn get union nd intersection L(A 1) nd L(A 2): union F = F 1 Q 2 Q 1 F 2 intersection F = F 1 F 2 In the cse where T 1 nd T 2 come from DFAs A 1 nd A 2 the product is gin DFA: the new trnsition function δ = δ 1 δ 2 looks like Q = Q 1 Q 2 δ((p, q), ) = (δ 1(p, ), δ 2(q, )) More importntly, we cn lso construct mchine for the complement L(A 1) L(A 2). difference F = F 1 (Q 2 F 2)

8 Asolute Complements 43 And ck to closures In the specil cse where A 1 is universl we get the plin complement Σ L(A 2). Of course, we do not need product construction here, ll we need to do is switch finl nd non-finl sttes in the given DFA. F = Q F. For the umpteenth time: rel lgorithm for product mchines should not construct the full Crtesin product. Insted, one should compute closures of the pproprite initil sttes under the trnsition function/reltion of the product mchine. For exmple, for product DFA construction we need Dire Wrning: Determinism is essentil here, we will see shortly tht complementtion for nondeterministic mchines is much hrder. clos( (q 01, q 02), δ 1 δ 2) Construct counterexmple tht shows tht the switch-sttes construction in generl fils to produce complements in NFAs. Figure out in detil how to do these constructions producing the ccessile prt only. Exmple 45 Full Product Automton 46 Consider the product utomton for DFAs A nd A, ccepting nd, respectively. A :, 0 1 2,,, , , The Accessile Prt 47 Closure Properties of Reg Σ 48 0, 1 2, At ny rte, we hve estlished criticl closure property for regulr lnguges:,, Lemm Regulr lnguges form Boolen lger: they re closed under union, intersection nd complement. Moreover, the closure is effective nd even polynomil time for DFAs. Effective here mens tht, given two mchines A 1 nd A 2, we cn compute new mchine for L(A 1) L(A 2), L(A 1) L(A 2) nd L(A 1) L(A 2). If the mchines re DFAs ll opertions re polynomil time (ut complement my low up for NFAs) We will hve more to sy out the complexity of the corresponding lgorithms; this is criticl for pplictions.

9 Déjà Vu All Over Agin 49 Deciding Equivlence 50 The lst lemm should sound very fmilir y now: there re nlogous results for semi-decidle sets, decidle set nd primitive recursive sets. Of course, for semi-decidle ones we hve to omit complements. We cn now del with the Equivlence prolem from lst time. Prolem: Equivlence Instnce: Two DFAs A 1 nd A 2. Question: Are the two mchines equivlent? In ll cses, we cn effectively construct mchines/progrms tht recognize the sets otined y Boolen opertions. The rel chllenge is stte complexity: in mny pplictions one needs to del with very lrge mchines. The corresponding lgorithm my require lot of ingenuity. Lemm A 1 nd A 2 re equivlent iff L(A 1) L(A 2) = nd L(A 2) L(A 1) =. Note tht the lemm yields qudrtic time lgorithm. We will see etter method lter. Deciding Inclusion 51 Conctention nd Kleene Str 52 Oserve tht we ctully re solving two instnces of closely relted prolem here: Prolem: Inclusion Instnce: Two DFAs A 1 nd A 2. Question: Is L(A 1) L(A 2)? which prolem cn e hndled y Lemm L(A 1) L(A 2) iff L(A 1) L(A 2) =. Definition Given two lnguges L 1, L 2 Σ their conctention (or product) is defined y L 1 L 2 = { xy x L 1, y L 2 }. Let L e lnguge. The powers of L re the lnguges otined y repeted conctention: L 0 = {ε} L k+1 = L k L Note tht for ny clss of lnguges Equivlence is decidle when Inclusion is so decidle. However, the converse my e flse ut it s not so esy to come up with n exmple. The Kleene str of L is the lnguge L = L 0 L 1 L 2... L n... Kleene str corresponds roughly to while-loop or itertion. Str Exmples 53 Conctention is Esy 54 Exmple {, } : ll words over {, } Exmple {, } {}{, } {}{, } : ll words over {, } contining t lest two s Exmple {ε,, }{,, } : ll words over {, } not contining suword Exmple {0, 1}{0, 1} : ll numers in inry, with leding 0 s {1}{0, 1} {0}: ll numers in inry, no leding 0 s Suppose we hve two NFAs A 1 nd A 2 for L 1 nd L 2. To uild mchine for L 1 L 2 it is esiest to go with n NFAE A: Let Q = Q 1 Q 2, keep ll the old trnsitions nd dd ε-trnsitions from F 1 to I 2. I 1 re the initil sttes nd F 2 the finl sttes in A. It is cler tht L(A) = L 1 L 2. But note tht this construction my introduce qudrticlly mny trnsitions. Find wy to keep the numer of new trnsitions liner.

10 Conctention is Hrd 55 Kleene Str nd More Nondeterminism 56 Now suppose we hve two DFAs A 1 nd A 2 for L 1 nd L 2. We cn get DFA from the previous mchine, ut cn we uild DFA for L 1 L 2 directly? The prolem is tht given word w we need to split it s w = xy nd then feed x to A 1 nd y to A 2. But there re w + 1 mny wys to do the split, nd we hve priori no ide where the rek should e. One cn lso think of this s guess nd verify prolem: guess x nd y, nd then check tht indeed A 1 ccepts x, nd A 2 ccepts y. Of course, there is slight prolem: DFAs don t know how to guess. The sitution gets worse if we try to construct DFA for the Kleene str of lnguge: L = L 0 L 1 L 2... L n... Not only do we not know where to split the string, we lso don t know how mny locks there re. Moreover, the numer of locks is unounded (t lest in generl), nd it is fr from cler how this type of processing cn e hndled y DFA. Of course, we cn simply strt with n NFA or even nd NFAE, nd then convert ck to DFA. NFAEs 57 Peles 58 If we re willing to del with ε-trnsitions closure under conctention nd Kleene str is not hrd t ll. Given two NFAs, construct n NFAE for the conctention of the two mchines. Given NFA, construct n NFAE for the Kleene str of the mchine. Another wy of thinking out this is to plce peles on the sttes. Initilly, ech stte in I hs pele. Under input, pele on p multiplies nd moves to ll q such tht p q. Multiple peles on stte re condensed into single one. We ccept whenever pele ppers in F. Peles re very helpful in prticulr in the direct construction of DFAs: the movement of the set of ll peles is perfectly deterministic. Pele Automton for Conctention 59 Quoi? 60 We strt with one copy of DFA A 1, the mster, nd one copy of DFA A 2, the slve. Plce one pele on the initil stte of the mster mchine. Move this nd ll other peles long trnsitions ccording to stndrd rules. Whenever the mster pele reches finl stte, plce new pele on the initil stte of the slve utomton. The composite mchine ccepts if pele sits on finl stte in the slve mchine. First, the mchine just descried is deterministic: we plce nd remove collection of peles ccording to n entirely deterministic rule. The sttes re of the form (p, P ) where p Q 1 nd P Q 2, corresponding to complete record of the positions of ll the peles. Now let n i e the stte complexity of A i. Then the numer of sttes is t most n 1 2 n2 Of course, the ccessile prt my well e smller. So the numer of sttes is ounded y A 1 2 A2 : the A 1 prt is deterministic ut the A 2 prt is not.

11 s 61 Aside: Complicted Intersections 62 There re severl gps nd inccurcies in the outline ove, fix them ll. Crry out this construction for the lnguges E = even numer of s nd E = even numer of s nd run some exmples. Product constructions re importnt even for reltively simple lnguges, it cn e quite difficult to uild utomt for, sy, the intersection of two regulr lnguges directly y hnd. Here is n exmple: uild DFA for the lnguge of ll words tht contin the scttered suword (not fctor) 3 times, nd multiple-of-3 numer of s. Building the two component mchines nd tking their product we get Explin why the peling construction relly defines DFA Crry out peling construction for Kleene str Sizes of Product Mchines 63 Bd News: DFA Intersection 64 More generlly, suppose we hve DFAs A i of size n i, respectively. Then the full product mchine hs n = n 1n 2... n s sttes. A = A 1 A 2... A s 1 A s The full product mchine grows exponentilly, ut its ccessile prt my e much smller. Als, there re cses where exponentil low-up cnnot e voided. Here is the Emptiness Prolem for list of DFAs rther thn just single mchine: Prolem: Instnce: Question: DFA Intersection A list A 1,..., A n of DFAs Is L(A i) empty? This is esily decidle: we cn check Emptiness on the product mchine A = A i. The Emptiness lgorithm is liner, ut it is liner in the size of A, which is itself exponentil. And, there is no universl fix for this: Theorem The DFA Intersection Prolem is PSPACE-hrd.

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

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

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

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

Designing finite automata II

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

More information

Lecture 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

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

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

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

CDM Automata on Infinite Words

CDM Automata on Infinite Words CDM Automt on Infinite Words 1 Infinite Words Klus Sutner Crnegie Mellon Universlity 60-omeg 2017/12/15 23:19 Deterministic Lnguges Muller nd Rin Automt Towrds Infinity 3 Infinite Words 4 As mtter of principle,

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

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

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

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

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

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

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. 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

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

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

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

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

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

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

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

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

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

More information

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

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

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

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

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

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

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

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

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

CDM Closure Properties

CDM Closure Properties CDM Closure Properties Klaus Sutner Carnegie Mellon Universality 15-closure 2017/12/15 23:19 1 Nondeterministic Machines 2 Determinization 3 Closure Properties Where Are We? 3 We have a definition of regular

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

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

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

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

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

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

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

Finite-State Automata: Recap

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

More information

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

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

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

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

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

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

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

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

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

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

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

More information

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

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

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

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

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

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

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

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

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

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

More information

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

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

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

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

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

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

More information

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

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

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

More information

GNFA GNFA GNFA GNFA GNFA

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

More information

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

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

More information

First Midterm Examination

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

More information

Homework Solution - Set 5 Due: Friday 10/03/08

Homework Solution - Set 5 Due: Friday 10/03/08 CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.

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

Lecture 3: Equivalence Relations

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

More information

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique? XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk out solving systems of liner equtions. These re prolems tht give couple of equtions with couple of unknowns, like: 6= x + x 7=

More information

On Determinisation of History-Deterministic Automata.

On Determinisation of History-Deterministic Automata. On Deterministion of History-Deterministic Automt. Denis Kupererg Mich l Skrzypczk University of Wrsw YR-ICALP 2014 Copenhgen Introduction Deterministic utomt re centrl tool in utomt theory: Polynomil

More information

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations. Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one

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

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

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

Revision Sheet. (a) Give a regular expression for each of the following languages:

Revision Sheet. (a) Give a regular expression for each of the following languages: Theoreticl Computer Science (Bridging Course) Dr. G. D. Tipldi F. Bonirdi Winter Semester 2014/2015 Revision Sheet University of Freiurg Deprtment of Computer Science Question 1 (Finite Automt, 8 + 6 points)

More information

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings... Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive

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

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

Worked out examples Finite Automata

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

More information

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

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

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique? XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk bout solving systems of liner equtions. These re problems tht give couple of equtions with couple of unknowns, like: 6 2 3 7 4

More information

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan CS 267: Automted Verifiction Lecture 8: Automt Theoretic Model Checking Instructor: Tevfik Bultn LTL Properties Büchi utomt [Vrdi nd Wolper LICS 86] Büchi utomt: Finite stte utomt tht ccept infinite strings

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

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

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

CSE396 Prelim I Answer Key Spring 2017

CSE396 Prelim I Answer Key Spring 2017 Nme nd St.ID#: CSE96 Prelim I Answer Key Spring 2017 (1) (24 pts.) Define A to e the lnguge of strings x {, } such tht x either egins with or ends with, ut not oth. Design DFA M such tht L(M) = A. A node-rc

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

p-adic Egyptian Fractions

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

More information

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power CS411-2015S-12 Turing Mchine Modifictions 1 12-0: Extending Turing Mchines When we dded stck to NFA to get PDA, we incresed computtionl power Cn we do the sme thing for Turing Mchines? Tht is, cn we dd

More information

Name Ima Sample ASU ID

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

More information

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

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

More information

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