# Questions and Answers on Homework Assignment #2

#### HW#1 is due on paper in class, Friday 27 February 2009

Question text is in black, my answers in blue.

• Question 2.1, posted 22 February:

It's an extra letter of the input alphabet, so that Σ here is {0,1,\$}. A typical string in the language is "00011\$01001", because the binary "9" after the "\$" is three times the binary "3" before it.

We often use "\$" for a letter that serves only as punctuation, such as the stack alphabet letter that is used to mark the bottom of the stack in the book and in many of my examples in lecture.

• Question 2.2, posted 22 February:

In Problem B-1, may I assume that the binary strings have no leading zeroes? I'm worried that if there are some, a string made up of just leading zeroes could pump without changing the meaning of the string, so that I won't get a contradiction from the Pumping Lemma.

No, you can't assume that, because I didn't give you that as part of the definition. So "00011\$1001" is a perfectly good string in the language. But this shouldn't be a problem for you.

First off, this question is almost trivial using Myhill-Nerode -- it's very easy to come up with an infinite set of pairwise L-distinguishable strings, and prove that any two of them are L-distinguishable. But if you insist on using the Pumping Lemma, remember that you get to pick the string w that will break up as xyz, and you may pick any w that is long enough (longer than p letters for this arbitrary number p). Your observation about leading zeroes is a good one, so you may want to pick a w without leading zeroes.

• Question 2.3, posted 22 February:

You've assigned Problem 2.42 parts a and b as separate problems, but 2.42 does not have separate parts. Is there some mistake?

Yes, thanks. I meant Problem 2.43, which does have two parts, and you are assigned 2.43(a) for ten points and 2.43(b) for five. I've corrected this on the assignment page.

• Question 2.4, posted 25 February:

In problem 2.9, it says that aibjck is in the language if "i=j or j=k". What about "i=j=k"? Is the empty string in this language?

Remember that "or" in mathematics is "inclusive or" unless it specifically says otherwise. So yes, if i=j=k, then "i=j or j=k" is true and the string is in the language. And since for the empty string i=j=k=0, the empty string is in the language as well.

• Question 2.5, posted 25 February:

In 2.43b, I'm supposed to describe what happens for an alphabet with three or more letters, and then "prove my answer". That seems a bit vague to me. I can see that what I did in 2.43a won't work, but that doesn't prove that there isn't some other clever way to construct a PDA that does work. Is it enough to prove that the 2.43a construction doesn't work, or do I have to do more?

You're right that "describe what happens" means "is the result of 2.43a still true, or not?". To answer that question with a proof, you have to either show that the SCRAMBLE of a regular language is always context-free, or find an example of a regular language whose SCRAMBLE is not context-free. This requires proving that a language is not context-free, and after today's lecture you know how to do this. Actually you may be able to avoid doing a CFL Pumping Lemma proof here, if you can use a language that's proved to be non-context-free in the text, or to be proved so in another exercise that's assigned.

• Question 2.6, posted 26 February:

Whoops, your "corrected" HW#2 assignment still referred to 2.42 although you apparently meant to change it to 2.43. Can I still get any credit for doing 2.42?

Sure, since I made the mistake and 2.42 is a perfectly good question, we'll give up to ten points extra credit for it. Might as well give a chance of redemption to those who messed up HW#1. So here, Y is the set of strings made up of blocks of 1's separated by single #'s, where no two of the blocks have the same length. My solution for this is a fairly sophisticated use of the CFL PL to get a contradiction, which is probably why Sipser starred the problem.

• Question 2.7, posted 26 February:

In answering questions like 2.12, converting CFG's to PDA's, may I use the "shorthand" notation for PDA transitions that pushes or pops multiple characters? I know how to eliminate these transitions by adding extra states, but it's tedious and makes the PDA's less readable.

I agree. The shorthand notation is fine.