The University of Nottingham

Size: px
Start display at page:

Download "The University of Nottingham"

Transcription

1 The University of Nottinghm SCHOOL OF COMPUTR SCINC AND INFORMATION TCHNOLOGY A LVL 1 MODUL, SPRING SMSTR MACHINS AND THIR LANGUAGS Time llowed TWO hours Cndidtes must NOT strt writing their nswers until told to do so Answer QUSTION ON nd ny THR other questions Mrks ville for sections of questions re shown in rckets in the right-hnd mrgin. No clcultors re permitted in this exmintion. Dictionries re not llowed with one exception. Those whose first lnguge is not nglish my use dictionry to trnslte etween tht lnguge nd nglish provided tht neither lnguge is the suject of this exmintion. No electronic devices cple of storing nd retrieving text, including electronic dictionries, my e used. DO NOT turn exmintion pper over until instructed to do so Turn Over

2 2 Question 1 (Compulsory) The following questions re multiple choice. There is t lest one correct choice ut there my e severl. To get ll the mrks you hve to list ll the correct nswers nd none of the wrong ones. Note: The nswers elow provide some explntions, minly for the incorrect lterntives. This is just for clrifiction. The nswer should just e list of lterntives. () Which of the following sttements re correct? (i) An lphet is finite set of symols. (ii) A word is possily infinite sequence of symols over given lphet. (iii) A lnguge is the set of ll possile words over given lphet. (iv) A regulr lnguge is lwys finite. (v) A finite lnguge is lwys regulr. Correct: i, v Incorrect: ii A word must e finite. iii A lnguge is suset of the possile words. iv Σ is n exmple of n infinite regulr lnguge for ny nonempty lphet Σ. () Which of the following sttements re correct? (i) The empty word ɛ elongs to ll lnguges. (ii) The empty word ɛ is the only word in the empty lnguge. (iii) ɛ {} (iv) ɛ (v) If L is lnguge contining t lest one non-empty word, then L is n infinite lnguge. Correct: iii, iv, v Incorrect: i A lnguge is n ritrry suset of the possile words over given lphet. This my or my not include the empty word. ii The empty lnguge contins no words, not even the empty one. (5) (5)

3 3 (c) Consider the following finite utomton A over Σ = {, }: Which of the following sttements out A re correct? (i) The utomton A is Deterministic Finite Automton (DFA). (ii) ɛ L(A) (iii) L(A) (iv) All words ccepted y A contin eqully mny s nd s. (v) The utomton A ccepts ll non-empty words over Σ tht contin eqully mny s nd s. (5) Correct: iii, iv Incorrect: i NFA since the trnsition function is not totl for the sttes 1 nd 2. ii Stte 0 is not n ccepting stte (nd there is no wy to get to n ccepting stte on the empty input). v No, it does not ccept, for exmple. (The utomton ccepts ( + )( + ).) (d) Consider the following set W of words: W = {ɛ,, c, } Which of the following regulr expressions denote lnguge tht contins ll words in W? (But not necessrily only the words in W : it is OK if the lnguge denoted y the regulr expression contins more words.) (i) (ɛ + + c)(ɛ + ) (ii) (ɛ + + c)( + ) (iii) (ɛ + + c) (iv) ( + c) (v) ( + c) (vi) () + c Turn Over

4 4 Correct: i, iii, iv Incorrect: (5) ii The empty word ɛ is not in the lnguge. To see this, recll tht conctention with the empty lnguge yields the empty lnguge nd simplify: (ɛ + + c)( + ) = (ɛ + + c) + (ɛ + + c) = (ɛ + + c) = + c + v Conctention with the empty lnguge yields the empty lnguge, thus the r.e. cn e simplified s follows: ( + c) = ( + c) = c vi The word c is not in the lnguge. (Six rther thn five lterntives is intentionl.) (e) Consider the following Context-Free Grmmr (CFG) G: S X Y C X Xc B Y Y ɛ B B ɛ C cc ɛ S, X, Y, B, C re nonterminl symols, S is the strt symol, nd,, c re terminl symols. Which of the following sttements out the lnguge L(G) generted y G re correct? (i) cc L(G) (ii) { i j c k (iii) { i i c j (iv) { i i c i i, j, k N} L(G) i, j N} L(G) i N} L(G) (v) L(G) = { i i c i i N} The lnguge denoted y the CFG is (5) Thus, correct: i, iii, iv Incorrect: L(G) = { i j c i } { i i c j }

5 5 Question 2 ii.g. ccc is not in L(G). v.g. ccc is in L(G). () Given the following NFA N over the lphet Σ = {,, c}, construct DFA D(N) tht ccepts the sme lnguge s N y pplying the suset construction:,, c,, c To sve work, consider only the rechle prt of D(N). Clerly show your clcultions, e.g. in stte-trnsition tle. Do not forget to indicte the initil stte nd the finl sttes of the resulting DFA D(N). (12) The DFA sttes re sets of NFA sttes. Any DFA stte contining n ccepting NFA stte is ccepting. mrks n initil stte, finl one. δ D(N) c {0} = X {0, 1} {0} {0} {0, 1} = Y {0, 1} {0, 2} {0} {0, 2} = Z {0, 1, 3} {0, 3} {0, 3} {0, 1, 3} = U {0, 1} {0, 2} {0} {0, 3} = V {0, 1} {0} {0} Now we cn drw the trnsition digrm: U c, c X Y Z c, c, c V Turn Over

6 6 () Construct finite utomton (DFA or NFA) tht ccepts the lnguge of correct inry (se 2) dditions (nd no other strings) ccording to the following. We consider ddition of two inry numers of equl ut ritrry length. For exmple: We represent n ddition y the string of inry digits (0 or 1) otined y reding the digits top-down, column y column, from left to right. The exmple ove is thus represented y the string We ssume tht the summnds hve een pdded with 0 s to the left to mke them s long s the result, if necessry. For exmple, the ddition is represented y the string To simplify the prolem slightly, the empty string ɛ is considered representing correct inry ddition (two zero-length summnds yield zero-length result). (13) Key ide: When we encounter digit from the sum, it will e cler whether or not the ddition in the next column must result in crry if the ddition is to e correct. If not, we just go ck to the strt stte (which is ccepting). Otherwise, we go to n expect crry stte which is like the strt stte, except tht it is not ccepting nd tht wht constitutes correct sequence of digits is djusted to reflect the expected crry. The following trnsition digrm represents 10-stte NFA tht implements this ide. A is the initil nd only ccepting stte. F is the expect crry stte.

7 7 0 0 B 1 G A D F I C 1 H 0 J 1 Question 3 () Clssify the following lnguges s regulr, context-free, or neither. Justify your nswer y providing, where possile nd resonle, regulr expression or context-free grmmr denoting the lnguge in question. Otherwise justify y giving short (informl ut convincing) rgument. (i) All words over Σ = {,, c} in which every is immeditely followed y. (ii) All words over Σ = {,, c} in which every is eventully followed y. (iii) { i i c j d j i, j N} (iv) { i j c i d j i, j N} (v) All legl sequences of moves in the gme of Chess. (i) Regulr: ( + + c) (ii) Regulr: (( + c) + + c) (iii) Context free: S AB A A ɛ B cbd ɛ (10) Turn Over

8 8 (iv) Not context free (nd thus not regulr). A production for gurnteeing the lnce etween the s nd the c s will necessrily look something like A Ac B. But once the B is reched, there is no wy to enforce tht the numer of s mtches the numer of d s tht follow the string derived from A. The sitution is similr if one sets out to initilly mintin the lnce etween the s nd the d s. Another rgument: PDA hs only one stck nd thus cnnot count two different things simultneously nd independently. (v) Regulr since the numer of chess sttes (wys of plcing pieces on the ord) is finite nd since the legl moves is uniquely determined y the current stte. () Systemticlly construct n NFA ccepting the lnguge denoted y the following regulr expression y following the grphicl construction descried in the lectures/lecture notes: The lphet is Σ = {,, c, d}. ( + ) (c + d) Your nswer should clerly show wht you re doing. In prticulr, in ddition to the finl NFA, the nswer should include t lest two intermedite stges of the construction. However, sttes only hve to e nmed in the finl NFA. Also, feel free to tidy up the finl NFA y removing ded ends, ut e sure to explin wht you re doing. (5) Work structurlly, from the smllest constituent suexpressions towrds to overll regulr expression. Since they re simple enough, we strt with NFAs for ( + ): q 1 q 3 q 2 q 4 nd (c + d): q 5 c q 7 q 6 d q 8

9 9 Then form n NFA for ( + ) : q 1 q 3 q 2 q 4 q 9 Conctente the NFAs for ( + ) nd (c + d), keeping in mind tht there is strt stte tht is lso finl in the first NFA (since ɛ elong to the lnguge), mening tht the initil sttes of the second NFA re kept s initil sttes. Don t forget to chnge the ccepting sttes of first the NFA to non-ccepting ones: q 1 q 2 q 3 q 4 q 5 q 6 c d q 7 q 8 q 9 Finlly, remove ded ends : Turn Over

10 10 q 1 q 2 q 5 q 6 c d q 7 q 8 (c) Use the Pumping Lemm for regulr lnguges to show tht the following lnguge is not regulr: { i j c k i, j, k N, k = min(i, j)} (10) Cll the given lnguge L. Assume it is regulr. Then, ccording to the pumping lemm for regulr expressions, there is constnt n such tht ny string w L which hs length t lest n ( w n) cn e divided into three prts w = xyz s follows: 1. xy n 2. y > 0 3. xy i z L for ny nturl numer i Consider string w = n n c n. As min(n, n) = n, we clerly hve w L. Moreover, the length of w is w = 3n n. The pumping lemm for regulr lnguges therefore pplies, nd our w, s ny sufficiently long string in the lnguge, cn e divided into three prts w = xyz ccordingly. Since xy n, it must e the cse tht y = k for 0 < k n due to the wy w ws chosen nd condition 2 on the division into prts. Now, consider condition 3. It should hold for ny i. Pick i = 0 for exmple. xy 0 z = (n k) n c n. Since k > 0, n k < n. Therefore min(n k, n) = n k < n. But the string xy 0 z hs n c s. Tht is too mny, nd thus it cnnot elong to L. We hve contrdiction, nd thus our initil ssumption tht L is regulr must e wrong. Thus L is not regulr, QD. Question 4

11 11 () The following is context-free grmmr (CFG) for Boolen expressions: () t f is nonterminl nd the strt symol,,,, (, ), t, nd f re terminls. Show tht this grmmr is miguous. (5) A CFG is miguous if t lest one word in the descried lnguge hs more thn one prse tree. To show tht grmmr is miguous pick word in the lnguge tht hs two prse trees nd show these two trees. For the given lnguge, t t t is word tht hs two prse trees: t t t t t t An equivlent wy is to show tht the word in question either hs two leftmost derivtions or two rightmost derivtions. It is NOT enough to just show two different derivtions, s merely permuting the order in which non-terminls re expnded does not ffect the structure of the corresponding prse tree. Here re two different leftmost derivtions. The first one, corresponding to the first tree: t t t t t t Turn Over

12 12 The second one, corresponding to the second tree: t t t t t t t () Construct n unmiguous version of the context-free grmmr for Boolen expressions given ove y mking it reflect the following opertor precedence conventions: hs the highest precedence hs the next highest precedence hs the lowest precedence For exmple, t f t should e interpreted s t (( f) t). As long s the grmmr is unmiguous, you cn choose whether or not to ccept expressions tht would need conventions out opertor ssocitivity to dismigute them, like t t t. (10) Here is version tht ssumes tht the inry opertors re nonssocitive. (Thus the lnguge ccepted is not quite the sme s for the miguous grmmr. But tht s OK ccording to the prolem sttement.) ( ) t f The prolem does not stte whether using mny logicl negtions immeditely fter one nother should e OK or not (e.g. t). The ove grmmr does llow tht. The following grmmr does not: ( ) t f The grmmr is unmiguous either wy, so oth versions re fine.

13 13 (c) Drw the derivtion trees ccording to your unmiguous grmmr for the following two expressions: (i) t f (ii) (f t) f t Prse trees ccording to the first grmmr ove. Prse tree for t f: (5) f t Prse tree for (f t) f t: ( ) 2 t 1 1 f 2 2 f t (d) The inry opertors nd cn e considered to e: left-ssocitive; i.e. n expression like t t t would e interpreted s (t t) t right-ssocitive; i.e. n expression like t t t would e interpreted s t (t t) non-ssocitive; i.e. ruling out expressions like t t t Turn Over

14 14 xplin wht is the cse for your grmmr nd why, nd how to chnge your grmmr for the other possiilities. (5) Left-ssocitive: mke the productions for the inry opertors left recursive: Right-ssocitive: mke the productions for the inry opertors right recursive: Non-ssocitive: do not mke the productions for the inry opertors directly recursive, s in the originl grmmr. Question 5 Consider the following Pushdown Automton (PDA) P : P = (Q = {q 0, q 1 }, Σ = {,, c}, Γ = {, #}, δ, q 0, Z 0 = #, F = {q 1 }) where the trnsition function δ is given y Acceptnce is y finl stte. δ(q 0,, #) = {(q 0, #)} δ(q 0, c, #) = {(q 0, #)} δ(q 0,, ) = {(q 0, )} δ(q 0,, ) = {(q 0, ɛ)} δ(q 0, c, ) = {(q 0, )} δ(q 0, ɛ, #) = {(q 1, #)} δ(q, w, z) = everywhere else () Which of the following words re ccepted y the PDA P? (i) cc (ii) ccc (iii) ɛ For those words tht re ccepted, provide sequence of Instntneous Descriptions (IDs) leding to n ccepting configurtion s evidence. For those words tht re not ccepted, explin why there is no sequence of IDs leding to n ccepting configurtion. (12)

15 15 (i) The word cc is ccepted. ID sequence: (q 0, cc, #) (q0, cc, #) (q0, c, #) (q0, c, #) (q0, c, #) (q0, c, #) (q0, ɛ, #) (q1, ɛ, #) The word is ccepted ecuse q 1 is n ccepting stte nd since ll input hs een red. (Mrking: 5 points.) (ii) The word ccc is not ccepted. On seeing c in stte q 0 with # on top of the stck, there re two possiilities. The PDA cn either red nd discrd the c, stying in q 0, or it cn move to q 1 without reding the c. We oserve tht the mchine gets stuck s soon s stte q 1 is reched. Thus, if we wnt to ccept string strting with c, the first trnsition must e to red nd discrd tht c: (q 0, ccc, #) (q 0, cc, #) We re now in stte q 0, reding, with # on top of the stck. The only possiility here is to move to q 1 without reding ny input: (q 1, cc, #) But this is stuck configurtion! And since ll input hs not een red, it is not n ccepting configurtion. Thus there re no sequences of IDs leding to n ccepting configurtion. (Mrking: 5 points.) (iii) The word ɛ is ccepted: (q 0, ɛ, #) (q 1, ɛ, #) This is n ccepting configurtion since q 1 is n ccepting stte nd since ll input (none!) hs een red. (Mrking: 2 points.) () Descrie the lnguge ccepted y P in nglish in one sentence. (5) Strings over Σ = {,, c} where cts s n opening prenthesis, s closing prenthesis, nd prentheses hs to e lnced in the usul fshion. Turn Over

16 16 (c) xplin how to modify P to mke it ccept y empty stck insted of ccepting y finl stte (without chnging the ccepted lnguge). (2) One possiility is to replce the eqution with or even (getting rid of one stte). δ(q 0, ɛ, #) = δ(q 1, #) δ(q 0, ɛ, #) = δ(q 1, ɛ) δ(q 0, ɛ, #) = δ(q 0, ɛ) ither wy, this gives the PDA the possiility to completely empty the stck when it is in stte where the prentheses seen so fr hs lnced out. If the PDA mkes tht move in stte where ll input hs een red it will enter n ccepting configurtion (nd lock), just s the given PDA does when entering stte q 1. (d) Wht does it men for PDA to e deterministic? Stte the forml condition nd explin wht it mens. Is P deterministic? Justify your nswer! (6) Tht the PDA never hs ny choice. Formlly: for ll q Q, x Σ, nd z Γ. δ(q, x, z) + δ(q, ɛ, z) 1 P is not deterministic s it hs choice in stte q 0 when # is the top stck symol for input symols nd c. Formlly, we hve e.g. δ(q 0,, #) + δ(q 0, ɛ, #) = = 2 which is not less thn or equl to 1. Question 6 () Wht is Turing Mchine (TM)? Your ccount does not hve to e forml, ut it should e comprehensive nd clerly outline the centrl ides. (5) A Turing Mchine is mthemticl model of generl computer. It consists of finite control plus n infinite tpe for storge of the input, the output, nd ny other dt needed during computtion. The tpe is divided into cells, ech cell is cple of storing one symol. A red/write hed scns one cell of the tpe, nd depending on the symol in tht cell nd the stte of the finite control, the TM updtes the scnned symol with new symol (possily the sme s efore), moves the hed one step left or right, nd chnges stte.

17 17 () Outline strtegy for constructing TM tht ccepts the lnguge { m n c m d n m, n N} If n is eing red, overwrite it with mrking symol not in the input lphet, sy X, move to the right until corresponding c is found, ut only moving cross first s, then s, then X s if ny, mrk tht s well, nd then move left until we find the first remining, nd repet. If t ny point c cnnot e found, stop in non-ccepting stte. If there ws no to egin with, or once there re no remining s, we do s ove for nd d. If the mchine hs reched stte where the lst remining nd hs een mtched with corresponding c or d, the TM is in stte where it is scnning left for remining or. But insted of finding one, it is going to encounter lnk symol to the left of the portion of the tpe where the input initilly ws written. At this point, the mchine strts scnning right. If it only reds X s efore the first lnk symol to the right of the portion of the tpe where the input ws stored is found, the TM moves to n ccepting stte nd stops. Otherwise it stops in non-ccepting stte. (c) xplin nd relte the following terms in the context of Turing Mchines: recursive, recursively-enumerle, decidle, undecidle. (5) A recursive lnguge is lnguge tht is ccepted y Turing Mchine tht lwys hlts. This is the sme s sying tht the lnguge is decidle (or tht the prolem represented y the lnguge is decidle). A recursively enumerle lnguge is lnguge tht is ccepted y Turing Mchine tht does not necessrily hlt for input not elonging to the lnguge. A lnguge tht is not recursive is undecidle. The undecidle lnguges thus includes the recursively enumerle (or semi-decidle) lnguges nd those lnguges which re not even recursively-enumerle. (5) (d) Wht is the Church-Turing thesis? Give rief explntion. (5) The unproven ssumption tht ny resonle notion of wht computtion mens is equivlent to wht Turing mchine cn compute. (e) One could rgue tht computer is relly finite stte utomton since ny computer only hs finite memory. Is this useful chrcteriztion? Provide good rgument for your position. (5) Turn Over

18 18 Arguing either wy is fine s long s the rgument is good! Here is my position: ven very modest rel computer hs fr too mny sttes for n FA chrcteriztion to provide ny useful model of its ehviour. If one does not ccept tht, then note tht it would e possile to design nd progrm computer in such wy tht it dynmiclly cn sk for more memory should the need rise (e.g. y mking dditionl storge resources ville over network). Then, given given some time, the computer would lwys hve s much memory s it needs, which for prcticl purposes is the sme s n unounded mount of memory. Agin, finite utomton is not useful chrcteriztion. (If one wnts to push the rgument, one could sy tht the resources on the rth re limited, nd thus it is conceivle tht progrm might need more memory thn ctully could e constructed using the resources ville on the rth. But nothing in principle stops us from moving eyond the rth. So ultimtely wht is going to set the limit is wht we re prepred/cn fford to do to extend the memory, nd for how long we cn wit for the finl nswer, not tht it is theoreticlly impossile to extend the memory.) nd

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

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

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

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

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

More information

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

More information

Lecture 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

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

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

More information

CMSC 330: Organization of Programming Languages

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

More information

1 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

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

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

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

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

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

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

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

Tutorial Automata and formal Languages

Tutorial Automata and formal Languages Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we

More information

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

Worked out examples Finite Automata

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

More information

CS 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

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

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

p-adic Egyptian Fractions

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

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

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

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

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

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

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

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

More information

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

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

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

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

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

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

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

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata CSC4510 AUTOMATA 5.1 Definitions nd Exmples 5.2 Deterministic Pushdown Automt Definitions nd Exmples A lnguge cn be generted by CFG if nd only if it cn be ccepted by pushdown utomton. A pushdown utomton

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

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

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

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

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

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

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

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

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

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

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

Model Reduction of Finite State Machines by Contraction

Model Reduction of Finite State Machines by Contraction Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900

More information

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

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

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

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA RIGHT LINEAR LANGUAGES. Right Liner Grmmr: Rules of the form: A α B, A α A,B V N, α V T + Left Liner Grmmr: Rules of the form: A Bα, A α A,B V N, α V T

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

2.4 Linear Inequalities and Interval Notation

2.4 Linear Inequalities and Interval Notation .4 Liner Inequlities nd Intervl Nottion We wnt to solve equtions tht hve n inequlity symol insted of n equl sign. There re four inequlity symols tht we will look t: Less thn , Less thn or

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

CS 275 Automata and Formal Language Theory

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

More information

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language. Section: Other Models of Turing Mchines Definition: Two utomt re equivlent if they ccept the sme lnguge. Turing Mchines with Sty Option Modify δ, Theorem Clss of stndrd TM s is equivlent to clss of TM

More information

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3 2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is

More information