The swap of a compact field (round six, `swW_RS`)
ProvedIntMul.Kappa.R6.IL2C.swW_RSThe swap of a compact field (stride s = Mid QC, on register r) with Bk.
The following holds (Lean statement, in the scope of module Solutions.R6IL2CPhase):
theorem IntMul.Kappa.R6.IL2C.swW_RS {Ksw : ℝ} (H : IntMul.Kappa.R6.IL2C.SwOK tab l12 τ Ksw) (hnG : 1 ≤ n * G) {r : Fin HS} {s P Mid : ℕ}
(hr : r = kSU ∨ r = kST)
(hreg : ∀ t, CEnv t l K ρ G n q Br fl → ∃ L, t.G r = .int (s : ℤ) :: L)
(hs : s = Mid * l.QC) (hM : l.M = P * l.QC * s) (hP0 : 0 < P) (hMid : 0 < Mid) :
RecStep I tab (IntMul.Kappa.R6.IL2C.swW l12 r) (fun t => CEnv t l K ρ G n q Br fl) l.M Br (swP l.QC s 1)
(IntMul.Kappa.R6.IL2C.cW Ksw τ l n G Br)
Context. Round six, compact controls (I2C): the compact phase as record steps
The ten table rotations (rotYA, rotYB on Y; rotS, rotC, rotL ±1 on Bk) and the
twelve Lemma 12 swaps (swT, swU: the compact fields T, U with Bk) of the compact
program, with all parameters read from the registers of CEnv, as RecSteps:
phaseC_step: one phase isl.stepP phInv;psiC_step: phase, load, phase, unload isl.stepP Psi;compactC_step: followed by the correction it isl.stepP TlS(exactly).
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_Defs21
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open IntMul IntMul.Kappa IntMul.Kappa.R6 IntMul.Kappa.R6.IL2C
open NLogN NLogN.KFL NLogN.KIL NLogN.KFD NLogN.KFW NLogN.KFX IntMul NLogN.RS NLogN.KFW.RS AModel AModelL12
variable {I : List Sym} {tab : Fin 1 → IStmt HS 1} {l12 : IStmt HS 1} {τ : ℝ}
{l : Lay} {K ρ G n L q Br : ℕ} {fl : ℤ}
variable (hP : PhOK l K ρ G n L Br)
include hP
theorem IntMul.Kappa.R6.IL2C.swW_RS {Ksw : ℝ} (H : IntMul.Kappa.R6.IL2C.SwOK tab l12 τ Ksw) (hnG : 1 ≤ n * G) {r : Fin HS} {s P Mid : ℕ}
(hr : r = kSU ∨ r = kST)
(hreg : ∀ t, CEnv t l K ρ G n q Br fl → ∃ L, t.G r = .int (s : ℤ) :: L)
(hs : s = Mid * l.QC) (hM : l.M = P * l.QC * s) (hP0 : 0 < P) (hMid : 0 < Mid) :
RecStep I tab (IntMul.Kappa.R6.IL2C.swW l12 r) (fun t => CEnv t l K ρ G n q Br fl) l.M Br (swP l.QC s 1)
(IntMul.Kappa.R6.IL2C.cW Ksw τ l n G Br) := by sorry