doc-next-gen

Mathlib.Analysis.Convex.Segment

Module docstring

{"# Segments in vector spaces

In a π•œ-vector space, we define the following objects and properties. * segment π•œ x y: Closed segment joining x and y. * openSegment π•œ x y: Open segment joining x and y.

Notations

We provide the following notation: * [x -[π•œ] y] = segment π•œ x y in locale Convex

TODO

Generalize all this file to affine spaces.

Should we rename segment and openSegment to convex.Icc and convex.Ioo? Should we also define clopenSegment/convex.Ico/convex.Ioc? ","#### Segments in an ordered space

Relates segment, openSegment and Set.Icc, Set.Ico, Set.Ioc, Set.Ioo "}

segment definition
(x y : E) : Set E
Full source
/-- Segments in a vector space. -/
def segment (x y : E) : Set E :=
  { z : E | βˆƒ a b : π•œ, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ a β€’ x + b β€’ y = z }
Closed segment in a vector space
Informal description
The closed segment joining two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$ is the set of all points $z$ that can be expressed as $z = a \cdot x + b \cdot y$ for some scalars $a, b \in \mathbb{K}$ with $a, b \geq 0$ and $a + b = 1$.
openSegment definition
(x y : E) : Set E
Full source
/-- Open segment in a vector space. Note that `openSegment π•œ x x = {x}` instead of being `βˆ…` when
the base semiring has some element between `0` and `1`.
Denoted as `[x -[π•œ] y]` within the `Convex` namespace. -/
def openSegment (x y : E) : Set E :=
  { z : E | βˆƒ a b : π•œ, 0 < a ∧ 0 < b ∧ a + b = 1 ∧ a β€’ x + b β€’ y = z }
Open segment in a vector space
Informal description
The open segment between two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$ is the set of all points $z$ that can be expressed as $z = a \cdot x + b \cdot y$ for some scalars $a, b \in \mathbb{K}$ with $a, b > 0$ and $a + b = 1$. Note that when $x = y$, the open segment is $\{x\}$ rather than empty, provided the base semiring has elements between $0$ and $1$.
segment_eq_imageβ‚‚ theorem
(x y : E) : [x -[π•œ] y] = (fun p : π•œ Γ— π•œ => p.1 β€’ x + p.2 β€’ y) '' {p | 0 ≀ p.1 ∧ 0 ≀ p.2 ∧ p.1 + p.2 = 1}
Full source
theorem segment_eq_imageβ‚‚ (x y : E) :
    [x -[π•œ] y] =
      (fun p : π•œ Γ— π•œ => p.1 β€’ x + p.2 β€’ y) '' { p | 0 ≀ p.1 ∧ 0 ≀ p.2 ∧ p.1 + p.2 = 1 } := by
  simp only [segment, image, Prod.exists, mem_setOf_eq, exists_prop, and_assoc]
Closed Segment as Image of Linear Combination
Informal description
For any points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the closed segment $[x -[π•œ] y]$ is equal to the image of the function $(a, b) \mapsto a \cdot x + b \cdot y$ applied to the set of pairs $(a, b) \in \mathbb{K} \times \mathbb{K}$ such that $a, b \geq 0$ and $a + b = 1$.
openSegment_eq_imageβ‚‚ theorem
(x y : E) : openSegment π•œ x y = (fun p : π•œ Γ— π•œ => p.1 β€’ x + p.2 β€’ y) '' {p | 0 < p.1 ∧ 0 < p.2 ∧ p.1 + p.2 = 1}
Full source
theorem openSegment_eq_imageβ‚‚ (x y : E) :
    openSegment π•œ x y =
      (fun p : π•œ Γ— π•œ => p.1 β€’ x + p.2 β€’ y) '' { p | 0 < p.1 ∧ 0 < p.2 ∧ p.1 + p.2 = 1 } := by
  simp only [openSegment, image, Prod.exists, mem_setOf_eq, exists_prop, and_assoc]
Open Segment as Image of Positive Linear Combination
Informal description
For any points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the open segment between $x$ and $y$ is equal to the image of the function $(a, b) \mapsto a \cdot x + b \cdot y$ applied to the set of pairs $(a, b) \in \mathbb{K} \times \mathbb{K}$ such that $a, b > 0$ and $a + b = 1$.
segment_symm theorem
(x y : E) : [x -[π•œ] y] = [y -[π•œ] x]
Full source
theorem segment_symm (x y : E) : [x -[π•œ] y] = [y -[π•œ] x] :=
  Set.ext fun _ =>
    ⟨fun ⟨a, b, ha, hb, hab, H⟩ => ⟨b, a, hb, ha, (add_comm _ _).trans hab, (add_comm _ _).trans H⟩,
      fun ⟨a, b, ha, hb, hab, H⟩ =>
      ⟨b, a, hb, ha, (add_comm _ _).trans hab, (add_comm _ _).trans H⟩⟩
Symmetry of Closed Segment: $[x -[π•œ] y] = [y -[π•œ] x]$
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the closed segment joining $x$ and $y$ is equal to the closed segment joining $y$ and $x$, i.e., $[x -[π•œ] y] = [y -[π•œ] x]$.
openSegment_symm theorem
(x y : E) : openSegment π•œ x y = openSegment π•œ y x
Full source
theorem openSegment_symm (x y : E) : openSegment π•œ x y = openSegment π•œ y x :=
  Set.ext fun _ =>
    ⟨fun ⟨a, b, ha, hb, hab, H⟩ => ⟨b, a, hb, ha, (add_comm _ _).trans hab, (add_comm _ _).trans H⟩,
      fun ⟨a, b, ha, hb, hab, H⟩ =>
      ⟨b, a, hb, ha, (add_comm _ _).trans hab, (add_comm _ _).trans H⟩⟩
Symmetry of Open Segment: $\text{openSegment}_{\mathbb{K}}(x, y) = \text{openSegment}_{\mathbb{K}}(y, x)$
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the open segment joining $x$ and $y$ is equal to the open segment joining $y$ and $x$, i.e., $\text{openSegment}_{\mathbb{K}}(x, y) = \text{openSegment}_{\mathbb{K}}(y, x)$.
openSegment_subset_segment theorem
(x y : E) : openSegment π•œ x y βŠ† [x -[π•œ] y]
Full source
theorem openSegment_subset_segment (x y : E) : openSegmentopenSegment π•œ x y βŠ† [x -[π•œ] y] :=
  fun _ ⟨a, b, ha, hb, hab, hz⟩ => ⟨a, b, ha.le, hb.le, hab, hz⟩
Open Segment is Subset of Closed Segment
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the open segment joining $x$ and $y$ is a subset of the closed segment joining $x$ and $y$, i.e., $\text{openSegment}_{\mathbb{K}}(x, y) \subseteq [x -[π•œ] y]$.
segment_subset_iff theorem
: [x -[π•œ] y] βŠ† s ↔ βˆ€ a b : π•œ, 0 ≀ a β†’ 0 ≀ b β†’ a + b = 1 β†’ a β€’ x + b β€’ y ∈ s
Full source
theorem segment_subset_iff :
    [x -[π•œ] y][x -[π•œ] y] βŠ† s[x -[π•œ] y] βŠ† s ↔ βˆ€ a b : π•œ, 0 ≀ a β†’ 0 ≀ b β†’ a + b = 1 β†’ a β€’ x + b β€’ y ∈ s :=
  ⟨fun H a b ha hb hab => H ⟨a, b, ha, hb, hab, rfl⟩, fun H _ ⟨a, b, ha, hb, hab, hz⟩ =>
    hz β–Έ H a b ha hb hab⟩
Characterization of Closed Segment Containment: $[x -[\mathbb{K}] y] \subseteq s \leftrightarrow \forall a, b \geq 0, a + b = 1 \Rightarrow a x + b y \in s$
Informal description
For a closed segment $[x -[\mathbb{K}] y]$ in a $\mathbb{K}$-vector space and a set $s$, the segment is contained in $s$ if and only if for all non-negative scalars $a, b \in \mathbb{K}$ with $a + b = 1$, the point $a \cdot x + b \cdot y$ belongs to $s$.
openSegment_subset_iff theorem
: openSegment π•œ x y βŠ† s ↔ βˆ€ a b : π•œ, 0 < a β†’ 0 < b β†’ a + b = 1 β†’ a β€’ x + b β€’ y ∈ s
Full source
theorem openSegment_subset_iff :
    openSegmentopenSegment π•œ x y βŠ† sopenSegment π•œ x y βŠ† s ↔ βˆ€ a b : π•œ, 0 < a β†’ 0 < b β†’ a + b = 1 β†’ a β€’ x + b β€’ y ∈ s :=
  ⟨fun H a b ha hb hab => H ⟨a, b, ha, hb, hab, rfl⟩, fun H _ ⟨a, b, ha, hb, hab, hz⟩ =>
    hz β–Έ H a b ha hb hab⟩
Characterization of Open Segment Containment via Convex Combinations
Informal description
For any subset $s$ of a $\mathbb{K}$-vector space $E$, the open segment between two points $x$ and $y$ is contained in $s$ if and only if for all positive scalars $a, b \in \mathbb{K}$ with $a + b = 1$, the convex combination $a \cdot x + b \cdot y$ belongs to $s$.
right_mem_segment theorem
(x y : E) : y ∈ [x -[π•œ] y]
Full source
theorem right_mem_segment (x y : E) : y ∈ [x -[π•œ] y] :=
  segment_symm π•œ y x β–Έ left_mem_segment π•œ y x
Right Endpoint Belongs to Closed Segment
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the point $y$ belongs to the closed segment joining $x$ and $y$, denoted $[x -[\mathbb{K}] y]$.
segment_same theorem
(x : E) : [x -[π•œ] x] = { x }
Full source
@[simp]
theorem segment_same (x : E) : [x -[π•œ] x] = {x} :=
  Set.ext fun z =>
    ⟨fun ⟨a, b, _, _, hab, hz⟩ => by
      simpa only [(add_smul _ _ _).symm, mem_singleton_iff, hab, one_smul, eq_comm] using hz,
      fun h => mem_singleton_iff.1 h β–Έ left_mem_segment π•œ z z⟩
Closed Segment at a Point is Singleton: $[x -[\mathbb{K}] x] = \{x\}$
Informal description
For any point $x$ in a $\mathbb{K}$-vector space $E$, the closed segment joining $x$ to itself is equal to the singleton set $\{x\}$, i.e., $[x -[\mathbb{K}] x] = \{x\}$.
insert_endpoints_openSegment theorem
(x y : E) : insert x (insert y (openSegment π•œ x y)) = [x -[π•œ] y]
Full source
theorem insert_endpoints_openSegment (x y : E) :
    insert x (insert y (openSegment π•œ x y)) = [x -[π•œ] y] := by
  simp only [subset_antisymm_iff, insert_subset_iff, left_mem_segment, right_mem_segment,
    openSegment_subset_segment, true_and]
  rintro z ⟨a, b, ha, hb, hab, rfl⟩
  refine hb.eq_or_gt.imp ?_ fun hb' => ha.eq_or_gt.imp ?_ fun ha' => ?_
  Β· rintro rfl
    rw [← add_zero a, hab, one_smul, zero_smul, add_zero]
  Β· rintro rfl
    rw [← zero_add b, hab, one_smul, zero_smul, zero_add]
  · exact ⟨a, b, ha', hb', hab, rfl⟩
Closed Segment as Open Segment with Endpoints: $[x -[\mathbb{K}] y] = \{x,y\} \cup \text{openSegment}_{\mathbb{K}}(x,y)$
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the set obtained by inserting the endpoints $x$ and $y$ into the open segment between $x$ and $y$ equals the closed segment joining $x$ and $y$. In other words: \[ \{x\} \cup \{y\} \cup \text{openSegment}_{\mathbb{K}}(x,y) = [x -[\mathbb{K}] y] \]
mem_openSegment_of_ne_left_right theorem
(hx : x β‰  z) (hy : y β‰  z) (hz : z ∈ [x -[π•œ] y]) : z ∈ openSegment π•œ x y
Full source
theorem mem_openSegment_of_ne_left_right (hx : x β‰  z) (hy : y β‰  z) (hz : z ∈ [x -[π•œ] y]) :
    z ∈ openSegment π•œ x y := by
  rw [← insert_endpoints_openSegment] at hz
  exact (hz.resolve_left hx.symm).resolve_left hy.symm
Non-Endpoint in Closed Segment Implies Membership in Open Segment
Informal description
For any points $x$, $y$, and $z$ in a $\mathbb{K}$-vector space $E$, if $x \neq z$, $y \neq z$, and $z$ belongs to the closed segment $[x -[\mathbb{K}] y]$, then $z$ belongs to the open segment between $x$ and $y$.
openSegment_subset_iff_segment_subset theorem
(hx : x ∈ s) (hy : y ∈ s) : openSegment π•œ x y βŠ† s ↔ [x -[π•œ] y] βŠ† s
Full source
theorem openSegment_subset_iff_segment_subset (hx : x ∈ s) (hy : y ∈ s) :
    openSegmentopenSegment π•œ x y βŠ† sopenSegment π•œ x y βŠ† s ↔ [x -[π•œ] y] βŠ† s := by
  simp only [← insert_endpoints_openSegment, insert_subset_iff, *, true_and]
Open Segment Subset Equivalence to Closed Segment Subset
Informal description
For any two points $x$ and $y$ in a set $s$ in a $\mathbb{K}$-vector space $E$, the open segment between $x$ and $y$ is a subset of $s$ if and only if the closed segment between $x$ and $y$ is a subset of $s$. In other words: \[ \text{openSegment}_{\mathbb{K}}(x,y) \subseteq s \leftrightarrow [x -[π•œ] y] \subseteq s \]
openSegment_same theorem
(x : E) : openSegment π•œ x x = { x }
Full source
@[simp]
theorem openSegment_same (x : E) : openSegment π•œ x x = {x} :=
  Set.ext fun z =>
    ⟨fun ⟨a, b, _, _, hab, hz⟩ => by
      simpa only [← add_smul, mem_singleton_iff, hab, one_smul, eq_comm] using hz,
    fun h : z = x => by
      obtain ⟨a, haβ‚€, haβ‚βŸ© := DenselyOrdered.dense (0 : π•œ) 1 zero_lt_one
      refine ⟨a, 1 - a, haβ‚€, sub_pos_of_lt ha₁, add_sub_cancel _ _, ?_⟩
      rw [← add_smul, add_sub_cancel, one_smul, h]⟩
Open Segment at a Point is Singleton
Informal description
For any point $x$ in a vector space $E$ over a field $\mathbb{K}$, the open segment between $x$ and itself is the singleton set $\{x\}$.
segment_eq_image theorem
(x y : E) : [x -[π•œ] y] = (fun ΞΈ : π•œ => (1 - ΞΈ) β€’ x + ΞΈ β€’ y) '' Icc (0 : π•œ) 1
Full source
theorem segment_eq_image (x y : E) :
    [x -[π•œ] y] = (fun ΞΈ : π•œ => (1 - ΞΈ) β€’ x + ΞΈ β€’ y) '' Icc (0 : π•œ) 1 :=
  Set.ext fun _ =>
    ⟨fun ⟨a, b, ha, hb, hab, hz⟩ =>
      ⟨b, ⟨hb, hab β–Έ le_add_of_nonneg_left ha⟩, hab β–Έ hz β–Έ by simp only [add_sub_cancel_right]⟩,
      fun ⟨θ, ⟨hΞΈβ‚€, hΞΈβ‚βŸ©, hz⟩ => ⟨1 - ΞΈ, ΞΈ, sub_nonneg.2 hθ₁, hΞΈβ‚€, sub_add_cancel _ _, hz⟩⟩
Closed Segment as Affine Image of Unit Interval
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the closed segment $[x -[π•œ] y]$ is equal to the image of the closed unit interval $[0,1] \subseteq \mathbb{K}$ under the affine map $\theta \mapsto (1-\theta)x + \theta y$. In other words: \[ [x -[π•œ] y] = \{(1-\theta)x + \theta y \mid \theta \in [0,1]\} \]
openSegment_eq_image theorem
(x y : E) : openSegment π•œ x y = (fun ΞΈ : π•œ => (1 - ΞΈ) β€’ x + ΞΈ β€’ y) '' Ioo (0 : π•œ) 1
Full source
theorem openSegment_eq_image (x y : E) :
    openSegment π•œ x y = (fun ΞΈ : π•œ => (1 - ΞΈ) β€’ x + ΞΈ β€’ y) '' Ioo (0 : π•œ) 1 :=
  Set.ext fun _ =>
    ⟨fun ⟨a, b, ha, hb, hab, hz⟩ =>
      ⟨b, ⟨hb, hab β–Έ lt_add_of_pos_left _ ha⟩, hab β–Έ hz β–Έ by simp only [add_sub_cancel_right]⟩,
      fun ⟨θ, ⟨hΞΈβ‚€, hΞΈβ‚βŸ©, hz⟩ => ⟨1 - ΞΈ, ΞΈ, sub_pos.2 hθ₁, hΞΈβ‚€, sub_add_cancel _ _, hz⟩⟩
Open Segment as Affine Image of Unit Interval
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the open segment between $x$ and $y$ is equal to the image of the open unit interval $(0,1) \subseteq \mathbb{K}$ under the affine map $\theta \mapsto (1-\theta)x + \theta y$. In other words: \[ \text{openSegment}_{\mathbb{K}}(x,y) = \{(1-\theta)x + \theta y \mid \theta \in (0,1)\} \]
segment_eq_image' theorem
(x y : E) : [x -[π•œ] y] = (fun ΞΈ : π•œ => x + ΞΈ β€’ (y - x)) '' Icc (0 : π•œ) 1
Full source
theorem segment_eq_image' (x y : E) :
    [x -[π•œ] y] = (fun ΞΈ : π•œ => x + ΞΈ β€’ (y - x)) '' Icc (0 : π•œ) 1 := by
  convert segment_eq_image π•œ x y using 2
  simp only [smul_sub, sub_smul, one_smul]
  abel
Closed Segment as Affine Image of Unit Interval via Relative Coordinates
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the closed segment $[x -[π•œ] y]$ is equal to the image of the closed unit interval $[0,1] \subseteq \mathbb{K}$ under the affine map $\theta \mapsto x + \theta(y - x)$. In other words: \[ [x -[π•œ] y] = \{x + \theta(y - x) \mid \theta \in [0,1]\} \]
openSegment_eq_image' theorem
(x y : E) : openSegment π•œ x y = (fun ΞΈ : π•œ => x + ΞΈ β€’ (y - x)) '' Ioo (0 : π•œ) 1
Full source
theorem openSegment_eq_image' (x y : E) :
    openSegment π•œ x y = (fun ΞΈ : π•œ => x + ΞΈ β€’ (y - x)) '' Ioo (0 : π•œ) 1 := by
  convert openSegment_eq_image π•œ x y using 2
  simp only [smul_sub, sub_smul, one_smul]
  abel
Open Segment as Affine Image of Unit Interval via Difference Vector
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the open segment between $x$ and $y$ is equal to the image of the open unit interval $(0,1) \subseteq \mathbb{K}$ under the affine map $\theta \mapsto x + \theta(y - x)$. In other words: \[ \text{openSegment}_{\mathbb{K}}(x,y) = \{x + \theta(y - x) \mid \theta \in (0,1)\} \]
segment_eq_image_lineMap theorem
(x y : E) : [x -[π•œ] y] = AffineMap.lineMap x y '' Icc (0 : π•œ) 1
Full source
theorem segment_eq_image_lineMap (x y : E) : [x -[π•œ] y] =
    AffineMap.lineMapAffineMap.lineMap x y '' Icc (0 : π•œ) 1 := by
  convert segment_eq_image π•œ x y using 2
  exact AffineMap.lineMap_apply_module _ _ _
Closed Segment as Affine Image of Unit Interval via Line Map
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the closed segment $[x -[π•œ] y]$ is equal to the image of the closed unit interval $[0,1] \subseteq \mathbb{K}$ under the affine map $\text{AffineMap.lineMap}\,x\,y$, which maps $\theta \in \mathbb{K}$ to $(1-\theta)x + \theta y$. In other words: \[ [x -[π•œ] y] = \{(1-\theta)x + \theta y \mid \theta \in [0,1]\} \]
openSegment_eq_image_lineMap theorem
(x y : E) : openSegment π•œ x y = AffineMap.lineMap x y '' Ioo (0 : π•œ) 1
Full source
theorem openSegment_eq_image_lineMap (x y : E) :
    openSegment π•œ x y = AffineMap.lineMapAffineMap.lineMap x y '' Ioo (0 : π•œ) 1 := by
  convert openSegment_eq_image π•œ x y using 2
  exact AffineMap.lineMap_apply_module _ _ _
Open Segment as Affine Image of Unit Interval via Line Map
Informal description
For any two points $x$ and $y$ in a vector space $E$ over a field $\mathbb{K}$, the open segment between $x$ and $y$ is equal to the image of the open unit interval $(0,1) \subseteq \mathbb{K}$ under the affine map $\text{lineMap}(x,y) : \mathbb{K} \to E$ defined by $\theta \mapsto (1-\theta)x + \theta y$. In other words: \[ \text{openSegment}_{\mathbb{K}}(x,y) = \{\text{lineMap}(x,y)(\theta) \mid \theta \in (0,1)\} \]
image_segment theorem
(f : E →ᡃ[π•œ] F) (a b : E) : f '' [a -[π•œ] b] = [f a -[π•œ] f b]
Full source
@[simp]
theorem image_segment (f : E →ᡃ[π•œ] F) (a b : E) : f '' [a -[π•œ] b] = [f a -[π•œ] f b] :=
  Set.ext fun x => by
    simp_rw [segment_eq_image_lineMap, mem_image, exists_exists_and_eq_and, AffineMap.apply_lineMap]
Image of Closed Segment under Affine Map is Closed Segment of Images
Informal description
For any affine map $f \colon E \to F$ between vector spaces over a field $\mathbb{K}$, and any two points $a, b \in E$, the image of the closed segment $[a -[π•œ] b]$ under $f$ is equal to the closed segment $[f(a) -[π•œ] f(b)]$ in $F$. In other words: \[ f([a, b]) = [f(a), f(b)] \] where $[a, b]$ denotes the closed segment joining $a$ and $b$ in $E$, and $[f(a), f(b)]$ denotes the closed segment joining $f(a)$ and $f(b)$ in $F$.
image_openSegment theorem
(f : E →ᡃ[π•œ] F) (a b : E) : f '' openSegment π•œ a b = openSegment π•œ (f a) (f b)
Full source
@[simp]
theorem image_openSegment (f : E →ᡃ[π•œ] F) (a b : E) :
    f '' openSegment π•œ a b = openSegment π•œ (f a) (f b) :=
  Set.ext fun x => by
    simp_rw [openSegment_eq_image_lineMap, mem_image, exists_exists_and_eq_and,
      AffineMap.apply_lineMap]
Affine Image of Open Segment Equals Open Segment of Images
Informal description
Let $E$ and $F$ be vector spaces over a field $\mathbb{K}$, and let $f : E \to F$ be an affine map. For any two points $a, b \in E$, the image of the open segment $\text{openSegment}_{\mathbb{K}}(a,b)$ under $f$ equals the open segment between $f(a)$ and $f(b)$ in $F$, i.e., \[ f(\text{openSegment}_{\mathbb{K}}(a,b)) = \text{openSegment}_{\mathbb{K}}(f(a), f(b)). \]
vadd_segment theorem
[AddTorsor G E] [VAddCommClass G E E] (a : G) (b c : E) : a +α΅₯ [b -[π•œ] c] = [a +α΅₯ b -[π•œ] a +α΅₯ c]
Full source
@[simp]
theorem vadd_segment [AddTorsor G E] [VAddCommClass G E E] (a : G) (b c : E) :
    a +α΅₯ [b -[π•œ] c] = [a +α΅₯ b -[π•œ] a +α΅₯ c] :=
  image_segment π•œ ⟨_, LinearMap.id, fun _ _ => vadd_comm _ _ _⟩ b c
Translation of Closed Segment Equals Closed Segment of Translations
Informal description
Let $G$ be an additive torsor acting on a $\mathbb{K}$-vector space $E$ with a compatible vector addition structure. For any element $a \in G$ and any points $b, c \in E$, the translation of the closed segment $[b, c]$ by $a$ is equal to the closed segment formed by translating $b$ and $c$ by $a$, i.e., \[ a + [b, c] = [a + b, a + c]. \]
vadd_openSegment theorem
[AddTorsor G E] [VAddCommClass G E E] (a : G) (b c : E) : a +α΅₯ openSegment π•œ b c = openSegment π•œ (a +α΅₯ b) (a +α΅₯ c)
Full source
@[simp]
theorem vadd_openSegment [AddTorsor G E] [VAddCommClass G E E] (a : G) (b c : E) :
    a +α΅₯ openSegment π•œ b c = openSegment π•œ (a +α΅₯ b) (a +α΅₯ c) :=
  image_openSegment π•œ ⟨_, LinearMap.id, fun _ _ => vadd_comm _ _ _⟩ b c
Translation Invariance of Open Segment under Torsor Action
Informal description
Let $G$ be an additive torsor acting on a $\mathbb{K}$-vector space $E$, with the action satisfying the commutative property `VAddCommClass`. For any element $a \in G$ and any points $b, c \in E$, the translation of the open segment $\text{openSegment}_{\mathbb{K}}(b, c)$ by $a$ equals the open segment between the translated points $a +α΅₯ b$ and $a +α΅₯ c$, i.e., \[ a +α΅₯ \text{openSegment}_{\mathbb{K}}(b, c) = \text{openSegment}_{\mathbb{K}}(a +α΅₯ b, a +α΅₯ c). \]
mem_segment_translate theorem
(a : E) {x b c} : a + x ∈ [a + b -[π•œ] a + c] ↔ x ∈ [b -[π•œ] c]
Full source
@[simp]
theorem mem_segment_translate (a : E) {x b c} : a + x ∈ [a + b -[π•œ] a + c]a + x ∈ [a + b -[π•œ] a + c] ↔ x ∈ [b -[π•œ] c] := by
  simp_rw [← vadd_eq_add, ← vadd_segment, vadd_mem_vadd_set_iff]
Translation Invariance of Closed Segment Membership
Informal description
For any point $a$ in a $\mathbb{K}$-vector space $E$, and for any points $x, b, c \in E$, the translated point $a + x$ belongs to the closed segment $[a + b, a + c]$ if and only if $x$ belongs to the closed segment $[b, c]$.
mem_openSegment_translate theorem
(a : E) {x b c : E} : a + x ∈ openSegment π•œ (a + b) (a + c) ↔ x ∈ openSegment π•œ b c
Full source
@[simp]
theorem mem_openSegment_translate (a : E) {x b c : E} :
    a + x ∈ openSegment π•œ (a + b) (a + c)a + x ∈ openSegment π•œ (a + b) (a + c) ↔ x ∈ openSegment π•œ b c := by
  simp_rw [← vadd_eq_add, ← vadd_openSegment, vadd_mem_vadd_set_iff]
Translation Invariance of Open Segment Membership
Informal description
For any point $a$ in a $\mathbb{K}$-vector space $E$, and for any points $x, b, c \in E$, the translated point $a + x$ belongs to the open segment between $a + b$ and $a + c$ if and only if $x$ belongs to the open segment between $b$ and $c$.
segment_translate_preimage theorem
(a b c : E) : (fun x => a + x) ⁻¹' [a + b -[π•œ] a + c] = [b -[π•œ] c]
Full source
theorem segment_translate_preimage (a b c : E) :
    (fun x => a + x) ⁻¹' [a + b -[π•œ] a + c] = [b -[π•œ] c] :=
  Set.ext fun _ => mem_segment_translate π•œ a
Preimage of Translated Closed Segment Equals Original Closed Segment
Informal description
For any points $a, b, c$ in a $\mathbb{K}$-vector space $E$, the preimage of the closed segment $[a + b, a + c]$ under the translation map $x \mapsto a + x$ is equal to the closed segment $[b, c]$. In other words, $$(x \mapsto a + x)^{-1}\big([a + b, a + c]\big) = [b, c].$$
openSegment_translate_preimage theorem
(a b c : E) : (fun x => a + x) ⁻¹' openSegment π•œ (a + b) (a + c) = openSegment π•œ b c
Full source
theorem openSegment_translate_preimage (a b c : E) :
    (fun x => a + x) ⁻¹' openSegment π•œ (a + b) (a + c) = openSegment π•œ b c :=
  Set.ext fun _ => mem_openSegment_translate π•œ a
Preimage of Translated Open Segment Equals Original Open Segment
Informal description
For any points $a, b, c$ in a $\mathbb{K}$-vector space $E$, the preimage of the open segment between $a + b$ and $a + c$ under the translation map $x \mapsto a + x$ is equal to the open segment between $b$ and $c$. In other words, $$(x \mapsto a + x)^{-1}\big(\text{openSegment}_{\mathbb{K}}(a + b, a + c)\big) = \text{openSegment}_{\mathbb{K}}(b, c).$$
segment_translate_image theorem
(a b c : E) : (fun x => a + x) '' [b -[π•œ] c] = [a + b -[π•œ] a + c]
Full source
theorem segment_translate_image (a b c : E) : (fun x => a + x) '' [b -[π•œ] c] = [a + b -[π•œ] a + c] :=
  segment_translate_preimage π•œ a b c β–Έ image_preimage_eq _ <| add_left_surjective a
Image of Closed Segment under Translation Equals Translated Closed Segment
Informal description
For any points $a, b, c$ in a $\mathbb{K}$-vector space $E$, the image of the closed segment $[b, c]$ under the translation map $x \mapsto a + x$ is equal to the closed segment $[a + b, a + c]$. In other words, $$(x \mapsto a + x)\big([b, c]\big) = [a + b, a + c].$$
openSegment_translate_image theorem
(a b c : E) : (fun x => a + x) '' openSegment π•œ b c = openSegment π•œ (a + b) (a + c)
Full source
theorem openSegment_translate_image (a b c : E) :
    (fun x => a + x) '' openSegment π•œ b c = openSegment π•œ (a + b) (a + c) :=
  openSegment_translate_preimage π•œ a b c β–Έ image_preimage_eq _ <| add_left_surjective a
Image of Open Segment under Translation is Open Segment
Informal description
For any points $a, b, c$ in a $\mathbb{K}$-vector space $E$, the image of the open segment between $b$ and $c$ under the translation map $x \mapsto a + x$ is equal to the open segment between $a + b$ and $a + c$. In other words, $$(x \mapsto a + x)\big(\text{openSegment}_{\mathbb{K}}(b, c)\big) = \text{openSegment}_{\mathbb{K}}(a + b, a + c).$$
segment_inter_subset_endpoint_of_linearIndependent_sub theorem
{c x y : E} (h : LinearIndependent π•œ ![x - c, y - c]) : [c -[π•œ] x] ∩ [c -[π•œ] y] βŠ† { c }
Full source
lemma segment_inter_subset_endpoint_of_linearIndependent_sub
    {c x y : E} (h : LinearIndependent π•œ ![x - c, y - c]) :
    [c -[π•œ] x][c -[π•œ] x] ∩ [c -[π•œ] y][c -[π•œ] x] ∩ [c -[π•œ] y] βŠ† {c} := by
  intro z ⟨hzt, hzs⟩
  rw [segment_eq_image, mem_image] at hzt hzs
  rcases hzt with ⟨p, ⟨p0, p1⟩, rfl⟩
  rcases hzs with ⟨q, ⟨q0, q1⟩, H⟩
  have Hx : x = (x - c) + c := by abel
  have Hy : y = (y - c) + c := by abel
  rw [Hx, Hy, smul_add, smul_add] at H
  have : c + q β€’ (y - c) = c + p β€’ (x - c) := by
    convert H using 1 <;> simp [sub_smul]
  obtain ⟨rfl, rfl⟩ : p = 0 ∧ q = 0 := h.eq_zero_of_pair' ((add_right_inj c).1 this).symm
  simp
Intersection of Segments with Common Endpoint is Trivial under Linear Independence
Informal description
Let $E$ be a vector space over a field $\mathbb{K}$, and let $c, x, y \in E$. If the vectors $x - c$ and $y - c$ are linearly independent in $E$, then the intersection of the closed segments $[c, x]$ and $[c, y]$ is contained in the singleton set $\{c\}$.
segment_inter_eq_endpoint_of_linearIndependent_sub theorem
[ZeroLEOneClass π•œ] {c x y : E} (h : LinearIndependent π•œ ![x - c, y - c]) : [c -[π•œ] x] ∩ [c -[π•œ] y] = { c }
Full source
lemma segment_inter_eq_endpoint_of_linearIndependent_sub [ZeroLEOneClass π•œ]
    {c x y : E} (h : LinearIndependent π•œ ![x - c, y - c]) :
    [c -[π•œ] x][c -[π•œ] x] ∩ [c -[π•œ] y] = {c} := by
  refine (segment_inter_subset_endpoint_of_linearIndependent_sub π•œ h).antisymm ?_
  simp [singleton_subset_iff, left_mem_segment]
Intersection of Segments with Common Endpoint is Exactly the Endpoint under Linear Independence
Informal description
Let $E$ be a vector space over a field $\mathbb{K}$ with $0 \leq 1$ in $\mathbb{K}$, and let $c, x, y \in E$. If the vectors $x - c$ and $y - c$ are linearly independent in $E$, then the intersection of the closed segments $[c, x]$ and $[c, y]$ is equal to the singleton set $\{c\}$.
sameRay_of_mem_segment theorem
[CommRing π•œ] [PartialOrder π•œ] [IsStrictOrderedRing π•œ] [AddCommGroup E] [Module π•œ E] {x y z : E} (h : x ∈ [y -[π•œ] z]) : SameRay π•œ (x - y) (z - x)
Full source
theorem sameRay_of_mem_segment [CommRing π•œ] [PartialOrder π•œ] [IsStrictOrderedRing π•œ]
    [AddCommGroup E] [Module π•œ E] {x y z : E}
    (h : x ∈ [y -[π•œ] z]) : SameRay π•œ (x - y) (z - x) := by
  rw [segment_eq_image'] at h
  rcases h with ⟨θ, ⟨hΞΈβ‚€, hΞΈβ‚βŸ©, rfl⟩
  simpa only [add_sub_cancel_left, ← sub_sub, sub_smul, one_smul] using
    (SameRay.sameRay_nonneg_smul_left (z - y) hΞΈβ‚€).nonneg_smul_right (sub_nonneg.2 hθ₁)
Same-Ray Condition for Points in a Closed Segment
Informal description
Let $\mathbb{K}$ be a commutative ring with a partial order and a strict ordered ring structure, and let $E$ be a $\mathbb{K}$-module. For any points $x, y, z \in E$, if $x$ lies in the closed segment $[y -[π•œ] z]$ joining $y$ and $z$, then the vectors $x - y$ and $z - x$ lie on the same ray in $E$.
segment_inter_eq_endpoint_of_linearIndependent_of_ne theorem
[CommRing π•œ] [PartialOrder π•œ] [IsOrderedRing π•œ] [NoZeroDivisors π•œ] [AddCommGroup E] [Module π•œ E] {x y : E} (h : LinearIndependent π•œ ![x, y]) {s t : π•œ} (hs : s β‰  t) (c : E) : [c + x -[π•œ] c + t β€’ y] ∩ [c + x -[π•œ] c + s β€’ y] = {c + x}
Full source
lemma segment_inter_eq_endpoint_of_linearIndependent_of_ne
    [CommRing π•œ] [PartialOrder π•œ] [IsOrderedRing π•œ] [NoZeroDivisors π•œ]
    [AddCommGroup E] [Module π•œ E]
    {x y : E} (h : LinearIndependent π•œ ![x, y]) {s t : π•œ} (hs : s β‰  t) (c : E) :
    [c + x -[π•œ] c + t β€’ y][c + x -[π•œ] c + t β€’ y] ∩ [c + x -[π•œ] c + s β€’ y] = {c + x} := by
  apply segment_inter_eq_endpoint_of_linearIndependent_sub
  simp only [add_sub_add_left_eq_sub]
  suffices H : LinearIndependent π•œ ![(-1 : π•œ) β€’ x + t β€’ y, (-1 : π•œ) β€’ x + s β€’ y] by
    convert H using 1; simp only [neg_smul, one_smul]; abel_nf
  nontriviality π•œ
  rw [LinearIndependent.pair_add_smul_add_smul_iff]
  aesop
Intersection of Segments with Common Endpoint is Exactly the Endpoint under Linear Independence and Distinct Scalars
Informal description
Let $\mathbb{K}$ be a commutative ring with a partial order and an ordered ring structure, and with no zero divisors. Let $E$ be a $\mathbb{K}$-module, and let $x, y \in E$ be linearly independent vectors over $\mathbb{K}$. For any distinct scalars $s, t \in \mathbb{K}$ and any vector $c \in E$, the intersection of the closed segments $[c + x, c + t \cdot y]$ and $[c + x, c + s \cdot y]$ is the singleton set $\{c + x\}$.
midpoint_mem_segment theorem
[Invertible (2 : π•œ)] (x y : E) : midpoint π•œ x y ∈ [x -[π•œ] y]
Full source
theorem midpoint_mem_segment [Invertible (2 : π•œ)] (x y : E) : midpointmidpoint π•œ x y ∈ [x -[π•œ] y] := by
  rw [segment_eq_image_lineMap]
  exact βŸ¨β…Ÿ 2, ⟨invOf_nonneg.mpr zero_le_two, invOf_le_one one_le_two⟩, rfl⟩
Midpoint Lies in Closed Segment
Informal description
Let $\mathbb{K}$ be a ring with an invertible element $2$, and let $E$ be a $\mathbb{K}$-module. For any two points $x, y \in E$, the midpoint of $x$ and $y$ lies in the closed segment joining $x$ and $y$, i.e., \[ \text{midpoint}_{\mathbb{K}}(x, y) \in [x -[\mathbb{K}] y]. \]
mem_segment_sub_add theorem
[Invertible (2 : π•œ)] (x y : E) : x ∈ [x - y -[π•œ] x + y]
Full source
theorem mem_segment_sub_add [Invertible (2 : π•œ)] (x y : E) : x ∈ [x - y -[π•œ] x + y] := by
  convert midpoint_mem_segment (π•œ := π•œ) (x - y) (x + y)
  rw [midpoint_sub_add]
Point $x$ lies in the segment between $x - y$ and $x + y$ when $2$ is invertible
Informal description
Let $\mathbb{K}$ be a ring with an invertible element $2$, and let $E$ be a $\mathbb{K}$-module. For any two points $x, y \in E$, the point $x$ lies in the closed segment joining $x - y$ and $x + y$, i.e., \[ x \in [x - y, x + y]. \]
mem_segment_add_sub theorem
[Invertible (2 : π•œ)] (x y : E) : x ∈ [x + y -[π•œ] x - y]
Full source
theorem mem_segment_add_sub [Invertible (2 : π•œ)] (x y : E) : x ∈ [x + y -[π•œ] x - y] := by
  convert midpoint_mem_segment (π•œ := π•œ) (x + y) (x - y)
  rw [midpoint_add_sub]
Point Lies in Segment Between Sum and Difference
Informal description
Let $\mathbb{K}$ be a ring with an invertible element $2$, and let $E$ be a $\mathbb{K}$-module. For any two points $x, y \in E$, the point $x$ lies in the closed segment joining $x + y$ and $x - y$, i.e., \[ x \in [x + y -[\mathbb{K}] x - y]. \]
left_mem_openSegment_iff theorem
[DenselyOrdered π•œ] [NoZeroSMulDivisors π•œ E] : x ∈ openSegment π•œ x y ↔ x = y
Full source
@[simp]
theorem left_mem_openSegment_iff [DenselyOrdered π•œ] [NoZeroSMulDivisors π•œ E] :
    x ∈ openSegment π•œ x yx ∈ openSegment π•œ x y ↔ x = y := by
  constructor
  · rintro ⟨a, b, _, hb, hab, hx⟩
    refine smul_right_injective _ hb.ne' ((add_right_inj (a β€’ x)).1 ?_)
    rw [hx, ← add_smul, hab, one_smul]
  Β· rintro rfl
    rw [openSegment_same]
    exact mem_singleton _
Characterization of Left Endpoint in Open Segment: $x \in \mathopen{]}x, y\mathclose{[} \leftrightarrow x = y$
Informal description
Let $\mathbb{K}$ be a densely ordered field and $E$ be a vector space over $\mathbb{K}$ with no zero scalar multiplication divisors. For any two points $x, y \in E$, the point $x$ belongs to the open segment between $x$ and $y$ if and only if $x = y$.
right_mem_openSegment_iff theorem
[DenselyOrdered π•œ] [NoZeroSMulDivisors π•œ E] : y ∈ openSegment π•œ x y ↔ x = y
Full source
@[simp]
theorem right_mem_openSegment_iff [DenselyOrdered π•œ] [NoZeroSMulDivisors π•œ E] :
    y ∈ openSegment π•œ x yy ∈ openSegment π•œ x y ↔ x = y := by rw [openSegment_symm, left_mem_openSegment_iff, eq_comm]
Characterization of Right Endpoint in Open Segment: $y \in \mathopen{]}x, y\mathclose{[} \leftrightarrow x = y$
Informal description
Let $\mathbb{K}$ be a densely ordered field and $E$ be a vector space over $\mathbb{K}$ with no zero scalar multiplication divisors. For any two points $x, y \in E$, the point $y$ belongs to the open segment between $x$ and $y$ if and only if $x = y$.
mem_segment_iff_div theorem
: x ∈ [y -[π•œ] z] ↔ βˆƒ a b : π•œ, 0 ≀ a ∧ 0 ≀ b ∧ 0 < a + b ∧ (a / (a + b)) β€’ y + (b / (a + b)) β€’ z = x
Full source
theorem mem_segment_iff_div :
    x ∈ [y -[π•œ] z]x ∈ [y -[π•œ] z] ↔
      βˆƒ a b : π•œ, 0 ≀ a ∧ 0 ≀ b ∧ 0 < a + b ∧ (a / (a + b)) β€’ y + (b / (a + b)) β€’ z = x := by
  constructor
  · rintro ⟨a, b, ha, hb, hab, rfl⟩
    use a, b, ha, hb
    simp [*]
  · rintro ⟨a, b, ha, hb, hab, rfl⟩
    refine ⟨a / (a + b), b / (a + b), by positivity, by positivity, ?_, rfl⟩
    rw [← add_div, div_self hab.ne']
Characterization of Points in Closed Segment via Non-Negative Weights
Informal description
For any points $x, y, z$ in a $\mathbb{K}$-vector space $E$, the point $x$ belongs to the closed segment between $y$ and $z$ if and only if there exist non-negative scalars $a, b \in \mathbb{K}$ with $a + b > 0$ such that $x = \frac{a}{a + b} \cdot y + \frac{b}{a + b} \cdot z$.
mem_openSegment_iff_div theorem
: x ∈ openSegment π•œ y z ↔ βˆƒ a b : π•œ, 0 < a ∧ 0 < b ∧ (a / (a + b)) β€’ y + (b / (a + b)) β€’ z = x
Full source
theorem mem_openSegment_iff_div : x ∈ openSegment π•œ y zx ∈ openSegment π•œ y z ↔
    βˆƒ a b : π•œ, 0 < a ∧ 0 < b ∧ (a / (a + b)) β€’ y + (b / (a + b)) β€’ z = x := by
  constructor
  · rintro ⟨a, b, ha, hb, hab, rfl⟩
    use a, b, ha, hb
    rw [hab, div_one, div_one]
  · rintro ⟨a, b, ha, hb, rfl⟩
    have hab : 0 < a + b := add_pos' ha hb
    refine ⟨a / (a + b), b / (a + b), by positivity, by positivity, ?_, rfl⟩
    rw [← add_div, div_self hab.ne']
Characterization of Points in Open Segment via Positive Weights
Informal description
For any points $x, y, z$ in a $\mathbb{K}$-vector space $E$, the point $x$ belongs to the open segment between $y$ and $z$ if and only if there exist positive scalars $a, b \in \mathbb{K}$ such that $x = \frac{a}{a + b} \cdot y + \frac{b}{a + b} \cdot z$.
mem_segment_iff_sameRay theorem
: x ∈ [y -[π•œ] z] ↔ SameRay π•œ (x - y) (z - x)
Full source
theorem mem_segment_iff_sameRay : x ∈ [y -[π•œ] z]x ∈ [y -[π•œ] z] ↔ SameRay π•œ (x - y) (z - x) := by
  refine ⟨sameRay_of_mem_segment, fun h => ?_⟩
  rcases h.exists_eq_smul_add with ⟨a, b, ha, hb, hab, hxy, hzx⟩
  rw [add_comm, sub_add_sub_cancel] at hxy hzx
  rw [← mem_segment_translate _ (-x), neg_add_cancel]
  refine ⟨b, a, hb, ha, add_comm a b β–Έ hab, ?_⟩
  rw [← sub_eq_neg_add, ← neg_sub, hxy, ← sub_eq_neg_add, hzx, smul_neg, smul_comm, neg_add_cancel]
Characterization of Closed Segment Membership via Same-Ray Condition
Informal description
Let $\mathbb{K}$ be a commutative ring with a partial order and a strict ordered ring structure, and let $E$ be a $\mathbb{K}$-module. For any points $x, y, z \in E$, the point $x$ belongs to the closed segment $[y, z]$ if and only if the vectors $x - y$ and $z - x$ lie on the same ray in $E$.
openSegment_subset_union theorem
(x y : E) {z : E} (hz : z ∈ range (lineMap x y : π•œ β†’ E)) : openSegment π•œ x y βŠ† insert z (openSegment π•œ x z βˆͺ openSegment π•œ z y)
Full source
/-- If `z = lineMap x y c` is a point on the line passing through `x` and `y`, then the open
segment `openSegment π•œ x y` is included in the union of the open segments `openSegment π•œ x z`,
`openSegment π•œ z y`, and the point `z`. Informally, `(x, y) βŠ† {z} βˆͺ (x, z) βˆͺ (z, y)`. -/
theorem openSegment_subset_union (x y : E) {z : E} (hz : z ∈ range (lineMap x y : π•œ β†’ E)) :
    openSegmentopenSegment π•œ x y βŠ† insert z (openSegment π•œ x z βˆͺ openSegment π•œ z y) := by
  rcases hz with ⟨c, rfl⟩
  simp only [openSegment_eq_image_lineMap, ← mapsTo']
  rintro a ⟨hβ‚€, hβ‚βŸ©
  rcases lt_trichotomy a c with (hac | rfl | hca)
  Β· right
    left
    have hc : 0 < c := hβ‚€.trans hac
    refine ⟨a / c, ⟨div_pos hβ‚€ hc, (div_lt_one hc).2 hac⟩, ?_⟩
    simp only [← homothety_eq_lineMap, ← homothety_mul_apply, div_mul_cancelβ‚€ _ hc.ne']
  Β· left
    rfl
  Β· right
    right
    have hc : 0 < 1 - c := sub_pos.2 (hca.trans h₁)
    simp only [← lineMap_apply_one_sub y]
    refine
      ⟨(a - c) / (1 - c), ⟨div_pos (sub_pos.2 hca) hc, (div_lt_one hc).2 <| sub_lt_sub_right h₁ _⟩,
        ?_⟩
    simp only [← homothety_eq_lineMap, ← homothety_mul_apply, sub_mul, one_mul,
      div_mul_cancelβ‚€ _ hc.ne', sub_sub_sub_cancel_right]
Open Segment Decomposition along a Line Point
Informal description
For any points $x, y$ in a $\mathbb{K}$-vector space $E$, and any point $z$ lying on the line through $x$ and $y$ (i.e., $z = (1 - \theta)x + \theta y$ for some $\theta \in \mathbb{K}$), the open segment between $x$ and $y$ is contained in the union of the open segments between $x$ and $z$, between $z$ and $y$, and the singleton set $\{z\}$. In other words: \[ \text{openSegment}_{\mathbb{K}}(x, y) \subseteq \{z\} \cup \text{openSegment}_{\mathbb{K}}(x, z) \cup \text{openSegment}_{\mathbb{K}}(z, y). \]
segment_subset_Icc theorem
(h : x ≀ y) : [x -[π•œ] y] βŠ† Icc x y
Full source
theorem segment_subset_Icc (h : x ≀ y) : [x -[π•œ] y][x -[π•œ] y] βŠ† Icc x y := by
  rintro z ⟨a, b, ha, hb, hab, rfl⟩
  constructor
  Β· calc
      x = a β€’ x + b β€’ x := (Convex.combo_self hab _).symm
      _ ≀ a β€’ x + b β€’ y := by gcongr
  Β· calc
      a β€’ x + b β€’ y ≀ a β€’ y + b β€’ y := by gcongr
      _ = y := Convex.combo_self hab _
Inclusion of Segment in Closed Interval: $[x, y] \subseteq \text{Icc}(x, y)$ for $x \leq y$
Informal description
For any two points $x$ and $y$ in an ordered vector space over $\mathbb{K}$ with $x \leq y$, the closed segment $[x, y]$ is contained in the closed interval $\text{Icc}(x, y) = \{z \mid x \leq z \leq y\}$.
openSegment_subset_Ioo theorem
(h : x < y) : openSegment π•œ x y βŠ† Ioo x y
Full source
theorem openSegment_subset_Ioo (h : x < y) : openSegmentopenSegment π•œ x y βŠ† Ioo x y := by
  rintro z ⟨a, b, ha, hb, hab, rfl⟩
  constructor
  Β· calc
      x = a β€’ x + b β€’ x := (Convex.combo_self hab _).symm
      _ < a β€’ x + b β€’ y := by gcongr
  Β· calc
      a β€’ x + b β€’ y < a β€’ y + b β€’ y := by gcongr
      _ = y := Convex.combo_self hab _
Open Segment Contained in Open Interval for Ordered Vector Spaces
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any elements $x, y \in E$ with $x < y$, the open segment $\{a \cdot x + b \cdot y \mid a, b \in \mathbb{K}, a, b > 0, a + b = 1\}$ is contained in the open interval $(x, y)$.
segment_subset_uIcc theorem
(x y : E) : [x -[π•œ] y] βŠ† uIcc x y
Full source
theorem segment_subset_uIcc (x y : E) : [x -[π•œ] y][x -[π•œ] y] βŠ† uIcc x y := by
  rcases le_total x y with h | h
  Β· rw [uIcc_of_le h]
    exact segment_subset_Icc h
  Β· rw [uIcc_of_ge h, segment_symm]
    exact segment_subset_Icc h
Closed Segment is Subset of Unordered Closed Interval: $[x, y] \subseteq [\min(x, y), \max(x, y)]$
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, the closed segment $[x -[π•œ] y]$ is contained in the unordered closed interval $\text{uIcc}(x, y) = [\min(x, y), \max(x, y)]$.
Convex.min_le_combo theorem
(x y : E) (ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a + b = 1) : min x y ≀ a β€’ x + b β€’ y
Full source
theorem Convex.min_le_combo (x y : E) (ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a + b = 1) :
    min x y ≀ a β€’ x + b β€’ y :=
  (segment_subset_uIcc x y ⟨_, _, ha, hb, hab, rfl⟩).1
Lower Bound of Convex Combination by Minimum
Informal description
For any elements $x, y$ in an ordered $\mathbb{K}$-vector space $E$, and nonnegative scalars $a, b \in \mathbb{K}$ with $a + b = 1$, the convex combination $a \cdot x + b \cdot y$ is bounded below by the minimum of $x$ and $y$, i.e., $\min(x, y) \leq a \cdot x + b \cdot y$.
Convex.combo_le_max theorem
(x y : E) (ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a + b = 1) : a β€’ x + b β€’ y ≀ max x y
Full source
theorem Convex.combo_le_max (x y : E) (ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a + b = 1) :
    a β€’ x + b β€’ y ≀ max x y :=
  (segment_subset_uIcc x y ⟨_, _, ha, hb, hab, rfl⟩).2
Convex Combination is Bounded by Maximum: $a \cdot x + b \cdot y \leq \max(x, y)$
Informal description
For any two points $x$ and $y$ in a $\mathbb{K}$-vector space $E$, and for any non-negative scalars $a$ and $b$ such that $a + b = 1$, the convex combination $a \cdot x + b \cdot y$ is less than or equal to the maximum of $x$ and $y$, i.e., $a \cdot x + b \cdot y \leq \max(x, y)$.
Icc_subset_segment theorem
: Icc x y βŠ† [x -[π•œ] y]
Full source
theorem Icc_subset_segment : IccIcc x y βŠ† [x -[π•œ] y] := by
  rintro z ⟨hxz, hyz⟩
  obtain rfl | h := (hxz.trans hyz).eq_or_lt
  Β· rw [segment_same]
    exact hyz.antisymm hxz
  rw [← sub_nonneg] at hxz hyz
  rw [← sub_pos] at h
  refine ⟨(y - z) / (y - x), (z - x) / (y - x), div_nonneg hyz h.le, div_nonneg hxz h.le, ?_, ?_⟩
  Β· rw [← add_div, sub_add_sub_cancel, div_self h.ne']
  Β· rw [smul_eq_mul, smul_eq_mul, ← mul_div_right_comm, ← mul_div_right_comm, ← add_div,
      div_eq_iff h.ne', add_comm, sub_mul, sub_mul, mul_comm x, sub_add_sub_cancel, mul_sub]
Closed Interval is Subset of Closed Segment: $[x, y] \subseteq [x -[\mathbb{K}] y]$
Informal description
For any elements $x$ and $y$ in a $\mathbb{K}$-vector space $E$ with a linear order, the closed interval $[x, y]$ is contained in the closed segment $[x -[\mathbb{K}] y]$.
segment_eq_Icc theorem
(h : x ≀ y) : [x -[π•œ] y] = Icc x y
Full source
@[simp]
theorem segment_eq_Icc (h : x ≀ y) : [x -[π•œ] y] = Icc x y :=
  (segment_subset_Icc h).antisymm Icc_subset_segment
Closed Segment Equals Closed Interval for Ordered Vector Spaces
Informal description
For any two points $x$ and $y$ in an ordered vector space over $\mathbb{K}$ with $x \leq y$, the closed segment $[x -[\mathbb{K}] y]$ is equal to the closed interval $[x, y] = \{z \mid x \leq z \leq y\}$.
Ioo_subset_openSegment theorem
: Ioo x y βŠ† openSegment π•œ x y
Full source
theorem Ioo_subset_openSegment : IooIoo x y βŠ† openSegment π•œ x y := fun _ hz =>
  mem_openSegment_of_ne_left_right hz.1.ne hz.2.ne' <| Icc_subset_segment <| Ioo_subset_Icc_self hz
Open Interval is Subset of Open Segment: $(x, y) \subseteq \text{openSegment}_{\mathbb{K}}(x, y)$
Informal description
For any elements $x$ and $y$ in a $\mathbb{K}$-vector space $E$ with a linear order, the open interval $(x, y)$ is contained in the open segment between $x$ and $y$, i.e., $\{z \mid x < z < y\} \subseteq \text{openSegment}_{\mathbb{K}}(x, y)$.
openSegment_eq_Ioo theorem
(h : x < y) : openSegment π•œ x y = Ioo x y
Full source
@[simp]
theorem openSegment_eq_Ioo (h : x < y) : openSegment π•œ x y = Ioo x y :=
  (openSegment_subset_Ioo h).antisymm Ioo_subset_openSegment
Open Segment Equals Open Interval for Ordered Vector Spaces
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any elements $x, y \in E$ with $x < y$, the open segment $\{a \cdot x + b \cdot y \mid a, b \in \mathbb{K}, a, b > 0, a + b = 1\}$ is equal to the open interval $(x, y) = \{z \mid x < z < y\}$.
segment_eq_Icc' theorem
(x y : π•œ) : [x -[π•œ] y] = Icc (min x y) (max x y)
Full source
theorem segment_eq_Icc' (x y : π•œ) : [x -[π•œ] y] = Icc (min x y) (max x y) := by
  rcases le_total x y with h | h
  Β· rw [segment_eq_Icc h, max_eq_right h, min_eq_left h]
  Β· rw [segment_symm, segment_eq_Icc h, max_eq_left h, min_eq_right h]
Closed Segment Equals Closed Interval of Min and Max
Informal description
For any two elements $x$ and $y$ in an ordered $\mathbb{K}$-vector space, the closed segment $[x -[\mathbb{K}] y]$ is equal to the closed interval $[\min(x, y), \max(x, y)]$.
openSegment_eq_Ioo' theorem
(hxy : x β‰  y) : openSegment π•œ x y = Ioo (min x y) (max x y)
Full source
theorem openSegment_eq_Ioo' (hxy : x β‰  y) : openSegment π•œ x y = Ioo (min x y) (max x y) := by
  rcases hxy.lt_or_lt with h | h
  Β· rw [openSegment_eq_Ioo h, max_eq_right h.le, min_eq_left h.le]
  Β· rw [openSegment_symm, openSegment_eq_Ioo h, max_eq_left h.le, min_eq_right h.le]
Open Segment Equals Open Interval for Distinct Points in Ordered Vector Spaces
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any distinct elements $x, y \in E$, the open segment $\{a \cdot x + b \cdot y \mid a, b \in \mathbb{K}, a, b > 0, a + b = 1\}$ is equal to the open interval $(\min(x, y), \max(x, y))$.
segment_eq_uIcc theorem
(x y : π•œ) : [x -[π•œ] y] = uIcc x y
Full source
theorem segment_eq_uIcc (x y : π•œ) : [x -[π•œ] y] = uIcc x y :=
  segment_eq_Icc' _ _
Closed Segment as Unordered Closed Interval
Informal description
For any two elements $x$ and $y$ in an ordered $\mathbb{K}$-vector space, the closed segment $[x -[\mathbb{K}] y]$ is equal to the unordered closed interval $\text{uIcc}(x, y) = [\min(x, y), \max(x, y)]$.
Convex.mem_Icc theorem
(h : x ≀ y) : z ∈ Icc x y ↔ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ a * x + b * y = z
Full source
/-- A point is in an `Icc` iff it can be expressed as a convex combination of the endpoints. -/
theorem Convex.mem_Icc (h : x ≀ y) :
    z ∈ Icc x yz ∈ Icc x y ↔ βˆƒ a b, 0 ≀ a ∧ 0 ≀ b ∧ a + b = 1 ∧ a * x + b * y = z := by
  simp only [← segment_eq_Icc h, segment, mem_setOf_eq, smul_eq_mul, exists_and_left]
Characterization of Closed Interval Points as Convex Combinations
Informal description
For any two points $x$ and $y$ in an ordered vector space over $\mathbb{K}$ with $x \leq y$, a point $z$ belongs to the closed interval $[x, y]$ if and only if there exist nonnegative scalars $a, b \in \mathbb{K}$ with $a + b = 1$ such that $z = a x + b y$.
Convex.mem_Ioo theorem
(h : x < y) : z ∈ Ioo x y ↔ βˆƒ a b, 0 < a ∧ 0 < b ∧ a + b = 1 ∧ a * x + b * y = z
Full source
/-- A point is in an `Ioo` iff it can be expressed as a strict convex combination of the endpoints.
-/
theorem Convex.mem_Ioo (h : x < y) :
    z ∈ Ioo x yz ∈ Ioo x y ↔ βˆƒ a b, 0 < a ∧ 0 < b ∧ a + b = 1 ∧ a * x + b * y = z := by
  simp only [← openSegment_eq_Ioo h, openSegment, smul_eq_mul, exists_and_left, mem_setOf_eq]
Characterization of Open Interval Points as Strict Convex Combinations
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any elements $x, y \in E$ with $x < y$, a point $z$ belongs to the open interval $(x, y)$ if and only if there exist positive scalars $a, b \in \mathbb{K}$ with $a + b = 1$ such that $z = a x + b y$.
Convex.mem_Ioc theorem
(h : x < y) : z ∈ Ioc x y ↔ βˆƒ a b, 0 ≀ a ∧ 0 < b ∧ a + b = 1 ∧ a * x + b * y = z
Full source
/-- A point is in an `Ioc` iff it can be expressed as a semistrict convex combination of the
endpoints. -/
theorem Convex.mem_Ioc (h : x < y) :
    z ∈ Ioc x yz ∈ Ioc x y ↔ βˆƒ a b, 0 ≀ a ∧ 0 < b ∧ a + b = 1 ∧ a * x + b * y = z := by
  refine ⟨fun hz => ?_, ?_⟩
  · obtain ⟨a, b, ha, hb, hab, rfl⟩ := (Convex.mem_Icc h.le).1 (Ioc_subset_Icc_self hz)
    obtain rfl | hb' := hb.eq_or_lt
    Β· rw [add_zero] at hab
      rw [hab, one_mul, zero_mul, add_zero] at hz
      exact (hz.1.ne rfl).elim
    · exact ⟨a, b, ha, hb', hab, rfl⟩
  · rintro ⟨a, b, ha, hb, hab, rfl⟩
    obtain rfl | ha' := ha.eq_or_lt
    Β· rw [zero_add] at hab
      rwa [hab, one_mul, zero_mul, zero_add, right_mem_Ioc]
    · exact Ioo_subset_Ioc_self ((Convex.mem_Ioo h).2 ⟨a, b, ha', hb, hab, rfl⟩)
Characterization of Left-Open Right-Closed Interval Points as Semistrict Convex Combinations
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any elements $x, y \in E$ with $x < y$, a point $z$ belongs to the left-open right-closed interval $(x, y]$ if and only if there exist nonnegative scalars $a, b \in \mathbb{K}$ with $0 \leq a$, $0 < b$, $a + b = 1$, such that $z = a x + b y$.
Convex.mem_Ico theorem
(h : x < y) : z ∈ Ico x y ↔ βˆƒ a b, 0 < a ∧ 0 ≀ b ∧ a + b = 1 ∧ a * x + b * y = z
Full source
/-- A point is in an `Ico` iff it can be expressed as a semistrict convex combination of the
endpoints. -/
theorem Convex.mem_Ico (h : x < y) :
    z ∈ Ico x yz ∈ Ico x y ↔ βˆƒ a b, 0 < a ∧ 0 ≀ b ∧ a + b = 1 ∧ a * x + b * y = z := by
  refine ⟨fun hz => ?_, ?_⟩
  · obtain ⟨a, b, ha, hb, hab, rfl⟩ := (Convex.mem_Icc h.le).1 (Ico_subset_Icc_self hz)
    obtain rfl | ha' := ha.eq_or_lt
    Β· rw [zero_add] at hab
      rw [hab, one_mul, zero_mul, zero_add] at hz
      exact (hz.2.ne rfl).elim
    · exact ⟨a, b, ha', hb, hab, rfl⟩
  · rintro ⟨a, b, ha, hb, hab, rfl⟩
    obtain rfl | hb' := hb.eq_or_lt
    Β· rw [add_zero] at hab
      rwa [hab, one_mul, zero_mul, add_zero, left_mem_Ico]
    · exact Ioo_subset_Ico_self ((Convex.mem_Ioo h).2 ⟨a, b, ha, hb', hab, rfl⟩)
Characterization of Left-Closed Right-Open Interval Points as Semistrict Convex Combinations
Informal description
Let $\mathbb{K}$ be an ordered semiring and $E$ be an ordered $\mathbb{K}$-vector space. For any elements $x, y \in E$ with $x < y$, a point $z$ belongs to the left-closed right-open interval $[x, y)$ if and only if there exist scalars $a, b \in \mathbb{K}$ with $a > 0$, $b \geq 0$, and $a + b = 1$ such that $z = a x + b y$.
Prod.segment_subset theorem
(x y : E Γ— F) : segment π•œ x y βŠ† segment π•œ x.1 y.1 Γ—Λ’ segment π•œ x.2 y.2
Full source
theorem segment_subset (x y : E Γ— F) : segmentsegment π•œ x y βŠ† segment π•œ x.1 y.1 Γ—Λ’ segment π•œ x.2 y.2 := by
  rintro z ⟨a, b, ha, hb, hab, hz⟩
  exact ⟨⟨a, b, ha, hb, hab, congr_arg Prod.fst hz⟩, a, b, ha, hb, hab, congr_arg Prod.snd hz⟩
Product Segment Subset Property
Informal description
For any pair of points $x = (x_1, x_2)$ and $y = (y_1, y_2)$ in the product space $E \times F$, the closed segment joining $x$ and $y$ is contained in the Cartesian product of the closed segments joining $x_1$ and $y_1$ in $E$ and $x_2$ and $y_2$ in $F$. That is, $$ [x -[π•œ] y] \subseteq [x_1 -[π•œ] y_1] \times [x_2 -[π•œ] y_2]. $$
Prod.openSegment_subset theorem
(x y : E Γ— F) : openSegment π•œ x y βŠ† openSegment π•œ x.1 y.1 Γ—Λ’ openSegment π•œ x.2 y.2
Full source
theorem openSegment_subset (x y : E Γ— F) :
    openSegmentopenSegment π•œ x y βŠ† openSegment π•œ x.1 y.1 Γ—Λ’ openSegment π•œ x.2 y.2 := by
  rintro z ⟨a, b, ha, hb, hab, hz⟩
  exact ⟨⟨a, b, ha, hb, hab, congr_arg Prod.fst hz⟩, a, b, ha, hb, hab, congr_arg Prod.snd hz⟩
Open Segment in Product Space is Subset of Product of Component Open Segments
Informal description
For any two points $x = (x_1, x_2)$ and $y = (y_1, y_2)$ in the product space $E \times F$, the open segment between $x$ and $y$ is contained in the Cartesian product of the open segments between their respective components. That is, for any scalar field $\mathbb{K}$, \[ \text{openSegment}_{\mathbb{K}}(x, y) \subseteq \text{openSegment}_{\mathbb{K}}(x_1, y_1) \times \text{openSegment}_{\mathbb{K}}(x_2, y_2). \]
Prod.image_mk_segment_left theorem
(x₁ xβ‚‚ : E) (y : F) : (fun x => (x, y)) '' [x₁ -[π•œ] xβ‚‚] = [(x₁, y) -[π•œ] (xβ‚‚, y)]
Full source
theorem image_mk_segment_left (x₁ xβ‚‚ : E) (y : F) :
    (fun x => (x, y)) '' [x₁ -[π•œ] xβ‚‚] = [(x₁, y) -[π•œ] (xβ‚‚, y)] := by
  rw [segment_eq_imageβ‚‚, segment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp [Convex.combo_self ha.2.2]
Image of Closed Segment under Left Injection in Product Space
Informal description
For any points $x_1, x_2$ in a $\mathbb{K}$-vector space $E$ and any point $y$ in a $\mathbb{K}$-vector space $F$, the image of the closed segment $[x_1 -[π•œ] x_2]$ under the mapping $x \mapsto (x, y)$ is equal to the closed segment $[(x_1, y) -[π•œ] (x_2, y)]$ in the product space $E \times F$.
Prod.image_mk_segment_right theorem
(x : E) (y₁ yβ‚‚ : F) : (fun y => (x, y)) '' [y₁ -[π•œ] yβ‚‚] = [(x, y₁) -[π•œ] (x, yβ‚‚)]
Full source
theorem image_mk_segment_right (x : E) (y₁ yβ‚‚ : F) :
    (fun y => (x, y)) '' [y₁ -[π•œ] yβ‚‚] = [(x, y₁) -[π•œ] (x, yβ‚‚)] := by
  rw [segment_eq_imageβ‚‚, segment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp [Convex.combo_self ha.2.2]
Image of Closed Segment under Right Projection in Product Space
Informal description
For any fixed point $x$ in a $\mathbb{K}$-vector space $E$ and any two points $y_1, y_2$ in a $\mathbb{K}$-vector space $F$, the image of the closed segment $[y_1 -[π•œ] y_2]$ under the mapping $y \mapsto (x, y)$ equals the closed segment $[(x, y_1) -[π•œ] (x, y_2)]$ in the product space $E Γ— F$. In mathematical notation: $$\{x\} Γ— [y_1 -[π•œ] y_2] = [(x, y_1) -[π•œ] (x, y_2)]$$
Prod.image_mk_openSegment_left theorem
(x₁ xβ‚‚ : E) (y : F) : (fun x => (x, y)) '' openSegment π•œ x₁ xβ‚‚ = openSegment π•œ (x₁, y) (xβ‚‚, y)
Full source
theorem image_mk_openSegment_left (x₁ xβ‚‚ : E) (y : F) :
    (fun x => (x, y)) '' openSegment π•œ x₁ xβ‚‚ = openSegment π•œ (x₁, y) (xβ‚‚, y) := by
  rw [openSegment_eq_imageβ‚‚, openSegment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp [Convex.combo_self ha.2.2]
Preservation of Open Segment under First Component Mapping in Product Space
Informal description
For any points $x_1, x_2$ in a $\mathbb{K}$-vector space $E$ and any point $y$ in a $\mathbb{K}$-vector space $F$, the image of the open segment between $x_1$ and $x_2$ under the function $x \mapsto (x, y)$ is equal to the open segment between $(x_1, y)$ and $(x_2, y)$ in the product space $E \times F$. In other words, the mapping preserves open segments in the first component when paired with a fixed point in the second component.
Prod.image_mk_openSegment_right theorem
(x : E) (y₁ yβ‚‚ : F) : (fun y => (x, y)) '' openSegment π•œ y₁ yβ‚‚ = openSegment π•œ (x, y₁) (x, yβ‚‚)
Full source
@[simp]
theorem image_mk_openSegment_right (x : E) (y₁ yβ‚‚ : F) :
    (fun y => (x, y)) '' openSegment π•œ y₁ yβ‚‚ = openSegment π•œ (x, y₁) (x, yβ‚‚) := by
  rw [openSegment_eq_imageβ‚‚, openSegment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp [Convex.combo_self ha.2.2]
Image of Open Segment under Right Projection in Product Space
Informal description
For any fixed element $x$ in a $\mathbb{K}$-vector space $E$ and any two elements $y_1, y_2$ in a $\mathbb{K}$-vector space $F$, the image of the open segment between $y_1$ and $y_2$ under the mapping $y \mapsto (x, y)$ is equal to the open segment between $(x, y_1)$ and $(x, y_2)$ in the product space $E \times F$. In other words: \[ \{(x, y) \mid y \in \text{openSegment}_{\mathbb{K}}(y_1, y_2)\} = \text{openSegment}_{\mathbb{K}}((x, y_1), (x, y_2)). \]
Pi.segment_subset theorem
(x y : βˆ€ i, M i) : segment π•œ x y βŠ† s.pi fun i => segment π•œ (x i) (y i)
Full source
theorem segment_subset (x y : βˆ€ i, M i) : segmentsegment π•œ x y βŠ† s.pi fun i => segment π•œ (x i) (y i) := by
  rintro z ⟨a, b, ha, hb, hab, hz⟩ i -
  exact ⟨a, b, ha, hb, hab, congr_fun hz i⟩
Product Space Segment Inclusion: $[x, y] \subseteq \prod_{i \in s} [x_i, y_i]$
Informal description
For any two functions $x, y \in \prod_{i} M_i$ in a product space, the closed segment $[x, y]$ joining $x$ and $y$ is contained in the product of the closed segments $[x_i, y_i]$ for each component $i \in s$. That is, for any $z \in [x, y]$, we have $z_i \in [x_i, y_i]$ for all $i \in s$.
Pi.openSegment_subset theorem
(x y : βˆ€ i, M i) : openSegment π•œ x y βŠ† s.pi fun i => openSegment π•œ (x i) (y i)
Full source
theorem openSegment_subset (x y : βˆ€ i, M i) :
    openSegmentopenSegment π•œ x y βŠ† s.pi fun i => openSegment π•œ (x i) (y i) := by
  rintro z ⟨a, b, ha, hb, hab, hz⟩ i -
  exact ⟨a, b, ha, hb, hab, congr_fun hz i⟩
Open Segment in Product Space is Contained in Product of Open Segments
Informal description
For any family of points $x, y \in \prod_{i} M_i$ in a product of $\mathbb{K}$-vector spaces, the open segment between $x$ and $y$ is contained in the product of the open segments between their components. That is, for any index set $s \subseteq \iota$, we have: \[ \text{openSegment}_{\mathbb{K}}(x, y) \subseteq \prod_{i \in s} \text{openSegment}_{\mathbb{K}}(x_i, y_i). \]
Pi.image_update_segment theorem
(i : ΞΉ) (x₁ xβ‚‚ : M i) (y : βˆ€ i, M i) : update y i '' [x₁ -[π•œ] xβ‚‚] = [update y i x₁ -[π•œ] update y i xβ‚‚]
Full source
theorem image_update_segment (i : ΞΉ) (x₁ xβ‚‚ : M i) (y : βˆ€ i, M i) :
    updateupdate y i '' [x₁ -[π•œ] xβ‚‚] = [update y i x₁ -[π•œ] update y i xβ‚‚] := by
  rw [segment_eq_imageβ‚‚, segment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp only [← update_smul, ← update_add, Convex.combo_self ha.2.2]
Image of Closed Segment under Function Update Equals Closed Segment of Updated Functions
Informal description
For any index $i$ in an index set $\iota$, any two points $x_1, x_2$ in a $\mathbb{K}$-vector space $M_i$, and any function $y \colon \iota \to \bigcup_{i} M_i$, the image of the closed segment $[x_1, x_2]$ under the function update $\text{update } y \, i$ is equal to the closed segment between the updated functions $\text{update } y \, i \, x_1$ and $\text{update } y \, i \, x_2$. That is: \[ \text{update } y \, i \big( [x_1, x_2] \big) = [\text{update } y \, i \, x_1, \text{update } y \, i \, x_2]. \]
Pi.image_update_openSegment theorem
(i : ΞΉ) (x₁ xβ‚‚ : M i) (y : βˆ€ i, M i) : update y i '' openSegment π•œ x₁ xβ‚‚ = openSegment π•œ (update y i x₁) (update y i xβ‚‚)
Full source
theorem image_update_openSegment (i : ΞΉ) (x₁ xβ‚‚ : M i) (y : βˆ€ i, M i) :
    updateupdate y i '' openSegment π•œ x₁ xβ‚‚ = openSegment π•œ (update y i x₁) (update y i xβ‚‚) := by
  rw [openSegment_eq_imageβ‚‚, openSegment_eq_imageβ‚‚, image_image]
  refine EqOn.image_eq fun a ha ↦ ?_
  simp only [← update_smul, ← update_add, Convex.combo_self ha.2.2]
Image of Open Segment under Function Update Equals Open Segment of Updated Points
Informal description
Let $E$ be a $\mathbb{K}$-vector space, and let $x_1, x_2 \in E$ and $y \in \prod_{i \in \iota} E$ be given. For any index $i \in \iota$, the image of the open segment $\text{openSegment}_{\mathbb{K}}(x_1, x_2)$ under the function update $y \mapsto \text{update } y \, i$ is equal to the open segment between the updated points: \[ \text{update } y \, i \left( \text{openSegment}_{\mathbb{K}}(x_1, x_2) \right) = \text{openSegment}_{\mathbb{K}}(\text{update } y \, i \, x_1, \text{update } y \, i \, x_2). \] Here, $\text{update } y \, i \, x$ denotes the function that coincides with $y$ everywhere except at index $i$, where it takes the value $x$.