Convexity of log-sum-exp
ProvedConvexOptimization.log_sum_exp_convexOnConvexity of the log-sum-exp function.
The function
is convex on .
Log-sum-exp is the smooth approximation of the maximum, satisfying , so its convexity is a differentiable surrogate for the (also convex, but nonsmooth) maximum function. It is the log-partition function of an exponential family — its gradient is the softmax, its Hessian the covariance of the associated distribution — and it is the Fenchel conjugate of the negative entropy on the probability simplex.
Together with it is the most frequently reused convexity fact in the book: geometric programming, logistic regression, maximum-entropy estimation and softmax classifiers all rest on it.
Formalization Note The variable is an element of EuclideanSpace ℝ (Fin n) and x i denotes its -th coordinate; convexity is asserted on Set.univ. Source: B&V §3.1.5, p. 72.
import Mathlib open scoped RealInnerProductSpace ENNReal open MeasureTheory
theorem ConvexOptimization.log_sum_exp_convexOn {n : ℕ} :
ConvexOn ℝ Set.univ
(fun x : EuclideanSpace ℝ (Fin n) => Real.log (∑ i, Real.exp (x i))) := by
sorry