Documentation

CslibFrontier.Computability.QueryComplexity.Quantum.SimonSearch

Simon's algorithm finds the hidden string #

The search version of Simon's problem (Simon, de Wolf, §3.1) asks for the hidden string s itself, for f : {0,1}^n → {0,1}^n with the promise that f(a) = f(b) exactly when b ∈ {a, a ⊕ s} (Cslib.QueryComplexity.SimonPromise). de Wolf §3.1 promises s ≠ 0. Here the quantum algorithm is analyzed on every promise input, including s = 0 (injective f), where the correct output is 0; this is stronger than the problem with s ≠ 0. As in CslibFrontier/Computability/QueryComplexity/Quantum/Simon.lean, the input is the truth table X : Fin N → Bool of the N = n 2^n output bits of f, and queries are bit queries.

The algorithm. Simon's algorithm with m rounds (Cslib.Quantum.simonAlg) measures m rows z_1, …, z_m ∈ {0,1}^n, and the classical post-processing Cslib.Quantum.simonSolve outputs the unique nonzero string orthogonal to all of them, or 0 if there is none or more than one. It outputs s whenever the strings orthogonal to all rows are exactly 0 and s (Cslib.Quantum.SimonDetermines, Cslib.Quantum.simonSolve_eq).

Analysis. Every measured row is orthogonal to s, so the post-processing fails only if some w ∉ {0, s} is orthogonal to all rows. For s = 0 this is the acceptance event of the decision version, of probability at most (2^n - 1) / 2^m (Cslib.Quantum.measureProb_simonAlg_le_of_injective). For s ≠ 0 every fiber of f, applied rowwise to m rows, has at most 2^m elements (Cslib.Quantum.card_simonG_fiber_le), so each row matrix is measured with probability at most 2^m / 2^{mn} (Cslib.Quantum.measureProb_simonAlg_le); and two distinct nonzero strings s, w are both orthogonal to all m rows of exactly 2^{nm} / 4^m row matrices (Cslib.BitString.card_kernel_pair). A union bound over the 2^n - 2 strings w gives failure probability at most (2^n - 1) / 2^m again (Cslib.Quantum.measureProb_not_simonDetermines_le). So the algorithm finds s with probability at least 1 - (2^n - 1) / 2^m on every promise input (Cslib.Quantum.le_measureProb_simonFound), and with m = n + 2 rounds, n (n + 2) bit queries find s with probability above 3/4 (Cslib.Quantum.simonAlg_search_spec).

The separation. Every randomized decision tree that finds s with error 1/3 on the promise inputs with s ≠ 0, with no requirement when s = 0, has depth q with 2^n ≤ (q + 2n)² (Cslib.QueryComplexity.simon_search_ne_zero_two_pow_le_sq): appending the 2n bit queries that check its output decides Simon's problem. This gives the exponential separation for the search problem of de Wolf §3.1 (Cslib.Quantum.simon_search_separation), with the quantum side also correct when s = 0. Both sides count bit queries. If the classical tree is also required to output 0 when s = 0, the bound is 2^n ≤ q² (Cslib.QueryComplexity.simon_search_two_pow_le_depth_sq).

Source mapping. de Wolf §3.2 repeats the subroutine O(n) times until the measured rows span s^⊥, then solves the linear system. Here the m rounds run side by side in one bit-query algorithm, and the bound 1 - (2^n - 1) / 2^m, which also covers s = 0, is formulated here. The post-processing Cslib.Quantum.simonSolve searches all 2^n strings; it makes no queries, so it does not affect the query count, but polynomial-time post-processing by Gaussian elimination is not formalized.

Main definitions #

Main results #

References #

The classical post-processing #

def Cslib.Quantum.simonSolutions {n m : ℕ} (zs : Fin m × Fin n → Bool) :
Finset (Fin n → Bool)

The nonzero strings orthogonal to every row z_r of the row matrix zs.

def Cslib.Quantum.simonSolve {n m : ℕ} (zs : Fin m × Fin n → Bool) :
Fin n → Bool

The classical post-processing of Simon's algorithm: the unique nonzero string orthogonal to every measured row (the sum of the one-element set Cslib.Quantum.simonSolutions zs), or 0 if there is none or more than one. It searches all 2^n strings and makes no queries.

def Cslib.Quantum.SimonDetermines {n m : ℕ} (zs : Fin m × Fin n → Bool) (s : Fin n → Bool) :

The measured rows zs determine the hidden string s: the strings orthogonal to every row are exactly 0 and s.

Instances For
    @[instance_reducible]
    instance Cslib.Quantum.instDecidableSimonDetermines {n m : ℕ} (zs : Fin m × Fin n → Bool) (s : Fin n → Bool) :
    theorem Cslib.Quantum.simonSolve_eq {n m : ℕ} {zs : Fin m × Fin n → Bool} {s : Fin n → Bool} (h : SimonDetermines zs s) :

    The post-processing outputs the hidden string when the rows determine it.

    def Cslib.Quantum.simonFound {N n : ℕ} (m : ℕ) (s : Fin n → Bool) :

    The outcomes of Simon's algorithm on which the post-processing outputs s.

    @[simp]
    theorem Cslib.Quantum.mem_simonFound {N n m : ℕ} {s : Fin n → Bool} {i : Fin N} {b : Bool} {w : SimonWork m n} :

    The analysis #

    theorem Cslib.Quantum.card_simonG_fiber_le {N n m : ℕ} {E : Fin N ≃ (Fin n → Bool) × Fin n} {X : Fin N → Bool} {s : Fin n → Bool} (hX : QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s) (ys : Fin m × Fin n → Bool) :
    {a : Fin m × Fin n → Bool | simonG E X a = ys}.card ≤ 2 ^ m

    The fibers of f applied rowwise. Under Simon's promise, each row of a preimage of ys is one of the two preimages of the corresponding row of ys, so the fibers have at most 2^m elements.

    theorem Cslib.Quantum.measureProb_not_simonDetermines_le {N n m : ℕ} (E : Fin N ≃ (Fin n → Bool) × Fin n) (i₀ : Fin N) {X : Fin N → Bool} {s : Fin n → Bool} (hX : QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s) (hs : s ≠ 0) :
    measureProb (run (simonAlg m E i₀) (simonInit i₀) X (m * n)) {x : Fin N × Bool × SimonWork m n | match x with | (fst, fst_1, w) => ¬SimonDetermines w.xs s} ≤ (2 ^ n - 1) / 2 ^ m

    The rows rarely fail to determine a nonzero hidden string: for s ≠ 0 they fail with probability at most (2^n - 1) / 2^m.

    theorem Cslib.Quantum.le_measureProb_simonFound {N n m : ℕ} (E : Fin N ≃ (Fin n → Bool) × Fin n) (i₀ : Fin N) {X : Fin N → Bool} {s : Fin n → Bool} (hX : QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s) :
    1 - (2 ^ n - 1) / 2 ^ m ≤ measureProb (run (simonAlg m E i₀) (simonInit i₀) X (m * n)) (simonFound m s)

    Simon's algorithm finds the hidden string: on every promise input, including s = 0, the post-processing of the measured rows outputs s with probability at least 1 - (2^n - 1) / 2^m.

    theorem Cslib.Quantum.simonAlg_search_spec {N n : ℕ} (E : Fin N ≃ (Fin n → Bool) × Fin n) (i₀ : Fin N) :
    ‖simonInit i₀‖ = 1 ∧ ∀ (X : Fin N → Bool) (s : Fin n → Bool), QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s → 3 / 4 < measureProb (run (simonAlg (n + 2) E i₀) (simonInit i₀) X ((n + 2) * n)) (simonFound (n + 2) s)

    Simon's algorithm solves the search version with n (n + 2) bit queries: from a unit initial state, with n + 2 rounds, the post-processing of the measured rows outputs the hidden string with probability above 3/4 on every promise input.

    theorem Cslib.Quantum.simon_search_separation {N n : ℕ} (E : Fin N ≃ (Fin n → Bool) × Fin n) (i₀ : Fin N) (hn : 1 ≤ n) :
    (∀ (X : Fin N → Bool) (s : Fin n → Bool), QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s → 3 / 4 < measureProb (run (simonAlg (n + 2) E i₀) (simonInit i₀) X ((n + 2) * n)) (simonFound (n + 2) s)) ∧ ∀ (μ : RandomizedDecisionTree (Fin N) (Fin n → Bool)) (S : (Fin N → Bool) → Fin n → Bool), (∀ (X : Fin N → Bool) (s : Fin n → Bool), QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s → s ≠ 0 → S X = s) → (∀ (X : Fin N → Bool) (s : Fin n → Bool), QueryComplexity.SimonPromise (QueryComplexity.simonFun E X) s → s ≠ 0 → μ.errorProb S X ≤ 1 / 3) → 2 ^ n ≤ (μ.depth + 2 * n) ^ 2

    The exponential quantum–classical separation for the search version of Simon's problem (de Wolf, §3.1), in the bit-query model on the truth table X : Fin N → Bool of f : {0,1}^n → {0,1}^n, for n ≥ 1: Simon's algorithm with classical post-processing finds the hidden string with n (n + 2) queries and probability above 3/4 on every promise input, including s = 0, while every randomized decision tree finding it with error 1/3 only on the promise inputs with s ≠ 0 (as the restriction of a total function S) has depth q with 2^n ≤ (q + 2n)².