CS 275 Automata and Formal Language Theory

Size: px
Start display at page:

Download "CS 275 Automata and Formal Language Theory"

Transcription

1 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 on book drft by J. V. Tucker nd K. Stephenson) Dept. of Computer Science, Swnse University csetzer/lectures/ utomtformllnguge/current/index.html Mrch 9, 2018 CS 275 Chpter II.6. 1/ 50

2 II.6.1. Push Down Automt II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs II.6.3. Equivlence of CFG nd PDA CS 275 Chpter II.6. 2/ 50

3 II.6.1. Push Down Automt Motivtion There re context free lnguges which re not regulr, so they cn t be recognised by NFA. The problem is tht when prsing lnguge such s L = {ww R w {, b} }, when checking the second hlf of the word, one needs to know the first hlf of the word in reverse order. An NFA hs only finitely mny sttes, nd therefore only finite memory. We cn repir the problem by dding stck to memory, which llows us to record in cse of L the first hlf of the word. The resulting mchine will be clled utomton ( PDA). push-down CS 275 Sect. II / 50

4 II.6.1. Push Down Automt Architecture of PDA A PDA consists of An input type, contining the input word. The input tpe will be red only from left to right. A finite stte q. A stck. CS 275 Sect. II / 50

5 II.6.1. Push Down Automt Picture finite Stte q top A b c Input Tpe Stck CS 275 Sect. II / 50

6 II.6.1. Push Down Automt Instructions of PDA A PDA hs two kinds of instruction: An empty move instructions which depending on the stte, the top symbol of the stck, without looking t the next symbol on the input tpe chooses new stte, possibly empty sequence of stck symbols to replce the top symbol on the stck, nd keeps the pointer to the input tpe. An ordinry instruction, which depending on the stte, the top symbol of the stck, nd the next input symbol on the tpe chooses new stte, possibly empty sequence of stck symbols to replce the top symbol on the stck, nd moves the pointer on the input tpe forwrd. CS 275 Sect. II / 50

7 II.6.1. Push Down Automt Execution of PDA The utomton strts with the hed on the left most symbol of the input tpe, with some initil stte nd strt symbol on the stck. It will then do the following non-deterministiclly: If the stck is empty, it will get stuck. Otherwise, depending on the stte s nd the top stck symbol x it will do one of the following: If s nd x mtch n empty move trnsition then replce the top stck symbol by the new symbols to be put on the stck, switch to new stte nd keep the position on the input tpe s before. If the next symbol on the input tpe is y nd s, x, y mtch n ordinry trnsition then replce the top stck symbol by the new symbols to be put on the stck, switch to new stte nd keep the position on the input tpe s before. CS 275 Sect. II / 50

8 II.6.1. Push Down Automt Execution of PDA If none of the bove instructions mtches, the PDA gets stuck. The PDA will stop if it gets stuck (becuse of empty stck or hving no opertion possible) while still reding the word, it wnts to red letter nd hs reched the end of the word. There re two kinds of lnguges defined from PDA: The lnguge ccepted by finl stte. A word is ccepted by finl stte, if the PDA reds the complete word nd reches stte which is finl (ccepting). The lnguge ccepted by empty stck. A word is ccepted by empty stck, if the PDA reds the complete word nd then obtins empty stck. CS 275 Sect. II / 50

9 II.6.1. Push Down Automt Acceptnce by Finl Stte vs Empty Stte Clerly, cceptnce by finl stte is nturl generlistion of NFA. The stndrd LL(k), LR(k), LALR prsing lgorithms use deterministic PDA ccepting by finl stte. CFG correspond in nturl wy to non-deterministic PDA which ccept by empty stck. We will see tht the lnguges ccepted by PDAs by empty stck nd ccepted by PDAs by finl stte re equivlent. Therefore PDAs ccepting by empty stte correspond to intermedite mchines for proving the equivlence of context free lnguges nd lnguges ccepted by finl stte by PDA. CS 275 Sect. II / 50

10 II.6.1. Push Down Automt Acceptnce by Finl Stte vs Empty Stte Deterministic PDAs ccepting by empty stck only ccept lnguges L which hve the prefix property, i.e. if w is proper prefix of word w L, then w L. Since prsing should be idelly done by deterministic mchine, deterministic PDAs ccepting by finl stte form more nturl model. CS 275 Sect. II / 50

11 II.6.1. Push Down Automt Convention Regrding Stcks When writing w for the stck, the top element will be the left most element of w. CS 275 Sect. II / 50

12 II.6.1. Push Down Automt Definition of PDA Definition A push down utomton ( PDA) P = (T, Q, Γ, q 0, Z 0, F, δ) consists of input lphbet T ; finite set of sttes Q; stck lphbet Γ; strt stte q 0 Q; n strt stck symbol Z 0 Γ. set of ccepting or finl sttes F Q; trnsition reltion δ Q Γ (T {ɛ}) Q Γ, where we write (q, Z) (q, w) for (q, Z,, q, w) δ. CS 275 Sect. II / 50

13 II.6.1. Push Down Automt Interprettion of the Components The input lphbet T will be the lphbet on the tpe; so the PDA will look t elements of T nd check whether it ccepts them or not; The stck will consist of elements of the stck lphbet Γ. The PDA will strt in strt stte q 0 with stck consisting of the strt stck symbol Z 0. F will be the set of finl sttes in cse we consider the lnguge ccepted by finl stte. (q, Z) (q, w) mens tht the PDA cn, when in stte q, nd if the next tpe symbol is move on the tpe once to the right, chnge to stte q, nd replce the top stck symbol Z by w. ɛ (q, Z) (q, w) mens tht the PDA cn, when in stte q nd hving top symbol Z on the stck, mke move without looking t the next letter, nd switch to stte q, nd replce the top symbol on the stck by w. CS 275 Sect. II / 50

14 II.6.1. Push Down Automt Exmple We define PDA which ccepts the lnguge L := {ww R w {, b} } We will use the stck in order to record the first hlf of the word, so need the stck symbols, b. In ddition we need the bottom symbol of the stck Z 0. After hving finished prsing the word, if we red this symbol the PDA will more to n ccepting stte. There re 3 sttes: Initil stte q 0. In this stte the PDA will red the first hlf of the word, nd push it onto the stck. An intermedite stte q1. When reding the second hlf of the word, the PDA will be in this stte nd pop symbols from the stck. A finl ccepting stte. CS 275 Sect. II / 50

15 II.6.1. Push Down Automt Exmple So our PDA will be ({, b}, {q 0, q 1, q 2 }, {Z 0,, b}, q 0, Z 0, {q 2 }, δ) CS 275 Sect. II / 50

16 II.6.1. Push Down Automt Trnsitions We hve the following trnsitions in δ: Initilly the PDA is in stte q 0, sees stck symbol Z 0, nd then reds the first symbol on the tpe nd pushes it on the stck: (q 0, Z 0 ) (q 0, Z 0 ) (q 0, Z 0 ) b (q 0, bz 0 ) When reding future letters, the PDA will, when in stte q 0, push them on the stck: (q 0, ) (q 0, b) (q 0, ) (q 0, b) b b (q 0, ) (q 0, b) (q 0, b) (q 0, bb) CS 275 Sect. II / 50

17 II.6.1. Push Down Automt Trnsitions The PDA will guess when it hs reched the middle of the stck, nd then switch silently (mking ɛ-trnsition, i.e. trnsition without reding the next symbol) to stte q 1 without modifying the stck. This cn hppen t the beginning (without hving red symbol, so stck is Z 0 ), or when it hs lredy pushed some symbol on the stck, so the stck symbol cn be ny of, b, Z 0 : (q 0, Z 0 ) (q 0, ) (q 0, b) ɛ (q 1, Z 0 ) ɛ (q 1, ) ɛ (q 1, b) CS 275 Sect. II / 50

18 II.6.1. Push Down Automt Trnsitions When in stte q 1, the PDA compres whether the letters it reds re identicl to those it red in the first prt, so whether the letter it reds is identicl to the letter on the stck. If yes it empties the stck. (q 1, ) (q 1, b) (q 1, ɛ) b (q 1, ɛ) CS 275 Sect. II / 50

19 II.6.1. Push Down Automt Trnsitions When the stck is emptied, while in stte q 1, the PDA cn move to the ccepting stte q 2. It will s well empty the stck. If there re more letters to be red, the PDA will get stuck in tht stte, becuse there will be no trnsitions in this stte. (q 1, Z 0 ) ɛ (q 2, ɛ) CS 275 Sect. II / 50

20 Presenttion of the PDA by Tble PDA terminls P, b sttes q 0, q 1, q 2 stck lphb. Z 0,, b strt stte q 0 strt stck Z 0 finl q 2 trnsitions (q 0, Z 0 ) (q 0, Z 0 ) (q 0, Z 0 ) (q 0, bz 0 ) (q 0, ) (q 0, ) (q 0, b) (q 0, b) b (q 0, ) (q 0, b) (q 0, b) (q 0, bb) ɛ ɛ (q 0, Z 0 ) (q 1, Z 0 ) (q 0, ) (q 1, ) ɛ (q 0, b) (q 1, b) (q 1, ) (q 1, ɛ) b ɛ (q 1, b) (q 1, ɛ) (q 1, Z 0 ) (q 2, ɛ) b b

21 II.6.1. Push Down Automt Grphicl Presenttion We cn present PDA s well grphiclly by trnsition digrm with sttes, strt stte, finl sttes represented s before, trnsitions lbelled with n expression, Z/w where T, Z Γ, w Γ, where trnsition from stte q to q lbelled by, Z/w stnds for (q, Z) (q, w) The lphbet T is implicitly given by the elements of the lphbet ppering in the trnsitions. CS 275 Sect. II / 50

22 II.6.1. Push Down Automt Exmple in Grphicl Nottion ɛ, Z 0 /Z 0 ɛ, / ɛ, b/b ɛ, Z 0 /ɛ q 0 q 1 q 2, Z 0 /Z 0 b, Z 0 /bz 0, /, b/b b, /b b, b/bb, /ɛ b, b/ɛ CS 275 Sect. II / 50

23 II.6.1. Push Down Automt Configurtion of PDA The complete stte of PDA is given by its stck nd n element of Q. We cll this the configurtion of PDA. Definition Let P = (T, Q, Γ, q 0, Z 0, F, δ) be PDA. A configurtion of P is given by n element (q, z) where q Q, z Γ. CS 275 Sect. II / 50

24 II.6.1. Push Down Automt Trnsition of Configurtions We extend the reltion (q, Z) (q, z) for q, q Q, Z Γ, z Γ, T {ɛ} to one step reltion (q, z) 1 (q, z ) between configurtions (q, z), (q, z ) nd w T expressing tht: If the PDA hs configurtion (q, z), then it cn mke one step movement using to configurtion (q, z ). Furthermore we define n n-step trnsition reltion (q, z) w n (q, z ) nd trnsition reltion expressing tht we cn move from one configurtion to nother in rbitrrily mny steps (q, z) w (q, z ) CS 275 Sect. II / 50

25 II.6.1. Push Down Automt One Step Trnsition of Configurtion Definition Let P = (T, Q, Γ, q 0, Z 0, F, δ) be PDA. for q, q Q, Z Γ, z Γ, define the one step trnsition reltion between configurtions (q, z) nd (q, z ) nd T {ɛ}, written s by: (q, z) 1 (q, z ) If (q, Z) (q, z), then z Z (q, Zz ) 1 (q, zz ) Since 1 extends, we often write write (q, z) (q, z ) insted of (q, z) 1 (q, z ). CS 275 Sect. II / 50

26 II.6.1. Push Down Automt n-step Trnsition of Configurtion Definition Let P = (T, Q, Γ, q 0, Z 0, F, δ) be PDA. We define for n N the n-step trnsition reltion between configurtions (q, z), (q, z ) nd w T, written s (q, z) w n (q, z ) s follows: ɛ (q, z) 0 (q, z) If (q, z) 1 (q, z ) nd (q, z ) w n (q, z ), then (q, z) w n+1 (q, z ) CS 275 Sect. II / 50

27 II.6.1. Push Down Automt Trnsition of Configurtion Definition Let P = (T, Q, Γ, q 0, Z 0, F, δ) be PDA. We define the trnsition reltion between configurtions (q, z), (q, z ) nd w T, written s (q, z) w (q, z ) s follows: (q, z) w (q, z ) iff n N.(q, z) w n (q, z ) CS 275 Sect. II / 50

28 II.6.1. Push Down Automt Lnguge Accepted by PDA Definition Let P = (T, Q, Γ, q 0, Z 0, F, δ) be PDA. lnguge ccepted by finl The is defined s stte of P, denoted by L finl (P), L finl (P) := {w T (q 0, Z 0 ) w (q, z) for some q F, z Γ } A finl-stte PDA is PDA P for which we define its lnguge to be L(P) = L finl (P). CS 275 Sect. II / 50

29 II.6.1. Push Down Automt Lnguge Accepted by PDA Definition (Cont) The lnguge ccepted L empty (P), is defined s by empty stck of P, denoted by L empty (P) := {w T (q 0, Z 0 ) w (q, ɛ) for some q Q} An empty-stck PDA is PDA P for which we define its lnguge to be L(P) = L empty (P). CS 275 Sect. II / 50

30 II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs II.6.1. Push Down Automt II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs II.6.3. Equivlence of CFG nd PDA CS 275 Sect. II / 50

31 II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs Equivlence Acceptnce by Finl/Empty Stck Theorem Let L be lnguge. The following re equivlent: (1) L = L(P) for finl stte PDA P. (2) L = L(P) for n empty stck PDA P. CS 275 Sect. II / 50

32 II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs Proof Ide of (1) (2) Let P = (T, Q, Γ, q 0, Z 0, F, δ). The ide for constructing n empty stck PDA P is s follows: P opertes essentilly s P. If P reches n ccepting stte, then P cn switch to specil stte. In tht stte it empties using ɛ-trnsition the stck nd nd therefore ccepts the string. Full detils cn be found in Additionl Mteril. CS 275 Sect. II / 50

33 II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs Proof of (2) (1) Let P = (T, Q, Γ, q 0, Z 0, F, δ). The ide for constructing finl stte PDA P is s follows: P keeps specil stck symbol Z 0 t the bottom of the stck. It opertes s P, until it observes tht the top stck symbol is Z 0. This indictes tht P would hve reched n empty stck nd therefore ccepted the string. Therefore P moves into specil ccepting stte q finl nd termintes. Full detils cn be found in the Additionl Mteril. CS 275 Sect. II / 50

34 II.6.3. Equivlence of CFG nd PDA II.6.1. Push Down Automt II.6.2. Equivlence of Finl-Stte nd Empty-Stck-PDAs II.6.3. Equivlence of CFG nd PDA CS 275 Sect. II / 50

35 II.6.3. Equivlence of CFG nd PDA Equivlence Acceptnce by Finl/Empty Stck We re going to show tht the context free lnguges re exctly the lnguges which cn be recognised by (non-deterministic) empty stck PDA. Since empty stck PDA re finl stte PDA recognise the sme lnguges, the context free lnguges re exctly the lnguges which cn be recognised by PDA. CS 275 Sect. II / 50

36 II.6.3. Equivlence of CFG nd PDA Equivlence of empty stck PDA nd CFG Theorem Let L be lnguge. The following re equivlent: (1) L = L(G) for CFG G. (2) L = L(P) for n empty stck PDA P. CS 275 Sect. II / 50

37 II.6.3. Equivlence of CFG nd PDA Corollry Becuse empty stck nd finl stte PDAs re equivlent, from the theorem follows immeditely the following corollry: Corollry Let L be lnguge. The following re equivlent: (1) L = L(G) for CFG G. (2) L = L(P) for n empty stck PDA P. (2) L = L(P) for finl stte PDA P. CS 275 Sect. II / 50

38 II.6.3. Equivlence of CFG nd PDA Proof of the Theorem We will only show (1) (2), (2) (1) is quite sophisticted. CS 275 Sect. II / 50

39 II.6.3. Equivlence of CFG nd PDA Proof of (1) (2) Assume G = (T, N, S, P) is CFG. We need to construct PDA which simultes G. There re two wys of constructing such PDA, one follows the LL-prsing method, one uses the LR-prsing method. LL prsing will result in PDA with single stte. The configurtion cn be given by its stck. We will introduce in the min slides LL-prsing nd in the Additionl mteril LR-prsing. Deterministic versions of of them re the bsis for mny prsers. In the dditionl mteril you will find the full proof of (1) (2) by showing for the PDA bsed on the LL prser tht it is equivlent to the CFG. CS 275 Sect. II / 50

40 II.6.3. Equivlence of CFG nd PDA PDA bsed on LL-Prsing LL-prsing stnds for left-to-right prsing bsed on leftmost derivtion. It constructs leftmost derivtion top down, nd is therefore n exmple of top down prser. We tke s exmple the grmmr with the rules We consider left-most derivtion S AC A Ab A b C ccd C cd S AC AbC bbc bbccd bbccdd CS 275 Sect. II / 50

41 II.6.3. Equivlence of CFG nd PDA Exmple of LL Prsing S AC A Ab A b C ccd C cd S AC AbC bbc bbccd bbccdd We strt on our PDA with stck S for the strt symbol. So we hve stck S We guess tht the rule is S AC, nd replce the top symbol S on the stck by AC. So we hve stck AC (the top symbol of the stck is the left most one). We guess tht the rule for the top symbol is A Ab, nd replce the top symbol A on the stck by Ab. So we hve stck AbC (the top of the stck is the symbol most to the left). CS 275 Sect. II / 50

42 II.6.3. Equivlence of CFG nd PDA Exmple of LL Prsing S AC A Ab A b C ccd C cd S AC AbC bbc bbccd bbccdd We hve now stck AbC. We cn ccept the letter, nd remove this symbol from the stck. So we hve stck AbC We guess tht the rule is A b, nd replce the top symbol A on the stck by b. So we hve stck bbc Now we cn 3 times ccept letter, nmely, b, b nd remove them from the stck. So we hve stck C. CS 275 Sect. II / 50

43 II.6.3. Equivlence of CFG nd PDA Exmple of LL Prsing S AC A Ab A b C ccd C cd S AC AbC bbc bbccd bbccdd We hve now stck C. We use rule C ccd nd replce C by ccd. So we hve stck ccd We consume the next letter c nd ccept it nd remove c from the stck. So we hve stck Cd We expnd C using C cd to cd. So we hve stck cdd. Now we consume nd ccept letters c, d, d, cler them from the stck, nd then ccept the word becuse we hve reched the empty stck. CS 275 Sect. II / 50

44 II.6.3. Equivlence of CFG nd PDA S A C C C C C C C A A b b b b b b b d c C C d d d c d d d ccept ɛ ɛ ɛ ɛ ɛ b b c c d d CS 275 Sect. II / 50

45 II.6.3. Equivlence of CFG nd PDA LL(k) Prsing We hd to guess which production to use. LL(k) is n lgorithm to decide by using lookhed of the next k symbols, which production to use. For instnce when the stck ws AC we could hve guessed by knowing tht the next two letters re,, tht we need to use the production A Ab nd not A b, since the ltter would give s next two letters b. Usully only lookhed of 1 symbol is used, but most stndrd grmmrs (e.g. Jv) hve no LL(1) grmmrs. CS 275 Sect. II / 50

46 II.6.3. Equivlence of CFG nd PDA Invrint The invrint kept bove ws tht when hving consumed string w nd obtined stck v, then we hve S wv. CS 275 Sect. II / 50

47 II.6.3. Equivlence of CFG nd PDA Resulting PDA We obtin PDA with single stte. Therefore we omit the stte, nd ignore the strt stte, set of sttes, finl sttes, the stte in configurtions, nd hve trnsitions for Z Γ, T, z Γ. Z z The stck symbols were the lphbet used in strings occurring in the derivtions, i.e. T N. The strt stck symbol ws S. CS 275 Sect. II / 50

48 II.6.3. Equivlence of CFG nd PDA Resulting PDA The PDA hs the following productions: If the top symbol is non-terminl A, nd there ws rule A w, we could replce A by w, nd mke n ɛ-trnsition. So we hve in this cse trnsition ɛ A w If the top symbol ws terminl, then we could ccept letter nd pop the symbol from the stck. So we hve trnsitions ɛ CS 275 Sect. II / 50

49 II.6.3. Equivlence of CFG nd PDA Resulting Empty Stck Single Stte PDA The empty stck PDA derived from G = (T, N, S, P) is s follows: PDA P terminls T sttes single stte stck lphb. T N strt stck S trnsitions A ɛ w if A w P ɛ if T In the dditionl mteril there is proof L(P) = L(G). CS 275 Sect. II / 50

50 II.6.3. Equivlence of CFG nd PDA LR Prsing nd Proof of Equivlence This cn be found in the Additionl Mteril CS 275 Sect. II / 50

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

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

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

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

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

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

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

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

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

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

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

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

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

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

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

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

a b b a pop push read unread

a b b a pop push read unread A Finite Automton A Pushdown Automton 0000 000 red unred b b pop red unred push 2 An Exmple A Pushdown Automton Recll tht 0 n n not regulr. cn push symbols onto the stck cn pop them (red them bck) lter

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

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

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

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

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

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

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

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

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

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages C 314 Principles of Progrmming Lnguges Lecture 6: LL(1) Prsing Zheng (Eddy) Zhng Rutgers University Ferury 5, 2018 Clss Informtion Homework 2 due tomorrow. Homework 3 will e posted erly next week. 2 Top

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

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

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

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

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

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

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

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

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

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

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

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

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

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Non-Deterministic Finite Automt http://users.comlb.ox.c.uk/luke. ong/teching/moc/nf2up.pdf 1 Nondeterministic Finite Automton (NFA) Alphbet ={} q1 q2 2 Alphbet ={} Two choices q1 q2 3 Alphbet ={} Two choices

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

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

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

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

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

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-* Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion

More information

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

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

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA Nondeterminism Nondeterministic Finite Automt Nondeterminism Subset Construction A nondeterministic finite utomton hs the bility to be in severl sttes t once. Trnsitions from stte on n input symbol cn

More information

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

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

Formal Languages Simplifications of CFGs

Formal Languages Simplifications of CFGs Forml Lnguges implifictions of CFGs ubstitution Rule Equivlent grmmr b bc ubstitute b bc bbc b 2 ubstitution Rule b bc bbc ubstitute b bc bbc bc Equivlent grmmr 3 In generl: xz y 1 ubstitute y 1 xz xy1z

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

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

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

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

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

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

Worked out examples Finite Automata

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

More information

State Minimization for DFAs

State Minimization for DFAs Stte Minimiztion for DFAs Red K & S 2.7 Do Homework 10. Consider: Stte Minimiztion 4 5 Is this miniml mchine? Step (1): Get rid of unrechle sttes. Stte Minimiztion 6, Stte is unrechle. Step (2): Get rid

More information

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

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

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

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

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

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

Decidability. Models of Computation 1

Decidability. Models of Computation 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.

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

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

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

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

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

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

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

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

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

Context-Free Grammars and Languages

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

More information

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

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

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

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

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016 CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

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

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

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

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

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

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

Thoery of Automata CS402

Thoery of Automata CS402 Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...

More information

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1 Chpter 1, Prt 1 Regulr Lnguges CSC527, Chpter 1, Prt 1 c 2012 Mitsunori Ogihr 1 Finite Automt A finite utomton is system for processing ny finite sequence of symols, where the symols re chosen from finite

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

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck. Outline Automt Theory 101 Rlf Huuck Introduction Finite Automt Regulr Expressions ω-automt Session 1 2006 Rlf Huuck 1 Session 1 2006 Rlf Huuck 2 Acknowledgement Some slides re sed on Wolfgng Thoms excellent

More information

THEOTY OF COMPUTATION

THEOTY OF COMPUTATION Pushdown utomt nd Prsing lgorithms: Pushdown utomt nd context-free lnguges; Deterministic PDNondeterministic PD- Equivlence of PD nd CFG-closure properties of CFL. PUSHDOWN UTOMT ppliction: Regulr lnguges

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

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Forml Lnguge nd Automt Forml Lnguge nd Automt Theory (CS21004) Khrgpur Khrgpur Khrgpur Forml Lnguge nd Automt Tle of Contents Forml Lnguge nd Automt Khrgpur 1 2 3 Khrgpur Forml Lnguge nd Automt Forml Lnguge

More information

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

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

More information

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

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

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

More information