First-order optimality criterion
ProvedConvexOptimization.optimal_iff_gradient_variationalThe first-order optimality criterion for differentiable convex problems — inequality (4.21) of Boyd & Vandenberghe.
Let be convex, let be differentiable with gradient field , and assume is convex on . Then for ,
Geometrically the condition says that defines a supporting hyperplane of at : moving from toward any other feasible point cannot decrease to first order. For an unconstrained problem () it collapses to .
This is the bridge between the variational and the algebraic descriptions of optimality, and it is used in both directions in this mission — to convert stationarity of the Lagrangian into optimality of a KKT point, and to characterize Euclidean projection.
Formalization Note The gradient is an explicit field f' with ∀ x, HasGradientAt f (f' x) x, and optimality is IsMinOn f X x. Convexity of the domain is assumed separately as Convex ℝ X alongside ConvexOn ℝ X f. Source: B&V §4.2.3, p. 139, eq. (4.21).
import Mathlib open scoped RealInnerProductSpace ENNReal open MeasureTheory
theorem ConvexOptimization.optimal_iff_gradient_variational {n : ℕ}
(X : Set (EuclideanSpace ℝ (Fin n))) (hX : Convex ℝ X)
(f : EuclideanSpace ℝ (Fin n) → ℝ)
(f' : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin n))
(hf : ∀ x, HasGradientAt f (f' x) x) (hfc : ConvexOn ℝ X f)
(x : EuclideanSpace ℝ (Fin n)) (hx : x ∈ X) :
IsMinOn f X x ↔ ∀ y ∈ X, 0 ≤ ⟪f' x, y - x⟫ := by
sorry
Read-back
What the Lean code literally says, in plain math · claude-fable-5
Theorem. Let be any natural number (implicit), , , and . Assume: (a) is convex; (b) for every point of the whole space (not just points of ), has gradient at — i.e. is differentiable at every point of and is its gradient field; (c) is convex on (which again subsumes convexity of ); (d) . Then the following equivalence (a genuine if-and-only-if) holds:
where "minimizes" means for all (non-strict), and the right-hand side is the variational inequality with the non-strict direction . Edge cases: if is empty the hypothesis is unsatisfiable, so the statement is vacuous there; the differentiability hypothesis is over all of , which is stronger than differentiability on alone.
Confirmed by the mission captain (proposal self-audit).