Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The level branch computes `levelH` (round six, `gen_level`)

Proved
IntMul.Kappa.R6.IL.gen_level

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

complexity-theoryinteger-multiplicationkappa-improvement

The level branch computes levelH.

The following holds (Lean statement, in the scope of module Solutions.R6ILGenL):

theorem IntMul.Kappa.R6.IL.gen_level {I : List Sym} {tab : Fin 1 → IStmt HS 1} (C : Bit.QHNet (ZMod 2) W T m)
    (s0 : IState HS) {q e P L M Bb : ℕ} {A B Cs : Shape} (hm : 2 ≤ m) (hq : q.Prime)
    (hqB : qBound C < q) (hOK : ∀ f, C.EdgesOK (q ^ f)) (hruns : C.RunsOK)
    (hM : zsz (M : ℤ) ≤ Bb) (hEB : EntB m q W T e P L (vol A) (vol B) (vol Cs) M)
    (hP : 1 ≤ P) (hL : 1 ≤ L) (hA : ∀ x ∈ A, 1 ≤ x) (hB : ∀ x ∈ B, 1 ≤ x)
    (hC : ∀ x ∈ Cs, 1 ≤ x) (hWL : m ≤ e → W ∣ L) (hN3 : (q ^ (e / m) + 1) ^ 3 ≤ M)
    (child : ℕ × ℕ × ℕ → List (ZMod 2) → List (ZMod 2)) (c0 : ℕ × ℕ × ℕ → ℕ)
    (hchL : ∀ ρ ∈ runsL C, ∀ ys : List (ZMod 2),
      ys.length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))) →
      (child ρ ys).length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))))
    (hch : m ≤ e → ∀ ρ ∈ runsL C, ∀ (t' : IState HS) (R' : List Item) (ys : List (ZMod 2)),
      DescG t' (ρ.2.2 * (e / m)) P (L / W)
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).1
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).2.1
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).2.2 →
      ys.length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))) →
      IRuns I tab (tab 0) (t'.upd 0 (ints (enc2 ys) ++ R')) (t'.upd 0 (ints (enc2 (child ρ ys)) ++ R'))
        (c0 ρ))
    (R : List Item) (xs : List (ZMod 2)) (hxs : xs.length = vol (P :: L :: hdShape A B Cs e q)) :
    IRuns I tab (genL C)
      (encK (s0.upd 0 (ints (enc2 xs) ++ R))
        (regState (fDesc e P L (vol A) (vol B) (vol Cs))
          (vEnt m q W T e P L (vol A) (vol B) (vol Cs)) genD))
      (encK (s0.upd 0 (ints (enc2 (if m ≤ e then Bit.levelH C (q ^ (e / m)) P (L / W) A
          (List.replicate (e % m) q ++ B) (List.replicate (e % m) q ++ Cs) child xs else xs)) ++ R))
        (regState (fDesc e P L (vol A) (vol B) (vol Cs))
          (vEnt m q W T e P L (vol A) (vol B) (vol Cs)) genD))
      (cGenL C e (vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m)))) Bb c0)

Context. Round six, item language: the level branch of the general procedure

genL C: if f = e / m = 0 nothing; otherwise push -N on sNQ (N = q ^ f), run the level body levBody C (the level registers are those of the entry file), pop sNQ. gen_level: given a specification of the child calls, it computes levelH with the child of progH.

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_Defs13

set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000

open IntMul IntMul.Kappa IntMul.Kappa.R6 IntMul.Kappa.R6.IL
open IntMul NLogN NLogN.RS NLogN.KIL NLogN.KFD AModel AModelL12 Finset
variable {W T m : ℕ} [NeZero W]
Formal statement
theorem IntMul.Kappa.R6.IL.gen_level {I : List Sym} {tab : Fin 1 → IStmt HS 1} (C : Bit.QHNet (ZMod 2) W T m)
    (s0 : IState HS) {q e P L M Bb : ℕ} {A B Cs : Shape} (hm : 2 ≤ m) (hq : q.Prime)
    (hqB : qBound C < q) (hOK : ∀ f, C.EdgesOK (q ^ f)) (hruns : C.RunsOK)
    (hM : zsz (M : ℤ) ≤ Bb) (hEB : EntB m q W T e P L (vol A) (vol B) (vol Cs) M)
    (hP : 1 ≤ P) (hL : 1 ≤ L) (hA : ∀ x ∈ A, 1 ≤ x) (hB : ∀ x ∈ B, 1 ≤ x)
    (hC : ∀ x ∈ Cs, 1 ≤ x) (hWL : m ≤ e → W ∣ L) (hN3 : (q ^ (e / m) + 1) ^ 3 ≤ M)
    (child : ℕ × ℕ × ℕ → List (ZMod 2) → List (ZMod 2)) (c0 : ℕ × ℕ × ℕ → ℕ)
    (hchL : ∀ ρ ∈ runsL C, ∀ ys : List (ZMod 2),
      ys.length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))) →
      (child ρ ys).length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))))
    (hch : m ≤ e → ∀ ρ ∈ runsL C, ∀ (t' : IState HS) (R' : List Item) (ys : List (ZMod 2)),
      DescG t' (ρ.2.2 * (e / m)) P (L / W)
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).1
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).2.1
        (chDesc m (q ^ (e / m)) (vol A) (q ^ (e % m) * vol B) (q ^ (e % m) * vol Cs) ρ).2.2 →
      ys.length = vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m))) →
      IRuns I tab (tab 0) (t'.upd 0 (ints (enc2 ys) ++ R')) (t'.upd 0 (ints (enc2 (child ρ ys)) ++ R'))
        (c0 ρ))
    (R : List Item) (xs : List (ZMod 2)) (hxs : xs.length = vol (P :: L :: hdShape A B Cs e q)) :
    IRuns I tab (genL C)
      (encK (s0.upd 0 (ints (enc2 xs) ++ R))
        (regState (fDesc e P L (vol A) (vol B) (vol Cs))
          (vEnt m q W T e P L (vol A) (vol B) (vol Cs)) genD))
      (encK (s0.upd 0 (ints (enc2 (if m ≤ e then Bit.levelH C (q ^ (e / m)) P (L / W) A
          (List.replicate (e % m) q ++ B) (List.replicate (e % m) q ++ Cs) child xs else xs)) ++ R))
        (regState (fDesc e P L (vol A) (vol B) (vol Cs))
          (vEnt m q W T e P L (vol A) (vol B) (vol Cs)) genD))
      (cGenL C e (vol (P :: (L / W) :: hdShape A (List.replicate (e % m) q ++ B)
        (List.replicate (e % m) q ++ Cs) m (q ^ (e / m)))) Bb c0) := 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.IL.gen_level`, Solutions/R6ILGenL.lean (lines 60–300) 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