Round-six lemma `p3B_fsp`
ProvedNLogN.KFL.p3B_fspAn 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.KFLCorr3):
theorem NLogN.KFL.p3B_fsp {κ γ : ℕ → ℕ} (hγκ : ∀ m, γ (κ m) = m) {recs : ℕ → List ℤ} {M A B Bb : ℕ}
(hB2 : 2 ≤ Bb) (hlen : ∀ m, (recs m).length = B) (hbits : ∀ m, NLogN.Bnd 1 (recs m))
(zB : zsz (B : ℤ) ≤ Bb) (zK : ∀ d < M, zsz ((d / 2 ^ A : ℕ) : ℤ) ≤ Bb)
(s : IState HS) (G0 : Fin HS → List ℤ) {k : ℕ} (hk : k < M) :
FSp (NLogN.KFL.p3B B) (encK s (P3 κ γ recs M A G0 (k + 1))) (encK s (P3 κ γ recs M A G0 k)) (cP3 B Bb)
Context. KFL §14: the correction, pass 3 (merge) and the whole correction
Pass 3 rebuilds stack 0 from the bottom: for d = M-1, …, 0 it pops the flag of d and moves
the top record of sKB (a moved destination: the sorted entries are in decreasing destination
order) or of sT (an unmoved record) to stack 0.
corrRS = pass 1 + radix sort + pass 3; corrRS_fsp: on flR recs M it produces
flR (recs ∘ corrR) M.
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_K_Defs33 import Definitions.Def_IntMul_Kappa_R6_Defs1 import Mathlib import Definitions.Def_IntMul_HvdH_M_Defs8 import Definitions.Def_IntMul_MultitapeModel set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 open NLogN NLogN.KFL open IntMul NLogN.RS NLogN.KIL NLogN.KFD Butterfly
theorem NLogN.KFL.p3B_fsp {κ γ : ℕ → ℕ} (hγκ : ∀ m, γ (κ m) = m) {recs : ℕ → List ℤ} {M A B Bb : ℕ}
(hB2 : 2 ≤ Bb) (hlen : ∀ m, (recs m).length = B) (hbits : ∀ m, NLogN.Bnd 1 (recs m))
(zB : zsz (B : ℤ) ≤ Bb) (zK : ∀ d < M, zsz ((d / 2 ^ A : ℕ) : ℤ) ≤ Bb)
(s : IState HS) (G0 : Fin HS → List ℤ) {k : ℕ} (hk : k < M) :
FSp (NLogN.KFL.p3B B) (encK s (P3 κ γ recs M A G0 (k + 1))) (encK s (P3 κ γ recs M A G0 k)) (cP3 B Bb) := by sorry