Skip to content

Commit ea606a7

Browse files
committed
feat(LinearAlgebra/AffineSpace/Independent): interior of a simplex (#21929)
Define the notion of the interior of a simplex (`Affine.Simplex.interior`), and also the corresponding closed set (`Affine.Simplex.closedInterior`). It's common in geometry to refer to a point being in the interior of a triangle, and having such a definition allows such a statement to be made without depending on the convexity refactor. Furthermore, this is a common enough concept that I think it makes sense for it to have its own definition and API even in the presence of the convexity refactor; `intrinsicInterior k (convexHull k (Set.range s.points))` is not exactly a convenient way to refer to this common construct. (The convexity refactor would of course allow the equivalence of the two definitions to be stated and proved, or the definitions here could be redefined in terms of the general convexity ones at that point if desired.) There are plenty of things that could be stated and proved using this definition (e.g. conditions for triangle centers to be inside the triangle) though this PR doesn't do anything like that beyond one API lemma saying when an affine combination lies in the interior of a simplex. The corresponding `closedInterior` is by analogy to how, for example, we have both `ball` and `closedBall` in metric spaces. The definitions are also intended to be analogous to such definitions for (not necessarily convex) polygons once we have those defined: sometimes when considering a polygon as a set of points in a plane you want the interior as an open set, sometimes the interior together with the boundary (and this analogy with polygons that aren't necessarily convex is why a simpler name such as `Affine.Simplex.convexHull` wasn't used for `closedInterior`).
1 parent b097622 commit ea606a7

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Mathlib/LinearAlgebra/AffineSpace/Independent.lean

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,3 +943,43 @@ theorem centroid_eq_of_range_eq {n : ℕ} {s₁ s₂ : Simplex k P n}
943943
end Simplex
944944

945945
end Affine
946+
947+
namespace Affine
948+
949+
namespace Simplex
950+
951+
variable {k V P : Type*} [OrderedRing k] [AddCommGroup V] [Module k V] [AffineSpace V P]
952+
953+
/-- The interior of a simplex is the set of points that can be expressed as an affine combination
954+
of the vertices with weights strictly between 0 and 1. This is equivalent to the intrinsic
955+
interior of the convex hull of the vertices. -/
956+
protected def interior {n : ℕ} (s : Simplex k P n) : Set P :=
957+
{p | ∃ w : Fin (n + 1) → k,
958+
(∑ i, w i = 1) ∧ (∀ i, w i ∈ Set.Ioo 0 1) ∧ Finset.univ.affineCombination k s.points w = p}
959+
960+
lemma affineCombination_mem_interior_iff {n : ℕ} {s : Simplex k P n} {w : Fin (n + 1) → k}
961+
(hw : ∑ i, w i = 1) :
962+
Finset.univ.affineCombination k s.points w ∈ s.interior ↔ ∀ i, w i ∈ Set.Ioo 0 1 := by
963+
refine ⟨fun ⟨w', hw', hw'01, hww'⟩ ↦ ?_, fun h ↦ ⟨w, hw, h, rfl⟩⟩
964+
simp_rw [← (affineIndependent_iff_eq_of_fintype_affineCombination_eq k s.points).1
965+
s.independent w' w hw' hw hww']
966+
exact hw'01
967+
968+
/-- `s.closedInterior is the set of points that can be expressed as an affine combination
969+
of the vertices with weights between 0 and 1 inclusive. This is equivalent to the convex hull of
970+
the vertices or the closure of the interior. -/
971+
protected def closedInterior {n : ℕ} (s : Simplex k P n) : Set P :=
972+
{p | ∃ w : Fin (n + 1) → k,
973+
(∑ i, w i = 1) ∧ (∀ i, w i ∈ Set.Icc 0 1) ∧ Finset.univ.affineCombination k s.points w = p}
974+
975+
lemma affineCombination_mem_closedInterior_iff {n : ℕ} {s : Simplex k P n} {w : Fin (n + 1) → k}
976+
(hw : ∑ i, w i = 1) :
977+
Finset.univ.affineCombination k s.points w ∈ s.closedInterior ↔ ∀ i, w i ∈ Set.Icc 0 1 := by
978+
refine ⟨fun ⟨w', hw', hw'01, hww'⟩ ↦ ?_, fun h ↦ ⟨w, hw, h, rfl⟩⟩
979+
simp_rw [← (affineIndependent_iff_eq_of_fintype_affineCombination_eq k s.points).1
980+
s.independent w' w hw' hw hww']
981+
exact hw'01
982+
983+
end Simplex
984+
985+
end Affine

0 commit comments

Comments
 (0)