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.

Slides:



Advertisements
Similar presentations
Pumping Lemma Problem: Solution:
Advertisements

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.
Chap 2 Context-Free Languages. Context-free Grammars is not regular Context-free grammar : eg. G 1 : A  0A1substitution rules A  Bproduction rules B.
127 The Chomsky Hierarchy(review) Recursively Enumerable Sets Turing Machines Post System Markov Algorithms,  -recursive Functions Regular Expression.
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
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)
Homework 4 Solutions.
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.
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.
Prof. Busch - LSU1 Pumping Lemma for Context-free Languages.
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.
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Problem of the DAY Create a regular context-free grammar that generates L= {w  {a,b}* : the number of a’s in w is not divisible by 3} Hint: start by designing.
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 21, 2004.
1 Properties of Context-Free Languages Is a certain language context-free? Is the family of CFLs closed under a certain operation?
Context-free Languages
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
Context-Free and Noncontext-Free Languages Chapter 13 1.
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.
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.
Context Free Pumping Lemma. CFL Pumping Lemma A CFL pump consists of two non-overlapping substrings that can be pumped simultaneously while staying in.
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.
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.
Introduction Finite Automata accept all regular languages and only regular languages Even very simple languages are non regular (  = {a,b}): - {a n b.
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.
Transparency No. 1 Formal Language and Automata Theory Homework 5.
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.
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.
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
Non-Context-Free Languages Sections: 2.3 page 123 October 17, 2008
Context Free Pumping Lemma Some languages are not context free!
Definition: Let G = (V, T, P, S) be a CFL
COSC 3340: Introduction to Theory of Computation
Deterministic PDAs - DPDAs
Pumping Lemma for Context-free Languages
Properties of Context-Free Languages
Bottom-up parsing Pumping Theorem for CFLs
Midterm #2 — Review problems
COSC 3340: Introduction to Theory of Computation
Chapter 2 Context-Free Language - 02
Applications of Regular Closure
Pumping Theorem for CFLs
Intro to Theory of Computation
Presentation transcript:

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

Solution Exercise 2.23 (credits to Jeff Kleeblatt for finding this elegant solution) S  AB | BA A  XAX | 1 B  XBX | 0 X  0 | 1

Idea of Pumping Lemma for Context- Free Languages S  * uAz where A is a variable, u and z are in  * uAz  * uvAyz  * uvxyz where v, x and y are in  * S  * uv 2 xy 2 z uv 10 xy 10 z uv n xy n z for n = 1, 2, 3, …

Pumping Lemma for Context-Free Grammars Pumping Lemma for Context-Free Grammars. Given a context-free grammar G = ( ,V,R,S), there exists n > 0 such that: For any string w  L with |w|  n, there are u, v, x, y, z in  * for which the following holds: 1.w = uvxyz 2.|vxy|  n 3.v  e or y  e 4.uv i xy i z  L, for each i = 0, 1, 2, …

Preliminaries of the Proof Definition. Given a grammar G, the fanout of G, denoted f(G), is the greatest number of symbols on the right side of a rule in G Example: G ={ S  aSbS, S  ab, S  e } F(G) = 4

Preliminaries the Proof (2) S  aSbS  aSbaSb  aSbab  a 2 b 2 ab Parse Tree: What is the maximum number of children for any node in this parse tree? F(G) S aSbS a ab S b e

Preliminaries (3) Lemma. Given a grammar G and a parse tree T for G, let w be the word contained in T, then: if length(w) > F(G) h, then height(T) > h Proof. The maximum number of leaves in a parse tree of height h is F(G) h = maximum number of characters of any word for that tree

Proof of Pumping Lemma Proof. Let n = F(G) |V|+1 Consider any w  L(G) with |w|  n Let T be a parse tree for w with the smallest height Let P be a path of length h, such that h is the height of T. Since |w|  F(G) |V|+1, then length(P)  |V| + 1 Thus, the number of nodes in P is at least |V| + 2 Thus, there must be at least one repeated variable A.

Proof (2) R akak T … A A … … amam a1a1 aiai ajaj alal apap uv xyz w = a 1 …. a p P has at least |V| + 2 nodes

Example {a n b n c n | n = 0, 1, 2, …} is not context-free {ww | w  {a,b}*}

Context-Free is not Closed under Intersection, Complement Theorem. Let L and M two context-free languages. Then L  M is not necessarily context-free L c is not necessarily context-free Proof (intersection). Homework (Friday): find a counter-example

Context-Free is not Closed under Intersection, Complement (2) Proof (complement). By contradiction: suppose that the complement of a context- free language is always context-free. We show that this implies that the intersection must always be context free: L  M = (L c  M c ) c

Homework 2.30 (a) Show that the set of all context-free languages is not closed under intersection