Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The generator's quantum segment is realizable from the instance data

Proved
OPI.W6.IsPR.GenR.qSegG_seg

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

lean-formalizationquantum-algorithmstwo-fold-opi-construction

The generator reads from its input a record uuu of natural-number data (Nums): the characteristic ppp, the degree eee and coefficient list fl\mathrm{fl}fl of fff, the length mmm, the flag gen\mathrm{gen}gen and coordinates HcH_cHc​ of the matrix defining the code, the bit encodings of the target β\betaβ, the parameter TTT, w=⌈log⁡2p⌉w = \lceil\log_2 p\rceilw=⌈log2​p⌉, L=ewL = e wL=ew, q=min⁡(pe,n+1)q = \min(p^e, n+1)q=min(pe,n+1) (nnn the input length) and the table budget Nb=8q8N_b = 8 q^8Nb​=8q8. It is coded as the tuple of its fields.

From uuu it computes the quantum segment

qSegG(u)=qSegN(Xu, 2Bu, M,M,M, T+3, 2q(T+10+Ju), 2T+6+(2Bu−1), kD(u), jobsu, pivu, TG(u), zT(u), Cf(u), [0,M)),\mathrm{qSegG}(u) = \mathrm{qSegN}\big(X_u,\ 2B_u,\ M, M, M,\ T+3,\ 2q(T+10+J_u),\ 2T+6+(2B_u-1),\ k_D(u),\ \mathrm{jobs}_u,\ \mathrm{piv}_u,\ T_G(u),\ z_T(u),\ C_f(u),\ [0, M)\big),qSegG(u)=qSegN(Xu​, 2Bu​, M,M,M, T+3, 2q(T+10+Ju​), 2T+6+(2Bu​−1), kD​(u), jobsu​, pivu​, TG​(u), zT​(u), Cf​(u), [0,M)),

with M=mLM = mLM=mL, Bu=T+mL+m+2L+12B_u = T + mL + m + 2L + 12Bu​=T+mL+m+2L+12, XuX_uXu​ the wire layout, JuJ_uJu​ the number of repeat-until-success jobs, and kD(u)k_D(u)kD​(u), pivu\mathrm{piv}_upivu​, TG(u)T_G(u)TG​(u), Cf(u)C_f(u)Cf​(u) the dimension of the dual code, the pivots, the shift tables and the trial-circuit gate list. These are all obtained from first-order row reduction of HcH_cHc​ and the budgeted lookup tables. Here qSegN\mathrm{qSegN}qSegN is the segment of the quantum program (phase-gradient preparation followed by T+3T+3T+3 retries of a trial), producing, from a continuation index kkk and start position sss, the DAG nodes placed at s,s+1,…s, s+1, \ldotss,s+1,….

Statement. The segment family u↦qSegG(u)u \mapsto \mathrm{qSegG}(u)u↦qSegG(u) is realizable, i.e. (u,k,s)↦qSegG(u)(k,s)(u, k, s) \mapsto \mathrm{qSegG}(u)(k, s)(u,k,s)↦qSegG(u)(k,s) has a polynomial realizer (running charge and output size polynomial in the input size).

This covers the quantum branch of the generator (the other branch outputs a trivial program when kD=0k_D = 0kD​=0), and is the main ingredient of the proof that the whole generator runs in polynomial time.

Preamble
import Definitions.Def_TwoFoldOPI_CL_Part05
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.W6 OPI.W6.IsPR
open OAI.ThreeMachine.StackCompiler
open Gen Lay TD RRefC FM SymEnc
variable {α : Type} [Coding α]
Formal statement
theorem OPI.W6.IsPR.GenR.qSegG_seg : SegPR (fun u : Nums => qSegG u) := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/f7224a159e790347c1a83c5ac23c63e5094a6a2c/WorkInProgress/QuantumOPIVariants/OPI/GenR.lean#L122-L127

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