Download presentation
Presentation is loading. Please wait.
Published byIris Daniels Modified over 6 years ago
1
Non-Context-Free Languages Sections: 2.3 page 123 October 17, 2008
CS310 Non-Context-Free Languages Sections: 2.3 page 123 October 17, 2008
2
Pumping Lemma (take two)
Theorem: For any CFG there is an equivalent grammar in CNF. Pumping lemma (CFG): Suppose A is a CFG. There exists a number p such that if s A and |s| p then s = udxyz where udixyiz A, i 0 |dy| > 0 |dxy| p For the NFA, P was the number of states in the machine. Here P is the number of Non-Terminals in the language. Key, we can pump a string and keep it in the language. By pumping the string we add a level to the parse tree which could produce pumped terminals around the middle. Note: Your book ugses uvxyz But, capital V is the set of variables for the grammar so that can get confusing
3
Pumping a Parse Tree T T | | R R ud2xy2z u d x y z u d y z d x y
4
Proof Suppose A is a CFG in CNF and s A, |s| p = 2 |V|+1 2 ?
The height of the parse tree for s is ?
5
Example L = {aibici | i 0} a PDA cannot represent this. Why?
Pumping Lemma: s = u= d= x= y= z=
6
Example L = {aibjck | k j i 0} a PDA cannot represent this. Why?
Pumping Lemma: s = u= d= x= y= z=
7
Example L = { ww | w {0, 1}* } s =
8
Example L = { w # x | wR is substring of x; w,x {0, 1}* }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.