Round-six lemma `sp_cnt`
ProvedJ6Seg.AxC.sp_cntAn auxiliary lemma of the round-six development, published as a separate node because its proof is long or shared.
The following holds (Lean statement, in the scope of module Solutions.J6SegAxCopy):
theorem J6Seg.AxC.sp_cnt {dA : Fin HS} (hA : DAok dA) (s : IState HS) (f : Fin HS → List ℤ)
(x1 x2 x3 x4 x5 : ℤ) (r : List ℤ) (hd : f dA = x1 :: x2 :: x3 :: x4 :: x5 :: r)
(hu : f cU = []) (h1 : f cA1 = []) (h2 : f cA2 = []) (h3 : f cA3 = []) (hn : f cN = [])
(B : ℕ) (b1 : zsz x1 ≤ B) (b2 : zsz x2 ≤ B) (b3 : zsz x3 ≤ B) (b4 : zsz x4 ≤ B)
(b5 : zsz x5 ≤ B) (bm1 : zsz (x5 * x3) ≤ B) (bm2 : zsz (x2 * (x5 * x3)) ≤ B)
(bm : zsz (2 * (x2 * (x5 * x3))) ≤ B) (hB2 : 2 ≤ B) :
Sp (cntRS dA) (encK s f) (encK s (update f cN [2 * (x2 * (x5 * x3))])) (cCnt B)
Context. The axis program: the copy 0 → rZ (after pass 2) and the swap 0 ↔ rZ (before pass 7)
Both read the count 2·pre·t·post (the number of integers of an axis array) off the axis
descriptor descAx6 = [k, pre, post, s, t, …] on dA (restored), on the scratch stacks 1 … 7.
cntRS dA: pushes2·(pre·(t·post))onCN = 5(sp_cnt);copyAx dA:gflat L ++ lon0andl₂onrZ↦gflat L ++ l₂onrZ, stack0unchanged (copyAx_runs);swapAx dA:gflat A ++ lon0,gflat B ++ l₂onrZ↦gflat B ++ lon0,gflat A ++ l₂onrZ(swapAx_runs).
Convention (FineBody6): every stack other than 0, dA, rZ empty; dA ∉ {0, …, 7, 53},
dA < 56.
Formalization Note. Part of the Lean formalization of the round-six κ-improvement (integer-multiplication-kappa campaign, target IntMul.Kappa.jain_round6_framework). The statement is copied verbatim from the Lean development; the platform node carries the same declaration name. Definitions it mentions live in the IntMul_Kappa_R6_Defs* bundles (on top of the published κ bundles IntMul_Kappa_K_Defs*).
-- Round-six κ development (integer-multiplication-kappa), generated by skeleton subtraction. import Definitions.Def_IntMul_Kappa_R6_Defs67 set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 open J6Seg J6Seg.AxC open IntMul NLogN NLogN.KIL NLogN.KFB IntMul.Kappa.R6 Function open J6Seg.Slab (rZ)
theorem J6Seg.AxC.sp_cnt {dA : Fin HS} (hA : DAok dA) (s : IState HS) (f : Fin HS → List ℤ)
(x1 x2 x3 x4 x5 : ℤ) (r : List ℤ) (hd : f dA = x1 :: x2 :: x3 :: x4 :: x5 :: r)
(hu : f cU = []) (h1 : f cA1 = []) (h2 : f cA2 = []) (h3 : f cA3 = []) (hn : f cN = [])
(B : ℕ) (b1 : zsz x1 ≤ B) (b2 : zsz x2 ≤ B) (b3 : zsz x3 ≤ B) (b4 : zsz x4 ≤ B)
(b5 : zsz x5 ≤ B) (bm1 : zsz (x5 * x3) ≤ B) (bm2 : zsz (x2 * (x5 * x3)) ≤ B)
(bm : zsz (2 * (x2 * (x5 * x3))) ≤ B) (hB2 : 2 ≤ B) :
Sp (cntRS dA) (encK s f) (encK s (update f cN [2 * (x2 * (x5 * x3))])) (cCnt B) := by sorry