Lemma 3.11 — the gradient of the LQR cost is
ProvedFatkhullinPolyak.Discrete.lqr_gradient_formulaUnder the standing assumptions, for every the cost is (Fréchet) differentiable at with gradient, with respect to the Frobenius inner product ,
where solves (2.7) and solves the Lyapunov equation
That is, for every there is such that
The explicit gradient is what the gradient method (4.4) evaluates at each step.
import Mathlib import Definitions.Def_FatkhullinPolyak_Discrete_LQR open Filter Topology
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
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setup. The data are natural numbers and real matrices (), (), (), , (), (). Assume:
- , , are positive definite;
- has full row rank ;
- .
For an gain , let , and define:
- : the unique solution of ;
- : the unique solution of .
Each of these is the zero matrix when the solution is not unique. Then set
These are defined for all . Let be a gain with Hurwitz.
Claim. For every there is such that every matrix with satisfies
Here . So is Fréchet differentiable at (for the Frobenius norm), with derivative represented by .
Degenerate cases. is not required to be stabilizing; is evaluated with the everywhere-defined formula above. forces . If , the only perturbation is and the inequality reads .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.