A generic loop (round six, `loopQS`)
ProvedIntMul.Kappa.R6.IL3H.loopQScomplexity-theoryinteger-multiplicationkappa-improvement
A generic loop (test of size ≤ sz).
The following holds (Lean statement, in the scope of module Solutions.R6IL3Top1):
theorem IntMul.Kappa.R6.IL3H.loopQS {sz : ℕ} {j : Fin Pp} {cond : NE} {step : List (Fin HS × NE)} {cont : IStmt HS Pp}
(hj : tbl j = testC 16 cond (withPushI (fr step) (.call j)) cont)
(Inv : ℕ → (Fin HS → Option ℤ) → Prop) {Mb Bz : ℕ} (hMb : zsz (Mb : ℤ) ≤ Bz)
(hcR : cond.RegsLt) (hcS : cond.size ≤ sz) (hsN : NoRdN [] step) (hs0 : ∀ x ∈ step, x.1 ≠ 0)
{f g : Fin HS → List ℤ} (hf : Clean0 f) (hg : Clean0 g) {cc : ℕ}
(hbase : ∀ σ, Inv 0 σ → σ 0 = none ∧ NatR σ cond ∧ cond.OK (vOf σ) Mb ∧
cond.val (vOf σ) ≠ 0 ∧
RunQ Isym tbl (σPush σ [((16 : Fin HS), ((cond.val (vOf σ) : ℕ) : ℤ))]) cont f g cc)
(hstep : ∀ n σ, Inv (n + 1) σ → σ 0 = none ∧ NatR σ cond ∧ cond.OK (vOf σ) Mb ∧
cond.val (vOf σ) = 0 ∧ FrOK (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))]) Mb 12 step ∧
Inv n (σPush (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))])
(frV (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))]) step))) :
∀ n σ, Inv n σ → RunQ Isym tbl σ (.call j) f g (cc + (n + 1) * cLoopS sz step.length Bz)
Context. Round six, item language (I3): the entry loops of the uniform Proposition 14
loopQ: a generic continuation-passing loop (testC 16 cond (push step; call j) cont) from an invariant indexed by the number of remaining iterations.gloopC cz: withZonvG = 24, findsG = clog₂ (4 (Z + cz) (Z + cz + 2))on11(gloopQ; the compact-controls field width).dloopC c: withDon22, findsd = dep m Don12andW^don13(dloopQ).
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*).
Preamble
-- Round-six κ development (integer-multiplication-kappa), generated by skeleton subtraction.
import Definitions.Def_IntMul_Kappa_R6_Defs22
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open IntMul IntMul.Kappa IntMul.Kappa.R6 IntMul.Kappa.R6.IL3H
open IntMul NLogN NLogN.KIL NLogN.KFD NLogN.KFB NLogN.KFG NLogN.KFH NLogN.KFN NLogN.KFW Complex P8Lift Butterfly IntMul.Kappa.R6.Cx
variable {Pp : ℕ} {Isym : List Sym} {tbl : Fin Pp → IStmt HS Pp}
Formal statement
theorem IntMul.Kappa.R6.IL3H.loopQS {sz : ℕ} {j : Fin Pp} {cond : NE} {step : List (Fin HS × NE)} {cont : IStmt HS Pp}
(hj : tbl j = testC 16 cond (withPushI (fr step) (.call j)) cont)
(Inv : ℕ → (Fin HS → Option ℤ) → Prop) {Mb Bz : ℕ} (hMb : zsz (Mb : ℤ) ≤ Bz)
(hcR : cond.RegsLt) (hcS : cond.size ≤ sz) (hsN : NoRdN [] step) (hs0 : ∀ x ∈ step, x.1 ≠ 0)
{f g : Fin HS → List ℤ} (hf : Clean0 f) (hg : Clean0 g) {cc : ℕ}
(hbase : ∀ σ, Inv 0 σ → σ 0 = none ∧ NatR σ cond ∧ cond.OK (vOf σ) Mb ∧
cond.val (vOf σ) ≠ 0 ∧
RunQ Isym tbl (σPush σ [((16 : Fin HS), ((cond.val (vOf σ) : ℕ) : ℤ))]) cont f g cc)
(hstep : ∀ n σ, Inv (n + 1) σ → σ 0 = none ∧ NatR σ cond ∧ cond.OK (vOf σ) Mb ∧
cond.val (vOf σ) = 0 ∧ FrOK (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))]) Mb 12 step ∧
Inv n (σPush (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))])
(frV (σPush σ [((16 : Fin HS), ((0 : ℕ) : ℤ))]) step))) :
∀ n σ, Inv n σ → RunQ Isym tbl σ (.call j) f g (cc + (n + 1) * cLoopS sz step.length Bz) := by sorrySource
S. Jain, round-six networks for the integer-multiplication κ-improvement campaign (https://github.com/Swapnil-jain/integer-mult-kappa, commit 5868dc7) and D. Colkitt, integer-mult-bounds (https://github.com/CrocSwap/integer-mult-bounds); target `IntMul.Kappa.jain_round6_framework`. Lean declaration `IntMul.Kappa.R6.IL3H.loopQS`, Solutions/R6IL3Top1.lean (lines 40–85) of the round-six development.