3SUM in word-RAM steps
ProvedTrulySubquadratic3SUM.threeSum_1999112For every fixed , there exist a finite deterministic word-RAM program , a natural constant , and a step bound that work for every input size and every word width . On integers of absolute value at most , the program halts within steps and accepts exactly when three pairwise distinct indices have values summing to zero. Repeated values at distinct positions are allowed, and inputs with fewer than three positions are rejected.
The time bound is : precisely, there is such that for every .
import Definitions.Def_TrulySubcubicAPSP_SourceSpecification set_option autoImplicit false set_option relaxedAutoImplicit false
theorem TrulySubquadratic3SUM.threeSum_1999112 :
EndStatement.ThreeSum.SolvedInTime 1.999112 := by sorryRead-back
What the Lean code literally says, in plain math · Codex
For every , there exist a finite program , a natural number , a function , and a natural number such that for every natural number , using the exact rational exponent , and the following holds for every natural number , every indexed family of integers satisfying at every index, and every natural word width , where for positive and : starting at program position , halts within instructions, with the halting instruction counted, and accepts if and only if there exist three pairwise distinct indices with . The program, , , and may depend on but are shared by all these , inputs, and widths. Memory is an integer-addressed collection of -bit words, initially containing the residue of modulo in cell , the residues of in cells , and zero in every other cell, including all negative-address cells. Each program instruction is one of the following, with its directly named cell addresses arbitrary fixed integers and its jump target a fixed natural-number program position: write the word to a named cell; add, subtract, or multiply the words in two named cells and write the result modulo to a named cell; load into a named cell from the address given by the signed interpretation of a word in a named cell; store the word in a named cell at the address given by the signed interpretation of a word in a named cell; jump to a named program position if a named cell's signed value is negative; accept; or reject. Signed interpretation is two's complement; for the sole word has signed value . A write or a failed conditional jump advances the program position by one, and a successful conditional jump changes it to the specified position; accessing a program position past the list behaves as a reject instruction. Every instruction costs one step, and zero available steps never produces a halting verdict. Acceptance and rejection are the only required output: final memory is unrestricted. The correctness requirement includes and , for which no asymptotic bound on is imposed, and also ; all instances with fewer than three positions must reject. The integer may be , with also at and the empty input's size bound vacuous; no positivity is required of or , and width is included whenever it satisfies the stated width inequality.
Confirmed by the moderator at approval.