CMPSCI 601: Theory of Computation

David Mix Barrington

Summer, 2003

This page will contain interesting questions I have received from students in CMPSCI 601, together with my answers. These will be mostly questions related to the current homework -- links to previous questions and answers will be at the bottom of this page. Questions are in black, answers in blue. Most recently answered questions are listed first.

Question 1.8, 18 June 2003

In question 4, is it enough to prove that it is possible to construct a Turing machine using a two-stack PDA? Or, do I also have to prove that it is possible to construct a two-stack PDA from a Turing machine?

You are asked to show that:

If you show that any TM can be simulated by a two-stack PDA, this does (b). You still have to do (a), which is easier but not completely obvious. (You may, if you like, quote the theorem about two TM tapes being simulated by one tape -- this makes the proof of (a) simpler.

Question 1.7, 16 June 2003

In question 5, are the input strings u and v separated by a space, or are they concatenated together?

Separated by a space is fine. It's clear to M in some way which part of the input is u and which is v.

If the input strings are separated by a space, I think it would be obvious that the Turing machine could tell which string is in A and which isn't by giving two separate outputs, one for each input string.

It isn't obvious, because you aren't given a machine that decides whether a string is in A. You are only told that A is recursively enumerable, not recursive.

If the input strings are concatenated together, then the Turing machine might have more trouble making the determination.

Yes, if M had to decide where the break between u and v was, this would be harder. But it doesn't have to decide this.

Question 1.6, 16 June 2003

In question 2, should one of the questions to show that L(M) is regular have machine M leaving string w to the left instead of the right?

If the machine M started to read w from the right, I'd basically be reading the reverse of w, and if w were regular then its reverse would be too.

I can see that I might leave w to the left when starting to read from the right end of w, but I don't see how I would leave w to the right unless I backtracked and read over the input from right to left, and then left to right.

If w is the input, the machine will begin at the left and leave on the right -- if the machine ever leaves w on the left we say that it has crashed.

But if the input is wx, where w and x are two nonempty strings, then it's possible that the machine will leave w to the right, then re-enter it on the right, then leave again, then enter again, and so on -- as long as it finally leaves wx on the right.

Question 1.5, 16 June 2003

Following are a few questions regarding homework #1.

1. For question #1, when you say that every a in the sting has a b immediately before it and immediately after it, do you mean a's can share b's, for example that babab is acceptable, or does each a need its own pre and post b, for example babbab?

The a's may share b's, so "babab" is in the language. The trick with questions like this is to read them like a lawyer. What the rule says is that each a has a b before and a b after -- since it doesn't say that these b's have to be distinct, there's no reason they need to be.

2. For question #2, question 2 asks "if M is started on the right end of ?" Does this mean the rightmost end, that is the cell just before the sequence of blanks that marks the end of the tape?

Yes, it means the rightmost letter of the string. You want to know what happens if the machine moves from the first blank leftward onto the last letter of the string.

Question 1.4, 16 June 2003

I've created the 4-state DFA for the language A that includes the "death state".

How do I determine the four Myhill-Nerode equivalence classes and give a regular expression for each by looking at the 4-state DFA?

Could you give me an example of a Myhill-Nerode equivalence class and its regular expression on a simple language?

Here's a simple example. Let P be the language over {a,b} consisting of strings with an odd number of a's. The two Myhill-Nerode classes are:

If x and y are both in C_1 or both in C_2, then for any string z, it should be clear that xz and yz are either both in P or both not in P.

The natural DFA for P has two states, a final state corresponding to C_1 and a nonfinal state corresponding to C_2. Since the empty string is in C_2, the start state is the C_2 state.

Question 1.3, 16 June 2003

Just looking at Q1.....I know that bab and babbab would be in the language...but what about baab ???

My vote is NO...since your wording is 'for EVERY A'....and since either 'a' would have BOTH a b before and a b after it...this would NOT be in the language...

You're right, baab is not in the language because neither of the two a's meets the condition. The first a does not have a b after it, and the second does not have a b before it.

Question 1.2, 16 June 2003

I was working on question 1, and I came up with a DFA with only 3 states that accepts the language A. My DFA has one final state, one state that is both a start state and a final state, and one intermediate state. Does this mean that there would only be three (instead of four) Myhill-Nerode equivalence classes, since "the number of equivalence classes is equal to the number of states in the minimum-state DFA that accepts A"?

It would if your 3-state DFA were correct, but it isn't. Remember that a DFA must have an arrow for each letter for each state. It sounds like you have left out the "death state", where strings go that can never, by any future letters, go back to an accepting state.

Question 1.1, 10 June 2003

I was looking at question 2, dealing with a two-way DFA and showing that it recognizes a regular language. Besides approaching the problem as you suggest in your hint, I was wondering if it could also be correct to show that two-way DFAs are equivalent to one-way DFAs. Then if the two-way DFA recognizes a language, the one-way DFA will also recognize it, and one-way DFAs recognize regular languages.

It is true, of course, that a 2WDFA can be simulated by a one-way DFA. The trick would be explaining how to construct the one-way from the two-way, and I don't know any way to do that that is simpler than the hint I gave. You could of course never mention regular languages, and go from the Myhill-Nerode equivalence classes directly to a DFA as in the proof of Myhill-Nerode. But somewhere you will have to do the work to show that the two-wayness doesn't help, and this will involve something like the way I suggest. You may find this called a "crossing sequence argument" in the literature.

Last modified 18 June 2003