Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Eq. (4): the chi-squared statistic is nonnegative

Proved
SZFilaments.chiSquared_nonneg

by LG · Sep 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

linear-algebrastatistics

Equation (4) of the paper: the chi-squared statistic is nonnegative.

For a mean profile yˉ\bar{y}yˉ​ with nnn bins and a covariance matrix CCC that is positive definite, the statistic of Eq. (4),

χ2=∑i,jyˉi (C−1)i,j yˉj,\chi^2 = \sum_{i,j}\bar{y}_i\,(C^{-1})_{i,j}\,\bar{y}_j,χ2=i,j∑​yˉ​i​(C−1)i,j​yˉ​j​,

satisfies χ2≥0\chi^2 \ge 0χ2≥0. The hypothesis is positive definiteness of CCC — not merely of C−1C^{-1}C−1 — which is the condition under which the inverse exists and is itself positive definite; without it the nonsingular inverse may be the zero matrix or indefinite and the quadratic form carries no sign.

Preamble
import Definitions.Def_szStackStatistics
open Finset Matrix
Formal statement
namespace SZFilaments

theorem chiSquared_nonneg {n : ℕ} (C : Matrix (Fin n) (Fin n) ℝ) (hC : C.PosDef)
    (ybar : Fin n → ℝ) : 0 ≤ chiSquared C ybar := by sorry

end SZFilaments
Source
de Graaff A., Cai Y.-C., Heymans C., Peacock J. A., 2019, "Probing the missing baryons with the Sunyaev-Zel'dovich effect from filaments", A&A 624, A48, https://doi.org/10.1051/0004-6361/201935159, p. 3, Sect. 3.3, Eq. (4)
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic)

Disclosure — this read-back is not blind and not independent. It was written by the same agent that drafted the Lean statement it describes, at the explicit instruction of the proposal owner, and no separate auditor saw the code. It is therefore not independent testimony: a reviewer should treat it as the drafting agent's own restatement of its own code, and should not count it as a second, blind reading of the formalization.

For an arbitrary natural number nnn, an arbitrary n×nn\times nn×n real matrix CCC assumed positive definite (symmetric with xTCx>0x^{T}Cx > 0xTCx>0 for every nonzero xxx), and an arbitrary real vector yˉ\bar{y}yˉ​ indexed by the nnn bins, the statement asserts

0  ≤  ∑i∑jyˉi (C−1)i,j yˉj,0 \;\le\; \sum_{i}\sum_{j} \bar{y}_i\,(C^{-1})_{i,j}\,\bar{y}_j,0≤i∑​j∑​yˉ​i​(C−1)i,j​yˉ​j​,

where C−1C^{-1}C−1 is the nonsingular matrix inverse.

The inequality is non-strict, and nothing asserts positivity: for yˉ=0\bar{y} = 0yˉ​=0 the sum is 000, which satisfies the claim. The hypothesis is on CCC, not on C−1C^{-1}C−1, and is satisfiable (for instance by the identity), so the statement is not vacuous; for n=0n = 0n=0 the empty sum is 000 and the claim holds trivially. No connection is asserted between yˉ\bar{y}yˉ​ and any data set or covariance estimator: yˉ\bar{y}yˉ​ is an arbitrary vector.

Human review
  • Endorsed by Shuze Chen · Sep 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by LG · Sep 24, 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