CMPSCI 250: Introduction to Computation

David Mix Barrington

Fall, 2004

Question and Answers on HW#7

Due on paper in class, Friday 3 December 2004

Questions are in black, answers in blue

Question #8, 2 December 2004

In a DFA, is the start state also allowed to be the end state?

Yes, there may be no final states, one final state, or many final states, and the start state may or may not be one of the final states.

Question #7, 1 December 2004

To simplify thinking about 9.3.1, suppose we had only four letters in the alphabet instead of 26. Is the string "abcd" equivalent to the string "aabbccdd"? If so, I think that there are 26! classes, and if not, I think that there are infinitely many. Am I on the right track?

Simplifying the problem is a good idea, and so is asking about the equivalence of particular strings. Let's define u to be "abcd" and v to be "aabbccdd". Both of these strings are panalphabetic for the four-letter alphabet. For them to be P-distinguishable, where P is the language of panalphabetic strings, we would have to find a string w such that one, but not both, of the strings uw and vw was in P. Can you tell whether uw and vw are panalphabetic?

Once you know whether those two strings are equivalent to each other, consider whether either is equivalent to "dcba" or "ddccbbaa". (Do all the panalphabetic strings form a single equivalence class?)

Question #6, 1 December 2004

I am thinking that 9.2.4 and 9.2.5 are the same -- neither of them has a DFA because there are an infinite number of different things that can happen.

If one or both of these languages have no DFA, you only know one way to prove it. You have to find an infinite set of strings that are pairwise distinguishable for that language, as is done in the text for the {anbn} language and the parenthesis language. For each language here, is it possible for two different strings to be indistinguishable (or equivalent) for that language? Of course there are infinitely many possible strings. But if strings can be equivalent, then there might be only finitely many equivalence classes.

Question #5, 1 December 2004

I have now built a three-state DFA for 9.1.5, but all of the states are final. Is this right?

Your "DFA" isn't a proper DFA because it doesn't have an arrow for every letter out of every state. If a legal DFA has all final states, it has to accept all strings. You've built what I call a "sub-DFA" in Problem 9.6.1 -- it never has multiple arrows like an NFA but some of its arrows are missing.

Your "DFA" behaves correctly on strings that are in the language. What you need to do is to add a "death state", which is a non-final state with all its arrows leading back to itself. Then add the missing arrows from the former states, making them go to the death state.

Question #4, 30 November 2004

In Problem 9.3.2, the reference to "the Problems in Section 7.2" looks like a mistake.

It is, thanks. Problem 9.3.1 should refer to 9.2.4 and problem 9.3.2 should refer to 9.2.5.

Question #3, 30 November 2004

In 8.3.1, what do you mean by "algorithm"? Should it be pseudocode? Java? Or just an English description?

Any of these are all right as long as it is clear to the graders what your algorithm is going to do (what steps it will take in what order) in all situations. Pseudo-Java is probably the clearest way to do this, but other ways are possible.

Question #2, 29 November 2004

In 9.1.5, may I have multiple start states on my DFA?

No. A DFA must have a single start state. So must an NFA, though in a λ-NFA you could simulate multiple start states by a single start state and some λ-moves.

Question #1, 29 November 2004

What is the difference between parts (a) and (b) of 8.3.1?

For part (a), consider the case where k is 6, so you have to calculate a6 using only six multiplications. Once you figure out how to do this, consider a b that is not a power of two, like 23. The method for getting powers that are powers of two doesn't directly tell you how to do it with other powers. How would you calculate a23 with at most 10 multiplications? (Here "k" is 5, because 23 is bounded above by 25=32.)

Someone pointed out in office hours that a solution to this problem is given in CMPSCI 287 -- you're free to use that solution with attribution. You might also find something useful by googling "repeated squaring" or "powering algorithms".

Last modified 9 November 2004