Repository navigation
refactor(Complexity): shared truncated-verifier, take-quantifier and output-length bounds in reduction closures - #4808
Conversation
…sure proofs `PolyTimeReducible.mem_NP` now uses `exists_truncated_verifier` instead of re-deriving the truncated verifier and its padding argument. It, `mem_NP_setOf_exists_append` and `PolyTimeReducible.mem_NPWithOracle` match their certificate quantifiers with `List.exists_length_eq_take_iff` instead of padding by hand. No statement changes. Follow-up from the #4794 review. Part of #4737. Jetski worker session 54b77ba8.
… length New `PolyTime/OutputLength.lean` states `ComputableInPolyTime.exists_polynomial_eval_length_le`: for a polynomial-time `f` and a polynomial `q`, some `P` bounds `q(|f a|)` by `P(|a|)`. It composes `polyBounded_length`, `PolyBounded.of_polynomiallyBounded_comp` and `PolynomiallyBounded.polynomial_eval`. `PolyTimeReducible.mem_FewP` and `PolyTimeReducible.mem_NPWithOracle` use it instead of rebuilding the bound through `unary_eval`/`encoding_length` or `Polynomial.eval_comp`. The `q = X` sites in NP/Advice, PH/Reduction and Parameterized/Distillation use `hf.polyBounded_length.exists_polynomial` directly. The resource-envelope manual section points to both. Part of #4737. Jetski worker session 54b77ba8.
|
Landed: exact reviewed APPROVE; all source, manual and final-validation holds cleared at exact I read the complete nine-file diff, actual verifier/counting/oracle definitions and all changed callers. The new output-length lemma composes the existing encoded-output polynomial bound with polynomial evaluation and returns one fixed polynomial for all inputs; it introduces no unary-computability, decoder or runtime claim for that polynomial. Its small
The new Operator paragraph accurately explains the common bound and its two real consumers, including the Terminal native43314498857/job131518840101 now passes all six final gates, stock changed-file lint, tidy/registry, hygiene and tooling checks. I read its complete actual three reports: no candidate among0 eligible definitions,9 statements or62 proofs, with no reported skipped/truncated comparison. Zero definitions is the scan's applicable scope; these bounded heuristics supplement source review, not a uniqueness claim. Actual tested merge Non-author root coordinator |
edemaine
left a comment
There was a problem hiding this comment.
Independent non-author agent source/API/both-manual APPROVE at exact 90360dc876ae975ef072e757c85cdb201bad5aeb, reviewer /root/review4808_reduction_bounds; no findings. Complete verifier/take-quantifier/output-length and actual-client delta checked; existing71 declaration headers, encodings, exact certificate and counting/oracle resource contracts preserved. Canonical proof/client/manual evidence and review limits. Fresh native six-gate/stock validation and actual final advisories remain an explicit integration hold. No queue action. Agent review, not human approval.
|
Agent review (Jetski reviewer session 5a624682-f5b1-4c56-b493-458fde4377cf) of 90360dc: approve. This is agent review, not human review.
|
Reduction-closure proofs for NP-style classes re-derived three pieces of plumbing by hand. This PR replaces those derivations with shared lemmas. No public statement changes; the only new declaration is one lemma.
Truncated verifier and take quantifiers.
PolyTimeReducible.mem_NPnow usesexists_truncated_verifier(from #4763) instead of rebuilding the truncated verifier and its padding argument (17 lines → 5).mem_NP_setOf_exists_appendandPolyTimeReducible.mem_NPWithOraclematch their certificate quantifiers withList.exists_length_eq_take_iffinstead of padding withList.replicateby hand. This follows up the #4794 review.Polynomials of a reduction's output length. New
PolyTime/OutputLength.leanstatesComputableInPolyTime.exists_polynomial_eval_length_le: for a polynomial-timefand polynomialq, somePboundsq(|f a|)byP(|a|). It composes existing lemmas (polyBounded_length,PolyBounded.of_polynomiallyBounded_comp,PolynomiallyBounded.polynomial_eval). It sits in its own module becausePolyTime/Basichas 112 direct importers; only its two clients import it.PolyTimeReducible.mem_FewP(4 lines → 1) andmem_NPWithOracle(6 lines → 1) use it.q = Xsites in NP/Advice, PH/Reduction and Parameterized/Distillation (×2) now callhf.polyBounded_lengthwithPolyBounded.exists_polynomialdirectly instead of going throughencoding_length.Infrastructure and refactoring only; no new mathematics. Net +72/−52 over 9 files, including the new 43-line module and 8 manual lines.
Not changed, with reasons.
ComputableInPolyTimeWithOracle.preprocess, soexists_truncated_verifierdoes not apply; only its padding and bound moved.exists_truncated_verifier_append(ArthurMerlin.lean) stays private. It has no two-block client outside that file.exists_truncated_verifier(TruncatedVerifier.lean) keeps its bound. It must build the unary computability certificate forbitsTakeWithInputanyway, and gets the bound from it in one line.Manuals. Operator's Manual: one paragraph in
native-and-resources.md§ Composing polynomial resource envelopes points to the new lemma, its clients and theq = Xform. TheIsVerifier.of_paddingmention indeterministic-workflows.mdis still accurate. Agent Operator's Manual: no change; no workflow or agent guidance is affected.Validation. On the merge with
main, buildslotlake build --wfailpasses for every changed module and for their representative clients (DP, Promise.Reduction, PH.OracleNP, SAT.LeftSet, FewP.Machine, SPP.FewP, PH.Yap, BooleanHierarchy.Kadin, Oracle.BakerGillSolovay) and tests (Distillation, SmallCountingClasses, NPExistsAppend, NPWitness). Each changed file also elaborates cleanly withlean -DwarningAsError=true.mk_all --check,lint-style,proof_copies, the projection-chain and encoding-readability ratchets, hygiene--check-simp,check_operator_manual.pyandcheck_pr_names.pyon the manual additions pass. Hosted CI runs the full suite.Part of #4737 (lane
ph-quantifiersfollow-ups). Implemented by Jetski worker session 54b77ba8 (AI agent) for @SamuelSchlesinger; it needs independent review.