Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 3.11 — the gradient of the LQR cost is 2(RKC−B⊤X)YC⊤2(RKC-B^\top X)YC^\top2(RKC−B⊤X)YC⊤

Proved
FatkhullinPolyak.Discrete.lqr_gradient_formula

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

gradientlqrp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Under the standing assumptions, for every K∈SK\in\mathcal SK∈S the cost fff is (Fréchet) differentiable at KKK with gradient, with respect to the Frobenius inner product ⟨M,N⟩=Tr(M⊤N)\langle M,N\rangle=\mathrm{Tr}(M^\top N)⟨M,N⟩=Tr(M⊤N),

∇f(K)=2(RKC−B⊤X) Y C⊤,(3.3)\nabla f(K)=2\big(RKC-B^\top X\big)\,Y\,C^\top, \tag{3.3}∇f(K)=2(RKC−B⊤X)YC⊤,(3.3)

where X=X(K)X=X(K)X=X(K) solves (2.7) and YYY solves the Lyapunov equation

AKY+YAK⊤+Σ=0.(3.4)A_KY+YA_K^\top+\Sigma=0. \tag{3.4}AK​Y+YAK⊤​+Σ=0.(3.4)

That is, for every ε>0\varepsilon>0ε>0 there is δ>0\delta>0δ>0 such that

∣f(K+E)−f(K)−⟨∇f(K),E⟩∣≤ε∥E∥Fwhenever ∥E∥F<δ.\big|f(K+E)-f(K)-\langle\nabla f(K),E\rangle\big|\le\varepsilon\|E\|_F\qquad\text{whenever }\|E\|_F<\delta .​f(K+E)−f(K)−⟨∇f(K),E⟩​≤ε∥E∥F​whenever ∥E∥F​<δ.

The explicit gradient is what the gradient method (4.4) evaluates at each step.

Preamble
import Mathlib
import Definitions.Def_FatkhullinPolyak_Discrete_LQR

open Filter Topology
Formal statement
namespace FatkhullinPolyak.Discrete

/-- Lemma 3.11 (p. 7): for every `K ∈ S`, `f` is Fréchet differentiable at `K` (Frobenius norm)
with gradient `∇f(K) = 2(RKC − BᵀX)YCᵀ` of (3.3), `Y` the solution of (3.4); i.e.
`f(K + E) = f(K) + ⟨∇f(K), E⟩_F + o(‖E‖_F)`. -/
theorem lqr_gradient_formula {n m r : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (B : Matrix (Fin n) (Fin m) ℝ)
    (C : Matrix (Fin r) (Fin n) ℝ) (Q : Matrix (Fin n) (Fin n) ℝ) (R : Matrix (Fin m) (Fin m) ℝ)
    (Sig : Matrix (Fin n) (Fin n) ℝ)
    (hQ : Q.PosDef) (hR : R.PosDef) (hSig : Sig.PosDef) (hC : C.rank = r) (hB : B ≠ 0)
    (K : Matrix (Fin m) (Fin r) ℝ) (hK : K ∈ stabSet A B C) :
    ∀ ε > 0, ∃ δ > 0, ∀ E : Matrix (Fin m) (Fin r) ℝ, frobNorm E < δ →
      |lqrCost A B C Q R Sig (K + E) - lqrCost A B C Q R Sig K
          - frobInner (lqrGrad A B C Q R Sig K) E| ≤ ε * frobNorm E := by sorry

end FatkhullinPolyak.Discrete
Source
Fatkhullin, Polyak, Optimizing Static Linear Feedback: Gradient Method, arXiv:2004.09875v2, p. 7, Lemma 3.11, (3.3)–(3.4)
Read-back

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

Setup. The data are natural numbers n,m,rn, m, rn,m,r and real matrices AAA (n×nn\times nn×n), BBB (n×mn\times mn×m), CCC (r×nr\times nr×n), QQQ, Σ\SigmaΣ (n×nn\times nn×n), RRR (m×mm\times mm×m). Assume:

  • QQQ, RRR, Σ\SigmaΣ are positive definite;
  • CCC has full row rank rrr;
  • B≠0B \neq 0B=0.

For an m×rm\times rm×r gain KKK, let AK=A−BKCA_K = A - BKCAK​=A−BKC, and define:

  • X(K)X(K)X(K): the unique solution of AK⊤X+XAK+C⊤K⊤RKC+Q=0A_K^\top X + XA_K + C^\top K^\top RKC + Q = 0AK⊤​X+XAK​+C⊤K⊤RKC+Q=0;
  • Y(K)Y(K)Y(K): the unique solution of AKY+YAK⊤+Σ=0A_K Y + YA_K^\top + \Sigma = 0AK​Y+YAK⊤​+Σ=0.

Each of these is the zero matrix when the solution is not unique. Then set

f(K)=tr⁡(X(K)Σ),G(K)=2 (RKC−B⊤X(K)) Y(K) C⊤.f(K) = \operatorname{tr}(X(K)\Sigma), \qquad G(K) = 2\,(RKC - B^\top X(K))\,Y(K)\,C^\top.f(K)=tr(X(K)Σ),G(K)=2(RKC−B⊤X(K))Y(K)C⊤.

These are defined for all KKK. Let KKK be a gain with AKA_KAK​ Hurwitz.

Claim. For every ε>0\varepsilon > 0ε>0 there is δ>0\delta > 0δ>0 such that every m×rm\times rm×r matrix EEE with ∥E∥F<δ\|E\|_F < \delta∥E∥F​<δ satisfies

∣ f(K+E)−f(K)−⟨G(K),E⟩F ∣≤ε ∥E∥F.\bigl|\,f(K+E) - f(K) - \langle G(K), E\rangle_F\,\bigr| \le \varepsilon\,\|E\|_F.​f(K+E)−f(K)−⟨G(K),E⟩F​​≤ε∥E∥F​.

Here ⟨G,E⟩F=∑i,jGijEij\langle G, E\rangle_F = \sum_{i,j} G_{ij}E_{ij}⟨G,E⟩F​=∑i,j​Gij​Eij​. So fff is Fréchet differentiable at KKK (for the Frobenius norm), with derivative represented by G(K)G(K)G(K).

Degenerate cases. K+EK + EK+E is not required to be stabilizing; f(K+E)f(K+E)f(K+E) is evaluated with the everywhere-defined formula above. B≠0B \neq 0B=0 forces n,m≥1n, m \ge 1n,m≥1. If r=0r = 0r=0, the only perturbation is E=0E = 0E=0 and the inequality reads 0≤00 \le 00≤0.

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