Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The bit environment: atoms ≤ A, degree-≤ 8 values fit in B bits. -/ structure CostEnv (A B : ℕ) : Prop…

Proved
NLogN.KFM.pmLoop_cost

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

complexity-theoryinteger-multiplicationkappa-improvement

The bit environment: atoms ≤ A, degree-≤ 8 values fit in B bits. -/ structure CostEnv (A B : ℕ) : Prop where hA : 256 ≤ A hAB : ∀ k ≤ 8, A ^ k < 2 ^ B theorem CostEnv.zsz_le {A B : ℕ} (h : CostEnv A B) {z : ℤ} (hz : |z| ≤ (A : ℤ)) : zsz z ≤ B := zsz_of_abs (k := 1) (by simpa using hz) (h.hAB 1 (by norm_num)) theorem CostEnv.zsz_nat {A B : ℕ} (h : CostEnv A B) {m : ℕ} (hm : m ≤ A) : zsz (m : ℤ) ≤ B := h.zsz_le (by rw [Nat.abs_cast]; exact_mod_cast hm) theorem CostEnv.B1 {A B : ℕ} (h : CostEnv A B) : 1 ≤ B := by have := h.hAB 1 (by norm_num) by_contra h0; push Not at h0 have : B = 0 := by omega subst this; simp at ; have := h.hA; omega theorem CostEnv.K {A B : ℕ} (h : CostEnv A B) : 100 ≤ 10 ^ 7 * (B + 2) ^ 2 := by have : 1 ≤ (B + 2) ^ 2 := Nat.one_le_pow _ _ (by omega) nlinarith theorem srcE_sm (A : ℕ) (hA : 2 ≤ A) (u : IState HS) (d' Q Mh Mf : ℕ) (h : SrcRegs u d' Q Mh Mf) (hb : d' ≤ A ∧ Q ≤ A ∧ Mh ≤ A ∧ Mf ≤ A) (r : Fin HS) (c : ℤ) (L : List Item) (hr : u.G r = .int c :: L) (hc : |c| ≤ (A : ℤ)) : exSmS A u (srcE (.add (.reg r) (.lit (-1)))) := by obtain ⟨⟨L1, h1⟩, ⟨L2, h2⟩, ⟨L3, h3⟩, ⟨L4, h4⟩⟩ := h obtain ⟨b1, b2, b3, b4⟩ := hb simp only [srcE, exSmS, IState.top_eq h1, IState.top_eq h2, IState.top_eq h3, IState.top_eq h4, IState.top_eq hr] constructorm _ ∧ _ atoms theorem CostEnv.dg {A B : ℕ} (h : CostEnv A B) (e : Ex HS) (hd : exDgS e ≤ 8) : A ^ exDgS e < 2 ^ B := h.hAB _ hd /-! ## The product loop

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

theorem NLogN.KFM.pmLoop_cost (u : IState HS) (d' Q Mh Mf i s : ℕ) (h : SrcRegs u d' Q Mh Mf)
    (LS LP : List Item) (hS : u.G mS = .int (s : ℤ) :: LS) (hP : u.G mP = .int 1 :: LP)
    (hs : 2 ≤ s) (hIx : ixO.eval u = i) (hIok : ixO.ok u)
    (hj : ∀ j < i, (j < d' → j ≤ Mh) ∧ (d' ≤ j → j - d' ≤ Mf))
    (A B : ℕ) (hE : CostEnv A B) (hb : d' ≤ A ∧ Q ≤ A ∧ Mh ≤ A ∧ Mf ≤ A) (hsA : s ≤ A)
    (hiA : i ≤ A) (c0 : ℕ) (LO : List Item) (hO : u.G mOc = .int (c0 : ℤ) :: LO) (hc0 : c0 ≤ A) :
    (RS.rep mIc ixO pmB).cost u ≤ (i + 1) * 40 * (10 ^ 7 * (B + 2) ^ 2)

Context. The lemma belongs to the part KFM S9: the cost of the source and inverse lists: Write K = 10^7 (B+2)^2. Assume every atom is at most A, with A^k < 2^B for k ≤ 8.

Formalization Note. This lemma belongs to layer 5 of the Lean formalization (integer-multiplication-kappa campaign) of the OpenAI preprint Integer multiplication below nlog⁡nn\log nnlogn: the uniform item-language machine (register programs over the NLogN multitape framework) assembling the Proposition 14 / Lemma 13 / Proposition 18 pieces, the resampling and chirp stages and the cost recurrences into one fixed machine, culminating in NLogN.KFTop.kappa_bound : IntMul.KappaBound (1 / 2 ^ 182) (the bound of Def_IntMul_MultitapeModel). All names refer to the definition bundles up to IntMul_Kappa_K_Defs33.

Preamble
-- OpenAI-preprint / κ-improvement development (integer-multiplication-kappa), generated by skeleton subtraction.

import Definitions.Def_IntMul_Kappa_K_Defs33

set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000

set_option linter.unusedSimpArgs false
set_option linter.unusedVariables false
open NLogN
open NLogN.KFM
open IntMul RS
set_option maxHeartbeats 2000000
Formal statement
theorem NLogN.KFM.pmLoop_cost (u : IState HS) (d' Q Mh Mf i s : ℕ) (h : SrcRegs u d' Q Mh Mf)
    (LS LP : List Item) (hS : u.G mS = .int (s : ℤ) :: LS) (hP : u.G mP = .int 1 :: LP)
    (hs : 2 ≤ s) (hIx : ixO.eval u = i) (hIok : ixO.ok u)
    (hj : ∀ j < i, (j < d' → j ≤ Mh) ∧ (d' ≤ j → j - d' ≤ Mf))
    (A B : ℕ) (hE : CostEnv A B) (hb : d' ≤ A ∧ Q ≤ A ∧ Mh ≤ A ∧ Mf ≤ A) (hsA : s ≤ A)
    (hiA : i ≤ A) (c0 : ℕ) (LO : List Item) (hO : u.G mOc = .int (c0 : ℤ) :: LO) (hc0 : c0 ≤ A) :
    (RS.rep mIc ixO pmB).cost u ≤ (i + 1) * 40 * (10 ^ 7 * (B + 2) ^ 2) := by sorry
Source
OpenAI, Integer multiplication below n log n (preprint, 23 Sep 2026), https://github.com/openai/math/tree/adc7f1241b42e322a6451854ab7e4b4c146bf78a/preprints/Integer-multiplication-below-n-log-n-September-23-2026. Lemma `NLogN.KFM.pmLoop_cost` of the Lean development Solutions/KFMS9.lean (lines 58–105), integer-multiplication-kappa campaign.

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