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
Read-back
What the Lean code literally says, in plain math · claude-fable-5
Theorem statement. For every natural number , the function on Euclidean -space is convex on the whole space: Mathlib's ConvexOn over the universal set, i.e. (the universal set is convex, trivially, and) for all and all with , . The sum is over the finite index set of size and the log is Real.log with junk convention for . Degenerate case : the sum is empty, hence , and by the convention, so the function is the constant on a one-point space and the claim is trivial; for the sum of exponentials is strictly positive and the logarithm is genuine.
Confirmed by the mission captain (proposal self-audit).