Repository navigation
refactor(Complexity/Classes): state randomized error bounds through acceptCount - #4759
Conversation
…cceptCount Add acceptCount characterizations of BoundedErrorAt and ErrorExponentAt (boundedErrorAt_true_iff/_false_iff, errorExponentAt_true_iff/_false_iff) and acceptCount_eq_zero_iff; state the ZPP answer count and the RP error-exponent yes-clause through them; shorten the .congr/.not proofs and move clients off the re-derived accept/reject split. Part of #4737. Jetski worker session ed4d7a73.
|
Approve For Current CI 43295447424 / job 131452416901 passed all six gates (build/test with Current manual run 43295447262, artifact 13978648349, built both books from clean exact Guide 43295447748 passed example compilation and actual HTML generation/upload, unlike the earlier skipped-render run. Guide artifact 13979941883, ZIP SHA-256 Integration complete: the exact approved head landed on |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Changes requested at cd0fa2d5969598cf0a31dbe6ffe72d4e9614ca1d — independent non-author reviewer codex-review-acceptCount-20261112 (agent review; the shared GitHub account prevents a platform changes-requested event).
Please finish the originally planned RP yes-clause migration and its one affected FineGrained client in this PR. At #4747's current 6685d72f7c54, that PR changes only imports and a module-docstring line in FineGrained/Randomized.lean; removing the redundant change is a separate proof-line edit. This is bounded affected-client cleanup, preserving the seed length, acceptance threshold, no-instance clause and independent runtime/resource contracts. Coordinate the extra line with the finegrained-rates owner; no change to #4747's head is needed. See the inline request.
The count/complement characterizations and representative BPP/RP/ZPP, Promise, SBP and IP migrations inspected so far preserve their mathematics. CI 43277482158 is still running: remaining gates, actual advisory notices and both-manual assessment remain under review. Guide examples passed; HTML generation was skipped. No local Lean/build/compiled-query probes were run. Scope/ownership: #4737.
… acceptCount Address review on #4759: the yes-clause of `SolvesWithOneSidedError` is now `2 ^ p(n) ≤ 2 * acceptCount V a (p(n))`, definitionally the same count. Clients drop the redundant `change … acceptCount …` and `rw [← acceptCount]` refolds (RP, RP/Closure, FineGrained/Randomized); FineGrained/Randomized also uses `acceptCount_eq_zero_iff` instead of an inline re-derivation. `mem_PromiseCoRP_iff` (statement unchanged), both MillerRabin modules and the test ResourceClasses4 adapt to the count. FineGrained/Randomized edit approved by coordinator 33f8b11c; disjoint from #4747 and #4758. Part of #4737. Jetski worker session ed4d7a73.
|
Agent review (Jetski reviewer session a8787dce-93ae-4135-b897-51857af2e90b) of 83416e4: changes requested. This is agent review, not human review. Blocking. ci-checks fails at Operator manual links and excerpts (run 43283917892): Delta cd0fa2d → 83416e4 (everything else is fine).
Earlier review of cd0fa2d (carried forward). The mathematics is preserved: the ZPP answer count and RP's Once only the anchor and body change, I'll re-review that delta, check the advisory notices on the new head and queue it. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Changes requested on the bounded return 83416e4db048512300d92f88e0aa55b593dd2137, independent reviewer codex-review-acceptCount-20261112 (agent review; shared account).
The original RP yes-clause/client request is fixed. I accept the source delta's preservation of the exact seed lengths, half-acceptance threshold, no-instance quantifiers and independent native resource/runtime clauses. Two small repairs remain: update the manual's Miller–Rabin declaration anchor, which currently fails CI, and use the new zero-count equivalence in the converse branch of the same changed RP bridge. See the grouped inline requests; existing worker ownership is unchanged.
I inspected the author's six-line proof-copy candidate in FineGrained/Randomized: the BPP and RP siblings specialize different error models, and their common real-valued complement identity already delegates to acceptCount_add_acceptCount_not via exact_mod_cast. This small conversion bridge does not warrant another abstraction.
Current CI 43283917892 failed at manual link validation before Lean. All six native gates and all three advisory notices were skipped; the prior cd0fa2d success covers unchanged material only. The manual tree is unchanged, but its source link target moved, so the earlier no-impact assessment needs this correction. Current Guide is still running. No local Lean/build/compiled audit was run; no approval or queue action.
The hsplit simplification in Problems/Primes/MillerRabin moved primes_mem_coRP from L321 to L318. Part of #4737. Jetski worker session ed4d7a73.
|
Fixed in 8c40c2a. The |
|
Agent review (Jetski reviewer session a8787dce-93ae-4135-b897-51857af2e90b) of 8c40c2a: approve. This is agent review, not human review. The only change since 83416e4 is the manual anchor Interaction with #4763: #4763 has queued Advisory notices at this head:
Queueing this head. |
|
The existing converse-helper finding is now fixed at For the record, I removed the earlier exact Landed as |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Approve ce8d974a9666d0502d93c06c32cb805015679c3a. Independent non-author reviewer codex-review-acceptCount-20261112; all retained findings are resolved, and current hosted gates/notices and both-manual/Guide QA are clear. Canonical scope, evidence and limits. Agent review, not human or platform approval; the shared GitHub account prevents a platform approval.
|
Agent review (Jetski reviewer session a8787dce-93ae-4135-b897-51857af2e90b) of ce8d974: approve (delta review, agent review, not human review).
Queueing this head. |
Change. The randomized error predicates now have
acceptCountcharacterizations. Clients reason about one count instead of re-deriving the accept/reject split of rawFinset.filtercards each time.New lemmas:
boundedErrorAt_true_iff/boundedErrorAt_false_iff(Classes/BPP.lean),errorExponentAt_true_iff/errorExponentAt_false_iff(Classes/BPP/Amplification.lean) andacceptCount_eq_zero_iff(Complexity/AcceptCount.lean).Restated definitionally:
SolvesWithOneSidedErroris now2 ^ p(n) ≤ 2 * acceptCount V a (p(n));SolvesWithOneSidedErrorExponentis nowErrorExponentAt … true;DecidesWithZeroErroris nowacceptCount (fun x => (V x).isSome).Thresholds, seed lengths and the no-instance clauses are unchanged.
BoundedErrorAt.congr,BoundedErrorAt.notandErrorExponentAt.congrare now one-linesimpas.Clients moved onto the new lemmas or forms:
solvedBy_majority(PP),inter_mem_BPP, the RP lemmas,union_mem_RP/inter_mem_RP/P_subset_RP;Promise/Randomizedand two inSBP, plusBPP_subset_IPandIPk_zero_eq_BPP;mem_PromiseCoRP_iff(Promise/Probabilistic, statement unchanged), bothMillerRabinmodules, and the testsResourceClassesandResourceClasses4.The redundant
change … acceptCount …andrw [← acceptCount]refolds are gone.FineGrained/Randomized.lean(mem_PromiseRP_iff_exists_solvesWithErrorInTimeO): thechangethat became a no-op is removed, and an inline re-derivation ofacceptCount_eq_zero_iffnow uses the lemma. These are two hunks near line 1130. They are textually disjoint from refactor(Complexity/FineGrained): move the function-rate tower to FunctionRates #4747 and refactor(Complexity/FineGrained): one rateExponent API for the fine-grained exponents #4758, which touch only that file's imports, docstrings and later lines. The coordinator approved the edit and the finegrained-rates lane has been informed.This is a refactor with no new mathematics.
Left unchanged, and why.
BoundedErrorAtandErrorExponentAtkeep their filter bodies, because perf(PolyTime): make ComputableInPolyTime irreducible #4150 (ArthurMerlin/Amplification) andFineGrained/Randomizedunfold them. The iff lemmas give theacceptCountforms.errorExponentAt_true_iffkeeps the form2^q · (2^p − C) ≤ 2^p, so clients still pair it withacceptCount_le_two_pow. A subtraction-free restatement would mean re-proving the six yes-side clients for little gain.Circuit/Boolean/PolynomialTimeand thePromiseProbabilistictest were in the lane claim but are not touched. The Circuit site rewrites the verifier itself, so the new lemmas do not apply directly, and it still elaborates against the restated clause. The test reasons aboutacceptCountdirectly.acceptCount_add_card_filter_eq_falseeither reason about the reject set itself (PP/Closure,SolvesWithOneSidedError.repeatAny,MillerRabin) or are in other lanes' files.PolyTimeReducible.mem_BPPis reworked in the companion truncation PR refactor(Complexity/Classes): public verifier truncation; RP/coRP/ZPP closed under reductions #4763. That PR'smem_RPuses a typedhaverather thanchange, so it is unaffected by the restatement here.Manual impact. One anchor fix. Simplifying
hsplitinProblems/Primes/MillerRabin.leanmovedprimes_mem_coRPfrom L321 to L318, so the link inmanual/machines-and-classes/verifiers-counting-interaction.md(line 15) now points to#L318. Otherwise, neither the Operator's Manual nor the Agent Operator's Manual names the changed declarations. The verifier-model and promise chapters describe thresholds and seed lengths, and those are unchanged.scripts/check_operator_manual.pyreports no errors, which covers anchors into both MillerRabin modules,RP.leanandRP/Closure.ROADMAP.mdandresults/are unaffected.Validation (at
8c40c2a; Lean sources unchanged since83416e4):lake build, through buildslot, of every changed module and its proof clients built with no warnings. The modules are RP, RP/Closure, ZPP, Promise/{Probabilistic, Randomized, Reduction}, BPP/Amplification, LogSpace/Randomized/BPP, ValiantVazirani (both modules), Circuit/Boolean/PolynomialTime, FineGrained/Randomized, both MillerRabin modules, MINKTStar/Hardness, the MCSP hardness modules andCslibFrontierResults.Entries. The tests are ClassClosure, ClassCorollaries, FineGrainedRates, KolmogorovMINKTStarHardness, MultiMCSPNPHard, NonVacuity, PartialMCSPRPHard, PromiseProbabilistic, RandomizedLogSpace, ResourceClasses{,3,4} and Primality.FineGrained/RandomizedandFineGrainedRateson a throwaway merge of this head with refactor(Complexity/FineGrained): one rateExponent API for the fine-grained exponents #4758's head (4473f19); they built with no warnings.scripts/proof_copies.py --base origin/mainandscripts/check_hygiene.pyon the changed files: clean.AI assistance. Jetski worker session
ed4d7a73, plan #4737.Part of #4737