The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V16. Normed spaces and functional analysis

Mathlib.Analysis.Convex.MetricSpace

20 declarations and 4 deprecated aliases. Mathlib docs · Source

Convex spaces with compatible metric structure

A convex space has a compatible metric structure if dist(∑ tᵢ xᵢ, ∑ tᵢ yᵢ) ≤ ∑ tᵢ dist(xᵢ, yᵢ). This is what one would expect from the triangle inequality.

Note that there is a separate notion of convex metric spaces in the literature that has little to do with this definition.

Main results

  • Convexity.IsConvexDist: The (Prop-valued) class of convex spaces with compatible metric structure.
  • Convexity.continuous_convexCombPair: Binary convex combination is continuous.
  • Convexity.IsConvexDist.of_convex: Convex subspaces of normed spaces are convex metric spaces.

TODO

  • Equip StdSimplex with a topology and show the analogous continuity result for n-ary convex combinations.
  • Tidy up the imports with Mathlib.Geometric.Convex.ConvexSpace.AffineSpace.
  • Define convex functions with domain a convex space, and redefine IsConvexDist as saying that dist : X × X → ℝ is convex.

class Convexity.IsConvexDist E3 #

(X : Type u_2) → [inst₁ : Convexity.ConvexSpace ℝ X] → [inst₂ : MetricSpace X] → Prop

A convex metric space is a real convex space with a compatible metric structure. Concretely, we ask for dist(∑ tᵢ xᵢ, ∑ tᵢ yᵢ) ≤ ∑ tᵢ dist(xᵢ, yᵢ), which is what one would expect from the triangle inequality.

In particular, convex subsets of normed affine spaces are convex metric spaces.

Note that there is a separate notion of convex metric spaces in the literature that has little to do with this definition.

ctor Convexity.IsConvexDist.mk E0 #

∀ {X : Type u_2} [inst₁ : Convexity.ConvexSpace ℝ X] [inst₂ : MetricSpace X],
  (∀ (f : Convexity.StdSimplex ℝ (X × X)),
      dist (Convexity.iConvexComb f Prod.fst) (Convexity.iConvexComb f Prod.snd) ≤
        Convexity.iConvexComb f fun x ↦ dist x.1 x.2) →
    Convexity.IsConvexDist X

theorem Convexity.IsConvexDist.dist_iConvexComb_fst_snd_le E1 #

∀ {X : Type u_2} [inst₁ : Convexity.ConvexSpace ℝ X] [inst₂ : MetricSpace X] [self : Convexity.IsConvexDist X]
  (f : Convexity.StdSimplex ℝ (X × X)),
  dist (Convexity.iConvexComb f Prod.fst) (Convexity.iConvexComb f Prod.snd) ≤
    Convexity.iConvexComb f fun x ↦ dist x.1 x.2

Use dist_iConvexComb_le instead.

theorem Convexity.dist_iConvexComb_le E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {ι : Type u_3}
  (f : Convexity.StdSimplex ℝ ι) (x y : ι → X),
  dist (Convexity.iConvexComb f x) (Convexity.iConvexComb f y) ≤ Convexity.iConvexComb f fun i ↦ dist (x i) (y i)

dist(∑ tᵢ xᵢ, ∑ tᵢ yᵢ) ≤ ∑ tᵢ dist(xᵢ, yᵢ)

theorem Convexity.dist_iConvexComb_left_le E1 #

∀ {I : Type u_1} {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X]
  (f : Convexity.StdSimplex ℝ I) (g : I → X) (x : X),
  dist (Convexity.iConvexComb f g) x ≤ Convexity.iConvexComb f fun i ↦ dist (g i) x

theorem Convexity.dist_iConvexComb_right_le E1 #

∀ {I : Type u_1} {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X]
  (x : X) (f : Convexity.StdSimplex ℝ I) (g : I → X),
  dist x (Convexity.iConvexComb f g) ≤ Convexity.iConvexComb f fun i ↦ dist x (g i)

theorem Convexity.dist_sConvexComb_left_le E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X]
  (f : Convexity.StdSimplex ℝ X) (x : X),
  dist (Convexity.sConvexComb f) x ≤ Convexity.iConvexComb f fun x_1 ↦ dist x_1 x

theorem Convexity.dist_sConvexComb_right_le E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] (x : X)
  (f : Convexity.StdSimplex ℝ X), dist x (Convexity.sConvexComb f) ≤ Convexity.iConvexComb f (dist x)

theorem Convexity.dist_convexCombPair_left E0 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (x y : X), dist (Convexity.convexCombPair s t hs ht h x y) x = t * dist x y

theorem Convexity.dist_convexCombPair_right E0 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (x y : X), dist (Convexity.convexCombPair s t hs ht h x y) y = s * dist x y

theorem Convexity.dist_left_convexCombPair E0 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (x y : X), dist x (Convexity.convexCombPair s t hs ht h x y) = t * dist x y

theorem Convexity.dist_right_convexCombPair E0 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (x y : X), dist y (Convexity.convexCombPair s t hs ht h x y) = s * dist x y

theorem Convexity.dist_convexCombPair_convexCombPair E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t s' t' : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (hs' : 0 ≤ s') (ht' : 0 ≤ t') (h' : s' + t' = 1) (x y : X),
  dist (Convexity.convexCombPair s t hs ht h x y) (Convexity.convexCombPair s' t' hs' ht' h' x y) = |s - s'| * dist x y

dist(sx + (1-s)y, s'x + (1-s')y) = |s - s'| dist(x, y).

See dist_convexCombPair_convexCombPair_le for the version where the weights are fixed and the points change.

theorem Convexity.dist_convexCombPair_convexCombPair_le E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {s t : ℝ}
  (hs : 0 ≤ s) (ht : 0 ≤ t) (h : s + t = 1) (x y x' y' : X),
  dist (Convexity.convexCombPair s t hs ht h x y) (Convexity.convexCombPair s t hs ht h x' y') ≤
    s * dist x x' + t * dist y y'

dist(sx + (1-s)y, sx' + (1-s)y') ≤ s dist(x, x') + (1-s) dist(y, y').

See dist_convexCombPair_convexCombPair for the version where the points are fixed and the weights change.

theorem Convexity.continuous_convexCombPair E3 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X],
  Continuous fun x ↦ Convexity.convexCombPair (↑x.1) (1 - ↑x.1) ⋯ ⋯ ⋯ x.2.1 x.2.2

The convex combination (t, p, q) ↦ t • p + (1 - t) • q is continuous on [0, 1] × X × X for a convex metric space X.

theorem Convexity.continuous_convexCombPair_of_isBounded E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] {T : Type u_3}
  [inst_3 : TopologicalSpace T] (f : T → ℝ),
  Continuous f →
    ∀ (hf0 : ∀ (t : T), 0 ≤ f t) (hf1 : ∀ (t : T), f t ≤ 1) (x y : T → X),
      ContinuousOn x (f ⁻¹' {0}ᶜ) →
        ContinuousOn y (f ⁻¹' {1}ᶜ) →
          Bornology.IsBounded (Set.range x) →
            Bornology.IsBounded (Set.range y) →
              Continuous fun i ↦ Convexity.convexCombPair (f i) (1 - f i) ⋯ ⋯ ⋯ (x i) (y i)

theorem Convexity.continuous_convexCombPair' E1 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] [BoundedSpace X]
  {T : Type u_3} [inst_4 : TopologicalSpace T] (f : T → ℝ),
  Continuous f →
    ∀ (hf0 : ∀ (t : T), 0 ≤ f t) (hf1 : ∀ (t : T), f t ≤ 1) (x y : T → X),
      ContinuousOn x (f ⁻¹' {0}ᶜ) →
        ContinuousOn y (f ⁻¹' {1}ᶜ) → Continuous fun i ↦ Convexity.convexCombPair (f i) (1 - f i) ⋯ ⋯ ⋯ (x i) (y i)

When X is a bounded convex metric space, to check continuity of t ↦ f(t) • x(t) + (1 - f(t)) • y(t) it suffices to show that f is continuous, x is continuous away from f(t) = 0, and y is continuous away from f(t) = 1.

instance Convexity.instIsConvexDistOfIsAffineConvexSpaceReal E0 #

∀ {V : Type u_3} {P : Type u_4} [inst : NormedAddCommGroup V] [inst_1 : NormedSpace ℝ V] [inst_2 : MetricSpace P]
  [inst_3 : NormedAddTorsor V P] [inst_4 : Convexity.ConvexSpace ℝ P] [Convexity.IsAffineConvexSpace ℝ V P],
  Convexity.IsConvexDist P

instance Convexity.IsConvexDist.subtype E0 #

∀ {X : Type u_2} [inst : Convexity.ConvexSpace ℝ X] [inst_1 : MetricSpace X] [Convexity.IsConvexDist X] (s : Set X)
  (hs : Convexity.IsConvexSet ℝ s), Convexity.IsConvexDist ↑s

instance Convexity.IsConvexDist.submodule E0 #

∀ {F : Type u_3} {M : Type u_4} [inst : AddCommGroup M] [inst_1 : MetricSpace M] [inst_2 : Module ℝ M]
  [inst_3 : Convexity.ConvexSpace ℝ M] [inst_4 : Convexity.IsModuleConvexSpace ℝ M] [Convexity.IsConvexDist M]
  [inst_6 : SetLike F M] [inst_7 : AddSubmonoidClass F M] [inst_8 : SMulMemClass F ℝ M] {S : F},
  Convexity.IsConvexDist ↥S

Deprecated aliases

NameNew nameSince
Convexity.IsConvexMetricSpaceConvexity.IsConvexDist2026-05-15
Convexity.continuous_convexComboPairConvexity.continuous_convexCombPair2026-05-15
Convexity.continuous_convexComboPair'Convexity.continuous_convexCombPair'2026-05-15
Convexity.dist_convexCombination_right_leConvexity.dist_iConvexComb_le2026-05-15