This lecture covers Chapter 7 of HMU: Properties of CFLs

Size: px
Start display at page:

Download "This lecture covers Chapter 7 of HMU: Properties of CFLs"

Transcription

1 This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU.

2 Chomsky Normal Form (CNF) for CF Chomsky Normal Forms A normal or canonical form (be it in algebra, matrices, or languages) is a standardized way of presenting the object (in this case, languages). A normal form for CFs provides a prescribed structure to the grammar without compromising on its power to define all context-free languages. Every non-empty language L with ɛ / L has Chomsky Normal Form grammar = (V, T, P, S) where every production rule is of the form: A BC for A, B, C V, or A a for A V and a T. CNF disallows: A ɛ [ɛ-productions]. A B for A, B V. [Unit productions]. A B 1 B k, A V, B i V T for k 2 [Complex productions]. 2 / 27

3 Chomsky Normal Form (CNF) for CF Towards CNF [Step 1: Remove ɛ-productions] ɛ-production: A ɛ for some A V. Let us call a variable A V as nullable if A ɛ. We can identify nullable variables as follows: Basis: A V is nullable if A ɛ is a production rule in P. Induction: B V is nullable if B A 1 A k is in P, and each A i is nullable. Procedure to Eliminate ɛ-productions iven = (V, T, P, S) define no-ɛ = (V, T, P no-ɛ, S) as follows: 1. Start with P no-ɛ = P. Find all nullable variables of. 3. For each production rule in P do the following: If the body contains k > 0 nullable variables, add 2 k productions to P no-ɛ obtained by choosing a subset of nullable variables and replacing each by ɛ 4. Delete any production in P no-ɛ of the form Y ɛ for any Y V. For example, suppose that in a given grammar, B, D are nullable and C is not. If A BCD is a rule in P, then A BCD CD BC C are rules in P no-ɛ. Similarly, if A BD is a rule in P, then A BD B D are rules in P no-ɛ. 3 / 27

4 Chomsky Normal Form (CNF) for CF Towards CNF [Step 1: Remove ɛ-productions] An Example Suppose = ({A, B, C}, {0, 1}, P, A) with P: A BC; B 0B ɛ; C C11 ɛ. B and C are nullable since B ɛ and C ɛ. Then, A is also nullable. Define no-ɛ = ({A, B, C}, {0, 1}, P no-ɛ, A) with P no-ɛ containing A BC B C ɛ B 0A ɛ C C11 ɛ Theorem The above induction procedure described in Slide 1 identifies all nullable variables. Theorem L( no-ɛ) = L() \ {ɛ}. a a Proof in the Additional Proofs Section at the end 4 / 27

5 Chomsky Normal Form (CNF) for CF Towards CNF [Step 2: Remove Unit Productions] iven a grammar and variables A, B V, we say (A, B) form a unit pair if A using unit productions alone. We can identify unit pairs as follows: Basis: For each A V, (A, A) is a unit pair (since A A). Induction: If (A, B) is a unit pair, and B C is a production in P, then (A, C) is a unit pair. Suppose A BC and C ɛ are productions then A unit pair. Procedure to Eliminate Unit Productions B, but (A, B) is not a iven = (V, T, P, S) define no-unit = (V, T, P no-unit, S) as follows: 1. Start with P no-unit = P. Find all unit pairs of. 2. For every unit pair (A, B) and non-unit production rule B α, add rule A α to P no-unit. 3. Delete all unit production rules in P no-unit. B 5 / 27

6 Chomsky Normal Form (CNF) for CF Towards CNF [Step 2: Remove Unit Productions] An Example Suppose = ({A, B, C, D}, {a, b}, P, A) with P: A B ac; B A bd; C ac ɛ; D bd ɛ. (A, B) and (B, A) are the only two pairs of unit variables. Define no-unit = ({A, B, C, D}, {a, b}, P no-unit, A) with P no-unit containing A ac bd B B bd ac A C ac ɛ D bd ɛ Note: Rules with B being the head can never be used. Theorem The induction procedure on Slide 5 identifies all unit pairs. Theorem L( no-unit ) = L(). b b Outline of the proof is given in the Additional Proofs Section at the end 6 / 27

7 Chomsky Normal Form (CNF) for CF Towards CNF [Step 3: Remove Useless Variables] A symbol X V T is said to be generating if X w for some w T ; reachable if S αx β for some α, β (V T ) ; and useful if S αx β w for some w T and α, β (V T ). (Useful Reachable + enerating) iven a grammar, we can identify generating variables as follows: Basis: For each s T, s s. So s is generating Induction: If A α, and every symbol of α is generating, so is A. iven a grammar, we can identify reachable variables as follows: Basis: S S so S is reachable. Induction: If A α, and A is reachable, so is every symbol of α. 7 / 27

8 Chomsky Normal Form (CNF) for CF Towards CNF [Step 3: Remove Useless Variables] Procedure to Eliminate Useless Variables iven = (V, T, P, S) define = (V, T, P, S) as follows: Find all generating symbols of V is the set of all generating variables. P is the set of production rules involving only generating symbols. Now, define R = (V R, T R, P R, S) as follows: Find all reachable symbols of V R is the set of all reachable variables. P R is the set of production rules involving only reachable symbols. The Order of Eliminating Variables is Important! Consider = ({A, B, S}, {0, 1}, P, S) with P : S AB 0; A 1A; B 1. A is not generating. Removing A and the rules S AB and A 1A results in B being unreachable. Removing B and B 1 yields R = ({S}, {0}, S 0, S). Reversing the order, we first see that all symbols are reachable; removing then the non-generating symbol A and production rules S AB and A 1A yields R = ({B, S}, {0}, S 0 and B 0, S). But B is unreachable now! 8 / 27

9 Chomsky Normal Form (CNF) for CF Towards CNF [Step 3: Remove Useless Variables] Theorem The induction procedure on Slide7 identifies all generating variables. Theorem The induction procedure on Slide7 identifies all reachable variables. Theorem (1) L() = L( R ); and (2) Every symbol in R is useful. c c Proof in the Additional Proofs Section at the end 9 / 27

10 Chomsky Normal Form (CNF) for CF Towards CNF [Step 4: Remove Complex Productions] Procedure to Eliminate Complex Productions iven = (V, T, P, S), define Ĝ = ( ˆV, T, ˆP, S) as follows: Start with Ĝ = and do the following operations. For every terminal a T that appears in the body of length 2 or more, introduce a new variable A and a new production rule A a. Replace the occurrence all such terminals in the body of length 2 or more by the introduced variables. Replace every rule A B 1 B k for k > 2, by introducing k 2 variables D 1,..., k 2, and by replacing the rule by the following k 1 rules: A B 1D 1 D 2 B 3 D 3 D k 2 B k 1 B k D 1 B 2D 2 D k 3 B k 2 D k 2 Note: Each introduced variable appears in the head exactly once. Theorem L() = L(Ĝ).d d Outline of the proof is given in the Additional Proofs Section at the end 10 / 27

11 Chomsky Normal Form (CNF) for CF The Chomsky Normal Form Theorem For every context-free language L containing a non-empty string, there exists a grammar in Chomsky Normal Form such that L \ {ɛ} = L(). Proof Since L is a CFL, it must correspond to some CF. Eliminate ɛ productions (Step 1) to derive a grammar 1 from such that L( 1) = L() \ {ɛ}. Eliminate unit productions (Step 2) to derive a grammar 2 from 1 such that L( 2) = L( 1). Eliminate useless variables (Step 3) to derive a grammar 3 from 2 such that L( 3) = L( 2). Eliminate complex productions (Step 4) to derive a grammar 4 from 3 such that L( 4) = L( 3). 4 contains no ɛ-productions, no unit productions, no useless variables, and no productions with body consisting of 3 or more symbols; Hence 4 is in CNF. 11 / 27

12 Pumping Lemma for CFLs Pumping Lemma Theorem Let L = be a CFL. Then there exists n > 0 such that for any string z L with z n, (1) z = uvwxy; (2) vx ɛ; (3) vwx n; uv i wx i y L for any i 0. Proof Since the claim only pertains to non-empty strings, we can show the claim for L \ {ɛ}. Let CNF grammar generate L \ {ɛ}. Choose n = 2 m where m = V in. Pick any z with z n. Depth d m + 1. {z } At most two children per node A! BC. apple 2. apple 2 2 one child A! s apple 2 3 apple 2 d-1 apple 2 d-1 yield = z and z =2 m 12 / 27

13 Pumping Lemma for CFLs Proof Since depth D = m + 1 or more, there must be a path with m + 1 edges in the tree. There must be two labels that match! The claim follows from the following pictorial argument. S X... S X... ) u w y S X X {z} {z } {z } {z } {z } u v w x y ). u v X X... x y v w x 13 / 27

14 Pumping Lemma for CFLs Uses of Pumping Lemma Pumping lemma can be used to argue that some langauges are not CFLs. Proof that L = {0 n 1 n 2 n : n 0} is Not Context-Free Suppose it were. There exists an n such that for strings z longer than n pumping lemma applies. Applying pumping lemma to z = 0 n 1 n 2 n, we see that z = uvwxy such that vwx n. n n n z } { z } { z } { vwx vwx 2 possible options for vwx vwx cannot contain both zeros and twos. Two cases arise: Case (a): Suppose vwx contains no 2s. Then uwx contains fewer 1s or 0s than 2s. Such a string is not in L. Case (b): Suppose vwx contains no 1s. Then uwx contains fewer 1s or 2s than 1s. Such a string is not in L. 14 / 27

15 Closure Properties Substitution of Symbols with Languages Let L be a CFL on Σ 1, and let h be a substitution, i.e., for each a Σ 1, h(a) is a language over some alphabet Σ a. We can extend the substitution to words by concatenation, i.e., h(s 1 s k ) = h(s 1)h(s 2) h(s k ). One can then extend the substitution to languages by unioning, i.e., h(l) := h(s 1 s l ) = h(s 1) h(s l ) s 1 s l L s 1 s l L i.e., h(l) is the language formed by substituting each symbol in a string in the language L by a corresponding language. An Example Suppose L = {a n b n : n 0} and h(a) = {0} and h(b) = {1, 11}. Then, h(l) = {0 n 1 m : n m 2n} Theorem If L is a CFL over Σ 1 and h(s) is a CFL for every s Σ 1, then h(l) is also a CFL. 15 / 27

16 Closure Properties Substitution of Symbols with Languages Proof of Theorem Let = (V, Σ 1, P, S) be a grammar that generates L. Let for a Σ 1, let a = (V a, Σ a, P a, S a) be a grammar that generates h(a). WLO, assume that V V a = for each a Σ 1. Now define Ĝ = (V, {Sa : a Σ1}, ˆP, S) by Every rule of ˆP is a rule of P obtained by replacing each a Σ 1 by S a. For example, X axb in P will correspond to X S axs b in ˆP if a, b Σ 1. Let sub = (V ( a Σ1 V a), a Σ1 Σ a, ˆP ( a Σ1 P a), S) Claim: sub generates h(l). Note that w h(l) can be written as w a1 w al for w ai h(a i ) for each i, and for some a 1 a l L. S ) a 1 a (in ) For i =1;:::;, S ai ) wai (in ai ) + + S ) S a1 S a (in Ĝ as well as sub ) S ai ) wai (in sub ) + z } { z } { S ) S a1 S a ) wa1 S a2 S a ) wa1 w a2 S a3 S a ) ) wa1 w a + 16 / 27

17 Closure Properties Closure under substitution means... Closure under (Finite) Union: Let L = {1, 2,..., k} and h(i) = L i be a CFL for each i = 1,..., k. By Theorem 7.3.1, h(l) = L 1 L k is a CFL. (FInite) Concatenation: Let L = {a 1a 2 a k } and h(a i ) = L ai be a CFL for each i = 1,..., k. By Theorem 7.3.1, h(l) = L a1 L ak is a CFL. Kleene- closure: Let L = {a} and h(a) = L a be a CFL. By Theorem 7.3.1, h(l) = (L a) is a CFL. Positive closure: Let L = {a} + := {a n : n 1} and h(a) = L a be a CFL. By Theorem 7.3.1, h(l) = L a(l a) is a CFL. Homomorphism: Let L be a CFL and g be a homomorphism (i.e., h maps symbols to strings of symbols over some alphabet). Define h(a) = {s(a)}, which is a regular/cf language.then, h(l) = s(l) and by Theorem 7.3.1, it is a CFL. 17 / 27

18 Closure Properties Some More Closure Properties - 1 Theorem If L is CFL, then so is L R. Proof of Theorem If = (V, T, P, S) generates L, then R = (V, T, P R, S) generates L R where A X 1 X l in P A (X 1 X l ) R = X l X l 1 X 1 in P R (1) Theorem If L is a CFL, R is a regular language, then L R is a CFL. Proof of Theorem Product PDA Approach: Run the PDA accepting L 1 and DFA accpeting L 2 in parallel. Accept input string iff both machines are in one of their respective final states. Corollary If L is a CFL, and R is regular, then L \ R = L R c is regular 18 / 27

19 Closure Properties Some More Closure Properties - 2 Theorem If L is a CFL, h 1 (L) = {w : h(w) L} is also a CFL. A Coarse Outline of Proof of Theorem ::: h ::: PDA P accepting L Yes/No Note that editing the input tape is not a valid PDA operation. To fix that, we need to alter the state of the PDA P to store h(a) in the state itself. Let L be a language over {0, 1} and h(0) = aa and h(1) = bbb. Let the states of PDA P be q 0,..., q k. Then, the PDA that accepts h 1 (L) has 6k states, namely (q i, aa), (q i, a), (q i, ɛ), (q i, bbb), (q i, bb), and (q i, b). The transition between states of P is defined as if the second component is the input tape. When the second component is empty, the PDA has the choice to read an input symbol a and move into a state with h(a) as the second component. 19 / 27

20 Closure Properties Some Non-Closure Properties CFLs are not closed under intersection. Let L 1 = {0 n 1 n 2 m : n, m 0}, L 2 = {0 n 1 m 2 n : n, m 0}. Both are CFLs. However, L 1 L 2 = {0 n 1 n 2 n : n 0} is not a CFL. CFLs are not closed under complementation. Suppose CFLs are closed under complementation. Let L 1, L 2 be the aforementioned CFLs. Then L 1 L 2 = (L c 1 L c 2) c must be a CFL, but it is not. (See Slide 14). Hence, CFLs cannot be closed under complementation. Note: There exist CFLs L such that L c is a CFL as well. 20 / 27

21 Decision Properties Emptiness and Membership Conversion of a grammar to a corresponding PDA, PDA to a corresponding grammar, and a grammar to CNF can each be achieved in polynomial time. Emptiness of a CFL L Let a grammar = (V, T, P, S) generating the language L be given. (If PDA is given, convert it to a grammar ). is non-empty S is generating. 21 / 27

22 Decision Properties Emptiness and Membership Emptiness of a CFL L iven = (V, T, P, S) and w = a 1 a l we identify l(l + 1)/2 sets E i,j 1 i j n E i,j corresponds to all variables that can derive a i a j. E i,j s are identify from bottom to top, left to right by the following induction. Basis: For each i = 1,..., l, E i,i contains all variables X such that X a i. Induction: For each i = 1,..., l and j > i, E ij contains X if: (1) X YZ (2) Y E i,i and Z E i +1,j for some i i < j. S E 1,l w L(). E 1; E 1; 1 E 2;..... E 1;3 E 2;4 E 2; E 1;2 E 2;3 E 3;4 E 1; E 1;1 E 2;2 E 3;3 E ; a 1 a 2 a 3 a 22 / 27

23 Decision Properties Some Undecidable Questions about CFs and CFLs Is a given grammar unambiguous/ambiguous? Is a given CFL inherently ambiguous? Is the intersection of two CFLs empty? Are two CFLs identical? Is a given CFL equal to Σ? 23 / 27

24 Additional Proofs Additional Proofs Proof of Theorem Construct a parse tree with yield w L() \ {ɛ}. Identify a maximal subtree, rooted at say X, whose yield is ɛ. Delete X and its subtree. Repeat until no such subtrees remain. In this illustrative example below, suppose that there is only one subtree with ɛ yield; let B be its label and let A BCD be the production that introduced B. Now, delete B and its subtree. This new subtree is a parse tree for no-ɛ with yield w since A CD is a valid production rule in P no-ɛ [Why? B is nullable]. Construct a parse tree with yield w L( no-ɛ). Identify production rules (used in the tree) that are not in P. For each such rule, find an appropriate rule by appending nullable variables. To the parse tree, add the corresponding nullable variable(s) and a zero-yield subtrees to transform it to a parse tree for. In the example, the portion of the parse tree in yellow corresponds to the rule A CD; then there must be some rule in P (namely A BCD) such that the added variable(s) (B in this case) is nullable. So we add a child node with label B to the node with label A and append a sub-tree of yield ɛ rooted at B. This is now a parse tree for with yield w. no- S S A! CD A A! BCD A C D () B C D yield: w.. yield: w. sub-yield = z } {. 24 / 27

25 Additional Proofs Additional Proofs Outline of Proof of Theorem L( no-unit ) L(): By definition, A γ in P no-unit iff there exists a B V such that A B and B γ in P. Thus, every production rule A γ of P no-unit is effectively a derivation A Hence, every derivation of no-unit is a derivation of. L() L( no-unit ): Consider a derivation of w L() from S. α in. Argue that every run of unit productions in P that are used in this derivation must be followed by a non-unit production rule in P. Each such run of unit productions in P followed by a non-unit production can be condensed to a single production in P no-unit. [See definition of P no-unit ] The condensed derivation is then a derivation of w using rules in P no-unit. 25 / 27

26 Additional Proofs Additional Proofs Proof of Theorem (1) L( R ) L()) since the alphabets and the rule of R are subsets of those of. Suppose w L(). Then, there must be such a derivation of w from S: S γ 1 γ 2 γ 3 γ k = w. Rule: R 1 R 2 R 3 R k Since every variable symbol that appears in this derivation is generating, they and the production rules R 1,..., R k used in this derivation will be present in. Every variable in this derivation is reachable; consequently, the variables that appear and the rules R 1,..., R k will be present in R. Then, w L( R ). (2) A straightforward exercise in verifying the definition on Slide 7. Note that the remaining symbols have to be shown to be useful in R, and not in! 26 / 27

27 Additional Proofs Additional Proofs Outline of Proof of Theorem L() L(Ĝ) because every production rule of Ĝ has a corresponding equivalent derivation of α from A in Ĝ. Consider the parse tree of w L(Ĝ). If there are no introduced variables, then this is also the parse tree of w in and hence w L(). If there are introduced variables, replace them by the complex production in that introduced them in the first place (such replacements are always possible). The resultant tree is a parse tree for w in, and hence w. Ĝ A S. S. B 1 B 2 D 1 D2 B 3... D k 2 ) B 1 B 2 B 3 B k yield: w... B k 1 B k yield: w. 27 / 27

Properties of Context-Free Languages

Properties of Context-Free Languages Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr

More information

Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages. Reading: Chapter 7 Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

Non-context-Free Languages. CS215, Lecture 5 c

Non-context-Free Languages. CS215, Lecture 5 c Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..

More information

Properties of context-free Languages

Properties of context-free Languages Properties of context-free Languages We simplify CFL s. Greibach Normal Form Chomsky Normal Form We prove pumping lemma for CFL s. We study closure properties and decision properties. Some of them remain,

More information

Chap. 7 Properties of Context-free Languages

Chap. 7 Properties of Context-free Languages Chap. 7 Properties of Context-free Languages 7.1 Normal Forms for Context-free Grammars Context-free grammars A where A N, (N T). 0. Chomsky Normal Form A BC or A a except S where A, B, C N, a T. 1. Eliminating

More information

Ogden s Lemma for CFLs

Ogden s Lemma for CFLs Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

The Pumping Lemma for Context Free Grammars

The Pumping Lemma for Context Free Grammars The Pumping Lemma for Context Free Grammars Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar is in the form A BC A a Where a is any terminal

More information

Context Free Language Properties

Context Free Language Properties Context Free Language Properties Knowing that the context free languages are exactly those sets accepted by nondeterministic pushdown automata provides us a bit of information about them. We know that

More information

CS20a: summary (Oct 24, 2002)

CS20a: summary (Oct 24, 2002) CS20a: summary (Oct 24, 2002) Context-free languages Grammars G = (V, T, P, S) Pushdown automata N-PDA = CFG D-PDA < CFG Today What languages are context-free? Pumping lemma (similar to pumping lemma for

More information

Context-Free Languages (Pre Lecture)

Context-Free Languages (Pre Lecture) Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of

More information

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions? Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)

More information

Context-Free Grammars: Normal Forms

Context-Free Grammars: Normal Forms Context-Free Grammars: Normal Forms Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr

More information

Section 1 (closed-book) Total points 30

Section 1 (closed-book) Total points 30 CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes

More information

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

Finite Automata and Formal Languages TMV026/DIT321 LP Useful, Useless, Generating and Reachable Symbols

Finite Automata and Formal Languages TMV026/DIT321 LP Useful, Useless, Generating and Reachable Symbols Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Lecture 13 Ana Bove May 7th 2012 Overview of today s lecture: Normal Forms for Context-Free Languages Pumping Lemma for Context-Free Languages

More information

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Table of Contents: Week 1: Preliminaries (set algebra, relations, functions) (read Chapters

More information

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal

More information

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner. Tel Aviv University. November 28, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Plan for 2 nd half. Just when you thought it was safe. Just when you thought it was safe. Theory Hall of Fame. Chomsky Normal Form

Plan for 2 nd half. Just when you thought it was safe. Just when you thought it was safe. Theory Hall of Fame. Chomsky Normal Form Plan for 2 nd half Pumping Lemma for CFLs The Return of the Pumping Lemma Just when you thought it was safe Return of the Pumping Lemma Recall: With Regular Languages The Pumping Lemma showed that if a

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 3/8, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

More information

This lecture covers Chapter 5 of HMU: Context-free Grammars

This lecture covers Chapter 5 of HMU: Context-free Grammars This lecture covers Chapter 5 of HMU: Context-free rammars (Context-free) rammars (Leftmost and Rightmost) Derivations Parse Trees An quivalence between Derivations and Parse Trees Ambiguity in rammars

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26 Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating

More information

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

CS 373: Theory of Computation. Fall 2010

CS 373: Theory of Computation. Fall 2010 CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Normal Forms for CFG Normal Forms for Grammars It is typically easier to work with a context free language if given a CFG in a normal

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Context Free Languages and Grammars

Context Free Languages and Grammars Algorithms & Models of Computation CS/ECE 374, Fall 2017 Context Free Languages and Grammars Lecture 7 Tuesday, September 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 36 What stack got to do

More information

Lecture 12 Simplification of Context-Free Grammars and Normal Forms

Lecture 12 Simplification of Context-Free Grammars and Normal Forms Lecture 12 Simplification of Context-Free Grammars and Normal Forms COT 4420 Theory of Computation Chapter 6 Normal Forms for CFGs 1. Chomsky Normal Form CNF Productions of form A BC A, B, C V A a a T

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the Fall 1999 Formal Language Theory Dr. R. Boyer Week Seven: Chomsky Normal Form; Pumping Lemma 1. Universality of Leftmost Derivations. Theorem. For any context free grammar ; if there is a derivation of

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification

More information

Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Functions on languages:

Functions on languages: MA/CSSE 474 Final Exam Notation and Formulas page Name (turn this in with your exam) Unless specified otherwise, r,s,t,u,v,w,x,y,z are strings over alphabet Σ; while a, b, c, d are individual alphabet

More information

CS481F01 Solutions 6 PDAS

CS481F01 Solutions 6 PDAS CS481F01 Solutions 6 PDAS A. Demers 2 November 2001 1. Give a NPDAs that recognize the following languages: (a) The set of all strings in {0, 1} that contain twice as many 1s as 0s. (answer a) We build

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

CSE 355 Test 2, Fall 2016

CSE 355 Test 2, Fall 2016 CSE 355 Test 2, Fall 2016 28 October 2016, 8:35-9:25 a.m., LSA 191 Last Name SAMPLE ASU ID 1357924680 First Name(s) Ima Regrading of Midterms If you believe that your grade has not been added up correctly,

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 3: Finite State Automata Motivation In the previous lecture we learned how to formalize

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 10 : Context-Free Grammars COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite

More information

DD2371 Automata Theory

DD2371 Automata Theory KTH CSC VT 2008 DD2371 Automata Theory Dilian Gurov Lecture Outline 1. The lecturer 2. Introduction to automata theory 3. Course syllabus 4. Course objectives 5. Course organization 6. First definitions

More information

This lecture covers Chapter 6 of HMU: Pushdown Automata

This lecture covers Chapter 6 of HMU: Pushdown Automata This lecture covers Chapter 6 of HMU: ushdown Automata ushdown Automata (DA) Language accepted by a DA Equivalence of CFs and the languages accepted by DAs Deterministic DAs Additional Reading: Chapter

More information

Context-Free and Noncontext-Free Languages

Context-Free and Noncontext-Free Languages Examples: Context-Free and Noncontext-Free Languages a*b* is regular. A n B n = {a n b n : n 0} is context-free but not regular. A n B n C n = {a n b n c n : n 0} is not context-free The Regular and the

More information

The View Over The Horizon

The View Over The Horizon The View Over The Horizon enumerable decidable context free regular Context-Free Grammars An example of a context free grammar, G 1 : A 0A1 A B B # Terminology: Each line is a substitution rule or production.

More information

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Salil Vadhan October 11, 2012 Reading: Sipser, Section 2.3 and Section 2.1 (material on Chomsky Normal Form). Pumping Lemma for

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL) CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL) Objectives Introduce Pumping Lemma for CFL Apply Pumping Lemma to show that some languages are non-cfl Pumping Lemma

More information

CPS 220 Theory of Computation

CPS 220 Theory of Computation CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF) CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs CSC4510/6510 AUTOMATA 6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs The Pumping Lemma for Context Free Languages One way to prove AnBn is not regular is to use the pumping lemma

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013 Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction

More information

Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften

Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften Normal forms (1) Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften Laura Heinrich-Heine-Universität Düsseldorf Sommersemester 2013 normal form of a grammar formalism

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Decidability (What, stuff is unsolvable?)

Decidability (What, stuff is unsolvable?) University of Georgia Fall 2014 Outline Decidability Decidable Problems for Regular Languages Decidable Problems for Context Free Languages The Halting Problem Countable and Uncountable Sets Diagonalization

More information

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc. Section 12.4 Context-Free Language Topics Algorithm. Remove Λ-productions from grammars for langauges without Λ. 1. Find nonterminals that derive Λ. 2. For each production A w construct all productions

More information

MTH401A Theory of Computation. Lecture 17

MTH401A Theory of Computation. Lecture 17 MTH401A Theory of Computation Lecture 17 Chomsky Normal Form for CFG s Chomsky Normal Form for CFG s For every context free language, L, the language L {ε} has a grammar in which every production looks

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack

More information

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules).

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). 1a) G = ({R, S, T}, {0,1}, P, S) where P is: S R0R R R0R1R R1R0R T T 0T ε (S generates the first 0. R generates

More information

Context-Free Grammars (and Languages) Lecture 7

Context-Free Grammars (and Languages) Lecture 7 Context-Free Grammars (and Languages) Lecture 7 1 Today Beyond regular expressions: Context-Free Grammars (CFGs) What is a CFG? What is the language associated with a CFG? Creating CFGs. Reasoning about

More information

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Pushdown Automata We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Next we consider a more powerful computation model, called a

More information

The Pumping Lemma and Closure Properties

The Pumping Lemma and Closure Properties The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

More information

CS311 Computational Structures More about PDAs & Context-Free Languages. Lecture 9. Andrew P. Black Andrew Tolmach

CS311 Computational Structures More about PDAs & Context-Free Languages. Lecture 9. Andrew P. Black Andrew Tolmach CS311 Computational Structures More about PDAs & Context-Free Languages Lecture 9 Andrew P. Black Andrew Tolmach 1 Three important results 1. Any CFG can be simulated by a PDA 2. Any PDA can be simulated

More information

SFWR ENG 2FA3. Solution to the Assignment #4

SFWR ENG 2FA3. Solution to the Assignment #4 SFWR ENG 2FA3. Solution to the Assignment #4 Total = 131, 100%= 115 The solutions below are often very detailed on purpose. Such level of details is not required from students solutions. Some questions

More information

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

Equivalence of Regular Expressions and FSMs

Equivalence of Regular Expressions and FSMs Equivalence of Regular Expressions and FSMs Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin Regular Language Recall that a language

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014 Q.2 a. Show by using Mathematical Induction that n i= 1 i 2 n = ( n + 1) ( 2 n + 1) 6 b. Define language. Let = {0; 1} denote an alphabet. Enumerate five elements of the following languages: (i) Even binary

More information

Concordia University Department of Computer Science & Software Engineering

Concordia University Department of Computer Science & Software Engineering Concordia University Department of Computer Science & Software Engineering COMP 335/4 Theoretical Computer Science Winter 2015 Assignment 3 1. In each case, what language is generated by CFG s below. Justify

More information

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form

More information

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form

More information

Context-Free Grammars and Languages. Reading: Chapter 5

Context-Free Grammars and Languages. Reading: Chapter 5 Context-Free Grammars and Languages Reading: Chapter 5 1 Context-Free Languages The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free

More information

Theory Bridge Exam Example Questions

Theory Bridge Exam Example Questions Theory Bridge Exam Example Questions Annotated version with some (sometimes rather sketchy) answers and notes. This is a collection of sample theory bridge exam questions. This is just to get some idea

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner. Tel Aviv University. November 21, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Homework 4. Chapter 7. CS A Term 2009: Foundations of Computer Science. By Li Feng, Shweta Srivastava, and Carolina Ruiz

Homework 4. Chapter 7. CS A Term 2009: Foundations of Computer Science. By Li Feng, Shweta Srivastava, and Carolina Ruiz CS3133 - A Term 2009: Foundations of Computer Science Prof. Carolina Ruiz Homework 4 WPI By Li Feng, Shweta Srivastava, and Carolina Ruiz Chapter 7 Problem: Chap 7.1 part a This PDA accepts the language

More information

Theory Of Computation UNIT-II

Theory Of Computation UNIT-II Regular Expressions and Context Free Grammars: Regular expression formalism- equivalence with finite automata-regular sets and closure properties- pumping lemma for regular languages- decision algorithms

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam ECS 120: Theory of Computation Handout MT UC Davis Phillip Rogaway February 16, 2012 Midterm Exam Instructions: The exam has six pages, including this cover page, printed out two-sided (no more wasted

More information

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA) CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA) Objectives Introduce the Pumping Lemma for CFL Show that some languages are non- CFL Discuss the DPDA, which

More information

Ogden s Lemma. and Formal Languages. Automata Theory CS 573. The proof is similar but more fussy. than the proof of the PL4CFL.

Ogden s Lemma. and Formal Languages. Automata Theory CS 573. The proof is similar but more fussy. than the proof of the PL4CFL. CS 573 Automata Theory and Formal Languages Professor Leslie Lander Lecture # 24 December 4, 2000 Ogden s Lemma (6.2) Let L be a CFL, then there is a constant n such that if z is a word in L with z > n

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers. 1. For each of the following statements indicate whether it is true or false. For the false ones (if any), provide a counter example. For the true ones (if any) give a proof outline. (a) Union of two non-regular

More information

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-500 014 Subject: FORMAL LANGUAGES AND AUTOMATA THEORY Class : CSE II PART A (SHORT ANSWER QUESTIONS) UNIT- I 1 Explain transition diagram, transition

More information

Theory of Computation 8 Deterministic Membership Testing

Theory of Computation 8 Deterministic Membership Testing Theory of Computation 8 Deterministic Membership Testing Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor 60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017

Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017 Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017 1. Find a Greibach normal form for the following given grammar. (10 points) S bab A BAa a B bb Ʌ Solution: (1) Since S does not

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Problems of CFLs and beyond Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable

More information