Question text is in black, solutions are in blue.
Q1: 10 points Q2: 10 points Q3: 10 points Q4: 10 points Q5: 20 points Q6: 30 points Q7: 30 points Total: 120 points
TRUE. There are two good proofs. One shows ALLCFG
≤m SUBCFG, which suffices because ALLCFG
was proved to be undecidable in the text. This reduction takes a grammar
G and returns (GALL, G) where GALL is any grammar that
generates Σ*. This is correct because Σ*
⊆ L(G) if and only if L(G) = Σ*.
The other proof is a Turing reduction showing that
EQCFG ≤T SUBCFG, which suffices because
EQCFG was shown to be undecidable in a homework problem. This
reduction decides whether (G1, G2) is in EQCFG
by testing whether (G1, G2) and (G2,
G1) are both in SUBCFG.
TRUE. One might try to prove this undecidable with the Rice-Myhill-Shapiro Theorem, but this property of TM languages is trivial so it doesn't apply. In fact for any machine M, L(M) is TR by definition. So to decide this language we need only decide whether the input string is a valid TM, and this is decidable.
FALSE. Let A be any TD language with an infinite number of strings, such as 0*. The enumerator must begin by printing some string w, but then it is only allowed to print strings of length at most that of w. There are only finitely many such strings, so it cannot print all the strings in A.
TRUE. Such a machine is guaranteed to exist by the fixed-point version of the Recursion Theorem (Theorem 6.8), because we could have f transform any machine M into a machine N such that L(N) = LD(M). But it's easier to give an example of a machine whose language X has the property that the set of strings w such that ww ∈ X is exactly X. The empty language has this property, as do {ε} and Σ*.
A left-blank Turing machine is a one-tape Turing machine that always moves left when it sees a blank character. We define ALBTM to be the set of pairs (M, w) where M is a left-blank Turing machine and w ∈ L(M).
ALBTM is not Turing decidable, because we can mapping-reduce ATM to it. Given any one-tape Turing machine M, we want to build a left-blank machine M' such that L(M) = L(M'). M' has the same alphabet as M but has one new character b, a "fake blank". When it sees a b, it does what M would have done on a real blank. When it sees a real blank in some state q, it overwrites the blank with a b, moves left (as it must) and enters a new state q'. In state q', whatever it sees, it move right and goes back to state q. (Note that in order to restore the state after the move left, we need a separate state q' for each state q of M.) When m would write a blank, we have M' write a b instead. The computation of M' tracks that of M exactly, except for these extra two steps the first time M' sees each blank -- these two steps convert the blank to a b and M' then continues. There is one additional technicality -- if the input string is ε we must deal with the fact that when M' sees the first blank in state q0, it will attempt to move left but actually stay in place under Sipser's rules for Turing machines. So we must have δ(q0,blank) = (q0,b,L), create no new state q0', and make sure that M' never reenters state q0 after it starts.
The language ARBTM is Turing decidable. If a right-blank Turing
machine ever reaches the blank to the right of the input, it will never return
to the input because it will see blanks and move right until or unless it
accepts or rejects. We can check each state q to see what happens if the
machine sees the first blank in state q -- whether it eventually accepts,
eventually rejects, or goes right forever. (If it ever revisits a state we
know it will go right forever, so this check takes only a finite number of
steps.
We can then modify M to get a machine M' that accepts or rejects as soon as
it sees the first blank. But M' is in effect an LBA, because it never leaves
the area of the original input. We know that ALBA is decidable --
this is Theorem 5.9 in Sipser, or we can recall that we need only simulate
an LBA for long enough that we know it to be in a loop if it has not yet halted.
Following the hint, let f be any function from N to S. We will show that f is not onto, which means S is uncountable because "counting" S would mean constructing an f that was onto. For every positive integer i, let gi be the function f(i). Then define a function d from N to N by the rule d(i) = gi(i) + 1. For any i, d cannot be the same function as gi because d(i) ≠ gi(i). So f is not onto because d is not in its range.
If you solve (c) first, you can simply observe that since every TM is denoted by a finite string, there are only countably many TM's and thus at most countably many functions that are computed by TM's. But a direct proof is also straightforward. If f is in SP, we can denote f by a finite sequence of positive integers: (t, q, f(1), f(2),..., f(t+q-1)) -- this is enough because every other value of f is equal to one of these and we can compute which (as we will do in part (c)). Every finite sequence of positive integers can be denoted by a finite string, and since there are only countably many strings there can be only countably many sequences and thus only countably many functions in SP.
Given any function f in SP, we can construct a Turing machine that has a lookup
table
sequence (t, q, f(1),..., f(t+q-1)) encoded within it. On input n, this Turing
machine computes f(n) by the recursive code
if (n <= t+q-1) return lookup(n); else
return f(n-q);
. Alternatively, we can avoid the recursion
by returning lookup(t + ((n-t)%q))
in the else
case.
This algorithm is clearly implementable by an always-halting Turing machine.
Let f be the function proving A ≤m B and let g be the function proving B ≤m C. Define the function h by the rule h(x) = g(f(x)). Then (x ∈ A) ↔ (f(x) ∈ B) ∈ (g(f(x)) ∈ C) and thus h proves that A ≤m C.
Given any machine M, let f(M) be the pair (M,M). Then (M ∈ LBOS) ↔ (M ∉ L(M)) ↔ ((M,M) ∉ ATM) and f is the desired reduction.
Given any pair (M,w), let g(M,w) be the machine NM,w that erases its input and then runs M on w. L(NM,w) is equal to Σ* if w ∈ L(M) and to ∅ otherwise, so we have that ((M,w) ∉ ATM) ↔ (g(M,w) ∈ L(NM,w)) and g is the desired reduction.
Last modified 13 April 2008