Download presentation
Presentation is loading. Please wait.
1
Non-Context-Free Languages
CSC 4170 Theory of Computation Non-Context-Free Languages Section 2.3
2
The pumping lemma for context-free languages
Giorgi Japaridze Theory of Computability Theorem 2.34 (Pumping lemma for context-free languages) If L is a context-free language, then there is a number p (the pumping length) where, if s is any string in L of length at least p, then s may be divided into five pieces s = uvxyz satisfying the conditions: 1. For each i0, uvixyiz L; 2. |vy| > 0; 3. |vxy| p. uxz uvxyz uvvxyyz uvvvxyyyz uvvvvxyyyyz uvvvvvxyyyyyz
3
The pumping lemma in work: example
2.3.b Giorgi Japaridze Theory of Computability S “R” is a regular expression R 0 | ( R )* “0” is a regular expression “(0)*” is a regular expression “((0)*)*” is a regular expression “(((0)*)*)*” is a regular expression … u = “( v = ( x = 0 y = )* z = )*” is a regular expression “((0)*)*” is a regular expression uv0xy0z: “(0)*” is a regular expression uv1xy1z: “((0)*)*” is a regular expression uv2xy2z: “(((0)*)*)*” is a regular expression uv3xy3z: “((((0)*)*)*)*” is a regular expression
4
Using the pumping lemma for proving that certain languages are not CF
Giorgi Japaridze Theory of Computability Example 2.36: Show that the following language is not CF: B = {anbncn | n0} Proof by contradiction: Assume B is CF. Let then p be its pumping length. Select wB with |w| p. By the pumping lemma, w=uvxyz and v and y can be pumped. If either v or y contain more than one type of symbols, then pumping would intermix these symbols in a wrong way. aaaabbbbcccc B aaaababbbbccccc B Thus, one of the three symbols should be neither in neither v, nor in y. aaaabbbbcccc B But then, after pumping, the number of that symbol will not change, while the number of the other symbols will increase. aaaaaabbbbbbbbcccc B
5
Regular vs context-free vs computer-recognizable languages
2.3.d Giorgi Japaridze Theory of Computability Computer-recognizable languages Context-free languages Regular languages {anbn | n0} {anbncn | n0}
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.