Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Eq. (41): gradients along a run on a quadratic

Proved
ShannoCG.SCONB.grad_eq_add_sum

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

conjugate-gradientp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1quadratic-programming

Let AAA be a real n×nn\times nn×n matrix and c∈Rnc \in \mathbb R^nc∈Rn, and let the gradient be affine, g(x)=Ax+cg(x) = Ax + cg(x)=Ax+c (for the quadratic f(x)=12(x−x^)′A(x−x^)+bf(x) = \tfrac12 (x-\hat x)'A(x-\hat x) + bf(x)=21​(x−x^)′A(x−x^)+b one has c=−Ax^c = -A\hat xc=−Ax^). Let t<kt < kt<k and let iterates satisfy xi+1=xi+pix_{i+1} = x_i + p_ixi+1​=xi​+pi​ for t<i≤kt < i \le kt<i≤k, with gi=g(xi)g_i = g(x_i)gi​=g(xi​). Then

gk+1=A(xt+1+∑i=t+1kpi)+c=gt+1+∑i=t+1kApi.g_{k+1} = A\left(x_{t+1} + \sum_{i=t+1}^{k} p_i\right) + c = g_{t+1} + \sum_{i=t+1}^{k} A p_i.gk+1​=A(xt+1​+i=t+1∑k​pi​)+c=gt+1​+i=t+1∑k​Api​.

This expresses the current gradient through the gradient after the restart step and the later steps; it is used to show that the restart step stays orthogonal to later gradients.

Formalization Note Iterates and gradients are sequences indexed by N\mathbb NN, with gi=Axi+cg_i = Ax_i + cgi​=Axi​+c for all iii. The sum runs over Finset.Ioc t k. Positive definiteness of AAA is not needed and not assumed.

Preamble
import Mathlib

open Matrix
Formal statement
namespace ShannoCG.SCONB

/-- Shanno, *Conjugate Gradient Methods with Inexact Searches*, Math. Oper. Res. 3(3) (1978), §IV, p. 251 (PDF 8), eq. (41): on a quadratic with gradient `g(x) = Ax + c`, if
`x_{i+1} = x_i + p_i` for `t < i ≤ k`, then
`g_{k+1} = A(x_{t+1} + ∑_{i=t+1}^k p_i) + c = g_{t+1} + ∑_{i=t+1}^k A p_i`.

**Formalization Note.** Vectors are `Fin n → ℝ`, iterates `x, p : ℕ → Fin n → ℝ` and gradients
`g : ℕ → Fin n → ℝ` with `g i = A *ᵥ x i + c` (the gradient of (4) is the case `c = −A x̂`; the paper
writes `Ax + b` here). The sum `∑_{i=t+1}^k` is over `Finset.Ioc t k`. Positive definiteness of `A`
is not needed for this identity and is not assumed. `t < k` is kept as in the paper (the identity
also holds, with an empty sum, at `k = t`). -/
theorem grad_eq_add_sum {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (c : Fin n → ℝ)
    (x p g : ℕ → Fin n → ℝ) (t k : ℕ) (htk : t < k)
    (hg : ∀ i, g i = A *ᵥ x i + c)
    (hstep : ∀ i, t < i → i ≤ k → x (i + 1) = x i + p i) :
    g (k + 1) = A *ᵥ (x (t + 1) + ∑ i ∈ Finset.Ioc t k, p i) + c ∧
      g (k + 1) = g (t + 1) + ∑ i ∈ Finset.Ioc t k, A *ᵥ p i := by sorry

end ShannoCG.SCONB
Source
Shanno, Conjugate Gradient Methods with Inexact Searches, Math. Oper. Res. 3(3) (1978) 244–256, DOI 10.1287/moor.3.3.244, p. 251 (PDF p. 8), §IV, eq. (41)
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 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