The discrete Fourier transform over a commutative ring #
For an element ω of a commutative ring R, Cslib.dft ω a is the discrete Fourier transform
of a vector a : Fin n → R, that is, the evaluation of the polynomial ∑ i, a i X ^ i at the
points ω ^ j for j < n ([CLRS09], Section 30.2). Mathlib's ZMod.dft is the
complex-valued transform built on ZMod.stdAddChar. Here the ring is arbitrary and the root of
unity is explicit, which covers number-theoretic transforms over ZMod p and the rings used in
fast integer multiplication.
Main definitions #
Cslib.dft ω a: the vectorj ↦ ∑ i, a i * ω ^ (i * j).Cslib.cyclicConv a b: the cyclic convolutionk ↦ ∑ i, a i * b (k - i)overFin n.
Main results #
Cslib.dft_eq_vandermonde_mulVec: the DFT is multiplication by the Vandermonde matrix of the powers ofω.Cslib.dft_coeff_eq_eval: the DFT of a coefficient vector evaluates the polynomial.Cslib.dft_cyclicConv: the convolution theorem ([CLRS09], Theorem 30.8, in cyclic form), for anyωwithω ^ n = 1.Cslib.dft_dft_neg: the inversion formuladft ω (dft ω a) (-j) = n * a jfor a principaln-th root of unityω.Cslib.dft_eq_add_of_lt,Cslib.dft_eq_sub_of_le: the Cooley–Tukey splitting of a transform of even length2 minto two transforms of lengthmwith respect toω ^ 2, underω ^ m = -1for the upper half ([CT65]; [CLRS09], Section 30.2).Cslib.cyclicConv_coeff: the cyclic convolution of coefficient vectors is the product whennatDegree p + natDegree q < n.
References #
The DFT of the coefficient vector of a polynomial of degree less than n evaluates the
polynomial at the powers of ω.
DFT inversion: for a principal n-th root of unity ω, applying the transform twice and
negating the index multiplies by n. When n is a unit, a = n⁻¹ • (dft ω (dft ω a) ∘ Neg.neg).
Cooley–Tukey splitting, lower half. For n = 2 m and j < m, the transform of length
n at j combines the length-m transforms of the even and odd parts with respect to ω ^ 2:
dft ω a j = E j + ω ^ j * O j.
The cyclic convolution of the coefficient vectors of p and q is the coefficient vector
of p * q when natDegree p + natDegree q < n, since then no index wraps around.