1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.

Slides:



Advertisements
Similar presentations
6.2 Closure Properties of CFL's
Advertisements

Properties of Regular Languages
3.2 Pumping Lemma for Regular Languages Given a language L, how do we know whether it is regular or not? If we can construct an FA to accept the language.
Automata and Formal Languages Tim Sheard 1 Lecture 9 Reasoning with DFAs.
CS21 Decidability and Tractability
Prof. Busch - LSU1 Properties of Context-Free languages.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
1 Positive Properties of Context-Free languages. 2 Context-free languages are closed under: Union is context free is context-free.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
1 More Applications of the Pumping Lemma. 2 The Pumping Lemma: Given a infinite regular language there exists an integer for any string with length we.
Courtesy Costas Busch - RPI1 Non-regular languages.
1 Background Information for the Pumping Lemma for Context-Free Languages Definition: Let G = (V, T, P, S) be a CFL. If every production in P is of the.
1 Applications of Regular Closure. 2 The intersection of a context-free language and a regular language is a context-free language context free regular.
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
1 A Non Context-Free Language (We will prove it at the next class)
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
1 Proof of the Day: Let P= {(b, acbb), (aac, a), (b, ca)}. 1.Prove that P has a match. 2. Find Q which is P encoded in binary. 3.What match of Q corresponds.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Design contex-free grammars that generate: L 1 = { u v : u ∈ {a,b}*, v ∈ {a, c}*, and |u| ≤ |v| ≤ 3 |u| }. L 2 = { a p b q c p a r b 2r : p, q, r ≥ 0 }
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Closure.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
1 L= { w c w R : w  {a, b}* } is accepted by the PDA below. Use a construction like the one for intersection for regular languages to design a PDA that.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
Context-Free and Noncontext-Free Languages Chapter 13 1.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
Properties of Regular Languages
CS355 - Theory of Computation Regular Expressions.
Costas Busch - LSU1 Properties of Context-Free languages.
Pumping Lemma for CFLs. Theorem 7.17: Let G be a CFG in CNF and w a string in L(G). Suppose we have a parse tree for w. If the length of the longest path.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2006.
Critique this PDA for L= { u u R v v R : u ∈ {0,1}* and v ∈ {0,1}+ } u0εu0 u1εu1 uεεvε v00vε v11vε vεεfε sεεtε t0εt0 t1εt1 t00tε t11tε tεεuε After you.
CFL Big Picture. Context Free Languages Conclusion We have studied the class of context free languages (CFL) We saw two different ways to express a CFL.
1 Find as many examples as you can of w, x, y, z so that w is accepted by this DFA, w = x y z, y ≠ ε, | x y | ≤ 7, and x y n z is in L for all n ≥ 0.
1 Create a NDFA which accepts the language generated by this context-free grammar. Start symbol: S S → aa S S → ε S → M M → bbb M → ab M M → b S M → E.
CS 154 Formal Languages and Computability March 17 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Properties of Context-Free Languages
Properties of Regular Languages
PROPERTIES OF REGULAR LANGUAGES
Formal Language & Automata Theory
PDAs Accept Context-Free Languages
Single Final State for NFA
DPDA Deterministic PDA
Properties of Regular Languages
Deterministic PDAs - DPDAs
Closure Properties of Context-Free languages
Closure Properties of Regular Languages
Chapter 4 Properties of Regular Languages
Properties of Context-Free languages
DPDA Deterministic PDA
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
Announcements Midterm is Wednesday June 23 in class.
Presentation transcript:

1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping theorem, factor in all ways as u v x y z such that |v| +|y| ≥ 1 and for each case, argue that u v n x y n z is not in L for some n.

2 The Pumping Theorem for Context-Free Languages: Let G be a context-free grammar. Then there exists some constant k which depends on G such that for any string w which is generated by G with |w| ≥ k, there exists u, v, x, y, z, such that 1. w= u v x y z, 2. |v| + |y| ≥ 1, and 3. u v n x y n z is in L for all n ≥ 0.

3 Assignment #4 has been posted, due on Friday Nov. 18, beginning of class. No tutorials this week. You can go and ask questions next week if you need help, but you are not expected to attend. Some old final exams are posted. Our final is very early in the exam schedule- keep up?

4 Closure Properties: We have constructions that use the context-free grammars proving that contex-free languages are closed under union, concatenation and Kleene star. We have a construction that uses a PDA and a DFA that proves that context-free languages are closed under intersection with regular languages.

5 Intersection: L 1 = { a n b n c p : n, p ≥ 0} L 2 = { a n b p c n : n, p ≥ 0} What is L 1 ∩ L 2 ?

6 Exclusive OR: L 1 = a* b* c* L 2 = { a p b q c r : p≠ q or p ≠ r or q≠r } What is L 1  L 2 ?

7 Difference: L 1 = a* b* c* L 2 = { a p b q c r : p≠ q or p ≠ r or q≠r } What is L 1  L 2 ?

8 L = { a n b n c n : n ≥ 0} L 1 = { a p b q c r : p ≠ q } L 2 = { a p b q c r : p ≠ r } L 3 = { a p b q c r : q ≠ r } The complement of L is NOT equal to L 1 ⋃ L 2 ⋃ L 3. Which strings are in the complement of L but not in L 1 ⋃ L 2 ⋃ L 3 ?

9 L = { a n b n c n : n ≥ 0} L 1 = { a p b q c r : p ≠ q } L 2 = { a p b q c r : p ≠ r } L 3 = { a p b q c r : q ≠ r } L 4 = { w  {a, b, c}* : w ∉ a* b* c*} L 1 ⋃ L 2 ⋃ L 3 ⋃ L 4 is context-free and is the complement of L. Therefore, context-free languages are not closed under complement.

10 Theorem: L= { a p : p is a prime number} is not context-free. Theorem: L= { a n 2 : n ≥ 0} is not context-free. Note: if L is a language defined over a one symbol alphabet and you can prove L is not regular using the pumping lemma, then it also means that L is not context-free.

11 Theorem: L= { a p : p is a prime number} is not context-free. Assume L is context-free and is generated by a context-free grammar G. Then there exists some constant k dependent on G such that for all strings w in L of length at least k the Pumping Theorem holds. Choose w= a p for some prime number p ≥ k.

12 Factor a p in all ways as u v x y z: w = a i a j a r a s a t where p= i + j + r + s + t, j + s ≥ 1, v=a j and y= a s. Pumping n+1 times yields: a i (a j ) n+1 a r (a s ) n+1 a t = a i a r a t (a j ) n+1 (a s ) n+1 = a p-j-s + (j+s)(n+1) Let x= j+s. Pumping n+1 times yields: a p+xn

13 w = a i a j a r a s a t Let x= j+s. Pumping n+1 times yields: a p+xn Pump p+1 times: Gives a p+xp = a p(x+1) Since x  1, (x+1)  2 and so p (x+1) Cannot be prime.

14 Theorem: L= { a n 2 : n ≥ 0} is not context-free. Note: if L is a language defined over a one symbol alphabet and you can prove L is not regular using the pumping lemma, then it also means that L is not context-free.