Chapter 2 Context-Free Language - 02

Slides:



Advertisements
Similar presentations
Pumping Lemma Problem: Solution:
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 Lecture7: The Pumping Lemma for Context Free Languages Prof. Amos Israeli.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
Chap 2 Context-Free Languages. Context-free Grammars is not regular Context-free grammar : eg. G 1 : A  0A1substitution rules A  Bproduction rules B.
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)
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.3: Non-Context-Free Languages) David Martin With.
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.
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.
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.
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.
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.
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.
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,
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:
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
Context-Free and Noncontext-Free Languages Chapter 13.
Context-Free Languages
Context-Free Grammars: an overview
Fall Compiler Principles Context-free Grammars Refresher
Lecture 15 Pumping Lemma.
7. Properties of Context-Free Languages
Lecture 22 Pumping Lemma for Context Free Languages
PDAs Accept Context-Free Languages
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
Lecture 14 Grammars – Parse Trees– Normal Forms
Jaya Krishna, M.Tech, Assistant Professor
Context Free Pumping Lemma Some languages are not context free!
Relationship to Left- and Rightmost Derivations
Non-Context-Free Languages
Context-free Languages
Definition: Let G = (V, T, P, S) be a CFL
CHAPTER 2 Context-Free Languages
Context-Free Grammars
فصل دوم Context-Free Languages
Finite Automata and Formal 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
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Chapter 1 Regular Language - 02
Relationship to Left- and Rightmost Derivations
Chapter 2 Context-Free Language - 01
COSC 3340: Introduction to Theory of Computation
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Fall Compiler Principles Context-free Grammars Refresher
Applications of Regular Closure
Pumping Theorem for CFLs
Context Free Grammars-II
Intro to Theory of Computation
Presentation transcript:

Chapter 2 Context-Free Language - 02 Original author : Prof. Y-p Chen Reproduced : ccming 2010/10/20

2.3 Non-Context-Free Language 2.3.1 Pumping Lemma for CFLs Theorem 2.34 – Pumping lemma for context-free languages: If A is a context-free language, then there is a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into five pieces, s = uvxyz satisfying the conditions

Proof idea : When the string is long enough, some variable(s) must be repeatedly used in derivations. Proof : Let G be a CFG for CFL A. Let b be the maximum number if symbols in the right-hand side of a rule. From the start variable, there are at most b leaves for one step; at most b2 leaves for 2 steps; at most bh leaves for h steps. Conversely if a generated string is at least bh+1 long, each of its parse tree must be at least h+1 high. Say |V| is the number of variables in G. We set p, the pumping length, to be b|V|+1. Now if s is a string in A and its length is p or more, its parse tree must be at least |V|+1 high.

For any such string s, let τ be the parse tree with the smallest number of nodes. We know that τ must be at least |V|+1 high, so it must contain a path from the root to a leaf of length at least |V|+1. That path has least |V|+2 nodes; one at a terminal, the others at variables. Hence that path has at least |V|+1 variables. With G having only |V| variables, some variable R appears more than once on that. So we have :

How to use the pumping lemma for CFLs: Condition 2: Both v and y are not ε . τ is the parse tree with the smallest number of nodes. Condition 3: vxy has length at most p. Choose R so that both occurrence fall within the bottom |V|+1 variables on the path. How to use the pumping lemma for CFLs: Assume the language, say B, is context free in order to obtain a contradiction. By the pumping lemma for CLFs, a pumping length p exist, and any string w∈B can be pumped if |w|≧p Find a string s ∈ B , |s|≧p that s cannot be pumped as described in the pumping lemma The contradiction is obtained, so that B is not context-free

Example 2.36 :

2.3.2 Ogden’s lemma for CFLs

Example :

2.3.3 Ogden’s lemma for CFGs

2.3.4 Inherently Ambiguous CFLs Theorem : There exists an inherently ambiguous CFL Proof : One of such language is

2.4 Properties of CLFs 2.4.1 substitutions

2.4.2 Closure Properties Let A and B be context-free languages. Let R be a regular language. The result of the following operations are all context-free languages:

2.4.2 Membership Test : CYK Algorithm

Example : w = baaba