The QFT circuit (4.4) maps |a⟩ to q^{-1/2} ∑_b exp(2πiac/q)|b⟩, c = bit reversal of b
ProvedShorAlgorithms.QFT.qft_circuit_eqLet and . Run Shor's gate sequence (4.4),
(applied from left to right; the one-bit gate (4.2) on bit , the two-bit phase gate (4.3) with angle ), on the basis state , where . The result is the state
the sum over all -bit strings , where with is the bit reversal of .
Since the entry of Shor's Fourier matrix (eq. (4.1)) is , the circuit computes followed by a reversal of the order of the output bits. The circuit consists of one-bit gates and two-bit gates, which is what makes the Fourier sampling steps of Shor's factoring and discrete logarithm algorithms efficient.
Formalization Note The statement is made on basis states , as in the paper; by linearity of the circuit it determines the action on every state. The conclusion is an equality of functions: the output amplitude at every bit string is . The case (, empty circuit) is included.
import Mathlib import Definitions.Def_ShorAlgorithms_QFT_BitStrings import Definitions.Def_ShorAlgorithms_QFT_Circuit
namespace ShorAlgorithms.QFT
/-- Shor 1997, §4, p. 1496: with `q = 2^l`, the gate sequence (4.4) takes the basis state `|a⟩`
to `q^{-1/2} ∑_b exp(2π i a c / q) |b⟩`, where `c` is the bit reversal of `b`. That is, the
circuit computes the Fourier transform `A_q` of eq. (4.1) followed by a reversal of the output
bits. -/
theorem qft_circuit_eq (l : ℕ) (a : Fin l → Fin 2) :
runCircuit (qftGates l) (basisState a) =
fun b => ((Real.sqrt (2 ^ l) : ℝ) : ℂ)⁻¹ *
Complex.exp (2 * Real.pi * Complex.I * (bitsVal a : ℂ) * (bitsVal (bitRev b) : ℂ) /
2 ^ l) := by sorry
end ShorAlgorithms.QFT
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.