queryCore computes the sum of Lemma 28 from the encodings and the trie of a tile (pruned encodings)
ProvedLight.Sec4.queryCore_specLet be a program of the light language whose procedure number is the body of queryCore, and in which the routines nineFirst, nineNext, scatter, horner and lookup meet their specifications for the limits . Then queryCore meets its specification for :
consider the encodings of a tile at ( cells each), a trie array at with the root of the tile's trie, an output string of symbols with exactly inner levels whose digits are stored at , and scratch areas ( cells) and ( cells). Assume the standing assumptions on the limits, , that every box the query reads is found in the trie, that every partial sum of the query and every product at a leaf with at most nines fits in a word, , and that the scratch areas are disjoint from each other and from the data, all within memory. Then for every depth with , the call ends within
steps, where is the number of leaves of order below and the number of boxes that the query reads, and returns
the products at the leaves of of order below plus the values the trie holds for the boxes of ; only the two scratch areas change. When the trie holds the true box values this is the sum of Lemma 28, i.e. the entry of the product for the query.
All leaves read have at most nines, so the routine is correct on pruned encodings.
“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.
Formalization Note The statement is P[Proc.queryCore]? = some queryCoreBody → Light.Sec4.Query.Callees lim P → QueryCoreSpecP lim P, where Callees bundles the specifications of the five routines; the returned value is trieQuery m t (arrT encA) (arrT encB) T root (digitsO η).
/- 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 Query
theorem Light.Sec4.queryCore_spec {lim : Limits} {P : Program} (hP : P[Proc.queryCore]? = some queryCoreBody)
(K : Light.Sec4.Query.Callees lim P) : QueryCoreSpecP lim P := by sorry