Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Error of the QFTq\mathrm{QFT}_qQFTq​ gadget: e (2π/2b+2p/2t)e\,(2\pi/2^b+2p/\sqrt{2^t})e(2π/2b+2p/2t​)

Proved
OPI.QQ.err

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

lean-formalizationquantum-algorithmstwo-fold-opi-construction

Let K=FqK=\mathbb F_qK=Fq​, q=peq=p^eq=pe, be given by a field presentation, with symbols encoded on L=e⋅wL=e\cdot wL=e⋅w qubits (power-basis coordinates in eee blocks of w=⌈log⁡2p⌉w=\lceil\log_2 p\rceilw=⌈log2​p⌉ bits). A QFTq\mathrm{QFT}_qQFTq​ gadget QQQ consists of:

  • a symbol register XXX of LLL qubits;
  • eee QFTp\mathrm{QFT}_pQFTp​ gadgets G1,…,GeG_1,\dots,G_eG1​,…,Ge​ whose data registers are the blocks of XXX, pairwise compatible and sharing one clean set clclcl, each with resource register BjB_jBj​ and control register CjC_jCj​;
  • a reversible re-encoding PRP_RPR​ with scratch inside clclcl, which maps the power-basis encoding of xxx to its trace-dual coordinates (tr(xXj))j(\mathrm{tr}(xX^j))_j(tr(xXj))j​.

Its system unitary is U=UGe⋯UG1PRU=U_{G_e}\cdots U_{G_1}P_RU=UGe​​⋯UG1​​PR​. Let QqQ_qQq​ be the QFT over Fq\mathbb F_qFq​ on symbols, Qq[z,z′]=ψ(dec(z)dec(z′))/qQ_q[z,z']=\psi(\mathrm{dec}(z)\mathrm{dec}(z'))/\sqrt qQq​[z,z′]=ψ(dec(z)dec(z′))/q​ on valid symbols with ψ(a)=e2πi tr(a)/p\psi(a)=e^{2\pi i\,\mathrm{tr}(a)/p}ψ(a)=e2πitr(a)/p, and ∣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⟩.

Statement. Assume p>0p>0p>0 and t≥1t\ge1t≥1. Let ggg satisfy, on its support: XXX holds a valid symbol, the re-encoding scratch is clean, and for every GjG_jGj​ the registers BjB_jBj​, CjC_jCj​ are 000 and its accumulator and scratch are clean. Then

∥U(∣up⟩B1⊗⋯⊗∣up⟩Be⊗g)−Qq(X)g∥≤e(2π2b+2p2t)∥g∥.\big\|U\big(|u_p\rangle_{B_1}\otimes\cdots\otimes|u_p\rangle_{B_e}\otimes g\big)-Q_q^{(X)}g\big\|\le e\Big(\frac{2\pi}{2^b}+\frac{2p}{\sqrt{2^t}}\Big)\|g\| .​U(∣up​⟩B1​​⊗⋯⊗∣up​⟩Be​​⊗g)−Qq(X)​g​≤e(2b2π​+2t​2p​)∥g∥.

The decoder applies this gadget to both symbols of every coordinate. The bound enters its total error, of order mεm\varepsilonmε.

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.QQ
open QAlgorithms TwoFoldOPI Matrix
variable {n b : ℕ}
variable {F : AvgCaseTI.FieldPres} {t : ℕ} (Q : QQ n b F t)
Formal statement
theorem OPI.QQ.err (hp : 0 < F.p) (ht : 1 ≤ t) (g : Qubits n → ℂ)
    (hg : ∀ z, g z ≠ 0 → Fq.Valid F (z ∘ Q.X) ∧ Q.RC z ∧
      ∀ G ∈ Q.Gs, z ∘ G.bE = (fun _ => false) ∧ z ∘ G.cE = (fun _ => false) ∧ G.C z) :
    vnorm (Q.U.mulVec (QG.prepAll Q.Gs g) - (embedOp (Fq.Qq F) Q.X).mulVec g) ≤
      F.f.natDegree * (2 * Real.pi / 2 ^ b + 2 * (F.p / Real.sqrt (2 ^ t))) * 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/QFTqGad.lean#L247-L295

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