Nathan Brunelle Department of Computer Science University of Virginia www.cs.virginia.edu/~njb2b/theory Theory of Computation CS3102 – Spring 2014 A tale.

Slides:



Advertisements
Similar presentations
Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Advertisements

Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Pushdown Automata CPSC 388 Ellen Walker Hiram College.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
CS 3240: Languages and Computation Properties of Context-Free Languages.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Chap 2 Context-Free Languages. Context-free Grammars is not regular Context-free grammar : eg. G 1 : A  0A1substitution rules A  Bproduction rules B.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
Fall 2004COMP 3351 NPDA’s Accept Context-Free Languages.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2009 with acknowledgement.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Normal forms for Context-Free Grammars
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CS 3240: Languages and Computation Pushdown Automata & CF Grammars NOTE: THESE ARE ONLY PARTIAL SLIDES RELATED TO WEEKS 9 AND 10. PLEASE REFER TO THE TEXTBOOK.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
CSCI 2670 Introduction to Theory of Computing September 21, 2005.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
نظریه زبان ها و ماشین ها فصل دوم Context-Free Languages دانشگاه صنعتی شریف بهار 88.
Pushdown Automata CS 130: Theory of Computation HMU textbook, Chap 6.
Pushdown Automata (PDAs)
Context-free Languages
Context-free Languages Chapter 2. Ambiguity.
CSCI 2670 Introduction to Theory of Computing September 22, 2005.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
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.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
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,
January 20, 2016CS21 Lecture 71 CS21 Decidability and Tractability Lecture 7 January 20, 2016.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
Transparency No. 1 Formal Language and Automata Theory Homework 5.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
 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 154 Formal Languages and Computability March 15 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Theory of Languages and Automata By: Mojtaba Khezrian.
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
NPDAs Accept Context-Free Languages
CSE 105 theory of computation
PDAs Accept Context-Free Languages
Lecture 17 Oct 25, 2011 Section 2.1 (push-down automata)
NPDAs Accept Context-Free Languages
DPDA Deterministic PDA
Context-free Languages
Context-Free Grammars
فصل دوم Context-Free Languages
COSC 3340: Introduction to Theory of Computation
Deterministic PDAs - DPDAs
Chapter 2 Context-Free Language - 01
COSC 3340: Introduction to Theory of Computation
CS21 Decidability and Tractability
DPDA Deterministic PDA
CS21 Decidability and Tractability
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Parse Tree Describes derivation of a string from a CFG Examples: S→aSaa|B B→BB|b|ε S S S B BB aa aa b b S  a for each a  L S  (S) | SS | S* | S+S S S S SS (a+b)*

Pumping Lemma for Context Free Languages If L is a CFL then there is some number p such that for any string s in L where |s|>p we can divide s into 5 substrings s=uvxyz in a way to satisfy all of the following: 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Proof: Consider the CFG for L. The grammar has a finite number of production rules. If a string is long enough, some variable must have been reached twice. S R R uvxyz S R u x z S uz R vy R vxy R

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Example: Consider: If any of a,b,c are not part of vy then we definitely fail rule 1. Because of rule 3 if v contains the letter ‘a’ then y cannot contain the letter ‘b’

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Example:. Consider: If neither a,c or b,d are not part of vy then we definitely fail rule 1. Because of rule 3 if v contains the letter ‘a’ then y cannot contain the letter ‘c’ If v contains the letter ‘b’ then y cannot contain the letter ‘d’

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Example: Consider: If I modify the first set of ‘a’s then I must also modify the second set. If v contains one of the first set of ‘a’s then y cannot contain one of the second set due to rule 3. The case for the ‘b’s is similar.

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Example: Prove its not context free for extra credit! Triple extra credit if you show the following first: If |∑|=1 then for any language, if L is context free then L is also regular

Pumping Lemma for Context Free Languages Does EqLenCat Preserve Regularity? No, Let A=a*, B=b*, Does EqLenCat Preserve Context Freeness? No, Let,. Then If A,B are regular, is EqLenCat Context Free? Yes, by construction of PDA. Idea: Build a PDA which simulate the FSA for A, where it pushes a character onto the stack for each input. It then non- deterministically switches to the FSA for B, where it pops from the stack for each input. Accept if in accept state of B with empty stack

Pumping Lemma for Context Free Languages If A,B are regular, is EqLenCat Context Free? Modified Concatenation Construction: a a a stack AB ε ε Push ‘a’ on each transition Pop ‘a’ on each transition

Pumping Lemma for Context Free Languages Does YesNo Preserve Regularity? Yes, Does YesNo Preserve Context Freeness? No. Idea: show that for an arbitrary context free language L, YesNo(L) is context free iff its complement is context free

Pumping Lemma for Context Free Languages Does YesNo Preserve Context Freeness? Consider a CFL language L whose complement is not context free. We will assume that L contains ε. We will also assume that ‘$’ is not a character in Σ. Let Since So if YesNo preserves context-freeness then L complement must be context free

Here Be an extra slide

Pumping Lemma for Context Free Languages 1.For each i≥0, 2.|vy|>0 3.|vxy|≤p Proof: Consider the CFG for L. The grammar has a finite number of production rules. If a string is long enough, some rule must have been applied twice. S R R uvxyz S R u x z S R R uvxyz R vy