Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

fillList inserts the boxes with eee stars, with their values, into the trie of a tile (pruned encodings)

Proved
Light.Sec4.fillList_spec

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

apsp-299791apsp-exponentdata-structuresprogram-verification

Let PPP be a program of the light language whose procedure number 494949 is the body of fillList, and in which the routines nineFirst, nineNext, starFirst, horner, insert and sumTen meet their specifications for the limits lim\mathrm{lim}lim. Then fillList meets its specification for lim\mathrm{lim}lim:

consider a tile with encodings encA,encB\mathrm{enc}_A,\mathrm{enc}_BencA​,encB​ (functions on the leaves, strings of LLL symbols) stored at aA,aBa_A,a_BaA​,aB​, a trie area of cap\mathit{cap}cap cells at tr\mathit{tr}tr holding the trie array TTT whose length is in the cell fp\mathit{fp}fp, two scratch strings cur,box\mathit{cur},\mathit{box}cur,box of LLL cells, and a number of stars e≤m−te\le m-te≤m−t. Assume the surroundings of the tile are valid (in particular t≤m≤Lt\le m\le Lt≤m≤L, the products of the two encodings at the leaves with at most mmm nines, multiplied by 10m10^m10m, and 10L10^L10L fit in a word, and the areas lie in order in memory), the root of the tile's trie is nonzero, the trie array represents the tries in which the boxes with fewer than eee stars of this tile are already stored, and there is room for 11L11L11L cells per new box. Then for every depth ddd with d+2≤depthd+2\le\mathrm{depth}d+2≤depth, fillList(e,root,aA,aB,tr,fp,cur,box,L,m−t)\mathrm{fillList}(e,\mathit{root},a_A,a_B,\mathit{tr},\mathit{fp},\mathit{cur},\mathit{box},L,m-t)fillList(e,root,aA​,aB​,tr,fp,cur,box,L,m−t) ends within

tnineFirst(L)+k⋅tfillStep(L)+60t_{\mathrm{nineFirst}}(L)+k\cdot t_{\mathrm{fillStep}}(L)+60tnineFirst​(L)+k⋅tfillStep​(L)+60

steps, where kkk is the number of boxes with eee stars; afterwards the trie area holds the array obtained by inserting each of these boxes with its value (for e=0e=0e=0 the product read from the two encodings; for e≥1e\ge1e≥1 the sum of the ten values of the boxes with one star fewer, by the recurrence of Lemma 29), and nothing changes outside the trie area, the cell fp\mathit{fp}fp and the two scratch strings.

The only reads of the encodings are at leaves with at most mmm nines, so the routine is correct for pruned encodings, which are wrong elsewhere.

“Procedure ppp meets its specification within TTT steps” means: called at any depth ddd allowed by the hypothesis, with the given argument values and a memory μ\muμ satisfying the precondition, the body of ppp terminates within TTT steps without violating the limits, and the returned value and final memory satisfy the postcondition.

Formalization Note The statement is P[Proc.fillList]? = some fillListBody → NineFirstSpec lim P → NineNextSpec lim P → StarFirstSpec lim P → HornerSpec lim P → InsertSpec lim P → SumTenSpec lim P → FillListSpecP lim P.

Preamble
/-
Copyright (c) 2026 Anthropic, PBC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
SPDX-License-Identifier: Apache-2.0
-/
-- Generated by skeleton subtraction from the ThreeSumApsp library at commit 27a2fa4bab32.

import Definitions.Def_APSP299791_Defs5

set_option autoImplicit false
set_option relaxedAutoImplicit false

open ThreeSumApsp
open Light
open Light.Sec4
open ThreeSumApsp.Spec
open FillList
Formal statement
theorem Light.Sec4.fillList_spec {lim : Limits} {P : Program} (hP : P[Proc.fillList]? = some fillListBody)
    (hFirst : NineFirstSpec lim P) (hNext : NineNextSpec lim P) (hStar : StarFirstSpec lim P)
    (hHorner : HornerSpec lim P) (hInsert : InsertSpec lim P) (hBox : SumTenSpec lim P) :
    FillListSpecP lim P := by sorry
Source
Developed for the prove2.me APSP exponent campaign (https://prove2.me/campaigns/apsp-exponent) on top of the Lean formalization anthropics/formal-math, folder 3sum-apsp, commit e1a4e65 (https://github.com/anthropics/formal-math/tree/e1a4e6508154ea59f030480661590a9fe3018011/3sum-apsp; Lean v4.33.1, Mathlib v4.33.1). The statement comes from the file 3sum-apsp/ThreeSumApsp/Programs/Sec4/Theorem30/FillList.lean of the campaign's modified copy of that library, which is not published; the new and modified definitions it uses are in the platform definition bundles APSP299791_Defs1 to APSP299791_Defs5. It builds on J. Alman and V. Vassilevska Williams, "Truly Subquadratic 3SUM and Truly Subcubic APSP via Triangles in Sparse Lopsided Graphs", arXiv:2610.06783v1 (https://arxiv.org/abs/2610.06783v1), Lemma 29 (p. 45) and Theorem 30 (pp. 46-47). This result belongs to an improvement of the paper's bounds developed for this campaign and is not stated in the paper.

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