Theorem 17 host: the residue classes and the chunks, followed by any statement (classes_then)
ProvedLight.Sec3.Et17.classes_thenA sequencing lemma for the host program of Theorem 17 (the reduction of Exact Triangle to Lop-AE-SparseTri), about the two calls that sort the pairs by residue class and cut the classes into chunks.
Let be a program of the light language whose procedures and are the bodies of classes and chunks. Let be an Exact Triangle instance with vertices per part and weight bound , and the data of the host's run (the prime , the capacity of a chunk, the residues of the weights), and assume the host is ready at depth in memory with free pointer : the three weight matrices are stored below with entries of absolute value at most , , and every address fit in a word, the arrays of the host fit in memory and . Let be a memory holding the residues of the first matrix modulo at their array.
Suppose a statement satisfies: for every result and every memory that holds the pairs sorted class by class and the table of chunks (their residues, starts and lengths) and agrees with outside the area between the class array and the first instance matrix, run from the host's local frame (with the number of chunks set) ends within steps with postcondition , where is the number of chunks. If moreover , then the sequence
run from the host's local frame in memory ends within steps with postcondition .
The lemma lets the proofs of the host compose the classes-and-chunks phase with whatever follows it, here the loop over the instances of the all-edges host at the middle dimension.
Formalization Note This is the lemma Light.Sec3.Et17.classes_then of the unmodified library; it is a platform node because the all-edges host at the middle dimension reuses it. The local variable names (ResAB, Size, ThePrime, Cls, …) are the slots of the host's frame Et17.locals.
/-
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.Spec
open Light
open Light.Sec3
open ThreeSumApsp
open Light.Sec3.Et17
variable {lim : Limits} {P : Program} {d : ℕ} {x : TriInst} {X : HostData} {μ : ℕ → ℤ} {fr : ℕ}
theorem Light.Sec3.Et17.classes_then {pClasses pChunks : ℕ} (hClasses : P[pClasses]? = some classesBody)
(hChunks : P[pChunks]? = some chunksBody) (hr : Ready lim d x X μ fr) (hcap : 1 ≤ X.cap)
{μ₁ : ℕ → ℤ} (hrab : SegN μ₁ (aRab X x.U fr) X.RAB) {g s res : ℤ} {t : Stmt} {T : ℕ}
{Q : State → Prop}
(h : ∀ res' μ', ClassMem x X fr μ₁ μ' → Ends lim P d t
⟨Light.frame (Light.Sec3.Et17.locals x X fr g s X.chunkCount res'), μ'⟩
(T - (tClasses X.n X.p + tChunks X.p X.chunkCount + 17)) Q)
(hT : tClasses X.n X.p + tChunks X.p X.chunkCount + 17 ≤ T) :
Ends lim P d
(.call pClasses [Light.v ResAB, Light.v Light.Sec3.Et17.Size, Light.v ThePrime, Light.v Cls, Light.v Light.Sec3.Et17.Cur, Light.v Light.Sec3.Et17.Rows, Light.v Light.Sec3.Et17.Cols] Light.Sec3.Et17.Small ;;
.call pChunks [Light.v Cls, Light.v ThePrime, Light.v Cap, Light.v TabR, Light.v TabL, Light.v TabW] NumChunks ;; t)
⟨Light.frame (Light.Sec3.Et17.locals x X fr g s 0 res), μ₁⟩ T Q := by sorry