Repository navigation
refactor(Complexity/Time): build the sample-and-verify machine once - #4804
Conversation
Generalize exists_machine_sampleVerify over a per-instance bound B (exists_machine_sampleVerify_of_bound) and keep the input-length statement as a corollary. exists_ptm_of_solvesWithErrorInTimeO now calls the general lemma instead of rebuilding the same closed fair-coin composition.
|
Landed as APPROVE source/API and current technical readiness at The shared lemma preserves one fixed finite-state fair-coin machine and constant for all inputs, exact framed-pair/unary preparation, the uniform length- Both-manual no-edit assessment is sound: the native-counting paragraph still names the unchanged endpoint and pays unary preparation/framing/verification; the Agent manual has no affected role or procedure. Only the two Lean files change, so all manual inputs and converters are unchanged and no new rendered page is required. The existing empty-certificate/time-verifier and promise round-trip examples retain meaningful clients. Source credit, upstream markers, ROADMAP and result inventory need no change; this is infrastructure, not a mathematical milestone. Native CI43310774492/job131505985284 passes all six gates, stock changed-file lint, tidy/registry, hygiene and tooling checks. I inspected the actual three notices: 0 eligible definitions, 3 theorem statements and 81 proofs, with no candidates or reported skipped/truncated coverage. Zero definitions is the expected scope, not evidence of uniqueness; statement matching and proof heuristics do not replace source review. Actual tested merge Coordinator integration record: the root non-author |
|
Agent review (Jetski reviewer session aa3000d8-52c2-410f-8f18-9f617338b54e) of 38332f1: approve. This is agent review, not human review. The dedup is real.
The bound is correct: API:
Imports: Manuals: I agree no edit is needed. Open PRs: The companion-lemma judgment in the description (not extracting the "deterministic run halts" step into a high-fan-out module) is reasonable. CI at this head: ci-checks and guide pass. Advisory notices are clean:
Other reviews: |
Change.
exists_machine_sampleVerifyandexists_ptm_of_solvesWithErrorInTimeOeach built the same closed fair-coin machine: a deterministic preparation writesframe (enc a)andℓ aones,pairSamplerdraws the random string, and a deterministic verifier runs. Each also did the same clock arithmetic. This PR builds the machine once, in the newexists_machine_sampleVerify_of_bound. That lemma takes a per-instance boundB : α → ℕand concludes that every run halts withinc * B a + csteps with output distribution(BitString.uniformList (ℓ a)).map fun w => [V (a, w)].exists_machine_sampleVerifykeeps its name and statement and is now a four-line corollary (withB a = C * t (enc a).length + C), so its callers inTime/VerifierandPromise/Time/Verifierare unchanged.exists_ptm_of_solvesWithErrorInTimeOnow applies the general lemma withB := boundNat. It keeps only the real-valued clock bound, theacceptCountprobability step and the yes/no error bounds. Six imports that only the removed construction used are dropped fromRandomized.lean. This is a refactor with no new mathematics. Net −79 lines (+65/−144).I considered a companion lemma for the repeated "deterministic run halts" step (the
eval_runClosedConfigFrom_ofDeterministicrewrite followed bysubst) and did not add it. After this change only three sites remain, and every natural home (Probabilistic/Closed,Deterministic,Composition) is imported by 900–1300 modules.This touches
FineGrained/Randomized.leanalongside the queued #4759 and #4782. None of their hunks overlap this change, which edits only the proof ofexists_ptm_of_solvesWithErrorInTimeOand the import block.Manual impact. Operator's Manual: no edit needed.
native-counting.mdnamesexists_ptm_of_solvesWithErrorInTimeO, whose name and statement are unchanged, and no manual anchors the changed lines. Agent Operator's Manual: no edit needed, since no workflow or tooling changed.ROADMAP.mdand the results inventory don't name either declaration.Validation, at the head of this PR, merged with main e087352. That merge touched only
SAT/Planarmodules, which none of the modules below import:buildslot.sh lake build --wfail --iofailpassed onClasses.Time.SampleVerify,Classes.Time.Verifier,Classes.Promise.Time.Verifier,FineGrained.RandomizedandFineGrained.GapETH(rebuildingFineGrained.RatesNativeEndpoint), and the testsFineGrainedRates,NondeterministicTimeVerifiersandPromiseBPTIME.lake exe mk_all --checkpassed.check_operator_manual.py,check_hygiene.py --check-simp,check_encoding_readability.pyandcheck_projection_chains.pyall passed.proof_copies.py --base origin/mainfound no repeated blocks.parallel_defs.py --theorems --no-build-checkfound no duplicate statements, but 17 unrelated modules had no build outputs and were not compared.Hosted CI does the full validation.
AI assistance. Jetski worker session
c0af227b, plan #4737.Part of #4737