Round-six lemma `rotIt_runs`
ProvedNLogN.KFUU.R6Crt.rotIt_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.R6CrtLoop):
theorem NLogN.KFUU.R6Crt.rotIt_runs (sig : Bool) (Q u n m : ℕ) (hQd : Q = 2 ^ u) (T : Shape) (μ : ℕ) (hu : 1 ≤ u)
(hmn : 2 * m ≤ n) (hμ : μ < Q) (hT : ∀ a ∈ T, 1 ≤ a) (w Z : ℕ)
(hVZ : zsz ((vol (SH n Q T) : ℕ) : ℤ) ≤ Z)
(xs : List ℤ) (hlen : xs.length = vol (SH n Q T)) (hb : Bnd w xs)
(t : IState HS) (R LP LB LD LI : List Item) {k : ℕ} (hk : k < m)
{LQ LM L2 RSP : List Item}
(hQ : t.G oQ = .int ((Q : ℕ) : ℤ) :: LQ) (hMu : t.G oMu = .int (μ : ℤ) :: LM)
(h2 : t.G rU2 = .int ((Q : ℕ) : ℤ) :: L2)
(hSP : t.G oSP = ints (List.replicate n ((Q : ℕ) : ℤ)) ++ RSP) :
IRuns I iprog (rotIt sig) (lsSt Q n m T sig μ t R LP LB LD LI xs k)
(lsSt Q n m T sig μ t R LP LB LD LI xs (k + 1)) (cIt n (vol (SH n Q T)) Q w Z)
Context. CRT reversal §4: one rotation set and one composite swap in IL
rotIt sig: one digit-selector rotation (rotDU) and the register advanceP_t ← P_t·Q,vol C ← vol C / Q,D ← D/Q(sig) orD·Q,t ← t+1.lsU sig neg: the rotation setL(±σ)/L(±1): pushQ,μ = Q-1(neg) or1, and the start values from the global registers, runm = ⌊n/2⌋iterations (rptXonrH), pop.lsU_runs: the dataxs(shapeSH n Q T) becomespull … (lsetK Q n m sig μ m) xs.swpU: the composite Lemma 12 swap of the blocksx,y(swSwithu' = u·m,2^{u'} = Q^m).swpU_runs: the data becomespull … (bsw n m) xs.
Global registers (set by the prologue of p2E): gQm = Q^m, gP = Q^{n-m},
gB = Q^{m-1} · vol T, gD = Q^{m-1}, gI = n - m, gUm = u·m, gMd = Q^{n-2m}; rH = m,
rB = vol T / 2, oSP holds n copies of 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.KFB NLogN.KFC NLogN.KFT NLogN.KFU AModel AModelL12 NLogN.KFUU
variable {P : ℕ} {I : List Sym} {iprog : Fin P → IStmt HS P}
theorem NLogN.KFUU.R6Crt.rotIt_runs (sig : Bool) (Q u n m : ℕ) (hQd : Q = 2 ^ u) (T : Shape) (μ : ℕ) (hu : 1 ≤ u)
(hmn : 2 * m ≤ n) (hμ : μ < Q) (hT : ∀ a ∈ T, 1 ≤ a) (w Z : ℕ)
(hVZ : zsz ((vol (SH n Q T) : ℕ) : ℤ) ≤ Z)
(xs : List ℤ) (hlen : xs.length = vol (SH n Q T)) (hb : Bnd w xs)
(t : IState HS) (R LP LB LD LI : List Item) {k : ℕ} (hk : k < m)
{LQ LM L2 RSP : List Item}
(hQ : t.G oQ = .int ((Q : ℕ) : ℤ) :: LQ) (hMu : t.G oMu = .int (μ : ℤ) :: LM)
(h2 : t.G rU2 = .int ((Q : ℕ) : ℤ) :: L2)
(hSP : t.G oSP = ints (List.replicate n ((Q : ℕ) : ℤ)) ++ RSP) :
IRuns I iprog (rotIt sig) (lsSt Q n m T sig μ t R LP LB LD LI xs k)
(lsSt Q n m T sig μ t R LP LB LD LI xs (k + 1)) (cIt n (vol (SH n Q T)) Q w Z) := by sorry