Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§1: canonical basis computation and equality test

Open
QAlgorithms.Papers.Independent.Intakethird100.P03.canonical_basis

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

Let BBB be a full-rank integer k×kk\times kk×k column basis. There is a unique matrix CCC generating the same subgroup and satisfying

cij=0 (i>j),cii>0,0≤cij<cii (i<j).c_{ij}=0\ (i>j),\qquad c_{ii}>0,\qquad 0\le c_{ij}<c_{ii}\ (i<j).cij​=0 (i>j),cii​>0,0≤cij​<cii​ (i<j).

A single classical polynomial-time procedure maps the signed binary encoding of BBB to that of CCC, with output length polynomial in the actual input length. Another single polynomial-time procedure decides whether two such bases generate the same subgroup. Both procedures work for all dimensions.

Consequently, arbitrary-basis output and canonical-basis output are polynomially equivalent: normalize in one direction and retain the canonical basis in the other.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intakethird100_P03
Formal statement
noncomputable section

open scoped Matrix ComplexConjugate Kronecker

namespace QAlgorithms.Papers.Independent.Intakethird100.P03

open QAlgorithms.Papers.Independent.Renew46.P01 (cleanVector)

attribute [local instance] Classical.propDecidable

/-- PDF p.4: canonicalization, efficient equality testing, and the polynomial equivalence
of arbitrary-basis and canonical-basis output. Runtime is measured in the input's actual bit
length. Polynomial-time computability refers to a halting multi-stack Turing machine. -/
theorem canonical_basis :
    ∃ (normalize equal : List Bool → List Bool) (p : Polynomial ℕ),
      QAlgorithms.Complexity.PolyTimeComputable normalize ∧
      QAlgorithms.Complexity.PolyTimeComputable equal ∧
      ∀ (k : ℕ) (B : Matrix (Fin k) (Fin k) ℤ), IsLatticeBasis B →
        IsCanonicalBasis B (canonicalBasis B) ∧
        (∀ C, IsCanonicalBasis B C → C = canonicalBasis B) ∧
        normalize (encodeBasis B) = encodeBasis (canonicalBasis B) ∧
        (encodeBasis (canonicalBasis B)).length ≤ p.eval (encodeBasis B).length ∧
        ∀ C : Matrix (Fin k) (Fin k) ℤ, IsLatticeBasis C →
          equal (encodeBasis B ++ encodeBasis C) =
            [decide (columnLattice B = columnLattice C)] := by sorry

end QAlgorithms.Papers.Independent.Intakethird100.P03

end
Source
Quantum measurements and the Abelian Stabilizer Problem, arXiv:quant-ph/9511026v1, PDF p. 4, §1: canonical basis computation and equality test
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

There exist two functions normalize,equal\mathrm{normalize},\mathrm{equal}normalize,equal from finite Boolean lists to finite Boolean lists, both Turing-machine computable in polynomial time with identity input and output encodings, and a polynomial ppp with natural-number coefficients, such that the following holds for every natural number kkk and integer k×kk\times kk×k matrix BBB for which c↦Bcc\mapsto Bcc↦Bc is injective on Zk\mathbb Z^kZk. Write K(B)K(B)K(B) for the matrix chosen by the preceding definition, which chooses a qualifying matrix if one exists and otherwise returns zero. Then K(B)K(B)K(B) has injective multiplication, the same integer column span as BBB, zero entries below the diagonal, positive diagonal entries, and 0≤K(B)ij<K(B)ii0\le K(B)_{ij}<K(B)_{ii}0≤K(B)ij​<K(B)ii​ for every i<ji<ji<j; every matrix CCC with these same properties relative to BBB equals K(B)K(B)K(B); normalize(E(B))=E(K(B))\mathrm{normalize}(E(B))=E(K(B))normalize(E(B))=E(K(B)); and ∣E(K(B))∣≤p(∣E(B)∣)|E(K(B))|\le p(|E(B)|)∣E(K(B))∣≤p(∣E(B)∣). Moreover, for every integer k×kk\times kk×k matrix CCC whose multiplication map is injective, equal(E(B)+ ⁣ ⁣+E(C))\mathrm{equal}(E(B)\mathbin{+\!\!+}E(C))equal(E(B)++E(C)) is the singleton Boolean list whose bit is true exactly when {Bc:c∈Zk}={Cc:c∈Zk}\{Bc:c\in\mathbb Z^k\}=\{Cc:c\in\mathbb Z^k\}{Bc:c∈Zk}={Cc:c∈Zk}. Here + ⁣ ⁣++\!\!+++ denotes list concatenation, and E(B)E(B)E(B) encodes kkk followed by the entries of BBB column by column, with increasing row indices within each column. To encode a natural number ttt, list the binary digits of t+1t+1t+1 from least significant to most significant, prefixing them by as many true bits as their length and then one false bit; to encode an integer zzz, prepend the bit indicating z<0z<0z<0 to the natural-number encoding of ∣z∣|z|∣z∣. The assertions include k=0k=0k=0. No behavior is prescribed for either function on other inputs.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 2026

    Confirmed by the mission captain (proposal self-audit).

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