CSC 4170 Theory of Computation NonContextFree Languages Section

  • Slides: 5
Download presentation
CSC 4170 Theory of Computation Non-Context-Free Languages Section 2. 3

CSC 4170 Theory of Computation Non-Context-Free Languages Section 2. 3

2. 3. a Giorgi Japaridze Theory of Computability The pumping lemma for context-free languages

2. 3. a Giorgi Japaridze Theory of Computability The pumping lemma for context-free languages 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 i 0, uvixyiz L; 2. |vy| > 0; 3. |vxy| p. uxz uvxyz uvvxyyz uvvvxyyyz uvvvvxyyyyz uvvvvvxyyyyyz

2. 3. b Giorgi Japaridze Theory of Computability The pumping lemma in work: example

2. 3. b Giorgi Japaridze Theory of Computability The pumping lemma in work: example 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 … “((0)*)*” is a regular expression uv 0 xy 0 z: uv 1 xy 1 z: uv 2 xy 2 z: uv 3 xy 3 z: u = “( v=( x=0 y = )* z = )*” is a regular expression “(0)*” is a regular expression “((0)*)*” is a regular expression “(((0)*)*)*” is a regular expression “((((0)*)*” is a regular expression

2. 3. c Giorgi Japaridze Theory of Computability Using the pumping lemma for proving

2. 3. c Giorgi Japaridze Theory of Computability Using the pumping lemma for proving that certain languages are not CF Example 2. 36: Show that the following language is not CF: B = {anbncn | n 0} Proof by contradiction: Assume B is CF. Let then p be its pumping length. Select w B 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. aaaaaabbbbcccc B

2. 3. d Giorgi Japaridze Theory of Computability Regular vs context-free vs computer-recognizable languages

2. 3. d Giorgi Japaridze Theory of Computability Regular vs context-free vs computer-recognizable languages Context-free languages Regular languages {anbn | n 0} {anbncn | n 0}