Theorems 4:2 and 5:2 — the cg-method reaches the solution in at most steps
ProvedConjGrad.ErrorDecrease.cg_terminatesLet be a real symmetric positive definite matrix, let , and let be the solution of . Let be the estimates produced by the cg-method (5:1) from an arbitrary starting point . Then there is an index with
This is Theorem 4:2 ("The cd-method is an -step method () in the sense that at the th step the estimate is the desired solution "), applied to the cg-method through Theorem 5:2 ("The cg-method is a cd-method"). It is the setting of Section 6 of the paper, "Let now be the estimates of obtained by applying the cg-method", and it is used in the proof of Theorem 6:3.
Formalization Note The cg sequence is the unguarded recursion of the definition, so after step it stays at . Symmetry of is part of Mathlib's Matrix.PosDef.
import Mathlib import Definitions.Def_ConjGrad_ErrorDecrease_cgIter open Matrix
namespace ConjGrad.ErrorDecrease
theorem cg_terminates {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
(k x₀ h : Fin n → ℝ) (hh : A *ᵥ h = k) :
∃ m ≤ n, (cgIter A k x₀ m).x = h := by sorry
end ConjGrad.ErrorDecrease
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting and hypotheses.
- is a natural number.
- is a real matrix that is positive definite: it is symmetric and for every nonzero .
- are arbitrary vectors.
- satisfies .
The sequence. is generated from , and as follows:
- Start with and .
- Set , then and .
- Set and .
- Any division by zero yields .
Conclusion. There exists a natural number with
The statement only asserts that the solution is hit at some step . It says nothing about the iterates after step . It also does not say that is the first index with .
Degenerate cases.
- : the only possible is , and holds trivially because all vectors are empty.
- : then works.
- Division-by-zero convention: this governs the sequence once a residual vanishes, as described in the definition of the sequence.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.