Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Fermat-ring FFT multiplication recovers the negacyclic convolution of the pieces

Proved
NLogN.ss_lift

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

integer-multiplicationschonhage-strassen-tmturing-machines

Let n≥1n\ge 1n≥1, k,Q,M∈Nk,Q,M\in\mathbb Nk,Q,M∈N with 2kQ=n2^kQ=n2kQ=n, and write F=2n+1F=2^n+1F=2n+1, K=2kK=2^kK=2k. Assume

2 (2k)2 (2M)2<2n−1.2\,(2^k)^2\,(2^M)^2 < 2^{n-1}.2(2k)2(2M)2<2n−1.

Then for all integers x,yx,yx,y, with x^=difZ(F,2Q,k,wtZ(F,Q,0,pcs(M,K,x)))\hat x = \mathrm{difZ}(F,2Q,k,\mathrm{wtZ}(F,Q,0,\mathrm{pcs}(M,K,x)))x^=difZ(F,2Q,k,wtZ(F,Q,0,pcs(M,K,x))) and y^\hat yy^​ defined likewise,

liftL(n,k,Q,K, ditZ(F,n,2Q,k, pmulZ(F,x^,y^)))=ncZ(K, pcs(M,K,x), pcs(M,K,y)).\mathrm{liftL}\big(n,k,Q,K,\ \mathrm{ditZ}(F,n,2Q,k,\ \mathrm{pmulZ}(F,\hat x,\hat y))\big) = \mathrm{ncZ}\big(K,\ \mathrm{pcs}(M,K,x),\ \mathrm{pcs}(M,K,y)\big).liftL(n,k,Q,K, ditZ(F,n,2Q,k, pmulZ(F,x^,y^​)))=ncZ(K, pcs(M,K,x), pcs(M,K,y)).

In words: cutting xxx and yyy into KKK signed MMM-bit pieces, twisting by powers of 2Q2^Q2Q, applying the forward FFT, multiplying pointwise mod FFF, applying the inverse FFT, untwisting, scaling by K−1K^{-1}K−1 and lifting to the symmetric range yields exactly (as integers, not only mod FFF) the negacyclic convolution

ncZ(K,a,b)m=∑i+l=maibl−∑i+l=m+Kaibl,0≤m<K.\mathrm{ncZ}(K,a,b)_m = \sum_{i+l=m} a_i b_l - \sum_{i+l=m+K} a_i b_l,\qquad 0\le m<K.ncZ(K,a,b)m​=i+l=m∑​ai​bl​−i+l=m+K∑​ai​bl​,0≤m<K.

This is the algebraic heart of the Schönhage–Strassen correctness proof: the convolution theorem for the Fermat-ring transform with root 22Q2^{2Q}22Q and twist 2Q2^Q2Q (whose KKK-th power is 2n≡−12^n\equiv-12n≡−1), together with the size bound guaranteeing that the coefficients ∣ncZm∣≤K 22M|\mathrm{ncZ}_m|\le K\,2^{2M}∣ncZm​∣≤K22M are recovered exactly from their residues.

Formalization Note. A purely mathematical statement on lists of integers; difZ, ditZ, wtZ, pmulZ, liftL are the reference functions that the item-language procedures are proved to compute, pcs uses signed (sign of xxx) truncating pieces, and % is the canonical nonnegative residue.

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
Formal statement
theorem NLogN.ss_lift (n k Q M : ℕ) (x y : ℤ) (hn : 1 ≤ n) (hKQ : 2 ^ k * Q = n)
    (hb : 2 * ((2 : ℤ) ^ k) ^ 2 * ((2 : ℤ) ^ M) ^ 2 < 2 ^ (n - 1)) :
    liftL n k Q (2 ^ k) (ditZ (2 ^ n + 1) n (2 * Q) k (pmulZ (2 ^ n + 1)
      (difZ (2 ^ n + 1) (2 * Q) k (wtZ (2 ^ n + 1) Q 0 (pcs M (2 ^ k) x)))
      (difZ (2 ^ n + 1) (2 * Q) k (wtZ (2 ^ n + 1) Q 0 (pcs M (2 ^ k) y))))) =
      ncZ (2 ^ k) (pcs M (2 ^ k) x) (pcs M (2 ^ k) y) := 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_lift` of the Lean development NLogN/SSCorrect.lean (lines 17–79), 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