Algorithm Search⌘K

Proofs: Fürer's multiplication

These are the human proofs of Fürer's multiplication, at full length.

The toy Fürer scheme returns the product full

This proof shows: correctness, termination.

This proof is for the exact toy model of the page: R=Zq[x]/(xm+1)R = \mathbb{Z}_q[x]/(x^m + 1) with qq prime, mm a power of 2, K=2mK = 2m, Nt=KLN_t = K^L with Nt∣q−1N_t \mid q - 1, limbs of bb bits and β=2b\beta = 2^b. It does not cover Fürer's complex version, whose precision analysis is in his paper.

Termination. A call of FFT on a vector of length KℓK^\ell with ℓ≥2\ell \ge 2 makes calls on vectors of length KK (line L7) and Kℓ−1K^{\ell - 1} (line L9) only, and a call of length KK stops at line L6, whose radix-2 DFT halves its length at each level. So the recursion depth is at most L−1+log⁡2KL - 1 + \log_2 K, and FURER-MULTIPLY makes three calls and finite loops.

Lemma 1 (the ring and the root). Let ω\omega be a primitive NtN_t-th root of unity in Zq\mathbb{Z}_q and ζ=ωNt/K\zeta = \omega^{N_t/K}. The map ϕ(f)=(f(ζ2i+1))0≤i<m\phi(f) = (f(\zeta^{2i+1}))_{0 \le i < m} is a ring isomorphism R→ZqmR \to \mathbb{Z}_q^m. The element ρ\rho with ϕ(ρ)=(ω2i+1)i\phi(\rho) = (\omega^{2i+1})_i satisfies ρNt/K=x\rho^{N_t/K} = x, and ρ\rho is a principal NtN_t-th root of unity in RR: ρNt=1\rho^{N_t} = 1, and ∑j=0Nt−1ρjk=0\sum_{j=0}^{N_t - 1} \rho^{jk} = 0 for k≢0(modNt)k \not\equiv 0 \pmod{N_t}.

Proof. ζ\zeta has order K=2mK = 2m, so ζm=−1\zeta^m = -1, and the mm numbers ζ2i+1\zeta^{2i+1} are distinct roots of xm+1x^m + 1. Hence xm+1=∏i(x−ζ2i+1)x^m + 1 = \prod_i (x - \zeta^{2i+1}) over the field Zq\mathbb{Z}_q, the factors are pairwise coprime, and ϕ\phi is an isomorphism by the Chinese remainder theorem. Then ϕ(ρNt/K)=(ω(2i+1)Nt/K)i=(ζ2i+1)i=ϕ(x)\phi(\rho^{N_t/K}) = (\omega^{(2i+1)N_t/K})_i = (\zeta^{2i+1})_i = \phi(x), so ρNt/K=x\rho^{N_t/K} = x. Each coordinate ω2i+1\omega^{2i+1} is a primitive NtN_t-th root of unity, since 2i+12i + 1 is odd and NtN_t is a power of 2. So ρNt=1\rho^{N_t} = 1, and for k≢0k \not\equiv 0 each coordinate of ϕ(∑jρjk)\phi(\sum_j \rho^{jk}) is a geometric sum ∑jω(2i+1)jk=0\sum_j \omega^{(2i+1)jk} = 0, because ω(2i+1)k≠1\omega^{(2i+1)k} \ne 1 and its NtN_t-th power is 1. □\square

Lemma 2 (shifts). For each integer ee, SHIFT computes a⋅xea \cdot x^e in RR.

Proof. x2m=1x^{2m} = 1 in RR, so only e mod 2me \bmod 2m matters, and xm=−1x^m = -1 turns e≥me \ge m into a sign and e−me - m. Then xe∑iaixi=∑iaixi+ex^e \sum_i a_i x^i = \sum_i a_i x^{i+e}, and each term with i+e≥mi + e \ge m is −aixi+e−m-a_i x^{i + e - m}, which is what the code writes. □\square

Lemma 3 (FFT). If ∣v∣⋅s=Nt|v| \cdot s = N_t and ∣v∣=Kℓ|v| = K^\ell with ℓ≥1\ell \ge 1, then FFT(v,s,σ)(v, s, \sigma) returns Xk=∑n<∣v∣vnωnkX_k = \sum_{n < |v|} v_n \omega^{nk} for 0≤k<∣v∣0 \le k < |v|, with ω=ρσs\omega = \rho^{\sigma s}.

Proof. By induction on ℓ\ell. If ℓ=1\ell = 1, then s=Nt/Ks = N_t/K and ω=ρσNt/K=xσ\omega = \rho^{\sigma N_t/K} = x^\sigma by Lemma 1, and line L6 computes the DFT with root xσx^\sigma by the radix-2 recursion, which is correct for each element ω\omega with ωK=1\omega^{K} = 1, using ωK/2=xσm=−1\omega^{K/2} = x^{\sigma m} = -1; its multiplications are by powers of xx and are correct by Lemma 2. If ℓ≥2\ell \ge 2, let J=Kℓ−1J = K^{\ell - 1}, and write n=Jn2+n1n = J n_2 + n_1 and k=k1+Kk2k = k_1 + K k_2 with n1,k2<Jn_1, k_2 < J and n2,k1<Kn_2, k_1 < K. Since ωJK=ω∣v∣=ρσNt=1\omega^{JK} = \omega^{|v|} = \rho^{\sigma N_t} = 1,

ωnk=ωJn2k1⋅ωn1k1⋅ωKn1k2.\omega^{nk} = \omega^{J n_2 k_1} \cdot \omega^{n_1 k_1} \cdot \omega^{K n_1 k_2}.

So Xk1+Kk2=∑n1ωKn1k2(ωn1k1∑n2vJn2+n1(ωJ)n2k1)X_{k_1 + K k_2} = \sum_{n_1} \omega^{K n_1 k_2} \left( \omega^{n_1 k_1} \sum_{n_2} v_{J n_2 + n_1} (\omega^{J})^{n_2 k_1} \right). Here ωJ=ρσsJ\omega^J = \rho^{\sigma s J} with sJ=Nt/KsJ = N_t/K, so the inner sum is the DFT of length KK that line L7 computes by the induction hypothesis with stride Nt/KN_t/K. Line L8 multiplies its k1k_1-th entry by ωn1k1\omega^{n_1 k_1}, skipping the factors equal to 1. The outer sum is the DFT of length JJ with root ωK=ρσsK\omega^K = \rho^{\sigma s K}, which line L9 computes with stride sKsK, where J⋅sK=NtJ \cdot sK = N_t, by the induction hypothesis. Line L9 stores it at index k1+Kk2k_1 + K k_2. □\square

Lemma 4 (inversion). If c^=FFT(c,1,+1)\hat c = \mathrm{FFT}(c, 1, +1), then FFT(c^,1,−1)=Ntc(\hat c, 1, -1) = N_t c.

Proof. By Lemma 3 the nn-th entry of FFT(c^,1,−1)(\hat c, 1, -1) is ∑k∑jcjρjkρ−nk=∑jcj∑kρ(j−n)k=Ntcn\sum_k \sum_j c_j \rho^{jk} \rho^{-nk} = \sum_j c_j \sum_k \rho^{(j - n)k} = N_t c_n, by Lemma 1. □\square

Theorem. If u,v<2(Nt/2)(m/2)bu, v < 2^{(N_t/2)(m/2) b} and (Nt/2)(m/2)(β−1)2<q(N_t/2)(m/2)(\beta - 1)^2 < q, then FURER-MULTIPLY returns uvuv.

Proof. Line L1 writes u=∑j<Nt/2∑t<m/2uj,tβt+jm/2u = \sum_{j < N_t/2} \sum_{t < m/2} u_{j,t} \beta^{t + j m/2} with 0≤uj,t<β0 \le u_{j,t} < \beta, and sets aj=∑tuj,txta_j = \sum_t u_{j,t} x^t for j<Nt/2j < N_t/2 and aj=0a_j = 0 for j≥Nt/2j \ge N_t/2; the same for vv and bjb_j. By Lemma 3 and the convolution property, which follows from Lemma 4 in the usual way, c=FFT(a^⋅b^,1,−1)/Ntc = \mathrm{FFT}(\hat a \cdot \hat b, 1, -1)/N_t is the cyclic convolution cn=∑j+j′≡n(modNt)ajbj′c_n = \sum_{j + j' \equiv n \pmod{N_t}} a_j b_{j'} in RR. Since aja_j and bj′b_{j'} vanish for j,j′≥Nt/2j, j' \ge N_t/2, only pairs with j+j′=n<Nt−1j + j' = n < N_t - 1 contribute, and there is no wrap. Each ajbj′a_j b_{j'} has degree at most m−2<mm - 2 < m in xx, so it is the plain product of the polynomials, with no use of xm=−1x^m = -1. Hence the coefficient of xtx^t in cnc_n, as an integer, is ∑uj,svj′,s′\sum u_{j,s} v_{j',s'} over j+j′=nj + j' = n and s+s′=ts + s' = t, a sum of at most (Nt/2)(m/2)(N_t/2)(m/2) terms each at most (β−1)2(\beta - 1)^2, so it is less than qq and its residue modulo qq is the integer itself. Line L5 computes ∑n∑tcn,tβt+nm/2\sum_n \sum_t c_{n,t} \beta^{t + n m/2}, which is

∑j,s∑j′,s′uj,svj′,s′β(s+s′)+(j+j′)m/2=uv.■\sum_{j, s} \sum_{j', s'} u_{j,s} v_{j',s'} \beta^{(s + s') + (j + j') m/2} = uv. \qquad \blacksquare

Back to Fürer's multiplication