Lecture 22 Pumping Lemma for Context Free Languages

Slides:



Advertisements
Similar presentations
The Pumping Lemma for CFL’s
Advertisements

CSCI 3130: Formal languages and automata theory Tutorial 5
Closure Properties of CFL's
About Grammars CS 130 Theory of Computation HMU Textbook: Sec 7.1, 6.3, 5.4.
CS5371 Theory of Computation
127 The Chomsky Hierarchy(review) Recursively Enumerable Sets Turing Machines Post System Markov Algorithms,  -recursive Functions Regular Expression.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
Normal forms for Context-Free Grammars
Chapter 12: Context-Free Languages and Pushdown Automata
Normal Forms for Context-Free Grammars Definition: A symbol X in V  T is useless in a CFG G=(V, T, P, S) if there does not exist a derivation of the form.
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.
Copyright © by Curt Hill Grammar Types The Chomsky Hierarchy BNF and Derivation Trees.
Section 12.4 Context-Free Language Topics
Saeid Pashzadeh Jan 2009 Theory of Computation 1.
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.
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.
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.
Mid-Terms Exam Scope and Introduction. Format Grades: 100 points -> 20% in the final grade Multiple Choice Questions –8 questions, 7 points each Short.
About Grammars Hopcroft, Motawi, Ullman, Chap 7.1, 6.3, 5.4.
Lecture 23 Turing Machines Topics: Pumping Lemma for CFL Example Chomsky hierarchy What’s Computable ? Turing Machines November 24, 2008 CSCE 355 Foundations.
Theory of Computation. Introduction to The Course Lectures: Room ( Sun. & Tue.: 8 am – 9:30 am) Instructor: Dr. Ayman Srour (Ph.D. in Computer Science).
Lecture 16 Cocke-Younger-Kasimi Parsing Topics: Closure Properties of Context Free Languages Cocke-Younger-Kasimi Parsing Algorithm June 23, 2015 CSCE.
Closed book, closed notes
Normal Forms for CFG’s Eliminating Useless Variables Removing Epsilon
Lecture 15 Pumping Lemma.
Review : Theory of Computation
Linear Bounded Automata LBAs
Language and Grammar classes
Complexity and Computability Theory I
Automata and Languages What do these have in common?
Natural Language Processing - Formal Language -
Context Sensitive Grammar & Turing Machines
CSCE 355 Foundations of Computation
7. Properties of Context-Free Languages
The chomsky hierarchy Module 03.3 COP4020 – Programming Language Concepts Dr. Manuel E. Bermudez.
CS314 – Section 5 Recitation 3
PDAs Accept Context-Free Languages
FORMAL LANGUAGES AND AUTOMATA THEORY
Lecture 14 Grammars – Parse Trees– Normal Forms
Jaya Krishna, M.Tech, Assistant Professor
Course 2 Introduction to Formal Languages and Automata Theory (part 2)
CSE322 Chomsky classification
CSE322 The Chomsky Hierarchy
A HIERARCHY OF FORMAL LANGUAGES AND AUTOMATA
Jaya Krishna, M.Tech, Assistant Professor
Context-free Languages
Chapter Fourteen: The Context-Free Frontier
Definition: Let G = (V, T, P, S) be a CFL
NORMAL FORMS FDP ON THEORY OF COMPUTING
7. Properties of Context-Free Languages
فصل دوم Context-Free Languages
The Pumping Lemma for CFL’s
Properties of Context-Free Languages
Department of Computer Science & Engineering
The Pumping Lemma for CFL’s
CS21 Decidability and Tractability
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Chapter 2 Context-Free Language - 02
Limitations of pushdown automata
Language translation Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
The Pumping Lemma for CFL’s
Language translation Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Sub: Theoretical Foundations of Computer Sciences
The Pumping Lemma for CFL’s
Language translation Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Limitations of context-free languages
Language translation Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
The Chomsky Hierarchy Costas Busch - LSU.
Context-Free Languages
Presentation transcript:

Lecture 22 Pumping Lemma for Context Free Languages CSCE 355 Foundations of Computation Lecture 22 Pumping Lemma for Context Free Languages Topics: Normal forms Pumping Lemma for CFLs Closure properties November 19, 2008

Last Time: New: Useless symbols: generating symbols, useful symbols Algorithm for generating and reachable symbols Removal of useless symbols Removal of epsilon productions; Removal of unit productions Chomsky normal form New: Chomsky Hierarchy Pumping Lemma for Context Free Languages

Algorithm for generating and reachable symbols Useless symbols: generating symbols, useful symbols Algorithm for generating and reachable symbols Removal of useless symbols Removal of epsilon productions; Removal of unit productions Chomsky normal form

Chomsky Normal Form A CFG (Context Free Grammar) is in Chomsky Normal form if productions are one of the following two forms: A  BC A  a References http://www.chomsky.info/

Conversion to Chomsky Normal Form Remove: ε-productions, unit productions A  BCDE A  abc In general For each terminal ‘a’ create a new non-terminal Na with Na  a added as a production A  B1B2…Bk create a new non-terminals C1C2…Ck and replace the production with A  B1C1 and Ci  Bi+1Ci+1 for i=1,…k-3 Ck-2  Bk-1Bk

Example

Regular Grammars A CFG is regular if all productions are of the form: A  a or A  aB Note sentential forms in a derivation based on a regular grammar have a unique form! What is it ? Grammar  NFA construction Create a state for each nonterminal. A  aB means δ(A, a) = B and A  a means δ(A, a) = Qfinal and

Example

Chomsky Hierarchy http://en.wikipedia.org/wiki/Chomsky_hierarchy Grammar Languages Automaton Production rules (constraints) Type-0 Recursively enumerable Turing machine α  β no restrictions Type-1 Context-sensitive Linear-bounded non-deterministic Turing machine αAβ  αγβ Type-2 Context-free Non-deterministic pushdown automaton A  α Type-3 Regular DFA A  a or A  aB

Chomsky Hierarchy Venn Diagram

Backus Naur Form (BNF) Backus Naur Form John Backus Peter Naur N ::= α | … | β (just a CFG) http://en.wikipedia.org/wiki/Backus-Naur_form John Backus Fortran compiler http://en.wikipedia.org/wiki/John_Backus Peter Naur http://en.wikipedia.org/wiki/Peter_Naur

Greibach Normal Form Each production RHS starts with a terminal A  aα or S ε http://en.wikipedia.org/wiki/Greibach_normal_form

Showing Languages are not CFLs Recursive productions A  a A | b B  B a | b D  aDb | d A * α A β

Pumping Lemma for CFLs Let L be a CFL. Then there exists a constant n such that if z is a string in L of length at least n, then we can write z = uvwxy such that |vwx| =< n |vx| > 0 uviwxi y is in L for all i >= 0.

Idea behind proof Assume CNF (or do for L(G)-{ε}) Consider Parse Tree Sufficiently long string z, means the parse tree must be sufficiently big.

Similarities to Pumping Lemma for Regular Languages Given an arbitrary n. Carefully choose z in L (depending on n) with |z| >= n. Then for any partition z = uvwxy that satisfies |vx| > 0 |vwx| <= n We must be able to “pump”, i.e. uviwxiy is in L for all i >= 0

Example L = {anbncn | n > 0} Given L as above, suppose we chose n for the Pumping Lemma (for CFLs). Choose z = Consider arbitrary partition of z = uvwxy satisfying | vwx| =< n |vx| > 0 Then show …

Example

Homework 7.1.4 7.1.3 7.1.6