Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

3SUM in O(n1.999112)O(n^{1.999112})O(n1.999112) word-RAM steps

Proved
TrulySubquadratic3SUM.threeSum_1999112

by marwahaha · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

3sumalgorithmsfine-grained-complexityword-ram

For every fixed κ∈N\kappa\in\mathbb Nκ∈N, there exist a finite deterministic word-RAM program PPP, a natural constant bbb, and a step bound TTT that work for every input size nnn and every word width W≥b(Nat.log2⁡(n)+1)W\ge b(\operatorname{Nat.log2}(n)+1)W≥b(Nat.log2(n)+1). On nnn integers of absolute value at most nκn^\kappanκ, the program halts within T(n)T(n)T(n) 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 T(n)=O(n1.999112)T(n)=O(n^{1.999112})T(n)=O(n1.999112): precisely, there is K∈NK\in\mathbb NK∈N such that T(n)125000≤Kn249889T(n)^{125000}\le K n^{249889}T(n)125000≤Kn249889 for every n≥2n\ge2n≥2.

Preamble
import Definitions.Def_TrulySubcubicAPSP_SourceSpecification

set_option autoImplicit false
set_option relaxedAutoImplicit false
Formal statement
theorem TrulySubquadratic3SUM.threeSum_1999112 :
    EndStatement.ThreeSum.SolvedInTime 1.999112 := by sorry
Source
Parameter refinement of Alman and Vassilevska Williams (2026), derived from Anthropic formal-math commit e1a4e6508154ea59f030480661590a9fe3018011. Corollary 26 proves gamma > 0.0640 and q < 0.4278: https://github.com/anthropics/formal-math/blob/e1a4e6508154ea59f030480661590a9fe3018011/3sum-apsp/ThreeSumApsp/Sec4/Corollary26.lean. Apply the balance in Remark 20 with grouping exponent 0.032: https://github.com/anthropics/formal-math/blob/e1a4e6508154ea59f030480661590a9fe3018011/3sum-apsp/ThreeSumApsp/Sec3/Theorem19.lean. The new numerical bound is a parameter refinement, not the paper’s stated rounded bound.
Read-back

What the Lean code literally says, in plain math · Codex

For every κ∈N\kappa\in\mathbb{N}κ∈N, there exist a finite program PPP, a natural number bbb, a function T:N→NT:\mathbb{N}\to\mathbb{N}T:N→N, and a natural number KKK such that T(n)125000≤Kn249889T(n)^{125000}\le K n^{249889}T(n)125000≤Kn249889 for every natural number n≥2n\ge2n≥2, using the exact rational exponent 1.999112=249889/1250001.999112=249889/1250001.999112=249889/125000, and the following holds for every natural number nnn, every indexed family of integers (x0,…,xn−1)(x_0,\ldots,x_{n-1})(x0​,…,xn−1​) satisfying ∣xi∣≤nκ|x_i|\le n^\kappa∣xi​∣≤nκ at every index, and every natural word width W≥b(log⁡2(n)+1)W\ge b(\operatorname{log}_2(n)+1)W≥b(log2​(n)+1), where log⁡2(n)=⌊log⁡2n⌋\operatorname{log}_2(n)=\lfloor\log_2 n\rfloorlog2​(n)=⌊log2​n⌋ for positive nnn and log⁡2(0)=0\operatorname{log}_2(0)=0log2​(0)=0: starting at program position 000, PPP halts within T(n)T(n)T(n) instructions, with the halting instruction counted, and accepts if and only if there exist three pairwise distinct indices i,j,k∈{0,…,n−1}i,j,k\in\{0,\ldots,n-1\}i,j,k∈{0,…,n−1} with xi+xj+xk=0x_i+x_j+x_k=0xi​+xj​+xk​=0. The program, bbb, TTT, and KKK may depend on κ\kappaκ but are shared by all these nnn, inputs, and widths. Memory is an integer-addressed collection of WWW-bit words, initially containing the residue of nnn modulo 2W2^W2W in cell 000, the residues of x0,…,xn−1x_0,\ldots,x_{n-1}x0​,…,xn−1​ in cells 1,…,n1,\ldots,n1,…,n, 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 111 to a named cell; add, subtract, or multiply the words in two named cells and write the result modulo 2W2^W2W 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 W=0W=0W=0 the sole word has signed value 000. 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 n=0n=0n=0 and n=1n=1n=1, for which no asymptotic bound on T(n)T(n)T(n) is imposed, and also n=2n=2n=2; all instances with fewer than three positions must reject. The integer κ\kappaκ may be 000, with n0=1n^0=1n0=1 also at n=0n=0n=0 and the empty input's size bound vacuous; no positivity is required of bbb or KKK, and width 000 is included whenever it satisfies the stated width inequality.

Human review
  • Endorsed by marwahaha · Oct 6, 2026

    Confirmed by the moderator at approval.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me