Department of Computer Science & Engineering

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.
CSCI 3130: Formal languages and automata theory Tutorial 5
Erik Jonsson School of Engineering and Computer Science FEARLESS Engineering CS 4384 – 001 Automata Theory Thursday: Context-Free.
Closure Properties of CFL's
CS 3240: Languages and Computation Properties of Context-Free Languages.
Examples for Context-free Language and Pumping Lemma CSC3130 Tutorial 5 Xiao Linfu Department of Computer Science & Engineering.
Applied Computer Science II Chapter 2 : Context-free languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany.
1 CSC 3130: Automata theory and formal languages Tutorial 4 KN Hung Office: SHB 1026 Department of Computer Science & Engineering.
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
104 Closure Properties of Regular Languages Regular languages are closed under many set operations. Let L 1 and L 2 be regular languages. (1) L 1  L 2.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Normal forms for Context-Free Grammars
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.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Chapter 12: Context-Free Languages and Pushdown Automata
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 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.
Context-Free and Noncontext-Free Languages Chapter 13 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.
Review for final pm. 2 Review for Midterm Induction – On integer: HW1, Ex 2.2.9b p54 – On length of string: Ex p53, HW2, HW3.
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.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
CFL Big Picture. Context Free Languages Conclusion We have studied the class of context free languages (CFL) We saw two different ways to express a CFL.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Limitations.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Transparency No. 1 Formal Language and Automata Theory Homework 5.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Properties of Regular Languages 1.Closure 2.Union 3.Concatenation 4.Complement(Negation)
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
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).
Closed book, closed notes
Properties of Context-Free Languages
Review : Theory of Computation
CSCE 355 Foundations of Computation
7. Properties of Context-Free Languages
Lecture 22 Pumping Lemma for Context Free Languages
CSE 105 theory of computation
PDAs Accept Context-Free Languages
FORMAL LANGUAGES AND AUTOMATA THEORY
Jaya Krishna, M.Tech, Assistant Professor
More on Context Free Grammars
An Interactive Approach to Formal Languages and Automata with JFLAP
Chapter Fourteen: The Context-Free Frontier
4. Properties of Regular Languages
Definition: Let G = (V, T, P, S) be a CFL
7. Properties of Context-Free Languages
CHAPTER 2 Context-Free Languages
Deterministic PDAs - DPDAs
The Pumping Lemma for CFL’s
Properties of Context-Free Languages
The Pumping Lemma for CFL’s
Cpt S 317: Spring 2009 Sampath Kumar S, AP/CSE, SECE
Subject Name: Finite Automata & Formal Languages Subject Code 10CS56.
Chapter 2 Context-Free Language - 02
Limitations of pushdown automata
CSE 105 theory of computation
The Pumping Lemma for CFL’s
Applications of Regular Closure
Sub: Theoretical Foundations of Computer Sciences
The Pumping Lemma for CFL’s
Limitations of context-free languages
CFL Big Picture.
CSE 105 theory of computation
Presentation transcript:

Department of Computer Science & Engineering CSC3130 Mid-term Review bridger.zhao@gmail.com Department of Computer Science & Engineering

Scope: regular languages DFA, NFA and conversion from NFA to DFA. Regular expression. Equivalence of DFA, NFA and regular expression. Closure properties of regular languages. Pumping lemma for regular languages. DFA minimization algorithm, DFA equivalence. CSC3130 Tutorial One 1/13/2019

Scope: context free languages Context free grammars. Derivations, parse trees, and ambiguity. Removal of ε and unit productions, Chomsky Normal Form. The CYK parsing algorithm. Pushdown automata. Pumping lemma for context-free languages CSC3130 Tutorial One 1/13/2019

NFA to DFA & State minimization CSC3130 Tutorial One 1/13/2019

DFA Hacking Let L be a regular language, L’={u|uv is in L and |u|=|v|}. That is, L’ is the first halves of strings in L. Prove that L’ is also regular. Hints: Let M be the DFA for L, How do we characterize a middle state? CSC3130 Tutorial One 1/13/2019

Closure Properties For regular languages: union, intersection, concatenation, Kleen closure, reverse, complement, etc. For context free languages, exclude intersection and complement. Usage: is L L regular? Is non palindromes regular? CSC3130 Tutorial One 1/13/2019

Context Free Language S → |aaSbbb CFG to PDA see 08L10,17/23 CSC3130 Tutorial One 1/13/2019

CNF Consider the following simple grammar: A  cA | a B  ABC | b C  c How to convert this grammar to CNF? CSC3130 Tutorial One 1/13/2019

Conversion into CNF A B1B2…Bn or Step 1: Convert every production into either: A B1B2…Bn or A a e.g. A  bCDeF becomes: A  BCDEF B  b E  e CSC3130 Tutorial One 1/13/2019

Conversion into CNF e.g. A  BCDEF becomes: Step 2: Convert production of the form A B1B2…Bn into A  C1C2 : e.g. A  BCDEF becomes: A  BX X  CY Y  DZ Z  EF CSC3130 Tutorial One 1/13/2019

Example Convert the following CFG into Chomsky Normal Form: S   S  ABBA B  bCb A  a C  c CSC3130 Tutorial One 1/13/2019

Solution Result: S   S   S  ABBA S AE B  bCb E BF A  a F BA Step 1: B bCb becomes B DCD D b Step 2: S  ABBA becomes S AE E BF F BA B DCD becomes B DG G CD Result: S   S AE E BF F BA B DG G CD A  a C  c D b S   S  ABBA B  bCb A  a C  c CSC3130 Tutorial One 1/13/2019

Pumping Lemma for CFL L = { ww | w is in {0,1}* } Assume L is a CFL Let n be the Pumping Lemma constant Consider z = 0n1n0n1n, |z| = 4n > n We want write z = uvwxy with |vwx|  n and |vx| 1 There are several cases for uvwxy CSC3130 Tutorial One 1/13/2019

Pumping Lemma for CFL Case 1: vwx is within the first block 0’s v and x must contain 0’s Let vx consist of k 0’s, where k > 0 Choose i=0, uviwxiy = 0n-k1n 0n1n If 0n-k1n 0n1n in form of ww, the end of first w must lie in the second block of 0’s Then, the two w’s are in the different pattern:0+1+0+ and 0+1+.So, 0n-k1n 0n1n  L 0n1n0n1n CSC3130 Tutorial One 1/13/2019

Pumping Lemma for CFL 0n1n0n1n Case 2: vwx spread over the first block of 0’s and first block of 1’s vx has at least one 0’s or one 1’s Let vx consist of k 0’s and p 1’s, where k0 ,p>0 or k>0,p 0 Choose i=0, uviwxiy = 0n-k1n-p 0n1n If 0n-k1n-p 0n1n in form of ww, the end of first w must lie after the first block of 1’s Then, the number of 1’s is different in two w. So, 0n-k1n-p 0n1n  L CSC3130 Tutorial One 1/13/2019

Pumping Lemma for CFL Case 3: vwx is within the first block of 1’s v and x must contain 1’s Let vx consist of k 1’s, where k > 0 Choose i=0, uviwxiy = 0n1n-k 0n1n If 0n1n-k 0n1n in form of ww, the end of first w must lie in the second block of 0’s Then, the number of 1’s is different in two w. So, 0n1n-k 0n1n  L. 0n1n0n1n CSC3130 Tutorial One 1/13/2019

Pumping Lemma – Example 0n1n0n1n Case 4: vwx spread over the first block of 1’s and second block of 0’s vx has at least one 1’s or one 0’s. Let vx consist of k 1’s and p 0’s, where k 0,p>0 or k>0,p 0 Choose i=0, uviwxiy = 0n1n-k 0n-p1n For 0n1n-k 0n-p1n in form of ww, if the end of first w lie in the first block of 1’s, then the number of 0’s is different in two w. if the end of first w lie in the second block of 0’s, then the number of 1’s is different in two w. So, 0n1n-k 0n-p1n  L CSC3130 Tutorial One 1/13/2019

Pumping Lemma for CFL Other cases: vwx is within the second half of z the argument is symmetric to the cases where vwx is within the first half of z We can conclude that L = { ww | w is in {0,1}* } is not context free. 0n1n0n1n 0n1n0n1n 0n1n0n1n CSC3130 Tutorial One 1/13/2019