Round-six lemma `tabUd_sp`
ProvedNLogN.KFUU.R6Crt.tabUd_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.R6CrtTab):
theorem NLogN.KFUU.R6Crt.tabUd_sp (sF : ℕ → ℕ) (μ D Q i Bv : ℕ)
(hs : ∀ j < i, 1 ≤ sF j) (hQ1 : 1 ≤ Q) (hμ : μ < Q) (hD1 : 1 ≤ D) (hDP : D ≤ Pv sF i) (B Bb : ℕ)
(hB : zsz ((Q * Pv sF i : ℕ) : ℤ) ≤ B) (hiB : zsz (i : ℤ) ≤ B) (hBvB : zsz (Bv : ℤ) ≤ B)
(hBb : zsz ((2 * (Q * Pv sF i)) : ℕ) ≤ Bb)
(s : IState HS) {LQ LM LP LD LI LB : List Item}
(hQ : s.G oQ = .int Q :: LQ) (hMu : s.G oMu = .int μ :: LM)
(hPi : s.G oPi = .int (Pv sF i) :: LP) (hDc : s.G oDc = .int D :: LD) (hI : s.G oI = .int i :: LI)
(hBv : s.G oBv = .int Bv :: LB) :
Sp (tabUd)
(encK s (Function.update (fun _ => []) oSP ((List.range i).map fun j => (sF j : ℤ)).reverse))
(encK s (tabEndd sF μ D Q i (Pv sF i) Bv)) (cTab i (Pv sF i) B Bb)
Context. CRT reversal §1: the digit-selector rotation rotDU
A copy of KFUU's uniform shift rotCU (KFUURot2–5) whose coefficient of field j is
cFd = μ · (P_j / D) mod Q (register oDc = D) instead of μ P_j mod Q. With all field sizes
equal to Q and D = Q^k, the coefficient is μ · [j = k], so rotDU adds μ · a_k to the
target digit: one shear y += μ x_k of the additive-swap reversal (see jain6/crt/DESIGN.md).
rotDU_runs: the KFU form pull … (rotG i Q (fun a => lf cs a % Q)).
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_Defs14
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open NLogN NLogN.KFUU NLogN.KFUU.R6Crt
open IntMul NLogN.KIL NLogN.KFC AModel AModelL12 NLogN.KFUU
variable {Pp : ℕ} {I : List Sym} {iprog : Fin Pp → IStmt HS Pp}
theorem NLogN.KFUU.R6Crt.tabUd_sp (sF : ℕ → ℕ) (μ D Q i Bv : ℕ)
(hs : ∀ j < i, 1 ≤ sF j) (hQ1 : 1 ≤ Q) (hμ : μ < Q) (hD1 : 1 ≤ D) (hDP : D ≤ Pv sF i) (B Bb : ℕ)
(hB : zsz ((Q * Pv sF i : ℕ) : ℤ) ≤ B) (hiB : zsz (i : ℤ) ≤ B) (hBvB : zsz (Bv : ℤ) ≤ B)
(hBb : zsz ((2 * (Q * Pv sF i)) : ℕ) ≤ Bb)
(s : IState HS) {LQ LM LP LD LI LB : List Item}
(hQ : s.G oQ = .int Q :: LQ) (hMu : s.G oMu = .int μ :: LM)
(hPi : s.G oPi = .int (Pv sF i) :: LP) (hDc : s.G oDc = .int D :: LD) (hI : s.G oI = .int i :: LI)
(hBv : s.G oBv = .int Bv :: LB) :
Sp (tabUd)
(encK s (Function.update (fun _ => []) oSP ((List.range i).map fun j => (sF j : ℤ)).reverse))
(encK s (tabEndd sF μ D Q i (Pv sF i) Bv)) (cTab i (Pv sF i) B Bb) := by sorry