CSE 555 HW 3 SAMPLE SOLUTION
Question 1.
Relation R ⊆ N k is definable in T h(N , +) if there is a formula φ with k free variables
a1 , . . . , ak so that φ uses only the relation PLUS, and whenever a1 , . . . , ak ∈ N ,
φ(a1 , . . . , ak ) is true ⇔ (a1 , . . . , ak ) ∈ R.
Consider the logical formula (x × y = z), and rewrite it as
((y = 0) → (z = 0)) ∧ ((y 6= 0) → (x + (x × (y − 1)) = z).
Repeating this until y = 0, we can eliminate all occurrences of ×, so it appears that we
have defined × in terms of +. Explain carefully why this appearance is not correct, and
that this does not make × definable in T h(N , +). Then explain why × cannot be definable
in T h(N , +) by any method. The appearance is not correct because it requires knowledge
of the value of y in order to eliminate all occurrences of ×. Therefore, this can be done
for a constant y, but not for an arbitrary y, which would be required in order to define R
in this way. This concerns what “definability” really means. Given a formula involving ×,
one would have to find a single formula that eliminates all occurrences of ×, not a different
formula for every value of y. The specific rewriting given does not meet this requirement.
In fact, no such rewriting can exist. By Theorem 6.13 T h(N, +, ×) is undecidable, but
T h(N, +) is decidable. We cannot define × in T h(N, +) as this would reduce the problem of
deciding membership in T h(N, +, ×) to deciding membership in T h(N, +), thus rendering
T h(N, +, ×) decidable, which is a contradiction.
Question 2.
In thinking about T h(N , +), we have built our DFA for + using big endian order
(most significant bit first, so that decimal 11 is written as 1011 or 01011 or 001011 or
...). Unfortunately our friend has built her DFA so that it uses little endian order (least
significant bit first, so that decimal 11 is written as 1101 or 11010 or 110100 or ...). Insisting
as we do on being big endian, when we use her DFA we get unusual results: adding 011010
and 000110 with her machine we get 011101 (because 22 + 24 = 46), but in big endian
order, the result is 100000 or 32 (because 26 + 6 = 32). To avoid confusion, we refer to the
operation of her machine as ⊕, when it is applied to numbers in big endian order; we call
the operation of the original machine +.
(1) Show that T h(N , +, ⊕) is decidable. Explain carefully. (Remember, the inputs are
given as big endian, as both machines now expect!)
1
2
CSE 555 HW 3 SAMPLE SOLUTION
(2) We are wondering whether her machine does the addition “correctly” infinitely
often. To do this, explain how to use your general method to decide the truth of
the sentence
∀y∃a∃b((a ≥ y) ∧ (b ≥ y) ∧ (a + b = a ⊕ b))
First rewrite the sentence using only +, ⊕, and logical operations by defining ≥
and = using the basic relations. Note: There is no credit for giving a proof or
disproof that does not use the general method developed in the first part.
(a) The strategy is essentially the same as for T h(N, +).
1 Write the formula in prenex normal form Q1 x1 Q2 x2 · · · Qn xn [ψ]. Let φn = ψ,
and φi = Qi+1 xi+1 φi+1 for 0 ≤ i < n.
2 Build a DFA for φn using the DFAs for + and ⊕, and closure under complement, intersection, and union. The crucial thing to check here is that every
one of the DFAs combined can be made to process the same input in the same
order. But the setup ensures that we can use the “standard” encoding of vectors in {0, 1}n as we did for T h(N, +) – note that in general simply having the
DFAs to combine does not mean that we can ensure that they run in lock-step,
each consuming an input symbol at the same time.
3 Now build a DFA for φi from the one for φi+1 for i = n − 1, n − 2, . . . , 0. If
Qi+1 = ∀, we rewrite φi as ¬∃xi+1 ¬φi+1 , and complement the DFAs when
needed. So suppose that Qi+1 = ∃. Rather than providing vectors of length
i + 1 as input symbols, we employ vectors of length i and “guess” (select
nondeterministically) the component for xi+1 . In the method developed for
T h(N, +), we added extra transitions to accommodate transitions on all-0
vectors, to permit leading zeroes to be added. However, one subtlety is that
leading zeroes in big endian are trailing zeroes in little endian! So we may have
a problem. For the moment, simply omit the addition of the extra transitions.
Then convert the NFA obtained to a DFA, and complement if Qi+1 = ∀, to
get the DFA for φi .
4 Now we have a DFA for φ0 , which is the original formula. It still has an
input symbol [], i.e. the vector of length 0. Change the DFA to an NFA by
converting all transitions on [] to transitions on ε, and convert the result to a
DFA. This DFA has its start state as a final state exactly when the formula is
true.
(b) We write a ≥ y as ∃x1 (P LU S(y, x1 , a)), b ≥ y as ∃x2 (P LU S(y, x2 , b)), and a + b =
a ⊕ b as ∃x3 ((P LU S(a, b, x3 ) ∧ OP LU S(a, b, x3 )). Our rewritten sentence then is
∀y∃a∃b∃x1 ∃x2 ∃x3 (P LU S(y, x1 , a) ∧ P LU S(y, x2 , b) ∧ P LU S(a, b, x3 ) ∧ OP LU S(a, b, x3 ))
We will not go through all the steps, but we use the method in the (a) part. The formula
turns out to be true. (To convince yourself that it really is true, choose any y you like,
and let 2` > y. Then choose a = 2`+1 and b = 2` . Then a ≥ y, b ≥ y, and a + b = a ⊕ b.
The key thing is that any addition without carries can be done in either order, because it
is just a logical ‘or’.)
CSE 555 HW 3 SAMPLE SOLUTION
3
Question 3.
Establish the recursion theorem for oracle Turing machines. That is, establish that a
TM with an oracle for L can implement “obtain own description”. Let T L be a TM with
an oracle for L that computes function t : Σ∗ × Σ∗ 7→ Σ∗ . There is a TM with an oracle
for L, RL that computes function r : Σ∗ 7→ Σ∗ where for every w, r(w) = t(hRL i, w). As
in the original recursion theorem, we construct RL in three parts, or procedures, with the
exception that T has been modified to T L to include access to an oracle - that is, there
are additional states with the purpose of querying the oracle, as well as an oracle tape
in addition to the standard work tape which has its own read/write head and may have
special symbols not in the work tape alphabet to designate the oracle’s response. The
control for RL is as follows.
RL = “On input w to the work tape:
1. Control begins in procedure A which prints whBT L i on the work tape and passes control
to B.
2. From the work tape, B receives whBT L i and computes q(whBT L i) which is hAi. B
combines A, B, and T L into a single machine and obtains its description hABT L i = hRL i.
It encodes the description together with w and prints hRL , wi on the work tape and passes
control to T L .
3. T L begins with hRL , wi on the work tape and computes t(hRL i, w).”
So, RL computes r(w) = t(hRL i, w). To see that this is the case, note that the only
change from the original recursion theorem is the oracle access, and this change only affects
T L . Neither A nor B access the oracle tape nor do they need to enter any states affiliated
with querying the oracle; all of the access to the oracle is done through procedure T L .
Thus, T L computes the same function as RL except that T L begins with RL ’s description
in addition to input w.
Question 4.
Establish that ET0 M = {hM i : M is a TM with an oracle for AT M and L(M ) = ∅} is
undecidable relative to AT M .
First, we show that A0T M = {M, w : M is a TM with an oracle for AT M and M accepts w}
is undecidable relative to AT M . Assume, for the purpose of obtaining a contradiction, that
A0T M is decidable relative to AT M . Let A be the TM with an oracle for AT M that decides
A0T M . We construct the following TM, B.
B = “On input hM i:
1. If hM i is not a description of a TM with an oracle for AT M , reject. Else,
2. Run A on hM, M i. If it accepts, reject; if it rejects, accept.”
First, note that B is a TM with an oracle for AT M in that B uses A, so hB, wi is a
candidate string in the language A0T M . However, when we run B on its own description,
4
CSE 555 HW 3 SAMPLE SOLUTION
it runs A on hB, Bi and if A accepts - that is, B accepts B - then B rejects. That is, B
rejects B if and only if B accepts B, a contradiction.
Next, we show that A0T M reduces to ET0 M . Assume, for the purpose of obtaining a
contradiction, that ET0 M is decidable relative to AT M . The proof is similar to the proof of
undecidability for ET M . Let C be a TM that decides ET0 M . We construct D, a TM that
decides A0T M . Again, we construct M1 from M to ensure that it rejects any string that is
not w, but on w it does what M does.
M1 = “On input x:
1. If x 6= w, reject. Else, run M on w and accept if M does.”
D = “On input hM i:
1. If hM i is not a description of a TM with an oracle for AT M , reject. Else,
2. Construct M1 , a TM with an oracle for AT M from the description of M as described
above.
3. Run C, the decider for ET0 M on M1 . If it accepts, reject; if it rejects, accept.”
Then we can use C, the decider for ET0 M to construct a decider for A0T M . But then
is decidable relative to AT M , which is a contradiction.
A0T M
Question 5.
Show (in general) that L is recognizable if and only if L is mapping reducible to AT M .
(⇐) Suppose that L is mapping reducible to AT M . By Theorem 5.28, L is Turingrecognizable. (In more detail, let M be a recognizer for AT M , f is a reduction from L to
AT M , and build a recognizer, N , for L as follows.
N =“On input w
1. Compute f (w).
2. Run M on f (w) and output whatever M outputs.”)
(⇒) Suppose that L is recognizable. Then there is a TM, R, that recognizes L. We can
construct a TM, F , that has the description of R hardcoded and that, when given input
w, outputs hR, wi. Thus, F computes the function f : w 7→ hR, wi. To see that f is a
reduction from L to AT M note that for every w, w ∈ L if and only if hR, wi ∈AT M .
Is it possible that L can be decidable relative to AT M , yet L is not recognizable? neither
recognizable nor co-recognizable? Explain.
We can decide AT M given an oracle for AT M . On input hM, wi, we query the oracle
for AT M and reverse the answer. Therefore, AT M is decidable relative to AT M , yet AT M
is not recognizable.
Consider L = {x#y : x ∈ AT M and y ∈ AT M } (from Homework 1). L is decidable
relative to AT M . On input x#y, our decider for L, equipped with an oracle for AT M ,
splits the input using # as a delimiter and issues two queries to the oracle. The decider
accepts if the oracle responds “yes” to x and “no” to y; otherwise, it rejects. However, we
proved that L is neither recognizable nor co-recognizable.
© Copyright 2026 Paperzz