Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 4:1 — conjugacy and orthogonality relations of the cd-method, (4:3a)–(4:3c) and (4:4)

Proved
ConjGrad.Termination.cd_conjugacy_relations

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

conjugate-directionsnumerical-linear-algebrap2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let AAA be a real symmetric positive definite n×nn \times nn×n matrix, let k∈Rnk \in \mathbb{R}^nk∈Rn, and let xix_ixi​, rir_iri​, pip_ipi​ (i=0,1,…i = 0, 1, \dotsi=0,1,…) be a run of the method of conjugate directions for Ax=kAx = kAx=k: ri=k−Axir_i = k - Ax_iri​=k−Axi​, xi+1=xi+aipix_{i+1} = x_i + a_i p_ixi+1​=xi​+ai​pi​ with ai=(pi,ri)/(pi,Api)a_i = (p_i, r_i)/(p_i, Ap_i)ai​=(pi​,ri​)/(pi​,Api​), and (pi+1,Apj)=0(p_{i+1}, Ap_j) = 0(pi+1​,Apj​)=0 for j≤ij \le ij≤i. Then

  1. the directions are mutually conjugate: (pi,Apj)=0(p_i, Ap_j) = 0(pi​,Apj​)=0 for i≠ji \ne ji=j (4:3a);
  2. the residual rir_iri​ is orthogonal to p0,…,pi−1p_0, \dots, p_{i-1}p0​,…,pi−1​: (pj,ri)=0(p_j, r_i) = 0(pj​,ri​)=0 for j<ij < ij<i (4:3b);
  3. the inner product of pip_ipi​ with each of r0,…,rir_0, \dots, r_ir0​,…,ri​ is the same (4:3c):
(pi,r0)=(pi,r1)=⋯=(pi,ri);(p_i, r_0) = (p_i, r_1) = \cdots = (p_i, r_i);(pi​,r0​)=(pi​,r1​)=⋯=(pi​,ri​);
  1. the step length may be computed from the initial residual, (4:4): xi+1=xi+aipix_{i+1} = x_i + a_i p_ixi+1​=xi​+ai​pi​ with
ai=(pi,r0)(pi,Api).a_i = \frac{(p_i, r_0)}{(p_i, Ap_i)}.ai​=(pi​,Api​)(pi​,r0​)​.

These relations are the basic properties of the cd-method. In particular (4:4) shows that the estimates can be computed without computing the intermediate residuals.

Formalization Note No direction is assumed nonzero: a zero direction gives a zero step (0/0=00/0 = 00/0=0 in Lean), and all four relations remain true for it. Item 4 is stated as the update of xxx, which is how (4:4) replaces (4:1a).

Preamble
import Mathlib
import Definitions.Def_ConjGrad_Termination_IsCDRun

open Matrix
Formal statement
namespace ConjGrad.Termination

/-- Theorem 4:1 (Hestenes–Stiefel 1952, p. 412). For every run of the cd-method with a
symmetric positive definite matrix `A`: (4:3a) the directions are mutually conjugate;
(4:3b) `rᵢ` is orthogonal to `p₀, …, pᵢ₋₁`; (4:3c) `(pᵢ, r₀) = (pᵢ, r₁) = ⋯ = (pᵢ, rᵢ)`;
(4:4) the step may be taken with `aᵢ = (pᵢ, r₀)/(pᵢ, Apᵢ)` in place of (4:1a). -/
theorem cd_conjugacy_relations {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
    (k : Fin n → ℝ) (x r p : ℕ → Fin n → ℝ) (hcd : IsCDRun A k x r p) :
    (∀ i j, i ≠ j → p i ⬝ᵥ (A *ᵥ p j) = 0) ∧
    (∀ i j, j < i → p j ⬝ᵥ r i = 0) ∧
    (∀ i j, j ≤ i → p i ⬝ᵥ r j = p i ⬝ᵥ r 0) ∧
    (∀ i, x (i + 1) = x i + ((p i ⬝ᵥ r 0) / (p i ⬝ᵥ (A *ᵥ p i))) • p i) := by sorry

end ConjGrad.Termination
Source
Hestenes & Stiefel, Methods of Conjugate Gradients for Solving Linear Systems, J. Res. Natl. Bur. Stand. 49(6) (1952), https://doi.org/10.6028/jres.049.044, p. 412, Theorem 4:1, eq. (4:3a)–(4:3c), (4:4); standing assumption (A symmetric positive definite) p. 410
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. Let n∈Nn \in \mathbb{N}n∈N and let AAA be a real n×nn\times nn×n matrix that is positive definite in this sense:

  • AAA is symmetric, A⊤=AA^\top = AA⊤=A;
  • ⟨v,Av⟩>0\langle v, A v\rangle > 0⟨v,Av⟩>0 for every nonzero v∈Rnv \in \mathbb{R}^nv∈Rn.

Here ⟨u,v⟩=∑lulvl\langle u,v\rangle = \sum_l u_l v_l⟨u,v⟩=∑l​ul​vl​. Let k∈Rnk \in \mathbb{R}^nk∈Rn, and let (xi)(x_i)(xi​), (ri)(r_i)(ri​), (pi)(p_i)(pi​), for i∈Ni \in \mathbb{N}i∈N, be sequences in Rn\mathbb{R}^nRn that satisfy all of these conditions:

  • ri=k−Axir_i = k - A x_iri​=k−Axi​ for every iii;
  • xi+1=xi+⟨pi,ri⟩⟨pi,Api⟩ pix_{i+1} = x_i + \dfrac{\langle p_i, r_i\rangle}{\langle p_i, A p_i\rangle}\, p_ixi+1​=xi​+⟨pi​,Api​⟩⟨pi​,ri​⟩​pi​ for every iii, where the quotient is 000 if its denominator is 000;
  • ⟨pi+1,Apj⟩=0\langle p_{i+1}, A p_j\rangle = 0⟨pi+1​,Apj​⟩=0 for every iii and every j≤ij \le ij≤i.

The starting estimate x0x_0x0​ and the starting direction p0p_0p0​ are otherwise arbitrary, and directions may be zero.

Conclusion. The theorem asserts all four of the following at once:

  1. For all i,j∈Ni, j \in \mathbb{N}i,j∈N with i≠ji \ne ji=j,
⟨pi,Apj⟩=0.\langle p_i, A p_j\rangle = 0 .⟨pi​,Apj​⟩=0.
  1. For all i,j∈Ni, j \in \mathbb{N}i,j∈N with j<ij < ij<i,
⟨pj,ri⟩=0.\langle p_j, r_i\rangle = 0 .⟨pj​,ri​⟩=0.
  1. For all i,j∈Ni, j \in \mathbb{N}i,j∈N with j≤ij \le ij≤i,
⟨pi,rj⟩=⟨pi,r0⟩.\langle p_i, r_j\rangle = \langle p_i, r_0\rangle .⟨pi​,rj​⟩=⟨pi​,r0​⟩.
  1. For every i∈Ni \in \mathbb{N}i∈N,
xi+1=xi+⟨pi,r0⟩⟨pi,Api⟩ pi,x_{i+1} = x_i + \frac{\langle p_i, r_0\rangle}{\langle p_i, A p_i\rangle}\, p_i ,xi+1​=xi​+⟨pi​,Api​⟩⟨pi​,r0​⟩​pi​,

again with the quotient read as 000 when ⟨pi,Api⟩=0\langle p_i, A p_i\rangle = 0⟨pi​,Api​⟩=0.

All indices range over all natural numbers, with no upper bound tied to nnn.

Degenerate cases.

  • n=0n = 0n=0. Every vector is empty and every dot product is 000. The only matrix is the empty one, which satisfies the positive-definiteness hypothesis vacuously, and all four conclusions hold trivially.
  • pi=0p_i = 0pi​=0. Then ⟨pi,Api⟩=0\langle p_i, A p_i\rangle = 0⟨pi​,Api​⟩=0, so both step coefficients are 000 and conclusion 4 reads xi+1=xix_{i+1} = x_ixi+1​=xi​.
  • Other hypotheses. The hypotheses are satisfiable for every nnn: for example, take all pi=0p_i = 0pi​=0 and xix_ixi​ constant.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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