Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 22 — 3SUM in O(n1.9992)O(n^{1.9992})O(n1.9992) steps

Proved
TrulySubquadratic3SUM.threeSum

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 function 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). Given nnn integers x0,…,xn−1x_0,\ldots,x_{n-1}x0​,…,xn−1​ with ∣xi∣≤nκ|x_i|\le n^\kappa∣xi​∣≤nκ, the program halts within T(n)T(n)T(n) steps and accepts if and only if there are pairwise distinct indices i,j,ki,j,ki,j,k such that xi+xj+xk=0x_i+x_j+x_k=0xi​+xj​+xk​=0.

The time bound is T(n)=O(n1.9992)T(n)=O(n^{1.9992})T(n)=O(n1.9992): precisely, there is a natural constant KKK such that T(n)1250≤Kn2499T(n)^{1250}\le K n^{2499}T(n)1250≤Kn2499 for every n≥2n\ge2n≥2. The program must also halt and reject when n<3n<3n<3. 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.

Preamble
import Definitions.Def_TrulySubcubicAPSP_SourceSpecification

set_option autoImplicit false
set_option relaxedAutoImplicit false
Formal statement
theorem TrulySubquadratic3SUM.threeSum :
    EndStatement.ThreeSum.SolvedInTime 1.9992 := by sorry
Source
https://arxiv.org/abs/2610.06783v1; Theorem 22, second bound using Corollary 26; https://github.com/anthropics/formal-math/blob/e1a4e6508154ea59f030480661590a9fe3018011/3sum-apsp/EndStatement.lean#L88-L97; EndStatement.Theorem_22_3SUM.
Read-back

What the Lean code literally says, in plain math · Codex (exact model identifier not exposed)

For every natural number κ\kappaκ, there exist a finite program PPP, a natural number bbb, a function T ⁣:N→NT\colon\mathbb N\to\mathbb NT:N→N, and a natural number KKK such that T(n)1250≤Kn2499T(n)^{1250}\le K n^{2499}T(n)1250≤Kn2499 for every natural number n≥2n\ge2n≥2, and such that the following holds for every natural number nnn, every indexed list of integers x0,…,xn−1x_0,\ldots,x_{n-1}x0​,…,xn−1​ satisfying ∣xi∣≤nκ|x_i|\le n^\kappa∣xi​∣≤nκ for every index 0≤i<n0\le i<n0≤i<n, and every natural word width W≥b(log⁡2n+1)W\ge b(\operatorname{log}_2 n+1)W≥b(log2​n+1): starting at instruction number zero, PPP halts within T(n)T(n)T(n) instruction steps with a Boolean verdict vvv and a final memory mmm, and vvv is true if and only if there exist indices i,j,k∈{0,…,n−1}i,j,k\in\{0,\ldots,n-1\}i,j,k∈{0,…,n−1} with i≠ji\ne ji=j, j≠kj\ne kj=k, i≠ki\ne ki=k, and xi+xj+xk=0x_i+x_j+x_k=0xi​+xj​+xk​=0 as an equality of integers. Here log⁡2n\operatorname{log}_2 nlog2​n is the natural-number base-two logarithm, equal to ⌊log⁡2n⌋\lfloor\log_2 n\rfloor⌊log2​n⌋ for n≥1n\ge1n≥1 and to zero for n=0n=0n=0; the rational exponent in the declaration is exactly 1.9992=2499/12501.9992=2499/12501.9992=2499/1250, and its time-bound definition is exactly the displayed inequality with integer powers, only for n≥2n\ge2n≥2. The choices of P,b,T,KP,b,T,KP,b,T,K may depend on κ\kappaκ but must work simultaneously for all such n,x,Wn,x,Wn,x,W. Memory consists of one WWW-bit word at every integer address. Initially address zero contains nnn, addresses 1,…,n1,\ldots,n1,…,n contain x0,…,xn−1x_0,\ldots,x_{n-1}x0​,…,xn−1​, and every other address, including every negative address, contains zero; each stored integer is reduced modulo 2W2^W2W. 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 2W2^W2W; 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 W>0W>0W>0, signed interpretation uses the range [−2W−1,2W−1−1][-2^{W-1},2^{W-1}-1][−2W−1,2W−1−1]; for W=0W=0W=0, 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 xix_ixi​, even when initialization reduces their representations modulo 2W2^W2W. 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 n=0,1,2n=0,1,2n=0,1,2, for which there are no three distinct indices and hence a successful execution must reject; at n=0n=0n=0 the input magnitude condition is vacuous, and at n=1n=1n=1 it requires ∣x0∣≤1|x_0|\le1∣x0​∣≤1. No asymptotic inequality is imposed at n=0n=0n=0 or n=1n=1n=1, although the halting and decision requirements still apply there. Natural-number exponentiation is used, including the convention 00=10^0=100=1. The constants b,Kb,Kb,K and values of TTT have no separately stated positivity assumptions, and the width quantifier includes W=0W=0W=0 whenever its stated lower bound permits it.

Human review
  • Endorsed by wurtle · Oct 6, 2026

  • Endorsed by marwahaha · Oct 6, 2026

    Confirmed by the mission captain (proposal self-audit).

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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me