The four calls of one batch of the batched counting oracle write the counts of the batch
ProvedLight.Batch.oBatchTail_endsLet be an instance of the counting oracle (Light.Filter2.OracleInst: an Exact Triangle instance with vertices per part and weight bound , a block size , a modulus , a place cnt) with precondition at free pointer , the need oNeedAt n U s p allowed by the limits, and the tables of the oracle in memory (BTabs). For a batch with oKK s p products and oKK oProd n s, the statement oBatchTail (two calls of writeSrc for the digit-lifted sources, preCore, and the queries), run in oProg ++ R in the frame of the oracle's locals, ends within tOBTail n s p steps; afterwards the tables are kept, the counts of the batch stand at cnt + bt·oKK·n² — the entry equals cntOf n s p AB BC AC (bt·oKK·n² + e), the number of in the middle block with — and every other cell below is unchanged.
/- 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 3b45b374640a. import Definitions.Def_APSP2995561_Defs2 set_option autoImplicit false set_option relaxedAutoImplicit false open Light open Light.Batch open ThreeSumApsp ThreeSumApsp.Batch Light.Sec4 Light.Filter2 OS set_option maxHeartbeats 1000000
theorem Light.Batch.oBatchTail_ends (R : Program) {lim : Limits} {d : ℕ} {x : Light.Filter2.OracleInst} {μ₀ μ : ℕ → ℤ}
{fr : ℕ} (hpre : x.Pre μ₀ fr) (hok : (Light.Batch.oNeedAt x.n x.U x.s x.p).Ok lim fr d) {bt kb : ℕ}
(hkb1 : 1 ≤ kb) (hkbK : kb ≤ oKK x.s x.p) (hkbT : bt * oKK x.s x.p + kb ≤ oProd x.n x.s)
(tmp : ℤ) (hT : BTabs x fr μ) :
Ends lim (oProg ++ R) d oBatchTail
⟨frame (oLocA x fr tmp bt (bt * oKK x.s x.p : ℕ) kb), μ⟩ (tOBTail x.n x.s x.p)
fun σ' => ∃ tmp' : ℤ, σ'.loc = frame (oLocA x fr tmp' bt (bt * oKK x.s x.p : ℕ) kb) ∧
BTabs x fr σ'.mem ∧
(∀ e < kb * (x.n * x.n), σ'.mem (x.cnt + bt * oKK x.s x.p * (x.n * x.n) + e)
= (Light.Filter2.cntOf x.n x.s x.p x.AB x.BC x.AC (bt * oKK x.s x.p * (x.n * x.n) + e) : ℤ)) ∧
(∀ b < fr, (b < x.cnt + bt * oKK x.s x.p * (x.n * x.n) ∨
x.cnt + bt * oKK x.s x.p * (x.n * x.n) + kb * (x.n * x.n) ≤ b) → σ'.mem b = μ b) := by sorry