Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Allocating the temporaries (round six, `sImplQ_padRole`)

Proved
IntMul.Kappa.R6.IL3H.sImplQ_padRole

by xuanji · Oct 20, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theoryinteger-multiplicationkappa-improvement

Allocating 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 of roleOpF on zero-padded temporaries;
  • sImplQ_padRole: padCU xL xQ U implements the data block Tm on W n records.

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_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 κ]
Formal statement
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
Source
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.sImplQ_padRole`, Solutions/R6IL3Alloc.lean (lines 177–311) of the round-six development.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me