Lemma 3.11 — the gradient of the LQR cost is
ProvedFatkhullinPolyak.Flow.lqr_gradient_formulaLet and let be a stabilizing gain. Then the LQR cost is (Fréchet) differentiable at , and its derivative is the linear functional
where solves (2.7) and solves the Lyapunov equation (3.4) .
In other words, (3.3) is the gradient of with respect to the Frobenius inner product , so the flow (4.1) is the gradient flow of .
Formalization Note Differentiability is taken with respect to the Frobenius norm on (Mathlib's Matrix.frobeniusNormedAddCommGroup, used as a local instance); all norms on this finite-dimensional space give the same notion. The standing assumptions and are not needed for this statement and are omitted, which makes it only stronger.
import Mathlib import Definitions.Def_FatkhullinPolyak_Flow_LQR
namespace FatkhullinPolyak.Flow
open Matrix
attribute [local instance] Matrix.frobeniusNormedAddCommGroup Matrix.frobeniusNormedSpace
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)
(K : Matrix (Fin m) (Fin r) ℝ) (hK : K ∈ stabSet A B C) :
∃ f' : Matrix (Fin m) (Fin r) ℝ →L[ℝ] ℝ,
HasFDerivAt (fun K' => cost A B C Q R Sig K') f' K ∧
∀ E : Matrix (Fin m) (Fin r) ℝ, f' E = trace ((grad A B C Q R Sig K)ᵀ * E) := by sorry
end FatkhullinPolyak.Flow
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let
Gains are real matrices. The notions used are:
- is the set of gains with every complex eigenvalue of having negative real part.
- is the unique solution of , or if the solution is not unique.
- is the unique solution of , or if the solution is not unique.
- The cost is , defined for every .
- is the explicit formula.
The space carries the Frobenius norm. In finite dimension the notion of differentiability does not depend on this choice.
Hypotheses.
- , , are positive definite (symmetric, with for ).
- .
- No rank condition on and no condition on is imposed.
Conclusion. The function is Fréchet differentiable at , and its derivative is the linear map
In other words, the explicit matrix represents the derivative of at in the trace (Frobenius) inner product. Differentiability here is a statement about on a full neighbourhood of in , using the values actually takes there.
Degenerate cases.
- If or , the domain is a single point and the statement is trivial.
- If , then and , so the claim is that the zero function has derivative .
- The hypotheses are satisfiable whenever is nonempty. If is empty, the statement is vacuous.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.