Round-six lemma `p2E_runs`
ProvedNLogN.KFUU.R6Crt.p2E_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.R6CrtRev):
theorem NLogN.KFUU.R6Crt.p2E_runs {pM : Fin P} (hMul : MulOK I iprog pM MS) {pS : Fin HS} (hpS : LS pS)
{eSw : Fin P} {dS : Fin HS} {K : ℝ} (hK : SwOKτ τ I iprog eSw dS K) (hdS : dS ≠ 0)
{Dsc : Fin HS} (hD : Dsc = 18 ∨ Dsc = 19) (hDd : Dsc ≠ dS)
(u w cz cr : ℕ) (bs : List Bool) (hu : 1 ≤ u) (hcz : cz = 2 * cr) (hcr : 1 ≤ cr)
(hn2 : 2 ≤ bs.length)
(xs0 : List ℤ) (hx : Bnd w xs0) (Z : ℕ) (hZ3 : 3 ≤ Z)
(hVZ : zsz ((vol (shP u bs) * cz : ℕ) : ℤ) ≤ Z) (zw : zsz (w : ℤ) ≤ Z)
(zU : zsz ((2 ^ u : ℕ) : ℤ) ≤ Z)
(t : IState HS) (R : List Item)
(h0 : t.G 0 = ints (Dl (mzB u bs.length cz) (bgB bs) (List.range bs.length ++ [bs.length])
(lay1 (bgB bs) bs.length 0) xs0 0) ++ R)
{RS LN LZ LW LU L2 : List Item}
(hpS0 : t.G pS = ints (zl (shP u bs)) ++ RS) (hN : t.G nR = .int (bs.length : ℤ) :: LN)
(hZ : t.G rCZ = .int (cz : ℤ) :: LZ)
(hW : t.G rW = .int (w : ℤ) :: LW) (hUu : t.G rU = .int (u : ℤ) :: LU)
(h2 : t.G rU2 = .int ((2 ^ u : ℕ) : ℤ) :: L2) :
IRuns I iprog (p2E pM pS eSw dS Dsc) t
(t.upd 0 (ints (Dl (mzB u bs.length cz) (bgB bs) (List.range bs.length ++ [bs.length])
(((lay1 (bgB bs) bs.length 0).take bs.length).reverse ++
(lay1 (bgB bs) bs.length 0).drop bs.length) xs0 0) ++ R))
(cP2E τ K u bs.length w Z (vol (ctB u cz bs) * cr) (vol (shP u bs) * cz))
Context. CRT reversal §8: phase 2 by additive swaps (p2E) and the reversal revE = p1U; p2E; p3U
p2E replaces KFUU's p2U (⌊n/2⌋ single-digit swaps, cost n·h^τ) by the nine-phase word of
mainU (three composite swaps of u·⌊n/2⌋-bit digits and six rotation sets). p2E_runs has
the interface of p2U_runs (with SwOKτ τ and 2 ≤ n); revE_runs / revKE the
interface of revU_runs / revK.
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.p2E_runs {pM : Fin P} (hMul : MulOK I iprog pM MS) {pS : Fin HS} (hpS : LS pS)
{eSw : Fin P} {dS : Fin HS} {K : ℝ} (hK : SwOKτ τ I iprog eSw dS K) (hdS : dS ≠ 0)
{Dsc : Fin HS} (hD : Dsc = 18 ∨ Dsc = 19) (hDd : Dsc ≠ dS)
(u w cz cr : ℕ) (bs : List Bool) (hu : 1 ≤ u) (hcz : cz = 2 * cr) (hcr : 1 ≤ cr)
(hn2 : 2 ≤ bs.length)
(xs0 : List ℤ) (hx : Bnd w xs0) (Z : ℕ) (hZ3 : 3 ≤ Z)
(hVZ : zsz ((vol (shP u bs) * cz : ℕ) : ℤ) ≤ Z) (zw : zsz (w : ℤ) ≤ Z)
(zU : zsz ((2 ^ u : ℕ) : ℤ) ≤ Z)
(t : IState HS) (R : List Item)
(h0 : t.G 0 = ints (Dl (mzB u bs.length cz) (bgB bs) (List.range bs.length ++ [bs.length])
(lay1 (bgB bs) bs.length 0) xs0 0) ++ R)
{RS LN LZ LW LU L2 : List Item}
(hpS0 : t.G pS = ints (zl (shP u bs)) ++ RS) (hN : t.G nR = .int (bs.length : ℤ) :: LN)
(hZ : t.G rCZ = .int (cz : ℤ) :: LZ)
(hW : t.G rW = .int (w : ℤ) :: LW) (hUu : t.G rU = .int (u : ℤ) :: LU)
(h2 : t.G rU2 = .int ((2 ^ u : ℕ) : ℤ) :: L2) :
IRuns I iprog (p2E pM pS eSw dS Dsc) t
(t.upd 0 (ints (Dl (mzB u bs.length cz) (bgB bs) (List.range bs.length ++ [bs.length])
(((lay1 (bgB bs) bs.length 0).take bs.length).reverse ++
(lay1 (bgB bs) bs.length 0).drop bs.length) xs0 0) ++ R))
(cP2E τ K u bs.length w Z (vol (ctB u cz bs) * cr) (vol (shP u bs) * cz)) := by sorry