The Deutsch–Jozsa algorithm #
The Deutsch–Jozsa problem Deutsch, Jozsa, as stated in
de Wolf, §2.4.1: for N = 2^n, the input x ∈ {0,1}^N, with positions identified
with the bit strings {0,1}^n by an equivalence e, is promised to be constant or balanced. The
goal is to decide which.
The algorithm. Apply the Hadamard transform to the query register, make one phase query, apply
the Hadamard transform again, and measure whether the query register holds 0ⁿ. This is the
circuit Cslib.Quantum.bernsteinVazirani e with initial state Cslib.Quantum.bernsteinVaziraniInit e; de Wolf §2.4.2 notes that the Bernstein–Vazirani algorithm "is exactly the same as the
Deutsch-Jozsa algorithm". The circuit is reused here rather than redefined.
Analysis. After the query the amplitude of |z, 1⟩ is 2^{-n} ∑_a (-1)^{x_a + a ⬝ z}
(Cslib.Quantum.run_bernsteinVazirani_apply), the Walsh–Hadamard coefficient of (-1)^x at z.
At z = 0ⁿ it is 2^{-n} ∑_a (-1)^{x_a}, so the query register holds 0ⁿ with probability
(2^{-n} ∑_i (-1)^{x_i})² (Cslib.Quantum.regProb_run_bernsteinVazirani_zero). That is 1 on a
constant input and 0 on a balanced one (Cslib.BitString.IsBalanced.sum_signVal_eq_zero). So
one query solves the problem with certainty
(Cslib.Quantum.deutschJozsa_regProb_eq_bitVal). The original algorithm of Deutsch and Jozsa used
two queries. The one-query version, with a phase oracle, is due to Cleve, Ekert, Macchiavello and
Mosca [CEMM98], as de Wolf §2.4.1 records.
The separation. Every deterministic decision tree solving the problem needs 2^{n-1} + 1
queries (CslibFrontier/Computability/QueryComplexity/DeutschJozsa.lean). The bound holds in the
same
bit-query model on the same input. Cslib.Quantum.deutschJozsa_separation combines the two. The
separation is for exact computation only. The problem is easy for bounded-error randomized
algorithms (de Wolf §2.4.1): three random queries err with probability at most 1/4 on the
promise (CslibFrontier/Computability/QueryComplexity/Randomized/DeutschJozsa.lean).
Main results #
Cslib.Quantum.regProb_run_bernsteinVazirani_zero: the probability of measuring0ⁿ.Cslib.Quantum.regProb_run_bernsteinVazirani_zero_of_const,Cslib.Quantum.regProb_run_bernsteinVazirani_zero_of_isBalanced: probability1on constant inputs and0on balanced ones.Cslib.Quantum.deutschJozsa_regProb_eq_bitVal: one query decides the problem exactly.Cslib.Quantum.deutschJozsa_separation: one exact quantum query against2^{n-1} + 1deterministic queries.
References #
The probability of measuring 0ⁿ after the Hadamard–query–Hadamard circuit on input x
is (2^{-n} ∑_i (-1)^{x_i})².
On a constant input, the circuit measures 0ⁿ with certainty.
On a balanced input, the circuit never measures 0ⁿ.
The Deutsch–Jozsa algorithm decides the problem with certainty using one query
Cleve, Ekert, Macchiavello, Mosca: for every total F that
solves the problem, on every constant or balanced input x the probability of measuring 0ⁿ
after one query is exactly F x, read as 0 or 1.
The exact quantum–deterministic separation for Deutsch–Jozsa, in the bit-query model on
N = 2^n positions with n ≥ 1. From a unit initial state, one quantum query decides every
constant or balanced input with certainty. Every deterministic decision tree solving the problem
(as a total function F correct on the promise inputs) has depth at least 2^{n-1} + 1.