The envelope lemma (Lemma 3.3.1)
ProvedBertsekasDP.envelope_gradient_lemmaLemma 3.3.1 (envelope lemma). Let be continuously differentiable in both arguments, let be convex, and let be a continuously differentiable selection of minimizers: and for all and all . Then the gradient of the minimum value is obtained by differentiating with the minimizer held fixed:
In other words, the indirect term that the chain rule would contribute through vanishes.
The reason is first-order optimality over the convex set : the derivative of in the control directions is orthogonal to every feasible variation of the minimizer. This is the step that lets the source differentiate the HJB equation along an optimal trajectory while ignoring the derivatives of the minimizing control law — the passage from the HJB equation to the adjoint equation of the Minimum Principle. The lemma is standard envelope-theorem material and is reusable well beyond control theory, in comparative statics and in duality arguments.
Formalization Note Gradients are Mathlib's, which return the zero vector at points of non-differentiability; here both composite maps are genuinely , so they are the classical gradients. Uniqueness of the minimizer is not assumed — only that selects one at each — and no compactness, boundedness or interiority is required.
import Mathlib
namespace BertsekasDP
theorem envelope_gradient_lemma {d m : ℕ}
(F : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin m) → ℝ)
(U : Set (EuclideanSpace ℝ (Fin m)))
(hU : Convex ℝ U)
(hF : ContDiff ℝ 1 (Function.uncurry F))
(μstar : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin m))
(hμ : ContDiff ℝ 1 μstar)
(hmem : ∀ y, μstar y ∈ U)
(hmin : ∀ y, IsMinOn (F y) U (μstar y)) :
∀ y, gradient (fun z => F z (μstar z)) y =
gradient (fun z => F z (μstar y)) y := by sorry
end BertsekasDPRead-back
What the Lean code literally says, in plain math · claude-fable-5
Fix natural numbers (implicit). Given:
- , assumed jointly as a function of the pair;
- a set assumed convex (nothing else: not assumed nonempty, closed, or bounded — though see the edge case below);
- a selection map , assumed on all of ;
- the hypothesis that for every (so if and is nonempty — which it always is — this hypothesis is unsatisfiable and the theorem is vacuous);
- the hypothesis that for every , is a minimum point of on , meaning: for every , (non-strict; this by itself does not assert — that is the separate previous hypothesis).
Conclusion. For every :
i.e. the gradient at of the composed map equals the gradient at of the map in which the second argument is frozen at the constant value . Both gradients are Mathlib total gradients (value where the map is not differentiable; under the hypotheses both maps are ). Note that the minimization and membership hypotheses are required at all points of the whole space, and the conclusion likewise is claimed at all . The proof is sorry (stated, not proved).
Confirmed by the mission captain (proposal self-audit).