Skip to content

feat(Geometry/Euclidean/Angle/Incenter): unoriented angle bisection#32282

Open
jsm28 wants to merge 249 commits intoleanprover-community:masterfrom
jsm28:angle_incenter_unoriented
Open

feat(Geometry/Euclidean/Angle/Incenter): unoriented angle bisection#32282
jsm28 wants to merge 249 commits intoleanprover-community:masterfrom
jsm28:angle_incenter_unoriented

Conversation

@jsm28
Copy link
Copy Markdown
Contributor

@jsm28 jsm28 commented Nov 30, 2025

jsm28 and others added 30 commits October 12, 2025 19:56
…Projection_of_le`

Add a lemma that `orthogonalProjection s₁ (orthogonalProjection s₂ p)
= orthogonalProjection s₁ p` for `s₁ ≤ s₂`. (A similar lemma for
projection onto submodules rather than affine subspaces already
exists.)
… and bisection lemmas

Add lemmas

```lean
lemma oangle_eq_neg_of_angle_eq_of_sign_eq_neg {w x y z : V}
    (h : InnerProductGeometry.angle w x = InnerProductGeometry.angle y z)
    (hs : (o.oangle w x).sign = -(o.oangle y z).sign) : o.oangle w x = -o.oangle y z := by
```

and

```lean
lemma angle_eq_iff_oangle_eq_neg_of_sign_eq_neg {w x y z : V} (hw : w ≠ 0) (hx : x ≠ 0)
    (hy : y ≠ 0) (hz : z ≠ 0) (hs : (o.oangle w x).sign = -(o.oangle y z).sign) :
    InnerProductGeometry.angle w x = InnerProductGeometry.angle y z ↔
      o.oangle w x = -o.oangle y z := by
```

and similar affine versions, corresponding to such lemmas that already
exist when the signs are equal rather than negations of each other.
Deduce lemmas relating oriented and unoriented versions of angle
bisection:

```lean
lemma angle_eq_iff_oangle_eq_or_sameRay {x y z : V} (hx : x ≠ 0) (hz : z ≠ 0) :
    InnerProductGeometry.angle x y = InnerProductGeometry.angle y z ↔
      o.oangle x y = o.oangle y z ∨ SameRay ℝ x z := by
```

and

```lean
lemma angle_eq_iff_oangle_eq_or_wbtw {p₁ p₂ p₃ p₄ : P} (hp₁ : p₁ ≠ p₂) (hp₄ : p₄ ≠ p₂) :
    ∠ p₁ p₂ p₃ = ∠ p₃ p₂ p₄ ↔ ∡ p₁ p₂ p₃ = ∡ p₃ p₂ p₄ ∨ Wbtw ℝ p₂ p₁ p₄ ∨ Wbtw ℝ p₂ p₄ p₁ := by
```
… equal distance

Add a lemma

```lean
lemma dist_orthogonalProjection_eq_iff_oangle_eq {p p' : P} {s₁ s₂ : AffineSubspace ℝ P}
    [s₁.direction.HasOrthogonalProjection] [s₂.direction.HasOrthogonalProjection]
    (hp' : p' ∈ s₁ ⊓ s₂)
    (hne : haveI : Nonempty s₁ := ⟨p', hp'.1⟩; haveI : Nonempty s₂ := ⟨p', hp'.2⟩;
      (orthogonalProjection s₁ p : P) ≠ orthogonalProjection s₂ p)
    (hp₁ : haveI : Nonempty s₁ := ⟨p', hp'.1⟩; orthogonalProjection s₁ p ≠ p')
    (hp₂ : haveI : Nonempty s₂ := ⟨p', hp'.2⟩; orthogonalProjection s₂ p ≠ p') :
    haveI : Nonempty s₁ := ⟨p', hp'.1⟩
    haveI : Nonempty s₂ := ⟨p', hp'.2⟩
    dist p (orthogonalProjection s₁ p) = dist p (orthogonalProjection s₂ p) ↔
      ∡ (orthogonalProjection s₁ p : P) p' p = ∡ p p' (orthogonalProjection s₂ p) :=
```

that is an oriented angle analogue of the existing
`dist_orthogonalProjection_eq_iff_angle_eq`.  Because the minimal
nondegeneracy conditions required for the two directions of this lemma
are different (whereas the unoriented version doesn't need any
nondegeneracy conditions), those two directions are added as separate
lemmas, each with minimal nondegeneracy conditions, from which the
`iff` version is then deduced.
…ality of twice angles

Add lemmas that two angles less than `π / 2` are equal if and only if
twice those angles are equal, along with a separate lemma

```lean
lemma toReal_neg_eq_neg_toReal_iff {θ : Angle} : (-θ).toReal = -(θ.toReal) ↔ θ ≠ π := by
```

which isn't directly connected but turns out to be useful in the same
application (dealing with angles in right-angled triangles that are
less then `π / 2`, when you have two such triangles that are
oppositely-oriented).
…`π / 2`

Add a lemma that an oriented angle in a right-angled triangle is less
than `π / 2`, even in degenerate cases (there's already a
corresponding lemma for unoriented angles, but that one needs to
exclude some degenerate cases because of the different default values
for oriented and unoriented angles involving zero vectors).  Deduce
lemmas that, for such angles involved in right-angled triangles,
equality of the angles (i.e. equality mod 2π) follows from equality of
twice the angles (i.e. equality of the angles mod π).
Add a lemma

```lean
lemma orthogonalProjection_eq_iff_mem {s : AffineSubspace ℝ P} [Nonempty s]
    [s.direction.HasOrthogonalProjection] {p q : P} :
    orthogonalProjection s p = q ↔ q ∈ s ∧ p -ᵥ q ∈ s.directionᗮ := by
```

that gives the characteristic property of the orthogonal projection in
a more convenient form to use than the existing
`inter_eq_singleton_orthogonalProjection` (from which it is derived).
Add instances that the supremum of two affine subspaces, either one
nonempty, is nonempty.  These are useful when working with orthogonal projections onto such a supremum.
Add a lemma that, if the orthogonal projections of a point onto two
subspaces are equal, so is the projection onto their supremum.
jsm28 and others added 25 commits January 21, 2026 01:19
@mathlib-dependent-issues mathlib-dependent-issues bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Mar 27, 2026
Copy link
Copy Markdown
Collaborator

@wwylele wwylele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

lemma angle_incenter_eq_angle_div_two {i₁ i₂ i₃ : Fin 3} (h₁₂ : i₁ ≠ i₂) (h₁₃ : i₁ ≠ i₃)
(h₂₃ : i₂ ≠ i₃) :
∠ (t.points i₂) (t.points i₁) t.incenter = ∠ (t.points i₂) (t.points i₁) (t.points i₃) / 2 := by
let S : AffineSubspace ℝ P := affineSpan ℝ (Set.range t.points)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random idea and not in the scope of the PR: should we have a "planarize" tactic that handles restricting everything to the subspace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like that would be reasonable (once we have enough examples to show e.g. what's most convenient in terms of choosing the two-dimensional subspace / showing that all points lie in it / possibly dealing with any special cases where actually the ambient space is less than two-dimensional). Note that we don't yet have a full set of map / restrict lemmas for all simplex definitions, though that might only matter when they're missing for the particular definition you wish to transport to a two-dimensional subspace in a particular case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-euclidean-geometry Affine and axiomatic geometry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants