# Problem Set 2

Problem Set 2 is now posted: [PDF] [LaTeX template]. It is due on Tuesday, 16 February.

PS2 covers NFAs (questions 1-3), regular and non-regular languages (questions 4-7), and push-down automata and grammars (questions 8-10). We’ve covered everything for questions 1-3 in class already, will cover what is used for questions 4-7 in tomorrow’ class (Class 5), and will introduce PDAs and grammars next week. Please use the comments on this post to ask questions about PS2.

### 8 comments to Problem Set 2

• mmk2d

For question 5, part a: The restriction for m is listed as 0 >= m <= 27. Is this a typo? (Should it be "0 <= m <= 27"?)

• Ohhhh…you are correct. I meant m is between 0 and 27 inclusive. The answer, though, it actually the same for the restriction that is in the problem set and for the one I actually meant! (The proof is slightly easier with the printed restriction which only allows m = 0, but I’ll accept either version.)

• tdr3b

For NFAs, if a string has a path that leads to an accepting state, are non-accepting states still included in the set of possible states of the machine? I’m thinking that since we know the string will end up in an accepting state, that’s the only state that would be included in Delta star (unless there are multiple accepting states it could be in).

• The delta* function doesn’t really know when the end of the string is reached, and is defined separately from the acceptance rule, to produce the set of possible states after processing the given input string.

The acceptance model for the NFA says that if at least one of those states is an accepting state, the string is accepted. But, the way delta* is defined it doesn’t make sense to remove the non-accepting states from it. It might be that if there was additional input, the accepting path would go through one of those non-accepting states at this point rather than the accepting state.

• jeg8c

I’m having trouble wrapping my head around the language splitting question. Are words of advice in approaching the problem?

• First, make sure you understand what the question is asking for. If you’re unclear on what it means to divide a language into three disjoint infinite regular subsets, break the phrase down to check you understand each word.

Then, I would suggest trying a few examples. Pick a simple infinite regular language, and figure out how to divide it into three disjoint infinite regular subsets. If you’re stuck on this, try doing the same thing with the natural numbers. Then, try another language and see if you can generalize how to do this.

Finally, for a proof you need to show you can do this for any regular language. Think about the properties you know all regular languages have, and how you can construct the three sets.

Note that in general, these steps apply to almost every problem — first, understand the problem; then, try a few simple examples; next, see if you can generalize them; and finally, try to construct a convincing proof that it always works.

• moc8f

My group has had a lot of trouble with problem 5e. We’ve tried using the pumping lemma, construction, and closure, but have had difficulties in each one of these areas. The problem we had with the pumping lemma related to how player 1 could just pick y to be an even number of x’s, making it impossible for player 2 to pick an i such that the string would not be in the language. If this doesn’t make any sense, then perhaps we’re on the wrong track. Any sort of advice would be helpful.

We honestly found 5e harder than 5f (the bonus question).

• You should keep in mind what the question is asking: is the language regular or not. From your answer, it sounds like you are possibly on the right track. If you are using the pumping lemma, a good choice of s is critical. It sounds like you are choosing something like a^na^n which isn’t a great choice. I would also suggest thinking of other ways the same language could be defined – the given definition may not be the simplest way to think of this language.