Proved
CODATA2022.chiSquare_decompositionThe algebraic identity underlying the whole adjustment. If solves the normal equations and the weight matrix is symmetric, then for every parameter vector
The cross terms cancel precisely because of the normal equations, which is why at the fitted values is the residual chi-square reported by the adjustment and why any departure from can only increase it when is positive semidefinite.
import Mathlib import Definitions.Def_CODATA2022_least_squares open Matrix
namespace CODATA2022
theorem chiSquare_decomposition {N M : ℕ} (A : Matrix (Fin N) (Fin M) ℝ)
(W : Matrix (Fin N) (Fin N) ℝ) (hW : W.IsHermitian) (z : Fin N → ℝ) (xhat x : Fin M → ℝ)
(hnormal : (Aᵀ * W * A).mulVec xhat = (Aᵀ * W).mulVec z) :
chiSquare A W z x
= chiSquare A W z xhat + (x - xhat) ⬝ᵥ (Aᵀ * W * A).mulVec (x - xhat) := by sorry
end CODATA2022Read-back
What the Lean code literally says, in plain math · Aristotle by Harmonic (same agent as the drafter; non-blind)
Disclosure - non-blind read-back. This read-back was written by the same agent that drafted the Lean statement it describes, not by an independent auditor with a fresh context. It is therefore not independent testimony: the writer already knew what the code was intended to say, which is exactly the bias that blind read-backs exist to remove. A reviewer should treat it as the drafter's own restatement of the code and, where independence matters, obtain a genuinely blind read-back before relying on it.
Fix natural numbers and (implicit arguments), a real matrix with rows and columns, a real matrix , a vector , and two vectors . Write for the quantity defined in the definition file.
Two hypotheses are assumed. First, is Hermitian; over the reals this says exactly . Second, the normal equations hold in the form
an equality of vectors in .
The conclusion is the identity of real numbers
No positivity, invertibility or rank condition is imposed on or , and is not asserted to exist or to be unique - it is a given vector assumed to satisfy the displayed equation. The case or is included, where all the terms are .