Documentation

CslibFrontier.Foundations.Quantum.Fourier

The quantum Fourier transform over ZMod N #

The quantum Fourier transform over the cyclic group ZMod N is the unitary matrix F_N(j, k) = ω^{jk} / √N with ω = e^{2πi/N} (Cslib.Quantum.qft), acting on a register whose computational basis is ZMod N. Its entries are ZMod.stdAddChar (j * k) / √N, and its unitarity is the orthogonality of the characters of ZMod N (AddChar.sum_mulShift). As a map on amplitude vectors it is √N times Mathlib's inverse discrete Fourier transform ZMod.dft.symm (𝓕⁻), whose sign convention it shares; it is the transform A_q of Shor, §4, eq. (4.1), with q = N, and F_N of de Wolf, §4.1 and §4.4. For N = 2 it is the Hadamard gate.

This module gives the transform as a matrix; it does not give a circuit for it. The polynomial-size circuit for N = 2^n (de Wolf, §4.5) is not formalized.

Main definitions #

Main results #

References #

theorem Cslib.Quantum.sqrt_inv_mul_sqrt_inv (N : ℕ) :
↑(√↑N)⁻¹ * ↑(√↑N)⁻¹ = (↑N)⁻¹

(√N)⁻¹ · (√N)⁻¹ = N⁻¹ in ℂ: the squared normalization of a uniform superposition over N basis states.

noncomputable def Cslib.Quantum.qft (N : ℕ) [NeZero N] :

The quantum Fourier transform over ZMod N: the unitary matrix with entries F_N(j, k) = ω^{jk} / √N, ω = e^{2πi/N} (Shor, §4, eq. (4.1); de Wolf, §4.1).

theorem Cslib.Quantum.qft_apply {N : ℕ} [NeZero N] (j k : ZMod N) :
↑(qft N) j k = ↑(√↑N)⁻¹ * ZMod.stdAddChar (j * k)
theorem Cslib.Quantum.qft_apply_eq_exp {N : ℕ} [NeZero N] (j k : ZMod N) :
↑(qft N) j k = Complex.exp (2 * ↑Real.pi * Complex.I * ↑j.val * ↑k.val / ↑N) / ↑√↑N

The entries of the quantum Fourier transform are exp(2πi · j k / N) / √N, computed from the canonical representatives j.val, k.val ∈ [0, N).

theorem Cslib.Quantum.qft_mulVec {N : ℕ} [NeZero N] (v : ZMod N → ℂ) :
(↑(qft N)).mulVec v = ↑√↑N • ZMod.dft.symm v

The quantum Fourier transform acts on amplitude vectors as √N times Mathlib's inverse discrete Fourier transform 𝓕⁻ = ZMod.dft.symm.