Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The QFTp\mathrm{QFT}_pQFTp​ gadget with exact phase is within 2δ2\sqrt{\delta}2δ​ of the ideal QFT

Proved
OPI.QLay.main_ideal

by sragavan · Nov 11, 2026 · Mathlib 0df444a (Lean v4.33.1)

lean-formalizationquantum-algorithmstwo-fold-opi-construction

Fix a layout of the QFTp\mathrm{QFT}_pQFTp​ gadget on nnn qubits: a data register AAA and a resource register BBB (www qubits each, values read in binary), a control register CCC of ttt qubits, an accumulator and lookup scratch. Consider the operator

W=S Q† τ Q Dideal,W=S\,Q^\dagger\,\tau\,Q\,D_{\mathrm{ideal}},W=SQ†τQDideal​,

where Dideal∣a⟩A∣y⟩B=ωpay∣a⟩A∣y⟩BD_{\mathrm{ideal}}|a\rangle_A|y\rangle_B=\omega_p^{ay}|a\rangle_A|y\rangle_BDideal​∣a⟩A​∣y⟩B​=ωpay​∣a⟩A​∣y⟩B​ with ωp=e2πi/p\omega_p=e^{2\pi i/p}ωp​=e2πi/p. QQQ is phase estimation (QFT on CCC, controlled shifts of BBB by 2j2^j2j modulo ppp, QFT on CCC). τ\tauτ sets A←A−r(ℓ) mod pA\leftarrow A-r(\ell)\bmod pA←A−r(ℓ)modp, where r(ℓ)=⌊(2t−1+pℓ)/2t⌋ mod pr(\ell)=\lfloor(2^{t-1}+p\ell)/2^t\rfloor\bmod pr(ℓ)=⌊(2t−1+pℓ)/2t⌋modp is the rounded estimate from the control value ℓ\ellℓ, and restores the accumulator. SSS swaps AAA and BBB.

For x<px<px<p let badMass(p,t,x)\mathrm{badMass}(p,t,x)badMass(p,t,x) be the total squared amplitude that phase estimation of the Fourier vector x^\hat xx^ puts on control values ℓ\ellℓ with r(ℓ)≠xr(\ell)\ne xr(ℓ)=x.

Statement. Assume 0<p≤2w0<p\le 2^w0<p≤2w. Let ggg satisfy, on its support: B=0B=0B=0, C=0C=0C=0, accumulator and scratch clean, and A<pA<pA<p. Let δ\deltaδ be such that badMass(p,t,x)≤δ\mathrm{badMass}(p,t,x)\le\deltabadMass(p,t,x)≤δ for all x<px<px<p. Then, with ∣up⟩=p−1/2∑y<p∣y⟩|u_p\rangle=p^{-1/2}\sum_{y<p}|y\rangle∣up​⟩=p−1/2∑y<p​∣y⟩,

∥W(∣up⟩B⊗g)−QFTp(A)g∥≤2δ ∥g∥.\big\|W(|u_p\rangle_B\otimes g)-\mathrm{QFT}_p^{(A)}g\big\|\le 2\sqrt{\delta}\,\|g\| .​W(∣up​⟩B​⊗g)−QFTp(A)​g​≤2δ​∥g∥.

This is the analytic core of the QFTp\mathrm{QFT}_pQFTp​ gadget. The implemented gadget differs from WWW only in the rounded table phase, which is handled separately.

Preamble
import Definitions.Def_TwoFoldOPI_CL_Part01
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Circuit
import Definitions.Def_QAlgorithms_Defs_GradientMethods
import Definitions.Def_QAlgorithms_Defs_OPIOraclePrograms
import Definitions.Def_QAlgorithms_Defs_OPIUniformity
import Definitions.Def_QAlgorithms_Defs_Fourier
import Definitions.Def_TwoFoldOPI_elemBits
import Definitions.Def_TwoFoldOPI_schurSquare
import Definitions.Def_TwoFoldOPI_schurFailureSum
import Definitions.Def_CodingTheory
import Definitions.Def_OAIThreeMachineSched01
import Definitions.Def_CookLevin_Cost
import Definitions.Def_TwoFoldOPI_codeOf
import Definitions.Def_TwoFoldOPI_solves
import Definitions.Def_TwoFoldOPI_Input
import Definitions.Def_TwoFoldOPI_CLSerializableF
open OPI OPI.QLay
open QAlgorithms Matrix
variable {n : ℕ}
variable {p w t : ℕ} (L : QLay n p w t)
Formal statement
theorem OPI.QLay.main_ideal (hp : 0 < p) (hpw : p ≤ 2 ^ w) (g : Qubits n → ℂ) (hg : L.Dom g) (δ : ℝ)
    (hδ : ∀ x < p, badMass p t x ≤ δ) :
    vnorm ((L.swM * L.Qmᴴ * L.tauM * L.Qm * L.Dideal).mulVec (bfac L.bE (fvec p w 0) g) -
      (embedOp (qftP p w) L.aE).mulVec g) ≤ 2 * Real.sqrt δ * vnorm g := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/db81d0d4e3fa008609ed37789a2eb2f6f08ee48d/WorkInProgress/QuantumOPIVariants/OPI/QFTpMain.lean#L494-L562

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me