Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The Gauss–Jordan straight-line program is well-formed with respect to its time stamps

Proved
OPI.GEP.prog_timeOK

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

lean-formalizationquantum-algorithmstwo-fold-opi-construction

Oblivious Gauss–Jordan elimination on an R×(C+1)R\times(C+1)R×(C+1) augmented system, followed by an output map o↦∑j<Kdxj coef(j,o)o\mapsto\sum_{j<K_d}x_j\,\mathrm{coef}(j,o)o↦∑j<Kd​​xj​coef(j,o), is written as a straight-line program prog\mathrm{prog}prog over a field KKK. Each instruction has a destination id, a list of source ids and an operation. Ids have the form nid(t,k,a,b)=tW+(kBd2+aBd+b)\mathrm{nid}(t,k,a,b)=tW+(kB_d^2+aB_d+b)nid(t,k,a,b)=tW+(kBd2​+aBd​+b) with Bd=R+C+2B_d=R+C+2Bd​=R+C+2 and W=2Bd2W=2B_d^2W=2Bd2​, so the time stamp of an id xxx is tm(x)=⌊x/W⌋\mathrm{tm}(x)=\lfloor x/W\rfloortm(x)=⌊x/W⌋. Ids x<Wx<Wx<W (time stamp 000) are inputs. The program has Tmax⁡=TC+R+Kd+2T_{\max}=T_C+R+K_d+2Tmax​=TC​+R+Kd​+2 time stamps, where Tj=2+j(2R+3)T_j=2+j(2R+3)Tj​=2+j(2R+3).

Hypotheses. Kd≤CK_d\le CKd​≤C, and for every row i<Ri<Ri<R and column l≤Cl\le Cl≤C the sources of the instruction that loads the initial entry (i,l)(i,l)(i,l) are distinct input ids (<W<W<W).

Statement. The program satisfies TimeOK(Tmax⁡W, {x<W}, tm, prog)\mathrm{TimeOK}(T_{\max}W,\ \{x<W\},\ \mathrm{tm},\ \mathrm{prog})TimeOK(Tmax​W, {x<W}, tm, prog). That is:

  • every source of every instruction is an input or the destination of some instruction of the program, has strictly smaller time stamp than the instruction's destination, and is <Tmax⁡W<T_{\max}W<Tmax​W;
  • each instruction has pairwise distinct sources;
  • no destination is an input id, and every destination is <Tmax⁡W<T_{\max}W<Tmax​W;
  • all destinations of the program are pairwise distinct;
  • time stamps of destinations are nondecreasing along the program.

By the general criterion pwf_of_time this yields well-formedness (prog_pwf). The program can then be evaluated as a fixpoint, giving prog_out: the outputs are the prescribed linear combinations of the particular solution. This is how the classical decoder is compiled to a reversible circuit.

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.GEP
variable {K : Type} [Field K] [DecidableEq K]
variable (R C Kd : ℕ) (coef : ℕ → ℕ → K) (a0src : ℕ → ℕ → List ℕ) (a0op : ℕ → ℕ → List K → K)
Formal statement
theorem OPI.GEP.prog_timeOK (hKd : Kd ≤ C)
    (ha0 : ∀ i < R, ∀ l ≤ C, (∀ s ∈ a0src i l, s < Wd R C) ∧ (a0src i l).Nodup) :
    TimeOK (Tmax R C Kd * Wd R C) (fun x => x < Wd R C) (tm R C) (prog R C Kd coef a0src a0op) := by sorry
Source
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/db81d0d4e3fa008609ed37789a2eb2f6f08ee48d/WorkInProgress/QuantumOPIVariants/OPI/GEProg.lean#L673-L860

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