Document Sample

CS 373 – Fall 2003 - NMG ****** SOLUTION****post**** September 27, 2003 Homework Assignment 4 for chapter 4, PROB 9 DROPPED Due Friday, 10/3/03 After class Problems related to chapter 4: General directions: 1. Clearly justify all statements in your proofs 2. If using a counter example to disprove, give a SPECIFIC example 3. For pumping lemma questions, Use the text book format of a game against an opponent and all steps must be explained. EXPLICITLY SPECIFY: a. Pumping lemma integer m which starts off the proof. Although you cannot assume a specific value for the integer, show how your knowledge of its existence is used. “m”, must be explicitly shown in your formulas for the pumped string. b. One specific string which you choose c. Form of the partition "the opponent is capable of choosing" as a result of your string choice. d. A value of i which you will use to pump up/down. P1. (10 points) Prove or disprove: If L1 and L2 are non-regular languages, then L1 L2 is non- regular. P2 . (10 points) Show that if L1 and L2 are languages over {a, b} where L1 is regular and L2 is non-regular, then L1 L2 may be either regular or non-regular, depending on L1 and L2. P3. (15 points total )Drill Time!. Use the pumping lemma for regular languages to show that the following languages are not regular (assume contains he symbols used in the definitions of the languages): a. (5 points) L = {a3i bi : i 1} … a warm-up exercise! b. (5 points) L = (an bm : n > m } c. (5 points) Show that L = {ag bh ch : g > 0 and h > 0 . P4. (10 points) Prove that the language: L = { an bj : n/j is an integer, and n 0, j > 0 } is not regular. P5 . (10 points) Use the pumping lemma for regular languages to show that the language below is not regular. L = {an^3 : n > 0 } where n^3 means n3 (problem doing double superscript). Hint: Consider the binomial expansion of (m+1)3. CS 373 Fall 2003 Solution key page 1 P6. (10 points) Find a regular language which is a proper subset of the language: L = {anbn : n 0}. P7. (15 points) Without using the pumping lemma prove that L = {anbm : n m} is not regular. Hint1: Consider the theorems in section 4.1 of Linz. Hint2: Consider theorem 4.2, and the use of the homomorphism. P8. (10 points) Prove or disprove the following: L = {vwv : v,w from {a,b}* and |v|=2} is regular. P9. (10 points) Given the language L = {an bpar : r n+p, and r, n, p 0}. You may assume that L1 = {an bpar : r = n+p} is not regular Without using the pumping lemma prove that L is not regular. You may assume that the language {anbn : n 0 } is not regular. PROBLEM DROPPED ****************************** end of graded part of assignment *************** Additional suggested practice problems related to chapter 4 (not graded) Solutions not given for these problems: Problems from the problems in the Linz book: 4.3.4b – First use some closure theorems to convert the language to a different form, and then use the pumping lemma to show that this converted form is not regular - hence a proof by contradiction. 4.3.5d - use the pumping lemma Other problems: P1: This is a takeoff on an example in the book: = {a, b} L = {w * : w = wr and |w| is odd } Use the pumping lemma to show that L is not regular. Do example 4.9 in which < is replaced by , that is show that: L = {w * : na(w) nb(w) } is not regular using the pumping lemma. The strict inequality version was covered in class, and is in the detailed examples posted on the website. Also study problems for which answers are given in the back of the book. CS 373 Fall 2003 Solution key page 2 Solutions: P1. (10 points) Prove or disprove: If L1 and L2 are non-regular languages, then L1 L2 is non- regular. $Answer: It is not true. Disproof: Let L1 = {anbm : 1 n m } – not regular, by pumping lemma, (variation of {anbn : n 1 }) L2 = {anbm : n > m 1 } – not regular, by pumping lemma, (variation of {anbn : n 1 }) L1 L2 = {anbm : n 1, m 1 } L1 L2 is regular because it is generated by the regular expression: aa*bb* = a+b+ . P2. (10 points) Show that if L1 and L2 are languages over {a, b} where L1 is regular and L2 is non-regular, then L1 L2 may be either regular or non-regular, depending on L1 and L2. $Answer: Case for regular: let L1 = a*b* and L2 = {an bn : n 0}. L1 is regular and L2 is not regular (pumping lemma – assumed done in the past). Because L2 L1, then L1 L2 = L1. Thus L1 L2 is regular. Case for not regular: let L1 = , the empty language which is regular and L2 = {an bn : n 0} which is not regular. Now L1 L2 = L2 . Thus L1 L2 is not regular. Other counterexamples could be given as well. P3. (5 points) part a. Show that L = {a3i bi : i 1} is not regular. $Answer: 1. “Opponent” gives m 2. choose w = a3m bm , w L and |w| > m 3. opponent gets partition w = xyz 4. pump down w0 = a3m-k bm , where |y| = k > 0. The requirements of the language holds only for k = 0, but k 1, thus w L and L is not regular. P3. (5 points) part b. Show that L = {an bm : n > m } is not regular. $Answer: We change to a more convenient notation: L = {ag bh : g > h } Given m w = am+1bm L, and |w| = 2m+1 > m Given partition xyz w = xyz Pumped up word (by i 0) is: wi = am+1-k aik bm choose pumping down to i=0 w0 = am+1-k bm CS 373 Fall 2003 Solution key page 3 Since k 1, m+1-k m if k = 1, number of a’s = number b’s, ==> not in language if k > 1, number of a’s < number b’s, ==> not in language Thus: w0 L thus L is not regular QED P3. (5 points) part c. Show that L = {ag bh ch : g > 0 and h > 0 }is not regular where = {a, b, c}. $Answer: Given the “pumping value” m Choose the word: w = abm cm The partitioned word is w = xyz Must show that all possible partitions of w fails the pumping lemma. We note that because |xy| m, xy is “buried” in the suffix abm . The decomposition of w must have one of two forms and the cases are handled separately: Case 1: In the decomposition, y does not have the symbol “a” in it. x = abf, y=bg, z= bm-g-f cm where |xy| = 1+f+g m or f+g m-1, and g > 0 pumping up by i=2 gives: w2 = abf b2g bm-g-f cm = abm bg cm = abm+g cm , m+g m, then w2 L Case 2: In the decomposition, y has the symbol “a” in it. x = , y=abf, z=bm-f cm |xy| = |abf| = f+1 m, or f m-1 pumping up by i=2 gives: w2 = abf abf bm-f cm = abf abm cm L … wrong format P4. (10 points) Prove that the language: L = { an bj : n/j is an integer, and n 0, j > 0 } is not regular. $Answer: 1. given m from the opponent. 2. Choose w = a2mb2m L, |w| > m 3. w = xyz, |xy| m, 1 |y| = k m 4. xy is totally contained in the prefix of a’s we pump down with i = 0. w0 = a2m-k b2m L, since (2m-k)/2m = 1- k/(2m), is not an integer 1 k m … QED. P5. (10 points) Use the pumping lemma for regular languages to show that the language below is not regular. L = {an^3 : n > 0 } where n^3 means n3 (problem doing double superscript). Hint: Consider the binomial expansion of (m+1)3 CS 373 Fall 2003 Solution key page 4 $Answer: 1. given m 2. choose w = am^3 L, |w| m 3. given partition w = xyz, |xy| m, 1 |y| = k m 4. pump up by i = 2 w2 = a(m^3) + k |w2 | = m3 + k m3 + m, since m k 1 |w2| < m3 + 3m < m3 + 3m2 + 3m + 1 = (m+1)3, since m is positive |w2 | < (m+1)3 but m3 < m3 + k, since k 1 but m3 + k = | w2 | = | a(m^3) + k | thus: m3 < |w2 | < (m+1)3 w2 L because |w2 | lies strictly between two consecutive perfect cubes. Thus L is not regular QED P6. (10 points) Find a regular language which is a proper subset of the language: L = {anbn : n 0}. $Answer: any finite language which is made up of elements of L or he empty language, . P7. (15 points) Without using the pumping lemma prove that L = {anbm : n m} is not regular. Hint1: Consider the theorems in section 4.1 of Linz. Hint2: Consider theorem 4.2, and the use of the homomorphism. $Answer: Assume that L is regular, then By theorem 4.2 the reversal Lr = {bm an : n m } is is also regular. Now apply a homomorphism h(a) = b and h(b) = a, which effectively interchanges the roles of a and b. We have the homomorphic image of : h(Lr) = {am bn : n m } is also regular But the intersection L h(Lr) = {an bn : n 0} must also be regular since the intersection of two regular languages is regular. But we already know that {an bn : n 0} is not regular by the pumping lemma. Thus, we have a contradiction and L must not be regular. P8. (15 points) Prove or disprove the following: L = {vwv : v,w from {a,b}* and |v|=2} is regular. Answer: L can be specified by the regular expression: aa(a+b)*aa + ab(a+b)*ab + ba(a+b)*ba + bb(a+b)*bb The L is regular. CS 373 Fall 2003 Solution key page 5 P9. (10 points) Given the language L = {an bpar : r n+p, and r, n, p 0}. You may assume that L1 = {an bpar : r = n+p} is not regular Without using the pumping lemma prove that L is not regular. You may assume that the language {anbn : n 0 } is not regular. $Answer: PROBLEM DROPPED CS 373 Fall 2003 Solution key page 6

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 6 |

posted: | 3/22/2013 |

language: | English |

pages: | 6 |

OTHER DOCS BY ajizai

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.