Problem text in black, solution text in blue.
The following algorithm decides EQNFA:
If the original NFA's have n states each then the DFA's might have as many
as 2n states after the subset construction. The symmetric
difference DFA might have as many as 22n states, and testing it
for emptiness would be a REACH question on a graph of this size, solvable
in 2O(n) steps.
Let h(n) be a function in FDTIME(f(n)), so that h(n) is computable by
a Turing machine M in O(f(n)) steps -- for definiteness we'll say cf(n)
steps for some fixed number c. We know that a Bloop program, with a variable
x representing a configuration of M, can compute the function nextConfig(x)
that returns a number representing the configuration representing M after
running one step from configuration x. It's also easy in Bloop to test
a configuration to see whether it has halted (and if so to extract its output),
and to create a start
configuration for a given input. So we may have a program:
This Bloop program will return h(n) -- we'll never reach the return(0)
at the end because M is guaranteed to halt in cf(n) steps but it might make
our compiler happier.
program runM(n) {
x = startConfig(n);
loop cf(n) times {
x = nextConfig(x);
if halted(x) return output(x);}
return 0;}
There's a simple way to do this from a Bloop program P that computes f.
We alter P as follows:
This computes the number of Bloop steps rather than the number
of Turing machine steps, of course. But if we translate the Bloop program
into a TM and back again, we'll get a Bloop program that takes at least as
many Bloop steps as does the TM that simulates the original Bloop program.
If we let this be P and carry out the conversion above, we'll get a "time"
program that bounds the time of the original Bloop program.
This is not r.e. as K-bar can be reduced to it. Given an input machine N, we want to create M so that N is in K-bar iff M never writes a 1 on the tape. To do this we have M erase its own input and then simulate N on input "N", with the following change -- we replace any "1" in N's alphabet by some other letter, and then have M write a 1 iff it finds that N has accepted. Then M will write a 1 iff N accepts "N" (no matter what the input is to M), and so M will be in the given language iff N is in K-bar. The function f taking M to N is clearly recursive, and reduces K-bar to the given language, so that language is not r.e. at all.
This language is recursive. Consider a machine M' that simulates M until or unless M wants to change a character on the tape, and rejects if it does. M is in the given language iff M' either halts or enters an infinite loop before rejecting, on any valid input. But M' is a two-way DFA, and following the analysis on HW#1 we can determine the language of inputs on which it rejects and then decide whether this language is empty. If it is, then M is in the given language, and if not, it isn't.
This language is r.e. but not recursive. It is r.e. because we can construct a nondeterministic Turing machine N that guesses a string w and then simulates M until or unless it writes a 1, accepting iff it does. Then L(N) is the given language, and we know that the language of an NDTM is always r.e. because the NDTM could be simulated by an ordinary TM.
We prove that the given language is not recursive by reducing K to it. Given a TM N, we let f(N) be a TM that erases its input, simulates N on input "N", and writes a 1 iff this computation accepts. (If "1" is in the alphabet of N, we replace it by a new letter in f(N).) Then N is in K iff f(N) writes a 1 on any input iff f(n) writes a 1 on all input, and we have reduced K to the given language.
Suppose that A is a set of numbers such that if
L(Mi) = L(Mj),
then i and j are either both in A or both not in A. Also suppose that
there is a recursive function f such that f is 1-1 and onto and for any
string w, w is in A iff f(w) is not in A. Prove that A is neither r.e. nor
co-r.e., that is, that neither A nor A-bar is recursively enumerable.
(Correction made 26 June 2003.)
Simply quoting from the proof of the RMS theorem, we know that if
A is not equal to N or to the empty set, then (since it meets the
other condition of the theorem) either K or K-bar must reduce to it.
Is it possible for A to be N or to be empty? No, because then the
reduction from A to A-bar could not exist. If A were N then "w in A"
would always be true, so "f(w) in A-bar" would have to always be true, which
is impossible because A-bar would be empty. And if A were empty, then "w in
A" would never be true, so "f(w) in A-bar" could also never be true, but it
is true if f(w) exists.
So we know that either K reduces to A or that K-bar reduces to A.
The given condition also tells us that A reduces to A-bar, and also that
A-bar reduces to A because the function f is invertible and its inverse
reduces A-bar to A. So we just check the two cases:
In each case we have shown that A is neither r.e. nor co-r.e., and
one of these two cases must hold by the proof of the RMS theorem.
Last modified 2 July 2003