First-order characterization of convexity
ProvedConvexOptimization.convexOn_iff_gradient_inequalityFirst-order characterization of convexity: a differentiable function is convex exactly when its tangent planes lie below its graph.
Let be open and convex, and let be differentiable on with gradient field . Then
The right-hand condition says that the first-order Taylor approximation at any point is a global underestimator of on — a remarkable amount of global information extracted from a derivative at a single point.
This is the workhorse of the theory: it yields the first-order optimality criterion, the definition of the subgradient in the nondifferentiable case, and the strong-convexity inequality that drives all convergence-rate analysis.
Formalization Note The gradient is an explicit field f' tied to f by ∀ x ∈ Ω, HasGradientAt f (f' x) x; openness of Ω is assumed so that the derivative is a genuine (two-sided) gradient at every point of the domain, and convexity of Ω is assumed separately from ConvexOn ℝ Ω f. Source: B&V §3.1.3, pp. 69–70.
import Mathlib open scoped RealInnerProductSpace ENNReal open MeasureTheory
theorem ConvexOptimization.convexOn_iff_gradient_inequality {n : ℕ}
(Ω : Set (EuclideanSpace ℝ (Fin n))) (hΩo : IsOpen Ω) (hΩc : Convex ℝ Ω)
(f : EuclideanSpace ℝ (Fin n) → ℝ)
(f' : EuclideanSpace ℝ (Fin n) → EuclideanSpace ℝ (Fin n))
(hf : ∀ x ∈ Ω, HasGradientAt f (f' x) x) :
ConvexOn ℝ Ω f ↔ ∀ x ∈ Ω, ∀ y ∈ Ω, f x + ⟪f' x, y - x⟫ ≤ f y := by
sorry
Read-back
What the Lean code literally says, in plain math · claude-fable-5
Theorem statement. Let be a subset of Euclidean -space that is open and convex, let be a total function, and let be a total map such that for every , has gradient at — i.e. is Fréchet-differentiable at with derivative the linear map (values of outside are unconstrained and unused). Then the claim is an equivalence: is convex on for all and , . "Convex on " is Mathlib's ConvexOn: the conjunction of ( convex — already a hypothesis, so this conjunct is redundant on the left) and the Jensen inequality for all and with . Only the values of on are constrained by either side. Degenerate case: if (or a singleton is impossible here since open, but is allowed) both sides hold vacuously and the equivalence is trivially true.
Confirmed by the mission captain (proposal self-audit).