carW_spec (KFT §3: linear cost bounds, the `bin_{2n}` write, and carries-then-write)
ProvedNLogN.KFT.carW_specThe following holds (Lean statement, in the scope of module Solutions.KFTOut):
theorem NLogN.KFT.carW_spec (b B : ℕ) (hb : 1 ≤ b) (zs : List GI) (hre : ∀ z ∈ zs, 0 ≤ z.1)
(hB : NLogN.KFB.GB B zs) {W : Fin HS} (hW0 : W ≠ 0) (s : IState HS) (R0 LW : List Item) (m : ℕ)
(hv : carOut b zs < 2 ^ m) (h0 : s.G 0 = ints (gflat zs) ++ R0)
(hW : s.G W = .int (2 ^ m) :: LW) :
IRuns I iprog (carW b zs.length W) s
{ (s.upd 0 R0).upd W LW with out := s.out ++ bin m (carOut b zs) }
(cCar b B zs.length + outRCost m)
Context. The lemma belongs to the part KFT §3: linear cost bounds, the bin_{2n} write, and carries-then-write.
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
set_option maxRecDepth 20000
open NLogN
open NLogN.KFT
open IntMul KFC KFB
variable {Pp : ℕ} {I : List Sym} {iprog : Fin Pp → IStmt HS Pp}
theorem NLogN.KFT.carW_spec (b B : ℕ) (hb : 1 ≤ b) (zs : List GI) (hre : ∀ z ∈ zs, 0 ≤ z.1)
(hB : NLogN.KFB.GB B zs) {W : Fin HS} (hW0 : W ≠ 0) (s : IState HS) (R0 LW : List Item) (m : ℕ)
(hv : carOut b zs < 2 ^ m) (h0 : s.G 0 = ints (gflat zs) ++ R0)
(hW : s.G W = .int (2 ^ m) :: LW) :
IRuns I iprog (carW b zs.length W) s
{ (s.upd 0 R0).upd W LW with out := s.out ++ bin m (carOut b zs) }
(cCar b B zs.length + outRCost m) := by sorry