Documentation

CslibFrontier.Computability.QueryComplexity.Quantum.BernsteinVazirani

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 #

Main results #

References #

noncomputable def Cslib.Quantum.bernsteinVazirani {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) :

The Bernstein–Vazirani algorithm: the Hadamard transform on the query register, one query, and the Hadamard transform again.

noncomputable def Cslib.Quantum.bernsteinVaziraniInit {N : ℕ} {K : Type u_1} (e : Fin N ≃ (K → Bool)) :

The initial state |0, 1⟩ of the Bernstein–Vazirani algorithm: the query register holds the zero string and the control bit is 1.

The initial state |0, 1⟩ is a unit vector.

theorem Cslib.Quantum.run_bernsteinVazirani_apply {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) (x : Fin N → Bool) (i : Fin N) (b : Bool) :

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.

theorem Cslib.Quantum.bernsteinVazirani_separation {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) :
(∀ (s : K → Bool), regProb (run (bernsteinVazirani e) (bernsteinVaziraniInit e) (QueryComplexity.linearTable e s) 1) (e.symm s) = 1) ∧ ∀ (μ : RandomizedDecisionTree (Fin N) (K → Bool)) (F : (Fin N → Bool) → K → Bool) (ε : ℝ), (∀ (s : K → Bool), F (QueryComplexity.linearTable e s) = s) → ε < 1 / 2 → (∀ (s : K → Bool), μ.errorProb F (QueryComplexity.linearTable e s) ≤ ε) → Fintype.card K ≤ μ.depth

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.