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.

Size: px
Start display at page:

Download "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."

Transcription

1 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 of the following theorems, give two or three sentence sketch of how the proof goes or why it is not true. () Every DFA M cn e converted into n equivlent NFA M for which L(M) = L(M ). True. A DFA M is utomticlly lso NFA. () Every NFA M cn e converted into n equivlent DFA M for which L(M) = L(M ). True. M computing is like hving mny clones computing on M. The current stte of M is the suset of the sttes of M tht the clones re currently on. (c) Every DFA M cn e converted into n equivlent TM M for which L(M) = L(M ). True. A TM M cn simulte DFA M simply y not using its tpe except for reding the input in. (d) Every TM M cn e converted into n equivlent DFA M for which L(M) = L(M ). Flse. A TM cn compute L = { n n n } nd DFA cnnot. (e) Every regulr expression R cn e converted into n equivlent NFA M for which L(R) = L(M). True. NFA re closed under union, conctention, nd kleene str. Hence, the NFA M is uilt up y following these opertions within the R. (f) Every DFA M cn e converted into n equivlent regulr expression R for which L(M) = L(R). True. This is the complex lgorithm in which sttes of the NFA re removed one t time nd edges re llowed to e leled with regulr expressions. (g) Every NFA M cn e converted into n equivlent one M tht hs single ccept stte. True. Given M, construct M y dding new stte f tht will e the only ccept stte of M. Add n ǫ trnsition from ech ccept stte of M to f. (h) The set of lnguges computed y DFA is closed under complement. True. Given DFA M tht computes L, construct M y switching the ccept nd not ccept sttes of M. L(M ) = L(M). (i) The set of lnguges computed y NFA is closed under complement. True. Given NFA M tht computes L, constructing M for which L(M ) = L(M) cnt e done directly. Insted, convert the NFA M into DFA M s done ove nd then construct from the DFA M the DFA M y switching the ccept stte, so tht L(M ) = L(M ) = L(M). 2. Closure: Consider the utomt from the lst ssignment., 2 3

2 () Construct n NFA for the lnguge L L 2. Use the technique done in clss tht comines the ove two mchines. Do not simplify the mchine produced. () Similrly, construct n NFA for the lnguge L 2 L., 2 3, 2 3 (c) Similrly, construct n NFA for the lnguge (L 2 ). (d) Suppose you re DFA. You hve n NFA M tht ccepts L nd n input string ω. In your own words, wht re the ides ehind simulting M on ω? Wht sttes to you need? 3. Consider the NFA M: () Give the lnguge L(M). L(m) = {w {} w = mod 2 or w = mod 3} () Convert this NFA into DFA. Giving the tle, the DFA M, nd the simplified DFA. 2

3 {,2-,3-} {2-,3-} {2-,3-} {2-,3-2} {2-,3-} {2-,3-} {2-,3-2} Q\Σ 2 {2 } 2 {2 } 3 {3 } 3 {3 2} 3 2 {3 } Simplified (c) Mke DFA M for the following lnguge L = {w {} w is, 2, 3, or 4 mod 6}. See ove fig. (d) Is there connection etween M nd M? Why? (If you re in the mood, see references for the Chinese Reminder Theorem of numer theory.) They compute the sme lnguge. The Chinese Reminder Theorem tells you for exmple tht if x = mod 2 nd x = 2 mod 3 then x = 5 mod 6. {6-} {6-} {6-2} {6-3} {6-4} {6-5} 4. Construct n NFA for the following lnguge ( ) ( ). U U ( U )* ( U )* ( U )* ( U )* 5. Use the Bumping Lemm to prove tht the following is not regulr. L = { n m n+m n,m } This L is not regulr ecuse it distinguishes etween the infinite numer of prefixes in the set S =. The prefixes α = i nd β = j re distinguished y L s follows. Let = i+, then α= i i+ is in L nd β= j i+ is not. 6. Algorithms: Descrie in few sentences the outline of n lgorithm to solve ech of the following computtionl prolems involving DFA nd NFA. () Given n NFA M, does it ccept ny string or is it the cse tht L(M) =. An NFA M ccepts the string α iff there exists pth from the strt stte to n ccept stte leled α. There is some string tht M ccepts iff there exists pth from the strt stte to n ccept stte. To check this, we consider ech ccept stte one t time nd sk whether there exists pth from the strt stte to this ccept stte. When the NFA M is viewed s directed grph, this question cn e rephrsed s the following clssic grph theory prolem. The input consists of directed grph nd two nodes s nd t. The output sttes whether or not there is pth in the grph from s to t. There re stndrd lgorithms for this prolem. 3

4 () The symmetric difference of two lnguges is defined to e L L 2 = (L L 2 ) (L 2 L ). It consists of those strings for which these lnguges give different nswers. Given two DFA M = Q,Σ,δ,s,F nd M 2 = Q 2,Σ,δ 2,s 2,F 2, construct DFA M = Q,Σ,δ,s,F. Then formlly prove s done in clss tht L(M) = L(M ) L(M 2 ), i.e. tht for every string α, α L(M) if nd only if α L(M ) L(M 2 ). Define M = Q Q 2,Σ,δ, s,s 2,F, where δ( q,q 2,) = δ (q,),δ 2 (q 2,) nd F = { q,q 2 (q F nd q 2 F 2 ) or (q F nd q 2 F 2 )}. We prove L(M) = L(M ) L(M 2 ) s follows. w L(M) iff M computing on w hlt in some stte q,q 2 F iff M nd M 2 computing on w hlts in sttes such tht one is ccepting nd the other is not iff w L(M ) L(M 2 ). (c) Given two NFA M nd M 2, determine whether L(M ) = L(M 2 ). Oserve tht L = L 2 if nd only if L L 2 =. We test this s follows. First covert ech NFA into equivlent DFAs using 2 Q clone method. Then uses lgorithm from () to construct DFA M for the symmetric difference of their lnguges. Finlly, use lgorithm from () to test whether M ccepts ny strings. (d) Given n NFA M, determine whether L(M) = {ω ω contins s sustring }. Let M 2 e the NFA given in the notes ccepting the lnguge {ω ω contins s sustring }. Use lgorithm from (c) to test whether L(M) = L(M 2 ). (e) Given n NFA M, determine whether L(M) = { n n n }. No NFA ccepts this lnguge. Hence, when we re given n NFA, we cn simply sy NO without even looking t it. 7. Let L e lnguge of strings from {,}. We sy tht the strings α nd β re distinguished y L if there exists γ such tht L(αγ) L(βγ). Don t try to prove it, ut wht did we sy in clss tht this sys out ny DFA computing L? Give first order logic sttement tht sttes tht the strings α nd β re not distinguished y L. Don t try to prove it, ut wht did we sy in clss tht this sys out ny DFA computing L? Our L hppens distinguish etween every pir of strings in the set S = {,,}. On the other hnd, L does not distinguish etween the strings ǫ,,,,. Neither does it distinguish etween,. Neither does it distinguish etween,,. The string hppens to e ccepted in L, ut strings nd re rejected. Surprisingly enough, this is enough informtion out the lnguge L to completely determine wht nswer it gives for every inry string. More over, this specified lnguge is regulr nd hs very simple DFA. With smll chnge, this is proved in Eric s emil to me in my 2 course notes. You do not need to red or understnd this proof unless you wnt. All you need to do is to use the ove informtion to figure out wht this DFA must look like. We proved in clss tht if L distinguishes etween two strings then these two strings need to go to the different sttes in ny DFA tht computes L. Becuse L distinguishes etween the three strings in S, they must go to three different sttes. Lets cll these sttes q, q, nd q. We sy tht the strings α nd β re not re distinguished y L if γ, L(αγ) = L(βγ). Given pst of α or of β, ll futures γ led to the sme result. A DFA computing L does not need to hve these strings go to the sme stte, ut if they might s well ecuse if they went to different sttes these two sttes could e collpsed into the sme stte. We might s well ssume tht the strings ǫ,,,, ll go to stte q. Also, go to stte q. Finlly,, go to q. See the sttes in the figure elow. Suppose the DFA is in stte q. As fr s the future is concerned we might s well ssume tht the prefix red so fr is. If the DFA then reds the chrcter then it hs effectively red 4

5 the prefix. We know tht goes to stte q. This gives us tht δ(q,) = q. Similrly, the other trnsitions re otined s follows. Current stte next chrcter ssumed prefix next prefix next stte q q q q q q q q q q q q Note this chrt is enough to close the DFA, mening ech of its sttes hs n edge leled nd one leled. Unlike Eric s proof, we did not sy S ws mximl so there could hve een more strings indistinguishle from ech of these three nd hence more sttes. But ecuse the DFA is closed, this cn t e. Becuse ǫ is indistinguishle from, it must go to stte q. Hence this must e the strt stte. We were told tht the string hppens to e in L. If we run our DFA on this string, it goes to stte q. Hence this stte must e n ccept stte. Similrly we re told tht nd re rejected y L. They go to the other two sttes nd hence these sttes must e reject sttes. 8. The opertion of shuffle is importnt in the theory of concurrent systems. If x,y Σ, we write x y for the set of ll strings tht cn e otined y shuffling strings x nd y together like deck of crds; for exmple The set x y cn e defined y induction: cd = {cd,cd,cd,cd,cd,cd}. ǫ y = {y}, x ǫ = {x}, x y = (x y){} (x y){}. The shuffle L L 2 of two lnguges L nd L 2 is the set of ll strings otined y shuffling string from L with string from L 2 : For exmple, L L 2 = x L,y L 2 x y {} {cd,e} = {e,e,e,cd,cd,cd,cd,cd,cd}. 5

6 Show tht if L nd L 2 re regulr lnguges then so is L L 2. Do this y descriing generl method of constructing n NFA M for L L 2 out of DFA M for L nd M 2 for L 2. Hint: Given string γ, we must decide whether or not it is shuffle of string α from L nd one β from L 2. Given we re uilding n NFA, we do hve Firy Godmother to help us. She cn tell us for ech letter of γ whether it is in α or in β. Then knowing α nd β, we cn use M nd M 2 to see whether or not α is from L nd β is from L 2. We ccept γ if this the cse. On the other hnd, we hve to run M nd M 2 in prllel just s we did when we computed L L 2. Towrds this gol, imgine putting pele on stte of M nd nother on one of M 2. Guess nondeterministiclly which pele to move. Accept if in the end oth peles occupy ccept sttes. () Now ssume M nd M 2 re ritrry DFA. Descrie how you would construct the NFA M. For every stte u in M nd stte v in M 2, our new NFA M will hve stte u,v. The loop invrint nd/or interpreted mening of such stte u,v is s follows. The NFA M hs so fr red some prt of the input string γ. The Firy Godmother hs specified which of these chrcters re prt of α from L nd which re prt of β from L 2. If one would follow this specified α prt in the mchine M, then the resulting stte would e u. Similrly, if one would follow this specified β prt in the mchine M 2, then the resulting stte would e v. When the next chrcter of γ is red, the Firy Godmother tells us whether this letter is the next in α or in β. We then either follow the edge leled with this chrcter in M or in M 2. This is done more formlly s follow. Consider ny stte u,v of the new NFA M nd ny chrcter c Σ. Let u denote the stte of M reched when trveling from stte u nd reding this chrcter c, i.e. using trnsition rule δ (u,c) = u. Similrly let v denote the stte of M 2 reched when trveling from stte v nd reding c, i.e. using trnsition rule δ 2 (v,c) = v. M will hve trnsition rule δ ( u,v,c) = { u,v, u,v }. This sttes tht when in stte u,v nd reding c, the mchine nondeterministiclly might e told y the Firy Godmother tht this c is in α nd hence the stte chnges in M ut not in M 2, which chnges the M stte to u,v. Or the mchine might e told tht this c is in β nd hence the stte chnges in M 2 ut not in M, which chnges the stte to u,v. The M strt stte is u,v, where u is the strt stte of M nd v is tht of M 2. The ccept sttes of M re u,v, where u is n ccept stte of M nd v is tht of M 2. () Let M e the DFA long the left nd M 2 e tht long the top. The NFA M for L L 2 will hve the mtrix of sttes s shown. Indicte the strt stte nd the ccept sttes nd dd ll the trnsition edges.,,,, leng leng leng 2 leng >2 Even Odd,,, leng leng leng 2 leng >2, Even,,,, Odd,,,, 6

7 9. Let L e regulr lnguges over n lphet Σ. Consider the lnguge MIDTHIRDS(L) = {y Σ x,z Σ, x = y = z nd xyz L} Like n n, one likely would first guess tht DFA for this lnguge would hve to count the length nd x, y, nd z nd hence this lnguge would not e regulr. But note tht only y is prt of the input. Your tsk is to prove tht MIDTHIRDS(L) is lso regulr. Hint: Let M e DFA tht computes L. We construct n NFA M for MIDTHIRDS(L) s follows. Imgine M hving five fingers on sttes of M. This will give M sttes q strt,y,q strt,z,q x,q y,q z where ech of these q re sttes of M. Assuming y is yes instnce, these fingers together trce out the pth p xyz tht the computtion on M follows given input xyz. A common phenomen of nondeterminism is tht the Firy Godmother provides you with some crucil informtion tht lone you could not otin nd then your jo t the end is to verify tht wht she sid is ctully true. Informlly, descrie wht ech of the five fingers does s M reds its input y. Wht is the strt stte of M? Descrie the edges of M, i.e. from some stte q strt,y,q strt,z,q x,q y,q z when reding chrcter c y, the Firy Godmother cn choose to trnsition to stte Wht re the ccept sttes of M. How mny sttes does M hve? There is no need to prove your construction correct. q strt,y,q strt,z,q x,q y,q z Given yes instnce y, there exists strings x nd z such tht x = y = z nd xyz L}. Let p xyz = p x p y p z denote the pth ( sequence of sttes) tht the computtion on M follows given input xyz. Let p x, p y, nd p z denote the portions of this pth followed when reding the prts x, y, nd z respectively. After t time steps in the computtion of M on this string y, M will e in stte q strt,y,q strt,z,q x,q y,q z. Here q strt,y is the first stte in the sequence of sttes p y nd q strt,z is the first in p z, ecuse t the end of the computtion we will need to hve rememered them. Here q x is the t th stte in p x, q y the t th in p y, nd q z the t th in p z. In this wy, the fingers t M sttes q x, q y, nd q z will simultneously trce out these respective pths. Doing so will verify tht these three pths hve the sme length, verifying tht x = y = z. Doing so will lso verify tht xyz L. The strt stte of M immeditely hs ǫ trnsitions so tht the Firy God mother cn nondeterministiclly set the initil sttes q strt,y,q strt,z,q y,q x,q z. Here q strt,y nd q strt,z re set to e eginning of p y nd p z respectively. The initil vlue of q x will e the strt stte of M. The initil vlue of q y will e q strt,y. The initil vlue of q z will e q strt,z. The computtion proceeds s follows. When M reds the next chrcter c y of y, it trnsitions long the edge from its current stte q strt,y,q strt,z,q x,q y,q z to stte q strt,y,q strt,z,q x,q y,q z s follows. The finger qy trnsitions deterministiclly ccording to δ M (q y,c y ) = q y. The Firy God mother nondeterministiclly needs to tell M the next chrcters c x nd c z of x nd of z. This then llows M move the fingers q x nd q z ccording to δ M (q x,c x ) = q x nd δ M (q z,c z ) = q z. The fingers t q strt,y nd q strt,z do not move. When M s input y ends, we know tht x nd z lso end, eing the sme length. M ccepts if the pths p x, p y, nd p z connect. This requires q x to e t stte q strt,y, p y to e t q strt,z, nd p z to e t n ccept stte of M. A given y is yes instnce iff x,z Σ, x = y = z nd xyz L iff the computtion on M given input xyz cn e roken into three pieces p xyz = p x p y p z iff the three pths trced y p x, p y, nd p z in M mtch up nd end t n ccept stte if M iff M ccepts y. Note tht if the numer of sttes of M is M, then the numer of sttes of our NFA M will hve M 5 sttes.. For ech integer r, consider the NFA M r depicted elow.. 7

8 ,,,,,,,......, q q q q * 2 q q 3 r R () Let the input string e of the form α = xy, where x,y {,} re strings nd the specified chrcter is red s the computtion follows this edge from q to q. Wht re the requirements on the sustrings x nd y for this α to e ccepted. Nmely, the lnguge computed y M r is L r = {xy {,} where?? something out x nd y?? }. L r = {xy {,} where y = r}. () Lets index the input chrcters ckwrds, nmely α = α n α n...α 2 α α. Here α n is the first chrcter red y the NFA nd α is the lst. Wht re the requirements on the chrcters α i for this α to e ccepted. Nmely, the lnguge computed y M r is L r = {α {,} where?? something out α i?? }. L r = {α {,} α r = }. (c) Using the concepts from tht previous two question, explin ccepting computtions on this NFA M r. The NFA first reds nd ignores the input chrcters x = α n α n...α r+2 α r+ while stying in the strt stte q. Then when the chrcter α r is red, the firy god mother (nondeterministiclly) specifies tht the computtion should leve stte q nd trnsition to stte q. To follow this edge, this chrcter α r needs to e n. After reding i chrcters from y, i.e. i of the chrcters fter α r, the computtion will e in stte q i. In our input, there re r more chrcters fter α r, nmely those in y. Hence, the string will end t stte q r, which is the only ccept stte. (d) Give regulr expression R r representing this lnguge L r. The regulr expression is {,} {,} r. (e) Now focus on the NFA M R where the ccept stte is q R. Let M R denote the DFA otined y converting this NFA M R into DFA s descried in clss. But recll the process of converting. After reding string α, we put clone on ech stte of M R tht the computtion could e in, depending on which nondeterministic steps the computtion took. Let Q [q,q,...,q R ] e n ritrry suset of these sttes. Descrie string denoted α Q such tht fter reding it there is clone on stte q nd one ech of the sttes specified in Q, ut on no other sttes. We explined ove how clone cn end up in stte q r if nd only if α r =. Hence, define α Q {,} to e the string such tht α r = if nd only if q r Q. It follows tht on this α Q, Q defines which sttes clone cn e on. Of course clone cn lwys lso e on the strt stte q. (f) How mny sttes do you think the resulting DFA M R would hve? It seems tht the DFA will hve different stte q Q for every set Q [q,q,...,q R ]. There re 2 R+ such sttes. (g) Let q Q denote the stte tht the resulting DFA M R is in when in the NFA M R there is clone on stte q nd one ech of the sttes specified in Q, ut on no other sttes. After reding the chrcter, which stte will M R e in? And fter reding n? Use Q = {5,8,2} s n exmple. Hint: Let Q+ denote the set where ech stte in Q is incremented y one, i.e. Q+ = {6,9,22}. After one time step, ech clone on stte in Q will move hed one step in the long pth in M R, i.e. this will put them in set of sttes denoted Q+. When reding, the clone on stte q will sty where it is. Hence the resulting stte in M R will e q Q+ = q {6,9,22}. When reding n, the clone on stte q will clone itself. The first clone sty where it is. The second clone will trnsition over to stte q. Hence the resulting stte in M R will e q {q} (Q+) = q {,6,9,22}. 8

9 (h) Now forget out the mchines M R nd M R nd let us focus on the lnguge L R. We will now set up the Bumping Lemm for this lnguge. Let S = {α Q Q [,,...,R]} e set of distinguished first nmes. Here string α Q is the string you defined in n erlier question. Recll the dversry chooses two different strings α Q nd α Q S. Your tsk is to find ζ {,} such tht L R (α Q ζ) L R (α Q ζ). Becuse the sets Q Q re different, there is some index r tht is in Q ut not in Q (or vis vers). The lnguge L R ccepts string if the chrcter tht hs R chrcters fter it is n. The numer of chrcters fter chrcter α r in α Q is r. Let ζ = R r so tht the numer of chrcters fter chrcter α r in α Q ζ is r +(R r) = R. Hence, the vlue of α r determines whether α Q ζ is in the lnguge or not. Becuse, r Q, the chrcter α r in α Q is n nd hence L R (α Q ζ) is true. Similrly, ecuse, r Q, the chrcter α r in α Q is not n nd hence L R (α Q ζ) is flse. (i) Wht does this distinguished set S nd the Bumping lemm tell us out the numer of sttes in ny DFA tht solves L R. The umping lemm sys tht if S is distinguished set for L R then no DFA cn solve L R with fewer thn S sttes. Here S = 2 R+. (j) Cn you mke ny conclusions from this? The NFA M R hs R+2 sttes nd ny DFA solving L R requires 2 R+ sttes. This proves tht there cn e n exponentil gp etween these two. Also the DFA M R uilt from the NFA M R hs the optiml numer of sttes. 9

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

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

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

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

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

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

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

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

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

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

Minimal DFA. minimal DFA for L starting from any other

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

More information

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

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

More information

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Lecture 09: Myhill-Nerode Theorem

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

More information

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

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

CHAPTER 1 Regular Languages. Contents

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

More information

CMSC 330: Organization of Programming Languages

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

More information

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

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

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

Bases for Vector Spaces

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

More information

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

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

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

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

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

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

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

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

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

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

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

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

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

input tape head moves current state

input tape head moves current state CPS 140 - Mthemticl Foundtions of CS Dr. Susn Rodger Section: Finite Automt (Ch. 2) (lecture notes) Things to do in clss tody (Jn. 13, 2004): ffl questions on homework 1 ffl finish chpter 1 ffl Red Chpter

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Quadratic Forms. Quadratic Forms

Quadratic Forms. Quadratic Forms Qudrtic Forms Recll the Simon & Blume excerpt from n erlier lecture which sid tht the min tsk of clculus is to pproximte nonliner functions with liner functions. It s ctully more ccurte to sy tht we pproximte

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

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

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

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A.

378 Relations Solutions for Chapter 16. Section 16.1 Exercises. 3. Let A = {0,1,2,3,4,5}. Write out the relation R that expresses on A. 378 Reltions 16.7 Solutions for Chpter 16 Section 16.1 Exercises 1. Let A = {0,1,2,3,4,5}. Write out the reltion R tht expresses > on A. Then illustrte it with digrm. 2 1 R = { (5,4),(5,3),(5,2),(5,1),(5,0),(4,3),(4,2),(4,1),

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

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

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

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

More information

1 Structural induction

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

More information

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

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

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