Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The generated DAG represents the constructed program

Proved
OPI.Gen.genDag_rep

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

lean-formalizationquantum-algorithmstwo-fold-opi-construction

Setting. An instance xxx of the two-fold OPI problem of Theorem 7.4 consists of a finite field F=Fp[X]/(f)F=\mathbb F_p[X]/(f)F=Fp​[X]/(f) (e=deg⁡fe=\deg fe=degf, q=peq=p^eq=pe), a length mmm, a matrix HHH with a flag gen\mathrm{gen}gen defining a code CCC, forbidden values β∈Fm\beta\in F^mβ∈Fm and a precision ttt. Let D=C⊥D=C^\perpD=C⊥. The construction constructQ(x)\mathrm{constructQ}(x)constructQ(x) is a packed program with no oracles. It is a classical program writing a fixed solution if dim⁡D=0\dim D=0dimD=0, and the quantum Regev-style program otherwise. For a program tree PPP on NNN qubits with ccc classical bits and out\mathrm{out}out output bits, packP(P)\mathrm{packP}(P)packP(P) is the packed program with no oracles and these dimensions.

A first-order DAG is a list of nodes (tag, fields, list of children). Rep(dag,i,P)\mathrm{Rep}(\mathrm{dag},i,P)Rep(dag,i,P) means that node iii represents the program tree PPP: its tag and fields are those of the root of PPP, its children have smaller indices and represent the subprograms, and PPP makes no oracle queries.

Before serialization, the generator outputs genDag(n,parsedOf(x))=(header,dag,root)\mathrm{genDag}(n,\mathrm{parsedOf}(x))=(\mathrm{header},\mathrm{dag},\mathrm{root})genDag(n,parsedOf(x))=(header,dag,root), computed with natural-number arithmetic from the parsed input and the input length nnn.

Statement. If pe≤np^e\le npe≤n, there exist N,c,out∈NN,c,\mathrm{out}\in\mathbb NN,c,out∈N and a program PPP with these dimensions such that

  • constructQ(x)=packP(P)\mathrm{constructQ}(x)=\mathrm{packP}(P)constructQ(x)=packP(P),
  • the header is [0,N,c,out][0,N,c,\mathrm{out}][0,N,c,out], and
  • Rep(dag,root,P)\mathrm{Rep}(\mathrm{dag},\mathrm{root},P)Rep(dag,root,P).

This is the form of correctness used for the resource bound. A polynomial bound on the size of the generated DAG bounds the resources of the constructed program.

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.Gen
open QAlgorithms QAlgorithms.OPI TwoFoldOPI Lay TD RRefC FM SymEnc
local notation "vl" => List.map Fin.val
variable (x : Input) (n : ℕ) (hq : x.F.p ^ x.F.f.natDegree ≤ n)
include hq
Formal statement
theorem OPI.Gen.genDag_rep : ∃ (N c out : ℕ) (P : Prog N c out),
    Leaf.constructQ x = packP P ∧ (genDag n (parsedOf x)).1 = [0, N, c, out] ∧
      Rep (genDag n (parsedOf x)).2.1 (genDag n (parsedOf x)).2.2 P := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/f7224a159e790347c1a83c5ac23c63e5094a6a2c/WorkInProgress/QuantumOPIVariants/OPI/IRGenRep.lean#L37-L65

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