Context-Free Languages

Slides:



Advertisements
Similar presentations
Erik Jonsson School of Engineering and Computer Science FEARLESS Engineering CS 5349 – 001 CS 4384 – 001 Automata Theory
Advertisements

Pumping Lemma Problem: Solution:
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.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
Courtesy Costas Busch - RPI1 More Applications of the Pumping Lemma.
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003.
Costas Busch - RPI1 The Pumping Lemma for Context-Free Languages.
1 Module 36 Non context-free languages –Examples and Intuition Pumping lemma for CFL’s –Pumping condition –No proof of pumping lemma –Applying pumping.
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.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Fall 2003Costas Busch1 More Applications of The Pumping Lemma.
Fall 2006Costas Busch - RPI1 More Applications of the Pumping Lemma.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.3: Non-Context-Free Languages) David Martin With.
Prof. Busch - LSU1 More Applications of the Pumping Lemma.
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 Non-regular languages. 2 Regular languages Non-regular languages.
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
Costas Busch1 More Applications of The Pumping Lemma.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 Properties of Context-Free Languages Is a certain language context-free? Is the family of CFLs closed under a certain operation?
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
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.
Context Free Pumping Lemma. CFL Pumping Lemma A CFL pump consists of two non-overlapping substrings that can be pumped simultaneously while staying in.
CS355 - Theory of Computation Regular Expressions.
Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation.
CSCI 2670 Introduction to Theory of Computing September 23, 2004.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
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:
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.
CS 44 – Jan. 28 Pumping lemma #2 Applications to 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.
Context-Free and Noncontext-Free Languages Chapter 13.
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
Context Free Pumping Lemma Some languages are not context free!
Non-Context-Free Languages
Context-free Languages
Context-Free Grammars
فصل دوم Context-Free Languages
COSC 3340: Introduction to Theory of Computation
The Pumping Lemma for CFL’s
Pumping Lemma for Context-free Languages
Elementary Questions about Regular Languages
Non-regular languages
Pumping Lemma September 29, 2006
Bottom-up parsing Pumping Theorem for CFLs
Cpt S 317: Spring 2009 Sampath Kumar S, AP/CSE, SECE
Non-Regular Languages
CS 461 – Sept. 16 Review Pumping lemma Applications of FA:
More Applications of the Pumping Lemma
COSC 3340: Introduction to Theory of Computation
CS21 Decidability and Tractability
Chapter 2 Context-Free Language - 02
CS21 Decidability and Tractability
Recap lecture 42 Row language, nonterminals defined from summary table, productions defined by rows, rules for defining productions, all possible productions.
The Pumping Lemma for CFL’s
Pumping Theorem for CFLs
The Pumping Lemma for CFL’s
Chapter 8. PROPERTIES OF CONTEXT-FREE LANGUAGES Exercises
Intro to Theory of Computation
Presentation transcript:

Context-Free Languages Pumping Lemma

Pumping Lemma for CFL If L is a context-free language, then there is a number p (the pumping length) where, if s is any string in L of length at least p, then s may be divided into five pieces s=uvxyz satisfying the conditions: For each i ≥ 0, s=uvixyiz  L, |vy| > 0, and |vxy| ≤ p.

Pumping Lemma as an “Adversary Game” We pick a language L that we want to show is not a CFL. Our “adversary” gets to pick p. We get to pick s, and may use p as a parameter when we do so. Our adversary gets to break s into uvxyz, subject only to the constraints that |vy| > 0, and |vxy| ≤ p. We “win” the game, if we can, by picking i and showing that uvixyiz is not in L.

Example 1: L = { 1n where n is prime} By intuition: Is L a context-free language? n=2: 11 n=3: 111 n=5: 11111 n=7: 1111111 n=13: 1111111111111

Example 1: L = { 1n where n is prime} Adversary picks a pumping length of p. Consider some prime n ≥ p+2. Such an n must exist since there are an infinite number of primes. Let s= 1n Adversary picks uvxyz. Let |vy| = m. Then, |uxz| = n-m.

Example 1: L = { 1n where n is prime} By the pumping lemma, uvn-mxyn-mz  L |uvn-mxyn-mz| = |uxz| + (n-m)(|v| + |y|) = n-m + (n-m) m = (n-m) (m+1) Thus, |uvn-mxyn-mz| is not prime unless one of the above factors is 1. But, (m+1) > 1 since m=|vy|, and |vy| > 0. (n-m) > 1 since: n ≥ p+2 was chosen, and m ≤ p since m=|vy| ≤ |vxy| ≤ p