Documentation

Complexity.Algorithms.WordRAM.ThreeSum.Frontend

Complete native distinct-position 3SUM frontend #

One finite 128-register program per fixed exponent starts from ordinary native initialized signed input. It computes (n+2)^κ, sorts with an explicit magnitude-derived bit count, retains full multiplicities, and writes six-word descriptors of compact injective arrays. Reading the descriptors gives exactly the existing ThreeSum.inputs, in its existing order, including empty arrays and the two multiplicity triples at lengths zero, one and two.

The mathematical definitions are reused from the frontend adaptation of anthropics/formal-math@16a5ce41304fcdaea4e0be7c132e1c361dc26da5, PaperStatements.lean lines 1358–1376. In particular twiceSet contains positive 2*a. Native programs, layout and charged proofs here are original; no source machine is imported. This is the frontend component, not complete Chan–He preprocessing or a subquadratic solver.

Main definitions #

Main results #

Physical word width is never read, so it never determines the radix iteration count.

Code size depends only on the fixed exponent; the assembled final halt adds one.

theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.runs_input {κ w : ℕ} (input : List ℤ) (hw : width κ input.length ≤ w) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) :

The complete finite program halts with its descriptor count, and following its descriptors gives exactly the existing frontend list. The memory witness is the actual native state just before the final halt. No slot, bit budget, sorting result or fit is advice.

theorem Cslib.Algorithms.WordRAM.ThreeSum.Frontend.intermediates_polynomial {κ w : ℕ} (input : List ℤ) (hw : width κ input.length ≤ w) (hvalues : ∀ z ∈ input, |z| ≤ ↑((input.length + 2) ^ κ)) {s : WordRAM.State 128} {steps : ℕ} (hr : WordRAM.Runs w ((program κ).program descriptorCount) (WordRAM.State.init (List.map WordRAM.Signed.encode input)) s steps) :
(∀ (i : Fin 128), s.data.regs i < (input.length + 2) ^ (160 * κ + 968)) ∧ ∀ (a : ℕ), s.data.mem a < (input.length + 2) ^ (160 * κ + 968)

Every run prefix at every admitted width uses polynomially bounded words. This includes all memory words and registers, rather than merely the final output or a pair-count metric.