Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

A query of the Theorem 30 data structure with pruned encodings meets its specification for all limits

Proved
Light.Sec4.queryAtSpec_all

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 that holds the fourteen routines of Section 4 at the numbers 40,…,5340,\dots,5340,…,53 and the body of queryAt at number 555555. Then for every limits lim\mathrm{lim}lim, queryAt meets its specification:

for all parameters p=(L,m,N)p=(L,m,N)p=(L,m,N) with m≤Lm\le Lm≤L, t≤mt\le mt≤m, block address b0b_0b0​, matrices X∈ZN×4mX\in\mathbb Z^{N\times4^m}X∈ZN×4m, Y∈Z4m×NY\in\mathbb Z^{4^m\times N}Y∈Z4m×N with entries of absolute value at most UUU, limits satisfying Lim30(p,t,b0,U)\mathrm{Lim30}(p,t,b_0,U)Lim30(p,t,b0​,U), every memory μ\muμ holding the data structure for X,YX,YX,Y at b0b_0b0​, all I,J<NI,J<NI,J<N and every depth ddd with d+2≤depthd+2\le\mathrm{depth}d+2≤depth, the call queryAt(I,J,b0)\mathrm{queryAt}(I,J,b_0)queryAt(I,J,b0​) ends within toutDigits(L)+tqueryCore(L,m,t)+400t_{\mathrm{outDigits}}(L)+t_{\mathrm{queryCore}}(L,m,t)+400toutDigits​(L)+tqueryCore​(L,m,t)+400 steps, returns (XY)IJ(XY)_{IJ}(XY)IJ​, keeps the data structure, and changes only the 3L+m3L+m3L+m scratch cells from WD(b0)\mathrm{WD}(b_0)WD(b0​).

Setting. The data structure of Theorem 30 is built for parameters p=(L,m,N)p=(L,m,N)p=(L,m,N) with m≤Lm\le Lm≤L (LLL levels, mmm inner levels), integer matrices X∈ZN×4mX\in\mathbb Z^{N\times 4^m}X∈ZN×4m and Y∈Z4m×NY\in\mathbb Z^{4^m\times N}Y∈Z4m×N with entries of absolute value at most UUU, and a threshold t≤mt\le mt≤m. It lives in a block of memory starting at an address b0b_0b0​: the shared tables of Section 2 with the pruned encodings of the nBn_BnB​ row bands of XXX and column bands of YYY (only the leaves whose LLL decimal digits contain at most mmm nines are stored), the directory, the table of trie roots (one per tile) and the trie array (one trie per tile, holding the values of its boxes). The limits must satisfy the bounds Lim30\mathrm{Lim30}Lim30: the standing assumptions (an address fits in a word and 100≤word100\le\mathrm{word}100≤word), the block fits in memory, and 10m(7LU)210^m(7^LU)^210m(7LU)2, 7L+1U7^{L+1}U7L+1U and 10L+110^{L+1}10L+1 fit in a word.

Compared with the statement for a single program and limits, the hypotheses on the routines called by the query are discharged: every program holding the routines of Section 4 at their numbers meets all their specifications.

“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 Has40 P → P[Proc.queryAt]? = some queryAtBody → ∀ lim, QueryAtSpecP 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 Light
open Light.Sec4
Formal statement
theorem Light.Sec4.queryAtSpec_all {P : Program} (h : Has40 P)
    (h55 : P[Proc.queryAt]? = some queryAtBody) : ∀ lim, QueryAtSpecP 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/Routines.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), Theorem 30 (pp. 46-47), "Query". 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