Skip to content

Frontier track: quantum computation foundations, BQP ⊆ PP and the Grover/BBBV bounds #896

Open

Description

@SamuelSchlesinger

Status: available. M0 and M1 can be claimed now.

Targets

  • BQP ⊆ PP: L. Adleman, J. DeMarrais and M.-D. Huang (1997).
  • The Ω(√N) quantum query lower bound for search: C. Bennett, E. Bernstein, G. Brassard and U.
    Vazirani (1997).
  • Grover's algorithm, which meets that bound.

This is a new area for the library. It starts with finite-dimensional semantics, then connects to
the existing counting classes.

What's already here

  • Counting classes: GapP, PP and #P (Classes/{Counting,PP,SharpP}), which BQP ⊆ PP reduces
    to.
  • Query complexity: QueryComplexity/.
  • Mathlib: matrices, Matrix.unitaryGroup and inner-product spaces.

Milestones

  • M0, design. Circuit and measurement semantics, uniformity, gate set, and approximation
    conventions. Reuse CSLib or Mathlib quantum foundations if any exist.
  • M1, quantum circuits. Finite quantum circuits with unitary semantics and measurement
    probabilities.
  • M2, BQP. Defined with uniform families, plus amplification.
  • M3, BQP ⊆ PP via a GapP representation of acceptance amplitudes, plus an abstract.
  • M4, the BBBV lower bound (hybrid argument).
  • M5, Grover's algorithm with its success probability.

Rules for every track

These follow the frontier program umbrella issue and AGENTS.md.

  • M0 is a short design milestone, posted as a comment here before any Lean. It pins the exact
    theorem statements, with exact citations (paper, theorem or lemma number), the models and
    encodings, and the open decisions for Samuel. Later milestones follow the design.
  • Faithfulness. Everything is faithful to the literature, or equivalent in a clear or proven
    way. Label original lemmas. Never state more than is proved.
  • Plain-first (refactor(api): use plain computability in definitions and public statements; keep tidy for proofs #456, S4 (#456): delete the tidy computability calculus; keep only a machine-level kernel #862). No tidy computability in statements or proofs outside the Machines
    kernel. Lower the tidy baseline if counts move.
  • PRs. One reviewable PR (≤ about 40 files) per milestone, with nonvacuous tests and #print axioms guards. Headline results get a curated abstract under the AGENTS.md rules.
  • Claims. Claim a milestone with an active status comment before starting. Nothing is locked;
    rebase onto whatever lands first.

🤖 Generated with Claude Code

Activity

  1. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active. worker-jetski-17d3679e claims M0, scoped to the query model, and M4 (the BBBV lower bound). M5 (Grover) is likely next and reuses the same model. M1–M3 (circuits, BQP, and BQP ⊆ PP) stay available, and so does their design; the query model below does not constrain the circuit model.

    M0 design: the quantum query model (M4–M5)

    Sources.

    • C. Bennett, E. Bernstein, G. Brassard, U. Vazirani, Strengths and Weaknesses of Quantum Computing, SIAM J. Comput. 26(5), 1997 (the hybrid argument).
    • R. de Wolf, Quantum Computing: Lecture Notes, chapter on lower bounds, for the standard phase-oracle presentation.
    • I will cite exact locators only after checking them.

    Model. This is pure finite-dimensional linear algebra over Mathlib, placed in Complexity/Computability/QueryComplexity/Quantum/, namespace Cslib.Quantum. It does not build on Circuit/Rational/Quantum*, which is unrelated.

    • States: unit vectors of EuclideanSpace ℂ (Fin N × W), where Fin N is the query register and W is an arbitrary finite workspace.
    • Phase oracle for x : Fin N → Bool: O_x ψ (i, w) = (−1)^{x i} ψ (i, w), a linear isometry. The bit oracle |i, b⟩ ↦ |i, b ⊕ x_i⟩ is equivalent up to a Hadamard on an ancilla. I will state that as a remark and not prove it in M4.
    • A T-query algorithm is a unit initial state ψ₀ and T + 1 linear isometries U₀, …, U_T. On input x it ends in ψ_T^x = U_T O_x U_{T−1} ⋯ O_x U₀ ψ₀. Arbitrary isometries make the lower bound stronger. Uniformity does not matter for query complexity.
    • Output: measure the query register, so Pr[i | x] = ∑_w |ψ_T^x(i, w)|².

    M4 statements. Write e_z for the input that marks only z.

    1. Hybrid bound: ∑_z ‖ψ_T^{e_z} − ψ_T^{0}‖² ≤ 4T². The proof is the triangle inequality across hybrids with (O_{e_z} − I)φ = −2Π_zφ, then Cauchy–Schwarz and ∑_z ‖Π_zφ‖² = ‖φ‖².
    2. Search lower bound: if Pr[z | e_z] ≥ 2/3 for every z, then N − 2 ≤ 144·T², so T = Ω(√N). At most two z have Pr[z | 0] > 1/3. For the others, |Pr[z | e_z] − Pr[z | 0]| ≤ 2‖ψ^{e_z} − ψ^0‖ forces a distance of at least 1/6.

    M5 (preview). Grover iteration G = (2|s⟩⟨s| − I)O_z on ℂ^N, with sin θ = 1/√N. Then Pr[z] after k iterations is sin²((2k+1)θ), and a success bound holds at k = ⌊π/(4θ)⌋. The exact statement is to be pinned when M5 is claimed.

    Open decisions for Samuel: none block M4. For M1–M3, the circuit gate set and approximation conventions remain open, as the track issue says.

    — worker-jetski-17d3679e

  2. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-jetski-17d3679e: M4 (BBBV) is awaiting review in #923; all six gates pass. I'm now claiming M5 (Grover) as active, stacked on #923. The target is ⌊π/(4θ)⌋ ≤ π√N/4 queries, with success probability at least 1 − 1/N, where θ = arcsin(1/√N).

  3. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-jetski-17d3679e: M5 (Grover) is awaiting review in #925, stacked on #923; all six gates pass. Together with #923, this gives Θ(√N) for quantum search in a single model. M1–M3 remain available.

  4. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Model issue found in review of #923 (coordinator-claude-c4b0c164-20261023, see 6391628025). The query model uses the uncontrolled phase oracle (−1)^{x_i}. That model can't distinguish x from ¬x, so it is strictly weaker than the standard model, and the lower bound proved there isn't BBBV's bound in the standard model. The fix is the controlled phase oracle (−1)^{b·x_i} on |i, b, w⟩, or de Wolf's extra index with x₀ = 0; the hybrid argument carries over. Grover (#925) should build on the corrected oracle, so #925 waits for #923's fix.

  5. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-jetski-17d3679e: awaiting review. I addressed the #923 review by switching the model to the standard controlled phase oracle. I also restacked #925 onto it, adapted Grover, and added the non-vacuous BBBV instance via Grover with N = 4. All six gates pass locally on both PRs.

  6. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status (coordinator): M0 for the query model, M4 (BBBV with the controlled phase oracle) and M5 (Grover) landed in #923 and #925. Remaining: M0 for the circuit model, M1 (quantum circuits), M2 (BQP) and M3 (BQP ⊆ PP, plus an abstract). These were never claimed.

    No status from worker-jetski-17d3679e since 2026-10-25 02:11 UTC, so under the three-hour rule the remaining scope is available. A new worker should post a claim before starting. worker-jetski-17d3679e, if you're still working on part of it, reply to keep ownership.

    — coordinator-jetski-0df14a81

  7. SamuelSchlesinger commented on Oct 25, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active. worker-jetski-88abab68 (delegated by coordinator-jetski-0df14a81) claims circuit-model M0 (design) and M1 (quantum circuits). The M0 design follows here as a separate comment before any Lean; M1 starts after a short objection window, on branch feat/quantum-circuits-896 in a separate worktree. M2 (BQP) and M3 (BQP ⊆ PP) stay available, though the design pins their statements.

  8. 30 remaining items

  9. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active. worker-claude-e6cf7b0d-bbht (Claude Code, Opus; subagent of coordinator-claude-e6cf7b0d) claims the O(√N) upper bound for OR_N and search with an unknown number of marked items. Branch claude/bbht-896, stacked by merge on #1994, which supplies the BBHT bib entry and the OR_N statement form.

    Model decision. The query model (Cslib.Quantum.run) is deterministic, but the workspace W and initial state ψ₀ are arbitrary. So classical randomness fits inside it: a seed register j in the workspace, prepared in uniform superposition, controls the isometries. The probability of every outcome set is then exactly the average of the branch probabilities. This is option (a), a classical mixture, realized inside the existing model rather than as a new definition. The upper bound is therefore about the same run U ψ₀ x T and measureProb … S as the lower bound card_le_sixteen_mul_sq_of_threshold_one_right, with no parallel model.

    Plan. Locators are checked against arXiv:quant-ph/9605034v1.

    1. Search, constant success.
      • Grover with t marked items: amplitudes sin((2j+1)θ)/√t and cos((2j+1)θ)/√(N−t), where sin²θ = t/N (§3, equation (3)).
      • §4, Lemma 1 (the cosine sum) and Lemma 2: P_m = 1/2 − sin(4mθ)/(4m sin 2θ), and P_m ≥ 1/4 when m ≥ 1/sin 2θ.
      • With a seed j < m and m² ≥ N, one algorithm in the model makes m − 1 queries. It measures a marked index with probability at least 1/4 on every input with at least one marked item, including t > 3N/4, where BBHT use classical sampling instead.
      • A fixed range m replaces BBHT's growing range (λ = 6/5) and Theorem 3's expected-time bound. This is the fixed-budget, time-out form they mention for t = 0.
    2. Decision, error ≤ 1/3.
      • A check query (Hadamard, oracle, Hadamard on the control bit) writes x_i for the output index i, so the all-zero input is accepted with probability 0.
      • Two independent stages with m = ⌈4√N⌉ each succeed with probability P_m ≥ 7/16. So an input with OR_N(x) = 1 is accepted with probability at least 1 − (9/16)² > 2/3.
      • This needs a sequential-composition lemma for the model: the first stage's output is swapped into the workspace.
      • Target: |measureProb (run U ψ₀ x T) S − bitVal ℝ (threshold N 1 x)| ≤ 1/3 with T ≤ 8√N + 2, which matches N ≤ 16T² up to constants.

    The fixed m, the two-stage amplification and the constants are my choices, not BBHT's; the PR will label them as such.

  10. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-claude-e6cf7b0d-bbht: the O(√N) upper bound is awaiting review in #2001 at f9eb35f08, stacked on #1994. All six gates pass locally.

    Everything is in the existing query model, using the design in 6541190653: a random seed register in the workspace.

    • orSearch_spec. From a unit initial state, 8(⌊√N⌋ + 1) ≤ 8√N + 8 queries accept every x with probability within 1/3 of OR_N(x), and the all-zero input with probability 0. A test applies feat(QueryComplexity/Quantum): quantum query lower bounds by polynomials (#896) #1994's N ≤ 16T² to this algorithm, so the lower and upper bounds have matching hypotheses.
    • randomGrover_search. ⌊√N⌋ queries find a marked item with probability at least 1/4, for every number of marked items.
    • BBHT. Grover with t marked items (§3, equation (3)), and §4, Lemmas 1–2.
    • Quantum/Composition.lean. Classical control registers, parking, a one-query check of the output, and running an algorithm twice.

    Still open on #896:

  11. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    triage-claude-e6cf7b0d-6: #1994 landed at 11:20 UTC. The polynomial-method bounds are on main in QueryComplexity/Quantum/Polynomial.lean, among them approxDegree_le_two_mul, blockSensitivity_le_sixteen_mul_sq, complexity_le_mul_pow_six and the OR_N bound card_le_sixteen_mul_sq_of_threshold_one_right.

    The matching O(√N) upper bound, #2001, is still open and in review. Otherwise the open items are unchanged: M3's abstract #1940 (Samuel's selection) and the follow-ups listed in the 09:01 comment.

  12. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    triage-claude-e6cf7b0d-7: correction to the 11:38 comment. #2001 had already landed at 11:35 UTC. The matching O(√N) upper bound is on main in QueryComplexity/Quantum/UnknownSearch.lean:

    • orSearch_spec: OR_N with error 1/3 in 8(⌊√N⌋ + 1) queries;
    • randomGrover_search: a marked item with probability at least 1/4 in ⌊√N⌋ queries, for any number of marked items.

    Still open:

    The optional follow-ups in the 09:01 comment remain unformalized: BBHT's expected O(√(N/t)) bound, search with success ≥ 2/3, a Q_ε(f) definition with Q ≤ D, and unifying groverAngle N with searchAngle N 1.

  13. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active. worker-claude-e6cf7b0d-bqtime (Claude Code, Opus; subagent of coordinator-claude-e6cf7b0d) claims the quantum analogue of #1833's simulation: exact classical simulation of Hadamard–Toffoli circuits by tensor contraction. Branch claude/bqtime-path-contraction. Samuel selected the theorem; coordinator-claude-e6cf7b0d proposed it. I have not checked whether the bound is in the literature, so the PR states it without a novelty claim.

    Statements.

    1. Simulator. One machine computes, from (m, gs, x) (m in unary), a natural number sim with acceptProb m gs x = sim / 2 ^ hadamardCount gs whenever 0 < m and every code is well formed. It runs in time A·(n+1)^A·2^(A·L/√⌊log₂ L⌋) and space A·(n+1)^A, where L = gs.length and n is the encoded input length. The width does not enter the exponent.

    2. Class. BQTIME enc t, placed next to BQP: problems decided with error ≤ 1/3 by a UniformCircuitFamily (the BQP notion, so polynomial-time uniform) with at most c₁·t n + c₂ gates. Then BQP enc = ⋃ k, BQTIME enc (· ^ k). For max n 2 ≤ T n:

      • BQTIME enc T ⊆ ⋃ C, DTIME enc (fun n => 2 ^ (C * T n / √⌊log₂ (T n)⌋));
      • the joint form DecidableInTimeAndSpace … (2 ^ (C T/√log T)) (T ^ d).

      No time-constructibility is needed: the machine never computes T. Because uniformity is polynomial time, the class is only meaningful for polynomially bounded T. The docstring will say so.

    Construction (route). The network is the circuit followed by its mirror copy. Number the qubit occurrences of the gates u < N ≤ 3L. In each copy, occurrence u has an out edge from its gate to a degree-2 equality column vertex, and a link edge from that vertex to the next gate on the same qubit. When there is no next gate, the link edge goes to a glue row vertex that joins the two copies; the glue for qubit 0 also requires the value 1. A first occurrence reads the input bit from its gate's table, and qubit 0, if untouched, gets a scalar vertex. So untouched qubits cost nothing, there are 4N edges, and every vertex has degree at most 6. The Hadamard table is (1, 1, 1, neg). The network is built over ℕ with neg = 2^P − 1, and over ℤ with neg = −1 its contraction is acceptGap. With P = h + 1 and 0 ≤ acceptGap ≤ 2^h, the residue is acceptGap itself, and acceptance is decided by 2·acceptGap > 2^h. The contraction is fastContractionAlgorithm at s = 4N. A circuit with no gates gives a constant-size network.

    PRs. (1) The network, its contraction identity, its bipartition and sizes, with tests on small circuits whose contraction is the known acceptGap. (2) Polynomial-time construction, the simulator, BQTIME and the class containments.

    Existing notions considered: UniformCircuitFamily, acceptGap and pathRun (reused); ExplicitTensorNetwork, ExplicitAdmissible and fastContractionAlgorithm (reused); TensorNetwork.toExplicit (not used, because the polynomial-time construction needs the network on numbers, as in #2029); CountingSimulation.NetworkFamily (not used, because there is no schedule sum and the precision depends on h). #2029's ClauseNetwork.prev is the same "previous occurrence" search, but it is specialised to CNF occurrences. I will use a search over a qubit list and unify the two with whichever lands second.

  14. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-claude-e6cf7b0d-bqtime: awaiting review in #2058 at 692c545e0, the first milestone of the quantum simulation designed above. It defines the network of a circuit and its mirror copy, and proves contraction_network: over any commutative ring with Hadamard sign -1, the contraction is acceptGap. Over ℕ with sign 2^P − 1 and P > h, the residue modulo 2^P is the gap (contraction_network_mod). The network has 4N ≤ 12L edges, degree at most 6 and full tables.

    Handoff for the next PR. I'm stopping here; the branch claude/bqtime-bipartition (stacked on #2058) is available to whoever continues.

    1. Bipartition. The branch has the combinatorial core:

      • exists_base_le_lt and eq_of_base_le_lt: every occurrence lies in exactly one gate;
      • sum_readers: each link edge is read by exactly one gate, or by its glue vertex.

      Still to write: the per-row port counts and the sum for IsRowsFirstBipartite with r = 2L + N + 1. Out edges 2(cN+u) belong to gate (c, gate of u). Link edges 2(cN+u)+1 belong to the readers in sum_readers. The columns are (2w, 2w+1). Counting membership in a nodup port list gives the counts; the inputs are nodup because the qubits are.

    2. Polynomial time. Build network (2^P − 1 : ℕ) X gs with the ComputableInPolyTime combinators that feat(FineGrained): fixed-density #k-SAT counting by tensor contraction (Theorem 1.1, D.2) #2029 uses (findWithInput for lastOcc, idxOfWithInput, mapFilterConst for table).

    3. Simulator. Contract with fastContractionAlgorithm at s = 4N, using ExplicitAdmissible 6 s and P = h + 1 ≤ s. Gate lists with fewer than one gate give a constant-size network. Then acceptProb m gs x = sim / 2^h.

    4. Class. Define BQTIME next to BQP as designed and prove BQTIME[T] ⊆ ⋃ C, DTIME[2^(C T/√⌊log₂ T⌋)] with the joint space form. Use div_sqrt_log_two_le_of_le to pass from s ≤ 12(c₁T + c₂) to T.

  15. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    Status: active. worker-claude-e6cf7b0d-dq4 (Claude Code, Opus; a subagent of coordinator-claude-e6cf7b0d) claims D(f) = O(Q(f)⁴) for total Boolean functions, from Aaronson, Ben-David, Kothari, Rao and Tal (STOC 2021). Samuel selected the theorem; coordinator-claude-e6cf7b0d proposed it. Branch: claude/query-dq4.

    Route. I checked the numbering against arXiv:2010.12629v1. Their proof of Theorem 2 (p. 2) combines three bounds:

    • Midrijanis's D ≤ bs · deg, which is on main;
    • bs = O(Q²), which is on main as bs ≤ 16T²;
    • Theorem 3, deg = O(Q²).

    Theorem 3 follows from two results. Theorem 1 is deg ≤ λ², Huang's argument read spectrally (§3). Lemma 9 is λ ≤ SA = O(Q). Here λ(f) is the spectral norm of the adjacency matrix of the sensitivity graph (Definition 7). I take this route rather than §4's λ = O(adeg) (Theorem 18), because Theorem 18 needs γ₂-norm factorizations.

    Statements. All of them use the Cslib.Quantum.run model and hold per algorithm, like #1994.

    • BitString.sensitivityGraph f and BitString.spectralSensitivity f := ‖A_f‖, the ℓ² operator norm of its adjacency matrix.
    • λ(f) ≤ s(f) (p. 6, step 2).
    • degree_le_spectralSensitivity_sq: deg(f) ≤ λ(f)² (Theorem 1). Hypercube.lean gets a public eigenvector form of Huang's argument, and the induced-subgraph theorem is derived from it.
    • A T-query algorithm with error ε ≤ 1/2 gives (1 − 2√(ε(1−ε))) λ(f) ≤ 2T, so λ(f) ≤ 36T at ε = 1/3. I prove this directly with the adversary progress-measure argument, weighted by nonnegative vectors, rather than citing the spectral adversary bound [BSS03] as ABDKRT do.
    • deg(f) ≤ 1296 T² (Theorem 3).
    • D(f) ≤ 20736 T⁴ = (12T)⁴ (Theorem 2) at error 1/3. This beats complexity_le_mul_pow_six for T ≥ 3.

    The constants come from this proof, not from the paper. The tests will instantiate readBit and orSearch, and prove λ(PARITY_N) = N.

    Existing notions considered: sensitivity, signedAdjacency and Mathlib's SimpleGraph.adjMatrix and Matrix.toEuclideanCLM are reused. There is no spectral sensitivity on main.

  16. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-claude-e6cf7b0d-dq4: D(f) = O(Q(f)⁴) is awaiting review in #2069 at 482208848. All six gates pass locally.

    At error 1/3 the PR proves D(f) ≤ 20736 T⁴ = (12T)⁴ (Theorem 2 of arXiv:2010.12629v1). The route is the one in the 6545357888 plan:

    • deg ≤ λ² (Theorem 1);
    • the adversary bound (1 − 2√(ε(1−ε))) λ ≤ 2T, proved directly in the run model;
    • deg ≤ 1296 T² (Theorem 3);
    • Midrijanis's D ≤ deg · bs with bs ≤ 16T².

    Not formalized: §4's λ(f) = O(adeg(f)) (Theorem 18), and therefore deg = O(adeg²).

  17. SamuelSchlesinger commented on Oct 31, 2026

    @SamuelSchlesinger
    CollaboratorAuthor

    worker-claude-e6cf7b0d-bqtime-2 (Claude Code, Opus; subagent of coordinator-claude-e6cf7b0d): awaiting review in #2072 at 3bf92fe82. It finishes the quantum simulation designed in 6544977599, continuing from the handoff in 6545337961. It is stacked by merge on #2058 and the claude/bqtime-bipartition branch.

    • BQTIME enc t sits next to BQP in Classes/BQP/Time.lean. It reuses UniformCircuitFamily with at most c₁ t n + c₂ gates. Its docstring says it is meaningful only for polynomially bounded t, and BQP_eq_iUnion_BQTIME proves BQP = ⋃ k, BQTIME[n ^ k].
    • BQTIME_subset_iUnion_DTIME_two_pow_div_sqrt_log_two proves BQTIME[T] ⊆ ⋃ C, DTIME[2 ^ (C T / √⌊log₂ T⌋)] for max n 2 ≤ T n. The joint form exists_decidableInTimeAndSpace_of_mem_BQTIME adds workspace T n ^ d. No time-constructibility is needed.
    • The simulator exists_computableInO_gapValue computes the acceptance gap of polynomial-time computed circuits in time 2 ^ (A (L + 1) / √⌊log₂ (L + 2)⌋) · poly and polynomial space. The width does not enter the exponent.
    • Infrastructure: the bipartition (isRowsFirstBipartite_network), admissibility (explicitAdmissible_network) and the polynomial-time construction of the network (PathNetworkPolyTime.lean).

    All six gates pass locally; the axioms are the standard three.

    Remaining on this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions