Allocating the temporaries (round six, `sImplQ_padRole`)
ProvedIntMul.Kappa.R6.IL3H.sImplQ_padRoleAllocating the temporaries.
The following holds (Lean statement, in the scope of module Solutions.R6IL3Alloc):
theorem IntMul.Kappa.R6.IL3H.sImplQ_padRole {lo hi r : ℕ} {st : Fin m × κ → ℕ} {n : ℕ}
(hs : SLaws st n) (ha : ∀ i, 2 * st i ∣ n) {Tm : Butterfly.Op (Fin m × κ)}
{A : ROp (Fin (W + T)) m κ}
(hA : ∀ (v w' : Fin W) (x y : Addr m κ),
A (Fin.castAdd T v, x) (Fin.castAdd T w', y) = if v = w' then Tm x y else 0)
{σ : Fin HS → Option ℤ} (hlt : ∀ i v, σ i = some v → i.val < 56) (hoff : OffG σ)
{xL xQ : Fin HS} (hL : σ xL = some ((2 * (W * n * r) : ℕ) : ℤ))
(hQ : σ xQ = some ((2 * (T * n * r) : ℕ) : ℤ))
{U : IStmt HS Pp} {e dw : ℕ} {cost : ℕ → ℕ}
(h : RImplQ I iprog (fun s => Agree σ s) lo hi r n st A U e dw cost) (Z : ℕ)
(hZ : zsz ((2 * (T * n * r) : ℕ) : ℤ) ≤ Z) :
SImplQ I iprog (fun s => Agree σ s) lo hi r st (W * n) Tm (padCU xL xQ U) e dw
(fun w => 400 * (cPadC (2 * (W * n * r)) (2 * (T * n * r)) Z w dw (fun _ => 0) + 0) +
cost w)
Context. Round six, item language (I3): allocating the temporaries
The complex network acts on W data/scratch roles and T temporaries (Fin (W + T), data
first). At a node the stream holds the W data roles (W n records); padCU xL xQ U appends
T n zero records (the clean temporaries), runs the role program U on W + T roles, and drops
the temporaries again. Only the data block of the network operator matters (DataCorrect), since
the temporaries enter as zeros and leave unread.
flatR_eq_of_getD,exists_flatR,flatR_append,flatR_padX,flatR_take_castAdd;roleOpF_padX: the data rows ofroleOpFon zero-padded temporaries;sImplQ_padRole:padCU xL xQ Uimplements the data blockTmonW nrecords.
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_K_Defs33
import Definitions.Def_IntMul_Kappa_R6_Defs1
import Mathlib
import Definitions.Def_IntMul_HvdH_M_Defs8
import Definitions.Def_IntMul_MultitapeModel
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open IntMul IntMul.Kappa IntMul.Kappa.R6
open IntMul NLogN NLogN.KIL NLogN.KFD NLogN.KFB NLogN.KFG NLogN.KFH NLogN.KFN NLogN.KFW Complex P8Lift Butterfly
variable {Pp : ℕ} {I : List Sym} {iprog : Fin Pp → IStmt HS Pp}
variable {W T m : ℕ} {κ : Type} [Fintype κ] [DecidableEq κ]
theorem IntMul.Kappa.R6.IL3H.sImplQ_padRole {lo hi r : ℕ} {st : Fin m × κ → ℕ} {n : ℕ}
(hs : SLaws st n) (ha : ∀ i, 2 * st i ∣ n) {Tm : Butterfly.Op (Fin m × κ)}
{A : ROp (Fin (W + T)) m κ}
(hA : ∀ (v w' : Fin W) (x y : Addr m κ),
A (Fin.castAdd T v, x) (Fin.castAdd T w', y) = if v = w' then Tm x y else 0)
{σ : Fin HS → Option ℤ} (hlt : ∀ i v, σ i = some v → i.val < 56) (hoff : OffG σ)
{xL xQ : Fin HS} (hL : σ xL = some ((2 * (W * n * r) : ℕ) : ℤ))
(hQ : σ xQ = some ((2 * (T * n * r) : ℕ) : ℤ))
{U : IStmt HS Pp} {e dw : ℕ} {cost : ℕ → ℕ}
(h : RImplQ I iprog (fun s => Agree σ s) lo hi r n st A U e dw cost) (Z : ℕ)
(hZ : zsz ((2 * (T * n * r) : ℕ) : ℤ) ≤ Z) :
SImplQ I iprog (fun s => Agree σ s) lo hi r st (W * n) Tm (padCU xL xQ U) e dw
(fun w => 400 * (cPadC (2 * (W * n * r)) (2 * (T * n * r)) Z w dw (fun _ => 0) + 0) +
cost w) := by sorry