Pumping Lemma for CFL Section 8 1 Let

  • Slides: 14
Download presentation
Pumping Lemma for CFL [Section 8. 1] Let G = (V, , S, P)

Pumping Lemma for CFL [Section 8. 1] Let G = (V, , S, P) be a CFG. Suppose we have a string u 2 L(G) with the following derivation: S )* v. Az )* vw. Ayz )* vwxyz = u where v, w, x, y, z 2 * and A 2 V. Which other strings (besides u) can be generated by G ?

[Section 8. 1] Pumping Lemma for CFL Let G = (V, , S, P)

[Section 8. 1] Pumping Lemma for CFL Let G = (V, , S, P) be a CFG. Suppose we have a string u 2 L(G) with the following derivation: S )* v. Az )* vw. Ayz )* vwxyz = u where v, w, x, y, z 2 *. Which other strings (besides u) can be generated by G ? vwmxymz 2 L(G) for every m ¸ 0 Is it true that for every sufficiently long u there exist v, w, x, y, z satisfying the above derivation ?

Pumping Lemma for CFL [Section 8. 1] Let G = (V, , S, P)

Pumping Lemma for CFL [Section 8. 1] Let G = (V, , S, P) be a CFG. Suppose G is in Chomsky normal form, i. e. , every rule is of the form A or A A 1 A 2 where A, A 1, A 2 2 V and 2 (plus we allow the rule S ). Let’s look at a derivation tree for some u 2 L(G).

Pumping Lemma for CFL [Section 8. 1] Thm (Pumping lemma for CFL) : Let

Pumping Lemma for CFL [Section 8. 1] Thm (Pumping lemma for CFL) : Let L be a CFL. Then there exists an integer n > 0 such that for every u 2 L with |u| ¸ n there exist strings v, w, x, y, z satisfying: (1) u = vwxyz (2) |wxy| · n (3) |wy| > 0 (4) vwmxymz 2 L for every m ¸ 0

Pumping Lemma for CFL Example: L = { a kb kc k | k

Pumping Lemma for CFL Example: L = { a kb kc k | k ¸ 0 } [Section 8. 1]

Pumping Lemma for CFL Example: L = { a ib jc k | 0

Pumping Lemma for CFL Example: L = { a ib jc k | 0 · i · j · k } [Section 8. 1]

Closure Properties, Part II Lemma: CFL’s are not closed under intersection. [Section 8. 2]

Closure Properties, Part II Lemma: CFL’s are not closed under intersection. [Section 8. 2]

Closure Properties, Part II Lemma: CFL’s are not closed under complement. [Section 8. 2]

Closure Properties, Part II Lemma: CFL’s are not closed under complement. [Section 8. 2]

Closure Properties, Part II Lemma: CFL’s are not closed under difference. [Section 8. 2]

Closure Properties, Part II Lemma: CFL’s are not closed under difference. [Section 8. 2]

Closure Properties, Part II [Section 8. 2] Lemma: CFL’s are closed under intersection with

Closure Properties, Part II [Section 8. 2] Lemma: CFL’s are closed under intersection with a regular language.

Closure Properties, Part II Example: L = { w 2 {a, b, c}* |

Closure Properties, Part II Example: L = { w 2 {a, b, c}* | na(w) = nb(w) = nc(w) } [Section 8. 2]

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES or NO. Give algorithms for the following decision problems : - Given a CFL L (by a PDA or a CFG) and a string x, is x in L ?

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES or NO. Give algorithms for the following decision problems : - Given a CFL L (by a PDA or a CFG), is L = ; ?

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES

Decision Problems for CFL’s [Section 8. 3] A decision problem : answer is YES or NO. Give algorithms for the following decision problems : - Given a CFL L (by a PDA or a CFG), is L finite ?