Round-six lemma `hdr_sp`
ProvedJ6Seg.hdr_spAn 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.J6SegILSweep2):
theorem J6Seg.hdr_sp (s : IState HS) (F : Fin HS → List ℤ) (z : List ℤ) (p α h c : ℕ)
(bs sv : List ℤ) (B : ℕ) (hB : 1 ≤ B) (h01 : ∀ b ∈ bs, b = 0 ∨ b = 1)
(hc : bs.sum = (c : ℤ)) (hzp : zsz (p : ℤ) ≤ B) (hzα : zsz (α : ℤ) ≤ B)
(hBe : h * bs.length + bs.length + 1 ≤ B) (hhB : h + 1 ≤ B)
(hzT : zsz ((2 : ℤ) ^ (h * bs.length + c)) ≤ B) :
Sp (hdrA σ dS)
(encK s (SS σ dS F z ((p : ℤ) :: (α : ℤ) :: (h : ℤ) :: (bs.length : ℤ) :: (bs ++ sv))
(fun _ : Fin 19 => ([] : List ℤ))))
(encK s (SS σ dS F z sv (vH p α h bs.length c bs))) (cHdr B bs.length)
Context. B-line IL, B6 §2: reading the line descriptor
hdrA σ dS (on dS = descLine6 = p :: α :: h :: d :: (bits ++ svals)): pop p, α, h, d into
σ 0..3, move the d bits onto σ 12 while counting the ones in σ 4, move them on to σ 13
(in order), then σ 5 := T = 2^{h d + #ones}, σ 6 := 1 (pre), σ 8 := 0 (k).
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
open IntMul NLogN NLogN.KIL NLogN.KFB IntMul.Kappa.R6 Function
variable {σ : Fin 19 → Fin HS} {dS dA : Fin HS} (hW : SwOK σ dS dA)
include hW
theorem J6Seg.hdr_sp (s : IState HS) (F : Fin HS → List ℤ) (z : List ℤ) (p α h c : ℕ)
(bs sv : List ℤ) (B : ℕ) (hB : 1 ≤ B) (h01 : ∀ b ∈ bs, b = 0 ∨ b = 1)
(hc : bs.sum = (c : ℤ)) (hzp : zsz (p : ℤ) ≤ B) (hzα : zsz (α : ℤ) ≤ B)
(hBe : h * bs.length + bs.length + 1 ≤ B) (hhB : h + 1 ≤ B)
(hzT : zsz ((2 : ℤ) ^ (h * bs.length + c)) ≤ B) :
Sp (hdrA σ dS)
(encK s (SS σ dS F z ((p : ℤ) :: (α : ℤ) :: (h : ℤ) :: (bs.length : ℤ) :: (bs ++ sv))
(fun _ : Fin 19 => ([] : List ℤ))))
(encK s (SS σ dS F z sv (vH p α h bs.length c bs))) (cHdr B bs.length) := by sorry