Theorem 22 — 3SUM in steps
ProvedTrulySubquadratic3SUM.threeSumFor every fixed , there exist a finite deterministic word-RAM program , a natural constant , and a step-bound function that work for every input size and every word width . Given integers with , the program halts within steps and accepts if and only if there are pairwise distinct indices such that .
The time bound is : precisely, there is a natural constant such that for every . The program must also halt and reject when . Repeated integer values at different positions are allowed; no witness triple needs to be output.
This is exactly EndStatement.Theorem_22_3SUM from the accompanying formalization. It is the integer 3SUM part of Theorem 22, using Corollary 26, presented here as an open proof obligation.
import Definitions.Def_TrulySubcubicAPSP_SourceSpecification set_option autoImplicit false set_option relaxedAutoImplicit false
theorem TrulySubquadratic3SUM.threeSum :
EndStatement.ThreeSum.SolvedInTime 1.9992 := by sorryRead-back
What the Lean code literally says, in plain math · Codex (exact model identifier not exposed)
For every natural number , there exist a finite program , a natural number , a function , and a natural number such that for every natural number , and such that the following holds for every natural number , every indexed list of integers satisfying for every index , and every natural word width : starting at instruction number zero, halts within instruction steps with a Boolean verdict and a final memory , and is true if and only if there exist indices with , , , and as an equality of integers. Here is the natural-number base-two logarithm, equal to for and to zero for ; the rational exponent in the declaration is exactly , and its time-bound definition is exactly the displayed inequality with integer powers, only for . The choices of may depend on but must work simultaneously for all such . Memory consists of one -bit word at every integer address. Initially address zero contains , addresses contain , and every other address, including every negative address, contains zero; each stored integer is reduced modulo . The permitted program instructions are: write the word representing one to a fixed integer address; add, subtract, or multiply the words at two fixed integer addresses and write the result to a fixed integer address, with arithmetic modulo ; read the word at the address given by the signed integer interpretation of a word at a fixed address and write it to a fixed address; write a word from a fixed address to the address given by the signed interpretation of a word at another fixed address; jump to a fixed natural-number instruction index if the signed interpretation of a word at a fixed address is negative, otherwise advance to the next instruction; accept; or reject. All instructions other than this conditional jump and the two halting instructions advance to the next instruction, and an instruction index outside the finite program executes rejection. For , signed interpretation uses the range ; for , the sole word has signed value zero. Each executed instruction, including acceptance or rejection, consumes one unit of the available step count, independently of word width; exhausting the count without executing a halting instruction produces no result, so a zero step count cannot solve an instance. The final memory is existentially quantified and is subject to no output requirement beyond being the memory reached by that execution. The decision condition refers to the original integers , even when initialization reduces their representations modulo . There are no additional assumptions on the integers or on the existence of a zero-sum triple; repeated values at different indices are allowed, while the three indices must be pairwise distinct. The quantification includes , for which there are no three distinct indices and hence a successful execution must reject; at the input magnitude condition is vacuous, and at it requires . No asymptotic inequality is imposed at or , although the halting and decision requirements still apply there. Natural-number exponentiation is used, including the convention . The constants and values of have no separately stated positivity assumptions, and the width quantifier includes whenever its stated lower bound permits it.
Confirmed by the mission captain (proposal self-audit).