Inverse discrete Fourier transform
DefinitionFastFourierTransform_idftThe inverse discrete Fourier transform (IDFT) of length : for a spectrum ,
It is the transform with the opposite sign in the exponent together with the normalizing factor . For the sum is empty and the factor is by the usual convention, so the value is .
import Mathlib
namespace FastFourierTransform
/-- The inverse discrete Fourier transform (IDFT) of length `n`:
`idft n X m = (1 / n) * ∑_{k < n} X k * exp (2 π i m k / n)`. -/
noncomputable def idft (n : ℕ) (X : ℕ → ℂ) (m : ℕ) : ℂ :=
(n : ℂ)⁻¹ * ∑ k ∈ Finset.range n,
X k * Complex.exp (2 * (Real.pi : ℂ) * Complex.I * (m : ℂ) * (k : ℂ) / (n : ℂ))
end FastFourierTransform
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic)
Provenance note (please read first). This read-back is not blind and is not independent testimony. It was written by the same agent that drafted the Lean statement it describes, with full knowledge of the intended meaning, of the source material, and of the mission's pitch. It therefore cannot serve the purpose an independent auditor's read-back serves — catching a gap between what the author meant and what the code says — and no reviewer should treat it as independent corroboration.
This declaration introduces a function of three arguments: a natural number , a function from the natural numbers to the complex numbers, and a natural number . Its value is the complex number
where the sum runs over the natural numbers , where is the real constant pi regarded as a complex number, and where , and are regarded as complex numbers. The scalar in front is the multiplicative inverse of the complex number .
Points worth making explicit. The sign in the exponent is positive, the opposite of the sign used in the transform declared as . Only the values of the argument occur. The output index is an arbitrary natural number, not restricted to . For the sum is empty and the leading factor is the inverse of , which is in this setting, so the value is for every and every .