Skip to content

feat(ExactTriangle): add callable complete fixed-prime solver - #2139

Merged
SamuelSchlesinger merged 5 commits into
mainfrom
work/three-sum-native-callable-fixed-prime-20261101
Nov 1, 2026
Merged

SamuelSchlesinger merged 5 commits into
mainfrom
work/three-sum-native-callable-fixed-prime-20261101

Conversation

@edemaine

@edemaine edemaine commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Makes the complete fixed-prime ExactTriangle solver callable on runtime original arrays while preserving selector registers and dirty outside memory. Resolves #2125 after integration. Parameter/prime selection, the outer ordinary-input host and #1394's final 1.9992 theorem remain open.

The fixed standard unsigned program has 640 registers, at most 400000 flat slots including halt and no physical-width reads. Arguments 600–607 are raw n,D,g,p, canonical-signed AB/BC/AC pointers and workspace base b; they and registers 0–159 survive. Raw flag/witness/scans return in 632/633–635/636. Original array spans may alias but end≤b. Memory outside[b,b+M) is unchanged. CallableFixedPrime.exec proves actual execution, flag1 iff original signed ET, original-coordinate witnesses and one global S≤F(p)+returnedFlag. CallableFixedPrime.runs_input supplies actual State.init, same-y prefix Runs and charged halt. Correctness requires exactly 3n² original integers, D=4^m≥16, g≥1, p∈Nat.sqrtPrimeWindow(D) and n≥D^18, plus explicit original-word/address fits.

The code copies only the original three n²-word arrays and writes five headers. An addition in each actual copy computes raw-word sum T. Native NatClog/Power compute w₀=6166·clog₂(n+D+g+p+T+4), M=2^w₀. Actual bank normalization and memory-window compilation invoke the real one-time producer and 416-register all-record product/witness solver in bank 160–578. No whole-window/catalogue clear or snapshot, extra ALU instruction, or supplied layout/list/run/solver/witness/time contract is used. The prepared reference state is derived in the proof, never supplied to the algorithm; dirty scratch is not given a fictitious canonical external frame.

The complete caller pre-halt charge is 24n²+24669·clog₂(n+D+g+p+T+4)+482+3·T_source; halt adds 1. Initialized header delivery adds 14. CallableFixedPrime.timeBound_le retains source preparation 690n²Dg, aggregate queried-product term 138412032·(19m+1)n³g/D^(1/18), record/query/control work and ONE global reserve(42·pieceSize+28)(F+1). The source halt-inclusive bound is retained conservatively inside factor 3. Arbitrary bad fixed primes can have large F; this does not claim uniform subcubic performance without the separate selection/parameter analysis.

Admission covers b+4M+P+1024, including original raw dirty-word bound P before remainder instructions. P is a numerical hypothesis, not an algorithm argument. For D,g,p≤n, magnitudes≤A≤(n+2)^κ and original b,P≤(n+2)^β, threshold≤(12332(κ+9)+β+14)·clog₂(n+2), with polynomial prefix envelope exponent 12332(κ+9)+β+15. Initialized admission is positive and≤(24664(κ+9)+19)·clog₂(n+2); prefix/support exponent is 24664(κ+9)+20. Every wider prefix is compared with the actual minimum-width complete run. Callers retain original outside support; initialized support is finite. The envelope is not cleared or copied by the program.

Reuse includes the actual native producer/record solver, finite global failure accounting, signed kernels, memory-window compiler and width transport. PreparationInput.exec_at reuses the existing private admission derivation for dirty callers; unchanged PreparationInput.exec_input consumes it. Public PreparationInput.input_fits, Output transfer/heap bounds and structured no-width-read facts support concrete clients. New eight-register ArrayCopySum adds its sum within the native copy loop. MemoryWindow normalization facts avoid repeated 416-bank unfolds. Existing source code definitions and old public initialized statements are preserved; these new seams are included in this layer’s whole-source review.

Primary source: anthropics/formal-math@16a5ce4. Under Programs/Sec3/Theorem17, Host/Loop.lean110–154 gives four calls/host charge; Host/FailedScans.lean86–104 bounds failed scans through distinct false positives; Host/Program.lean135 onward gives a Light host conditional on a lopsided solver. These are checked paraphrase locators, not quotations. This PR proves original native caller/dirty-memory/compiler results around the existing concrete native solver, rather than assuming that Light contract. Existing supplier credit/reviews apply only to unchanged source; the fresh review covers all new reasoning.

Validation: the final exact source tree ff0dd30bd22eecb962c199c873d76609e1084840 passed strict scoped compilation of the new umbrella, all three owned tests and existing initialized supplier client; canonical imports; full hygiene/simp; all 25 changed-library environment lints; compiled doc-name/new-test audits using fresh scoped outputs; strict body names and full-base/staged/unstaged whitespace. One thread, downloads disabled. Normal merge of pinned main b467 preserves all 28 owned source blobs/modes, inherited main blobs and source credit. The existing native code prefix/private admission proof and old public initialized statements were checked for identity; source pin/blobs/locators checked. No source repair during this audit. Exact candidate dc92727dc records the scoped validation and limits.

No local full-six claim: hosted exact-head CI must cover all six and the standard whole-library changed-file artifact check. That CLI's missing unrelated artifacts were recorded; its unchanged doc/test audit functions passed against freshly compiled 25-library/3-test scoped outputs. Tests include fully admitted initialized positive/negative thin geometry, a complete dirty caller with aliased source spans/nonzero protected registers, and actual small signed-copy/header/return/frame/cost runs; small VM fixtures alone do not meet thin geometry. The independent source review below does not convert scoped checks into full validation.

Independent nonauthoring agent /root/callable_fixed_prime_review APPROVE at dc92727dc2744d3f1420d5b1ddd9144603d9c207, with no blockers or requested changes. It read all 29 changed files, checked the primary pinned source locators directly, and covered copying/normalization, producer admission/locality, actual caller and initialized execution, same-y halt/readback, dirty/aliased memory and register frames, independent-width prefixes, charges and all three tests. It inspected the scoped validation evidence without running builds or modifying source. Existing supplier coverage is reused only for unchanged code. This is agent review, not human or platform approval; exact-head full CI is still required.

No abstract/catalogue/rendering impact or new headline claim. AI assistance: OpenAI Codex implementation/proofs; original source credit retained.

Source/MCP checkpoint for #2125 on pinned bc2. Complete actual640-register caller execution, original-array copy/sum, computed source width and memory-window translation, exact +/- ET/witness/global scans and caller/selector frames are proved. Aggregate actual source/copy/setup/return/halt charge and original initialization14 are checked. All owned source modules and concrete signed/dirty/frame/cost tests have clean targeted diagnostics; no local all-six/static/import audit claim. Original producer admission/locality proof is reused through narrow public seams; old initialized statement and all existing native source program bodies are retained.

This is a partial source checkpoint, not completion/publication: full initialized same-y Runs/halt, original-regime logarithmic width/polynomial prefixes, fully admitted clients and final audit/review remain under2125. Root retains sole audit slot and full1394/global parameter/prime/ordinary-host/asymptotic scope. No new agents or PR. AI assistance: OpenAI Codex; original source credit preserved.
Source-ready checkpoint for #2125 on pinned main bc2e6c2. Complete fixed640 standard Code caller and initialized entry: real original-array copies/sum, native ceiling-log/power/modulus/normalization, actual complete one-time producer and all-record solver, original signed witness verification, raw Boolean/witness/global scans. Caller preserves low160 and arguments600..607, with outside-window/source frame and dirty scratch. Actual initialized same-y prefix and halt prove positive and negative ET iff, and global S<=F(p)+actualFlag. No run/layout/list/witness/solver/time oracle.

New Width/Prefix/SourceBounds prove original-parameter positive admission, raw dirty words before reduction, every-wide-width native prefixes and independent-W polynomial words/new-support. Separate caller placement/raw-word exponent is explicit. Initialized log-width coefficient24664*(kappa+9)+19 and polynomial prefix exponent24664*(kappa+9)+20. Actual caller cost24n^2+24669*clog2(n+D+g+p+T+4)+482+3*oldSourceTime pre-halt, T actual raw copied sum. Initialized header14 and halt1 are charged. Complete source aggregate terms retained, including one global false-positive reserve; parameter/prime choice, uniform selected-prime performance and full1394/1.9992 remain OPEN.

Targeted Lean MCP clean: new umbrella and all source through its imports; three owned test modules WordRAMCallableFixedPrime, WordRAMCallableFixedPrimeInput, WordRAMCallableFixedPrimeCaller; existing WordRAMExactTriangleFixedPrimeInput client. Tests include fully admitted initialized +/- valid thin geometry, complete actual dirty caller with aliased inputs/nonzero low160, and small native signed/header/return/frame/cost regressions. Earlier source files checked serially; bootstrap was warm. No local all-six, canonical aggregate generation or final hygiene/name/static audit claimed: root retains that slot, required fresh whole-layer review/publication still pending. Original source checkpoint37de retained. Own new-file executable modes corrected to0644; no unrelated checkout/cache/process/source change.

Public producer exec_at/input_fits and Output transfer/heap lemmas reuse original private admission/locality proofs; old initialized statements and existing native program bodies retained. FixedPrime noReads property extracted once and reused. Generic ArrayCopySum/MemoryWindow normalization API additions have concrete clients. Abstract catalogue/rendering unaffected; no headline promotion. AI assistance: OpenAI Codex; existing mathematical/source credit retained.
Only mode100755 to100644; source bytes and targeted Lean evidence from69495f23b unchanged. Source-ready2125 still awaits coordinated canonical imports/static and fresh whole-layer review; no all-six claim.
…tion

Final #2125 candidate on one normal compatibility merge of pinned main b4678e2. All28 source-ready owned source blobs and modes are identical to61fec4343, all inherited main blobs preserved, and only22 canonical imports added. No source/proof/program repair during this final audit. Frozen validated source tree ff0dd30.

Strict cache-disabled scoped build PASS for new CallableFixedPrime umbrella, all3 owned tests (WordRAMCallableFixedPrime, WordRAMCallableFixedPrimeInput, WordRAMCallableFixedPrimeCaller) and existing WordRAMExactTriangleFixedPrimeInput. Canonical mk_all check PASS; full hygiene --check-simp PASS; changed25-library environment lint PASS (538 local declarations, imported-environment nonlocal linters too); fresh scoped compiled doc-name/3-new-test audits PASS; strict PR body declaration names PASS; whole pinned-base/staged/unstaged diff --check PASS. One compiler thread, downloads disabled. Exact own/supplier/main/native-code/statement/private-fit and primary-pin/blob/locator identities PASS. All audit processes finished.

Scope limitation: NO local whole-library/all-six claim. Standard changed-file CLI first rejected missing whole-library freshness/root artifacts, including unrelated WordRAMUniformProbing. Its unchanged repository doc/test lint functions passed on fresh strictly built scoped25lib/3test artifacts instead; full standard CLI and all six gates require hosted exact-head CI before integration. Initial mk_all generation exit1 denoted one updated aggregate; subsequent check0. Initial lake lint argument parsing fixed by direct existing Batteries script; no source workaround. Preserved raw logs/summary/validation and reproducible audit helpers under tmp/callable-fixed-prime-3dda8289/final.

Code/model: fixed640 standard caller protects low160 and args600..607, returns raw632 flag/633..635 original witness/636 global scans; actual signed copying+sum/native modulus/dirty normalization/one producer/all-record execution, initialized same-y prefix+halt, exact positive AND negative ET iff, global S<=F(p)+actualFlag and caller frame. Original D4^m>=16, n>=D^18,g>=1,p-window and raw old-word/address bounds explicit. Complete charged preparation/product/query/control/scan/compiler/copy/setup/return/halt bounds, positive source-regime log admission and independent-W polynomial prefix/support proved. Full parameter/prime/outer host/asymptotic1394/1.9992 remains OPEN; no selected-prime/uniform fast endpoint claimed.

Fresh whole-layer nonauthoring review remains REQUIRED before publication, covering CopySum, normalization, producer exec_at/input_fits/locality, dirty source derivation, actual640 caller/init, every-wide prefix and costs. Unchanged supplier reviews are not approval of new reasoning. No PR/watch/merge by child. Abstract/catalogue/rendering no impact. AI assistance: OpenAI Codex; existing source credit retained. Canonical imports are the only source delta from the source-ready checkpoint plus pinned-main compatibility.
edemaine added a commit that referenced this pull request Nov 1, 2026
… time

Complete #1394 milestone: natural dyadicTime depends only on original n and F;
pointwise actual parameter/selector/callable ledger +42 is bounded for every
selected prime and arbitrary reference memory. Uniform C,N are chosen per
natural kappa>=1 before F<=(n+2)^kappa, contents, selected p or width; the
natural function is O(n^(3-1/1296)). Actual initialized callable prefix and
charged halt preserve one final state with exact signed verdict, original
witness and input frame at the derived logarithmic width. Selected p is still
supplied to this subroutine; parameter/prime dispatch remains #2146. No clock,
layout, run or time law is an input oracle. Full #1394/1.9992 remains open.

All final source MCP diagnostics clean. Strict scoped compilation passes new
Cost/Execution/test, parent subcubic-budget test and old initialized callable
client. Canonical mk_all check, environment lint over 3 libraries+test, full
hygiene --check-simp, fresh scoped compiled doc/new-test checker APIs, strict
PR names and whole-base whitespace pass. Standard whole-library artifact
validation is unavailable locally (4491 unrelated ileans absent); hosted
exact-head all-six plus standard checker validation required. No local full
six claim. No machine program or curated abstract changed.

Independent nonauthoring /root/natural_runtime_review APPROVE whole layer;
/root/natural_runtime_api_delta_review APPROVE exact subsequent coefficient
monotonicity move, verifying inverse transforms recover whole reviewed source.
Review source hashes match final files. Agent review, not human approval.

Normal combined prerequisite 22f07e4 carries unchanged #2139 dc927 plus
#2148 97fbc0. Of 4903 inherited Lean/abstract paths, only the declared existing
DyadicCost.Asymptotics coefficient API extraction is changed. New own Cost,
Execution and test files plus 2 canonical imports complete this layer. Original
composition of existing proved costs, no new external quotation or endpoint
claim. AI-assisted by OpenAI Codex. Local reproducible packet:
tmp/callable-et-cost-20261101/{validation-summary,source-identity,changed-file-check}.json
and final-{strict-scoped,environment-lint,hygiene,pr-names}.log; public PR owns
final validation and review. Detailed source mappings in module/PR text.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-author coordinator codex-algorithms-review2139-20261101, outside the separate codex-three-sum-stack-20261028 / t3-3dda8289 source-authoring fleet: APPROVE at dc92727. No blocking findings. I reused the recorded whole-layer review and unchanged supplier coverage after confirming the 28 owned library/test blobs and modes match source checkpoint 61fec434. The new layer's import closure contains none of the native counter/selector/dyadic-parameter programs from #2109/#2124/#2133; those approvals are not being used as blanket coverage here. The three modified inherited files add the producer/locality/no-width-read seams; the actual old code definitions and public initialized preparation signature are preserved.

Direct inspection covered the actual 640-register program, three original-array copies with accumulated raw-word sum, computed logarithm/power modulus, fixed-bank normalization, memory-window compilation, dirty-source execution and derived reference state, caller/initialized prefix and halt, witness/readback, frames, admission/prefix envelopes, costs and all three test suites. The reference prepared state is constructed from actual preparation and used only in the proof; it is not a runtime catalogue, solver, run or time oracle. The program never clears or snapshots the polynomial reservation. Low registers 0–159 and runtime arguments survive; original spans may alias below the workspace, and outside memory is preserved. The caller and initialized code bounds are respectively 400000 and 400014 slots including halt, with no physical-width reads.

The correctness scope is exactly fixed-prime ET: original signed arrays of length 3n², D=4^m≥16, g≥1, p∈sqrtPrimeWindow D, and D^18≤n, with the stated original-word/address admission. The actual result is Boolean, is one iff the original integer triangle predicate holds, and supplies original-coordinate witnesses. The scan bound is the single global S≤F(p)+returnedFlag, including the negative all-one/modulo-three case with modular candidates but no integer zero. I checked the dirty-source proof's explicit external frame and the distinction from the pinned conditional Light host.

The charge includes 24n² adaptation, actual logarithm/power/normalization, at most three times the real source charge, five return copies, initialized header and halt. Its single global false-positive reserve remains explicit; an arbitrary bad fixed prime can make F large. This is a unit-instruction word-RAM bound, not an ordinary bit-cost or uniform subcubic ThreeSum claim. For wider-caller prefixes, the original raw dirty-word bound P is explicit before normalization; caller outside support is retained, while initialized support is finite. Logarithmic/polynomial source simplifications additionally assume the stated scalar, weight, placement and raw-context bounds. Fully admitted positive/negative thin-geometry clients and the dirty aliased caller complement the small copy/header/return VM fixtures; the latter are not advertised as complete small-geometry solver runs.

Hosted CI passed all six gates, including whole-library tests/changed-file checks. Actual checkout 18116aaa has parents base b4678e20 and this head and exactly the reviewed tree ff0dd30b. I ran no Lean, local build or interpreter checks. Current-main integration still needs its normal ownership/source/merge validation. No curated abstract/catalogue/rendering impact. Parameter/prime selection composition, small-case/outer-host handling, aggregate asymptotics, full ThreeSum and broader Schönhage claims remain outside this approval. Agent review, not human approval.

SamuelSchlesinger commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Coordinator logsQ-queue-20261101: #2139 actually landed as exact 6daf0b94bed06938802ae93bcecc14c5c8e848f0 at 20:30:23 UTC. The 28 reviewed payloads, inherited interfaces, source credit, pins and complete accepted prefix are preserved. Current outside-source-fleet approval and all-six source CI carry forward.

The one shared cumulative MQ receipt verifies all six required gates at exact landed descendant 37e23f9c, without relabelling or cancelling unfinished individual runs. Usable-publication closeout is complete through the same shared fixed-main receipt: exact 37e23f9c, all six passed, public map and all 113 new references verified. Its unavailable-handoff/rebuild limits are recorded there; no parallel main log/map or artifact-body retrieval.

The callable fixed-prime solver retains its geometry, original raw-context admission, dirty-memory/register frames and explicit global false-positive reserve. Parameter/prime-selection composition, ordinary host/bit costs and the full ThreeSum endpoint remain separate; no abstract impact. Source #2154 and later callers remain dependency-gated. No source edits, new approval count or local build. Agent coordination, not human approval.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 6daf0b9 Nov 1, 2026
3 checks passed
SamuelSchlesinger added a commit that referenced this pull request Nov 2, 2026
Merge fixed actual main851fa3f5, containing actual #2139/6daf and
#2148/851, into approved sourcec7b9fcf. The true own layer starts
after joint parent22f07e41=[2148/97fbc0f,2139/dc92727d], not at the
PR display base; inherited sibling code is not new feature work.

Preserve all four reviewed code/test payloads and their documentation.
Replay the complete original five-path feature, including imports,
forward and backward exactly. Resolve only generated imports, exact
reviewed Asymptotics bytes under main==joint-parent guard, and the
unchanged-child ROADMAP conflict by retaining exact actual main.
All5328 unrelated main entries/pins remain exact; imports are
canonical3899. All28 callable payloads and107 parameter-branch code
entries have explicit parent guards; the sole shared Asymptotics
change is the already reviewed own-layer API/proof move.

Validation is source-only preservation and own-delta whitespace.
No Lean/build/CI-log download or full-six claim. The old-source-relative
whitespace note is inherited exact-main scripts/test_guide_selection.py:149;
no unrelated cleanup is introduced. Root independently audits this
unpublished checkpoint before publication; fresh canonical CI follows.

Original Edemaine/t3 implementation credit and outside review5729897050
are preserved. Supplied-selected-prime/component/asymptotic scope and
full #1394 gap are unchanged; selected abstracts have no impact.
AI-assisted integration preparation: OpenAI Codex
(codex-prep2154-1730-20261102), delegated by LogsQ. No new mathematics,
approval, source-branch push, retarget or queue/cache action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ExactTriangle): make the complete fixed-prime solver callable on native arrays

2 participants