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