Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation."— Presentation transcript:

1

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

3 The pumping lemma for context-free languages 2.3.a 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 i  0, uv i xy i z  L; 2. |vy| > 0; 3. |vxy|  p. uvxyzuvxyz uxzuxz uvvxyyz uvvvxyvvz uvvvvxyyyyz uvvvvvxyyyyyz

4 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 … “((0)*)*” is a regular expression u = “( v = ( x = 0 y = )* z = )*” is a regular expression uv 0 xy 0 z: “(0)*” is a regular expression uv 1 xy 1 z: “((0)*)*” is a regular expression uv 2 xy 2 z: “(((0)*)*)*” is a regular expression uv 3 xy 3 z: “((((0)*)*)*)*” is a regular expression

5 Using the pumping lemma for proving that certain languages are not CF 2.3.c Giorgi Japaridze Theory of Computability Example 2.36: Show that the following language is not CF: B = {a n b n c n | 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. aaaaaabbbbbbbbcccc BB

6 Regular vs context-free vs computer-recognizable languages 2.3.d Giorgi Japaridze Theory of Computability Regular languages Context-free languages {a n b n | n  0} {a n b n c n | n  0} Computer-recognizable languages


Download ppt "Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation."

Similar presentations


Ads by Google