140 likes | 161 Views
[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 ) * vAz ) * vwAyz ) * 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].
E N D
[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 )* vAz )* vwAyz )* 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) be a CFG. Suppose we have a string u 2 L(G) with the following derivation: S )* vAz )* vwAyz )* 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 ?
[Section 8.1] Pumping Lemma for CFL 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 A1A2 where A,A1,A22 V and 2 (plus we allow the rule S ). Let’s look at a derivation tree for some u 2 L(G).
[Section 8.1] Pumping Lemma for CFL 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
[Section 8.1] Pumping Lemma for CFL Example: L = { akbkck | k ¸ 0 }
[Section 8.1] Pumping Lemma for CFL Example: L = { aibjck | 0 · i · j · k }
[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 difference.
[Section 8.2] Closure Properties, Part II Lemma: CFL’s are closed under intersection with a regular language.
[Section 8.2] Closure Properties, Part II Example: L = { w 2 {a,b,c}* | na(w) = nb(w) = nc(w) }
[Section 8.3] Decision Problems for CFL’s • 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 ?
[Section 8.3] Decision Problems for CFL’s • 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 = ; ?
[Section 8.3] Decision Problems for CFL’s • 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 ?