Theorem 5:1, eq. (5:3c) — for and for
ProvedConjGrad.Termination.cg_direction_residualLet be a real symmetric positive definite matrix, let , and let , be the residuals and directions produced by the conjugate gradient method (3:1) started at . Then
With this gives , which is why the cg step length (3:1b) coincides with the cd step length (4:1a).
Formalization Note The statement is for all indices; after the method reaches the solution the residuals and directions are .
import Mathlib import Definitions.Def_ConjGrad_Termination_cgIter open Matrix
namespace ConjGrad.Termination
/-- Theorem 5:1, eq. (5:3c) (Hestenes–Stiefel 1952, p. 414). For a symmetric positive
definite `A`, the directions and residuals of the cg-method (3:1) satisfy `(pᵢ, rⱼ) = 0`
for `i < j` and `(pᵢ, rⱼ) = |rᵢ|²` for `i ≥ j`. -/
theorem cg_direction_residual {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
(k x₀ : Fin n → ℝ) :
(∀ i j, i < j → (cgIter A k x₀ i).p ⬝ᵥ (cgIter A k x₀ j).r = 0) ∧
(∀ i j, j ≤ i →
(cgIter A k x₀ i).p ⬝ᵥ (cgIter A k x₀ j).r = (cgIter A k x₀ i).r ⬝ᵥ (cgIter A k x₀ i).r) := by sorry
end ConjGrad.Termination
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let and let be a real matrix that is positive definite in this sense:
- is symmetric, ;
- for every nonzero .
Here . Let be arbitrary.
The iteration. Let be the sequence defined recursively as follows. Start with
Then, for every ,
Every quotient with a zero denominator is , and the recursion never stops.
Conclusion. The theorem asserts both of the following:
- For all with ,
- For all with ,
In part 2 the right-hand side is the squared length of , the residual carrying the same index as the direction. It is not the squared length of .
Degenerate cases.
- Unbounded indices. Both parts cover all natural-number indices, including those beyond .
- . Every dot product is and both parts hold trivially.
- . All and are , and both sides of each equation are .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.