Questions in black, solutions in blue.
HANG is clearly r.e. because we can design a Turing machine MH that on
input (M,w), simulates M on w until or unless it hangs, accepting only
if it hangs and rejecting if it halts. Clearly L(MH) = HANG.
To prove completeness, the easiest thing is to reduce ATM
to HANG, which is enough because ATM is known to be r.e.-complete.
We need a total recursive function f that, on input (M,w), produces a pair
(N,x) such that (M,w) is in ATM iff (N,x) is in HANG.
This is very easy to do. We let x equal w and let N be a machine that
simulates M until or unless it either halts or hangs. If M halts, N will
hang, and if M hangs, N will halt.
SF is primitive recursive. The recurrence I gave is almost a
primitive recursive definition already, one we know that the factorial
function is primitive recursive:
let fact(0) = 1;
let fact(n+1) = h1(fact(n),n) where h1(a,b) = a * b;
let sf(0) = 1;
let sf(n+1) = h2(sf(n),n) where h2(a,b) = fact(a+1);
HF is also primitive recursive. As above:
To confirm that this is a valid primitive recursive definition, we
need the following to be primitive recursive: the constant function 1
= σ(ζ()), the binary multiplication function defined in Lecture
#8, and the functions h2 and h3 above. The latter two are easily constructed
from functions previously shown to be p.r., using composition, projection,
and the successor function.
It would also be easy to write Bloop programs for each of these two
functions in turn and invoke the homework result from the Spring 2003 course.
let hf(0) = 1;
let hf(n+1) = h3(hf(n),n) where h3(a,b) = sf(a+1);
We first show that KK is K-r.e. by constructing a K-oracle machine MM such that
KK = L(MM). On input "M", MM begins simulating the K-machine M on input "M".
When M makes an oracle query, MM uses its own oracle to get the result of this
query. MM simply follows the eventual result of the simulation, so it halts
on "M" iff M halts on "M", and this is true iff "M" is in the language KK,
so L(MM) = KK and KK is K-r.e. as desired.
To show that KK is K-r.e.-complete, it remains to show that any K-r.e.
language reduces to KK. Let A = L(M) be an arbitrary K-r.e. language. We
need a K-recursive function f such that for any string w, w is in L(M) iff
f(w) is in K. We define f so that if w is any string,
f(w) is the code of a K-Turing machine that ignores its input and runs M on
w. The K-oracle maching f(w) uses K-oracle calls to get the answers to any
calls that M wants to make.
(Note that we would even be allowed to use K-oracle calls in the course of
computing f, but we didn't need any.) Now w is in L(M) iff M accepts w iff
f(w) accepts all strings iff f(w) accepts the string "f(w)" iff "f(w)" is in
KK. Thus any K-r.e. language is reducible to KK and we have completed the
proof that KK is K-r.e.-complete.
L and D are both anti-reflexive because L(x,x) and D(x,x) are both clearly
false -- you can't find a t such that x starts with both t0 and t1.
L and D are both anti-symmetric. For L, clearly if one is shorter the
other is not, and if the first difference in the strings has a 0 for u it
cannot also have a 0 for v. For D, if u is a prefix of v then D(v,u) is
impossible because u and v agree until u ends. And again, if the first
difference has a 0 for u it cannot also have a 0 for v.
L and D are both transitive. If L(u,v) and L(v,w) are both true, L(u,w)
follows immediately if the three strings are not all of the same length.
If they are of the same length, there is a first difference between u and v
and a first difference between v and w. Whichever of these comes first (they
cannot come at the same time, as there are only two possible values for the
letter in question), that very letter is the first difference between u and w
and forces L(u,w) to be true. The argument for D is similar. Consider the
first difference between u and v and the first difference between v and w,
considering the prefix relation to be a difference at the end. The earlier
of these two differences is also a difference between u and w, forcing D(u,w)
to be true.
L and D are both total -- the argument for antisymmetry above shows that if
u and v are different, either L(u,v) or L(v,u) must be true and either D(u,v)
or D(v,u) must be true.
Both L(x,y) and D(x,y) are computable
because it is easy for a TM to decide them
as follows. First check the length of each and return true for L if x is
shorter and false for L if x is longer. Then
beginning with the first letter of each, compare corresponding
letters of u and v until you find letters that differ or you run out of letters
in one or the other. If you find the difference first, D(u,v) and L(u,v) are
true if you're on a 0 in u and a 1 in v, and false otherwise. If you run out
of letters in both at the same time, then u=v and both L and D are false.
If you run out of letters in u and v still has more, D is true. If you run
out of letters in v and u still has more, D is false.
The L-successor of 1n is 0n+1. The L-successor of
any other string x is the string of the same length that represents a binary
number (possibly with leading zeroes) one larger than does x.
The D-successor of x is x0, because this is smaller than anything beginning
with x1 and a prefix of any other string extending x. Any other string
z with D(x,z) also satisfies D(x0,z).
To prove that T-successorship is co-r.e. I must define a machine M that
accepts a pair (x,y) iff y is not the T-successor of x. M first
tests whether T(x,y) is true and accepts if it is not. Then it searches
through all strings z to see whether T(x,z) and T(z,y) are both true, accepting
if they are.
Here's an example of a computable total order for which I don't think
successorship is recursive -- I'll try to come up with a proof tomorrow.
Given two strings u and u', write them as 0i1jv
and 0i'1j'v'. Then define T(u,v) to be true if i <
i', or if Mi halts on blank input within min(j,j') steps and
L(v,v'), or Mi does not halt on blank input within min(j,j')
steps and L(v',v). Something like this ought to work...
Last modified 9 October 2003