Honors Theory of Computation, G22.3550, Spring 2002; Yap; May 13, 2002.

FINAL EXAM (with SOLUTION)

Answer all questions. This is an OPEN book, in-class exam. Please write only in complete English sentences.

1. (Short Questions, 10 Points Each) Brief justification is necessary; you may cite any known results. DO NOT write more than half a page for any part of this question (often 2 lines suffice).

(a) TRUE/FALSE: L = {a^{n}b^{2n}a^{n} : n ∈ ℕ} is context-free.

(b) Draw the quantum circuit to produce the following state \frac{1}{\sqrt{2}}(|000⟩+|111⟩) starting from |000⟩.

(c) The following three statements cannot all be true:

(i) All reversible gates are quantum gates.

(ii) The control-NOT gate named T_{2} can copy any bit x, i.e., T_{2}(|x, 0⟩) = |x, x⟩. (iii) The No Cloning Theorem is true.

What is the apparent contradiction? Resolve it.

SOLUTION:

(a) FALSE: Here is a proof by contradiction. (The question is tricky because L looked like some other languages known to be a CFL.) Assuming L is CFL with pumping length p, then the pumping lemma says if x = a^{p}b^{2p}a^{p}, then x = uvwyz ∈ L such that for all i ∈ ℕ, uv^{i}wy^{i}z ∈ L. Hence vy must have equal number of a’s and b’s. Since |vwy| ≤ p, it is clear that vy = a^{n}b^{n} or vy = b^{n}a^{n} for some n > 0. Also, if v has both a’s and b’s, then v^{2} = … b … a … b …, which implies v^{2} is not a subword of x. Hence we may assume v = a^{n} and y = b^{n}. From uvwyz = ua^{n}wb^{n}z ∈ L, we know there are a’s on either side of w. However, in uv^{2}wy^{2}z, the number of a’s to the left of w has increased while the number to the right of w is constant. Contradiction.

(b) You may recall that we can produce (|00⟩ + |11⟩)/\sqrt{2} using a Hadamdard gate on line 1, then use a control-NOT (or T_{2}) gate on line 2 (using line 1 as control line). Simply follow this circuit by another control-NOT gate applied to line 3 (using line 1 as control gate again).

(c) The seeming contradiction comes from (ii) saying that you can clone a bit, and (iii) saying you cannot. Moreover, (i) tells you that you can regard the gate in (ii) as a quantum gate. The resolution lies in the fact that statement (ii) is only true when x is a classical state!

2. (Reduction, 20 Points)

Suppose A ∈ NP∩co-NP. Show that if B is Cook-reducible to A then B ∈ NP∩co-NP.

SOLUTION: Let A be accepted by an NP-machine M_{0} and co-A be accepted by a NP-machine M_{1}. Suppose T is a deterministic oracle machine that reduces B to A. We construct an NP-machine (call it N) to accept B as follows: on any input x, we simulate T until a query z is made. At that moment, we dovetail a computation of M_{0} on z, and a computation of M_{1} on z. If M_{0} accepts, we continue the simulation of T from the ”yes” state of the query machine. If M_{1} acccepts, we continue the simulation of T from the ”no” state. We accept iff T accepts. It is clear that N accepts x iff T^{(A)} accepts x. Hence B ∈ NP.

We also show that B ∈ co-NP. Construct a nondeterministic machine N′ that is similar to N above. Only difference is that if N accepts, then we reject, and viceversa.

3. (Kolmogorov Complexity, 20 Points) Let A ⊆ ℕ. We say A is sparse if there is a constant C > 0 such that for all n large enough, |{x : x ∈ A, x < 2^{n}}| < n^{C}. Give an upper bound on the function f(n) = K(χ_{A}[n]|n) when A is a sparse and recursively enumerable. Here, χ_{A}[n] = ⟨b_{0}b_{1} ⋯ b_{n−1}⟩ where b_{i} = 1 iff i ∈ A.

SOLUTION: (This is essentially Barzdin’s theorem for sparse set, and the proof is exactly as for a similar homework problem!)

We claim that K(χ[n]|n) ≤ ℓ(ℓ(n)) + C for some C.

Let N be any deterministic Turing machine that accepts A. Construct a STM M that on input ⟨n, m⟩, will dovetail the computations of N on the inputs i = 0, 1, …, n − 1. When m of these computations accepts, then N outputs a string b_{0}b_{1} ⋯ b_{n} where b_{i} = 1 iff the acceptor for A has accepted i.

Note that M will loop if less than m of the computations of N accept. Clearly, if χ_{A}[n] has m 1’s, then our machine N on ⟨n, m⟩ will output χ_{A}[n]. But by sparseness of A, χ_{A}[n] has m ≤ lg(n^{c}) = c lg n non-zero entries. Thus, K_{N}(χ_{A}[n]|n) = ℓ(m) ≤ ℓ(ℓ(n)) + c_{0}, for some c_{0}. By invariance, K(χ_{A}[n]|n) ≤ ℓ(ℓ(n)) + C for some C.

4. (Choice Computation, 20 Points) Describe a polynomial time alternating machine that, on input (n, x, r), will accept iff r is the n-order of x, i.e., x ∈ ℤ_{n}^{∗} and ord_{n}(x) = r. You may assume that checking whether a number is prime is in NP.

Give an algorithm with as few alternations as possible (one alternation suffice). What is the number of alternations in your solution (you must explain your algorithm clearly enough that this number is easy to see)?

SOLUTION:

On input (n, x, r), we first check that GCD(n, x) = 1 and that x^{r} ≡ 1(mod n). All this in polynomial time. If check fails, we answer NO, else we continue. Then we universally guess s < r and check that x^{s} ≢ 1(mod n). If so, we reply YES.

There is only one alternation “round” in this answer. (Note: your answer should justify some of the above assertions, etc)

5. (Quantum Computation, 40 Points) Let U be a unitary transformation and |v⟩ an eigenvector such that U|v⟩ = ω^{ϕ}|v⟩ where 0 ≤ ϕ < 1 and, as usual, we write ω for e^{i2π}.

(i) Consider the circuit in Figure 1 that has two Hadamard gates and a control-U gate. What is the output of this circuit on input |0⟩ ⊗ |v⟩? (ii) Show that the probability of |0⟩ on the control line is p_{0} = (1 + cos 2πϕ)/2. (iii) Suppose X is the number of heads in n tosses of a coin. If the coin has probability p (0 < p < 1) of showing up heads, then

Pr{|p − (X/n)| > ε} ≤ 2 exp(−2nε^{2}).

U |0⟩ |v⟩  |v⟩ |?⟩ H  H

Figure 1: Alternative primitive for phase estimation

This is known as the “Hoeffding bound”. Suppose cos 2πϕ = ±0.b_{1}b_{2}b_{3} ⋯ in binary notation. Using the Hoeffding bound as well as the quantum circuit, describe an experimental procedure to estimate the sign σ ∈ {±1} and first two bits b_{1}, b_{2} so that

Pr{| cos 2πϕ − σ0.b_{1}b_{2}| > 1/8} ≤ δ  (1)

where 0 < δ < 1 is given. (iv) Outline a generalization of (iii), so that we efficiently estimate the first m bits of cos 2πϕ with error probability δ. That is, Pr{| cos 2πϕ − 0.b_{1}b_{2} ⋯ b_{m}| > 2^{m+1}} ≤ δ. HINT: use the control-U^{2^{i}} circuits (i ≥ 1) to estimate the bits in parallel. SOLUTION:

(i) Begin with the state |0⟩ ⊗ |v⟩. After the first Hadamard gate, we get (|0⟩ + |1⟩) ⊗ |v⟩/\sqrt{2}. After applying control-U, we obtain (|0⟩ + ω^{ϕ}|1⟩) ⊗ |v⟩/\sqrt{2}. After the second Hadamard gate, we get

((|0⟩ + |1⟩) + ω^{ϕ}(|0⟩ + |1⟩)) ⊗ |v⟩/2 = ((1 + ω^{ϕ})|0⟩ + (1 − ω^{ϕ})|1⟩) ⊗ |v⟩/2.

(ii) The probability of |0⟩ is |1+ω^{ϕ}|^{2}/4 = (1+ω^{ϕ})(1+ω^{−ϕ})/4 = (1+ω^{ϕ}+ω^{−ϕ}+ω^{0})/4 = (1 + cos 2πϕ)/2. (iii) The idea is simply to measure the control line in this circuit n times, and if h is the number of times that we get the state |0⟩, then we would like to estimate p_{0} by h/n. There are two steps to reach our goal of estimating c = cos 2πϕ. The following argument is slightly more general than what we ask you to show. Initially let ε > 0 be left unspecified. This will be determined after we see what restrictions on ε are needed. Let E be the event {|p_{0} − (h/n)| > ε}. We want the following bound to hold:

Pr(E) = Pr{|p_{0} − (h/n)| > ε} ≤ δ.  (2)

Hoeffding’s bound tells us that it is sufficient to choose n such that δ ≥ 2 exp(−2nε^{2}), or

n ≥ \frac{1 + ln(1/δ)}{2ε^{2}}.  (3)

Next, we re-express the above event E.

E = {|p_{0} − (h/n)| > ε}
= {|(1 + c)/2 − (h/n)| > ε},  c = cos 2πϕ
= {|c − ((2h/n) − 1)| > 2ε}.

Thus (2h/n) − 1 is to be our estimate for c. Suppose we choose the bits b_{1}, b_{2}, …, b_{t} such that

|((2h/n) − 1) − 0.b_{1}b_{2} ⋯ b_{t}| ≤ 2ε.

This is possible provided 2ε ≥ 2^{−t−1}, or

ε ≥ 2^{−t−2}.  (4)

We then see that

{|c − 0.b_{1}b_{2} ⋯ b_{t}| > 4ε} ⊆ {|c − ((2h/n) − 1)| > 2ε} ∪ {|((2h/n) − 1) − 0.b_{1}b_{2} ⋯ b_{t}| > 2ε}
= {|c − ((2h/n) − 1)| > 2ε},

where the last equality follows from the fact that {|((2h/n) − 1) − 0.b_{1}b_{2} ⋯ b_{t}| > 2ε} is empty. Hence

Pr{|c − 0.b_{1}b_{2} ⋯ b_{t}| > 4ε} ≤ Pr{|c − ((2h/n) − 1)| > 2ε} = Pr(E) ≤ δ.

If we want to ensure that

Pr{|c − 0.b_{1}b_{2} ⋯ b_{t}| > 2^{−t}}  (5)

we just need 4ε ≥ 2^{−t} or ε ≥ 2^{−t−2}. Combined with (4), we can choose

ε = 2^{−t−2}.  (6)

From (3), we only have to choose

n = ⌈(1 + ln(1/δ)2^{2t+3}⌉ .

Note that the exam question asks for the case t = 2 only. (iv) This is considerably harder to do, but we would be happy if you could sketch out some of the issues that must be solved.

Before attempting the solution, the obvious question is “why not simply use the framework of part (iii)?” The answer is, yes, part (iii) can be generalized to give as many bits of precision as you like. The catch is that the number of measurements n will grow exponentially with the precision: n = Ω(ε^{−2}), or n = Ω(4^{p}) if you want p bits of precision. Hence for efficiency, you will need to use control-U^{2^{i}} gates for i = 1, 2 …, as in phase estimation.

A new complication arises: we are only estimating cos 2πϕ, not ϕ. So when we apply U^{2^{i}}-gates, we are getting estimates for cos 2πϕ2^{i}. Hence you need to modify (iii) so that you directly obtain estimates on ϕ rather than cos 2πϕ. This can be done, but requires more analysis.

We must answer the following question: if you know t bits of precision for cos 2πϕ (that is, you know c such that |c − cos 2πϕ| ≤ 2^{−t}), how many bits of precision do you know about ϕ? It is easy to prove the upper bound

| cos(x + δ_{x}) − cos x| ≤ |δ_{x}|.

Unfortunately, what we need is a lower bound. Using Taylor series with remainder, we have

cos(x + δ_{x}) = cos x − δ_{x} sin(x + δ′)

where 0 ≤ δ′ ≤ δ_{x}. Thus

| cos(x + δ_{x}) − cos x| ≥ |δ_{x} sin(x + δ′)|

This means we must first bound x away from 0, π, 2π (otherwise the righthand side gets arbitrarily close to 0. Assuming this has been done, so that we know some constant c > 0 where

| cos(x + δ_{x}) − cos x| ≥ δ_{x}2^{−c}

This means that

δ_{x} < 2^{−t+c}.

At each stage i ≥ 0, we choose t = c + 5 to ensures that we can estimate 2πϕ2^{i} to at least 5 bits of precision, and hence ϕ2^{i} to at least 2 bits of precision. We obtain obtain

ϕ = 0.ϕ_{1}ϕ_{2}ϕ_{3} ⋯ = \frac{⌊2ϕ⌋}{2} + \frac{⌊2^{2}ϕ⌋}{2^{2}} + \frac{⌊2^{3}ϕ⌋}{2^{3}} + · · · .

FINALLY, if we want to compute ϕ to p bits of precision with error probability at most δ, we can make the error probability for estimating each bit to be δ/p. This concludes the algorithm.