1 Introduction to Computability Theory Lecture7: The Pumping Lemma for Context Free Languages Prof. Amos Israeli.

Slides:



Advertisements
Similar presentations
The Pumping Lemma for CFL’s
Advertisements

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
CS 3240: Languages and Computation Properties of Context-Free Languages.
1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture5: Context Free Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.1: Context-Free Grammars) David Martin With some.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
Costas Busch - RPI1 The Pumping Lemma for Context-Free Languages.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Context Free Pumping Lemma Zeph Grunschlag. Agenda Context Free Pumping Motivation Theorem Proof Proving non-Context Freeness Examples on slides Examples.
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.
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.
Prof. Busch - LSU1 Pumping Lemma for Context-free Languages.
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.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
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.
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
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.
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.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
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.
CSCI 2670 Introduction to Theory of Computing September 23, 2004.
Costas Busch - LSU1 Pumping Lemma for Context-free Languages.
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.
Lecture # 31 Theory Of Automata By Dr. MM Alam 1.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
 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.
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
Context-Free and Noncontext-Free Languages Chapter 13.
Lecture 15 Pumping Lemma.
Context Free Pumping Lemma Some languages are not context free!
DPDA Deterministic PDA
Definition: Let G = (V, T, P, S) be a CFL
CHAPTER 2 Context-Free Languages
COSC 3340: Introduction to Theory of Computation
The Pumping Lemma for CFL’s
Pumping Lemma for Context-free Languages
Properties of Context-Free Languages
Bottom-up parsing Pumping Theorem for CFLs
COSC 3340: Introduction to Theory of Computation
CS21 Decidability and Tractability
Chapter 2 Context-Free Language - 02
DPDA Deterministic PDA
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
Intro to Theory of Computation
Presentation transcript:

1 Introduction to Computability Theory Lecture7: The Pumping Lemma for Context Free Languages Prof. Amos Israeli

In this lecture we present the Pumping Lemma for Context Free Languages. This lemma enables us to prove that some languages are not CFL and hence are not recognizable by any PDA. Introduction and Motivation 2

Let A be a context free language. There exists a number p such that for every, if then w may be divided into five parts, satisfying: 1.for each, it holds that Note: Without req. 2 the Theorem is trivial. The Pumping Lemma 3

If w is “long enough” (to be precisely defined later) it has a large parse tree which has a “long enough” path from its root to one of its leaves. Under these conditions, some variable on should appear twice. This enables pumping of w as demonstrated in the next slide: Proof Idea 4

5 R R R R R R R Pumping upPumping down

Let T be a binary tree. The 0 - th level of T has nodes. The 1 - th level of T has at most nodes. … The i - th level of T has at most nodes. If T’ is a b- ari tree then its i- th level has at most nodes. Reminder 6

Let G be a grammar for the language L. Let b be the maximum number of symbols (variables and constants) in the right hand side of a rule of G. (Assume ). In any parse tree, T, for generating w from G, a node of T may have no more than b children. If the height of T is h then. The Proof 7

If the height of T is h then. Conversely, If then the height of T is at least. Assume that G has variables. Then we set. Conclusion: For any, if, then the height of any parse tree of w is at least. The Proof (cont.) 8

To see how pumping works let be the parse tree of with a minimal number of nodes. The height of the tree, is at least, so it has a path, with at least nodes, from its root until some leaf. The path has at least variables and a single terminal. The Proof (cont.) 9

Since G has variables and has at least variables, there exists a variable, R, that repeats itself among the lowest variables of, as depicted in the following picture: The Proof (cont.) 10 R R

Each occurrence of R has a sub-tree rooted at it: Let be the word generated by the upper occurrence of R and let x be the word generated by the lower occurrence of R. The Proof (cont.) 11 R R

Since both sub-trees are generated by the same variable, each of these sub-trees can be replaced by another. This tree is obtained from by substituting the upper sub-tree at the lower occurrence of R. The Proof (cont.) 12 R R R R

The word generated is, and since It is generated by a parse tree of G we get. Additional substitutions of the upper sub-tree at the lower occurrence of, yield the conclusion for each The Proof (cont.) 13 R R R R

Substitution of the lower sub-tree at the upper occurrence of R yields this pars tree whose generated word is. Since once again this is a legitimate parse tree we get. The Proof (cont.) 14 R

To see that, assume that this is the situation. In this case, this tree is a parse tree for w with less nodes then, in contradiction with the choice of as a parse tree for w with a minimal number of nodes. The Proof (cont.) 15 R

In order to show that recall that we chose R so that both its occurrences fall within the bottom nodes of the path, where is the longest path of the tree so the height of the red sub-tree is at most and the number of its leaves is at most The Proof (cont.) 16 R R

Now we use the pumping lemma for CFL to show that the language is not CFL. Assume towards a contradiction that L is CFL and let p be the pumping constant. Consider. Obviously. Using the Pumping Lemma 17

By the pumping lemma, there exist a partition where, and for each, it holds that. Case 1: Both v and y contain one symbol each: Together they may hold 2 symbols, so in, the third symbol appears less than the other two. Using the Pumping Lemma 18

Case 2: Either v or y contain two symbols: In this case, the word has more than three blocks of identical letters: In other words:, Q.E.D. Using the Pumping Lemma 19 quodquod erat demonstrandum (Wiktionary)eratdemonstrandum which was to be proved; which was to be demonstrated. Abbreviation: QEDQED

Some weeks ago we started our quest to find out “What can be computed and what cannot?” So far we identified two classes: RL-s and CFL-s and found some examples which do not belong in neither class Discussion 20

This is what we got so far: CFL-s Ex: RL-s Ex: Discussion 21 Non CFL-s Ex: ???

Moreover: Our most complex example, namely, the language is easily recognizable by your everyday computer, so we did not get so far yet. Our next attempt to grasp the essence of “What’s Computable?” are Turing Machines. Some surprises are awaiting… Discussion 22

In this lecture we introduced and proved the Pumping Lemma for CFL-s Using this lemma we managed to prove that the fairly simple language, is not CFL. The next step is to define Turing Machines. Recap 23