Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Section 6, eq. (6:6) — (yi+1,xi+1−xi)=f(xi+1)/μ(pi)(y_{i+1},x_{i+1}-x_i)=f(x_{i+1})/\mu(p_i)(yi+1​,xi+1​−xi​)=f(xi+1​)/μ(pi​)

Proved
ConjGrad.ErrorDecrease.error_vector_inner_6_6

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

conjugate-gradientnumerical-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,x0∈Rnk,x_0\in\mathbb{R}^nk,x0​∈Rn, and let hhh solve Ah=kAh=kAh=k. Let xix_ixi​ and pip_ipi​ be the estimates and direction vectors of the cg-method (5:1) started at x0x_0x0​, write yi=h−xiy_i=h-x_iyi​=h−xi​ for the error vector of xix_ixi​, let f(x)=(h−x,A(h−x))f(x)=(h-x,A(h-x))f(x)=(h−x,A(h−x)) be the error function (4:5), and let μ(z)=(z,Az)/∣z∣2\mu(z)=(z,Az)/|z|^2μ(z)=(z,Az)/∣z∣2 be the Rayleigh quotient (4:12). Then for every i≥0i\ge 0i≥0,

(yi+1, xi+1−xi)=f(xi+1)μ(pi).(y_{i+1},\,x_{i+1}-x_i) = \frac{f(x_{i+1})}{\mu(p_i)} .(yi+1​,xi+1​−xi​)=μ(pi​)f(xi+1​)​.

This is the identity (6:6), displayed in the paper's proof of Theorem 6:3 (with the index shifted by one): the step xi+1−xix_{i+1}-x_ixi+1​−xi​ and the new error vector yi+1y_{i+1}yi+1​ make a nonnegative inner product, whose value is determined by the error function. It is the ingredient that turns the decrease of fff into a decrease of the Euclidean length of the error vector.

Formalization Note The statement is for all iii, including steps after termination; there xi+1=xi=hx_{i+1}=x_i=hxi+1​=xi​=h and both sides are 000. The index is shifted (step i+1i+1i+1 goes from xix_ixi​ to xi+1x_{i+1}xi+1​) to avoid natural-number subtraction.

Preamble
import Mathlib
import Definitions.Def_ConjGrad_ErrorDecrease_cgIter
import Definitions.Def_ConjGrad_ErrorDecrease_errorFun
import Definitions.Def_ConjGrad_ErrorDecrease_rayleigh

open Matrix
Formal statement
namespace ConjGrad.ErrorDecrease

theorem error_vector_inner_6_6 {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.PosDef)
    (k x₀ h : Fin n → ℝ) (hh : A *ᵥ h = k) (i : ℕ) :
    (h - (cgIter A k x₀ (i + 1)).x) ⬝ᵥ ((cgIter A k x₀ (i + 1)).x - (cgIter A k x₀ i).x) =
      errorFun A h (cgIter A k x₀ (i + 1)).x / rayleigh A (cgIter A k x₀ i).p := by sorry

end ConjGrad.ErrorDecrease
Source
Hestenes & Stiefel, Methods of Conjugate Gradients for Solving Linear Systems, J. Res. Natl. Bur. Stand. 49(6) (1952), p. 417, Section 6, eq. (6:6) (in the proof of Theorem 6:3)
Read-back

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

Setting and hypotheses.

  • nnn is a natural number.
  • AAA is a positive definite real n×nn\times nn×n matrix: symmetric, with z⋅Az>0z\cdot Az>0z⋅Az>0 for z≠0z\ne0z=0.
  • k,x0∈Rnk, x_0\in\mathbb{R}^nk,x0​∈Rn are arbitrary.
  • hhh satisfies Ah=kAh=kAh=k.
  • i∈Ni\in\mathbb{N}i∈N is arbitrary.

The sequence. (xi,ri,pi)(x_i, r_i, p_i)(xi​,ri​,pi​) is generated from AAA, kkk and x0x_0x0​ as follows:

  • Start with r0=p0=k−Ax0r_0=p_0=k-Ax_0r0​=p0​=k−Ax0​.
  • Set ai=(ri⋅ri)/(pi⋅Api)a_i=(r_i\cdot r_i)/(p_i\cdot Ap_i)ai​=(ri​⋅ri​)/(pi​⋅Api​), then xi+1=xi+aipix_{i+1}=x_i+a_ip_ixi+1​=xi​+ai​pi​ and ri+1=ri−aiApir_{i+1}=r_i-a_iAp_iri+1​=ri​−ai​Api​.
  • Set bi=(ri+1⋅ri+1)/(ri⋅ri)b_i=(r_{i+1}\cdot r_{i+1})/(r_i\cdot r_i)bi​=(ri+1​⋅ri+1​)/(ri​⋅ri​) and pi+1=ri+1+bipip_{i+1}=r_{i+1}+b_ip_ipi+1​=ri+1​+bi​pi​.
  • Division by zero yields 000.

Functions used.

  • The error function is f(x)=(h−x)⋅A(h−x)f(x)=(h-x)\cdot A(h-x)f(x)=(h−x)⋅A(h−x).
  • The Rayleigh quotient is μ(z)=(z⋅Az)/(z⋅z)\mu(z)=(z\cdot Az)/(z\cdot z)μ(z)=(z⋅Az)/(z⋅z), with μ(0)=0\mu(0)=0μ(0)=0.

Conclusion. The statement asserts

(h−xi+1)⋅(xi+1−xi)  =  f(xi+1)μ(pi).(h - x_{i+1})\cdot(x_{i+1} - x_i) \;=\; \frac{f(x_{i+1})}{\mu(p_i)} .(h−xi+1​)⋅(xi+1​−xi​)=μ(pi​)f(xi+1​)​.

The left side uses the plain Euclidean dot product, not the one weighted by AAA.

Degenerate cases.

  • μ(pi)=0\mu(p_i) = 0μ(pi​)=0: under positive definiteness this happens exactly when pi=0p_i=0pi​=0. The right-hand side is then 000 by the division convention, and ai=0a_i = 0ai​=0 gives xi+1=xix_{i+1}=x_ixi+1​=xi​, so the left-hand side is also 000.
  • n=0n=0n=0: both sides are 000.
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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me