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

Size: px
Start display at page:

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

Transcription

1 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, for some k 0 over the lphet Σ, such tht w 1 w 2 w k. Put w 0 = ε. Prove, (w 1 /w 0 )(w 2 /w 1 ) (w k /w k 1 ) = w k. Exercise 1.3. The reverse w R of string w is given y ε R = ε nd (w) R = (w R ). Prove tht (wv) R = (v R )(w R ) for every two strings w nd v. Exercise 1.4. A full inry tree is tree where ech node s either 0 or 2 children. Proof tht full inry tree with n leves hs t most 2 n 1 nodes. Exercise 1.5. (The Towers of Hnoi) See, e.g., Suppose you hve three posts nd stck of n different sized disks, initilly plced on one post with the lrgest disk on the ottom nd with ech disk ove it smller thn the disk elow. You re to move the disks so they end up ll on nother post, gin in decresing order of size with the lrgest disk on the ottom. The only moves you re llowed involve tking the top disk from one post nd moving it so tht it ecomes the top disk on nother post, without eing put on smller disk. () Show tht for ny n there must e sequence of moves tht does indeed end with ll the disks on post different from the originl one in the desired configurtion. () How mny moves re t lest required given n initil stck of n disks in the sequence of moves reveled y your nswer to the previous question? Exercise 1.6. Let Σ e n lphet. () Clculte the lnguge conctentions {,cd} {e,ef} nd {} {}. () Prove tht {ε} L = L {ε} = L for every lnguge L Σ. (c) Prove tht L = L = nd = {ε}. (d) Give counter exmple for (L 1 L 2 ) = L 1 L 2 for two lnguges L 1,L 2 Σ. Exercise 1.7. The shuffle w v of two strings w,v Σ yields set of strings, nd is given y (1) ε ε = {ε} (2) w ε = {w} (3) ε v = {v} (4) w v = {} (w v ) {} (w v )

2 2 () Clculte nd c def. () Prove w v = v w. (c) Does it lwys hold tht wv,vw w v?

3 3 Exercises Chpter 2 Exercises for Section 2.1 Exercise 2.1. Construct DFA D 1 with lphet {,} (with no more thn three sttes) for the lnguge L 1 = { n n 0} nd prove with the help of pthsets tht L(D 1 ) = L 1. Exercise 2.2. Construct DFA D 2 with lphet {0,1} (with no more thn four sttes) for the lnguge L 2 = {w {0,1} the second lst element of w is 0} nd prove with the help of pthsets tht L(D 2 ) = L 2. Exercise 2.3. () Construct DFA for the lnguge {,c,c,} over the lphet {,,c}. () If L {,,c} is finite, does there exists DFA D such tht L(D) = L? Exercise 2.4. () Construct DFA D 3 with lphet {0,1} (with no more thn eight sttes) for the lnguge L 3 = {w {0,1} w hs sustring 00 nd sustring 11} nd prove tht L(D 3 ) = L 3. () Construct DFA D 4 with lphet {0,1,2} (with no more thn eight sttes) for the lnguge L 4 = {w {0,1,2} w hs sustring 00 nd sustring 11} nd prove tht L(D 4 ) = L 4. Exercise 2.5. Construct DFAs D 5 nd D 6 ccepting the following lnguges () L 5 = {w {,} w mod 3 = 0} (c) L 6 = {w {0,1} w s inry numer is divisile y 3} Exercise 2.6. Suppose lnguge L Σ is ccepted y DFA D. Construct DFA D C tht ccepts the lnguge L C = {w Σ w / L}. Exercise 2.7. Let D 1 nd D 2 e two DFAs, sy D i = (Q i, Σ, δ i, q0 i, F i) for 1 i 2. () Give DFA D with set of sttes Q 1 Q 2 nd lphet Σ such tht L(D) = L(D 1 ) L(D 2 ). () Prove, y induction on the length of string w, tht ((q 1,q 2 ),w) n D ((q 1,q 2),w ) (q 1,w) n D (q 1,w ) (q 2,w) n D (q 2,w ) (c) Conclude tht indeed L(D) = L(D 1 ) L(D 2 ).

4 4 Exercises for Section 2.2 Exercise 2.8. Consider the lphet Σ = {,, c}. () Construct n NFA tht ccepts the lnguge L = { n m c l n,m,l 0} nd hs no more thn three sttes. () Derive DFA ccepting L from the NFA constructed in prt (). Exercise 2.9. Consider the lphet Σ = {,, c}. () Construct single NFA tht ccepts string w Σ iff (i) w is of the form c n for some n 0, or (ii) w is of the form m c for some m 0, or (iii) w is of the form c l for some l 0 () Derive DFA ccepting L from the NFA constructed in prt (). Exercise Give n utomton overthe lphet {,,c,d} tht ccepts ll strings in which t lest one symol of the lphet does not occur. Exercise Suppose the lnguge L Σ is regulr. () Show tht L\{ε} is regulr. () Let w Σ e n ritrry string. Prove tht L {w} is regulr. Exercise () Prove tht the lnguge L = {c,c,,c} is regulr. () Construct DFA ccepting L. (c) Prove tht every finite lnguge over some lphet Σ is regulr.

5 5 Exercises for Section 2.3 Exercise (Sipser 1997) For the lnguge of ech of the following regulr expressions over the lphet {,}, give two strings tht re memers nd two strings tht re not memers. () () () (c) (+) (+) (+) (+) (d) (1+) Exercise Provide regulr expression for ech of the following lnguges. () {w {,} w strt with nd ends in } () {w {,,c} w contins t most two s nd t lest one } (c) {w {,} w 3} Exercise (Sipser 1997) Construct regulr expressions for the lnguges ccepted y the following DFAs: () () q 0 q 1, q 0 q 1 q 2 Exercise Guess regulr expression for ech of the following lnguges. Next provide DFA for ech lnguge nd construct regulr expression vi elimintion of sttes. () {w {,} in w, ech mximl sustring of s of length 2 or more is followed y symol } () {w {,} w hs no sustring } (c) {w {,} # (w) = # (w) if v w then 2 # (v) # (v) 2} Exercise (Sipser 1997) Convert the following regulr expression to n equivlent NFA: () (+) (+) () ((() ())+)

6 6 Exercises for Section 2.4 Exercise Prove tht the following lnguges re not regulr. () { k k k 0} () { k l k > l > 0} (c) { k l c k+l k,l 0} Exercise Prove tht the lnguge {ww R w {0,1} } is not regulr. Exercise Prove tht the lnguge { n n is prime} is not regulr. Exercise () Prove, y induction on m, tht m < 2 m for m 0. () Prove tht the lnguge { n n = 2 k for some k 0} is not regulr. Exercise Prove tht the following lnguges re not regulr. () {w {0,1} # 0 (w) = # 1 (w)} () {w {0,1} # 0 (w) # 1 (w)} Exercise Prove tht the clss of regulr lnguges is closed under reversl, i.e. if the lnguge L is regulr, then so is L R = {w R w L}. Exercise The symmetric difference X Y of two sets X nd Y is given y X Y = {x X x / Y } {y Y y / X } Prove tht the clss of regulr lnguges is closed under symmetric difference, i.e. if the lnguges L 1 nd L 2 re regulr, then so is L 1 L 2.

7 7 Exercises Chpter 3 Exercises for Section 3.1 Exercise 3.1. (Hopcroft, Motwni & Ullmn, 2001) Consider the following PDA. [ /1] [1/11] [1/1] [1/11] [1/ε] [1/ε] q 0 q 1 Compute ll mximl derivtion sequences for the following inputs: () ; () ; (c). A mximl derivtion sequence of PDA P for string w is sequence (q 0,w 0,x 0 ) P (q 1,w 1,x 1 ) P...(q n 1,w n 1,x n 1 ) P (q n,w n,x n ) P where q 0,q 1,...,q n 1,q n re sttes of P with q 0 its initil stte, w 0,w 1,...,w n 1,w n strings over the input lphet of P with w 0 equl to w, nd x 0,x 1,...,x n 1,x n strings over the stck lphet of P with x 0 equl to ε, the empty stck. Exercise 3.2. Construct push-down utomton nd give n invrint tle for the following lnguges over the input lphet Σ = {,,c}. () L 1 = { n m c n+m n,m 0}; () L 2 = { n+m n c m n,m 0}; (c) L 3 = { n n+m c m n,m 0}; Exercise 3.3. Give push-down utomton nd invrint tle for ech of the following lnguges: () L 4 = { n 2n n 0}; () L 5 = { n m m n 1}; (c) L 6 = { n m 2n = 3m+1}; (d) L 7 = { n m m,n 0, m n}. Exercise 3.4. () Give push-down utomton for the lnguge L 8 = {w {,} # (w) # (w)} () Give push-down utomton for the lnguge L 9 = {w {,,c} # (w) # (w) # (w) # c (w)}

8 8 Exercises for Section 3.2 Exercise 3.5. (Hopcroft, Motwni & Ullmn 2001) Consider the context-free grmmr G given y the production rules S XY X ε X Y ε Y Y tht genertes the lnguge of the regulr expression (+). Give leftmost nd rightmost derivtions for the following strings: () ; () ; (c). Exercise 3.6. Consider the context-free grmmr G given y the production rules () Prove tht L G (A) = { n n 0}. S A B A ε A B ε B () Prove tht L(G) = { n n 0} { n n 0}. Exercise 3.7. Give context-free grmmr for ech of the following lnguges nd prove them correct. () L 1 = { n m n,m 0, n m}; () L 2 = { n m c l n,m,l 0, n m m l}; Exercise 3.8. Give construction, sed on the numer of opertors, tht shows tht every the lnguge of every regulr expression cn e generted y context-free grmmr. Exercise 3.9. (Hopcroft, Motwni & Ullmn 2001) Consider the context-free grmmr G given y the production rules S S S () Prove tht no string w L(G) hs sustring. () Give description of L(G) tht is independent of G. (c) Prove tht your nswer for prt () is correct.

9 9 Exercise (Hopcroft, Motwni& Ullmn 2001) Consider the context-free grmmr G given y the production rules S SS SS ε Prove tht L(G) = {w {,} # (w) = # (w)}. Exercise A context-free grmmr G = (V, T, R, S, ) is clled liner if ech production rule is of either of the following two forms: A B or A ε for A,B V, not necessrily different, nd T. Argue tht every regulr lnguge is generted y liner context-free grmmr. Argue tht every liner context-free grmmr genertes regulr lnguge.

10 10 Exercises for Section 3.3 Exercise Consider gin the the grmmr of Exercise 3.5 with production rules S XY X ε X Y ε Y Y Provide prse trees for this grmmr with yield,, nd. A context-free grmmr G is clled miguous if there exist two different complete prse trees PT 1 nd PT 2 of G such tht yield(pt 1 ) = yield(pt 2 ). Otherwise G is clled unmiguous. Exercise () Show tht the grmmr G given y the production rules is miguous. S AB B A A B () Provide n unmiguous grmmr G tht genertes the sme lnguge s G. Argue why G is unmiguous nd why L(G ) = L(G). Exercise () Show tht the grmmr G given y the production rules is miguous. S ε SS SS () Provide n unmiguous grmmr G tht genertes the sme lnguge s G. Argue why G is unmiguous nd why L(G ) = L(G).

11 11 Exercises for Section 3.4 Exercise (Hopcroft, Motwni & Ullmn 2001) Convert the context-free grmmr G S AA A S S to PDA P tht ccepts on empty stck with N(P) = L(G). Exercise Consider the PDA P ccepting on empty stck elow. [D/ε] [X/XX] [D/XD] [X/X] q 0 q 1 [D/D] [X/ε] Give context-free grmmr G such tht L(G) = N(P). Exercise (Hopcroft, Motwni & Ullmn, 2001) Consider gin the PDA of Exercise 3.1 repeted elow. [ /1] [1/11] [1/1] [1/11] [1/ε] [1/ε] q 0 q 1 Provide context-free grmmr tht genertes the sme lnguge s this PDA ccepts.

12 12 Exercises for Section 3.5 Exercise Show tht the clss of context-free lnguges is closed under reversl, i.e. if L is contextfree lnguge then so is L R = {w R w L}. Show tht the clss of context-free lnguges is not closed under set difference, i.e. if L 1 nd L 2 re context-free lnguges, then L 1 \L 2 = {w L 1 w / L 2 } is not context-free in generl. Exercise Show tht the lnguge L 1 = { n2 n 0} is not context-free. Exercise Show tht the lnguge L 2 = {ww R w w {,} } is not context-free. Exercise Show tht the lnguge L 3 = {0 n 10 2n 10 3n n 0} is not context-free. Exercise Show tht the lnguge L 4 = { n l c m n,l m} is not context-free.

13 13 Exercises Chpter 4 Exercises for Section 4.1 Exercise 4.1. ConstructrectiveTuringmchinefor the lngugel = { n m c l n,m,l 0}. Give n ccepting computtion sequence for the string ccc. Argue why the strings cc nd c re not ccepted. A proof of correctness is not sked for. Exercise 4.2. Construct, for the lnguge L = { n m c n+m n,m 0 }, rective Turing mchine. Give n ccepting computtion sequence for the string cccc. Argue why the strings cc nd ccc re not ccepted. A proof of correctness is not sked for. Exercise 4.3. Construct rective Turing mchine for the lnguge L = {ww R w {,} }. Give n ccepting computtion sequence for the string. Argue why the strings nd re not ccepted. A proof of correctness is not sked for. Exercise 4.4. Construct rective Turing mchine for the lnguge L = { n n n n n 0}. Give n ccepting computtion sequence for the string. Argue why the strings nd re not ccepted. A proof of correctness is not sked for. Exercise 4.5. ConstructrectiveTuringmchineforthelngugeL = {ww R w w {,} }. Give computtion sequence for the string. Argue why the strings nd re not ccepted. A proof of correctness is not sked for. Exercise 4.6. Construct Turing mchine for the lnguge L = { n n c n n > 0} tht hs t most one -move. A proof of correctness is not sked for. Exercise 4.7. ConstructrectiveTuringmchineforthelngugeL = {w {,} # (w) = 2 # (w)} with t most 4 sttes. A proof of correctness is not sked for.

14 14 Exercises for Section 4.2 Exercise 4.8. Construct clssicl Turing mchine tht computes function p : {,} {Y,N} such tht p(w) = Y if w is plindrome, nd p(w) = N if w is not plindrome. Give computtion sequence for the strings nd producing Y, nd for the strings the strings nd producing N. A proof of correctness is not sked for. Exercise 4.9. Construct clssicl Turing mchine for the Dutch ntionl flg prolem, i.e. Turing mchine tht computes the function dnf : {R,W,B} {R,W,B} such tht, for ny string w {R,W,B}, dnf(w) = R n W m B l where n = # R (w), m = # W (w), nd l = # B (w). Give computtion sequence for the strings RWBRW, BBWWWRRR nd BWB. A proof of correctness is not sked for. Exercise () Construct clssicl Turing mchine tht computes function 2 log : {0,1} {0,1} such tht 2 log(w) = n if 2 n w < 2 n+1 with the string w interpreted s inry numer. () Construct Turing mchine tht computes function 2to3 : {0,1} {0,1,2} such tht if the string w represents in inry the numer n, the string 2to3(w) represent in ternry the sme numer n. (c) Construct clssicl Turing mchine tht computes function 3 log : {0,1} {0,1} such tht 3 log(w) = n if 3 n w < 3 n+1 with the string w interpreted s ternry numer.

15 15 Exercises Chpter 5 Exercises for Section 5.1 Exercise 5.1. Consider the LTS S 1 nd S 2 in Figure 1. () Provide isimultion reltion tht shows tht the two sttes q 0 nd q 1 of LTS S 1 re isimilr. () Provide isimultion reltion tht shows tht LTS S 1 nd LTS S 2 re isimilr. Exercise 5.2. Construct coloring tle to decide which sttes in LTS S 3 nd nd which sttes in LTS S 4 of Figure 1 re isimilr. Is it the cse tht the two LTS re isimilr? If yes, provide isimultion reltion. If no, point out why the initil sttes cnnot e isimilr. S 3 q 0 S 4 p 0 S 1 q 0 S 2 p 0 q 1 q 2 p 1 c c c c q 1 p 1 p 3 q 3 q 4 q 5 c c p 2 p 3 p 4 c c d e d e p 2 q 6 q 7 p 5 p 6 () LTS for Exercise 5.1 () LTS for Exercise 5.2 Figure 1: Bisimilrity Exercise 5.3. Let S e n LTS with set of sttes Q. Prove tht if R 1,R 2 Q Q re two isimultion reltions for S then R 1 R 2 is lso isimultion reltion for S. Exercise 5.4. Consider LTS S 0 of Figure 2. Apply the coloring procedure to show tht q 0,q 1,q 2,q 3 re rnching isimilr sttes nd tht q 4,q 5,q 6,q 7,q 8,q 9 re rnching isimilr sttes. Exercise 5.5. Consider LTS S 1 nd LTS S 2 of Figure 2. Apply the coloring procedure to decide whether LTS S 1 is rnching isimilr to LTS S 2. Exercise 5.6. Consider LTS S 3 nd LTS S 4 of Figure 2c. Apply the coloring procedure to decide whether LTS S 3 is rnching isimilr to LTS S 4.

16 16 S 1 q 0 S 2 p 0 S 0 q 0 q 1 q 2 q 3 c c q 4 q 5 q 6 q 7 q 8 q 9 d d d q 1 q 2 c d d q 3 p 1 p 2 d d c c p 3 p 4 () LTS for Exercise 5.4 () LTS for Exercise 5.5 S 3 q 0 q 1 S 4 p 0 S 5 q 0 S 6 p 0 q 2 q 3 p 1 p 2 q 1 p 1 p 3 q 4 p 3 p 4 p 2 (c) LTS for Exercise 5.6 (d) LTS for Exercise 5.7 Figure 2: Brnching isimilr?

17 17 Exercise 5.7. Consider LTS S 5 nd LTS S 6 of Figure 2d. Apply the coloring procedure to decide whether LTS S 5 is rnching isimilr to LTS S 6. Exercise 5.8. Let S e n LTS with set of sttes Q. () Verify tht the identity reltion I = {(q,q) q Q} is isimultion reltion for S. () SupposeR Q QisisimultionreltionforS. Definethe inversereltionr 1 Q Q y R 1 (q,p) R(p,q). Prove tht R 1 is isimultion reltion for S s well. (c) Prove tht if R 1,R 2 Q Q re two isimultion reltions for S then their composition R 1 R 2 defined y R 1 R 2 = {(q,p) r : R 1 (q,r) R 2 (r,p)} is lso isimultion reltion for S. (d) Conclude tht isimilrity of sttes of n LTS is n equivlence reltion. Exercise 5.9. Let S 1 = (Q 1, Σ, 1, q 0 ) nd S 2 = (Q 2, Σ, 2, p 0 ) e two LTSs, nd R Q 1 Q 2 isimultion reltion for S 1 nd S 2. () Prove tht if q Q 1 is rechle from q 0 in S 1, there exists p Q 2 rechle from p 0 such tht R(q, p). () Give n exmple of two isimilr LTSs S 1 nd S 2 for which there exists stte q in S 1 for which there is no isimilr stte in S 2 nd there exists stte p in S 2 for which there is no isimilr stte in S 1.

18 18 Exercises for Section 5.2 Exercise Consider LTS P nd Q elow: P p 0 p 1 p 2 p 8 p 9 Q q 0 q 1 q 2 p 7 p 6 p 5 p 3 p 4 Prove tht P nd Q re rnching isimilr. Exercise Consider LTS A, B nd C elow. A c! B d! C c? c 0 c 1 d? Let the communiction function γ e such tht γ(c!,c?) = c nd γ(d!,d?) = d. Define the ction set H = {c!,c?,d!,d?}. Drw the LTS H (A γ B γ C). Exercise Consider LTS A, B nd C elow. A B C 0 0 c 0 x c 1 x y 1 c 1 y c 2 d e 4 5 Let the communiction function γ e such tht γ(x,x ) = x nd γ(y,y ) = y. Define the ction set H = {x,x,y,y } nd the ction set I = {x,y}. Drw the LTS H (A γ B γ C) nd indicte how to otin LTS I ( H (A γ B γ C)).

19 19 Exercise Consider LTS A nd B elow. 0 A x y B 0 x y y x 5 6 c y x 5 6 d 7 7 Let the communiction function γ e such tht γ(x,x ) = x nd γ(y,y ) = y. Define the ction set H = {x,x,y,y } nd the ction set I = {x,y}. Drw the LTS H (A γ B) nd indicte how to otin LTS I ( H (A γ B)). Exercise Consider the processes C(0) nd C(1), nd the processes D(0) nd D(1) given y C(0) c! 0 C(1) c! 1 D(0) d! 0 D(1) d! 1 c 0 c 1 d 0 d 1 Design n LTS S such tht, for suitle communiction function γ nd sets of ctions H nd I, it holds tht the LTS I ( H (S γ C(i) γ D(j))) for i,j = 0,1, esides ctions, only performs n ction in cse i+j = 0, n ction if i+j = 1, nd n ction c if i+j = 2. Exercise LTS IC of n instle coin process, nd LTS SC of stle coin process re given y IC ic0 c! hed ic 1 ic 2 c! til SC sc0 c! hed sc 1 sc 2 c! til Put H = { c! x, c? x x = hed,til } nd I = { c x x = hed,til }. Give process S nd communiction function γ, such tht the LTS I ( H (S γ IC)) nd I ( H (S γ SC)) re not rnching isimilr.

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

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

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

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

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

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

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

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

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

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

More information

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

Context-Free Grammars and Languages

Context-Free Grammars and Languages Context-Free Grmmrs nd Lnguges (Bsed on Hopcroft, Motwni nd Ullmn (2007) & Cohen (1997)) Introduction Consider n exmple sentence: A smll ct ets the fish English grmmr hs rules for constructing sentences;

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

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

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

More information

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

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

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

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

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

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

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

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is

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

CSC 311 Theory of Computation

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

More information

CS 275 Automata and Formal Language Theory

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

More information

1.4 Nonregular Languages

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

More information

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

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

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

More information

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

Overview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.

Overview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch. Overview H9 Vertlerouw H 9: Prsing: op-down & LL(1) do 3 mei 2001 56 heo Ruys h. 8 - Prsing 8.1 ontext-free Grmmrs 8.2 op-down Prsing 8.3 LL(1) Grmmrs See lso [ho, Sethi & Ullmn 1986] for more thorough

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

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

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

More information

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

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

In-depth introduction to main models, concepts of theory of computation:

In-depth introduction to main models, concepts of theory of computation: CMPSCI601: Introduction Lecture 1 In-depth introduction to min models, concepts of theory of computtion: Computility: wht cn e computed in principle Logic: how cn we express our requirements Complexity:

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

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

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

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)

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

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

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

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

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

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

1 Nondeterministic Finite Automata

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

More information

CS 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

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

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

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

Some Theory of Computation Exercises Week 1

Some Theory of Computation Exercises Week 1 Some Theory of Computtion Exercises Week 1 Section 1 Deterministic Finite Automt Question 1.3 d d d d u q 1 q 2 q 3 q 4 q 5 d u u u u Question 1.4 Prt c - {w w hs even s nd one or two s} First we sk whether

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

Fundamentals of Computer Science

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

More information

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

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

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15 Regulr Lnguge Nonregulr Lnguges The Pumping Lemm Models of Comput=on Chpter 10 Recll, tht ny lnguge tht cn e descried y regulr expression is clled regulr lnguge In this lecture we will prove tht not ll

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

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

SWEN 224 Formal Foundations of Programming WITH ANSWERS

SWEN 224 Formal Foundations of Programming WITH ANSWERS T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 END-OF-YEAR SWEN 224 Forml Foundtions of Progrmming

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

CS375: Logic and Theory of Computing

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

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

Myhill-Nerode Theorem

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

More information

Automata and Languages

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

More information

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

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

The University of Nottingham

The University of Nottingham The University of Nottinghm SCHOOL OF COMPUTR SCINC AND INFORMATION TCHNOLOGY A LVL 1 MODUL, SPRING SMSTR 2004-2005 MACHINS AND THIR LANGUAGS Time llowed TWO hours Cndidtes must NOT strt writing their

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

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

ɛ-closure, Kleene s Theorem,

ɛ-closure, Kleene s Theorem, DEGefW5wiGH2XgYMEzUKjEmtCDUsRQ4d 1 A nice pper relevnt to this course is titled The Glory of the Pst 2 NICTA Resercher, Adjunct t the Austrlin Ntionl University nd Griffith University ɛ-closure, Kleene

More information

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q

More information

FABER Formal Languages, Automata and Models of Computation

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

More information

Parse trees, ambiguity, and Chomsky normal form

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

More information

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)

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

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

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

More information

Lecture 6 Regular Grammars

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

More information

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

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 0 Forml Methods nd Models Dn Richrds, George Mson University, Fll 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 8 1. Prove q (q p) p q p () (4pts) with truth tle. p q p q p (q p) p q

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

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

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q

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

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

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

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

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

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

More information

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

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

More information

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

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

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

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

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

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

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

DFA minimisation using the Myhill-Nerode theorem

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

More information

Languages & Automata

Languages & Automata Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings

More information

Formal Languages and Automata Theory. D. Goswami and K. V. Krishna

Formal Languages and Automata Theory. D. Goswami and K. V. Krishna Forml Lnguges nd Automt Theory D. Goswmi nd K. V. Krishn Novemer 5, 2010 Contents 1 Mthemticl Preliminries 3 2 Forml Lnguges 4 2.1 Strings............................... 5 2.2 Lnguges.............................

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