Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
|
|
- Felix Collins
- 5 years ago
- Views:
Transcription
1 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 Regulr Lnguges Prolem. Consider the following NFA A over {, }: strt s 0, s s 2 s 3 A is intended to recognise the lnguge L = {zα z {, }, α {} } of strings over the lphet {, } tht strt with either or, end with nd hve n ritrry numer of s etween the first nd the lst letter. (i) The following trnsition tle shows DFA A D tht is otined from A y the method of lzy suset construction: {s 0 } {s, s 2 } {s 2 } {s, s 2 } {s, s 2 } {s 3 } {s 2 } {s, s 2 } {s 3 } {s 3 } Assignment Automt, Lnguges, nd Computility
2 For the ske of convenience, let s define DFA A D tht is exctly like A D ut sttes re renmed. The following tle shows A D : The trnsition digrm of A D is s follows: q 4 q 4 q 4 q 0 q q 2 q q q 3 q 2 q q 3 q 3 q 4 q 4 strt q 0 q q 2 q, 3 q 4, (ii) The initil split differentites non-finl nd finl sttes: [ [ q 0, q, q 2, q 4 ], [ q 3 ] ] splits [ q 0, q, q 2, q 4 ]: [ [ q 0, q 4 ], [ q, q 2 ], [ q 3 ] ] (s well s ) splits [ q 0, q 4 ]: [ [ q 0 ], [ q 4 ], [ q, q 2 ], [ q 3 ] ] Neither nor splits the only remining non-singleton group [ q, q 2 ]. Every other group is singleton. Therefore, the lgorithm termintes. Sttes q nd q 2 re equivlent. (iii) A m is s follows Assignment Automt, Lnguges, nd Computility 2
3 strt q 0, q q, 3 q 4, (iv) Prove tht A m recognises L. Proof: We need to prove the following two sttements () for ll w, if δ (q 0, w) = q 3 then w L () for ll w, if w L then δ (q 0, w) = q 3 Ech of these sttements cn e reformulted s follows () for ll w, if δ (q 0, w) = q 3 then either w = α or w = α, where α {} () for ll α, if α {} then δ (q 0, α) = q 3 nd δ (q 0, α) = q 3 Below we prove ech of these sttements () w = 0 Hence, w = ɛ. δ (q 0, ɛ) = q 0. Stte q 0 is stte distinct from q 3, therefore the ntecedent of the conditionl sttement is flse. Therefore, the whole sttement is true. w = Hence, either w = or w =. In oth cses δ (q 0, w) = q. Stte q is stte distinct from q 3, therefore the ntecedent of the conditionl sttement is flse. Therefore, the whole sttement is true. w > Hence, w is of the form xαy, where x, y {, } nd α {, }. Assume δ (q 0, xαy) = q 3. By definition of δ the following holds δ (q 0, xαy) = δ (δ(q 0, x), αy) δ(q 0, x) is defined for x {, } s follows: δ(q 0, ) = q δ(q 0, ) = q Therefore, regrdless whether x is or, δ(q 0, x) = q. Hence, δ (q 0, xαy) = δ (q, αy) Assignment Automt, Lnguges, nd Computility 3
4 δ (q, αy) = δ(δ (q, α), y) = q 3 There is only one one-step trnsition tht leds to q 3. It is lelled. Therefore y must e nd δ (q, α) must e q. Consequently, it is sufficient to prove the following sttement: for ll α {, }, if δ (q, α) = q then α {} Lemm proves this sttement. () Assume α {}. We need to prove tht δ (q 0, α) = q 3 nd δ (q 0, α) = q 3. We consider δ (q 0, α) nd δ (q 0, α) seprtely: δ (q 0, α) = δ (δ(q 0, ), α) = δ (q, α) = δ(δ (q, α), ). δ (q 0, α) = δ (δ(q 0, ), α) = δ (q, α) = δ(δ (q, α), ). In oth cses we reched δ(δ (q, α), ). By Lemm 2, δ (q, α) = q. Therefore, δ(δ (q, α), ) = δ(q, ) = q 3 Lemm For ll β {, }, if δ (q, β) = q then β {} Proof: β = 0. β = ɛ nd β {}. β > 0. This mens tht β = xα where x {, } nd α {, }. We need to prove the following: if δ (q, xα) = q then xα {} Assume δ (q, xα) = q () By the definition of δ the following holds: δ (q, xα) = δ (δ(q, x), α) (2) For the ske of contrdiction ssume tht x =, then δ(q, x) = δ(q, ) = q 3. Then δ (q, xα) = δ (q 3, α) = q This mens tht from stte q 3 we rech stte q 3 fter reding α. But ll trnsitions from q 3 led to the sink stte q 4. Therefore δ (q 3, α) = q is impossile. We reched contrdiction. Therefore, x nd x cn only e equl to, since is the only remining symol of the lphet. Hence we cn rewrite δ (δ(q, x), α) in (2) s follows: δ (δ(q, ), α) Since δ(q, ) = q nd y ssumption () the following holds: δ (δ(q, ), α) = δ (q, α) = q The only one possile wy to rech q from q is trnsition δ(q, ) or sequence of them. Therefore α {}. Hence, xα {}. Assignment Automt, Lnguges, nd Computility 4
5 Lemm 2 For ll α {}, δ (q, α) = q Proof: Induction on the length of α. Bse cse: α = 0. δ (q, ɛ) = q Induction: α > 0. Induction hypothesis: δ (q, n ) = q, where n is string consisting of sequence of n s. We need to prove δ (q, n+ ) = q. δ (q, n+ ) = δ(δ (q, n ), ) By induction hypothesis δ (q, n ) = q, hence Prolem 2. Let L e the lnguge δ (q, n+ ) = δ(q, ) = q L = {w {0, } w {0} or w {} } Construct deterministic finite utomton tht ccepts ll strings tht re in L, nd rejects ll strings tht re not in L. 0 strt q 0 0 q q 3 0, 0 q 2 Prolem 4. Let L e the lnguge L = {w {0, } w hs in the third position from the right} Construct non-deterministic finite utomton tht ccepts ll strings tht re in L, nd rejects ll strings tht re not in L. 0, strt q 0 q 0, q 0, 2 q 3 Assignment Automt, Lnguges, nd Computility 5
6 Prolem 3. Let L e the lnguge L = {w {0, } ech lock of 5 consecutive symols contins t lest two 0 s} Construct deterministic finite utomton tht ccepts ll strings tht re in L, nd rejects ll strings tht re not in L. Explin in plin English the intuition ehind the constructed utomton. We first define non-miniml DFA A n tht recognizes L. The nme of stte conveys the informtion out the sequence of 0s nd s of the lst 4-symols lock tht the utomton hs processed. Thus, if the sequence of the lst four processed symols ws 000, the utomton is in stte nmed 000. Then δ(000, 0) = 000 nd δ(000, ) = 00. We define the only non-ccepting stte sink. Whenever the utomton is in stte nmed with sequence of four symols nd t lest three of these symols re s, the utomton goes to the rejecting stte sink on input. The only exception is the string, s discussed elow. Since the utomton hs to ccept ll strings of length smller thn 5, there re sttes for these strings. The only string contining four consecutive s tht is ccepted is the string of length 4. Stte is the ccepting stte corresponding to strings. If the first four s of string re followed y symol, the utomton performs trnsition to sink. The initil stte is nmed ɛ. It is the stte for the empty string. Thus the utomton is s follows: Assignment Automt, Lnguges, nd Computility 6
7 0 *ɛ 0 * * 0 * * * * 0 * * * * * * * * 0 * * * * * * * *0 0 sink * * * *0 00 sink * *0 00 sink *0 00 sink * sink sink sink sink sink A n cn e minimized. The equivlence clsses of sttes re s follows: [ɛ] [] [sink] [] [0] [0] [] [0] [0] [] [00, 000, 00, 0] [0, 00] [0, 00] [0, 00] [0, 00, 000, 00] [0, 00, 000, 00, 0000, 000, 000, 00] Among equivlent sttes, we keep the sttes tht re emphsized in old ove. This gives us the following miniml utomton A m : Assignment Automt, Lnguges, nd Computility 7
8 0 *ɛ 0000 * 00 * 00 * 0 * * * * * *0 0 sink * *0 00 sink *0 00 sink * sink * sink sink sink sink sink Here is A m s trnsition digrm: strt ɛ , sink 0, Assignment Automt, Lnguges, nd Computility 8
9 2 Grmmr Prolem 5. From the NFA A given in Prolem, derive right-liner grmmr using the lgorithm given in the lectures. The grmmr is s follows G = ({, }, {S 0, S, S 2, S 3 }, S 0, P ) where the set P consists of the following production rules S 0 S S 0 S 2 S 0 S 2 S S 2 S S 3 S 2 S S 2 S 2 S 2 S 3 S 3 ɛ Prolem 2.6. Consider the grmmr G = ({S, T }, {0, }, S, P ), where P consists of the following productions S 0S T 0 T T Show tht no string in the lnguge L(G) contins the sustring 0. Proof: Let α e sententil form derived using G. We show y induction on the length n of the derivtion of α tht α does not contin ny of the sustrings 0, S, S0, SS, T 0 or T S. Bse cse: n=. The possile derivtions of length of sententil forms for G re S 0S, S T, nd S 0. Neither 0S, nor T, nor 0 contin 0, S, S0, SS, T 0 or T S s sustring. Inductive cse: Let S α β e derivtion of β of length n +. By inductive hypothesis, α does not contin 0, S, S0, SS, T 0 or T S s sustring. If the lst derivtion step uses S 0S, since α does not contin S, SS or T S, the derivtion step cnnot introduce 0, S0 or T 0 in β. If the lst derivtion step uses S T, since α does not contin S0 or SS, the derivtion step cnnot introduce T 0 or T S in β. If the lst derivtion step uses S 0, since α does not contin S, SS or T S, the derivtion step cnnot introduce 0, S0 or T 0 in β. If the lst derivtion step uses T T, since α does not contin T 0 or T S, the derivtion step cnnot introduce T 0 or T S in β. If the lst derivtion step uses T, since α does not contin T 0 or T S, the derivtion step cnnot introduce 0 or S in β. Assignment Automt, Lnguges, nd Computility 9
10 3 Context Free Lnguges nd Pushdown Automt Prolem 3.6. Show tht the lnguge {uw u, w {, }, with u = w } is context free y exhiiting context free grmmr tht genertes it. A CFG grmmr tht genertes this lnguge is G = ({, }, {S, T, X}, S, P ), where P consists of the following productions: S T T XT X X Prolem 7. Consider the context-free grmmr G = ({S, A, B}, {,, c}, P, S), where P consists of the following productions S A A BA B S cs Construct PDA M tht ccepts L(G) y empty stck. Drw the prse three of G for the string, nd show the corresponding execution trce for M. The prse tree for the string : A A A S S B M = ({q 0, q, q 2 }, q 0, {q 2 }, {,, c}, {,, c, S, A, B, Z}, Z, δ) with δ defined s follows: δ(q 0, ɛ, Z) = {(q, SZ)} δ(q, ɛ, S) = {(q, A)} δ(q, ɛ, A) = {(q, BA), (q, )} δ(q, ɛ, B) = {(q, S), (q, cs)} δ(q,, ) = {(q, ɛ)} δ(q,, ) = {(q, ɛ)} δ(q, c, c) = {(q, ɛ)} δ(q, ɛ, Z) = {(q 2, ɛ)} Assignment Automt, Lnguges, nd Computility 0
11 The execution trce of M for the string is s follows: (q 0,, Z) (q,, SZ) (q,, AZ) (q,, AZ) (q,, BAZ) (q,, SAZ) (q,, SAZ) (q,, AAZ) (q,, AAZ) (q,, AZ) (q,, AZ) (q,, Z) (q, ɛ, Z) (q 2, ɛ, ɛ) 4 OPTIONAL: Turing Mchine nd Computility Prolem 8. Design 2-tpe Turing mchine ccepting the lnguge of ll strings over {0, } tht hve n equl numer of 0 s nd s. The first tpe contins the input, nd is scnned from left to right. The second tpe is used to keep trck of the difference etween the numer of 0 s nd s in the prt of the input seen so fr. M = ({q 0, q, q 2 }, q 0, {q 2 }, {Λ, 0,, #}, {0, }, Λ, δ) The mchine strts in stte q 0. If the input string is empty, it goes directly to ccepting stte q 2. If the input string is non-empty, the mchine writes # on the second tpe nd goes to stte q. for ech 0 on tpe, the mchine moves left on tpe 2 for ech on tpe, the mchine moves right on tpe 2 If fter the whole word is scnned on tpe, the hed of tpe 2 is on symol #, the mchine ccepts y going to ccepting stte q 2 ; otherwise it rejects. δ(q 0, [Λ, Λ]) = (q 2, (Λ, R), (Λ, R)) δ(q 0, [0, Λ]) = (q, (0, R), (#, L)) δ(q 0, [, Λ]) = (q, (, R), (#, R)) δ(q, [0, Λ]) = (q, (0, R), (Λ, L)) δ(q, [, Λ]) = (q, (, R), (Λ, R)) δ(q, [0, #]) = (q, (0, R), (#, L)) δ(q, [, #]) = (q, (, R), (#, R)) δ(q, [Λ, #]) = (q 2, (Λ, R), (#, R)) Prolem 9. For TM M, let E(M) denote the encoding of M. Consider the lnguge L = {E(M) M, when strted on lnk tpe eventully writes somewhere on the tpe}. (i) Show tht L is recursively enumerle. Assignment Automt, Lnguges, nd Computility
12 (ii) Show tht L is not recursive. Let s use nottion M from the lectures for E(M). (i) We cn construct TM M L tht recognizes L s follows. M L first trnsforms its input M to M, ɛ. M L simultes universl TM U except the following cses: s soon s U writes on the tpe, M L moves to n ccepting stte if U hlts in n ccepting stte, M L hlts in non-ccepting stte (ii) L lnkhlt = { M lnkhlt M lnkhlt (ɛ) hlts} is hlting lnguge. It is the lnguge of encodings of TMs tht hlt on the lnk tpe. L lnkhlt is not recursive (s ws proven on lectures). We show how to reduce L lnkhlt to L. Assume there is decider D such tht D( M ) hlts in n ccepting stte if nd only if M L nd otherwise hlts in non-ccepting stte. We show tht using D we cn construct D lnkhlt such tht D lnkhlt ( M lnkhlt ) hlts in n ccepting stte if nd only if M lnkhlt L lnkhlt nd otherwise hlts in non-ccepting stte. We define converter R such tht for ll mchines M lnkhlt such tht M lnkhlt L lnkhlt, it returns mchine M such tht M L. R constructs M from M lnkhlt in the following wy: All occurences of symol in the trnsitions of M lnkhlt (red nd written) re replced in M with #, where # is new symol not occuring in the tpe lphet of M. The finl sttes of M lnkhlt re not finl in M. Insted, for ech finl stte q f of M lnkhlt, for every tpe symol x, R dds trnsition δ(q f, x) = (q f,, R) to M. For ech stte q nd tpe symol x for which δ(q, x) is undefined in M lnkhlt (i.e. M lnkhlt hlts on x), R dds trnsition δ(q, x) = (q f,, R) to M. M lnkhlt eventully hlts when strted on lnk tpe if nd only if M = R(M lnkhlt ) eventully writes somewhere on the tpe. Then we cn tke D lnkhlt = D( R(M lnkhlt ) ). We know such decider does not exists ecuse L lnkhlt is not recursive. Assignment Automt, Lnguges, nd Computility 2
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 informationHarvard 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 informationFormal 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 informationTalen 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 informationMinimal 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 informationCS 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 informationWorked 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 informationNondeterminism 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 informationFirst 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 informationThe 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 informationHomework 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 informationConvert 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 informationCMPSCI 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 information1. 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 informationTheory 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 informationFormal 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 informationGrammar. 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 informationFinite 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 informationFinite 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 informationCS 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 informationAUTOMATA 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 informationTheory 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 informationLecture 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 informationDeterministic 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 informationNon-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 information1.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 informationChapter 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 informationSection: 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 informationSome 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 informationRegular 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 informationNon-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 informationCS 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 informationCS 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 information5. (±±) Λ = 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 informationRevision 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 informationCS375: 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 informationCS 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 informationHomework 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 informationFinite-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 informationThe University of Nottingham
The University of Nottinghm SCHOOL OF COMPUTR SCINC AND INFORMATION TCHNOLOGY A LVL 1 MODUL, SPRING SMSTR 2004-2005 MACHINS AND THIR LANGUAGS Time llowed TWO hours Cndidtes must NOT strt writing their
More informationDesigning 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 informationJava II Finite Automata I
Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression
More informationCSE : 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 informationCHAPTER 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 informationCSC 311 Theory of Computation
CSC 11 Theory of Computtion Tutoril on DFAs, NFAs, regulr expressions, regulr grmmr, closure of regulr lnguges, context-free grmmrs, non-deterministic push-down utomt, Turing mchines,etc. Tutoril 2 Second
More informationExercises 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 information1 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 informationConverting 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 informationCS 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 informationLanguages & 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 informationGNFA 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 informationCS 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 informationCS: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 informationCSCI 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 informationLecture 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 informationRegular 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 informationNon-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 informationCS103B 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 informationCMSC 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 informationCS 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 informationCHAPTER 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 informationLet'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 informationFABER 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 informationThoery 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 informationIntermediate 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 informationName 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 informationCS 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 informationCS 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 informationFinite 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 informationNFAs 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 information3 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 informationNFA 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 informationNon 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 informationCSC 473 Automata, Grammars & Languages 11/9/10
CSC 473 utomt, Grmmrs & Lnguges 11/9/10 utomt, Grmmrs nd Lnguges Discourse 06 Decidbility nd Undecidbility Decidble Problems for Regulr Lnguges Theorem 4.1: (embership/cceptnce Prob. for DFs) = {, w is
More information1.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 informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, section 003, George Mson University, Fll 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Septemer 7 1. Prove (p q) (p q), () (5pts) using truth tles. p q
More informationLexical Analysis Finite Automate
Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition
More informationCS375: Logic and Theory of Computing
CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks
More informationThe 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 information1 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 informationCompiler 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 informationChapter 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 informationTable 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 informationTypes 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 informationCS415 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 informationTypes 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 information1. 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 information12.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 informationContext-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 informationNormal Forms for Context-free Grammars
Norml Forms for Context-free Grmmrs 1 Linz 6th, Section 6.2 wo Importnt Norml Forms, pges 171--178 2 Chomsky Norml Form All productions hve form: A BC nd A vrile vrile terminl 3 Exmples: S AS S AS S S
More informationCoalgebra, 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 informationState 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 informationFinite 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 informationClosure 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 informationPART 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 information12.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 informationIn-depth introduction to main models, concepts of theory of computation:
CMPSCI601: Introduction Lecture 1 In-depth introduction to min models, concepts of theory of computtion: Computility: wht cn e computed in principle Logic: how cn we express our requirements Complexity:
More informationI. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines
CI 3104 /Winter 2011: Introduction to Forml Lnguges Chter 13: Grmmticl Formt Chter 13: Grmmticl Formt I. Theory of Automt II. Theory of Forml Lnguges III. Theory of Turing Mchines Dr. Neji Zgui CI3104-W11
More informationFormal 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 informationMyhill-Nerode Theorem
Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute
More information