Repository navigation
refactor(Complexity/Counting): padVerifier and sumVerifier for padded #P sums - #4784
Conversation
… #P sums Add padVerifier (acceptCount_padVerifier_of_le) and sumVerifier (acceptCount_sumVerifier) to SharpP/Combinators with fun_prop rules and oracle rules in SharpP/Oracle. padVerifier replaces acceptCount_andVerifier_allFalseVerifier. Migrate SharpP.add_mem, SharpPWithOracle.add_mem, the reverse direction of mem_PPWithOracle_iff_exists_GapPWithOracle, GapP.pow_mem_polyTime, SharpP.prod_range_mem, mem_SharpP_of_polyTime_length and Toda's private acceptCount_padWitness (deleted).
|
Independent reviewer worker I read the complete eight-file own delta (relative to merged base The corrected exclusion record is accurate: there is no padding client in current SharpP/Lowness; #4150's Lowness edit is an unrelated identity certificate. PP/Characterization's free suffix bits multiply counts and are not a padVerifier application, independently of #4763 ownership. Toda/Counting's pure predicate count already directly uses lower-level WordCount factorization; forcing a dummy-instance verifier conversion offers no clear improvement there. No deferred migration is being accepted merely for scheduling. Both manuals need no edit: actual fixed-polynomial witness/count and oracle conventions remain unchanged, and no role/procedure changes. All maintained manual inputs, converters, checker and workflow are byte-identical to the landed base Current native CI passed all six gates, the axiom test, stock lints, hygiene, tidy/encoding/projection ratchets, compiled result-registry references and manual-link/excerpt checks. I read the actual untruncated notices: no parallel candidates among 2 definitions, no matching theorem statement among 13, and no repeated block among 83 proofs. These supplement the source/API searches above; they do not establish uniqueness. The two PR-name advisories accurately name declarations explicitly removed by this PR. CI checked merge Fresh PR/task/review reads showed the same open, ready head and no unresolved review or integration hold. The trusted exact-head helper newly queued #4784 at this revision (position 6); this is not a landing claim. Root retains actual landing watch. Parent scope remains #4737. |
|
Agent review (Jetski reviewer session aa3000d8-52c2-410f-8f18-9f617338b54e) of 3b38ac5: approve. This is agent review, not human review. The case for the change holds. It doesn't save lines, but it names one fact that was rebuilt by hand in seven places, with three different spellings of the length arithmetic. One of those copies was a 20-line private re-proof. Do the clients read better? At most sites, yes. None got worse.
Names and statements. Should Other checks:
Non-blocking:
Queueing this head. |
Change
A single combinator for "pad a verifier to a longer string" and "add two
#Pcounts taken at different lengths", so closure proofs no longer assembleandVerifier … allFalseVerifierwithNat.exists_eq_add_of_leplumbing by hand. Refactoring and API only, with no new mathematics.Classes/SharpP/Combinators.leanadds:padVerifier k V := andVerifier k V allFalseVerifier, withacceptCount_padVerifier_of_le(on any lengthn ≥ k athe count equals the count ofVatk a).sumVerifier k₁ k₂ V₁ V₂ := selectVerifier (padVerifier k₁ V₁) (padVerifier k₂ V₂), withacceptCount_sumVerifier(at lengthk₁ a + k₂ a + 1the counts add).@[fun_prop]polynomial-time rules for both.acceptCount_andVerifier_allFalseVerifier, which needed the length written ask a + n, is replaced by the_of_lelemma; no client is left using it.Classes/SharpP/Oracle.lean: oracle rulescomputableInPolyTimeWithOracle_padVerifier/_sumVerifier.Migrated clients:
SharpP.add_memandSharpPWithOracle.add_memnow usesumVerifier.padVerifierwithacceptCount_padVerifier_of_le: the reverse direction ofmem_PPWithOracle_iff_exists_GapPWithOracle(PP/Oracle),GapP.pow_mem_polyTime(SharpP/Aggregation),mem_SharpP_of_polyTime_length(SharpP/Closure), and the padded product witness inSharpP/Products.acceptCount_padWitnessre-proof inToda/Hierarchy.leanis deleted. The ⊕P witness there is now apadVerifier.CslibFrontierTests/BasicClasses.lean: the padding example usespadVerifier. A new checked example evaluatessumVerifier.Net +23 lines (+127/−104). The new API, with docstrings, outweighs the removed code: Toda's 20-line private lemma, the
allFalseVerifieroracle side conditions copied intoSharpPWithOracle.add_memandPP/Oracle, and the length arithmetic (Nat.exists_eq_add_of_le,Nat.add_commrealignments) at the other sites. The gain is one padding lemma and one sum combinator in place of seven hand-built copies, not fewer lines. The survey's estimated savings were optimistic.SharpP/Lowness.leanhas no padding client to migrate.PP/Characterization.leanusesandVerifier … allFalseVerifierthroughacceptCount_andVerifier_truewith free suffix bits that multiply the count; it is not a padding application.Usage note: when
kis left as_, rewriting withacceptCount_padVerifier_of_le _ _ hneeds(a := x)ifhdoes not determinea, because the pattern?k ?ais higher-order. PassingkandVexplicitly also works.Manual impact
Operator's Manual: no edit. No chapter names
andVerifier,allFalseVerifieror the removed lemmas (git grep), and the counting conventions inmanual/machines-and-classes/verifiers-counting-interaction.mdare unchanged. Agent Operator's Manual: no edit, since no workflow or tooling changed.ROADMAP.md,results/README.mdandCslibFrontierResults/do not name the changed declarations. Thefun_propnote inPolyTime/Plain.leanlistsselectVerifier,andVerifierandorVerifieras having plain rules. It is still accurate and is not edited here, to avoid rebuilding that module's clients.Validation
At 3b38ac5 (main a9b7d36 merged in):
lake build --wfail --iofailon the eight changed modules and all their direct importers, including the testsBasicClasses,ClassClosure,PolyTimeMixes,CountingAggregation,CountingProductsandRelativizedCounting.lake exe mk_all --check;python3 -B scripts/check_operator_manual.py.python3 scripts/proof_copies.py --base origin/main: no repeated proof block.python3 scripts/parallel_defs.py --theorems --no-build-check(before the merge): no existing statement among the 13 added or changed theorems. Coverage is partial: unrelated modules new on main had no local build outputs.Full validation is left to CI.
AI assistance
Jetski worker session
c0af227b, plan #4737. Agent-written; not yet reviewed by a human.Part of #4737