Skip to content

Commit ddbcd9d

Browse files
committed
feat: add a congruence lemma for orthogonalProjection (#25004)
While it is still tricky to rewrite with `rw`, this makes it work with `simp`.
1 parent 51b8a38 commit ddbcd9d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Mathlib/Geometry/Euclidean/Projection.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,20 @@ theorem orthogonalProjectionFn_eq {s : AffineSubspace ℝ P} [Nonempty s]
138138
orthogonalProjectionFn s p = orthogonalProjection s p :=
139139
rfl
140140

141+
/-- Since both instance arguments are propositions, allow `simp` to rewrite them
142+
alongside the `s` argument.
143+
144+
Note that without the coercion to `P`, the LHS and RHS would have different types. -/
145+
@[congr]
146+
theorem orthogonalProjection_congr {s₁ s₂ : AffineSubspace ℝ P} {p₁ p₂ : P}
147+
[Nonempty s₁] [s₁.direction.HasOrthogonalProjection]
148+
(h : s₁ = s₂) (hp : p₁ = p₂) :
149+
letI : Nonempty s₂ := h ▸ ‹_›
150+
letI : s₂.direction.HasOrthogonalProjection := h ▸ ‹_›
151+
(orthogonalProjection s₁ p₁ : P) = (orthogonalProjection s₂ p₂ : P) := by
152+
subst h hp
153+
rfl
154+
141155
/-- The linear map corresponding to `orthogonalProjection`. -/
142156
@[simp]
143157
theorem orthogonalProjection_linear {s : AffineSubspace ℝ P} [Nonempty s]

0 commit comments

Comments
 (0)