Discrete Fourier Transform (DFT) theorems over mathlib ℂ #
TorchLean’s runtime FFT building blocks (NN.Runtime.Autograd.TorchLean.Fft) implement FFT/IFFT by
explicit DFT matrices. This file proves the corresponding exact math facts over mathlib’s complex
numbers ℂ:
- the inverse DFT matrix is a left inverse of the DFT matrix, and therefore
ifft (fft x) = xfor vectors.
We prove these statements in the mathlib Matrix world first. That choice is deliberate:
primitive roots of unity, conjugate transposes, geometric sums, and matrix inverse facts already
live cleanly in mathlib for ℂ.
The TorchLean runtime FFT code uses shape-indexed tensors and scalar-polymorphic twiddle factors
written with cos/sin. Connecting that runtime representation to these exact matrices is a
separate transport theorem in NN.Proofs.Analysis.FftBridge. Keeping the files split avoids making
the pure DFT algebra import the runtime/autograd stack.
References:
- Any standard Fourier analysis / numerical linear algebra text (this is the classical DFT inversion formula).
- For the primitive-root-of-unity facts used here, we rely on mathlib’s
Complex.isPrimitiveRoot_expand the geometric-sum identitymul_geom_sum.
DFT / IDFT matrices #
Primitive n-th root of unity: ζₙ = exp(2π i / n).
Instances For
The “negative-frequency” root used by the DFT: ωₙ = ζₙ⁻¹ = exp(-2π i / n).
Instances For
Inversion theorem #
The proof follows the textbook orthogonality argument. The (i,k) entry of IDFT * DFT is
(1/n) * ∑ j, (ζ^i * (ζ^k)⁻¹)^j.
If i = k, the ratio is 1 and the sum is n. If i ≠ k, the ratio is a nontrivial n-th root
of unity, so the geometric sum is 0.
Main algebraic identity: IDFT * DFT = 1 (over ℂ), for n ≠ 0.
This is the standard DFT inversion theorem.
Orthogonality / unitary form #
On ℂ, the inverse DFT matrix is a scaled conjugate transpose of the DFT matrix:
F⁻¹ = (1/n) • Fᴴ.
Orthogonality identity (unitary form): Fᴴ * F = n • 1.
Equivalently, the DFT columns form an orthogonal basis with squared norm n.
Right-inverse form: DFT * IDFT = 1 (for n ≠ 0).