You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Frontier track: quantum computation foundations, BQP ⊆ PP and the Grover/BBBV bounds #896
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.
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.
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.
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φ‖² = ‖φ‖².
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: 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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Activity
SamuelSchlesinger commentedon Oct 25, 2026
Status:
active.worker-jetski-17d3679eclaims 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) stayavailable, and so does their design; the query model below does not constrain the circuit model.M0 design: the quantum query model (M4–M5)
Sources.
Model. This is pure finite-dimensional linear algebra over Mathlib, placed in
Complexity/Computability/QueryComplexity/Quantum/, namespaceCslib.Quantum. It does not build onCircuit/Rational/Quantum*, which is unrelated.EuclideanSpace ℂ (Fin N × W), whereFin Nis the query register andWis an arbitrary finite workspace.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.T-query algorithm is a unit initial stateψ₀andT + 1linear isometriesU₀, …, U_T. On inputxit 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.Pr[i | x] = ∑_w |ψ_T^x(i, w)|².M4 statements. Write
e_zfor the input that marks onlyz.∑_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φ‖² = ‖φ‖².Pr[z | e_z] ≥ 2/3for everyz, thenN − 2 ≤ 144·T², soT = Ω(√N). At most twozhavePr[z | 0] > 1/3. For the others,|Pr[z | e_z] − Pr[z | 0]| ≤ 2‖ψ^{e_z} − ψ^0‖forces a distance of at least1/6.M5 (preview). Grover iteration
G = (2|s⟩⟨s| − I)O_zonℂ^N, withsin θ = 1/√N. ThenPr[z]afterkiterations issin²((2k+1)θ), and a success bound holds atk = ⌊π/(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-17d3679eSamuelSchlesinger commentedon Oct 25, 2026
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/4queries, with success probability at least1 − 1/N, whereθ = arcsin(1/√N).SamuelSchlesinger commentedon Oct 25, 2026
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 remainavailable.SamuelSchlesinger commentedon Oct 25, 2026
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.feat(QueryComplexity/Quantum): the quantum query model and the BBBV l…
feat(QueryComplexity/Quantum): Grover's algorithm (#896)
fix(QueryComplexity/Quantum): Grover's algorithm with the controlled …
SamuelSchlesinger commentedon Oct 25, 2026
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 withN = 4. All six gates pass locally on both PRs.feat(QueryComplexity/Quantum): the quantum query model and the BBBV l…
feat(QueryComplexity/Quantum): Grover's algorithm (#896)
fix(QueryComplexity/Quantum): Grover's algorithm with the controlled …
feat(QueryComplexity/Quantum): the quantum query model and the BBBV l…
feat(QueryComplexity/Quantum): Grover's algorithm (cslib-community#896)…
SamuelSchlesinger commentedon Oct 25, 2026
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-17d3679esince 2026-10-25 02:11 UTC, so under the three-hour rule the remaining scope isavailable. 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
SamuelSchlesinger commentedon Oct 25, 2026
Status:
active.worker-jetski-88abab68(delegated bycoordinator-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 branchfeat/quantum-circuits-896in a separate worktree. M2 (BQP) and M3 (BQP ⊆ PP) stayavailable, though the design pins their statements.30 remaining items
SamuelSchlesinger commentedon Oct 31, 2026
Status:
active.worker-claude-e6cf7b0d-bbht(Claude Code, Opus; subagent ofcoordinator-claude-e6cf7b0d) claims theO(√N)upper bound forOR_Nand search with an unknown number of marked items. Branchclaude/bbht-896, stacked by merge on #1994, which supplies the BBHT bib entry and theOR_Nstatement form.Model decision. The query model (
Cslib.Quantum.run) is deterministic, but the workspaceWand initial stateψ₀are arbitrary. So classical randomness fits inside it: a seed registerjin 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 samerun U ψ₀ x TandmeasureProb … Sas the lower boundcard_le_sixteen_mul_sq_of_threshold_one_right, with no parallel model.Plan. Locators are checked against arXiv:quant-ph/9605034v1.
tmarked items: amplitudessin((2j+1)θ)/√tandcos((2j+1)θ)/√(N−t), wheresin²θ = t/N(§3, equation (3)).P_m = 1/2 − sin(4mθ)/(4m sin 2θ), andP_m ≥ 1/4whenm ≥ 1/sin 2θ.j < mandm² ≥ N, one algorithm in the model makesm − 1queries. It measures a marked index with probability at least1/4on every input with at least one marked item, includingt > 3N/4, where BBHT use classical sampling instead.mreplaces BBHT's growing range (λ = 6/5) and Theorem 3's expected-time bound. This is the fixed-budget, time-out form they mention fort = 0.x_ifor the output indexi, so the all-zero input is accepted with probability0.m = ⌈4√N⌉each succeed with probabilityP_m ≥ 7/16. So an input withOR_N(x) = 1is accepted with probability at least1 − (9/16)² > 2/3.|measureProb (run U ψ₀ x T) S − bitVal ℝ (threshold N 1 x)| ≤ 1/3withT ≤ 8√N + 2, which matchesN ≤ 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.SamuelSchlesinger commentedon Oct 31, 2026
worker-claude-e6cf7b0d-bbht: theO(√N)upper bound is awaiting review in #2001 atf9eb35f08, 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 + 8queries accept everyxwith probability within1/3ofOR_N(x), and the all-zero input with probability0. A test applies feat(QueryComplexity/Quantum): quantum query lower bounds by polynomials (#896) #1994'sN ≤ 16T²to this algorithm, so the lower and upper bounds have matching hypotheses.randomGrover_search.⌊√N⌋queries find a marked item with probability at least1/4, for every number of marked items.tmarked 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:
O(√(N/t))bound (Theorem 3, growing rangeλ = 6/5) is not formalized; feat(QueryComplexity/Quantum): O(√N) search and OR_N with an unknown number of marked items (#896) #2001 uses a fixed range instead.≥ 2/3, as opposed to decidingOR_N, would need the two-stage construction with an output selector.Q_ε(f), withQ ≤ Dfor non-vacuity.Composition.lean(controlled,check,twice) may help with the simulation.groverAngle NwithsearchAngle N 1, and derivingrun_groverfromrun_grover_of_weight. This is a small cleanup once feat(QueryComplexity/Quantum): quantum query lower bounds by polynomials (#896) #1994 lands.SamuelSchlesinger commentedon Oct 31, 2026
triage-claude-e6cf7b0d-6: #1994 landed at 11:20 UTC. The polynomial-method bounds are on
maininQueryComplexity/Quantum/Polynomial.lean, among themapproxDegree_le_two_mul,blockSensitivity_le_sixteen_mul_sq,complexity_le_mul_pow_sixand theOR_Nboundcard_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.feat(QueryComplexity/Quantum): quantum query lower bounds by polynomi…
feat(QueryComplexity/Quantum): O(√N) search and OR_N with an unknown …
SamuelSchlesinger commentedon Oct 31, 2026
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 onmaininQueryComplexity/Quantum/UnknownSearch.lean:orSearch_spec:OR_Nwith error1/3in8(⌊√N⌋ + 1)queries;randomGrover_search: a marked item with probability at least1/4in⌊√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, aQ_ε(f)definition withQ ≤ D, and unifyinggroverAngle NwithsearchAngle N 1.SamuelSchlesinger commentedon Oct 31, 2026
Status:
active.worker-claude-e6cf7b0d-bqtime(Claude Code, Opus; subagent ofcoordinator-claude-e6cf7b0d) claims the quantum analogue of #1833's simulation: exact classical simulation of Hadamard–Toffoli circuits by tensor contraction. Branchclaude/bqtime-path-contraction. Samuel selected the theorem;coordinator-claude-e6cf7b0dproposed it. I have not checked whether the bound is in the literature, so the PR states it without a novelty claim.Statements.
Simulator. One machine computes, from
(m, gs, x)(min unary), a natural numbersimwithacceptProb m gs x = sim / 2 ^ hadamardCount gswhenever0 < mand every code is well formed. It runs in timeA·(n+1)^A·2^(A·L/√⌊log₂ L⌋)and spaceA·(n+1)^A, whereL = gs.lengthandnis the encoded input length. The width does not enter the exponent.Class.
BQTIME enc t, placed next toBQP: problems decided with error≤ 1/3by aUniformCircuitFamily(the BQP notion, so polynomial-time uniform) with at mostc₁·t n + c₂gates. ThenBQP enc = ⋃ k, BQTIME enc (· ^ k). Formax n 2 ≤ T n:BQTIME enc T ⊆ ⋃ C, DTIME enc (fun n => 2 ^ (C * T n / √⌊log₂ (T n)⌋));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 boundedT. 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, occurrenceuhas anoutedge from its gate to a degree-2 equality column vertex, and alinkedge from that vertex to the next gate on the same qubit. When there is no next gate, thelinkedge 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 are4Nedges, and every vertex has degree at most 6. The Hadamard table is(1, 1, 1, neg). The network is built over ℕ withneg = 2^P − 1, and over ℤ withneg = −1its contraction isacceptGap. WithP = h + 1and0 ≤ acceptGap ≤ 2^h, the residue isacceptGapitself, and acceptance is decided by2·acceptGap > 2^h. The contraction isfastContractionAlgorithmats = 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,BQTIMEand the class containments.Existing notions considered:
UniformCircuitFamily,acceptGapandpathRun(reused);ExplicitTensorNetwork,ExplicitAdmissibleandfastContractionAlgorithm(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 onh). #2029'sClauseNetwork.previs 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.SamuelSchlesinger commentedon Oct 31, 2026
worker-claude-e6cf7b0d-bqtime: awaiting review in #2058 at692c545e0, the first milestone of the quantum simulation designed above. It defines the network of a circuit and its mirror copy, and provescontraction_network: over any commutative ring with Hadamard sign-1, the contraction isacceptGap. Overℕwith sign2^P − 1andP > h, the residue modulo2^Pis the gap (contraction_network_mod). The network has4N ≤ 12Ledges, 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.Bipartition. The branch has the combinatorial core:
exists_base_le_ltandeq_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
IsRowsFirstBipartitewithr = 2L + N + 1. Out edges2(cN+u)belong to gate(c, gate of u). Link edges2(cN+u)+1belong to the readers insum_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.Polynomial time. Build
network (2^P − 1 : ℕ) X gswith theComputableInPolyTimecombinators that feat(FineGrained): fixed-density #k-SAT counting by tensor contraction (Theorem 1.1, D.2) #2029 uses (findWithInputforlastOcc,idxOfWithInput,mapFilterConstfortable).Simulator. Contract with
fastContractionAlgorithmats = 4N, usingExplicitAdmissible 6 sandP = h + 1 ≤ s. Gate lists with fewer than one gate give a constant-size network. ThenacceptProb m gs x = sim / 2^h.Class. Define
BQTIMEnext toBQPas designed and proveBQTIME[T] ⊆ ⋃ C, DTIME[2^(C T/√⌊log₂ T⌋)]with the joint space form. Usediv_sqrt_log_two_le_of_leto pass froms ≤ 12(c₁T + c₂)toT.SamuelSchlesinger commentedon Oct 31, 2026
Status:
active.worker-claude-e6cf7b0d-dq4(Claude Code, Opus; a subagent ofcoordinator-claude-e6cf7b0d) claimsD(f) = O(Q(f)⁴)for total Boolean functions, from Aaronson, Ben-David, Kothari, Rao and Tal (STOC 2021). Samuel selected the theorem;coordinator-claude-e6cf7b0dproposed it. Branch:claude/query-dq4.Route. I checked the numbering against arXiv:2010.12629v1. Their proof of Theorem 2 (p. 2) combines three bounds:
D ≤ bs · deg, which is on main;bs = O(Q²), which is on main asbs ≤ 16T²;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.runmodel and hold per algorithm, like #1994.BitString.sensitivityGraph fandBitString.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.leangets a public eigenvector form of Huang's argument, and the induced-subgraph theorem is derived from it.T-query algorithm with errorε ≤ 1/2gives(1 − 2√(ε(1−ε))) λ(f) ≤ 2T, soλ(f) ≤ 36Tatε = 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 error1/3. This beatscomplexity_le_mul_pow_sixforT ≥ 3.The constants come from this proof, not from the paper. The tests will instantiate
readBitandorSearch, and proveλ(PARITY_N) = N.Existing notions considered:
sensitivity,signedAdjacencyand Mathlib'sSimpleGraph.adjMatrixandMatrix.toEuclideanCLMare reused. There is no spectral sensitivity on main.SamuelSchlesinger commentedon Oct 31, 2026
worker-claude-e6cf7b0d-dq4:D(f) = O(Q(f)⁴)is awaiting review in #2069 at482208848. All six gates pass locally.At error
1/3the PR provesD(f) ≤ 20736 T⁴ = (12T)⁴(Theorem 2 of arXiv:2010.12629v1). The route is the one in the 6545357888 plan:deg ≤ λ²(Theorem 1);(1 − 2√(ε(1−ε))) λ ≤ 2T, proved directly in therunmodel;deg ≤ 1296 T²(Theorem 3);D ≤ deg · bswithbs ≤ 16T².Not formalized: §4's
λ(f) = O(adeg(f))(Theorem 18), and thereforedeg = O(adeg²).SamuelSchlesinger commentedon Oct 31, 2026
worker-claude-e6cf7b0d-bqtime-2(Claude Code, Opus; subagent ofcoordinator-claude-e6cf7b0d): awaiting review in #2072 at3bf92fe82. It finishes the quantum simulation designed in 6544977599, continuing from the handoff in 6545337961. It is stacked by merge on #2058 and theclaude/bqtime-bipartitionbranch.BQTIME enc tsits next toBQPinClasses/BQP/Time.lean. It reusesUniformCircuitFamilywith at mostc₁ t n + c₂gates. Its docstring says it is meaningful only for polynomially boundedt, andBQP_eq_iUnion_BQTIMEprovesBQP = ⋃ k, BQTIME[n ^ k].BQTIME_subset_iUnion_DTIME_two_pow_div_sqrt_log_twoprovesBQTIME[T] ⊆ ⋃ C, DTIME[2 ^ (C T / √⌊log₂ T⌋)]formax n 2 ≤ T n. The joint formexists_decidableInTimeAndSpace_of_mem_BQTIMEadds workspaceT n ^ d. No time-constructibility is needed.exists_computableInO_gapValuecomputes the acceptance gap of polynomial-time computed circuits in time2 ^ (A (L + 1) / √⌊log₂ (L + 2)⌋) · polyand polynomial space. The width does not enter the exponent.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.
ClauseNetwork.previsPathNetwork.lastOcconos.map (·.2.2.1), followed bygetD u.ClauseNetwork.boundedTable BisPathNetwork.tablewith6replaced byB, and their polynomial-time lemmas duplicate too. Unifying them needs a neutral home: a last-occurrence search underFoundations/Data/Listand a genericboundedTablebeside the explicit networks. It also edits the merged CNF module, so it is better done after feat(Quantum): the acceptance gap of a circuit as a tensor contraction (#896) #2058 and feat(Quantum): BQTIME[T] ⊆ DTIME[2^O(T/√log T)] by tensor contraction (#896) #2072 land.BQTIME, which would make the class meaningful beyond polynomialT.feat(QueryComplexity): spectral sensitivity and D(f) ≤ 20736 T⁴ for q…
feat(Quantum): the acceptance gap of a circuit as a tensor contraction (
feat(Quantum): BQTIME[T] ⊆ DTIME[2^O(T/√log T)] by tensor contraction (…
feat(abstracts): candidate abstract for BQP ⊆ PP (cslib-community#896) (