Problem_Set_04

Problem_Set_04 - w 1/8(W) ARSDIGITA VNIVERSITY Month 8:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
V N I V E R S I T Y Month 8: Theory of Computation Problem Set 4 Solutions - Rusty Chris, Dimitri Kountourogiannis, and Mike Allen 1. Context Free or Not a. CF. Here is a grammar that will generate the language. S -> 1A0 A -> 1A0 | B B -> CC C -> 0D1 D -> 0D1 | e b. Not CF. Assume for the purpose of contradiction that it is. Then let the pumping length be p. Consider the string s=0 p 1 p #0 p 1 p , which is in the language. If we decompose s into s=uvwxy as in the statement of the pumping lemma, there are three cases to consider. 1. If vwx is contained in the first half of the string s, then pumping up even once (that is, taking the string uv 2 wx 2 y) will give us a string where the first half is longer than then second half, which means it can't be a substring of the second half. 2. If vwx is contained completely in the second half, then when we pump down (that is, take the string uwy). Then the second half will be shorter than the first half (since |vwx|>=1) and so the pumped down string will not be in the language. 3. If vwx overlaps with the symbol #, then it must be the case that the # is contained in w, or else pumping up would give too many # symbols. So either the v will be a string of 1's or the x will be a string of 0's or both (We need the fact that |vwx| <= p here). If v is a nonempty string of 1's then pumping up will give the left half more 1's then the right side, so the left side will not be a subset of the right side. If x is a nonempty string of zeros then pumping down will give the right side fewer zeros than the left so the left side will not be a subset of the right side. In any case we come to the conclusion that no matter how we choose the decomposition, the conditions of the pumping lemma will be violated. So the language cannot be regular. c. Not CF. Suppose it is. Then let the pumping length be p. Consider the string s=0 p 1 p 01 p , which is in the language. If we decompose s into s=uvwxy as in the statement of the pumping lemma, then an argument like the previous one shows that if vwx is anything but the lone zero between the ones, then pumping up will give you something that is not in the language. On the other hand if vwx is the lone zero, then pumping down will give you. 0 p 1 p 1 p , which is not in the language. This contradicts the pumping lemma, so therefore the language is not context free. d. CF. Here is a grammar that generates the language, with some comments on the side to explain what each non-terminal represents. 页码,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/23/2011 for the course CS 627 taught by Professor Friesen during the Spring '11 term at Texas A&M.

Page1 / 8

Problem_Set_04 - w 1/8(W) ARSDIGITA VNIVERSITY Month 8:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online