Round-six lemma `rotDU_runs`
ProvedNLogN.KFUU.R6Crt.rotDU_runsAn 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.rotDU_runs (sF : ℕ → ℕ) (μ D Q i : ℕ) (C : Shape)
(hs : ∀ j < i, 1 ≤ sF j) (hQ1 : 1 ≤ Q) (hμ : μ < Q) (hD1 : 1 ≤ D) (hDP : D ≤ Pv sF i) (B Bb w : ℕ)
(hB : zsz ((Q * Pv sF i : ℕ) : ℤ) ≤ B) (hiB : zsz (i : ℤ) ≤ B) (hBvB : zsz ((vol C : ℕ) : ℤ) ≤ B)
(hBb : zsz ((2 * (Q * Pv sF i)) : ℕ) ≤ Bb)
(xs : List ℤ) (hlen : xs.length = vol ((List.range i).map sF ++ Q :: C)) (hb : Bnd w xs)
(t : IState HS) (R RSP : List Item) {LQ LM LP LD LI LB : List Item}
(h0 : t.G 0 = ints xs ++ R)
(hQ : t.G oQ = .int Q :: LQ) (hMu : t.G oMu = .int μ :: LM)
(hPi : t.G oPi = .int (Pv sF i) :: LP) (hDc : t.G oDc = .int D :: LD)
(hI : t.G oI = .int i :: LI)
(hBv : t.G oBv = .int (vol C) :: LB)
(hSP : t.G oSP = ints ((List.range i).map fun j => (sF j : ℤ)).reverse ++ RSP) :
IRuns I iprog (rotDU) t
(t.upd 0 (ints (pull ((List.range i).map sF ++ Q :: C) ((List.range i).map sF ++ Q :: C)
(KFU.rotG i Q (fun a => KIL.lf (csUd sF μ D Q i) a % Q)) 0 xs) ++ R))
(cRotU i (Pv sF i) Q (vol C) w 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.rotDU_runs (sF : ℕ → ℕ) (μ D Q i : ℕ) (C : Shape)
(hs : ∀ j < i, 1 ≤ sF j) (hQ1 : 1 ≤ Q) (hμ : μ < Q) (hD1 : 1 ≤ D) (hDP : D ≤ Pv sF i) (B Bb w : ℕ)
(hB : zsz ((Q * Pv sF i : ℕ) : ℤ) ≤ B) (hiB : zsz (i : ℤ) ≤ B) (hBvB : zsz ((vol C : ℕ) : ℤ) ≤ B)
(hBb : zsz ((2 * (Q * Pv sF i)) : ℕ) ≤ Bb)
(xs : List ℤ) (hlen : xs.length = vol ((List.range i).map sF ++ Q :: C)) (hb : Bnd w xs)
(t : IState HS) (R RSP : List Item) {LQ LM LP LD LI LB : List Item}
(h0 : t.G 0 = ints xs ++ R)
(hQ : t.G oQ = .int Q :: LQ) (hMu : t.G oMu = .int μ :: LM)
(hPi : t.G oPi = .int (Pv sF i) :: LP) (hDc : t.G oDc = .int D :: LD)
(hI : t.G oI = .int i :: LI)
(hBv : t.G oBv = .int (vol C) :: LB)
(hSP : t.G oSP = ints ((List.range i).map fun j => (sF j : ℤ)).reverse ++ RSP) :
IRuns I iprog (rotDU) t
(t.upd 0 (ints (pull ((List.range i).map sF ++ Q :: C) ((List.range i).map sF ++ Q :: C)
(KFU.rotG i Q (fun a => KIL.lf (csUd sF μ D Q i) a % Q)) 0 xs) ++ R))
(cRotU i (Pv sF i) Q (vol C) w B Bb) := by sorry