Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 5.3 — rounding GMG_MGM​ recovers rank(A)\mathrm{rank}(A)rank(A) of a projection with probability ≥1−δ\ge 1-\delta≥1−δ once M≥24 rank(A)ln⁡(2/δ)M \ge 24\,\mathrm{rank}(A)\ln(2/\delta)M≥24rank(A)ln(2/δ)

Proved
TraceEstimation.ProjectionRank.projection_rank_round

by mikedeng1 · Sep 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

gaussianp2o-batch-p200ap2o-gran-per-chapterp2o-plan-paperp2o-v1projection-matrixrank-estimationtrace-estimation

Let A∈Rn×nA \in \mathbb{R}^{n\times n}A∈Rn×n be a projection matrix — symmetric, with A2=AA^2 = AA2=A, equivalently symmetric with only the eigenvalues 000 and 111 — and let δ>0\delta > 0δ>0 be a failure probability. Let M≥1M \ge 1M≥1 be an integer with

M≥24 rank(A)ln⁡(2/δ),M \ge 24\,\mathrm{rank}(A)\ln(2/\delta),M≥24rank(A)ln(2/δ),

and let GMG_MGM​ be the Gaussian trace estimator of AAA with MMM samples (Definition 3.1). Then

Pr⁡(round(GM)≠rank(A))≤δ.\Pr\bigl(\mathrm{round}(G_M) \ne \mathrm{rank}(A)\bigr) \le \delta .Pr(round(GM​)=rank(A))≤δ.

Thus the rank of a projection available only through matrix–vector products is computed exactly, with failure probability at most δ\deltaδ, from O(rank(A)log⁡(2/δ))O(\mathrm{rank}(A)\log(2/\delta))O(rank(A)log(2/δ)) products, with no dependence on an accuracy parameter. Computing the rank of a projection is used, for example, to compute charge densities in electronic structure calculations without diagonalization.

Formalization Note "Projection matrix" is formalized as orthogonal projection (A.IsHermitian and A * A = A), the reading under which the paper's proof, which diagonalizes A=UTdiag(1,…,1,0,…,0)UA = U^T\mathrm{diag}(1,\ldots,1,0,\ldots,0)UA=UTdiag(1,…,1,0,…,0)U with UUU unitary, applies. round\mathrm{round}round is Mathlib's round : ℝ → ℤ, which rounds half-integers up; the statement does not depend on the tie-breaking rule, since every rounding failure lies in the event ∣GM−rank(A)∣≥12|G_M - \mathrm{rank}(A)| \ge \tfrac12∣GM​−rank(A)∣≥21​. The probability is Measure.real under the product Gaussian measure of Definition 3.1. No upper bound on δ\deltaδ is imposed (for δ≥1\delta \ge 1δ≥1 the statement is trivially true), and the case rank(A)=0\mathrm{rank}(A) = 0rank(A)=0 is included.

Preamble
import Mathlib
import Definitions.Def_TraceEstimation_Shared_gaussianEstimator
Formal statement
namespace TraceEstimation.ProjectionRank

open MeasureTheory ProbabilityTheory Matrix

/-- Lemma 5.3 (Avron–Toledo, p. 8:9). Let `A ∈ ℝ^{n×n}` be a projection matrix and `δ > 0` a
failure probability. For `M ≥ 24 rank(A) ln(2/δ)` samples (`M ≥ 1`), the Gaussian trace
estimator `G_M` of `A` satisfies `Pr(round(G_M) ≠ rank(A)) ≤ δ`.

"Projection matrix" is an orthogonal projection: `A` symmetric (`A.IsHermitian`) and idempotent
(`A * A = A`), i.e. symmetric with eigenvalues in `{0, 1}` (the proof diagonalises
`A = Uᵀ diag(1,…,1,0,…,0) U` with `U` unitary). `round` is Mathlib's `round : ℝ → ℤ`
(half-integers round up); the probability is `P.real` under the product Gaussian measure of
Definition 3.1. -/
theorem projection_rank_round {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.IsHermitian)
    (hA2 : A * A = A) (δ : ℝ) (hδ : 0 < δ) (M : ℕ) (hM : 0 < M)
    (hMδ : 24 * (A.rank : ℝ) * Real.log (2 / δ) ≤ M) :
    (Shared.gaussianSampleMeasure n M).real
        {ω | round (Shared.gaussianEstimator A M ω) ≠ (A.rank : ℤ)} ≤ δ := by sorry

end TraceEstimation.ProjectionRank
Source
Avron and Toledo, Randomized algorithms for estimating the trace of an implicit symmetric positive semi-definite matrix, J. ACM 58(2), Article 8 (2011), p. 8:9, Lemma 5.3
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 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