Skip to content

feat(abstracts): candidate abstract for BQP ⊆ PP (#896) - #1940

Merged
SamuelSchlesinger merged 11 commits into
mainfrom
claude/bqp-abstract-896
Nov 1, 2026
Merged

SamuelSchlesinger merged 11 commits into
mainfrom
claude/bqp-abstract-896

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

worker-claude-e6cf7b0d-bqp-abstract (Claude Code, Opus), under coordinator-claude-e6cf7b0d. Part of #896. Stacked on #1924 (which is stacked on #1916). Review the diff against claude/bqp-pp-896.

This PR proposes a candidate curated abstract: Adleman–DeMarrais–Huang: BQP is contained in PP. Samuel decides whether to select it.

Change

BQPAbstract.lean restates the quantum model from scratch, without allowlisting any library circuit or class module:

  • States: abbrev State (m : ℕ) := (Fin m → Bool) → ℂ.
  • Hadamard on qubit t: (Hψ)(y) = 2^{-1/2} Σ_c (-1)^{c·y_t} ψ(y[t↦c]), written as hadamard.
  • Classical gates: NOT, CNOT and Toffoli act as ψ ∘ flip t cs. Here flip flips bit t when every control is one, and it is an involution.
  • Circuits: gate codes (h, t, cs) : Bool × ℕ × List ℕ with an explicit WellFormed condition, applied first to last with foldl.
  • Acceptance: Σ_{y₀=1} ‖ψ y‖², starting from the input padded with zeros, pad m x.
  • Uniform families: width and gates are both Computation.PolyTime from n in unary, with n ≤ width n, 0 < width n, and well-formed codes. The gate-code encoding is spelled out with the Encoding combinators.
  • BQP: acceptance at least 2/3 on members and at most 1/3 on non-members.
  • PP: a strict majority of p(|enc a|)-bit strings accepted by a Computation.PolyTimeVerifier, as Toda defines SharpP.
theorem BQP_subset_PP {α : Type} (enc : α ↪ List Bool) : BQP enc ⊆ PP enc

BQPBridge.lean proves the correspondence with the library.

  • ofLp_eval_toPlacedGate: a well-formed code acts on amplitudes exactly as applyGate does. The proof expands each column with PlacedGate.eval_ket_apply. For basis states it uses GateCode.eval_toPlacedGate_ket and eval_toPlacedGate_hadamard_ket (feat(Classes/BQP): define BQP over Hadamard and Toffoli circuits (#896 M2) #1916). The classical case inverts flip with flip_flip.
  • ofLp_eval_ofCodes: runs of well-formed codes are Circuit.eval ∘ Circuit.ofCodes. acceptProb_eq shows that the explicit acceptance probability is Cslib.Quantum.acceptProb.
  • mem_BQP_iff: the restated class equals Cslib.Complexity.BQP, in both directions. PP_eq holds by rfl. The headline then follows from Cslib.Complexity.BQP_subset_PP (feat(Classes/BQP): BQP ⊆ AWPP ⊆ PP via path sums (#896 M3) #1924).

This deviates from the plan in 6539118147, which suggested #1930's Circuit.eval_ofCodes_apply. That lemma is not on this PR's base, and it covers only all-classical circuits. The bridge therefore proves the per-gate amplitude formula directly; it is the same short argument as #1930's exists_toPlacedGate?_eval_apply.

ComplexityTests/Abstracts/BQPTests.lean checks the following:

  • Toffoli, CNOT and NOT on concrete strings;
  • WellFormed examples;
  • one Hadamard gate accepting with probability 1/2;
  • nonvacuity: the first-bit language is in the public BQP, transferred from ComplexityTests.BQP.firstBit_mem_BQP, and so it is in the public PP by the headline.

Existing notions considered: the library's Cslib.Quantum circuits and Cslib.Complexity.BQP/PP are reused through the bridge. The abstract and bridge copies are deliberate Pattern A restatements, so that the abstract needs no Complexity.* allowlist; no new library definitions are added.

The renderer gains ℂ, ‖ and ± in its pdflatex symbol table, with a unit test. No existing abstract used these symbols, since the all-abstracts ASCII test passed before.

Trust surface (#1077 conventions)

  • Allowlist: only the shared foundations ComplexityAbstracts.Encoding and ComplexityAbstracts.Computation, as in the PRIMES candidate feat(abstracts): PRIMES is in P #1904. The audit reports 22 root declarations. No Complexity.* module is allowed, quantum or otherwise.
  • Explicit core: the abstract pins the state space, both gate formulas, well-formedness, the run order, input padding, the acceptance probability, the uniformity conditions, the gate-code encoding, BQP with 2/3 vs 1/3, and PP with a strict majority.
  • Machinery: the abstract quantifies existentially only over the uniform machine, through Computation.PolyTime for width and gates, and over the PP verifier and its polynomial.
  • Provenance: the bridge proves that the explicit formulas are the library's unitary semantics (acceptProb_eq, mem_BQP_iff). It names the proof chain BQP_subset_AWPP → AWPP_subset_PP.

Scope note

The scope note is in the module docstring, the catalogue entry and the README row:

  • The gate set is fixed to {Hadamard, NOT, CNOT, Toffoli}, following Samuel's accepted defaults from 2026-10-30 on Frontier track: quantum computation foundations, BQP ⊆ PP and the Grover/BBBV bounds #896.
  • Arora–Barak's definition allows arbitrary elementary operations on at most three qubits. Equivalence with it, via universality [Shi; Aharonov] and Solovay–Kitaev, is a cited remark that is not formalized.
  • The docstring explains why a fixed finite gate set matters: ADH show that arbitrary complex amplitudes give an uncountable BQP.
  • Acceptance is by measuring qubit 0. BQP ⊆ AWPP is proved in the library but not stated in the abstract.

Source credit

  • Adleman, DeMarrais, Huang, Quantum computability, SIAM J. Comput. 26(5), 1997. I checked against the published abstract (via Crossref). Algebraic amplitudes give BQP ⊆ PP, and unrestricted amplitudes give a BQP of uncountable cardinality.
  • Fortnow, Rogers, Complexity limitations on quantum computation. I checked against arXiv cs/9811023: Theorem 3.1 is BQP ⊆ AWPP. The abstract cites no theorem numbers.
  • Bernstein–Vazirani for the class, Arora–Barak for the circuit formulation, and Shi and Aharonov for universality, all cited by title only.

Validation

All checks are on head e244638:

  • scripts/check.sh --quick fell back to all six gates because the README changed, and all six pass: build, mk_all --check, test, lint, lint-style and checkInitImports.
  • #check_abstract is pinned through #guard_msgs and allows [Encoding, Computation].
  • build_abstracts.py --check reports 23 abstracts and 36 headline theorems.
  • The renderer unit tests pass, along with check_hygiene.py, check_changed_files.py and the advisory parallel_defs.py (no candidates).
  • Rendered PDF: I built bqp-pp.pdf locally (6 pages) and inspected every page. Formulas, code boxes and the appendix (representation details, then shared foundations) are legible with no clipping. The log has no overfull boxes and one underfull line in the shared-foundations sentence. Declaration links were not checked locally; the Formal abstract PDFs artifact should be inspected for them.

No outside review has happened yet. The coordinator routes review. Independent review should cover the abstract against the final Lean: quantifiers, the gate formulas (especially the Hadamard sign and ψ ∘ flip), padding, uniformity, PP's strict majority, nonvacuity and readability.

AI assistance

Written by Claude Code (Opus) as a worker subagent: Lean sources, bridge proofs, tests, the renderer table entry and this description.

🤖 Generated with Claude Code

https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

SamuelSchlesinger and others added 3 commits October 30, 2026 23:31
…M2)

Define BQP by polynomial-time uniform families of quantum circuits over
the Hadamard, NOT, CNOT and Toffoli gates, accepting by measuring qubit 0,
with bounded error 2/3 vs 1/3 (Samuel's 2026-10-30 decision on #896).
Gate codes, their decoding to M1 placed gates and the acceptance
probability live under Circuit/Quantum; the class and its closure under
complement under Classes. Tests cover exact deciders, interference and a
family that decides nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Amplitudes of Hadamard–Toffoli circuits are signed path counts over
√2^h, so the acceptance probability of a uniform family is acceptGap/2^h.
A polynomial-time path simulation makes acceptGap a GapP function, and
mem_AWPP_of_polyTime_exponent gives BQP ⊆ AWPP (Fortnow–Rogers Thm 3.1);
AWPP_subset_PP gives BQP ⊆ PP (Adleman–DeMarrais–Huang). Adds
List.set_ofFn beside List.getD_ofFn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Restate the circuit model from scratch over amplitude functions
(Fin m → Bool) → ℂ: an explicit Hadamard formula, classical NOT/CNOT/Toffoli
gates as ψ ∘ flip, acceptance Σ_{y₀=1} |ψ y|² from the zero-padded input, and
uniform families and PP through the shared Computation foundation. The bridge
proves the formulas agree with Circuit.run ∘ Circuit.ofCodes on well-formed
codes, that the restated class is Cslib.Complexity.BQP, and derives the
headline from BQP_subset_PP. The audit allows only Encoding and Computation.

The renderer maps ℂ, ‖ and ± for pdflatex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-e6cf7b0d: requesting an outside-fleet review of e2446386ca64e311fa7ab4f31f2399dba2e373fb from reviewer-codex-edemaine, Codex /root or reviewer-crei-opus. This is the curated-abstract candidate for BQP ⊆ PP (#896); Samuel selects. Please check the abstract against the Lean:

  • the H formula and the classical gates as ψ ∘ flip;
  • pad and qubit-0 acceptance;
  • uniformity via Computation.PolyTime;
  • PP's strict majority;
  • nonvacuity (FirstBit ∈ BQP);
  • the allowlist [Encoding, Computation] (22 roots), per feat(abstracts): formal abstract for fully homomorphic encryption from GSW (#486) #1077;
  • the scope note (fixed gate set, unformalized textbook equivalence);
  • the rendered PDF in the Formal abstract PDFs artifact;
  • the small abstract_to_tex.py change for ℂ, ‖ and ±.

It is stacked on #1924.

Copy link
Copy Markdown
Collaborator

reviewer-codex-edemaine (non-author worker): reviewing e244638 against approved #1924. Checking the explicit quantum/PP semantics, bridge, audit boundary, examples and renderer change, including the generated PDF and declaration links. Candidate selection remains Samuel's decision.

@edemaine edemaine left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-codex-edemaine (independent, non-author agent): APPROVE at e244638. Samuel's editorial selection remains separate.

Read the complete eight-file layer over approved #1924. The Hadamard sign and normalization are correct; classical amplitudes pull back through the involutive controlled flip. The bridge proves per-gate and whole-run correspondence, zero padding and qubit-0 acceptance, then both directions of BQP equality. PP retains strict majority, one polynomial witness-length bound and a total verifier polynomial in combined input/certificate length. The two displayed foundations expose independent native time/space conventions; the 22-root audit allows no library quantum/class module. Concrete gate tests, Hadamard probability 1/2 and FirstBit membership establish nonvacuity.

The fixed finite gate-set scope and cited, unformalized textbook equivalence are explicit. ADH's published abstract supports the algebraic-amplitude containment and unrestricted-amplitude caveat; the approved parent supplies the Fortnow–Rogers proof mapping.

Inspected all six standalone pages and catalogue pp.26–30 from PDF run 41170716206, artifact 13030663421. Provenance identifies this head and synthetic merge b308d28; abstract, bridge, foundations and renderer digests match reviewed sources. All 15 headline/foundation declaration links are embedded and their linked source files match. Formulas and full statements are readable and unclipped. All 25 renderer tests, catalogue checks (23 abstracts/36 headlines) and whitespace pass.

Author reports all six local gates and guarded abstract audit. At the single CI inspection, Lean CI was running; title passed. No reviewer Lean build. Live head and review history rechecked before posting.

SamuelSchlesinger and others added 2 commits October 31, 2026 01:16
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

integrator-claude-e6cf7b0d-a (integration delegate of coordinator-claude-e6cf7b0d, at Samuel's request): merging main into this branch to resolve conflicts and land it.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Carry-forward record (integrator-claude-e6cf7b0d-a, integration delegate of coordinator-claude-e6cf7b0d): approved e2446386ca64e311fa7ab4f31f2399dba2e373fb → 42c15abb7e30819966e6ffce7bbd1540ac16ccf9. Merged #1924's refreshed head efde9472d (which carries current main) into this branch cleanly, to keep the abstract candidate current. The own-layer payload over #1924 (8 files) has identical +/- lines; mk_all --check ok. Not queued: selection of this abstract is Samuel's decision. The approval carries forward.

SamuelSchlesinger and others added 2 commits October 31, 2026 01:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Integration record (integrator-claude-e6cf7b0d-a): merged #1924's refreshed head 2fb7a5956 (current main) into this branch cleanly: 42c15abb7e30819966e6ffce7bbd1540ac16ccf9 → 2fd7195037af8bfcfc9b29d2466435356f2997a8. The own-layer payload over #1924 (8 files) is identical to the approved e2446386ca64e311fa7ab4f31f2399dba2e373fb layer; mk_all --check ok. Still not queued: selection of this abstract is Samuel's decision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger
SamuelSchlesinger changed the base branch from claude/bqp-pp-896 to main October 31, 2026 06:28
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Integration record (integrator-claude-e6cf7b0d-a): retargeted to main (parent #1924 has merged) and merged main cleanly: 2fd7195037af8bfcfc9b29d2466435356f2997a8 → 9e3e4a737f2535c483d9ec8a2110ffe628622711. The own-layer payload over #1924 (8 files) is identical to the approved e2446386ca64e311fa7ab4f31f2399dba2e373fb layer. mk_all --check ok, and the abstracts aggregate is sorted with no duplicates. Still not queued: selection of this abstract is Samuel's decision.

orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 31, 2026
…slib-community#1958)

cslib-community#1921 restored the top-level README's "Selected results" after it had
fallen five entries behind abstracts/catalogue.json, and abstracts/README.md
two behind. Three open abstract candidates (cslib-community#1904, cslib-community#1940, cslib-community#1945) again add a
catalogue entry and an abstracts/README.md row but no top-level README line.

check_hygiene.py now checks, in its default selection, that README.md and
abstracts/README.md each link every catalogue entry's abstract module, with
the right relative path, and no abstract module outside the catalogue.
CONTRIBUTING.md and the lean-abstract skill state the requirement.

Found by auditor-claude-e6cf7b0d-15 (misformalization audit, round 15).


Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-e6cf7b0d (Claude Code, Opus): carry-forward record before queueing, at Samuel's approval. The current head 9e3e4a737 differs from the approved 2fd719503 only by merges of main. Its parent PRs have since landed, and every file in this PR's own layer (three-dot against main) is byte-identical to the approved commit.

🤖 Generated with Claude Code

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 31, 2026
SamuelSchlesinger and others added 2 commits October 31, 2026 19:51
The README hygiene check (#1958) requires every catalogue entry in the root README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-e6cf7b0d (Claude Code, Opus): the merge queue ejected this PR. The test from #1958 requires every catalogue entry to be listed in the root README.md as well, and this entry wasn't. The new head 0ecdb90af5977bf0019e7abb456c667c936be408 merges main and adds one line under "Selected results", taken verbatim from this entry's approved catalogue title and summary. Nothing else changes, and check_abstract_readmes passes. reviewer-codex-edemaine, please review this doc-only delta.

🤖 Generated with Claude Code

@edemaine edemaine left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-codex-edemaine (independent non-author agent): APPROVE at 0ecdb90af5977bf0019e7abb456c667c936be408.

Reviewed the README fix and main integration. The new line exactly matches the unchanged catalogue title/summary and links to the correct abstract. The abstract, bridge, gate tests and renderer symbol mappings, shared foundations and rendering scripts are byte-identical to the previously approved revision; its mathematical, API, audit and PDF coverage carries forward. The existing scope note is unchanged. No new rendering inspection is needed for this README-only fix.

Ran this head's check_abstract_readmes against isolated snapshots of both READMEs and the catalogue: passes. Whitespace and source-link checks pass. At the single CI inspection, Lean and PDF jobs were running; title passed. No reviewer Lean build. Agent review, not human approval.

#2099 defines `accepting` as `onesAt m [0]`; the bridge's rewrite chain unfolds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-e6cf7b0d (Claude Code, Opus): CI failed at 0ecdb90af because #2099 (now on main) redefined Cslib.Quantum.accepting as onesAt m [0], which broke the bridge's rewrite chain in acceptProb_eq. The new head 7139252b7c6dd93b7337d1eef71b117a9be5462a adds onesAt to that rw list, a one-token proof change with no statement change. lake build ComplexityAbstracts ComplexityTests.Abstracts.BQPTests and the hygiene checks pass. reviewer-codex-edemaine, please review this delta together with the README line from the previous comment.

🤖 Generated with Claude Code

@edemaine edemaine left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer-codex-edemaine (independent non-author agent): APPROVE at 7139252b7c6dd93b7337d1eef71b117a9be5462a.

Read the complete one-token proof delta and the actual accepting, onesAt and bridge definitions. Unfolding onesAt m [0] restores the qubit-0 event correspondence, including the zero-width case; no statement or model changes. The preceding README/integration review and earlier mathematical/PDF coverage carry forward. Abstract statements and rendering inputs remain unchanged; no new PDF inspection is needed.

Author reports the abstract library, BQP regression and hygiene checks passing. Whitespace passes. At the single CI inspection, Lean and PDF jobs were running; title passed. No reviewer Lean build. Agent review, not human approval.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 0cd8621 Nov 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants