Title: 1' Let B be an undecidable language where B m B'
1 1. Let B be an undecidable language where B ltm
B. A) Prove that B ?S1 ? P1 We assume that B ?S1
? P1. If B ?S1 then B ltm B implies that B ?S1.
If B ?P1 then B ltm B implies that B ?P1. In
either case, B ?S1 ? P1 B) Give an example of
such a language B Let B (i,j) if (iltj)
then i ?Lu and j ? Lu if
(igtj) then i ?Lu or j ? Lu i j
odd
Homework 5 Solutions
2Claim Lu ltm B (implies B ?S1)
1. f Z? Z x Z (obvious) 2. f is computable
(obvious) 3. f reduces LU to B
?k, k ? LU f(k) ? B
k ? LU ? Mk dna k ? (i,j) f(k) ? B k ? LU ?
Mk acc k ? (i,j) f(k) ? B
3 Define reduction f Z Z x Z f(k)
(i,j) such that i k j the smallest
number greater than k such that Mj accepts
0,1 Note
k ? LU ? Mk dna k ? (i,j) f(k) ? B k ? LU ?
Mk acc k ? (i,j) f(k) ? B
4Claim B ltm B
1. f Z x Z ? Z x Z (obvious) 2. f is
computable (obvious) 3. f reduces B to B
?k, k ? B f(k) ? B
(i,j) ? B ? ... ? (a,b) f(i,j) ? B (i,j) ? B
? ... ? (a,b) f(i,j) ? B
5 Define reduction f Z x Z ? Z x Z f(i,j)
(a,b) such that if i j, then a b i1
if i ? j, then a j b i
6 if i j, then a b i1 and so (i,j) ? B ?
i odd ... ? a b even ? f(i,j) ? B (i,j) ?
B ? i even ... ? a b odd ? f(i,j) ? B
if i gt j, then altb (i,j) ? B ? i ? Lu or
j ? Lu ? a ? Lu or b ? Lu ? f(i,j) ? B (i,j) ?
B ? i ? Lu and j ? Lu ? a ? Lu and b ? Lu ?
f(i,j) ? B if iltj, then agtb (i,j) ? B ? i
? Lu and j ?Lu ? a ? Lu and b ? Lu ? f(i,j) ? B
(i,j) ? B ? i ? Lu or j ? Lu ? a ? Lu or b ? Lu
? f(i,j) ? B
72. Prove
For all A,B,C, If Language A ltm B and Language B
lt m C Then Language A lt m C
If A reduces to B by function f and B reduces to
C by function g, then A reduces to C by function
h g?f. Note 1) h maps domain(A) to
domain(C) 2) h is computable by Mf and Mg run in
succession. 3) ? x, x ? A ? f(x) ? B ? h(x) ? C
83. Prove or disprove ?A, B, if B is regular
and Altm B, then A is regular False consider B
1 and A w ? n s.t. w 0n1n A reduces to B
by function f f(w) 1 if w ? A, f(w) 0
otherwise. Note f is computable 5. For the
following languages, try to state the lowest
class (level) of the Kleene hierarchy that
contains the language. Prove that L is
contained this class, and determine whether L is
recognizable or co-recognizable. A) A useless
state of a Turing machine is one that is never
entered on any input string. Define L M M
has a useless state L M M has useless state
q1 or M has useless state q2 ... or M has useless
state qn where n is the number of states of M L
M ? w1, w2, ... wn, (M never enters state q1
while computing on w1) or (M never enters state
q2 while computing on w2) ... or (M never enters
state qn while computing on wn) where n is the
number of states of M
9L M ? w1, ... wn, k1, ... kn, (M doesnt
enter state q1 while computing on w1 for k1
steps) ... or (M never enters state qn while
computing on wn for kn steps) where n is the
number of states of M So L ? P1 We prove L ?
S1 by showing Lu lt L. We will define f that
1. f Z? T.M.s 2. f is computable 3. f
reduces LU to L
k ? LU ? Mk dna k ? ... f(k) ? L k ? LU ? Mk
acc k ? ... f(k) ? L
10? k, f(k) machine M s.t. M has one special
non-accept, non-reject state q that is not
visited ordinarily. On input w, M does
If w 1, M rejects w otherwise,
Simulate Mk on k. If Mk accepts k, then M
visits q and accepts else M does not halt
(or visit q)
11B) L M1 ? a different Turing machine M2 such
that L(M1) L(M2) L all Turing Machines M
M is a T.M., a decidable set C) L M ? w,
M halts on w L M ? w, ? n M halts on w
within n steps So. L ? P2
12 We prove L ? S1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s 2. f is
computable 3. f reduces LU to L k ? LU ? Mk
dna k ? ? w M halts on w ? f(k) ? L k ? LU ?
Mk acc k ? ? w M DNH on w ? f(k) ? L ? k, f(k)
M s.t. On input w, M does M simulates Mk
on k for w steps if Mk acc k within w
steps, then M enters an infinite loop
else, if Mk DNA k within w steps, then M accepts
w (and halts)
13 We prove L ? P1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s 2. f is
computable 3. f reduces LU to L k ? LU ? Mk
acc k ? ? w M halts on w ? f(k) ? L k ? LU ?
Mk DNA k ? ? w M DNH on w ? f(k) ? L ? k, f(k)
M s.t. On input w, M does M simulates Mk
on k if Mk acc k, then M accepts w (and
halts) else, if Mk DNA k, then then M DNH on w
14D) L M ? input ws.t. M (accepts or rejects)
and enters all other states while computing on
w L M ? w,k s.t. M (accepts or rejects)
and enters all other states while computing on w
within k steps So L? S1 and is recognizable
We prove L ? P1 by showing Lu lt L. We will
define f that
1. f Z? T.M.s 2. f is computable 3. f
reduces LU to L
k ? LU ? Mk dna k ? ... f(k) ? L k ? LU ? Mk
acc k ? ... f(k) ? L
15? k, f(k) machine M s.t. M has one special
non-accept, non-reject state q that is not
visited ordinarily. On input w, M does
Simulate Mk on k. If Mk accepts k, then M
visits q and accepts else M does not halt
(or visit q)
16E) L (M1, M2) ? string w s.t. M1 halts on
w and M2 does not halt on w L (M1, M2) ?
w,n ? m s.t. M1 halts on w within n steps and M2
does not halt on w within m steps So L ? S2
17 We prove L ? S1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s x T.M.s 2. f
is computable 3. f reduces LU to L k ? LU ?
Mk dna k ? ? w M1 halts on w and M2 DNH on w ?
f(k) ? L k ? LU ? Mk acc k ? ? w M1 DNH on w
or M2 halts on w ? f(k) ? L ? k, f(k) (M1,
M2) s.t. On input w, M1 does M1 halts and
accepts w. On input w, M2 does M2 simulates
Mk on k if Mk acc k, then M2 halts and
accepts on w else M2 DNH on w
18We prove L ? P1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s x T.M.s 2. f
is computable 3. f reduces LU to L k ? LU ?
Mk acc k ? ? w M1 halts on w and M2 DNH on w ?
f(k) ? L k ? LU ? Mk dna k ? ? w M1 DNH on w
or M2 halts on w ? f(k) ? L ? k, f(k) (M1,
M2) s.t. On input w, M1 does M1 simulates
Mk on k if Mk acc k, then M1 halts and
accepts w else M1 DNH on w On input w, M2
does M2 DNH on w
19F) L M L(M) contains every string of
hamming weight 0 mod 5 Let S w H.W. (w) 0
mod 5 L M S ? L(M) L M ? w, w ? S ? M
acc w L M ? w, w ? S or M acc w L M ?
w ? n w ? S or M acc w within n steps So L ?
P2 Note that L satisfies Rices Theorem, case 2
and so L ? P1
20 We prove L ? S1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s 2. f is
computable 3. f reduces LU to L k ? LU ? Mk
dna k ? L(M) 0,1 ? f(k) ? L k ? LU ? Mk
acc k ? L(M) is finite ? S ? L(M) ? f(k) ? L ?
k, f(k) machine M s.t. On input w, M does
M simulates Mk on k for w steps. If Mk accepts k
within w steps, then M rejects w else if Mk DNA
k within w steps, then M accepts w
21G) L M L(M) does not contain any string with
2 or more 0s L M ? w, w has fewer than 2
0s or L(M) does not contain w L M ? w, w
has fewer than 2 0s or M does not accept w L
M ? w,n w has fewer than 2 0s or M does not
accept w within n steps So w ? P1 Note that L
satisfies Rices Theorem, case 1 and so L ? S1 L
M ? w ? n w ? S or M acc w within n
steps H) L M M a T.M. such that L(M) w
w is odd L M ? w, M acc w ? w is odd L
M ? w (M acc w or w is even) and (M DNA w
or w is odd) L M ? w,n ? m (M acc w
within m steps or w is even) and (M DNA w
within n steps or w is odd) So w ? P2 Note
that L satisfies Rices theorem, case 2 and so L
? P1
22 We prove L ? S1 by showing Lu lt L. We will
define f that 1. f Z? T.M.s 2. f is
computable 3. f reduces LU to L k ? LU ? Mk
dna k ? L(M) w w is odd ? f(k) ? L k ? LU
? Mk acc k ? L(M) 0,1 ? f(k) ? L ? k, f(k)
machine M s.t. On input w, M does If w
is odd, then M accepts w Else, if w is
even, then M simulates Mk on k. If Mk
accepts k, then M accepts w else if Mk DNA k,
then M DNA w