Documentation

CslibFrontier.Computability.QueryComplexity.BernsteinVazirani

The classical query complexity of Bernstein–Vazirani #

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. 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. It is the Hadamard codeword of s read through e (Cslib.QueryComplexity.linearTable_eq_hadamardCode_comp), so distinct strings have distinct inputs (Cslib.QueryComplexity.linearTable_injective, from Cslib.BitString.hadamardCode_injective).

Upper bound. Querying the n unit vectors reads off s coordinate by coordinate: Cslib.QueryComplexity.linearDecode e recovers s from linearTable e s (Cslib.QueryComplexity.linearDecode_linearTable), and the decision tree Cslib.QueryComplexity.linearDecodeTree e computes it with depth at most n.

Lower bound. The 2^n inputs have distinct answers, and a decision tree of depth q takes at most 2^q values. So every deterministic decision tree recovering s has depth at least n (Cslib.QueryComplexity.card_le_depth_of_linearTable), and every randomized decision tree that recovers s with error at most ε on every input has depth q with 2^n (1 - ε) ≤ 2^q (Cslib.QueryComplexity.linearTable_randomized_lower_bound); for ε < 1/2 this forces q ≥ n (Cslib.QueryComplexity.card_le_depth_of_linearTable_randomized). The search problem is a promise problem, so the lower bounds take any total F that answers s on the inputs linearTable e s. Hence the deterministic complexity and every bounded-error randomized complexity of linearDecode e are exactly n (Cslib.QueryComplexity.complexity_linearDecode, Cslib.QueryComplexity.randomizedComplexity_linearDecode), against the single quantum query of CslibFrontier/Computability/QueryComplexity/Quantum/BernsteinVazirani.lean. de Wolf §2.4.2 notes that classically n queries are needed; the counting argument and its randomized form are formulated here.

Main definitions #

Main results #

References #

def Cslib.QueryComplexity.linearTable {N : ℕ} {K : Type u_1} [Fintype K] (e : Fin N ≃ (K → Bool)) (s : K → Bool) :
Fin N → Bool

The truth table of the linear function a ↦ s ⬝ᵥ a, with the query positions identified with the bit strings by e.

The truth table of a ↦ s ⬝ᵥ a is the Hadamard codeword of s, read through e.

The truth table determines the hidden string.

def Cslib.QueryComplexity.linearDecode {N : ℕ} {K : Type u_1} [DecidableEq K] (e : Fin N ≃ (K → Bool)) (X : Fin N → Bool) :
K → Bool

Read off the hidden string at the unit vectors: coordinate k is the queried bit at the position of the unit vector e_k.

@[simp]
theorem Cslib.QueryComplexity.linearDecode_linearTable {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) (s : K → Bool) :

Decoding the truth table of a ↦ s ⬝ᵥ a recovers s.

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

The decision tree that queries the n unit vectors and outputs the decoded string.

The unit-vector tree computes linearDecode e on every input.

The unit-vector tree has depth at most n.

theorem Cslib.QueryComplexity.card_le_depth_of_linearTable {N : ℕ} {K : Type u_1} [Fintype K] (e : Fin N ≃ (K → Bool)) (t : DecisionTree (Fin N) (K → Bool)) (ht : ∀ (s : K → Bool), t.eval (linearTable e s) = s) :

The deterministic lower bound for Bernstein–Vazirani: a decision tree that recovers s from the truth table of a ↦ s ⬝ᵥ a for every s has depth at least n.

theorem Cslib.QueryComplexity.linearTable_randomized_lower_bound {N : ℕ} {K : Type u_1} [Fintype K] (e : Fin N ≃ (K → Bool)) (μ : RandomizedDecisionTree (Fin N) (K → Bool)) {F : (Fin N → Bool) → K → Bool} (hF : ∀ (s : K → Bool), F (linearTable e s) = s) {ε : ℝ} (hμ : ∀ (s : K → Bool), μ.errorProb F (linearTable e s) ≤ ε) :
2 ^ Fintype.card K * (1 - ε) ≤ 2 ^ μ.depth

The randomized lower bound for Bernstein–Vazirani: a randomized decision tree that recovers s from the truth table of a ↦ s ⬝ᵥ a with error at most ε for every s (as the restriction of a total function F) has depth q with 2^n (1 - ε) ≤ 2^q.

theorem Cslib.QueryComplexity.card_le_depth_of_linearTable_randomized {N : ℕ} {K : Type u_1} [Fintype K] (e : Fin N ≃ (K → Bool)) (μ : RandomizedDecisionTree (Fin N) (K → Bool)) {F : (Fin N → Bool) → K → Bool} (hF : ∀ (s : K → Bool), F (linearTable e s) = s) {ε : ℝ} (hε : ε < 1 / 2) (hμ : ∀ (s : K → Bool), μ.errorProb F (linearTable e s) ≤ ε) :

Bounded-error randomized decision trees need n queries for Bernstein–Vazirani: for error ε < 1/2, a randomized decision tree that recovers s from the truth table of a ↦ s ⬝ᵥ a has depth at least n.

The deterministic query complexity of Bernstein–Vazirani is n.

theorem Cslib.QueryComplexity.randomizedComplexity_linearDecode {N : ℕ} {K : Type u_1} [Fintype K] [DecidableEq K] (e : Fin N ≃ (K → Bool)) {ε : NNReal} (hε : ↑ε < 1 / 2) :

The bounded-error randomized query complexity of Bernstein–Vazirani is n, for every error 0 ≤ ε < 1/2.