Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Deterministic integer 3SUM in O(n^1.999017) word-RAM steps

Proved
ThreeSumSharpTail.threeSum_1999017

by Yuxuan Xu · Oct 13, 2026 · Mathlib 0df444a (Lean v4.33.1)

3sumalgorithmsfine-grained-complexityword-ram

For each fixed κ∈N\kappa\in\mathbb Nκ∈N, there exist a finite deterministic word-RAM program PPP, a natural number bbb, and a step bound T:N→NT:\mathbb N\to\mathbb NT:N→N. For every nnn, input x:{0,…,n−1}→Zx:\{0,\ldots,n-1\}\to\mathbb Zx:{0,…,n−1}→Z with ∣xi∣≤nκ|x_i|\le n^\kappa∣xi​∣≤nκ, and every W≥b(Nat.log2⁡(n)+1)W\ge b(\operatorname{Nat.log2}(n)+1)W≥b(Nat.log2(n)+1), the program halts within T(n)T(n)T(n) steps and accepts exactly when three pairwise distinct indices have sum zero. Equal values at distinct indices are allowed; no witness is required; inputs of size less than three are rejected.

The exact time requirement is ∃K∈N  ∀n≥2, T(n)1000000≤Kn1999017\exists K\in\mathbb N\;\forall n\ge2,\ T(n)^{1000000}\le K n^{1999017}∃K∈N∀n≥2, T(n)1000000≤Kn1999017, equivalent to T(n)=O(n1.999017)T(n)=O(n^{1.999017})T(n)=O(n1.999017). The target instantiates the campaign template without changing its definitions.

Source: Theorem 1.1 of Xu's sharp-tail manuscript. The manuscript states κ≥1\kappa\ge1κ≥1 and a sufficiently large logarithmic word width; the campaign additionally makes uniformity over all larger widths explicit. The case κ=0\kappa=0κ=0 follows from the κ=1\kappa=1κ=1 bound for n≥1n\ge1n≥1, with n=0n=0n=0 handled separately. The formal development must justify this interface adaptation. The improved bound is a proposed formalization target, not an already Lean-certified result.

Preamble
import Definitions.Def_TrulySubcubicAPSP_SourceSpecification

set_option autoImplicit false
set_option relaxedAutoImplicit false
Formal statement
theorem ThreeSumSharpTail.threeSum_1999017 :
    EndStatement.ThreeSum.SolvedInTime 1.999017 := by sorry
Source
Yuxuan Xu, Deterministic Integer 3SUM in O(n^1.999017) Time via a Sharper Binomial-Tail Analysis (13 October 2026), Hexagon submission https://hexagonmath.org/submit/d57cba23-2d89-4bcb-8180-7c1bde7d14e3; Theorem 1.1; shared campaign interface adaptation
Read-back

What the Lean code literally says, in plain math · gpt-6

For every natural number κ\kappaκ, there exist a finite instruction list PPP, a natural number bbb, a function T:N→NT:\mathbb N\to\mathbb NT:N→N, and a natural number KKK such that for every natural n≥2n\ge2n≥2, T(n)1000000≤Kn1999017T(n)^{1000000}\le K n^{1999017}T(n)1000000≤Kn1999017, and such that the following correctness condition holds. For every natural nnn, every integer sequence (x0,…,xn−1)(x_0,\ldots,x_{n-1})(x0​,…,xn−1​) with ∣xi∣≤nκ|x_i|\le n^\kappa∣xi​∣≤nκ at every position, and every natural word width W≥b(⌊log⁡2n⌋+1)W\ge b(\lfloor\log_2 n\rfloor+1)W≥b(⌊log2​n⌋+1), taking the integer logarithm of 000 to be 000, the program PPP started at instruction position 000 halts within T(n)T(n)T(n) steps and accepts if and only if three pairwise distinct positions i,j,k∈{0,…,n−1}i,j,k\in\{0,\ldots,n-1\}i,j,k∈{0,…,n−1} satisfy xi+xj+xk=0x_i+x_j+x_k=0xi​+xj​+xk​=0 as integers. Memory consists of WWW-bit words at every integer address. It initially contains nnn modulo 2W2^W2W at address 000, the input values in order modulo 2W2^W2W at addresses 111 through nnn, and zero at every other address, including all negative addresses. The allowed instructions are: write constant 111 to a fixed integer-addressed cell; add, subtract, or multiply two fixed cells into a fixed cell modulo 2W2^W2W; load into a fixed cell from an address supplied by the signed interpretation of another fixed cell; store the value of a fixed cell at an address supplied by the signed interpretation of another fixed cell; jump to a fixed natural instruction position when a fixed cell has negative signed value; accept; and reject. Each instruction consumes one step. Writes and non-taken conditional jumps advance by one instruction, and a position beyond the list executes rejection. The halting instruction is counted, and zero available steps produce no verdict. The final memory has no output constraint. The same witnesses work for all eligible sizes, inputs, and word widths for the fixed κ\kappaκ; witnesses may vary with κ\kappaκ, and word width has no upper bound. Sizes n=0,1,2n=0,1,2n=0,1,2 are included in correctness and require rejection because three distinct positions do not exist, although the time inequality is imposed only for n≥2n\ge2n≥2. At n=0n=0n=0 the magnitude condition is vacuous, and natural exponentiation uses 00=10^0=100=1. Neither bbb nor KKK is required to be positive, so a chosen b=0b=0b=0 would require correctness even at W=0W=0W=0. The exponent is the exact rational 1.999017=1999017/10000001.999017=1999017/10000001.999017=1999017/1000000, which is why the time condition uses the displayed integer powers.

Human review
  • Endorsed by Shuze Chen · Oct 13, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Yuxuan Xu · Oct 13, 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