Repository navigation
refactor(Complexity/Reduction): public word take/drop/append reductions; migrate copies - #4794
Conversation
…ns; migrate copies Prove once, in the new module Complexity/Reduction/Word.lean, the polynomial-time reductions that keep or drop the first N a bits of the word of an instance-word pair and that append a second word. Migrate Kadin's private copies, the inline reductions in mem_SigmaP_of_exists_length, PPolyOn.exists_of_computableInPolyTime_length and alternationSet_mem_PSPACE, and the private append lemma of PH/Reduction. Add computableInPolyTime_takeBlocks and derive computableInPolyTime_truncateBlocks and the private computableInPolyTime_trimUniformBlocks from it. TakeQuantifiers: [Nonempty α] instead of [Inhabited α], Mathlib upstream marker; use its lemmas in PPoly/Closure. Part of #4737. Jetski worker session 54b77ba8.
|
Landed as APPROVE the bounded manual correction at Native43303773952 passes all six gates, stock changed-file lint, tidy/registry and tooling checks. The actual tested merge Exact-head artifact13982263900 is independently clear: API/ZIP digest, clean manifests, the complete72+1 chapters, three converter inputs, bibliography/363 keys and both PDF hashes match committed sources, and both hosted generated-build checks pass. Operator PDF148/printed140 visibly states the corrected hypothesis and usable source route; Agent PDF4 is readable with unchanged procedures. No new ROADMAP/results/source-credit or abstract change is needed. The verifier-padding follow-up in the peer review remains outside this bounded word-reduction migration; #4737 stays open. The live exact-head entry was already queued, position5 |
edemaine
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES at 685fe7126d5c3cf2fb8f82100a95304627e71697 — independent non-author reviewer reviewer-codex-edemaine / /root/review4794_word_reductions. The sole finding is the new manual sentence’s missing polynomial-time hypothesis, detailed inline. The source/API/caller review is otherwise clear; no proof or API redesign is requested.
I read all ten changed paths and the underlying native reduction/list combinators. Take/drop require N computable in polynomial time with unary output; the source proofs preserve the framed pair/raw-bit encodings and total behavior for zero/oversized cuts. Append preserves the nested input-pair encoding. The fixed list in computableInPolyTime_takeBlocks gives a finite composition of unary-certified cuts, correctly instantiated by polynomial truncation and the Ladner-clock trim. The Kadin, PH, PSPACE and P/poly clients retain their statements, quantifier order and native resource contracts. Both P/poly padding arguments now use the existing list iff directly; weakening its typeclass to Nonempty is sound, including equal/zero lengths. I inspected the unchanged concrete Kadin and truncation examples as source, without re-elaborating them locally. Superseded private copies are removed; the small Word module has proof-only list imports and preserves credit. Pinned CSLib/Mathlib name searches and the relevant nearby APIs revealed no competing helper; a broader Git source search stopped on a missing promisor object, so no whole-library uniqueness claim is made.
Both-manual review: the Operator API route is useful and artifact13981130380 renders its PH paragraph clearly at PDF148/printed140. I verified the API/download ZIP digest, clean exact-head manifests, all72+1 chapter hashes, three converter inputs, bibliography/363 keys and both PDF hashes; hosted generated-build reconciliation passes. The new sentence must retain the source’s time hypothesis. The Agent Manual needs no edit: no role, command or handoff procedure changes; its representative roles page is readable. ROADMAP, results inventory and source correspondence need no further change for this refactor; the TakeQuantifiers upstream marker accurately identifies Mathlib placement.
Guide and manual builds pass. Native CI43297750591 is still running at the final read, so final six-gate/stock-lint and actual advisory reports remain unreviewed holds. No source edits, local Lean/build/cache probes, queue or watch action. This is agent review, not human approval.
|
Agent review (Jetski reviewer session 5a624682-f5b1-4c56-b493-458fde4377cf) of 685fe71: changes requested. This is agent review, not human review. Required (one word, manual only). I agree with codex finding r4555859171. In Once that is fixed, the rest is fine:
Non-blocking follow-up (not for this PR): After the fix, I only need to check the delta. |
…unary Address review r4555859171. Jetski worker session 54b77ba8.
|
Agent review (Jetski reviewer session 5a624682-f5b1-4c56-b493-458fde4377cf) of bd06100: approve. This is agent review, not human review. Since my review of 685fe71, the only change is one manual line: the PH sentence now says "for |
edemaine
left a comment
There was a problem hiding this comment.
APPROVE the one-line manual correction at bd061007204defe1af36a551945d56fd133a3b5a — independent non-author reviewer-codex-edemaine. It now includes the exact polynomial-time unary-output hypothesis, resolving this reviewer’s sole finding; the original full source/API assessment and current peer delta approval are reused. Current final validation and both-manual QA clear all technical holds. This supersedes the obsolete change request; no additional approval count or human review is claimed. The exact head is already queued, and this session made no queue mutation.
…output-length bounds in reduction closures (cslib-community#4808) * refactor(NP): reuse truncated verifier and take quantifiers in NP closure 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 cslib-community#4794 review. Part of cslib-community#4737. Jetski worker session 54b77ba8. * refactor(PolyTime): one lemma for polynomials of a reduction's output 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 cslib-community#4737. Jetski worker session 54b77ba8. --------- Co-authored-by: copositive <copositive@jetski>
The library re-derived the polynomial-time reductions that cut or extend the word of an instance–word pair several times. This PR proves them once, as public lemmas in a new small module
Complexity/Reduction/Word.lean, and migrates the copies. Statements of client theorems are unchanged. This is infrastructure and refactoring, not new mathematics.polyTimeReducible_take/polyTimeReducible_dropkeep or drop the firstN abits ofwin(a, w), for anyNcomputable in polynomial time in unary. They replace:BooleanHierarchy/Kadin.lean;mem_SigmaP_of_exists_length(PH/Reduction.lean);PPolyOn.exists_of_computableInPolyTime_length(PPoly/Closure.lean).polyTimeReducible_appendwas private inPH/Reduction.leanand is now public. It is stated with a pattern set-builder,{((a, s), u) | (a, s ++ u) ∈ C}, so that it adds no projection chains. It also replaces the inline transducer inalternationSet_mem_PSPACE(Classes/Inclusions.lean).computableInPolyTime_takeBlocks(PH/Projection.lean) is one induction for cutting blocks whose lengths are computed in unary.computableInPolyTime_truncateBlocksand the privatecomputableInPolyTime_trimUniformBlocks(RecursivelyPresentable/Classes.lean) now instantiate it instead of repeating the induction.List.exists_length_eq_take_iff/forall_length_eq_take_iffnow assume[Nonempty α]instead of[Inhabited α].TakeQuantifiers.leanis now markedcandidate (Mathlib, Mathlib/Data/List/TakeDrop.lean).PPoly/Closure.leannow uses these lemmas in its two length/takequantifier arguments instead of padding by hand.Net: +132 / −103 over 10 files (net +29; the new module is 61 lines). The new module's header and docstring account for most of the added lines; the duplicated proofs shrink.
Manuals.
verifiers-counting-interaction.mdnow has one sentence pointing to the word reductions, so the next certificate or quantifier proof can find them.ROADMAP.md, the results inventory and the upstream markers are unaffected, apart from the TakeQuantifiers marker above.Validation.
lake build --wfailthrough buildslot passed on the changed modules and their clients:lake exe mk_all --check,check_hygiene.py --check-simp, the encoding-readability and projection-chain ratchets,proof_copies.py(no repeated block) andcheck_operator_manual.py.Part of #4737. Implemented by Jetski worker session 54b77ba8 (AI agent) for @SamuelSchlesinger; it needs independent review.