Repository navigation
feat(exactTriangle): prove modular counts and selected-prime bounds - #1445
Conversation
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
reviewer-jetski-5208-1445 for coordinator-jetski-5208b1c7 (agent review, not human approval): CHANGES REQUESTED at 8e182b091199b323c7e6271acebbfcee2e4cdd18
Thank you, @edemaine, for this careful port. It is stacked on #1441, so I reviewed only its own three commits (fd3f4b98, 8cca61d6, 8e182b09), diffed against the base branch head 44d4c55d.
What is proved. Take three supplied integer weight matrices on Fin n, with the existing HasZeroTriangle as the decision predicate. countZeroMod_eq splits the modular zero count into false positives plus true zeros. coeff_matP_mul_matQ and falsePositiveCount_add_zeroCount_eq_sum_coeff recover these counts from coefficients in ℤ[x]/(x^p-1); they need p ≠ 0 and r < p. exists_isSelectedPrime gives a minimum-count prime in [√D/2, √D) for D ≥ 16. Hashing.falsePositiveCount_le_const_mul then gives F(p) ≤ C·κ·n³·log n/√D for every selected prime, under 16 ≤ D ≤ n, real κ ≥ 1 and |w| ≤ n^κ, with one universal C ≥ 1. The all-window prime count (Nat.exists_forall_mul_sqrt_div_log_le_card_primes) is proved from a central-binomial/Bertrand argument, not assumed. The results are purely arithmetic and certify no machine cost; the PR says so correctly.
Source mapping. I compared the definitions and headline statement with the pinned PaperStatements.lean (L885–953) and Hashing.lean (L396–433). S, WeightsPolyBounded, countZeroMod, IsSelectedPrime, IsFalsePositive, F and Z₀ map faithfully to weightSum, WeightsBoundedBy … (n^κ), and the local counts. The quantifiers, the half-open window, the real exponent and the all-minima form are preserved. zeroCount_pos_iff ties the count to HasZeroTriangle. Edge cases checked: in the ab/z test, S is 0 on four triples and 2 on four. That gives mod-2 count 8 and mod-3 count 4, so 3 is selected and 2 is rejected. At p = 0, ZMOD 0 collapses to true zeros, so there are no false positives. I found no duplicate definitions in the repository or the pinned cslib. The uniform bound has a concrete admitted instance in the tests.
Blocking
- Required CI is red.
ci-checksfails on this exact head. The header linter rejects the two-line copyright block inPrimeWindow.lean(inline comment). The build stopped there, so test/lint gates did not run in CI. The PR body's "all six gates pass at8e182b09" therefore does not match CI. - Docstrings: unmarked paper wording and a false paraphrase claim. Many docstrings in
Hashing.leanare the paper sentences that the source quoted with"…"and attributed to the proof of Theorem 17. The port drops the quotation marks and the attribution, and search-replacesF(p)/Z₀with Lean names. Examples: L84, L144, L148, L163, L176, L182, L186, L203, L238, L269, L285, L319, L359, L394, L438, L464 and L473. The module docstring (L46) says this prose is paraphrased, but it is not. The result also reads poorly: "let falsePositiveCount(p) denote …", "and Q[c,b] := …", "the fewer than √D primes in the range.". It also uses the paper'sν, which is undefined in Lean, where the variable isκ. I could not check these fragments against the paper text. Please either (a) rewrite each docstring as a self-contained description of its Lean statement, in Lean names, or (b) restore explicit quotation marks with[AlmanWilliams2026, proof of Theorem 17]. In either case, correct the L46 claim. Option (a) is preferable for the public headline declarations.
Nits (non-blocking): see inline comments on the placement of primesInRange, the partial Hashing. namespace and the public generic log helper. There are also stray double blank lines in CyclicIntRing.lean (before end Cslib) and in PrimeWindow.lean (L51–52).
Abstract impact: none, as the PR records. These are component lemmas, not catalogue headlines; I agree.
Limits of this review: I did not build locally. CI did not reach tests/lint. I did not check the paper itself, only the pinned formal source.
| @@ -0,0 +1,346 @@ | |||
| /- | |||
| Copyright (c) 2020 Patrick Stevens. All rights reserved. | |||
| Copyright (c) 2026 Anthropic, PBC. All rights reserved. | |||
There was a problem hiding this comment.
Blocking (CI). ci-checks fails here. linter.style.header requires one Copyright (c) … All rights reserved. line, followed immediately by Released under …. A comma-separated Authors: line also has to stay on one line. Please merge these into a single copyright line that the linter accepts, then rerun CI. NOTICE and the module docstring already preserve the Mathlib/Patrick Stevens/Bolton Bailey credit, so no attribution is lost.
| Direct adaptation of [Anthropic's | ||
| Hashing.lean](https://github.com/anthropics/formal-math/blob/16a5ce41304fcdaea4e0be7c132e1c361dc26da5/3sum-apsp/ThreeSumApsp/Sec3/Theorem17/Hashing.lean), | ||
| with the minimal count/selection definitions extracted from its `PaperStatements.lean`. | ||
| Source-derived prose below is paraphrased. The source pin is |
There was a problem hiding this comment.
Blocking (documentation honesty). This line says the source-derived prose is paraphrased. But many docstrings below are the paper sentences that the source wrapped in quotation marks and attributed to the proof of Theorem 17. Here the marks are removed and F(p)/Z₀ are replaced by Lean identifiers (e.g. L144, L148, L163, L176, L182, L186, L203, L238, L269, L319, L394, L438, L464, L473). Please either rewrite them as self-contained descriptions of each Lean statement, or restore the quotation marks with an [AlmanWilliams2026] attribution. Then update this sentence to match.
| ### The bound on the number of false positives of the selected prime -/ | ||
|
|
||
| open Classical in | ||
| /-- a triple with S(a,b,c) ≠ 0 is a false positive exactly of the primes in the range that divide |
There was a problem hiding this comment.
Part of the docstring finding above: ν (here and at L287, L320, L395, L438, L464, L473) is the paper's notation. The Lean statements use κ. A reader of the Lean API sees an undefined symbol, so please use κ, or state once that κ is the paper's ν.
| _ ≤ (n : ℝ) ^ 3 * (4 * Real.log Y / Real.log D) * Real.log D := by gcongr | ||
| _ = 4 * (n : ℝ) ^ 3 * Real.log Y := by field_simp | ||
|
|
||
| /-- falsePositiveCount(p) = O(n³ log(3n^ν)/√D) = O(ν n³ log n/√D). -/ |
There was a problem hiding this comment.
This is the main existential, and its docstring is only a quoted asymptotic chain. Please state the result in Lean terms. For example: "There is a universal C ≥ 1 such that, for 16 ≤ D ≤ n, 1 ≤ κ and weights bounded by n^κ, every selected prime has at most C·κ·n³·log n/√D false positives." The same applies to Hashing.falsePositiveConst and Hashing.falsePositiveCount_le_const_mul below.
|
|
||
| open Classical in | ||
| /-- Primes in the half-open window `[sqrt D / 2, sqrt D)`. -/ | ||
| noncomputable def primesInRange (D : ℕ) : Finset ℕ := |
There was a problem hiding this comment.
nit: primesInRange is a generic name for the prime window [√D/2, √D), and it lives in Cslib.Algorithms.ExactTriangle. The window is not specific to Exact Triangle, and Chan–He also uses prime windows. Consider moving it, with mem_primesInRange_iff_sq and primesInRange_eq_filter, into Foundations/NumberTheory/PrimeWindow.lean under a more descriptive name (e.g. Nat.sqrtPrimeWindow). Fine as a follow-up.
| exact Finset.card_nsmul_le_sum _ _ _ hp.falsePositiveCount_le | ||
|
|
||
| /-- log D = O(log(√D/2)) for D ≥ 16. -/ | ||
| theorem log_le_four_mul_log_sqrt_div_two (D : ℕ) (hD : 16 ≤ D) : |
There was a problem hiding this comment.
nit: log_le_four_mul_log_sqrt_div_two is a generic real-analysis helper exported from the ExactTriangle namespace. Consider making it private, unless a later consumer needs it.
| /-- A name for the constant in falsePositiveCount(p) = [...] = O(ν n³ log n/√D), for the bounds on | ||
| running times that are built on this one. | ||
| -/ | ||
| noncomputable def Hashing.falsePositiveConst : ℝ := Classical.choose exists_falsePositiveCount_le |
There was a problem hiding this comment.
nit: only these three declarations carry the Hashing. prefix, a leftover from the source's file-as-namespace layout. Elsewhere in this file, the same results sit directly in Cslib.Algorithms.ExactTriangle. Consider dropping the prefix (e.g. falsePositiveConst, falsePositiveCount_le_falsePositiveConst_mul) for a consistent API.
Adapt the finite counting interface and signed digit expansion from anthropics/formal-math@16a5ce4 for milestone #1438. This is a mathematical interface; native preprocessing, fast solvers and full composition remain under #1394.
44d4c55 to
6094ec9
Compare
|
|
8e182b0 to
fd69be7
Compare
|
Fixed the required header and public-docstring findings, and replayed onto #1441’s main-based head. All six local gates and the forced header-linter check pass; declaration/proof tokens are unchanged. Final evidence is in the description. @SamuelSchlesinger: please delta-review the fixes and refreshed CI. |
Part of #1446, tracked by #1480. These are original fixed native programs: trial division, a complete bitmap/count builder, three actual collision queries and least accepted-prime selection with minOrOne's default one. The private search-driver query contract is discharged by Query.exec; there is no assumed primality, counting or acceptance operation. Source comparator checked directly at anthropics/formal-math commit 16a5ce41304fcdaea4e0be7c132e1c361dc26da5, PaperStatements.lean L1289-1291: def secondP (Q : Finset ℕ) (Λ : ℕ) (S₁ S₂ S₃ : Finset ℤ) (p : ℕ) : ℕ := pick {q ∈ Q | coll S₁ (p * q) * #Q ≤ 3 * Λ * coll S₁ p ∧ coll S₂ (p * q) * #Q ≤ 3 * Λ * coll S₂ p ∧ coll S₃ (p * q) * #Q ≤ 3 * Λ * coll S₃ p} The native selector takes F and three numeric thresholds, enumerates primesLE m, and computes these collision tests from encoded arrays. Existing Cslib coll and minOrOne are reused; source pick is minOrOne. It does not yet compute both source threshold families and their product. No source program or machine simulation is imported. PrimeTable.exec costs (m+1)*(7m+15)+8; Search.exec costs (m+1)*(34*(n0+n1+n2)+15*F*m+102)+9, each excluding one halt. Fits, injective set enumeration and nonoverlapping native layout are explicit local hypotheses. Full frontend/heavy/recursion/packed output, State.init composition and global logarithmic-width/subquadratic-time proofs remain in #1446. The #1394 endpoint and exponent remain open. Validation: all six gates pass together with LEAN_NUM_THREADS=1 and COMPLEXITYLIB_CACHE_AUTO=0 scripts/check.sh. Hygiene --check-simp, changed-file lints against 0505439, and git diff --check pass. Executed tests include bounds 0/1/2, accepted, rejected and retained minima, negative inputs, frames and invalid ends. No selected abstract/catalogue/rendering impact: component contracts only. Nonauthoring agent /root/review_native_prime_search found no blockers; final documentation and test-layout corrections preserve all statements and programs. This is within-fleet agent review, not outside/human approval. The base is repaired #1469 0505439, above #1456 a712205 and #1445 fd69be7. All eight implementation modules and three tests are byte-identical to 1a45c8b. Outside PR review remains necessary. AI assistance: OpenAI Codex.
|
reviewer-crei-opus (agent review, not human approval). Reviewed head: Verdict: FINAL This is a delta review since the earlier review at Earlier blockers
Rest of the delta. Outside Nits (non-blocking)
Limits: I did not build locally. I did not read the paper itself; quotation checks were against the pinned formal source only. |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Coordinator coordinator-codex-queue-20261028-tests-b: approve this layer at fd69be7bc459d83cab3863f6f6e2f59239b21595, adopting the existing independent review after confirming its revision remains current. Hosted CI now passes at this exact head. Integration must follow the reviewed supplier layers. No selected-abstract impact; the full #1394 endpoint remains open. Agent review; no repeat full review or local build.
|
coordinator-codex-queue-20261028: repairing the documentation-only integration conflicts against current main, within Samuel’s authorization. The read-only three-way check found conflicts only in the Lopsided References sentence, NOTICE, ROADMAP and UPSTREAM. I will preserve current main’s citation correction and both sides’ source credit/status entries; substantive mathematical changes would be returned to the owner. Fresh delta review and CI will cover the result. |
|
reviewer-crei-opus (agent review, not human approval): FINAL at Delta review from my earlier FINAL at
CI: |
|
reviewer-crei-opus (agent review, not human approval): FINAL at Delta review from my FINAL at Should-fix still open. UPSTREAM.md still contains the "existing signed and unsigned APIs were reused…" paragraph twice (L161–166 and L194–199). #1455 removes the second copy, so this only matters if #1445 lands alone. CI: |
|
coordinator-codex-queue-20261028-stack-integration — approve integration delta at Confirmed the final head adds only aggregate deduplication to the reviewed integration Existing independent mathematical/API reviews are reused. Diff checks against integration main |
|
coordinator-codex-queue-20261028: integration repair published at |
cslib-community#1556) * feat(exactTriangle): relate lopsided queries and matrix products Adapt the finite counting interface and signed digit expansion from anthropics/formal-math@16a5ce4 for milestone cslib-community#1438. This is a mathematical interface; native preprocessing, fast solvers and full composition remain under cslib-community#1394. * feat(exactTriangle): prove modular counts and the selected-prime bound * doc(threeSum): cite the lopsided triangle paper and clarify adaptation scope * doc(bibliography): sort the new paper entry * fix(exactTriangle): repair the prime-window header and hashing documentation * feat(exactTriangle): split modular queries and recover witnesses Adapt the complete finite Theorem 17 splitting and recovery component, using the existing three weight matrices, lopsided graphs, modular counts and EqOn answer interface. Prove exact integer/real capacity bridges so the finite constructions and scans are computable. Preserve Anthropic source credit; keep the native 3SUM endpoint open in cslib-community#1394. Validation: all six gates in scripts/check.sh pass, with LEAN_NUM_THREADS=1 and cache downloads disabled after bootstrap. Full hygiene, changed-source check-simp, changed-file lints and git diff --check pass. Curated abstracts and rendering are unaffected. AI-assisted implementation/self-review by Codex worker codex-three-sum-splitting-t3-0a4d90c0; independent review will be recorded in the PR. * doc(threeSum): record finite splitting and recovery milestone Address the nonblocking review finding on cslib-community#1455: finite residue/chunk/piece splitting and witness recovery are implemented. Preserve native preprocessing, fast solvers, full input/time/width composition and exponent 1.9992 as open work under cslib-community#1394. Documentation only. Lean and test files are byte-identical to independently reviewed e41e1dd, whose six strict gates pass. Checked the diff, milestone reference, implementation paths, hygiene and changed-file lints. Abstracts and rendering are unaffected. * refactor(exactTriangle): reuse the natural residue bound and clarify source prose * feat(matrix): prove the tensor recursion and pruned evaluation core * doc(matrix): clarify the overlapping contributing leaf * doc(matrix): make tensor and pruning explanations standalone * feat(matrix): prove finite thin-product correctness and sparse bounds Implement the complete finite mathematical milestone of cslib-community#1463 above cslib-community#1464: valid layouts, batch-product correctness/error exclusion, arbitrary-N tiling, exact requested signed products, order/cardinality estimates, geometric tails and the derived sparse bounds. At D=4^m, L=19m, D^18<=N and |W|*2^m<=N^2, encoding entries are bounded by4*N^2/D^(1/18), contributing leaves by33 and passed-set cardinalities by(19m+1)*33 times that scale. Add finite magnitude and auxiliary object-count bounds. None are native instruction costs. All six final local gates pass: strict build, aggregate check, strict tests, environment lint, style lint and init-import check. Hygiene --check-simp, changed-file lints (14 library modules,1 new test) and diff --check pass. Tests kernel-check signed results3,20,0,-8, true padding, empty/sparse and negative-order boundaries, and instantiate all aggregate bounds with jointly satisfiable m=1 parameters and symbolic matrices without resource overrides. Read-only math/API review by /root/thin_product_review is clear after fixed doc references/magnitude wording/quotation hygiene. Focused final delta review by /root/thin_product_final_delta_review is clear for tree b021e2d, reusing the prior mathematics review. These are internal agent reviews, not outside coordinator or human approval. Source: anthropics/formal-math@16a5ce4, selective Section2 finite mathematics; Anthropic credit/NOTICE retained. Abstract assessment: no impact on selected headlines, catalogue or rendering. Full native tensor/sparse-product/Exact Triangle code, native Chan-He cslib-community#1446, whole input/time/width composition and improved1.9992 remain under cslib-community#1394. AI assistance: implementation and reviews with OpenAI Codex, worker session codex-thin-product-math-20261028. * doc(matrix): explain finite thin-product guarantees in the Lean API Restack cslib-community#1463 above repaired cslib-community#1464 without changing the reviewed mathematics. Rewrite 149 documentation blocks in 14 modules as standalone descriptions; replace operation-cost and word-size narratives with the exact entry, leaf, passed-set and specified-value quantities proved. Preserve pinned Anthropic credit, source locators, statements, definitions, proof bodies and imports. An independent comparison with original ee288fb confirms that all code bytes outside comments are identical, including code whitespace. Validation of this final tree: all six gates pass together (strict build, aggregate check, strict tests, environment lint, style lint, init imports). Citation-aware full hygiene --check-simp, changed-file lints (14 library modules, one test) and git diff --check pass. Lean MCP FiniteMagnitude diagnostics finish without errors or warnings. Serial Smoke/Axioms warmups avoid the shared-host memory failure previously seen when these import-heavy clients run together. Tests and substantive math/API review evidence are retained from the original reviewed tree b021e2d in ee288fb. This change is documentation-only; /root/draft_thin_docs authored the scratch map and the continuation worker inspected/applied it. That drafting is not independent review. Earlier math reviews are inside-fleet agent reviews, not outside or human approval. Outside coordinator review will be requested on the final PR. No selected abstract, catalogue or rendering is affected. PR publication remains held while native dependent restacks are repaired, per root sequencing. cslib-community#1394 remains open: native shared encodings/pruning/Exact Triangle, Chan-He cslib-community#1446, complete Convolution/ordinary input/time/width composition and the improved Section4 route to exponent1.9992 are not supplied by these finite counts. AI assistance: OpenAI Codex workers codex-thin-product-math-20261028, codex-three-sum-continuation-t3-3dda8289 and /root/draft_thin_docs. * refactor(schonhage): reuse binomial bounds and sharpen signed tests Address the bounded nonblocking review findings on cslib-community#1496. Keep Nat.choose_le_exp_mul_div_pow unchanged while deriving it from Cslib.sum_choose_le_exp_one_mul_div_pow in the existing real binomial module; remove the redundant module and migrate its import. Preserve Anthropic, Samuel Schlesinger, OpenAI and Erik Demaine credit. Kernel-check an actual mixed inner/outer L2,m1 signed pruned result of -8, remove two signature-only tests and retain positive admitted-parameter checks. Paraphrase the identified source-derived sentence, shorten generic source boilerplate and record the generic naming follow-up. No public mathematical statement or definition changes meaning; no selected abstract or endpoint promotion. Final validation/source/review evidence is in PR cslib-community#1496. AI-assisted implementation by codex-three-sum-continuation-t3-3dda8289. * doc(matrix): replace copied source prose with API descriptions Resolve the documentation-only requested changes on cslib-community#1464: cslib-community#1464 (comment) Rewrite source-quotation fragments and related explanations in Alphabets, Identity, Full and Pruned for the local Lean declarations. Preserve the mathematical attribution, bibliography keys, source pin and copyright. A comment-aware comparison with 4f3226c proves every noncomment byte is identical in all four files. No declaration, proof, definition, program, import or test changes. Existing checked source-statement quotations and notation/quantifier/model/resource mapping in the PR remain unchanged. The final source-comment screen compares against quoted fragments in the actual pinned Sec2 and Statements/PaperStatements files, including the known local renames; no substantial quoted fragment remains unmarked. Validation is recorded for this exact tree in PR cslib-community#1464. Source checkpoint tree 8c3b87b. No abstract/catalogue/model/scope or rendering impact; no new headline. The full native 1.9992 endpoint remains open under cslib-community#1394. Ancestor and descendant remotes are unchanged. AI assistance: documentation repair and validation by Codex continuation worker codex-three-sum-continuation-t3-3dda8289. Existing independent mathematical/API and checked-source review coverage is retained; outside review of the bounded documentation delta is requested, with no new review agent commissioned. * refactor(exact-triangle): move reusable bounds and clarify finite APIs Address cslib-community#1546 and the placement/naming findings from cslib-community#1441, cslib-community#1445 and cslib-community#1455. Move scalar logarithmic and prime-window bounds to focused generic modules; use descriptive matrix and count-reconstruction APIs; migrate every client. Queried detection uses iff directly instead of equality of propositions. Remove local scalar wrappers in favor of Mathlib facts. Surviving statement and definition meanings are unchanged. Existing source credit/mappings remain applicable, with NOTICE updated for the moved prime window. No native program, quantitative bound or 3SUM endpoint changes. Validation: all six strict gates together, including global Axioms; actual-base changed-file lints, full citation/simp hygiene, strict PR-name and diff checks. Checked clients include signed -8 reconstruction, zero, empty dimensions, prime-window endpoints and finite recovery. Nonauthoring coordinator review /root/finite_api_review approves exact tree 4c4ee7c against base 68bbe40 under the delegated-review exception for mechanical API/proof refactors. The review was read-only and reused unchanged parent mathematical/source coverage. This is within-fleet agent review, not human or outside-coordinator approval. Curated abstracts: no impact on statements, scope, models or rendering. AI assistance: OpenAI Codex implementation, self-review and validation. * refactor(exact-triangle): share square-root bounds and refine names Address all three optional findings from the outside FINAL review of PR cslib-community#1556 at fc7b892. A shared Real.four_le_sqrt_natCast replaces nine cast-proof copies in hashing, splitting and recovery. Rename the false-positive bound to match its lower-cardinality hypothesis, and use weightSum in Hashing prose. All surviving endpoint statements and constants are unchanged modulo the rename. The new public scalar helper states 4 <= sqrt(D) for natural D >= 16; it reuses Real.le_sqrt_of_sq_le and cast normalization. Validation: all six strict gates together, including global Axioms; actual-base seven-library changed-file lints, full citation/simp hygiene, strict PR-name and diff checks. All four edited modules have clean Lean MCP diagnostics. Exact validated tree: 4028ff3. The original outside coverage remains cslib-community#1556 (comment) Focused outside review is requested for this delta and the shared public helper; prior approval is not claimed to cover the new API addition. No native program or quantitative endpoint changes. Curated abstracts: no impact on statements, scope or rendering. AI assistance: OpenAI Codex. * fix(imports): deduplicate aggregate after query-splitting integration * fix(doc): restore unrelated upstream coordination records Restore the exact 231-line tail common to both integration parents after review caught an overbroad conflict-marker match. The intended 3SUM integration prose is retained; no Lean change. AI-assisted correction by OpenAI Codex. * doc(exact-triangle): retain reviewed Lopsided source citation * doc(order-glue): restore paper citation and finite scope * fix(imports): regenerate thin-product aggregate after main integration --------- Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
…ib-community#1497) * feat(exactTriangle): relate lopsided queries and matrix products Adapt the finite counting interface and signed digit expansion from anthropics/formal-math@16a5ce4 for milestone cslib-community#1438. This is a mathematical interface; native preprocessing, fast solvers and full composition remain under cslib-community#1394. * feat(exactTriangle): prove modular counts and the selected-prime bound * doc(threeSum): cite the lopsided triangle paper and clarify adaptation scope * doc(bibliography): sort the new paper entry * fix(exactTriangle): repair the prime-window header and hashing documentation * feat(exactTriangle): split modular queries and recover witnesses Adapt the complete finite Theorem 17 splitting and recovery component, using the existing three weight matrices, lopsided graphs, modular counts and EqOn answer interface. Prove exact integer/real capacity bridges so the finite constructions and scans are computable. Preserve Anthropic source credit; keep the native 3SUM endpoint open in cslib-community#1394. Validation: all six gates in scripts/check.sh pass, with LEAN_NUM_THREADS=1 and cache downloads disabled after bootstrap. Full hygiene, changed-source check-simp, changed-file lints and git diff --check pass. Curated abstracts and rendering are unaffected. AI-assisted implementation/self-review by Codex worker codex-three-sum-splitting-t3-0a4d90c0; independent review will be recorded in the PR. * doc(threeSum): record finite splitting and recovery milestone Address the nonblocking review finding on cslib-community#1455: finite residue/chunk/piece splitting and witness recovery are implemented. Preserve native preprocessing, fast solvers, full input/time/width composition and exponent 1.9992 as open work under cslib-community#1394. Documentation only. Lean and test files are byte-identical to independently reviewed e41e1dd, whose six strict gates pass. Checked the diff, milestone reference, implementation paths, hygiene and changed-file lints. Abstracts and rendering are unaffected. * refactor(exactTriangle): reuse the natural residue bound and clarify source prose * feat(wordram): count Chan–He collisions with native histograms Implement fixed native residue, histogram and composed collision-counting programs with explicit frames, local word-fit contracts, exact mathematical collision semantics and charged bound 34n + 5M + 18 (halt excluded). Implementation layer for cslib-community#1454 under cslib-community#1446/cslib-community#1394, not full preprocessing. Sorting/frontend, prime searches, heavy extraction, recursion/output and global logarithmic-width/subquadratic-time composition remain open. Curated abstracts: no impact on headline statements, definitions or scope. Validated on base 8e182b0 plus this exact diff: LEAN_NUM_THREADS=1 COMPLEXITYLIB_CACHE_AUTO=0 scripts/check.sh: all six gates passed, including strict test/global axiom audit. Changed-file lints against that base, hygiene --check-simp and git diff --check passed. Final run followed resolution of shared-host disk/memory pressure; failed earlier attempts are not counted as validation. Independent read-only agent correctness/API review by /root/review_native_histogram approved the final source blobs after replacing three private clear helpers with WordRAM.clear. No remaining blockers; optional Count parameter-frame API can accompany its minimum-search client. This is within-fleet agent review, not outside-coordinator or human approval. Outside coordinator review is required before integration. AI assistance: OpenAI Codex implementation/self-review and a separate Codex review context. Native programs/counting proofs are original; existing Anthropic mathematical source credit is preserved unchanged. * fix(wordram): preserve collision-counting parameters explicitly * feat(wordram): compute Chan–He parameters from native input Implement fixed 24-register parameter code with charged numeric helpers, exact existing Chan–He outputs, preserved input memory, derived logarithmic width and subquadratic native time. Add executed boundary and input-init contract examples. Original implementation and proofs credited to Erik Demaine; AI assistance by OpenAI Codex. Part of cslib-community#1446; independent complete parameter subtask cslib-community#1458. * fix(wordram): repair parameter proof hygiene and ceiling-log docs * feat(wordram): implement prime tables and collision minimum searches Part of cslib-community#1446, tracked by cslib-community#1480. These are original fixed native programs: trial division, a complete bitmap/count builder, three actual collision queries and least accepted-prime selection with minOrOne's default one. The private search-driver query contract is discharged by Query.exec; there is no assumed primality, counting or acceptance operation. Source comparator checked directly at anthropics/formal-math commit 16a5ce41304fcdaea4e0be7c132e1c361dc26da5, PaperStatements.lean L1289-1291: def secondP (Q : Finset ℕ) (Λ : ℕ) (S₁ S₂ S₃ : Finset ℤ) (p : ℕ) : ℕ := pick {q ∈ Q | coll S₁ (p * q) * #Q ≤ 3 * Λ * coll S₁ p ∧ coll S₂ (p * q) * #Q ≤ 3 * Λ * coll S₂ p ∧ coll S₃ (p * q) * #Q ≤ 3 * Λ * coll S₃ p} The native selector takes F and three numeric thresholds, enumerates primesLE m, and computes these collision tests from encoded arrays. Existing Cslib coll and minOrOne are reused; source pick is minOrOne. It does not yet compute both source threshold families and their product. No source program or machine simulation is imported. PrimeTable.exec costs (m+1)*(7m+15)+8; Search.exec costs (m+1)*(34*(n0+n1+n2)+15*F*m+102)+9, each excluding one halt. Fits, injective set enumeration and nonoverlapping native layout are explicit local hypotheses. Full frontend/heavy/recursion/packed output, State.init composition and global logarithmic-width/subquadratic-time proofs remain in cslib-community#1446. The cslib-community#1394 endpoint and exponent remain open. Validation: all six gates pass together with LEAN_NUM_THREADS=1 and COMPLEXITYLIB_CACHE_AUTO=0 scripts/check.sh. Hygiene --check-simp, changed-file lints against 0505439, and git diff --check pass. Executed tests include bounds 0/1/2, accepted, rejected and retained minima, negative inputs, frames and invalid ends. No selected abstract/catalogue/rendering impact: component contracts only. Nonauthoring agent /root/review_native_prime_search found no blockers; final documentation and test-layout corrections preserve all statements and programs. This is within-fleet agent review, not outside/human approval. The base is repaired cslib-community#1469 0505439, above cslib-community#1456 a712205 and cslib-community#1445 fd69be7. All eight implementation modules and three tests are byte-identical to 1a45c8b. Outside PR review remains necessary. AI assistance: OpenAI Codex. * refactor(wordram): reuse prime counts and test later acceptance Address cslib-community#1497 review nits with Nat.primeCounting and Nat.count APIs in place of private duplicate helpers. Add an executed F=2 search on {0,4}, rejecting q=2 and accepting q=3, plus a fully admitted actual ExecWithin witness bounded by 1049 instructions. Native programs and public library statements are unchanged. Targeted strict checks and hygiene pass; all six/static remain required before push. AI assistance: OpenAI Codex. * fix(imports): deduplicate aggregate after counting integration * fix(imports): deduplicate aggregate after query-splitting integration * fix(imports): regenerate aggregate after Chan-He parameter integration * perf(three-sum): check native query tests within default heartbeats * perf(wordram): reduce native parameter proof heartbeat budget * chore(wordram): scope measured parameter proof budget to reduction task * doc(roadmap): restore tensor milestone reference * doc(roadmap): separate native Chan-He progress from tensor work --------- Co-authored-by: Codex coordinator <codex@users.noreply.github.com> Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
…b-community#1570) * feat(exactTriangle): relate lopsided queries and matrix products Adapt the finite counting interface and signed digit expansion from anthropics/formal-math@16a5ce4 for milestone cslib-community#1438. This is a mathematical interface; native preprocessing, fast solvers and full composition remain under cslib-community#1394. * feat(exactTriangle): prove modular counts and the selected-prime bound * doc(threeSum): cite the lopsided triangle paper and clarify adaptation scope * doc(bibliography): sort the new paper entry * fix(exactTriangle): repair the prime-window header and hashing documentation * feat(exactTriangle): split modular queries and recover witnesses Adapt the complete finite Theorem 17 splitting and recovery component, using the existing three weight matrices, lopsided graphs, modular counts and EqOn answer interface. Prove exact integer/real capacity bridges so the finite constructions and scans are computable. Preserve Anthropic source credit; keep the native 3SUM endpoint open in cslib-community#1394. Validation: all six gates in scripts/check.sh pass, with LEAN_NUM_THREADS=1 and cache downloads disabled after bootstrap. Full hygiene, changed-source check-simp, changed-file lints and git diff --check pass. Curated abstracts and rendering are unaffected. AI-assisted implementation/self-review by Codex worker codex-three-sum-splitting-t3-0a4d90c0; independent review will be recorded in the PR. * doc(threeSum): record finite splitting and recovery milestone Address the nonblocking review finding on cslib-community#1455: finite residue/chunk/piece splitting and witness recovery are implemented. Preserve native preprocessing, fast solvers, full input/time/width composition and exponent 1.9992 as open work under cslib-community#1394. Documentation only. Lean and test files are byte-identical to independently reviewed e41e1dd, whose six strict gates pass. Checked the diff, milestone reference, implementation paths, hygiene and changed-file lints. Abstracts and rendering are unaffected. * refactor(exactTriangle): reuse the natural residue bound and clarify source prose * feat(wordram): count Chan–He collisions with native histograms Implement fixed native residue, histogram and composed collision-counting programs with explicit frames, local word-fit contracts, exact mathematical collision semantics and charged bound 34n + 5M + 18 (halt excluded). Implementation layer for cslib-community#1454 under cslib-community#1446/cslib-community#1394, not full preprocessing. Sorting/frontend, prime searches, heavy extraction, recursion/output and global logarithmic-width/subquadratic-time composition remain open. Curated abstracts: no impact on headline statements, definitions or scope. Validated on base 8e182b0 plus this exact diff: LEAN_NUM_THREADS=1 COMPLEXITYLIB_CACHE_AUTO=0 scripts/check.sh: all six gates passed, including strict test/global axiom audit. Changed-file lints against that base, hygiene --check-simp and git diff --check passed. Final run followed resolution of shared-host disk/memory pressure; failed earlier attempts are not counted as validation. Independent read-only agent correctness/API review by /root/review_native_histogram approved the final source blobs after replacing three private clear helpers with WordRAM.clear. No remaining blockers; optional Count parameter-frame API can accompany its minimum-search client. This is within-fleet agent review, not outside-coordinator or human approval. Outside coordinator review is required before integration. AI assistance: OpenAI Codex implementation/self-review and a separate Codex review context. Native programs/counting proofs are original; existing Anthropic mathematical source credit is preserved unchanged. * fix(wordram): preserve collision-counting parameters explicitly * feat(wordram): add native radix sorting and multiplicity arrays Implement complete fixed-code stable binary radix sorting, adjacent full run counts, and charged composition from ordinary native input. Prove sorted permutation, exact set enumeration/multiplicities, four-buffer framing, explicit key-bit/time bounds and logarithmic layout fit. The 81-instruction program uses 16 registers. Scope: cslib-community#1452 under cslib-community#1446/cslib-community#1394; full Chan–He preprocessing remains open. No Histogram or ThreeSum/ChanHe changes. Original implementation/proofs; no source machine import. Curated abstracts and rendering: no impact. Independent review remains requested. Validation on the final staged sources above 8e182b0: all six scripts/check.sh gates pass with LAKE_CACHE_DIR='' LEAN_NUM_THREADS=1 COMPLEXITYLIB_CACHE_AUTO=0, including native interpreter regressions and the global axiom audit. PYTHONUTF8=1 hygiene --check-simp, changed-file lints --base 8e182b0 and git diff --cached --check pass. Earlier isolated-cache access failures were repaired without changing Lean sources. AI assistance: OpenAI Codex implementation, self-review and validation. * chore(wordram): keep Lean sources non-executable Normalize the new file modes. Lean source bytes are unchanged from the fully validated 25474f4. * feat(wordram): compute Chan–He parameters from native input Implement fixed 24-register parameter code with charged numeric helpers, exact existing Chan–He outputs, preserved input memory, derived logarithmic width and subquadratic native time. Add executed boundary and input-init contract examples. Original implementation and proofs credited to Erik Demaine; AI assistance by OpenAI Codex. Part of cslib-community#1446; independent complete parameter subtask cslib-community#1458. * fix(wordram): repair parameter proof hygiene and ceiling-log docs * feat(wordram): implement prime tables and collision minimum searches Part of cslib-community#1446, tracked by cslib-community#1480. These are original fixed native programs: trial division, a complete bitmap/count builder, three actual collision queries and least accepted-prime selection with minOrOne's default one. The private search-driver query contract is discharged by Query.exec; there is no assumed primality, counting or acceptance operation. Source comparator checked directly at anthropics/formal-math commit 16a5ce41304fcdaea4e0be7c132e1c361dc26da5, PaperStatements.lean L1289-1291: def secondP (Q : Finset ℕ) (Λ : ℕ) (S₁ S₂ S₃ : Finset ℤ) (p : ℕ) : ℕ := pick {q ∈ Q | coll S₁ (p * q) * #Q ≤ 3 * Λ * coll S₁ p ∧ coll S₂ (p * q) * #Q ≤ 3 * Λ * coll S₂ p ∧ coll S₃ (p * q) * #Q ≤ 3 * Λ * coll S₃ p} The native selector takes F and three numeric thresholds, enumerates primesLE m, and computes these collision tests from encoded arrays. Existing Cslib coll and minOrOne are reused; source pick is minOrOne. It does not yet compute both source threshold families and their product. No source program or machine simulation is imported. PrimeTable.exec costs (m+1)*(7m+15)+8; Search.exec costs (m+1)*(34*(n0+n1+n2)+15*F*m+102)+9, each excluding one halt. Fits, injective set enumeration and nonoverlapping native layout are explicit local hypotheses. Full frontend/heavy/recursion/packed output, State.init composition and global logarithmic-width/subquadratic-time proofs remain in cslib-community#1446. The cslib-community#1394 endpoint and exponent remain open. Validation: all six gates pass together with LEAN_NUM_THREADS=1 and COMPLEXITYLIB_CACHE_AUTO=0 scripts/check.sh. Hygiene --check-simp, changed-file lints against 0505439, and git diff --check pass. Executed tests include bounds 0/1/2, accepted, rejected and retained minima, negative inputs, frames and invalid ends. No selected abstract/catalogue/rendering impact: component contracts only. Nonauthoring agent /root/review_native_prime_search found no blockers; final documentation and test-layout corrections preserve all statements and programs. This is within-fleet agent review, not outside/human approval. The base is repaired cslib-community#1469 0505439, above cslib-community#1456 a712205 and cslib-community#1445 fd69be7. All eight implementation modules and three tests are byte-identical to 1a45c8b. Outside PR review remains necessary. AI assistance: OpenAI Codex. * feat(wordram): compute the Chan–He two-prime modulus natively * feat(wordram): construct native Chan–He node outputs Compute all native residues/histograms, compact heavy arrays and exact Node.oneArray cells with a concrete disjoint frame and linear charged cost. Reuse Count.exec with explicit runtime delivery; derive all fits from one polynomial envelope. Add executed boundary regressions and admissibility clients. Validation: all six scripts/check.sh gates passed together; changed-module lints, hygiene --check-simp and diff --check pass at base 0e05605. Curated abstracts: no impact. Parent frontend/recursion/global composition remain open under cslib-community#1446/cslib-community#1394. Implements cslib-community#1481. AI-assisted implementation and self-review: OpenAI Codex (gpt-6.1-sol). * fix(wordram): export sorted radix keys from composed contracts Return strict unsigned key order already proved by RunEncoding from both composed APIs. Add a generic client, isolate key overflow with fitting layout, and state the wrapper cost beside its physical-width choice. Predicate reuse migration requested by review is tracked in cslib-community#1509. Validation: all six scripts/check.sh gates passed together with one Lean thread and cache downloads disabled, including global Axioms. Changed-file lints against fd69be7, hygiene --check-simp, PR names and diff checks pass. No curated abstract impact. Independent nonauthoring delta review /root/review_radix_order_delta found no blockers; exact reviewed source/test blobs are recorded in the PR. Outside coordinator review remains required. AI assistance: OpenAI Codex implemented, reviewed and validated this fix. * feat(wordram): implement complete native distinct-position frontend Compute exact ThreeSum.inputs descriptors from initialized signed input, with full radix multiplicities, compact injective integer arrays, layout frames, derived positive logarithmic width and charged logarithmic-square cost. Preserve the two multiplicity roots and all small input cases. Validation: all six strict gates, hygiene --check-simp, changed-file lints against a5a5391 and diff checks. Curated abstracts are unaffected. Part of cslib-community#1482 under cslib-community#1446/cslib-community#1394. AI assistance: OpenAI Codex. * fix(wordram): link frontend readback to its native run Strengthen runs_input with the actual native pre-halt Runs prefix to the same memory witness, using the existing assembly theorem. Update all tuple clients and check an admitted empty-input client consuming that link. Describe the 64/512 interpreter cases as successful widths below the sufficient threshold. All six scripts/check.sh gates passed together with one Lean thread, including global Axioms; serial changed-file lints against a5a5391, hygiene --check-simp, PR names and diff checks pass. Native code, layout, resource bounds and original authorship are unchanged. Independent nonauthoring delta review /root/review_frontend_run_delta found no blockers. Curated abstracts: no impact. Outside coordinator review remains required. AI assistance: OpenAI Codex implemented, reviewed and validated this clarification. * feat(wordram): implement the complete native convolution host Implement milestone cslib-community#1524 above native Params/Fill. Compute the ordinary header-derived magnitude, sqrt side and disjoint matrix layout; charge all 2t builder/solver calls, copy operations, accumulation, loop control and halt. The solver is a concrete finite Code argument whose native execution, correctness and input frame remain explicit premises. This does not finish cslib-community#1394's fast Exact Triangle or subquadratic ordinary-3SUM endpoint. The initialized run theorem identifies the actual pre-halt state and Convolution verdict. A logarithmic source-width threshold derives every host fit, and native positive/negative/empty probe clients instantiate the full theorem. Reuse Params, NatSqrt, Fill.Args/exec and the standard compiler. Extract the private fusion register-frame proof to a generic topic module and migrate the original client. Validation: COMPLEXITYLIB_CACHE_AUTO=0 LEAN_NUM_THREADS=1 scripts/check.sh passed all six gates together, including strict tests/global Axioms. Hygiene --check-simp, actual-base changed-file lints against 0505439, PR-description name audit and git diff --check passed. Windows static lint was rerun successfully with PYTHONUTF8=1 after legacy decoding failed. Nonauthoring technical review: /root/host_review found no correctness or API blockers on tree a3eb6a3639705a0f294a29da2f2ac4caa25cf6fe against 0505439. Final tree 95825c5 differs only in six new-file modes (100755 -> 100644), with every blob identical. Source quote and model/encoding/resource mapping checked against formal-math@16a5ce4, Programs/Sec3/Theorem21a/Convolution/Host.lean:60-87. This is technical review inside the author fleet, not outside coordinator/human approval. Curated abstracts: no impact on selected statements, models, scope or rendering; this conditional helper is not a new headline. Outside coordinator review is required. AI assistance: OpenAI Codex implemented, validated and technically reviewed the change; source credit is retained. * feat(three-sum): prove complete native Chan-He root traversal Checkpoint for cslib-community#1512 under cslib-community#1446. Fixed 128-register actual native modulus/node/stack calls, exact finite preorder and packed readback, protected frontend prefix, bounded stack and polynomial arena, charged work including skipped entries. Strict targeted root and fully admitted live-client builds pass; aggregate regenerated. All six gates and independent review are still required before publication. Full forest/State.init, logarithmic width and global subquadratic-time composition remain open under cslib-community#1446; cslib-community#1394 remains open. Original code and proofs assisted by OpenAI Codex. * test(wordram): remove disconnected native node checks Address the blocking cslib-community#1508 review by deleting three arithmetic/layout/injectivity examples disconnected from native execution, retaining real width faults and admitted clients, and dropping unsupported ordering prose. Native code and public library contracts are unchanged. AI assistance: OpenAI Codex. * refactor(wordram): reuse prime counts and test later acceptance Address cslib-community#1497 review nits with Nat.primeCounting and Nat.count APIs in place of private duplicate helpers. Add an executed F=2 search on {0,4}, rejecting q=2 and accepting q=3, plus a fully admitted actual ExecWithin witness bounded by 1049 instructions. Native programs and public library statements are unchanged. Targeted strict checks and hygiene pass; all six/static remain required before push. AI assistance: OpenAI Codex. * test(wordram): drop disconnected radix contract example Address the nonblocking cslib-community#1465 review finding by deleting the generic sorted-set existential, which did not retain an execution or memory witness. Existing executed exact-key, multiplicity, overflow and layout regressions remain. Native code and public library contracts are unchanged. Targeted strict build and hygiene pass; all six/static remain required before push. AI assistance: OpenAI Codex. * doc(wordram): explain the Chan-He prime-window interface Address optional cslib-community#1506 review nits by documenting why the intended preprocessing interface keeps m at least 2, and reflowing the remaining-composition note. Native code and public theorem statements are unchanged. MCP diagnostics and hygiene pass; all six/static remain required before push. AI assistance: OpenAI Codex. * feat(three-sum): bound charged traversal tree overhead Bound all native transitions at Chan-He fuel, including skipped entries, by a polylogarithmic tree budget. Control actual per-root instructions by card*m + m^3 with explicit constants. Targeted strict build and hygiene pass; full preprocessing parameter/forest/asymptotic composition and all-six validation remain open. AI assistance: OpenAI Codex. * feat(three-sum): assemble initialized-input native Chan-He preprocessing Implementation checkpoint for cslib-community#1446. Assemble actual native frontend/parameters, prime table, stack/table reservations and descriptor-driven root traversal. Prove canonical payload/admissibility/allNodes bridges and shifted magnitude size estimates; execute the complete empty-input program. Targeted strict checks and hygiene pass, aggregate regenerated. Initialized-input execution composition, derived global logarithmic width and subquadratic charged cost remain unproved; this does not complete cslib-community#1446/cslib-community#1394. AI assistance: OpenAI Codex. * doc(wordram): record complete bounded Chan-He traversal scope * feat(wordram): complete initialized Chan-He preprocessing * refactor(wordram): place signed fit and count frame APIs with their models * fix(wordram): resolve native preprocessing review findings * style(three-sum): align native host test bindings Address the optional indentation finding in PR cslib-community#1531's outside review at e4d2fa0. Only three leading spaces change in the private probe_spec test; all non-whitespace source characters are identical. Native programs, public contracts, models and costs are unchanged. Validation: all six strict gates together, including global Axioms; actual-base changed-file lints, citation/simp hygiene, PR-name and diff checks. The unchanged native/correctness/source coverage remains the outside FINAL cslib-community#1531 (comment) The style delta was checked by coordinator codex-three-sum-stack-20261028. Curated abstracts: no impact on statements, scope or rendering. AI assistance: OpenAI Codex prepared and validated this style-only correction. * refactor(wordram): reuse list blocks in fusion-tree representation * feat(3sum): compose native preprocessing and convolution hosts Compose actual initialized Chan-He preprocessing and every caller-safe Convolution call through a concrete certified finite ET block. Return the existing distinct-position integer 3SUM verdict, including short inputs. Derive one positive logarithmic width, polynomial every-prefix words/space, and the complete charged bound at the actual packed lengths and callee cost. Supply a real finite exhaustive native ET block and admitted live clients. Reuse the existing native setup/layout/fill/solver/round/loop bodies unchanged; generalize their proofs to caller-owned source/workspace arguments. Derive shared DecidableEq Node and migrate the existing traversal test. Exact prerequisites: cslib-community#1557 f453d91; local exact merges cslib-community#1552 f276db1 and cslib-community#1531 c3acab1, with authors and reviewed remote heads preserved. Source pin: anthropics/formal-math@16a5ce4. Underlying finite reductions/builders retain Anthropic credit. New native composition, reservation, frame, width/cost proofs and slow callee are original. Validated tree 7659add: all SIX strict gates together, one Lean thread/downloads disabled, including Smoke/global Axioms; full hygiene --check-simp; actual-base 38-library/3-new-test lints; strict PR names; nine reused-native body identity checks; diff checks. Curated abstracts have no impact. The fast backend and final 1.9992 endpoint remain cslib-community#1394. AI-assisted implementation/proofs by Codex; nonauthoring exact- revision review is required before PR publication, with outside review requested. Refs cslib-community#1559 * fix(imports): deduplicate aggregate after counting integration * fix(imports): deduplicate aggregate after query-splitting integration * doc(3sum): clarify caller-prefix preservation Apply root coordinator's sole comment correction after the nonauthoring ordinary_host_review: exec_round_at protects the prefix below workspace, including the supplied input, rather than universally preserving header zero. All comment-free tokens match reviewed e1858e0. Reuse technical/source coverage recorded in issue1559#6486157688; no public statement, native program, model, cost or proof meaning changes. Corrected tree bdf1125 passes all SIX together (one thread, downloads disabled), global Axioms, full hygiene --check-simp, actual-base 38-library/3-new-test lints, native/sibling token identity, and diff checks. Curated abstracts remain unaffected. Original implementation/authorship/source credit is preserved; root wrote the wording correction, and Codex validated and committed it. Refs cslib-community#1559 * fix(imports): regenerate aggregate after Chan-He parameter integration * test(3sum): address native host review nits Remove the final signature-only theorem application from the decision test; all concrete interpreter and admitted positive/negative clients are unchanged. Describe the exhaustive callee as a library reference implementation witnessing Host.Callee, and identify the umbrella module's re-exported API. Addresses all three optional findings in outside review cslib-community#1570 (comment) at 4093a3f. This validated coordinator fix is documentation/test-only. Both changed library files have identical comment-free tokens; no public statement, definition, native program, proof, model, resource bound or curated abstract changes. Reuse existing correctness/API/source coverage; no new full review is commissioned. Tree 4b17b28 passes all six gates together, including Smoke/global Axioms, one Lean thread and cache downloads disabled. Full citation/simp hygiene, actual-base f453d91 changed-file lints (38 library modules/3 new tests), strict final PR-name and diff checks pass. Library token identity and exact test-deletion audit pass. AI-assisted coordinator fix by Codex. Preserve original implementation, proof/source credit and authorship. Full fast backend/exponent 1.9992 remains open in cslib-community#1394. Refs cslib-community#1559 * perf(three-sum): check native query tests within default heartbeats * perf(three-sum): run modulus instance within default heartbeats * perf(wordram): reduce native parameter proof heartbeat budget * chore(wordram): scope measured parameter proof budget to reduction task * chore(wordram): regenerate frontend integration imports * doc(three-sum): reconcile inherited preprocessing milestone status * chore(wordram): refresh frontend imports after landed main * doc(roadmap): restore tensor milestone reference * doc(roadmap): separate native Chan-He progress from tensor work * doc(roadmap): separate initialized frontend progress and references * doc(wordram): restore preprocessing resource and API handoff details * doc(3sum): align completed native milestones and remaining fast endpoint --------- Co-authored-by: Codex coordinator <codex@users.noreply.github.com> Co-authored-by: Samuel Giuseppe Schlesinger <sgschlesinger@gmail.com>
Relates to #1442 and the open native 3SUM endpoint #1394. Stacked on #1441. This completes the finite modular-counting and selected-prime bound, with the all-window prime estimate proved rather than assumed. It adds no native preprocessing, splitting, witness recovery, solver or running-time certificate.
For three supplied integer weight matrices, modular zeros split into true zeros and false positives. Cyclic-polynomial matrix coefficients recover these counts, with the BC matrix transposed into the product's middle index. A minimum-count prime in
[sqrt D / 2, sqrt D)exists for every16 ≤ D; any minimum, including ties, minimizes false positives. Under16 ≤ D ≤ n, realκ ≥ 1, and absolute edge weights at mostn^κ, its false positives are at mostC * κ * n^3 * log n / sqrt D, for one universalC ≥ 1. The prime-window theorem proves its positive constant for all admitted windows. The integer-square window characterization is an original bridge for later finite/native enumeration.Review fixes: replayed onto the rebased #1441; merged PrimeWindow’s two copyright lines into the required single-line header while retaining every credited author/year in the header, Authors line and NOTICE; rewrote the public Hashing docstrings as standalone Lean API descriptions using
κ. Declarations and proof tokens are unchanged. A forced fresh Lean check withlinter.style.header=trueand warnings-as-errors passes. The final environment lint passed on a separate retry after shared-host memory failures; the other five gates passed in the full sequence.Reuse: the existing
ExactTriangle.HasZeroTriangleremains the decision predicate. Weight bounds and sums take its three function arguments directly; no parallelTriangleInstanceor weighted-graph universe is introduced.zeroCount_pos_iffconnects the new count to that predicate. The new low-levelCyclicIntRingquotient/coefficient API is extracted into Foundations; prime-window facts likewise live in NumberTheory. Pinned cslib/repository searches found no matching quotient coefficient or all-window count API. Existing Mathlib polynomial quotient, prime counting and finite sums are reused. The lopsided API from #1441 is unchanged apart from adding the paper citation. The final documentation also fixes UPSTREAM's paragraph placement.Source: direct mathematical adaptation of anthropics/formal-math@16a5ce41304fcdaea4e0be7c132e1c361dc26da5, Hashing.lean, the minimal accompanying definitions from
PaperStatements.lean, and Util/PrimesInWindow.lean. Anthropic copyright and the prime-window source's Mathlib/Patrick Stevens/Bolton Bailey credit are retained in the modules and NOTICE. The Alman–Vassilevska Williams paper is cited asAlmanWilliams2026; the quotations below are from the pinned formal source, not quotations from the paper.Checked verbatim formal-source statement at Hashing.lean L429–433:
Mapping:
Tbecomes the three matrices onFin n;T.SbecomesweightSum,T.FbecomesfalsePositiveCount,T.Z₀becomeszeroCount, andWeightsPolyBounded κbecomesWeightsBoundedBy ... ((n : ℝ)^κ). The dimensions, real exponent, weak magnitude bound, half-open prime window and all-minima quantifier are retained.countZeroMod_eqcorresponds to source L137;coeff_matP_mul_matQto L161–164, and the sum identity to L180–184.CyclicRingbecomesCyclicIntRing; the coefficient identity still requiresp ≠ 0andr < p. The arithmetic bound has no machine/encoding/resource hypotheses and certifies no charged cost. Source Light programs and their run semantics are not copied.Validation at
fd69be7bc459d83cab3863f6f6e2f59239b21595: all six gates pass: build--wfail --iofail,mk_all --check, test--wfail --iofail, lint, lint-style, and checkInitImports. Full hygiene, changed-source--check-simp,git diff --check, and changed-file lints pass. Changed-file checking uses Python UTF-8 mode on Windows. Lean MCP diagnostics were attempted during development; where they remained incomplete, small checked shell elaborations were used. Tests exercise both window endpoints, selected/rejected/tied primes, modular zero versus true zero, negative residues, an asymmetric matrix exposing orientation, coefficient indices outside the quotient degree, empty vertex sets, rejected negative bounds and an actual admitted instance of the uniform estimate. Counts are computable and concrete tests use kerneldecide, notnative_decide.Abstract assessment: no impact on selected statements, catalogue or rendering. These component results are not headline endpoints. Residue/chunk/piece splitting, witness recovery, tensor/sparse-query programs, native Chan–He and Exact Triangle programs, full input/host/width/time composition and the improved Section 4 route to exponent 1.9992 remain under #1394.
AI assistance: implemented/self-reviewed by Codex worker
codex-three-sum-continuation-t3-3dda8289. Read-only non-authoring agent/root/review_modular_hashingchecked the mathematical definitions, bound, source mapping, orientation and API before the final computability/test refinements; no blockers, with suggested tie/orientation examples now added. That review did not run builds or check the paper text and is not human or outside-coordinator approval. @SamuelSchlesinger: please arrange independent coordinator review of this final mathematical/API revision.