|
| 1 | +/- |
| 2 | +Copyright (c) 2026 Yaël Dillies. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Yaël Dillies |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.Geometry.Convex.Set |
| 9 | + |
| 10 | +/-! |
| 11 | +# Star-convex sets |
| 12 | +
|
| 13 | +This file defines star-convex sets in a convex space. |
| 14 | +
|
| 15 | +A set is star-convex at `x` if every segment from `x` to a point in the set is contained in the set. |
| 16 | +
|
| 17 | +This is the prototypical example of a contractible set in homotopy theory (by scaling every point |
| 18 | +towards `x`), but has wider uses. |
| 19 | +
|
| 20 | +Note that this has nothing to do with star rings, `Star` and co. |
| 21 | +
|
| 22 | +## Implementation notes |
| 23 | +
|
| 24 | +Instead of saying that a set is star-convex, we say a set is star-convex *at a point*. This has the |
| 25 | +advantage of allowing us to talk about convexity as being "everywhere star-convexity" and of making |
| 26 | +the union of star-convex sets be star-convex. |
| 27 | +
|
| 28 | +Incidentally, this choice means we don't need to assume a set is nonempty for it to be star-convex. |
| 29 | +Concretely, the empty set is star-convex at every point. |
| 30 | +-/ |
| 31 | + |
| 32 | +open Finsupp Set |
| 33 | + |
| 34 | +public section |
| 35 | + |
| 36 | +namespace Convexity |
| 37 | +variable {R X Y : Type*} {ι : Sort*} {κ : ι → Sort*} |
| 38 | + |
| 39 | +section Semiring |
| 40 | +variable [Semiring R] [PartialOrder R] [IsStrictOrderedRing R] [ConvexSpace R X] [ConvexSpace R Y] |
| 41 | + {f : X → Y} {w : StdSimplex R X} {x : X} {s t : Set X} {y : X} |
| 42 | + |
| 43 | +variable (R x s) in |
| 44 | +/-- A set `s` is star-convex at a point `x` if every segment from `x` to a point in `s` is |
| 45 | +contained in `s`. |
| 46 | +
|
| 47 | +TODO: Replace `StarConvex` with this predicate. -/ |
| 48 | +@[expose] |
| 49 | +def IsStarConvexSet : Prop := |
| 50 | + ∀ ⦃y⦄, y ∈ s → ∀ ⦃a b : R⦄ ha hb hab, convexCombPair a b ha hb hab x y ∈ s |
| 51 | + |
| 52 | +@[simp] protected lemma IsStarConvexSet.empty : IsStarConvexSet R x ∅ := by simp [IsStarConvexSet] |
| 53 | + |
| 54 | +@[simp] |
| 55 | +protected lemma IsStarConvexSet.univ : IsStarConvexSet R x .univ := by simp [IsStarConvexSet] |
| 56 | + |
| 57 | +@[simp] protected lemma IsStarConvexSet.singleton : IsStarConvexSet R x {x} := by |
| 58 | + simp [IsStarConvexSet] |
| 59 | + |
| 60 | +@[grind ←] |
| 61 | +protected lemma IsStarConvexSet.inter (hs : IsStarConvexSet R x s) (ht : IsStarConvexSet R x t) : |
| 62 | + IsStarConvexSet R x (s ∩ t) := by simp +contextual [IsStarConvexSet, hs _, ht _] |
| 63 | + |
| 64 | +@[grind ←] |
| 65 | +protected lemma IsStarConvexSet.union (hs : IsStarConvexSet R x s) (ht : IsStarConvexSet R x t) : |
| 66 | + IsStarConvexSet R x (s ∪ t) := by simp +contextual [IsStarConvexSet, hs _, ht _, or_imp] |
| 67 | + |
| 68 | +@[grind ←] |
| 69 | +protected lemma IsStarConvexSet.sInter {S : Set (Set X)} (hS : ∀ s ∈ S, IsStarConvexSet R x s) : |
| 70 | + IsStarConvexSet R x (⋂₀ S) := by simp +contextual [IsStarConvexSet, hS _ _ _] |
| 71 | + |
| 72 | +@[grind ←] |
| 73 | +protected lemma IsStarConvexSet.iInter {s : ι → Set X} (hs : ∀ i, IsStarConvexSet R x (s i)) : |
| 74 | + IsStarConvexSet R x (⋂ i, s i) := by simp +contextual [IsStarConvexSet, hs _ _] |
| 75 | + |
| 76 | +lemma IsStarConvexSet.iInter₂ {s : ∀ i, κ i → Set X} (h : ∀ i j, IsStarConvexSet R x (s i j)) : |
| 77 | + IsStarConvexSet R x (⋂ i, ⋂ j, s i j) := .iInter fun i ↦ .iInter <| h i |
| 78 | + |
| 79 | +@[grind ←] |
| 80 | +protected lemma IsStarConvexSet.sUnion {S : Set (Set X)} (hS : ∀ s ∈ S, IsStarConvexSet R x s) : |
| 81 | + IsStarConvexSet R x (⋃₀ S) := by |
| 82 | + rintro y ⟨s, hs, hy⟩ a ha b hb hab; exact ⟨s, hs, hS _ hs hy _ ..⟩ |
| 83 | + |
| 84 | +@[grind ←] |
| 85 | +protected lemma IsStarConvexSet.iUnion {s : ι → Set X} (hs : ∀ i, IsStarConvexSet R x (s i)) : |
| 86 | + IsStarConvexSet R x (⋃ i, s i) := .sUnion <| by simpa |
| 87 | + |
| 88 | +protected lemma IsStarConvexSet.iUnion₂ {s : ∀ i, κ i → Set X} |
| 89 | + (h : ∀ i j, IsStarConvexSet R x (s i j)) : IsStarConvexSet R x (⋃ i, ⋃ j, s i j) := |
| 90 | + .iUnion fun i ↦ .iUnion <| h i |
| 91 | + |
| 92 | +lemma IsConvexSet.isStarConvexSet (hs : IsConvexSet R s) (hx : x ∈ s) : IsStarConvexSet R x s := |
| 93 | + fun _y hy _a _b _ha _hb _hab ↦ hs.convexCombPair_mem hx hy .. |
| 94 | + |
| 95 | +lemma IsStarConvexSet.mem (hs : IsStarConvexSet R x s) (hs₀ : s.Nonempty) : x ∈ s := by |
| 96 | + obtain ⟨y, hy⟩ := hs₀; simpa using hs hy zero_le_one le_rfl (add_zero _) |
| 97 | + |
| 98 | +@[grind ←] |
| 99 | +protected lemma IsStarConvexSet.preimage {s : Set Y} (hf : IsAffineMap R f) |
| 100 | + (hs : IsStarConvexSet R (f x) s) : IsStarConvexSet R x (f ⁻¹' s) := |
| 101 | + fun y hy a b ha hb hab ↦ by simpa [mem_preimage, hf.map_convexCombPair] using hs hy _ .. |
| 102 | + |
| 103 | +@[grind <=] |
| 104 | +protected lemma IsStarConvexSet.image (hf : IsAffineMap R f) (hs : IsStarConvexSet R x s) : |
| 105 | + IsStarConvexSet R (f x) (f '' s) := by |
| 106 | + rintro _ ⟨y, hy, rfl⟩ a b ha hb hab; exact ⟨_, hs hy _ .., hf.map_convexCombPair ..⟩ |
| 107 | + |
| 108 | +@[grind ←] |
| 109 | +protected lemma IsStarConvexSet.prod {t : Set Y} {y : Y} (hs : IsStarConvexSet R x s) |
| 110 | + (ht : IsStarConvexSet R y t) : IsStarConvexSet R (x, y) (s ×ˢ t) := by |
| 111 | + rintro ⟨w, z⟩ ⟨hw, hz⟩ a b ha hb hab; exact ⟨by simpa using hs hw _ .., by simpa using ht hz _ ..⟩ |
| 112 | + |
| 113 | +@[grind ←] |
| 114 | +protected lemma IsStarConvexSet.pi {ι : Type*} {X : ι → Type*} [∀ i, ConvexSpace R (X i)] |
| 115 | + {s : Set ι} {x : ∀ i, X i} {t : ∀ i, Set (X i)} (ht : ∀ i ∈ s, IsStarConvexSet R (x i) (t i)) : |
| 116 | + IsStarConvexSet R x (s.pi t) := |
| 117 | + fun y hy a b ha hb hab i hi ↦ by simpa using ht _ hi (hy _ hi) _ .. |
| 118 | + |
| 119 | +end Semiring |
| 120 | +end Convexity |
0 commit comments