Skip to content

Commit 2ac9285

Browse files
committed
refactor(Geometry/Euclidean/Projection): revert everything back to metric space (leanprover-community#33385)
After leanprover-community#27378 was merged, @jsm28 noted that `[NormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P]` implies `[MetricSpace P]` anyways so there's no point distinguishing between `PseudoMetricSpace` and `MetricSpace`.
1 parent c5daafe commit 2ac9285

1 file changed

Lines changed: 15 additions & 33 deletions

File tree

Mathlib/Geometry/Euclidean/Projection.lean

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ variable {V₂ P₂ : Type*} [NormedAddCommGroup V₂] [InnerProductSpace 𝕜 V
3737

3838
open AffineSubspace
3939

40-
section PseudoMetricSpace
41-
42-
variable [PseudoMetricSpace P] [NormedAddTorsor V P]
40+
variable [MetricSpace P] [NormedAddTorsor V P]
4341

4442
/-- The orthogonal projection of a point onto a nonempty affine subspace. -/
4543
def orthogonalProjection (s : AffineSubspace 𝕜 P) [Nonempty s]
@@ -177,6 +175,19 @@ theorem eq_orthogonalProjection_of_eq_subspace {s s' : AffineSubspace 𝕜 P} [N
177175
have h := SetLike.coe_mem (orthogonalProjection (affineSpan 𝕜 {p₁}) p₂)
178176
rwa [mem_affineSpan_singleton] at h
179177

178+
/-- The distance to a point's orthogonal projection is 0 iff it lies in the subspace. -/
179+
theorem dist_orthogonalProjection_eq_zero_iff {s : AffineSubspace 𝕜 P} [Nonempty s]
180+
[s.direction.HasOrthogonalProjection] {p : P} :
181+
dist p (orthogonalProjection s p) = 0 ↔ p ∈ s := by
182+
rw [dist_comm, dist_eq_zero, orthogonalProjection_eq_self_iff]
183+
184+
/-- The distance between a point and its orthogonal projection is
185+
nonzero if it does not lie in the subspace. -/
186+
theorem dist_orthogonalProjection_ne_zero_of_notMem {s : AffineSubspace 𝕜 P} [Nonempty s]
187+
[s.direction.HasOrthogonalProjection] {p : P} (hp : p ∉ s) :
188+
dist p (orthogonalProjection s p) ≠ 0 :=
189+
mt dist_orthogonalProjection_eq_zero_iff.mp hp
190+
180191
/-- Subtracting `p` from its `orthogonalProjection` produces a result
181192
in the orthogonal direction. -/
182193
theorem orthogonalProjection_vsub_mem_direction_orthogonal (s : AffineSubspace 𝕜 P) [Nonempty s]
@@ -505,11 +516,6 @@ theorem reflection_vadd_smul_vsub_orthogonalProjection {s : AffineSubspace 𝕜
505516
reflection_orthogonal_vadd hp₁
506517
(Submodule.smul_mem _ _ (vsub_orthogonalProjection_mem_direction_orthogonal s _))
507518

508-
end PseudoMetricSpace
509-
510-
section MetricSpace
511-
512-
variable [MetricSpace P] [NormedAddTorsor V P]
513519
variable [MetricSpace P₂] [NormedAddTorsor V₂ P₂]
514520

515521
@[simp] lemma orthogonalProjection_map (s : AffineSubspace 𝕜 P) [Nonempty s]
@@ -537,19 +543,6 @@ lemma orthogonalProjection_subtype (s : AffineSubspace 𝕜 P) [Nonempty s] (s'
537543
infer_instance
538544
convert orthogonalProjection_map s' s.subtypeₐᵢ p
539545

540-
/-- The distance to a point's orthogonal projection is 0 iff it lies in the subspace. -/
541-
theorem dist_orthogonalProjection_eq_zero_iff {s : AffineSubspace 𝕜 P} [Nonempty s]
542-
[s.direction.HasOrthogonalProjection] {p : P} :
543-
dist p (orthogonalProjection s p) = 0 ↔ p ∈ s := by
544-
rw [dist_comm, dist_eq_zero, orthogonalProjection_eq_self_iff]
545-
546-
/-- The distance between a point and its orthogonal projection is
547-
nonzero if it does not lie in the subspace. -/
548-
theorem dist_orthogonalProjection_ne_zero_of_notMem {s : AffineSubspace 𝕜 P} [Nonempty s]
549-
[s.direction.HasOrthogonalProjection] {p : P} (hp : p ∉ s) :
550-
dist p (orthogonalProjection s p) ≠ 0 :=
551-
mt dist_orthogonalProjection_eq_zero_iff.mp hp
552-
553546
@[simp] lemma reflection_map (s : AffineSubspace 𝕜 P) [Nonempty s]
554547
[s.direction.HasOrthogonalProjection] (f : P →ᵃⁱ[𝕜] P₂)
555548
[(s.map f.toAffineMap).direction.HasOrthogonalProjection] (p : P) :
@@ -562,8 +555,6 @@ lemma reflection_subtype (s : AffineSubspace 𝕜 P) [Nonempty s] (s' : AffineSu
562555
(reflection s' p : P) = reflection (s'.map s.subtype) p := by
563556
simp [reflection_apply', orthogonalProjection_subtype]
564557

565-
end MetricSpace
566-
567558
end EuclideanGeometry
568559

569560
namespace Affine
@@ -576,9 +567,7 @@ variable {𝕜 : Type*} {V : Type*} {P : Type*} [RCLike 𝕜]
576567
variable [NormedAddCommGroup V] [InnerProductSpace 𝕜 V]
577568
variable {V₂ P₂ : Type*} [NormedAddCommGroup V₂] [InnerProductSpace 𝕜 V₂]
578569

579-
section PseudoMetricSpace
580-
581-
variable [PseudoMetricSpace P] [NormedAddTorsor V P]
570+
variable [MetricSpace P] [NormedAddTorsor V P]
582571

583572
/-- The orthogonal projection of a point `p` onto the hyperplane spanned by the simplex's points. -/
584573
def orthogonalProjectionSpan {n : ℕ} (s : Simplex 𝕜 P n) :
@@ -627,11 +616,6 @@ lemma orthogonalProjectionSpan_faceOpposite_eq_point_rev (s : Simplex 𝕜 P 1)
627616
(p : P) : (s.faceOpposite i).orthogonalProjectionSpan p = s.points i.rev := by
628617
simp [faceOpposite_point_eq_point_rev]
629618

630-
end PseudoMetricSpace
631-
632-
section MetricSpace
633-
634-
variable [MetricSpace P] [NormedAddTorsor V P]
635619
variable [MetricSpace P₂] [NormedAddTorsor V₂ P₂]
636620

637621
lemma orthogonalProjectionSpan_map {n : ℕ} (s : Simplex 𝕜 P n) (f : P →ᵃⁱ[𝕜] P₂) (p : P) :
@@ -648,8 +632,6 @@ lemma orthogonalProjectionSpan_map {n : ℕ} (s : Simplex 𝕜 P n) (f : P →
648632
rw [eq_comm]
649633
convert (s.restrict S hS).orthogonalProjectionSpan_map S.subtypeₐᵢ p
650634

651-
end MetricSpace
652-
653635
end Simplex
654636

655637
end Affine

0 commit comments

Comments
 (0)