Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Schönhage–Strassen: integer multiplication on multitape TMs in time O(n log n log log n)

Proved
NLogN.ss_mulTimeBound

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

integer-multiplicationschonhage-strassen-tmturing-machines

There is a deterministic multitape Turing machine M\mathcal MM (in the sense of Def_IntMul_MultitapeModel) multiplying integers in time O(nlog⁡nlog⁡log⁡n)O(n\log n\log\log n)O(nlognloglogn):

MulTimeBound(n↦n⋅ln⁡n⋅ln⁡ln⁡n).\mathrm{MulTimeBound}\big(n\mapsto n\cdot\ln n\cdot\ln\ln n\big).MulTimeBound(n↦n⋅lnn⋅lnlnn).

Explicitly: for every n≥1n\ge1n≥1 there is a bound TTT such that on every input x#yx\#yx#y with x,y∈{0,1}nx,y\in\{0,1\}^nx,y∈{0,1}n the machine halts within TTT steps with output bin2n(val x⋅val y)\mathrm{bin}_{2n}(\mathrm{val}\,x\cdot\mathrm{val}\,y)bin2n​(valx⋅valy), and there are c>0c>0c>0 and n0n_0n0​ such that for all n≥max⁡(n0,1)n\ge \max(n_0,1)n≥max(n0​,1) this holds with T=c nln⁡nln⁡ln⁡nT=c\,n\ln n\ln\ln nT=cnlnnlnlnn.

The machine is ssMachine, the compilation of the item-language program ssProg (main program, FM, forward FFT, inverse FFT, powers of two). The proof bounds the cost of FM at size NNN by the potential Φ(N)=22100N ℓ λ\Phi(N)=2^{2100}N\,\ell\,\lambdaΦ(N)=22100Nℓλ with ℓ≈log⁡N\ell\approx\log Nℓ≈logN, λ≈4log⁡ℓ\lambda\approx 4\log\ellλ≈4logℓ, by induction using fmMain_runs (one level costs 2kC2^kC2kC plus fmLevelCost N, and the parameter inequalities show that the potential absorbs this when C=Φ(N′)C=\Phi(N')C=Φ(N′)); the main program reads the inputs, calls FM at N0=2∣n+1∣2+1=Θ(n)N_0=2^{|n+1|_2+1}=\Theta(n)N0​=2∣n+1∣2​+1=Θ(n) and writes the product; compiler correctness and multipliesAt_of_exec transfer the bound to the Turing machine.

Formalization Note. Real.log is the natural logarithm (the base only affects the constant), and for small nnn where ln⁡ln⁡n≤0\ln\ln n\le 0lnlnn≤0 the bound is only required for n≥n0n\ge n_0n≥n0​. The platform-facing alias is IntMul.TM.schonhage_strassen, with the same statement.

Preamble
-- Schönhage–Strassen multitape-TM development (NLogN), generated by skeleton subtraction.

import Definitions.Def_IntMul_SS_Defs2

set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000

open NLogN
open IntMul
attribute [local irreducible] fmA
Formal statement
theorem NLogN.ss_mulTimeBound :
    MulTimeBound fun n => (n : ℝ) * Real.log n * Real.log (Real.log n) := by sorry
Source
A. Schönhage, V. Strassen, Schnelle Multiplikation großer Zahlen, Computing 7 (1971), 281–292 (main theorem: O(n log n log log n) multitape TM multiplication). Lemma `NLogN.ss_mulTimeBound` of the Lean development NLogN/SSFinal.lean (lines 66–83), written for the prove2.me integer-multiplication 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