-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Merged by Bors] - feat(Geometry/Euclidean/Incenter): incenters and excenters #23752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 42 commits
1c433b6
2695d8a
a266644
dd9e2ec
4289326
6bc7623
6d7c364
bdfa56c
1ff4175
15298f9
ad01007
cf230ff
dbc3140
2cb5275
de47b60
0fcc624
3950557
378638f
674df8e
e555829
8fc6d1a
d42900b
c8d3e0a
3d041b4
62728c7
8b373dc
63e1abe
567aca8
44df45d
fdee4aa
162d3c3
fdddcd3
261bc3c
367e64b
235c5ea
1fc5993
de61165
2eb2b23
d8e485f
4c558c4
780e1c6
4800c88
c13a716
e475c9e
6a7acf2
effce21
801bb95
54d2d5d
90b6798
7cfc30d
c4401b3
c56d5f7
10f1bc5
5f7c3a3
781147d
c235776
cfb0db4
6e8eb8e
6114841
88acc1c
8f4676b
123c71a
ce2f64c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /- | ||
| Copyright (c) 2025 Eric Wieser. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Eric Wieser | ||
| -/ | ||
| import Mathlib.Analysis.InnerProductSpace.Basic | ||
| import Mathlib.Analysis.Normed.Group.AddTorsor | ||
| /-! | ||
| # Normed affine spaces over an inner product space | ||
| -/ | ||
|
|
||
| variable {𝕜 V P : Type*} | ||
|
|
||
| section RCLike | ||
| variable [RCLike 𝕜] [NormedAddCommGroup V] [InnerProductSpace 𝕜 V] [MetricSpace P] | ||
| variable [NormedAddTorsor V P] | ||
|
|
||
| open scoped InnerProductSpace | ||
|
|
||
| theorem inner_vsub_left_eq_zero_symm {a b : P} {v : V} : | ||
| ⟪a -ᵥ b, v⟫_𝕜 = 0 ↔ ⟪b -ᵥ a, v⟫_𝕜 = 0 := by | ||
| rw [← neg_vsub_eq_vsub_rev, inner_neg_left, neg_eq_zero] | ||
|
|
||
| theorem inner_vsub_right_eq_zero_symm {v : V} {a b : P} : | ||
| ⟪v, a -ᵥ b⟫_𝕜 = 0 ↔ ⟪v, b -ᵥ a⟫_𝕜 = 0 := by | ||
| rw [← neg_vsub_eq_vsub_rev, inner_neg_right, neg_eq_zero] | ||
|
|
||
| end RCLike | ||
|
|
||
| section Real | ||
| variable [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P] | ||
| variable [NormedAddTorsor V P] | ||
|
|
||
| open scoped RealInnerProductSpace | ||
|
|
||
| /-! | ||
| In this section, the first `left`/`right` indicates where the common argument to `vsub` is, | ||
| and the section refers to the argument of `inner` that ends up in the `dist`. | ||
|
|
||
| The lemma shapes are such that the relevant argument of `inner` remains unchanged, | ||
| and that the other `vsub` preserves the position of the unchanging argument. -/ | ||
|
|
||
| theorem inner_vsub_vsub_left_eq_dist_sq_left_iff {a b c : P} : | ||
| ⟪a -ᵥ b, a -ᵥ c⟫ = dist a b ^ 2 ↔ ⟪a -ᵥ b, b -ᵥ c⟫ = 0 := by | ||
| rw [dist_eq_norm_vsub V, inner_eq_norm_sq_left_iff, vsub_sub_vsub_cancel_left, | ||
| inner_vsub_right_eq_zero_symm] | ||
|
|
||
| theorem inner_vsub_vsub_left_eq_dist_sq_right_iff {a b c : P} : | ||
| ⟪a -ᵥ b, a -ᵥ c⟫ = dist a c ^ 2 ↔ ⟪c -ᵥ b, a -ᵥ c⟫ = 0 := by | ||
| rw [real_inner_comm, inner_vsub_vsub_left_eq_dist_sq_left_iff, real_inner_comm] | ||
|
|
||
| theorem inner_vsub_vsub_right_eq_dist_sq_left_iff {a b c : P} : | ||
| ⟪a -ᵥ c, b -ᵥ c⟫ = dist a c ^ 2 ↔ ⟪a -ᵥ c, b -ᵥ a⟫ = 0 := by | ||
| rw [dist_eq_norm_vsub V, inner_eq_norm_sq_left_iff, vsub_sub_vsub_cancel_right, | ||
| inner_vsub_right_eq_zero_symm] | ||
|
|
||
| theorem inner_vsub_vsub_right_eq_dist_sq_right_iff {a b c : P} : | ||
| ⟪a -ᵥ c, b -ᵥ c⟫ = dist b c ^ 2 ↔ ⟪a -ᵥ b, b -ᵥ c⟫ = 0 := by | ||
| rw [real_inner_comm, inner_vsub_vsub_right_eq_dist_sq_left_iff, real_inner_comm] | ||
|
|
||
| end Real |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE. | |
| Authors: Joseph Myers | ||
| -/ | ||
| import Mathlib.Geometry.Euclidean.Projection | ||
| import Mathlib.Analysis.InnerProductSpace.Affine | ||
|
|
||
| /-! | ||
| # Altitudes of a simplex | ||
|
|
@@ -170,6 +171,101 @@ def height {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i : Fin (n + 1)) : ℝ := | |
| lemma height_pos {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i : Fin (n + 1)) : 0 < s.height i := by | ||
| simp [height] | ||
|
|
||
| open scoped RealInnerProductSpace | ||
|
|
||
| -- TODO: move | ||
| private theorem _root_.Fin.exists_ne_of_ne_of_two_lt | ||
| {n : ℕ} {i j : Fin n} (h : i ≠ j) (h : 2 < n) : ∃ k, k ≠ i ∧ k ≠ j := by | ||
| have : NeZero n := ⟨by linarith⟩ | ||
| rcases i with ⟨i, hi⟩ | ||
| rcases j with ⟨j, hj⟩ | ||
| simp_rw [← Fin.val_ne_iff] | ||
| by_cases h0 : 0 ≠ i ∧ 0 ≠ j | ||
| · exact ⟨0, h0⟩ | ||
| · by_cases h1 : 1 ≠ i ∧ 1 ≠ j | ||
| · exact ⟨⟨1, by omega⟩, h1⟩ | ||
| · refine ⟨⟨2, by omega⟩, ?_⟩ | ||
| dsimp only | ||
| omega | ||
|
|
||
| /-- The inner product of an edge from `j` to `i` and the vector from the foot of `i` to `i` | ||
| is the square of the height. -/ | ||
| lemma inner_vsub_vsub_altitudeFoot_eq_height_sq | ||
| {n : ℕ} [NeZero n] (s : Simplex ℝ P n) {i j : Fin (n + 1)} (h : i ≠ j) : | ||
| ⟪s.points i -ᵥ s.points j, s.points i -ᵥ s.altitudeFoot i⟫ = s.height i ^ 2 := by | ||
| rw [height, inner_vsub_vsub_left_eq_dist_sq_right_iff, altitudeFoot] | ||
| refine Submodule.inner_right_of_mem_orthogonal | ||
| (K := vectorSpan ℝ (Set.range (s.faceOpposite i).points)) | ||
| (vsub_mem_vectorSpan_of_mem_affineSpan_of_mem_affineSpan | ||
| (SetLike.coe_mem _) | ||
| (mem_affineSpan ℝ ?_)) ?_ | ||
| · simp only [range_faceOpposite_points, ne_eq, Set.mem_image, Set.mem_setOf_eq] | ||
| refine ⟨j, h.symm, rfl⟩ | ||
| · rw [← direction_affineSpan] | ||
| exact vsub_orthogonalProjection_mem_direction_orthogonal _ _ | ||
|
|
||
| /-- The angle between two distinct faces can never reach 0 or π. -/ | ||
| lemma abs_inner_height_vsub_altitudeFoot_div_lt_one | ||
| {n : ℕ} [NeZero n] (s : Simplex ℝ P n) {i j : Fin (n + 1)} (hij : i ≠ j) (hn : 1 < n) : | ||
| |⟪s.points i -ᵥ s.altitudeFoot i, s.points j -ᵥ s.altitudeFoot j⟫ | ||
| / (s.height i * s.height j)| < 1 := by | ||
|
||
| rw [abs_div, div_lt_one (by simp [height])] | ||
| apply LE.le.lt_of_ne | ||
| · convert abs_real_inner_le_norm _ _ using 1 | ||
| simp only [dist_eq_norm_vsub, abs_eq_self, height] | ||
| positivity | ||
| · simp_rw [height, dist_eq_norm_vsub] | ||
| nth_rw 2 [abs_eq_self.2 (by positivity)] | ||
| rw [← Real.norm_eq_abs, ne_eq, norm_inner_eq_norm_iff (by simp) (by simp)] | ||
| rintro ⟨r, hr, h⟩ | ||
| suffices s.points j -ᵥ s.altitudeFoot j = 0 by | ||
| simp at this | ||
| rw [← Submodule.mem_bot ℝ, | ||
| ← Submodule.inf_orthogonal_eq_bot (vectorSpan ℝ (Set.range s.points))] | ||
| refine ⟨vsub_mem_vectorSpan_of_mem_affineSpan_of_mem_affineSpan | ||
| (mem_affineSpan _ (Set.mem_range_self _)) ?_, ?_⟩ | ||
| · refine SetLike.le_def.1 (affineSpan_mono _ ?_) (Subtype.property _) | ||
| simp | ||
| · rw [SetLike.mem_coe] | ||
| have hk : ∃ k, k ≠ i ∧ k ≠ j := Fin.exists_ne_of_ne_of_two_lt hij (by linarith only [hn]) | ||
| have hs : vectorSpan ℝ (Set.range s.points) = | ||
| vectorSpan ℝ (Set.range (s.faceOpposite i).points) ⊔ | ||
| vectorSpan ℝ (Set.range (s.faceOpposite j).points) := by | ||
| rcases hk with ⟨k, hki, hkj⟩ | ||
| have hki' : s.points k ∈ Set.range (s.faceOpposite i).points := by | ||
| rw [range_faceOpposite_points] | ||
| exact Set.mem_image_of_mem _ hki | ||
| have hkj' : s.points k ∈ Set.range (s.faceOpposite j).points := by | ||
| rw [range_faceOpposite_points] | ||
| exact Set.mem_image_of_mem _ hkj | ||
| convert AffineSubspace.vectorSpan_union_of_mem_of_mem ℝ hki' hkj' | ||
| simp only [range_faceOpposite_points, ← Set.image_union] | ||
| simp_rw [← Set.image_univ, ← Set.compl_setOf, ← Set.compl_inter, | ||
| Set.setOf_eq_eq_singleton] | ||
| rw [Set.inter_singleton_eq_empty.mpr ?_, Set.compl_empty] | ||
| simpa using hij.symm | ||
| rw [hs, ← Submodule.inf_orthogonal, Submodule.mem_inf] | ||
| refine ⟨?_, ?_⟩ | ||
| · rw [h, ← direction_affineSpan] | ||
| exact Submodule.smul_mem _ _ | ||
| (vsub_orthogonalProjection_mem_direction_orthogonal _ _) | ||
| · rw [← direction_affineSpan] | ||
| exact vsub_orthogonalProjection_mem_direction_orthogonal _ _ | ||
|
|
||
| /-- The angle between two faces can never reach π. -/ | ||
| lemma neg_one_lt_inner_height_vsub_altitudeFoot_div | ||
| {n : ℕ} [NeZero n] (s : Simplex ℝ P n) (i j : Fin (n + 1)) (hn : 1 < n) : | ||
| -1 < ⟪s.points i -ᵥ s.altitudeFoot i, s.points j -ᵥ s.altitudeFoot j⟫ | ||
| / (s.height i * s.height j) := by | ||
| obtain rfl | hij := eq_or_ne i j | ||
| · rw [real_inner_self_eq_norm_sq, height] | ||
| refine neg_one_lt_zero.trans_le ?_ | ||
| positivity | ||
| rw [neg_lt] | ||
| refine lt_of_abs_lt ?_ | ||
| rw [abs_neg] | ||
| exact abs_inner_height_vsub_altitudeFoot_div_lt_one s hij hn | ||
|
|
||
| end Simplex | ||
|
|
||
| end Affine | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need the first
h(it should have explicitiandjinstead).