The Bernstein–Vazirani algorithm #
The Bernstein–Vazirani problem Bernstein, Vazirani, as stated in
de Wolf, §2.4.2: the input x ∈ {0,1}^N, with N = 2^n query positions identified
with the bit strings a ∈ {0,1}^n, is the truth table x_a = s ⬝ᵥ a of a linear function for an
unknown s ∈ {0,1}^n; the goal is to find s.
Here the positions Fin N are identified with the bit strings K → Bool by an equivalence e,
and Cslib.QueryComplexity.linearTable e s is the input. The algorithm
(Cslib.Quantum.bernsteinVazirani) starts in |0, 1⟩ (Cslib.Quantum.bernsteinVaziraniInit),
applies the Hadamard transform to the query register, makes one phase query, which multiplies the
amplitude of |a⟩ by (-1)^{s ⬝ᵥ a}, and applies the Hadamard transform again. One query
recovers s exactly: the final state is the basis state |s, 1⟩
(Cslib.Quantum.run_bernsteinVazirani), so measuring the query register gives s with
probability 1 (Cslib.Quantum.regProb_run_bernsteinVazirani).
Classically n queries are needed, even with randomness and error ε < 1/2
(CslibFrontier/Computability/QueryComplexity/BernsteinVazirani.lean), in the same bit-query model
on the same input; Cslib.Quantum.bernsteinVazirani_separation combines the two bounds. The
exponential separation of CslibFrontier/Computability/QueryComplexity/Quantum/Simon.lean uses the
same Hadamard transforms.
Main definitions #
Cslib.Quantum.bernsteinVazirani,Cslib.Quantum.bernsteinVaziraniInit: the algorithm and its initial state.
Main results #
Cslib.Quantum.norm_bernsteinVaziraniInit: the initial state is a unit vector.Cslib.Quantum.run_bernsteinVazirani_apply: on an arbitrary input the final amplitudes are the Walsh–Hadamard coefficients of(-1)^x; the Deutsch–Jozsa algorithm (CslibFrontier/Computability/QueryComplexity/Quantum/DeutschJozsa.lean) reads off the coefficient at0.Cslib.Quantum.run_bernsteinVazirani: after one query the state is|s, 1⟩.Cslib.Quantum.regProb_run_bernsteinVazirani: measuring the query register givesswith certainty.Cslib.Quantum.bernsteinVazirani_separation: one quantum query againstnrandomized queries.
References #
The final amplitudes on any input: after one query on an arbitrary input x, the amplitude
of |z, 1⟩ is 2^{-n} ∑_a (-1)^{x_{e⁻¹ a}} (-1)^{a ⬝ z}, the Walsh–Hadamard coefficient of
(-1)^x at z = e i, and the amplitude of every |z, 0⟩ is 0.
One query recovers s: after one query on the truth table of a ↦ s ⬝ᵥ a, the
Bernstein–Vazirani algorithm is in the basis state |s, 1⟩.
Measuring the query register gives s with certainty.
The quantum–classical query separation for Bernstein–Vazirani, in the bit-query model on
the truth table of a ↦ s ⬝ᵥ a: one quantum query recovers s with certainty, while every
randomized decision tree that recovers s with error ε < 1/2 (as the restriction of a total
function F) has depth at least n.