Questions are in black, solutions in blue.
One half is immediate from Kleene's Theorem -- if the language has a
regular expression of this form, it is DFA-recognizable.
For the other half, assume that A = L(D) for some DFA D. By the Regular
Language Pumping Lemma, there is a number k such that for every string
am in A, with m ≥ k, there are numbers i and j such that
j > 0 and
ait+j is in A for all non-negative integers t. (Why? Consider
the strings u, v, and x in the lemma where w - uvx. Let v be aj
and ux be ai.
Now consider all possible i and j with 0 ≤ i ≤ k, 0 < j ≤ k,
and ati+j in A for all t. The language A is the union of the
languages ai(aj)* for all such i and j,
together with possibly some strings of length less than k. Each such language
has a regular expression of the desired form (for the individual strings you
can take v to be the empty string) and thus so does their union, A.
On a one-letter language, the CFL Pumping Lemma turns out to have the same
consequence as the regular language Pumping Lemma. We can write any
sufficiently long w or am = uvxyz where |vy| > 0 and for all t,
uvtxytz is in A. Letting vy be aj and
letting uxz by ai, we get the same conclusion, that ait+j
is in A for all numbers t.
But this (all sufficiently long strings are in a set of this type)
is the property of A that we used in Question 1 to prove that A had a regular
expression of the desired type. Hence A is DFA-recognizable, and A was an
arbitrary CFL on one letter.
Define a NFA to simulate the PDA in question, using c17 different states to represent the possible contents of the stack. (Actually an NFA state represents a PDA state and a PDA stack contents.) A possible move of the PDA corresponds to some change in state and stack contents as the PDA reads a letter, and this can be simulated by an NFA move. Since the NFA accepts iff the PDA does, its language is that of the PDA, and so the PDA's language is regular.
Consider the c17 possible length-17 initial segments of strings over this alphabet. Some of these cause M to accept and some cause M to reject, but two strings with the same 17-letter prefix must either both be in or both be out of L(M) because M will never see the difference between them. So L(M) is a union of finitely many languages of the form "u" or "uΣ*, where u is a string of length at most 17. Hence L(M) is a regular language.
Suppose A is r.e., and thus that A = L(N) for some machine N. We must design
a Turing machine M such that A = H(M). So M must hang when N halts and not
hang when N does not halt.
To do this, M will first place an endmarker on the leftmost cell of the
tape and then begin simulating N. If N tries to hang, M should halt (because
N will not halt on that input). If N halts, M should immediately move
left until it hangs. If N loops, M can also loop and this is good because N
has not halted and M has not hung.
Now for the other direction, assume that A = H(M) for some machine M.
We must prove that A is r.e. by constructing a machine N such that L(N) = H(M),
that is, such that N halts iff M hangs. Again, N places an endmarker and then
simulates M. If M halts, N will hang, and if M tries to hang, N will halt
(and thus not hang). Again, if M loops then N will loop, and this is good
because M has not hung and N has not halted.
(In fact the same simulation from the first half of the
argument also works for the second half.)
Let w be any nonempty string. Let v be the string obtained from w by complementing its first letter. We know that there exists a machine M such that A = L(M). Run M simultaneously on w and v by dovetailing. Since exactly one of w and v is in A, one of these two processes will eventually halt. If it is w, then w is in A, and if it is v, then w is not in A.
Case 1: The empty string is in A. Our machine N decides whether w is in A
as follows. If w is empty it accepts. Otherwise it creates v and proceeds
as in part (a).
Case 2: The empty string is not in A. Our machine N rejects w if it is empty,
and otherwise follows part (a).
Of course if we are given M, it is undecidable whether we are in Case 1 or
Case 2. But either way, an always-halting machine exists that decides A, so
A is recursive.
Last modified 1 October 2003