Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

With polynomial parameters the quantum program fails with probability at most 2∣D∣E+2−T2|D|E+2^{-T}2∣D∣E+2−T

Proved
OPI.Lay.final_bound

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

lean-formalizationquantum-algorithmstwo-fold-opi-construction

Let FFF be a presented finite field with q≥2q\ge2q≥2 elements and LLL qubits per symbol, HHH an r×mr\times mr×m matrix over FFF, and gen\mathrm{gen}gen a flag. The code CCC is the row space of HHH (if gen\mathrm{gen}gen) or its kernel, D=C⊥D=C^\perpD=C⊥, E=schurFailureSum(D)E=\mathrm{schurFailureSum}(D)E=schurFailureSum(D), and kd=dim⁡Dk_d=\dim Dkd​=dimD, which is assumed to be ≥1\ge1≥1 (so D≠0D\ne0D=0). Let β∈Fm\beta\in F^mβ∈Fm be the forbidden values and A={x:xi≠βi ∀i}A=\{x:x_i\ne\beta_i\ \forall i\}A={x:xi​=βi​ ∀i}.

For a security parameter T∈NT\in\mathbb NT∈N put B=T+mL+m+2L+12B=T+mL+m+2L+12B=T+mL+m+2L+12. The program progFinal\mathrm{progFinal}progFinal is progQ\mathrm{progQ}progQ with

  • gradient width and QFTq\mathrm{QFT}_qQFTq​ precision b=t=2Bb=t=2Bb=t=2B,
  • repeat-until-success cap R=2q (T+10+J)R=2q\,(T+10+J)R=2q(T+10+J), where JJJ is the number of repeat-until-success jobs,
  • K=T+3K=T+3K=T+3 trials,
  • Nt=2T+6+(2B−1)N_t=2T+6+(2B-1)Nt​=2T+6+(2B−1) majority tests per gradient bit.

Let "event" be any property of the output that holds whenever the output bits decode to a word of C∩AC\cap AC∩A.

Statement. Started from the all-zero state, with any initial classical memory,

1−Pr⁡[event] ≤ 2 ∣D∣ E+2−T.1-\Pr[\text{event}]\ \le\ 2\,|D|\,E+2^{-T}.1−Pr[event] ≤ 2∣D∣E+2−T.

This is the formal version of the success guarantee of Theorem 7.4 for D≠0D\ne0D=0. All parameters are polynomial in TTT, mmm and LLL, so the program has polynomial size.

Preamble
import Definitions.Def_TwoFoldOPI_CL_Part04
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.Lay
open QAlgorithms TwoFoldOPI
open SymEnc
variable (F : AvgCaseTI.FieldPres) (m : ℕ) {r : ℕ} (gen : Bool) (H : Matrix (Fin r) (Fin m) F.F) (T : ℕ)
local notation "LL" => bitsPerSymbol F
local notation "BB" => Bpar T m (bitsPerSymbol F)
local notation "KD" => kdOf F m gen H
local notation "NNf" => total (parOf F m (2 * Bpar T m (bitsPerSymbol F)) (2 * Bpar T m (bitsPerSymbol F) - 1 + 1)
  (SymEnc.nIds m (kdOf F m gen H) (kdOf F m gen H * kdOf F m gen H)))
set_option maxHeartbeats 2000000
open Classical
Formal statement
theorem OPI.Lay.final_bound (hq : 2 ≤ Fintype.card F.F) (hkd : 1 ≤ KD) (β : Fin m → F.F) {c : ℕ} (dG dz dst : Fin c)
    (slot : Fin (m * LL) → Fin c) (hslot : Function.Injective slot)
    (event : Option (Fin (m * LL) → Bool) → Prop)
    (hev : ∀ bits, decodeWord F m bits ∈ codeOf gen H ∧ decodeWord F m bits ∈ targetSet β → event (some bits))
    (mem : Fin c → Bool) :
    1 - lawP (progFinal F m gen H T β dG dz dst slot hslot) event (sysZero (NNf + (2 * BB - 1 + 1))) mem ≤
      2 * (Dfin gen H).card * schurFailureSum (CodingTheory.dualCode F.F (Fin m) (codeOf gen H)) + (1 / 2) ^ T := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/db81d0d4e3fa008609ed37789a2eb2f6f08ee48d/WorkInProgress/QuantumOPIVariants/OPI/FinalBound.lean#L74-L248

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