The step runner computes runArr when every delegated interchange is correct
ProvedNLogN.KIL.runCode_runArrThe step runner computes runArr when every delegated interchange is correct.
The following holds (Lean statement, in the scope of module Solutions.KIL2Run):
theorem NLogN.KIL.runCode_runArr (scode : Step n Q → IStmt HS Pp) (jOf : Fin n → Fin n → Fin Pp)
(child : Fin n → Fin n → List ℤ → List ℤ) (t : IState HS) (R : List Item) (Bb cS : ℕ)
(cC : Fin n → Fin n → ℕ) (steps : List (Step n Q))
(hS : ∀ i u c, Step.shift i u c ∈ steps → ∀ ys, DOK sh Bb ys →
IRuns I iprog (scode (.shift i u c)) (t.upd 0 (ints ys ++ R))
(t.upd 0 (ints ((Step.shift i u c).arr Λ 0 ys) ++ R)) cS)
(hC : ∀ a b, Step.swap a b ∈ steps → ∀ ys, DOK sh Bb ys →
IRuns I iprog (iprog (jOf a b)) (t.upd 0 (ints ys ++ R))
(t.upd 0 (ints (child a b ys) ++ R)) (cC a b) ∧
child a b ys = (Step.swap a b).arr Λ 0 ys)
(xs : List ℤ) (hx : DOK sh Bb xs) :
IRuns I iprog (runCode scode jOf steps) (t.upd 0 (ints xs ++ R))
(t.upd 0 (ints (AModel.runArr Λ 0 steps xs) ++ R)) (runCostI cS cC steps)
Context. The lemma belongs to the part KIL2: running a list of steps, interchanges delegated to child procedures: runCode scode jOf steps is item-language code (IStmt, so it may call procedures):
a shift step runs the code scode s, an interchange swap a b is the call .call (jOf a b).
Formalization Note. This lemma belongs to the item-language (IL) layer of the integer-multiplication-kappa campaign: tape-level programs (register programs over 64 item stacks of the NLogN multitape framework, definition bundles IntMul_HvdH_M_Defs1–IntMul_HvdH_M_Defs8) that implement the data-movement primitives of the OpenAI preprint Integer multiplication below (field moves, row split/merge, shifts, the uniform Proposition 11 interchange, Lemma 12 with fine -per-element costs, Gaussian record primitives, Proposition 14 pieces) with exact list denotations from the array-model bundles IntMul_Kappa_K_Defs* and explicit cost bounds. All names refer to the definition bundles up to IntMul_Kappa_K_Defs18.
-- OpenAI-preprint / κ-improvement development (integer-multiplication-kappa), generated by skeleton subtraction.
import Definitions.Def_IntMul_Kappa_K_Defs18
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
set_option linter.unusedSimpArgs false
open NLogN
open NLogN.KIL
open IntMul AModel
variable {sh : Shape} {n Q : ℕ} (Λ : Layout sh n Q) {Pp : ℕ} {I : List Sym}
{iprog : Fin Pp → IStmt HS Pp}
theorem NLogN.KIL.runCode_runArr (scode : Step n Q → IStmt HS Pp) (jOf : Fin n → Fin n → Fin Pp)
(child : Fin n → Fin n → List ℤ → List ℤ) (t : IState HS) (R : List Item) (Bb cS : ℕ)
(cC : Fin n → Fin n → ℕ) (steps : List (Step n Q))
(hS : ∀ i u c, Step.shift i u c ∈ steps → ∀ ys, DOK sh Bb ys →
IRuns I iprog (scode (.shift i u c)) (t.upd 0 (ints ys ++ R))
(t.upd 0 (ints ((Step.shift i u c).arr Λ 0 ys) ++ R)) cS)
(hC : ∀ a b, Step.swap a b ∈ steps → ∀ ys, DOK sh Bb ys →
IRuns I iprog (iprog (jOf a b)) (t.upd 0 (ints ys ++ R))
(t.upd 0 (ints (child a b ys) ++ R)) (cC a b) ∧
child a b ys = (Step.swap a b).arr Λ 0 ys)
(xs : List ℤ) (hx : DOK sh Bb xs) :
IRuns I iprog (runCode scode jOf steps) (t.upd 0 (ints xs ++ R))
(t.upd 0 (ints (AModel.runArr Λ 0 steps xs) ++ R)) (runCostI cS cC steps) := by sorry