Correctness and time of a query of the Theorem 30 data structure with pruned encodings (queryAt)
ProvedLight.Sec4.queryAtP_specLet be a program of the light language whose procedure number is the body of queryAt, and in which the routines outDigits (number ) and queryCore (number ) meet their specifications for the limits . Then queryAt meets its specification for :
for all parameters with , , block address , matrices with , limits satisfying , every memory that holds the data structure for at , every pair and every depth with , the call ends within
steps, returns , the final memory still holds the data structure, and it differs from only in the scratch cells from the address .
Setting. The data structure of Theorem 30 is built for parameters with ( levels, inner levels), integer matrices and with entries of absolute value at most , and a threshold . It lives in a block of memory starting at an address : the shared tables of Section 2 with the pruned encodings of the row bands of and column bands of (only the leaves whose decimal digits contain at most 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 : the standing assumptions (an address fits in a word and ), the block fits in memory, and , and fit in a word.
The query finds the tile of from the bands of row and column , writes the digits of its output string , reads the root of the trie of the tile, and evaluates the sum of Lemma 28 from the two encodings and the trie. With pruned encodings the encodings are correct only at the leaves with at most nines, which are exactly the leaves the query reads.
“Procedure meets its specification within steps” means: called at any depth allowed by the hypothesis, with the given argument values and a memory satisfying the precondition, the body of terminates within steps without violating the limits, and the returned value and final memory satisfy the postcondition. Programs are those of the library's light language (procedures numbered by their position in a list , local variables, a memory of integer cells , calls with a nesting depth), which the library compiles to the word RAM; runs are checked against limits on the absolute value of every word, the number of memory cells and the call depth.
Formalization Note The name carries a P because the platform already has Light.Sec4.queryAt_spec, the same lemma for the unpruned data structure of the foundation development. The statement is P[Proc.queryAt]? = some queryAtBody → OutDigitsSpec lim P → QueryCoreSpecP lim P → QueryAtSpecP lim P. The invariant "holds the data structure" is DSReadyP, built on Sec2.SharedReadyP (pruned encodings).
/-
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
variable {lim : Limits} {P : Program} {d : ℕ} {p : Sec2.Par} {t : ℕ} {hmL : p.m ≤ p.L}
{aX aY b0 : ℕ} {X : Matrix (Fin p.N) (Fin (D p.m)) ℤ} {Y : Matrix (Fin (D p.m)) (Fin p.N) ℤ}
{U : ℤ} {μ : ℕ → ℤ}
theorem Light.Sec4.queryAtP_spec (hP : P[Proc.queryAt]? = some queryAtBody) (hOut : OutDigitsSpec lim P)
(hCore : QueryCoreSpecP lim P) : QueryAtSpecP lim P := by sorry