This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Problem Set 4 Solutions CS373  Spring 2011 Due: Thursday April 7 at 2:00 PM in class (151 Everitt Lab) Please follow the homework format guidelines posted on the class web page: http://www.cs.uiuc.edu/class/sp11/cs373/ 1. Pumping Lemma / Ogden's Lemma [ Category : Proof, Points : 15] Ogden's Lemma is a more general version of the pump ing lemma for contextfree languages. It states that for every contextfree language L , there exists an integer m such that for every w L where  w  m , and every choice of m or more distinguished positions in w , there exist strings u,v,x,y,z such that w = uvxyz and the following three conditions hold. A) vy contains at least one distinguished position. B) vxy contains m or fewer distinguished positions. C) For every i , uv i xy i z L . If every position in w is distinguished, then the result is the pumping lemma. Ogden's Lemma allows one to restrict the set of decompositions that need to be considered when proving that a language is not contextfree. i) Let n ( w ) be the number of 's in a string w . Let n 1 ( w ) be the number of 1 's in w . Let n 2 ( w ) be the number of 2 's in w . Use the pumping lemma for CFLs to prove L 1 = { w { , 1 , 2 } *  n ( w ) = min ( n 1 ( w ) ,n 2 ( w )) } is not contextfree. (5 Points) Solution: Assume that L 1 is regular. Let p be the pumping length, and let w = p 1 p 2 p . When w is decomposed into uvxyz , one of two things can happen. One possibility is that vy contains a . If vy contains a , then because  vxy  p , vy cannot contain a 2 . Therefore, uv 2 xy 2 z contains more 's than 2 's. However, since the number of 's must be less than or equal to the number of 2 's, uv 2 xy 2 z 6 L 1 . If vy does not contain a , then vy contains either a 1 or a 2 (or both). Therefore, uv xy z contains fewer 1 's than 's, or fewer 2 's than 's. Since the number of 's must be less than or equal to the number of 1 's and less than or equal to the number of 2 's, uv xy z 6 L . Therefore, L 1 does not satisfy the pumping lemma, so L 1 is not contextfree. ii) Prove that L 2 = { i 1 i + j j  j 6 = i } satis es the pumping lemma for CFLs.(5 Points) Solution: We will show that L 2 satis es the pumping lemma for p = 4 . The way that w L 2 is decomposed to satisfy the pumping lemma will depend on the values of i and j . If i = 0 , then w = 1 j j for some j 2 . Let u = 1 j 1 ,v = 1 ,x = ,y = 0 ,z = 0 j 1 , so that pumping the string is essentially just changing the value of j . Whether 1 the string is pumped up or down, the lowest possible value of j is 1 , so j is never equal to i , so uv i xy i z L 2 . If j = 0 , then w = 0 i 1 i for some i 2 . Let u = 0 i 1 ,v = 0 ,x = ,y = 1 ,z = 1 i 1 , so pumping the string is essentially changing the value of i . The minimum possible value of i when the string is pumped is 1 , so i is never equal to j , so uv i xy i z L 2 ....
View Full
Document
 Spring '08
 Viswanathan,M

Click to edit the document details