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
- $\operatorname{ifft}(\operatorname{fft}(x))=x$ for 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 implementation.
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:
$\zeta_n=\exp(2\pi i/n)$.
Instances For
The negative-frequency root used by the DFT: $\omega_n=\zeta_n^{-1}=\exp(-2\pi i/n)$.
Instances For
Inversion theorem #
The proof follows the textbook orthogonality argument. The $(i,k)$ entry of $\operatorname{IDFT}\operatorname{DFT}$ is
$$ \frac1n\sum_j\left(\zeta^i(\zeta^k)^{-1}\right)^j. $$
If $i=k$, the ratio is $1$ and the sum is $n$. If $i\ne k$, the ratio is a nontrivial $n$-th root of unity, so the geometric sum is $0$.
Main algebraic identity: $\operatorname{IDFT}\operatorname{DFT}=I$ (over ℂ), for $n\ne0$.
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^{-1}F^{\mathrm H}$.
Orthogonality identity (unitary form): $F^{\mathrm H}F=nI$.
Equivalently, the DFT columns form an orthogonal basis with squared norm $n$.
Right-inverse form: $\operatorname{DFT}\operatorname{IDFT}=I$ (for $n\ne0$).