Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

On every padded prefix of the encoding, the generator outputs the serialization of the construction

Proved
OPI.Gen.gen_spec

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), a length mmm, an r×mr\times mr×m 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. Its public encoding encode(x)∈{0,1}∗\mathrm{encode}(x)\in\{0,1\}^*encode(x)∈{0,1}∗ lists the field, mmm, rrr, gen\mathrm{gen}gen, the entries of HHH and of β\betaβ (as bit blocks) and ttt. Its size parameter is scale(x)=m+r+q+t\mathrm{scale}(x)=m+r+q+tscale(x)=m+r+q+t, where q=∣F∣q=|F|q=∣F∣. The construction constructQ(x)\mathrm{constructQ}(x)constructQ(x) is the packed program of Theorem 7.4: a trivial classical program if C⊥=0C^\perp=0C⊥=0, and the quantum Regev-style program otherwise. packedSerialization\mathrm{packedSerialization}packedSerialization is its canonical bit-string serialization.

The generator gen:{0,1}∗→{0,1}∗\mathrm{gen}:\{0,1\}^*\to\{0,1\}^*gen:{0,1}∗→{0,1}∗ reads a bit string www, parses it (with numbers saturated at ∣w∣+1|w|+1∣w∣+1) and runs the natural-number construction with input length ∣w∣|w|∣w∣.

Statement. Let s∈Ns\in\mathbb Ns∈N with ∣encode(x)∣≤s|\mathrm{encode}(x)|\le s∣encode(x)∣≤s and scale(x)≤s\mathrm{scale}(x)\le sscale(x)≤s, and let ws=(encode(x) 0s)[0,s)w_s=(\mathrm{encode}(x)\,0^s)_{[0,s)}ws​=(encode(x)0s)[0,s)​ be the encoding padded with zeros to length exactly sss. Then

gen(ws)=packedSerialization(constructQ(x)).\mathrm{gen}(w_s)=\mathrm{packedSerialization}\big(\mathrm{constructQ}(x)\big).gen(ws​)=packedSerialization(constructQ(x)).

This is the correctness half of the Cook–Levin serializability of the construction. Raw zero-padded prefixes are the inputs on which the uniformity notion runs its machines.

Preamble
import Definitions.Def_TwoFoldOPI_CL_Part05
import Definitions.Def_TwoFoldOPI_CLSerializableF
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
open OPI OPI.Gen
open QAlgorithms QAlgorithms.OPI TwoFoldOPI
Formal statement
theorem OPI.Gen.gen_spec (x : Input) (s : ℕ) (h1 : x.encode.length ≤ s) (h2 : x.scale ≤ s) :
    gen ((x.encode ++ List.replicate s false).take s) = packedSerialization (Leaf.constructQ x) := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/f7224a159e790347c1a83c5ac23c63e5094a6a2c/WorkInProgress/QuantumOPIVariants/OPI/Leaf74.lean#L15-L26

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