Documentation

Tdaf.Analysis.Convex.Subgradient.Rademacher

Almost everywhere differentiability of a convex function #

A proper convex function on a finite-dimensional space is differentiable at almost every point of the interior of its effective domain, the points of differentiability are dense there, and the gradient map is continuous where it is defined.

Main results #

Implementation notes #

Rademacher's theorem, from Mathlib, does the analysis; convexity only supplies local Lipschitz constants. Convexity gives them on compact subsets of ri (dom f), and exists_lipschitzOnWith_ball shrinks a closed ball to an open one, so that DifferentiableWithinAt upgrades to DifferentiableAt. The density clause is stated without any measure: a non-empty open set has positive Haar measure, so it cannot sit inside a null set.

The classical implication runs the other way — the fixed-direction statement first, by a Fubini argument over lines, then full differentiability by intersecting the coordinate directions. With Rademacher available differentiability comes first, since it supplies the two-sided derivative in every direction at once.

References #

[^1]: R. T. Rockafellar, Convex Analysis, Princeton University Press, 1970, §25.

Differentiability through the real trace #

theorem Tdaf.ConvexAnalysis.eventuallyEq_coe_toReal {E : Type u_1} [NormedAddCommGroup E] {f : E → EReal} {x : E} (hp : Proper f) (hx : x ∈ interior (dom f)) :
f =ᶠ[nhds x] fun (z : E) => ↑(f z).toReal

Near an interior point of its effective domain, a proper function is the coercion of its real trace fun z => (f z).toReal.

theorem Tdaf.ConvexAnalysis.HasGradientAt.hasFDerivAt_toReal {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {f' : StrongDual ℝ E} {x : E} (h : HasGradientAt f f' x) :
HasFDerivAt (fun (z : E) => (f z).toReal) f' x

A gradient of f is a Fréchet derivative of its real trace.

theorem Tdaf.ConvexAnalysis.hasGradientAt_of_hasFDerivAt_toReal {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {f' : StrongDual ℝ E} {x : E} (hp : Proper f) (hx : x ∈ interior (dom f)) (hd : HasFDerivAt (fun (z : E) => (f z).toReal) f' x) :

Conversely, at an interior point of dom f a Fréchet derivative of the real trace is a gradient of f.

theorem Tdaf.ConvexAnalysis.hasGradientAt_iff_hasFDerivAt_toReal {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {f' : StrongDual ℝ E} {x : E} (hp : Proper f) (hx : x ∈ interior (dom f)) :
HasGradientAt f f' x ↔ HasFDerivAt (fun (z : E) => (f z).toReal) f' x
theorem Tdaf.ConvexAnalysis.HasGradientAt.fderiv_toReal_eq {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {f' : StrongDual ℝ E} {x : E} (h : HasGradientAt f f' x) :
fderiv ℝ (fun (z : E) => (f z).toReal) x = f'

Mathlib's fderiv of the real trace is ∇f.

theorem Tdaf.ConvexAnalysis.DifferentiableAtFn.hasGradientAt_fderiv {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {x : E} (h : DifferentiableAtFn f x) :
HasGradientAt f (fderiv ℝ (fun (z : E) => (f z).toReal) x) x

The gradient of f at a point of differentiability, named.

Differentiability almost everywhere #

theorem Tdaf.ConvexAnalysis.exists_lipschitzOnWith_ball {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] {f : E → EReal} {x : E} (hf : ConvexFn f) (hp : Proper f) (hx : x ∈ interior (dom f)) :
∃ r > 0, Metric.ball x r ⊆ interior (dom f) ∧ ∃ (K : NNReal), LipschitzOnWith K (fun (z : E) => (f z).toReal) (Metric.ball x r)

A proper convex function is Lipschitz on a whole ball around any interior point of its effective domain. Balls are what Rademacher's theorem needs, because differentiability within an open set is differentiability.

A proper convex function is differentiable at almost every point of the interior of its effective domain.

The points of int (dom f) at which f fails to be differentiable form a null set.

theorem Tdaf.ConvexAnalysis.twoSided_dirDeriv_of_differentiableAtFn {E : Type u_1} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : E → EReal} {x : E} (hf : ConvexFn f) (h : DifferentiableAtFn f x) (y : E) :
dirDeriv f x y = -dirDeriv f x (-y)

Where f is differentiable, every two-sided directional derivative exists. Both sides are values of the gradient.

In any fixed direction y the two-sided directional derivative exists at almost every point of int (dom f). Here this is a consequence of almost-everywhere differentiability, which supplies the two-sided derivative in every direction at once.

The points of differentiability are dense in the interior of the effective domain. No measure appears in the statement; the proof borrows one.

Continuity of the gradient #

The Riesz bridge at the level of the pairings themselves: pairing x with the vector v through the inner product is pairing x with the functional ⟪v, ·⟫ through the canonical pairing of E with its continuous dual. Everything below is this identity under a quantifier.

The Riesz bridge for the conjugate: mem_subgradient_innerL_iff with conj in place of subgradient. It carries results stated on a general normed space with the pairing ⟨x, y⟩ = y x over to statements about conj (innerₗ E).

The Riesz bridge between the two pairings of an inner-product space with itself and with its dual: v is a subgradient for innerₗ E exactly when the functional ⟪v, ·⟫ is one for the canonical pairing with the dual.

In vector form: at a point of differentiability the subdifferential for the inner-product pairing is the single vector representing the gradient.

The Riesz bridge for singletons: a subdifferential that is the single vector v for the inner-product pairing is the single functional ⟪v, ·⟫ for the canonical pairing with the dual.

Converse, in vector form: a lone subgradient for the inner-product pairing is the gradient.

The gradient mapping is continuous on the set where the function is differentiable. This is upper semicontinuity of ∂f with both subdifferentials collapsed to singletons.

A finite convex function differentiable on an open convex set is continuously differentiable there. Mathlib's ConvexOn enters by extension with ⊤ off C, which on the open set C has the same gradients.

The normal cone to the unit ball #

theorem Tdaf.ConvexAnalysis.normalCone_innerₗ_closedBall {E : Type u_1} [NormedAddCommGroup E] [InnerProductSpace ℝ E] {x : E} (hx : ‖x‖ = 1) :
normalCone (innerₗ E) (Metric.closedBall 0 1) x = {y : E | ∃ (lam : ℝ), 0 ≤ lam ∧ y = lam • x}

The normal cone to the unit ball at a boundary point is the ray through that point: N_B(x) = {λx | λ ≥ 0} for ‖x‖ = 1. It is what turns the optimality condition at a maximiser over the ball into the eigenvalue condition λx ∈ ∂f(x). Both inclusions are the equality case of Cauchy–Schwarz, so neither finite-dimensionality nor completeness is needed.