doc-next-gen

Mathlib.Analysis.Convex.Hull

Module docstring

{"# Convex hull

This file defines the convex hull of a set s in a module. convexHull π•œ s is the smallest convex set containing s. In order theory speak, this is a closure operator.

Implementation notes

convexHull is defined as a closure operator. This gives access to the ClosureOperator API while the impact on writing code is minimal as convexHull π•œ s is automatically elaborated as (convexHull π•œ) s. "}

convexHull definition
: ClosureOperator (Set E)
Full source
/-- The convex hull of a set `s` is the minimal convex set that includes `s`. -/
@[simps! isClosed]
def convexHull : ClosureOperator (Set E) := .ofCompletePred (Convex π•œ) fun _ ↦ convex_sInter
Convex hull of a set
Informal description
The convex hull of a set $s$ in a module over a scalar ring $\mathbb{K}$ is the smallest convex set containing $s$, defined as the intersection of all convex sets that include $s$.
subset_convexHull theorem
: s βŠ† convexHull π•œ s
Full source
theorem subset_convexHull : s βŠ† convexHull π•œ s :=
  (convexHull π•œ).le_closure s
Set is Subset of its Convex Hull
Informal description
For any set $s$ in a module over a scalar ring $\mathbb{K}$, the set $s$ is a subset of its convex hull, i.e., $s \subseteq \text{convexHull}_{\mathbb{K}}(s)$.
convex_convexHull theorem
: Convex π•œ (convexHull π•œ s)
Full source
theorem convex_convexHull : Convex π•œ (convexHull π•œ s) := (convexHull π•œ).isClosed_closure s
Convexity of the Convex Hull
Informal description
For any set $s$ in a module over a scalar ring $\mathbb{K}$, the convex hull $\text{convexHull}_{\mathbb{K}}(s)$ is a convex set.
convexHull_eq_iInter theorem
: convexHull π•œ s = β‹‚ (t : Set E) (_ : s βŠ† t) (_ : Convex π•œ t), t
Full source
theorem convexHull_eq_iInter : convexHull π•œ s = β‹‚ (t : Set E) (_ : s βŠ† t) (_ : Convex π•œ t), t := by
  simp [convexHull, iInter_subtype, iInter_and]
Convex Hull as Intersection of All Containing Convex Sets
Informal description
The convex hull of a set $s$ in a module over a scalar ring $\mathbb{K}$ is equal to the intersection of all convex sets $t$ that contain $s$. That is, \[ \text{convexHull}_{\mathbb{K}}(s) = \bigcap_{\substack{t \subseteq E \\ s \subseteq t \\ \text{Convex}_{\mathbb{K}}(t)}} t. \]
mem_convexHull_iff theorem
: x ∈ convexHull π•œ s ↔ βˆ€ t, s βŠ† t β†’ Convex π•œ t β†’ x ∈ t
Full source
theorem mem_convexHull_iff : x ∈ convexHull π•œ sx ∈ convexHull π•œ s ↔ βˆ€ t, s βŠ† t β†’ Convex π•œ t β†’ x ∈ t := by
  simp_rw [convexHull_eq_iInter, mem_iInter]
Characterization of Membership in Convex Hull via Containing Convex Sets
Informal description
An element $x$ belongs to the convex hull of a set $s$ in a module over a scalar ring $\mathbb{K}$ if and only if for every convex set $t$ containing $s$, $x$ is also in $t$. That is, \[ x \in \text{convexHull}_{\mathbb{K}}(s) \leftrightarrow \forall t, (s \subseteq t \land \text{Convex}_{\mathbb{K}}(t)) \to x \in t. \]
convexHull_min theorem
: s βŠ† t β†’ Convex π•œ t β†’ convexHull π•œ s βŠ† t
Full source
theorem convexHull_min : s βŠ† t β†’ Convex π•œ t β†’ convexHullconvexHull π•œ s βŠ† t := (convexHull π•œ).closure_min
Minimality of the Convex Hull: $\text{convexHull}_{\mathbb{K}}(s) \subseteq t$ for $s \subseteq t$ and $t$ convex
Informal description
For any subset $s$ of a module over a scalar ring $\mathbb{K}$, if $s$ is contained in a convex set $t$, then the convex hull of $s$ is also contained in $t$.
Convex.convexHull_subset_iff theorem
(ht : Convex π•œ t) : convexHull π•œ s βŠ† t ↔ s βŠ† t
Full source
theorem Convex.convexHull_subset_iff (ht : Convex π•œ t) : convexHullconvexHull π•œ s βŠ† tconvexHull π•œ s βŠ† t ↔ s βŠ† t :=
  (show (convexHull π•œ).IsClosed t from ht).closure_le_iff
Characterization of Convex Hull Containment in a Convex Set: $\text{convexHull}_\mathbb{K}(s) \subseteq t \leftrightarrow s \subseteq t$ when $t$ is convex
Informal description
Let $s$ and $t$ be sets in a module over a scalar ring $\mathbb{K}$, and suppose $t$ is convex. Then the convex hull of $s$ is contained in $t$ if and only if $s$ is contained in $t$. In other words, $\text{convexHull}_\mathbb{K}(s) \subseteq t \leftrightarrow s \subseteq t$.
convexHull_mono theorem
(hst : s βŠ† t) : convexHull π•œ s βŠ† convexHull π•œ t
Full source
@[mono, gcongr]
theorem convexHull_mono (hst : s βŠ† t) : convexHullconvexHull π•œ s βŠ† convexHull π•œ t :=
  (convexHull π•œ).monotone hst
Monotonicity of Convex Hull: $s \subseteq t \implies \text{convexHull}(\mathbb{K}, s) \subseteq \text{convexHull}(\mathbb{K}, t)$
Informal description
For any two sets $s$ and $t$ in a module over a scalar ring $\mathbb{K}$, if $s$ is a subset of $t$, then the convex hull of $s$ is a subset of the convex hull of $t$.
convexHull_eq_self theorem
: convexHull π•œ s = s ↔ Convex π•œ s
Full source
lemma convexHull_eq_self : convexHullconvexHull π•œ s = s ↔ Convex π•œ s := (convexHull π•œ).isClosed_iff.symm
Convex Hull Equals Set if and only if Set is Convex
Informal description
For a set $s$ in a module over a scalar ring $\mathbb{K}$, the convex hull of $s$ equals $s$ itself if and only if $s$ is convex. In other words, $\text{convexHull}_{\mathbb{K}}(s) = s \leftrightarrow \text{Convex}_{\mathbb{K}}(s)$.
convexHull_univ theorem
: convexHull π•œ (univ : Set E) = univ
Full source
@[simp]
theorem convexHull_univ : convexHull π•œ (univ : Set E) = univ :=
  ClosureOperator.closure_top (convexHull π•œ)
Convex Hull of Universal Set is Universal Set
Informal description
For any scalar ring $\mathbb{K}$ and module $E$ over $\mathbb{K}$, the convex hull of the universal set in $E$ is equal to the universal set itself, i.e., $\text{convexHull}_{\mathbb{K}}(E) = E$.
convexHull_empty theorem
: convexHull π•œ (βˆ… : Set E) = βˆ…
Full source
@[simp]
theorem convexHull_empty : convexHull π•œ (βˆ… : Set E) = βˆ… :=
  convex_empty.convexHull_eq
Convex Hull of Empty Set is Empty
Informal description
The convex hull of the empty set in a module $E$ over a scalar ring $\mathbb{K}$ is the empty set, i.e., $\text{convexHull}_{\mathbb{K}}(\emptyset) = \emptyset$.
convexHull_empty_iff theorem
: convexHull π•œ s = βˆ… ↔ s = βˆ…
Full source
@[simp]
theorem convexHull_empty_iff : convexHullconvexHull π•œ s = βˆ… ↔ s = βˆ… := by
  constructor
  Β· intro h
    rw [← Set.subset_empty_iff, ← h]
    exact subset_convexHull π•œ _
  Β· rintro rfl
    exact convexHull_empty
Convex Hull is Empty if and only if Set is Empty
Informal description
For any set $s$ in a module over a scalar ring $\mathbb{K}$, the convex hull of $s$ is empty if and only if $s$ itself is empty, i.e., $\text{convexHull}_{\mathbb{K}}(s) = \emptyset \leftrightarrow s = \emptyset$.
convexHull_nonempty_iff theorem
: (convexHull π•œ s).Nonempty ↔ s.Nonempty
Full source
@[simp]
theorem convexHull_nonempty_iff : (convexHull π•œ s).Nonempty ↔ s.Nonempty := by
  rw [nonempty_iff_ne_empty, nonempty_iff_ne_empty, Ne, Ne]
  exact not_congr convexHull_empty_iff
Nonempty Convex Hull Characterization: $\text{convexHull}_{\mathbb{K}}(s) \neq \emptyset \leftrightarrow s \neq \emptyset$
Informal description
For any set $s$ in a module over a scalar ring $\mathbb{K}$, the convex hull of $s$ is nonempty if and only if $s$ itself is nonempty, i.e., $\text{convexHull}_{\mathbb{K}}(s) \neq \emptyset \leftrightarrow s \neq \emptyset$.
segment_subset_convexHull theorem
(hx : x ∈ s) (hy : y ∈ s) : segment π•œ x y βŠ† convexHull π•œ s
Full source
theorem segment_subset_convexHull (hx : x ∈ s) (hy : y ∈ s) : segmentsegment π•œ x y βŠ† convexHull π•œ s :=
  (convex_convexHull _ _).segment_subset (subset_convexHull _ _ hx) (subset_convexHull _ _ hy)
Segment is Subset of Convex Hull
Informal description
For any two points $x$ and $y$ in a set $s$ in a module over a scalar ring $\mathbb{K}$, the segment connecting $x$ and $y$ is contained in the convex hull of $s$, i.e., $\text{segment}_{\mathbb{K}}(x, y) \subseteq \text{convexHull}_{\mathbb{K}}(s)$.
convexHull_singleton theorem
(x : E) : convexHull π•œ ({ x } : Set E) = { x }
Full source
@[simp]
theorem convexHull_singleton (x : E) : convexHull π•œ ({x} : Set E) = {x} :=
  (convex_singleton x).convexHull_eq
Convex Hull of a Singleton Set is the Singleton Itself
Informal description
For any element $x$ in a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of the singleton set $\{x\}$ is equal to $\{x\}$ itself.
convexHull_zero theorem
: convexHull π•œ (0 : Set E) = 0
Full source
@[simp]
theorem convexHull_zero : convexHull π•œ (0 : Set E) = 0 :=
  convexHull_singleton 0
Convex Hull of Zero Set is Zero
Informal description
The convex hull of the zero set $\{0\}$ in a module $E$ over a scalar ring $\mathbb{K}$ is equal to $\{0\}$ itself, i.e., $\text{convexHull}_\mathbb{K}(\{0\}) = \{0\}$.
convexHull_pair theorem
[IsOrderedRing π•œ] (x y : E) : convexHull π•œ { x, y } = segment π•œ x y
Full source
@[simp]
theorem convexHull_pair [IsOrderedRing π•œ] (x y : E) : convexHull π•œ {x, y} = segment π•œ x y := by
  refine (convexHull_min ?_ <| convex_segment _ _).antisymm
    (segment_subset_convexHull (mem_insert _ _) <| subset_insert _ _ <| mem_singleton _)
  rw [insert_subset_iff, singleton_subset_iff]
  exact ⟨left_mem_segment _ _ _, right_mem_segment _ _ _⟩
Convex Hull of Two Points Equals Their Connecting Segment
Informal description
For any ordered ring $\mathbb{K}$ and any two points $x$ and $y$ in a module $E$ over $\mathbb{K}$, the convex hull of the two-point set $\{x, y\}$ is equal to the segment connecting $x$ and $y$, i.e., \[ \text{convexHull}_\mathbb{K}(\{x, y\}) = \text{segment}_\mathbb{K}(x, y). \]
convexHull_convexHull_union_left theorem
(s t : Set E) : convexHull π•œ (convexHull π•œ s βˆͺ t) = convexHull π•œ (s βˆͺ t)
Full source
theorem convexHull_convexHull_union_left (s t : Set E) :
    convexHull π•œ (convexHullconvexHull π•œ s βˆͺ t) = convexHull π•œ (s βˆͺ t) :=
  ClosureOperator.closure_sup_closure_left _ _ _
Convex Hull of Union with Left Convex Hull: $\text{convexHull}_\mathbb{K}(\text{convexHull}_\mathbb{K}(s) \cup t) = \text{convexHull}_\mathbb{K}(s \cup t)$
Informal description
For any two sets $s$ and $t$ in a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of the union of the convex hull of $s$ and $t$ is equal to the convex hull of the union of $s$ and $t$, i.e., \[ \text{convexHull}_\mathbb{K}(\text{convexHull}_\mathbb{K}(s) \cup t) = \text{convexHull}_\mathbb{K}(s \cup t). \]
convexHull_convexHull_union_right theorem
(s t : Set E) : convexHull π•œ (s βˆͺ convexHull π•œ t) = convexHull π•œ (s βˆͺ t)
Full source
theorem convexHull_convexHull_union_right (s t : Set E) :
    convexHull π•œ (s βˆͺ convexHull π•œ t) = convexHull π•œ (s βˆͺ t) :=
  ClosureOperator.closure_sup_closure_right _ _ _
Convex Hull of Union with Right Convex Hull: $\text{convexHull}_\mathbb{K}(s \cup \text{convexHull}_\mathbb{K}(t)) = \text{convexHull}_\mathbb{K}(s \cup t)$
Informal description
For any two sets $s$ and $t$ in a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of the union of $s$ and the convex hull of $t$ is equal to the convex hull of the union of $s$ and $t$, i.e., \[ \text{convexHull}_\mathbb{K}(s \cup \text{convexHull}_\mathbb{K}(t)) = \text{convexHull}_\mathbb{K}(s \cup t). \]
Convex.convex_remove_iff_not_mem_convexHull_remove theorem
{s : Set E} (hs : Convex π•œ s) (x : E) : Convex π•œ (s \ { x }) ↔ x βˆ‰ convexHull π•œ (s \ { x })
Full source
theorem Convex.convex_remove_iff_not_mem_convexHull_remove {s : Set E} (hs : Convex π•œ s) (x : E) :
    ConvexConvex π•œ (s \ {x}) ↔ x βˆ‰ convexHull π•œ (s \ {x}) := by
  constructor
  Β· rintro hsx hx
    rw [hsx.convexHull_eq] at hx
    exact hx.2 (mem_singleton _)
  rintro hx
  suffices h : s \ {x} = convexHull π•œ (s \ {x}) by
    rw [h]
    exact convex_convexHull π•œ _
  exact
    Subset.antisymm (subset_convexHull π•œ _) fun y hy =>
      ⟨convexHull_min diff_subset hs hy, by
        rintro (rfl : y = x)
        exact hx hy⟩
Convexity of Set Difference from a Singleton: $s \setminus \{x\}$ is convex iff $x \notin \text{convexHull}_\mathbb{K}(s \setminus \{x\})$
Informal description
Let $s$ be a convex set in a module $E$ over a scalar ring $\mathbb{K}$, and let $x \in E$. Then the set difference $s \setminus \{x\}$ is convex if and only if $x$ does not belong to the convex hull of $s \setminus \{x\}$.
IsLinearMap.image_convexHull theorem
{f : E β†’ F} (hf : IsLinearMap π•œ f) (s : Set E) : f '' convexHull π•œ s = convexHull π•œ (f '' s)
Full source
theorem IsLinearMap.image_convexHull {f : E β†’ F} (hf : IsLinearMap π•œ f) (s : Set E) :
    f '' convexHull π•œ s = convexHull π•œ (f '' s) :=
  Set.Subset.antisymm
    (image_subset_iff.2 <|
      convexHull_min (image_subset_iff.1 <| subset_convexHull π•œ _)
        ((convex_convexHull π•œ _).is_linear_preimage hf))
    (convexHull_min (image_subset _ (subset_convexHull π•œ s)) <|
      (convex_convexHull π•œ s).is_linear_image hf)
Linear Image of Convex Hull Equals Convex Hull of Linear Image
Informal description
Let $E$ and $F$ be modules over a scalar ring $\mathbb{K}$, and let $f \colon E \to F$ be a $\mathbb{K}$-linear map. For any subset $s \subseteq E$, the image of the convex hull of $s$ under $f$ equals the convex hull of the image of $s$ under $f$. In symbols: \[ f(\text{convexHull}_\mathbb{K}(s)) = \text{convexHull}_\mathbb{K}(f(s)). \]
LinearMap.image_convexHull theorem
(f : E β†’β‚—[π•œ] F) (s : Set E) : f '' convexHull π•œ s = convexHull π•œ (f '' s)
Full source
theorem LinearMap.image_convexHull (f : E β†’β‚—[π•œ] F) (s : Set E) :
    f '' convexHull π•œ s = convexHull π•œ (f '' s) :=
  f.isLinear.image_convexHull s
Linear Image of Convex Hull Equals Convex Hull of Linear Image
Informal description
Let $E$ and $F$ be modules over a scalar ring $\mathbb{K}$, and let $f \colon E \to F$ be a $\mathbb{K}$-linear map. For any subset $s \subseteq E$, the image of the convex hull of $s$ under $f$ equals the convex hull of the image of $s$ under $f$. In symbols: \[ f(\text{convexHull}_\mathbb{K}(s)) = \text{convexHull}_\mathbb{K}(f(s)). \]
convexHull_add_subset theorem
{s t : Set E} : convexHull π•œ (s + t) βŠ† convexHull π•œ s + convexHull π•œ t
Full source
theorem convexHull_add_subset {s t : Set E} :
    convexHullconvexHull π•œ (s + t) βŠ† convexHull π•œ s + convexHull π•œ t :=
  convexHull_min (add_subset_add (subset_convexHull _ _) (subset_convexHull _ _))
    (Convex.add (convex_convexHull π•œ s) (convex_convexHull π•œ t))
Convex Hull of Minkowski Sum is Subset of Sum of Convex Hulls
Informal description
For any two subsets $s$ and $t$ of a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of their Minkowski sum $s + t$ is contained in the Minkowski sum of their convex hulls, i.e., $$\text{convexHull}_{\mathbb{K}}(s + t) \subseteq \text{convexHull}_{\mathbb{K}}(s) + \text{convexHull}_{\mathbb{K}}(t).$$
convexHull_smul theorem
(a : π•œ) (s : Set E) : convexHull π•œ (a β€’ s) = a β€’ convexHull π•œ s
Full source
theorem convexHull_smul (a : π•œ) (s : Set E) : convexHull π•œ (a β€’ s) = a β€’ convexHull π•œ s :=
  (LinearMap.lsmul _ _ a).image_convexHull _ |>.symm
Scalar Multiplication Commutes with Convex Hull
Informal description
For any scalar $a$ in a scalar ring $\mathbb{K}$ and any subset $s$ of a module $E$ over $\mathbb{K}$, the convex hull of the scaled set $a \cdot s$ is equal to the scaled convex hull of $s$, i.e., \[ \text{convexHull}_{\mathbb{K}}(a \cdot s) = a \cdot \text{convexHull}_{\mathbb{K}}(s). \]
AffineMap.image_convexHull theorem
(f : E →ᡃ[π•œ] F) (s : Set E) : f '' convexHull π•œ s = convexHull π•œ (f '' s)
Full source
theorem AffineMap.image_convexHull (f : E →ᡃ[π•œ] F) (s : Set E) :
    f '' convexHull π•œ s = convexHull π•œ (f '' s) := by
  apply Set.Subset.antisymm
  Β· rw [Set.image_subset_iff]
    refine convexHull_min ?_ ((convex_convexHull π•œ (f '' s)).affine_preimage f)
    rw [← Set.image_subset_iff]
    exact subset_convexHull π•œ (f '' s)
  Β· exact convexHull_min (Set.image_subset _ (subset_convexHull π•œ s))
      ((convex_convexHull π•œ s).affine_image f)
Affine Image of Convex Hull Equals Convex Hull of Affine Image
Informal description
For any affine map $f \colon E \to F$ between modules over a scalar ring $\mathbb{K}$ and any subset $s \subseteq E$, the image of the convex hull of $s$ under $f$ equals the convex hull of the image of $s$ under $f$. In symbols: \[ f(\text{convexHull}_{\mathbb{K}}(s)) = \text{convexHull}_{\mathbb{K}}(f(s)). \]
convexHull_subset_affineSpan theorem
(s : Set E) : convexHull π•œ s βŠ† (affineSpan π•œ s : Set E)
Full source
theorem convexHull_subset_affineSpan (s : Set E) : convexHullconvexHull π•œ s βŠ† (affineSpan π•œ s : Set E) :=
  convexHull_min (subset_affineSpan π•œ s) (affineSpan π•œ s).convex
Convex Hull is Contained in Affine Span
Informal description
For any subset $s$ of a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of $s$ is contained in the affine span of $s$. In symbols: \[ \text{convexHull}_{\mathbb{K}}(s) \subseteq \text{affineSpan}_{\mathbb{K}}(s). \]
affineSpan_convexHull theorem
(s : Set E) : affineSpan π•œ (convexHull π•œ s) = affineSpan π•œ s
Full source
@[simp]
theorem affineSpan_convexHull (s : Set E) : affineSpan π•œ (convexHull π•œ s) = affineSpan π•œ s := by
  refine le_antisymm ?_ (affineSpan_mono π•œ (subset_convexHull π•œ s))
  rw [affineSpan_le]
  exact convexHull_subset_affineSpan s
Affine Span of Convex Hull Equals Affine Span
Informal description
For any subset $s$ of a module $E$ over a scalar ring $\mathbb{K}$, the affine span of the convex hull of $s$ is equal to the affine span of $s$. In symbols: \[ \text{affineSpan}_{\mathbb{K}}(\text{convexHull}_{\mathbb{K}}(s)) = \text{affineSpan}_{\mathbb{K}}(s). \]
convexHull_neg theorem
(s : Set E) : convexHull π•œ (-s) = -convexHull π•œ s
Full source
theorem convexHull_neg (s : Set E) : convexHull π•œ (-s) = -convexHull π•œ s := by
  simp_rw [← image_neg_eq_neg]
  exact AffineMap.image_convexHull (-1) _ |>.symm
Negation Commutes with Convex Hull
Informal description
For any subset $s$ of a module $E$ over a scalar ring $\mathbb{K}$, the convex hull of the negation of $s$ equals the negation of the convex hull of $s$. In symbols: \[ \text{convexHull}_{\mathbb{K}}(-s) = -\text{convexHull}_{\mathbb{K}}(s). \]
convexHull_vadd theorem
(x : E) (s : Set E) : convexHull π•œ (x +α΅₯ s) = x +α΅₯ convexHull π•œ s
Full source
lemma convexHull_vadd (x : E) (s : Set E) : convexHull π•œ (x +α΅₯ s) = x +α΅₯ convexHull π•œ s :=
  (AffineEquiv.constVAdd π•œ _ x).toAffineMap.image_convexHull s |>.symm
Convex Hull of Translated Set Equals Translation of Convex Hull
Informal description
For any vector $x$ in a module $E$ over a scalar ring $\mathbb{K}$ and any subset $s \subseteq E$, the convex hull of the translation of $s$ by $x$ is equal to the translation of the convex hull of $s$ by $x$. In symbols: \[ \text{convexHull}_{\mathbb{K}}(x + s) = x + \text{convexHull}_{\mathbb{K}}(s). \]