Theorem 6:3 — each cg step shortens the error vector, with the exact decrease (6:5)
ProvedConjGrad.ErrorDecrease.error_vector_decreasesLet be a real symmetric positive definite matrix, let , and let be the solution of . Run the cg-method (5:1) from an arbitrary starting point , producing estimates , residuals and direction vectors . Write for the error vector of , for the error function (4:5) and for the Rayleigh quotient (4:12).
For every index with (that is, every step that the algorithm actually performs), the step reduces the Euclidean length of the error vector, and the reduction is exactly
This is Theorem 6:3 of Hestenes and Stiefel, whose step from to is written here with the index shifted by one. The cg-method minimizes the -weighted error , not the Euclidean error; the theorem shows that the Euclidean distance to the solution also decreases strictly at every step, although the residual need not. This justifies stopping the algorithm before the final step.
Formalization Note The hypothesis says that step takes place (the paper's range ); it is needed, since after termination both sides of the identity are and the strict inequality fails. Termination itself ( for some ) is not assumed. The strict decrease is stated for the squared lengths , which is equivalent because lengths are nonnegative.
import Mathlib import Definitions.Def_ConjGrad_ErrorDecrease_cgIter import Definitions.Def_ConjGrad_ErrorDecrease_errorFun import Definitions.Def_ConjGrad_ErrorDecrease_rayleigh open Matrix
namespace ConjGrad.ErrorDecrease
theorem error_vector_decreases {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
(k x₀ h : Fin n → ℝ) (hh : A *ᵥ h = k) (i : ℕ) (hr : (cgIter A k x₀ i).r ≠ 0) :
(h - (cgIter A k x₀ i).x) ⬝ᵥ (h - (cgIter A k x₀ i).x) -
(h - (cgIter A k x₀ (i + 1)).x) ⬝ᵥ (h - (cgIter A k x₀ (i + 1)).x) =
(errorFun A h (cgIter A k x₀ (i + 1)).x + errorFun A h (cgIter A k x₀ i).x) /
rayleigh A (cgIter A k x₀ i).p ∧
(h - (cgIter A k x₀ (i + 1)).x) ⬝ᵥ (h - (cgIter A k x₀ (i + 1)).x) <
(h - (cgIter A k x₀ i).x) ⬝ᵥ (h - (cgIter A k x₀ i).x) := by sorry
end ConjGrad.ErrorDecrease
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let , and let be an matrix with real entries, where the rows and columns are indexed by . The theorem assumes is positive definite in Mathlib's sense:
- is symmetric, ;
- for every nonzero .
It also takes three arbitrary vectors and assumes
so solves the linear system with right-hand side . Since is positive definite and therefore invertible, is exactly . The starting vector is not restricted in any way. Finally, the theorem takes an index .
The statement uses three definitions from the bundle, , and . Their Lean code was not given to me, so the only facts below are what this statement itself shows about them:
- is a record indexed by , built from , and , with at least three vector fields. Write them , and (the fields
.x,.rand.p). The names suggest an iterate, a residual and a search direction, but nothing visible here fixes what they are. In particular, it is not visible whether is the given starting vector or whether equals . - is a real number that depends on , and a vector . Its formula is not visible.
- is a real number that depends on and a vector . Its formula is not visible.
The last hypothesis is that the -field of the -th record is nonzero:
Under all of these hypotheses, the theorem asserts that the following two statements hold together. Here is the ordinary Euclidean squared norm, not a norm weighted by .
- An exact identity:
- A strict decrease:
Degenerate cases:
- : has only the zero vector, so the hypothesis can never hold, and the theorem is vacuously true.
- Iterations that have already stopped: for any , the theorem says nothing about an index with .
- Division by zero: division is total, and dividing by gives . If , conclusion 1 therefore asserts . That contradicts conclusion 2, so in that case the theorem amounts to claiming the hypotheses cannot all hold together. Whether can actually be , or can be negative, depends on the hidden definition of .
- What is covered: the statement holds for every , including , and for every starting vector . Nothing is said about how many iterations are run.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.