Decidability. Models of Computation 1

Size: px
Start display at page:

Download "Decidability. Models of Computation 1"

Transcription

1 Decidbility We investigte the power of lgorithms to solve problems. We demonstrte tht certin problems cn be solved lgorithmiclly nd others cnnot. Our objective is to explore the limits of lgorithmic solvbility. Models of Computtion 1

2 Encoding Turing Mchines s strings We cn encode Turing Mchines s strings over ny non-empty lphbet. E.g. if the string begins with the prefix 0 n 10 m 10 k 10 s 10 t 10 r 10 u 10 v this might indicte tht the mchine hs n sttes (0, 1,, n 1); it hs m tpe symbols (0, 1,,m 1), of which the first k re input symbols; the strt, ccept nd reject sttes re s, t nd r respectively, nd the endmrker nd blnk symbols re u nd v respectively. The reminder of the string cn consist of sequence of substrings specifying the trnsitions in δ. E.g. 0 p q 10 b 10might indicte tht δ contins the trnsition ((p, ), (q, b, L)). The exct detils re unimportnt. Models of Computtion 2

3 There re lnguges tht re not RE There re only countbly mny TMs. Observe tht Σ is countble, for ny lphbet Σ. Since M Σ for ech TM M,wecnenumertethesetofTMsbysimplyomittingthosestringsthtrenot encodings of TMs. The set of lnguges over Σ, P(Σ ),isuncountble. Suppose there were n enumertion of P(Σ ),nmely,l 1,L 2,L 3,.Let x 1,x 2,x 3, be n enumertion of Σ.DefinenewlngugeL by: for i 1 x i L x i L i Now L P(Σ ),butl is not equl to ny of the L i s. Thus P(Σ ) is not in 1-1 correspondence with the set of Turing mchines (there re more lnguges thn TMs). It follows tht there is some lnguge tht is not ccepted by ny TM. Models of Computtion 3

4 DFA Acceptnce Problem DFA Acceptnce Problem: GivenDFAB nd n input w, doesb ccept w? The corresponding lnguge is A DFA = { B,w : B is DFA tht ccepts input string w }. Lemm. A DFA is decidble lnguge. Proof. WeconstructTMM tht decides A DFA :Oninput B,w where B is DFA nd w n input 1. Simulte B on input w 2. If the simultion ends in n ccept stte, ccept. Ifitendsinnon-ccepting stte, reject. Convince yourself tht it follows tht A NFA nd A regexp (cceptnce problems for NFA nd regulr expressions respectively) re lso decidble. Models of Computtion 4

5 Emptiness Problem for DFA: Given DFA A, is L(A) empty? The corresponding lnguge is E DFA = { A : A is DFA such tht L(A) = } Lemm. E DFA is decidble lnguge. Proof. WedesignTMT tht uses mrking lgorithm. On input A where A is DFA: 1. Mrk the strt stte of A. 2. Repet until no new sttes get mrked: Mrk ny stte tht hs trnsition coming into it from ny mrked stte. 3. If no ccept stte is mrked, ccept; otherwisereject. Models of Computtion 5

6 Equivlence Problem for DFA: Given two DFAs, re they equivlent? The corresponding lnguge: EQ DFA = { A, B : A nd B re DFA s.t. L(A) =L(B) }. Lemm. EQ DFA is decidble lnguge. Proof. Keyide:ForsetsP nd Q, P Q iff P Q =. WeuseT,the lgorithm for the Emptiness Problem E DFA. On input A, B, wherea nd B re DFAs: 1. Construct C =(A B) (B A). (DFAsreclosedunderunion, intersection nd complementtion.) 2. Run T on input C. 3. If T ccepts, ccept; if T rejects, reject. Models of Computtion 6

7 Acceptnce problem for CFG Consider the lnguge: A CFG = { G, w : G is CFG tht genertes w } Lemm. A CFG is decidble lnguge. We use fct: If G is in Chomsky norml form, ny derivtion of w hs 2n 1 steps, where n is the length of w. Proof. TheTMS for A CFG is: On input G, w, whereg is CFG nd w is string: 1. Convert G to n equivlent one in Chomsky norml form. 2. List ll derivtions with 2n 1 steps, where n is the length of w. 3. If ny of these derivtions generte w, ccept;otherwise,reject. This is of course extremely inefficient, nd will not be used in prctice. Models of Computtion 7

8 Emptiness Problem for CFG: Given CFG G, isl(g) empty? Lemm. E CFG is decidble lnguge. Proof. TheTMR for E CFG is: On input G, whereg =(V,Σ,R,S) is CFG: 1. Mrk ll terminl symbols in G. 2. Repet until no new vribles get mrked: Mrk ny vrible A where G contins rule A U 1 U k nd ech symbol U i Σ V hs lredy been mrked. 3. If the strt symbol is not mrked, ccept; otherwise, reject. Models of Computtion 8

9 Equiv. Problem for CFG: Given two CFGs, re they equivlent? Obvious ttempt: Use the strtegy for deciding EQ DFA. Unfortuntely CFGs re neither closed under intersection nor complementtion! In fct EQ CFG is undecidble. Models of Computtion 9

10 Universl Turing Mchines A universl TM is TM U tht cn simulte the ctions of ny Turing mchine. I.e. for ny TM M nd ny input x of M, U ccepts (respectively rejects or loops on) M,x, ifndonlyif,m ccepts (respectively rejects or loops on) x. This is equivlent to n interpreter of C written in C. Note this is different (quntifier order) from results such s every NDTM cn be simulted by deterministic TM. Models of Computtion 10

11 Universl Turing Mchines Simultion. The tpe of U is prtitioned into 3 trcks: The top trck holds the trnsition function δ M of the input TM M. The middle trck will be used to hold the simulted contents of M s tpe. The bottom trck will hold the current stte of M,ndthecurrentpositionof M s tpe hed. U simultes M on input x one step t time, shuttling bck nd forth between the three trcks. In ech step, it updtes M s stte nd simulted tpe contents nd hed position s dictted by δ M.IfeverM hlts nd ccepts or hlts nd rejects, then U does the sme. Note: The input lphbet of M nd U my be different. Models of Computtion 11

12 A TM :AcceptnceProblemforTMs Acceptnce Problem for TM A TM = { M,w : M is TM tht ccepts input w } Theorem. A TM is RE. Proof. WedefineTMU tht ccepts A TM :Oninput M,w where M is TM nd w is string 1. Simulte M on inputw. 2. If M ever enters its ccept stte, ccept; if M ever enters its reject stte, reject. Note tht U loops on M,w if M loops on w. ThisiswhyU is not decider. If the lgorithm hd some wy to determine tht M ws not hlting on w, itcould reject. Models of Computtion 12

13 A TM :AcceptnceProblemforTMs Theorem. A TM is undecidble. Proof. Suppose,forcontrdiction,TMH is decider for A TM.I.e. H( M,w ) = ccept reject if M ccepts w if M does not ccept w We construct new TM D with H s subroutine. D: Oninput M, wherem is TM 1. Run H on input M, M 2. Output the opposite of H. I.e.ifH ccepts, reject, ndifh rejects, ccept. Models of Computtion 13

14 A TM is undecidble (proof cont d) Thus D( M ) = reject ccept if M ccepts M if M does not ccept M Now we run D on input D. Wehve reject D( D ) = ccept if D ccepts D if D does not ccept D I.e. D ccepts D iff D rejects D, whichiscontrdiction.thusneitherd nor H cn exist. To summrize, A TM is (RE but) undecidble. Models of Computtion 14

15 AlngugethtisnotRE We sy tht L is co-re if its complement L is RE. Theorem. AlngugeisdecidbleiffitisbothREndco-RE. Proof. Suppose L nd L re cceptble by M nd M respectively. Define TM N s follows: On input x 1. Write x on the input tpes of M nd M. 2. Run M nd M in prllel (e.g. by dove-tiling the two computtions). 3. If M ccepts, ccept; ifm ccepts, reject. N is decider for L becuse for ny input x, eitherx L or x L: ifthe former then N must ccept becuse M must hlt nd ccept t some point, if the ltter, then N must reject becuse M must hlt nd ccept t some point. Corollry. A TM is not RE. Models of Computtion 15

16 The Hlting Problem: Given M nd x, doesm hlt on x? HALT TM = { M,w : M is TM nd M hlts on input w } Theorem. TheHltingProblem,HALT TM,isundecidble. Proof. Suppose,forcontrdiction,H is decider for HALT TM.WeuseH to construct TM S to decide A TM s follows: On input M,w where M is TM nd w is n input: 1. Run TM H on input M,w 2. If H rejects, reject. 3. If H ccepts, run M on w until it hlts. 4. If M hs ccepted, ccept; ifm hs rejected, reject. Since A TM is undecidble, H cnnot be decider for HALT TM. Models of Computtion 16

17 The Emptiness Problem for TM is undecidble E TM = { M : M is TM nd L(M) = } Theorem. TheEmptinessProblemforTMisundecidble. Proof. Suppose,forcontrdiction,E TM is decidble by TM E. Weshlluse E to construct TM S tht decides A TM. Definition of S: On input M,x where M is TM nd x n input 1. Construct TM M x defined s: On input y () If y x then reject. (b) Run M (input is x) ndccept if M does. 2. Run E on input M x.ife ccepts, reject, ife rejects, ccept. Models of Computtion 17

18 The Emptiness Problem for TM is undecidble (proof cont d) Now we hve M ccepts x L(M x )={ x } i.e. S ccepts M,x M does not ccept x L(M x )= i.e. S rejects M,x Thus S decides A TM,whichiscontrdiction. Models of Computtion 18

19 The Equivlence Problem for TM is undecidble EQ TM = { M 1,M 2 : M 1 nd M 2 re TMs nd L(M 1 )=L(M 2 ) } Theorem. TheEquivlenceProblemforTMisundecidble. Proof. Suppose,forcontrdiction,EQ TM is decidble by Q. WedefineTM tht decides E TM by: On input M 1. Run Q on input M,M 1 where M 1 is TM tht ccepts nothing i.e. L(M 1 )=. 2. If Q ccepts, ccept; ifq rejects, reject. This gives contrdiction. Models of Computtion 19

20 Proving Undecidbilty We hve seen three min methods of proving undecidbility results: digonliztion, Turing reduction nd mny-one reduction. Digonliztion. E.g. A TM :ShowtheproblemcnnotbedecidblebycretingTMwhich cnnot exist without contrdiction. Advntge: Donotneedtoknowboutundecidbleproblems Disdvntge: Onlyworksesilyforsmllnumberofproblems:A TM, HALT TM,... Models of Computtion 20

21 Proving Undecidbility: Reductions Reductions trnsform one problem to nother in computble wy. If there is reduction from known undecidble problem to some problem P,thenP is lso undecidble. Reductions lso work lso for proving tht problem is or is not RE. Turing reduction. E.g. E TM :Cretenlgorithmforknownundecidbleproblemusingthe problem to be reduced to s subroutine. Advntge: Esywytoshowundecidbilitywithknownundecidbleproblems Disdvntge: Algorithmicpproch doesnotprovideinsightintony reltionship between the problems Models of Computtion 21

22 Proving Undecidbility: Reductions Mny-one reduction. E.g. EQ TM :LetA be decision problem over Σ A nd let B decisionproblem over Σ B.Amny-onereductioniscomputblefunctionf :Σ A Σ B such tht for ll w Σ A w A f(w) B Advntge: Trueproblemtrnsformtion givesreltionshipsusefulinother res (e.g. complexity) Disdvntge: StrongerthnTuringreduction,sohrdertofindreductions between problems Another method of proving tht problem is not RE uses the fct tht problem is decidble if nd only if the problem nd its complement re both RE. Models of Computtion 22

23 TOTAL = { M : M hlts on ll inputs} Theorem. TOTALisneitherREnorco-RE. Proof. HALT TM is not decidble, but it is RE. Hence HALT TM is not RE. Therefore it suffices to reduce HALT TM to (i) TOTAL nd to (ii) TOTAL. (i) Given M,x where M is TM nd x is n input, we set N M,x to be the following TM: On input y, 1. Run M on input x for up to y steps. 2. If M hs hlted, then loop; if M hs not yet hlted, ccept. We hve M,x HALT TM N M,x hlts on ll input y N M,x TOTAL. Models of Computtion 23

24 TOTAL is neither RE nor co-re. (proof cont d) (ii) Given M,x where M is TM nd x is n input, we construct N M,x to be the following TM: On input y, 1. Erse y. 2. Write x on input tpe, nd run M on x. 3. If M ccepts, ccept; ifm rejects, reject. Note tht either N M,x loops on ll inputs, or it hlts on ll inputs. Now M,x HALT TM N M,x loops on ll inputs N M,x / TOTAL. Models of Computtion 24

25 Rice s Theorem Rice s Theorem. Everynon-trivilpropertyoftheREsetsisundecidble. Reformultion Let P be ny decision problem bout TMs (expressed s lnguge) tht stisfies the following properties: (1) For ny TMs M 1 nd M 2 where L(M 1 )=L(M 2 ),wehve M 1 P iff M 2 P.I.e.themembershipofTMM in P depends only on the lnguge of M. (2) There re TMs M 1 nd M 2 where M 1 P nd M 2 P.I.e.P is non-trivil. Then P is undecidble. Models of Computtion 25

26 Proof of Rice s Theorem Tke property P tht stisfies (1) nd (2). Wlog, ssume tht for ny TM E, if L(E) = then E P.TkeTMK such tht K P.Given M,x where M is TM nd x is n input, we construct N M,x s follows: On input y 1. Sve y on seprte trck somewhere. 2. Write x on the input tpe, nd run M on input x. 3. If M hlts on x, runk on y. 4. If K ccepts, ccept. Either M hlts on x or not. If M does not hlt on x, thesimultionin3.willnothlt,ndtheinputy of N M,x will not be ccepted, nd so, L(N M,x )= i.e. N M,x P. On the other hnd, if M hlts on x, y is ccepted by N M,x iff y is ccepted by K i.e. L(N M,x )=L(K) i.e. N M,x P. Models of Computtion 26

27 Proof of Rice s Theorem (cont d) Thus M hlts on x L(N M,x )=L(K) N M,x P M does not ccept x L(N M,x )= N M,x / P Thus we hve reduced HALT TM to P.SinceHALT TM is undecidble, so is P. [Assume for contrdiction P ws decidble, sy by decider A, then we cn construct decider S for HALT TM s follows: on input M,x construct N M,x nd run A on N M,x.IfAccepts ccept, ifa rejects reject.] Models of Computtion 27

28 Appliction of Rice s Theorem For n rbitrry TM M with Σ={, b}, thefollowingproblemsreundecidble: whether M ccepts bb (i.e. bb L(M)) whether L(M) contins two different strings of the sme length; whether L(M) contins ny string of length five; whether L(M) is regulr lnguge; whether L(M) is context-free lnguge; Note The following properties of TMs re not properties of RE sets nd Rice s Theorem is not pplicble: M hs t lest 341 sttes; M hlts on ll inputs; M rejects bb there exists smller mchine equivlent to M. Models of Computtion 28

29 PCP: Post Correspondence Problem Apuzzle:Given collection of dominos such s e.g. P = {[ b c ], [ b ], [ c ] [ ]} bc, c find list of dominos from P (repetitions permitted) so tht the string we get by reding off the symbols on the top is the sme s the sting of symbols on the bottom. This list is clled mtch. E.g. the following is mtch tking dominos 2, 1, 3, 2 nd 4 in this order: [ ] [ ] [ ] [ ] [ ] b c bc,,,, b c b c (Reding off the top string we get bcbc, thesmesredingoffthebottom one.) Models of Computtion 29

30 AformlsttementofthePCP Instnce: AcollectionP of dominos: P = {[ t1 b 1 ], [ t2 b 2 ],, [ tk where k 1, ndllt i nd b j re strings over Σ. Question: Is there mtch for P?I.e.non-emptysequencei 1,,i l where ech 1 i j k nd b k ]} t i1 t i2 t il = b i1 b i2 b il Theorem. PCPisundecidble. Models of Computtion 30

31 Exmples 1. Let Σ={ 0, 1 }, nd P = {[ ] [ ] [ ]} ,, Here is mtch for P : 1, 1, 3, 2, i.e. [ ] [ ] [ ,, ], [ For some collection of dominos, finding mtch my not be possible. E.g. P = {[ bc b ], [ c ] [ ]} cc, bc (becuse every top string is longer thn the bottom string) ] Models of Computtion 31

32 Undecidbility of PCP: outline proof We modify PCP to MPCP = {P is n instnce of PCP with mtch tht strts with the first domino} 1. Suppose, for contrdiction, there is TM R tht decides the PCP. We use R to construct TM S tht decide A TM.Let M = (Q, Σ, Γ,,,δ,q 0,q cc,q rej ) Tke n input w for M.WeconstructninstnceP of the MPCP (over the lphbet Q Γ {}) thtsimultesm on w i.e. P MPCP M,w A TM. Models of Computtion 32

33 Ide. Writingconfigurtion(u i,q i,v i ) s u i q i v i,mtchofp gives string; the first prt q 0 wu 1 q 1 v 1 u 2 q 2 v 2 u i q i v i u n q cc v n corresponds exctly to n ccepting configurtion; the rest of the string q cc consists of progressively shorter segments of the form tht finlly ends in. 2. We convert P to P,ninstnceofPCP which still simultes M on w. Models of Computtion 33

34 Definition of P [ ] [ ] Prt 1. Put into P t1 s the first domino q 0 w 1 w n b 1 [ ] q Prt 2. For ech, b Γ, q, r Q, ifδ(q, ) =(r, b, R), put br [ ] cq Prt 3. For ech, b, c Γ, q, r Q, ifδ(q, ) =(r, b, L), put rcb [ ] Prt 4. For every Γ, put into P. [ ] [ ] Prt 5. Put nd into P. [ ] [ ] qcc qcc Prt 6. For every Γ, put nd into P. Prt 7. Add [ ] qcc to P. q cc q cc into P into P Models of Computtion 34

35 An exmple Consider the following TM M on input w = b M =({ q 0,q 3,q 4,q cc,q rej }, {, b, c }, Σ {, },,,δ,q 0,q cc,q rej ) }{{}}{{}}{{} Q Σ Γ where δ is prtly given by δ(q 0, ) = (q 0,,R) δ(q 0,) = (q 3,c,R) δ(q 3,b) = (q 4,,R) δ(q 4, ) = (q cc,,l) An ccepting computtion: (ϵ, q 0, b) (,q 0,b) ( c, q 3,b) ( c, q 4, ) ( c, q cc,b) Models of Computtion 35

36 An exmple (cont d) q 0 b prt 1 (ϵ, q 0, b) q 0 q 0 b q 0 δ(q 0, ) =(q 0,,R) prt 2 q 0 b (,q 0,b) q 0 b q 0 b prts Models of Computtion 36

37 An exmple (cont d) q 0 b q 0 b ( c, q 3,b) q 0 b q 0 b c q 3 b q 0 b q 0 b c q 3 b ( c, q 4, ) q 0 b q 0 b c q 3 b c q c q 3 b c q 4 ( c, q cc,b) c q 4 c q cc b Models of Computtion 37

38 An exmple (cont d) Tidying up. c q 4 c q cc b c q cc b q cc b cq cc b q cc b q cc b q cc b q cc q cc b q cc b q cc b q cc Models of Computtion 38

39 Converting MPCP instnce to PCP instnce Finlly we show how to convert P to n instnce of PCP which still simultes M on w. Theideistobuildtherequirementofstrtingwiththefirstdominodirectly into the problem. Nottion. Tkestringu = u 1 u n.define u = u 1 u 2 u n u = u 1 u 2 u n u = u 1 u 2 u n Models of Computtion 39

40 Converting MPCP instnce to PCP instnce (cont d) Suppose P is the MPCP instnce (over lphbet Θ) {[ t1 b 1 ], [ t2 b 2 ], [ t3 b 3 ],, [ tk b k ]} Now define P to be the PCP instnce (over lphbet Θ {, }) {[ ] [ ] [ ] [ ] [ ]} t1 t2 t3 tk,,,,, b 1 b 2 b 3 b k Note tht the only domino tht cn strt mtch is the first one, becuse it is the only one where both the top nd bottom strt with the sme symbol, nmely,. The originl symbols in Θ now occur in even positions of the mtch. The domino [ ] is to llow the top to dd the extr t the end of the mtch. Models of Computtion 40

41 Lnguge regulr context-free semi-decidble/re Grmmr right-liner context-free unrestricted rules A wb, A w A α α β Mchine DFA or NFA NPDA Turing mchine memory finite finite + one stck unrestricted Other Descr n Regulr expression Myhill-Nerode-Thm λ-clculus µ-recursive funct s RM, Hugs, Oberon,... Exmple { w : w contins 10 } { 0 n 1 m : n, m 0 } { ww R } { 0 n 1 n : n 0 } { 0 n 1 m 0 n m : n 0 } { Mx : M hlts on x } HP Counterexmple { 0 n 1 n : n 0 } { 0 n 1 n 0 n : n 0 } { ww} { M : M hlts on every x } TOTAL Appliction Tokenizer Prser Generl computing Model checker Models of Computtion 41

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

CSC 473 Automata, Grammars & Languages 11/9/10

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

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CSCI FOUNDATIONS OF COMPUTER SCIENCE 1 CSCI- 2200 FOUNDATIONS OF COMPUTER SCIENCE Spring 2015 My 7, 2015 2 Announcements Homework 9 is due now. Some finl exm review problems will be posted on the web site tody. These re prcqce problems not

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

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

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

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

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

Automata and Languages

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

More information

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

Recursively Enumerable and Recursive. Languages

Recursively Enumerable and Recursive. Languages Recursively Enumerble nd Recursive nguges 1 Recll Definition (clss 19.pdf) Definition 10.4, inz, 6 th, pge 279 et S be set of strings. An enumertion procedure for Turing Mchine tht genertes ll strings

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

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages Automt & lnguges A primer on the Theory of Computtion Lurent Vnbever www.vnbever.eu Prt 5 out of 5 ETH Zürich (D-ITET) October, 19 2017 Lst week ws ll bout Context-Free Lnguges Context-Free Lnguges superset

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

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

More information

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

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

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

More information

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

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

Lecture 6 Regular Grammars

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

More information

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility) CS5371 Theory of Computtion Lecture 20: Complexity V (Polynomil-Time Reducibility) Objectives Polynomil Time Reducibility Prove Cook-Levin Theorem Polynomil Time Reducibility Previously, we lernt tht if

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

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

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

More information

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

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model? CS125 Lecture 11 Fll 2016 11.1 Finite Automt Motivtion: TMs without tpe: mybe we cn t lest fully understnd such simple model? Algorithms (e.g. string mtching) Computing with very limited memory Forml verifiction

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

Deterministic Finite-State Automata

Deterministic Finite-State Automata Deterministic Finite-Stte Automt Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 12 August 2013 Outline 1 Introduction 2 Exmple DFA 1 DFA for Odd number of

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

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

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

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

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 Tble of Contents: Week 1: Preliminries (set lgebr, reltions, functions) (red Chpters 1-4) Weeks

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

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

Turing Machines Part One

Turing Machines Part One Turing Mchines Prt One Wht problems cn we solve with computer? Regulr Lnguges CFLs Lnguges recognizble by ny fesible computing mchine All Lnguges Tht sme drwing, to scle. All Lnguges The Problem Finite

More information

Turing Machines Part One

Turing Machines Part One Turing Mchines Prt One Hello Hello Condensed Condensed Slide Slide Reders! Reders! Tody s Tody s lecture lecture consists consists lmost lmost exclusively exclusively of of nimtions nimtions of of Turing

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

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

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent

More information

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

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

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

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt From Regulr Expressions to NFA- Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion

More information

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

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

Designing finite automata II

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

More information

Lecture 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

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

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

Deterministic Finite Automata

Deterministic Finite Automata Finite Automt Deterministic Finite Automt H. Geuvers nd J. Rot Institute for Computing nd Informtion Sciences Version: fll 2016 J. Rot Version: fll 2016 Tlen en Automten 1 / 21 Outline Finite Automt Finite

More information

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

NFAs continued, Closure Properties of Regular Languages

NFAs continued, Closure Properties of Regular Languages Algorithms & Models of Computtion CS/ECE 374, Fll 2017 NFAs continued, Closure Properties of Regulr Lnguges Lecture 5 Tuesdy, Septemer 12, 2017 Sriel Hr-Peled (UIUC) CS374 1 Fll 2017 1 / 31 Regulr Lnguges,

More information

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

Finite-State Automata: Recap

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

More information

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

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

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!) CMSC 330: Orgniztion of Progrmming Lnguges DFAs, nd NFAs, nd Regexps (Oh my!) CMSC330 Spring 2018 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All

More information

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

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

CS 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

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

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

Normal Forms for Context-free Grammars

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

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

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

Myhill-Nerode Theorem

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

More information

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun: CMPU 240 Lnguge Theory nd Computtion Spring 2019 NFAs nd Regulr Expressions Lst clss: Introduced nondeterministic finite utomt with -trnsitions Tody: Prove n NFA- is no more powerful thn n NFA Introduce

More information

PESIT SOUTHCAMPUS QUESTION BANK. Chapter 1 & 2 : Introduction to theory of computation and finite automata

PESIT SOUTHCAMPUS QUESTION BANK. Chapter 1 & 2 : Introduction to theory of computation and finite automata QUESTION BANK Fculty: Mr. Krthik S Totl Hours: 52 Chpter 1 & 2 : Introduction to theory of computtion nd finite utomt 1 Define lnguge ccepted by DFA 2 2 Define regulr lnguge 2 3 Give the forml definition

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

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

How to simulate Turing machines by invertible one-dimensional cellular automata

How to simulate Turing machines by invertible one-dimensional cellular automata How to simulte Turing mchines by invertible one-dimensionl cellulr utomt Jen-Christophe Dubcq Déprtement de Mthémtiques et d Informtique, École Normle Supérieure de Lyon, 46, llée d Itlie, 69364 Lyon Cedex

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

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

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

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

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1 Non Deterministic Automt Forml Lnguges nd Automt - Yonsei CS 1 Nondeterministic Finite Accepter (NFA) We llow set of possible moves insted of A unique move. Alphbet = {} Two choices q 1 q2 Forml Lnguges

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

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

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

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

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

I. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines

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

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

More information

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

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3) cs3102: Theory of Computtion Clss 5: Non-Regulr PS1, Prolem 8 Menu Non-regulr lnguges Spring 2010 University of Virgini Dvid Evns PS1 Generl Comments Proofs re for mking convincing rguments, not for ofusction.

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

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

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation Strong Bisimultion Overview Actions Lbeled trnsition system Trnsition semntics Simultion Bisimultion References Robin Milner, Communiction nd Concurrency Robin Milner, Communicting nd Mobil Systems 32

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

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

Lexical Analysis Finite Automate

Lexical Analysis Finite Automate Lexicl Anlysis Finite Automte CMPSC 470 Lecture 04 Topics: Deterministic Finite Automt (DFA) Nondeterministic Finite Automt (NFA) Regulr Expression NFA DFA A. Finite Automt (FA) FA re grph, like trnsition

More information

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

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

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

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 Structural induction, finite automata, regular expressions

1 Structural induction, finite automata, regular expressions Discrete Structures Prelim 2 smple uestions s CS2800 Questions selected for spring 2017 1 Structurl induction, finite utomt, regulr expressions 1. We define set S of functions from Z to Z inductively s

More information