1 Properties of Context-Free Languages Is a certain language context-free? Is the family of CFLs closed under a certain operation?

Slides:



Advertisements
Similar presentations
Context-Free and Noncontext-Free Languages
Advertisements

Erik Jonsson School of Engineering and Computer Science FEARLESS Engineering CS 5349 – 001 CS 4384 – 001 Automata Theory
Pumping Lemma Problem: Solution:
Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
CS 3240: Languages and Computation Properties of Context-Free Languages.
Turing machines Sipser 2.3 and 3.1 (pages )
Turing machines Sipser 2.3 and 3.1 (pages )
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
1 Module 31 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union, concatenation.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.3: Non-Context-Free Languages) David Martin With.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
CS 3240 – Chapter 8.  Is a n b n c n context-free? CS Properties of Context-Free Languages2.
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.
Homework #7 Solutions. #1. Use the pumping lemma for CFL’s to show L = {a i b j a i b j | i, j > 0} is not a CFL. Proof by contradiction using the Pumping.
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.
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Decidability A decision problem is a problem with a YES/NO answer. We have seen decision problems for - regular languages: - context free languages: [Sections.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
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.
Context-free Languages Chapter 2. Ambiguity.
1 Module 31 Closure Properties for CFL’s –Kleene Closure –Union –Concatenation CFL’s versus regular languages –regular languages subset of CFL.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
Context-Free and Noncontext-Free Languages Chapter 13 1.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
Context-Free and Noncontext-Free Languages Chapter 13 1.
Test # 2 Friday, November 2 nd Covers all of Chapter 2 Test # 2 will be 20% of final score (same as Test #1) Final Exam will be 40% of the final score.
Closure Properties Lemma: Let A 1 and A 2 be two CF languages, then the union A 1  A 2 is context free as well. Proof: Assume that the two grammars are.
Non-CF Languages The language L = { a n b n c n | n  0 } does not appear to be context-free. Informal: A PDA can compare #a’s with #b’s. But by the time.
1 Closure Properties of Regular Languages L 1 and L 2 are regular. How about L 1  L 2, L 1  L 2, L 1 L 2, L 1, L 1 * ?
Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation.
Context-Free and Noncontext-Free Languages Chapter 13.
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.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
January 20, 2016CS21 Lecture 71 CS21 Decidability and Tractability Lecture 7 January 20, 2016.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
Lecture 6: Context-Free Languages
CS 154 Formal Languages and Computability March 17 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
 2004 SDU Lecture8 NON-Context-free languages.  2004 SDU 2 Are all languages context free? Ans: No. # of PDAs on  < # of languages on  Pumping lemma:
Bottom-up parsing Pumping Theorem for CFLs MA/CSSE 474 Theory of Computation.
CS 461 – Oct. 5 Pumping lemma #2 –Understanding –Use to show a language is not a CFL Next: Applications of CFLs –Expression grammars and Compiling.
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
© M. Winter COSC/MATH 4P61 - Theory of Computation Pumping Lemma as a game 1.Player 1 picks the language L to be proven nonregular. 2.Player 2 picks.
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)
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.
Context-Free and Noncontext-Free Languages Chapter 13.
PROPERTIES OF REGULAR LANGUAGES
Lecture 15 Pumping Lemma.
PDAs Accept Context-Free Languages
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
Summary.
COSC 3340: Introduction to Theory of Computation
Deterministic PDAs - DPDAs
COSC 3340: Introduction to Theory of Computation
Applications of Regular Closure
Pumping Theorem for CFLs
Chapter 8. PROPERTIES OF CONTEXT-FREE LANGUAGES Exercises
Presentation transcript:

1 Properties of Context-Free Languages Is a certain language context-free? Is the family of CFLs closed under a certain operation?

2 Pumping Lemma Let L be an infinite CFL. Then there exists m  0 such that any w  L with |w|  m can be decomposed as w = uvxyz where: |vy|  1 |vxy|  m uv i xy i z  L for all i  0

3 Pumping Lemma Proof: The RL case: S  * xA  * xyA  * xyz The CFL case: S  * uAz  * uvAyz  * uvxyz

4 Moves in the Game 1.The opponent picks m  0. 2.We choose w  L with |w|  m. 3.The opponent chooses the decomposition w = uvxyz such that |vy|  1 and |vxy|  m. 4.We pick i such that uv i xy i z  L.

5 Example Prove L = {ww | w  {a, b}*} is not a CFL.

6 Moves in the Game 1.The opponent picks m  0.

7 Moves in the Game 1.The opponent picks m  0. 2.We choose w = a m b m a m b m.

8 Moves in the Game 1.The opponent picks m  0. 2.We choose w = a m b m a m b m. 3.The opponent chooses the decomposition w = uvxyz such that |vy|  1 and |vxy|  m. m m m m a... a b... b u v x y z

9 Moves in the Game 1.The opponent picks m  0. 2.We choose w = a m b m a m b m. 3.The opponent chooses the decomposition w = uvxyz such that |vy|  1 and |vxy|  m. m m m m a... a b... b u v x y z 4.We pick i such that uv i xy i z  L.

10 Example Prove L = {a n b n c n | n  0} is not a CFL.

11 Linear Context-Free Languages A CFL L is said to be linear iff there exists a linear CFG G such that L = L(G). (A grammar is linear iff at most 1 variable can occur on the right side of any production)

12 Pumping Lemma for Linear CFLs Let L be an infinite linear CFL. Then there exists m  0 such that any w  L with |w|  m can be decomposed as w = uvxyz where: |vy|  1 |uvyz|  m uv i xy i z  L for all i  0

13 Moves in the Game 1.The opponent picks m  0. 2.We choose w  L with |w|  m. 3.The opponent chooses the decomposition w = uvxyz such that |vy|  1 and |uvyz|  m. 4.We pick i such that uv i xy i z  L.

14 Example Prove L = {w | n a (w) = n b (w)} is not linear.

15 Closure Properties of Context-Free Languages L 1 and L 2 are context-free. How about L 1  L 2, L 1  L 2, L 1 L 2, L 1, L 1 * ?

16 Theorem If L 1 and L 2 are context-free, then so are L 1  L 2, L 1 L 2, L 1 *. (The family of context-free languages is closed under union, concatenation, and star-closure.)

17 Proof G 1 = (V 1, T 1, S 1, P 1 ) G 2 = (V 2, T 2, S 2, P 2 ) G 3 = (V 1  V 2  {S 3 }, T 1  T 2, S 3, P 1  P 2  {S 3  S 1 | S 2 }) L(G 3 ) = L(G 1 )  L(G 2 )

18 Proof G 1 = (V 1, T 1, S 1, P 1 ) G 2 = (V 2, T 2, S 2, P 2 ) G 4 = (V 1  V 2  {S 4 }, T 1  T 2, S 4, P 1  P 2  {S 4  S 1 S 2 }) L(G 4 ) = L(G 1 ).L(G 2 )

19 Proof G 1 = (V 1, T 1, S 1, P 1 ) G 5 = (V 1  {S 5 }, T 1, S 5, P 1  {S 5  S 1 S 5 | }) L(G 5 ) = L(G 1 )*

20 Theorem The family of context-free languages is not closed under intersection and complement.

21 Proof L 1 = {a n b n c m | n  0, m  0} L 2 = {a n b m c m | n  0, m  0} L = {a n b n c n | n  0} = L 1  L 2

22 Proof L 1  L 2 = L 1  L 2

23 Homework Exercises: 2, 7, 8, 9, 14, 15, 16 of Section 8.1. Exercises: 2, 4, 10, 15 of Section 8.2. Presentations: Section 12.1: Computability and Decidability + Halting Problem Section 13.1: Recursive Functions Post Systems + Church's Thesis Section 13.2: Measures of Complexity + Complexity Classes