Skip to content

[Merged by Bors] - feat(Geometry/Euclidean/Incenter): incenters and excenters#23752

Closed
jsm28 wants to merge 63 commits intomasterfrom
jsm28/incenter
Closed

[Merged by Bors] - feat(Geometry/Euclidean/Incenter): incenters and excenters#23752
jsm28 wants to merge 63 commits intomasterfrom
jsm28/incenter

Conversation

@jsm28
Copy link
Copy Markdown
Contributor

@jsm28 jsm28 commented Apr 7, 2025

Define the exspheres and insphere of a simplex (in dimension 1 and greater), and corresponding definitions for their center and radius. Give necessary and sufficient conditions for them to exist (in terms of the barycentric coordinates, being signed versions of the inverses of the distances between vertices and opposite faces, having a nonzero sum) and show that they do always exist in the case of the incenter and of the excenter opposite a single vertex (the latter in dimensions 2 and greater), and that any point lying in the span of the vertices and equidistant from the faces opposite the vertices is an excenter (and, when signs of the equal distances are given, is the excenter with corresponding signs).

Some major pieces are deferred to followups, in particular definitions of touchpoints, tangency of exspheres and insphere to faces, and the relation to angle bisectors in various forms. But since the file is already over 600 lines, I think this is a reasonable starting point (and since the lemmas do show that the definitions have their characteristic properties of points being equidistant from the faces on the desired sides, I think it sufficiently justifies that the definitions are correct and usable as-is).

Feel free to golf; the calculations involved in showing that the excenter opposite a vertex always exists (in dimensions 2 and greater) are rather long.


Open in Gitpod

jsm28 added 4 commits April 5, 2025 23:23
… of simplex

Add two simple lemmas about the projection of a vertex of a simplex
onto the opposite face (that arise while setting up the theory of
`incenter` and `excenter`).

```lean
@[simp] lemma ne_orthogonalProjection_faceOpposite (i : Fin (n + 1)) : s.points i ≠
    orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i) := by
```

```lean
lemma dist_orthogonalProjection_faceOpposite_pos (i : Fin (n + 1)) :
    0 < dist (s.points i)
      (orthogonalProjection (affineSpan ℝ (Set.range (s.faceOpposite i).points)) (s.points i)) := by
```
Add the trivial lemmas `abs_ite`, `abs_dite`, `mabs_ite` and `mabs_dite`.
@jsm28 jsm28 added the t-euclidean-geometry Affine and axiomatic geometry label Apr 7, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2025

PR summary 0665576140

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Geometry.Euclidean.Altitude Mathlib.Geometry.Euclidean.MongePoint 1
Mathlib.Geometry.Euclidean.Incenter (new file) 1928

Declarations diff

+ ExcenterExists
+ ExcenterExists.dist_excenter
+ ExcenterExists.excenter_mem_affineSpan_range
+ ExcenterExists.exradius_pos
+ ExcenterExists.signedInfDist_excenter
+ ExcenterExists.signedInfDist_excenter_eq_mul_sum_inv
+ ExcenterExists.sum_excenterWeights_eq_one
+ _
+ abs_inner_vsub_altitudeFoot_div_lt_one
+ abs_inner_vsub_altitudeFoot_lt_mul
+ altitudeFoot_mem_affineSpan_image_compl
+ dist_incenter
+ excenter
+ excenterExists_compl
+ excenterExists_empty
+ excenterExists_singleton
+ excenterWeights
+ excenterWeightsUnnorm
+ excenterWeightsUnnorm_compl
+ excenterWeightsUnnorm_empty_apply
+ excenterWeights_compl
+ excenter_empty
+ excenter_eq_affineCombination
+ excenter_singleton_mem_affineSpan_range
+ excenter_univ
+ exists_forall_dist_eq_iff_exists_excenterExists_and_eq_excenter
+ exists_forall_signedInfDist_eq_iff_eq_incenter
+ exists_forall_signedInfDist_eq_iff_excenterExists_and_eq_excenter
+ exists_ne_and_ne_of_two_lt
+ exradius
+ exradius_empty
+ exradius_eq_abs_inv_sum
+ exradius_nonneg
+ exradius_singleton_pos
+ exradius_univ
+ exsphere
+ exsphere_center
+ exsphere_empty
+ exsphere_radius
+ exsphere_univ
+ incenter
+ incenter_eq_affineCombination
+ incenter_mem_affineSpan_range
+ inner_vsub_vsub_altitudeFoot_eq_height_sq
+ inradius
+ inradius_eq_abs_inv_sum
+ inradius_pos
+ insphere
+ insphere_center
+ insphere_radius
+ inv_height_eq_sum_mul_inv_dist
+ inv_height_lt_sum_inv_height
+ neg_mul_lt_inner_vsub_altitudeFoot
+ neg_one_lt_inner_vsub_altitudeFoot_div
+ signedInfDist_incenter
+ sum_excenterWeights
+ sum_excenterWeightsUnnorm_empty_pos
+ sum_excenterWeightsUnnorm_singleton_pos
+ sum_excenterWeights_eq_one_iff
+ sum_inv_height_sq_smul_vsub_eq_zero

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 7, 2025
@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot removed the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Apr 7, 2025
This reduces the number of cases where rewriting on the definition of
`orthogonalProjectionSpan` is needed.
@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 19, 2025

Whether ExcenterExists for a given subset of vertices (not empty, a singleton or the complement of such) in three or more dimensions depends on the particular simplex. The obvious cases are for a regular simplex where all heights are equal. You could probably construct extreme examples to show that the inequalities can go either way round for a set of between 2 and n-1 of the n+1 vertices and then use continuity to show that there exists a simplex where you have equality (not that we have a topology on the space of n-simplices at present, and this argument also requires showing that space is connected, as well as that height is a continuous function of the simplex), and thus that for any cardinality in that range it is possible that ExcenterExists and possible that not ExcenterExists.

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 19, 2025

(With the added complication that the space of n-simplices in an ambient space of n dimensions isn't actually connected, it has two connected components corresponding to orientations of the ambient space.)

@eric-wieser
Copy link
Copy Markdown
Member

Just to be clear I understand what you wrote above; you have no examples of extreme simplices in mind that permit more than the single-face excenters, but you believe they could exist?

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 19, 2025

A general simplex will have all 2^n possible excenters. It's equality (and thus fewer excenters) that's the exceptional case; the extreme simplices are in order to show that equality is possible (via showing that both signs of the inequality are possible). Simply taking a regular simplex gives all possible excenters except for those given by a set of exactly half the vertices (in an odd dimension).

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 19, 2025

But to construct the extreme simplices: we want to construct an n-simplex (thus n+1 vertices), with n at least 3, where three heights are equal and much smaller than the rest (reciprocals much larger than the rest) so the sign of the inequality is determined by which set contains two of the three. When giving explicit coordinates for an n-simplex it's often convenient to work in more than n dimensions; we'll work in n+2 dimensions.. n-2 of the vertices are of the form (1, 0, 0, ...), (0, 1, 0, 0, ...), using the first n-2 coordinates. The remaining three vertices are (0, ..., 0, 1-epsilon, epsilon, 0, 0), (0, ..., 0, 1-epsilon, 0, epsilon, 0) and (0, ..., 0, 1-epsilon, 0, 0, epsilon). The final three vertices are close to each other, so have small heights, and symmetry says their heights are equal. To bound the height of the first vertex (which equals the height of any other of the first n-2), note that all the others lie in the affine subspace where the sum of all but the first coordinate is 1, and the first coordinate is 0, so the distance to that subspace (which is at least 1) is a lower bound on that height.

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 19, 2025

(There may well be simpler constructions, or indeed explicit constructions to give equality directly for any desired set of between 2 and n-1 vertices.)

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) and removed blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) labels May 19, 2025
@JovanGerb
Copy link
Copy Markdown
Contributor

I think this definition gives an arbitrary point for degenerate triangles. But I think for triangles you can still define the incenter to be the middle one of the three points if they are collinear, and I think this gives a continuous, total definition of incenter of a triangle. Is this something we want? And does this have a natural definition other than a case split?

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 20, 2025

Everything here is for a Simplex, so you can't apply the definitions at all to any family of points that's not affine independent.

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 20, 2025

The case giving an arbitrary point with these definitions is rather where the signed sum of weights is 0. You can interpret such a sum of points with weights summing to 0 as giving a vector via weightedVSub rather than a point. The span of that vector is probably the intersection of the directions of the relevant angle bisectors (whereas when the signed sum of weights is nonzero, the bisectors intersect in a single point and thus the intersection of their directions is trivial).

@eric-wieser
Copy link
Copy Markdown
Member

eric-wieser commented May 20, 2025

I guess you could make the same argument that altitudeFoot and therefore height is well-defined in the degenerate case (for a line Sbtw (p 0) (p 1) (p 2) the feet are ![p 2, p 1, p 0])

@jsm28
Copy link
Copy Markdown
Contributor Author

jsm28 commented May 20, 2025

You could apply the definitions of altitudeFoot and height without affine independence, but they'd give each point as its own foot (height 0) in the case of three distinct collinear points.

@eric-wieser
Copy link
Copy Markdown
Member

I think I said the wrong thing above, that actually sounds correct to me.

Copy link
Copy Markdown
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Thanks 🎉

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Jun 12, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jun 12, 2025
Define the exspheres and insphere of a simplex (in dimension 1 and greater), and corresponding definitions for their center and radius. Give necessary and sufficient conditions for them to exist (in terms of the barycentric coordinates, being signed versions of the inverses of the distances between vertices and opposite faces, having a nonzero sum) and show that they do always exist in the case of the incenter and of the excenter opposite a single vertex (the latter in dimensions 2 and greater), and that any point lying in the span of the vertices and equidistant from the faces opposite the vertices is an excenter (and, when signs of the equal distances are given, is the excenter with corresponding signs).

Some major pieces are deferred to followups, in particular definitions of touchpoints, tangency of exspheres and insphere to faces, and the relation to angle bisectors in various forms. But since the file is already over 600 lines, I think this is a reasonable starting point (and since the lemmas do show that the definitions have their characteristic properties of points being equidistant from the faces on the desired sides, I think it sufficiently justifies that the definitions are correct and usable as-is).

Feel free to golf; the calculations involved in showing that the excenter opposite a vertex always exists (in dimensions 2 and greater) are rather long.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 12, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(Geometry/Euclidean/Incenter): incenters and excenters [Merged by Bors] - feat(Geometry/Euclidean/Incenter): incenters and excenters Jun 12, 2025
@mathlib-bors mathlib-bors bot closed this Jun 12, 2025
@mathlib-bors mathlib-bors bot deleted the jsm28/incenter branch June 12, 2025 13:39
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Jun 15, 2025
…r-community#23752)

Define the exspheres and insphere of a simplex (in dimension 1 and greater), and corresponding definitions for their center and radius. Give necessary and sufficient conditions for them to exist (in terms of the barycentric coordinates, being signed versions of the inverses of the distances between vertices and opposite faces, having a nonzero sum) and show that they do always exist in the case of the incenter and of the excenter opposite a single vertex (the latter in dimensions 2 and greater), and that any point lying in the span of the vertices and equidistant from the faces opposite the vertices is an excenter (and, when signs of the equal distances are given, is the excenter with corresponding signs).

Some major pieces are deferred to followups, in particular definitions of touchpoints, tangency of exspheres and insphere to faces, and the relation to angle bisectors in various forms. But since the file is already over 600 lines, I think this is a reasonable starting point (and since the lemmas do show that the definitions have their characteristic properties of points being equidistant from the faces on the desired sides, I think it sufficiently justifies that the definitions are correct and usable as-is).

Feel free to golf; the calculations involved in showing that the excenter opposite a vertex always exists (in dimensions 2 and greater) are rather long.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
pfaffelh pushed a commit to pfaffelh/mathlib4 that referenced this pull request Jun 15, 2025
…r-community#23752)

Define the exspheres and insphere of a simplex (in dimension 1 and greater), and corresponding definitions for their center and radius. Give necessary and sufficient conditions for them to exist (in terms of the barycentric coordinates, being signed versions of the inverses of the distances between vertices and opposite faces, having a nonzero sum) and show that they do always exist in the case of the incenter and of the excenter opposite a single vertex (the latter in dimensions 2 and greater), and that any point lying in the span of the vertices and equidistant from the faces opposite the vertices is an excenter (and, when signs of the equal distances are given, is the excenter with corresponding signs).

Some major pieces are deferred to followups, in particular definitions of touchpoints, tangency of exspheres and insphere to faces, and the relation to angle bisectors in various forms. But since the file is already over 600 lines, I think this is a reasonable starting point (and since the lemmas do show that the definitions have their characteristic properties of points being equidistant from the faces on the desired sides, I think it sufficiently justifies that the definitions are correct and usable as-is).

Feel free to golf; the calculations involved in showing that the excenter opposite a vertex always exists (in dimensions 2 and greater) are rather long.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
callesonne pushed a commit to callesonne/mathlib4 that referenced this pull request Jul 24, 2025
…r-community#23752)

Define the exspheres and insphere of a simplex (in dimension 1 and greater), and corresponding definitions for their center and radius. Give necessary and sufficient conditions for them to exist (in terms of the barycentric coordinates, being signed versions of the inverses of the distances between vertices and opposite faces, having a nonzero sum) and show that they do always exist in the case of the incenter and of the excenter opposite a single vertex (the latter in dimensions 2 and greater), and that any point lying in the span of the vertices and equidistant from the faces opposite the vertices is an excenter (and, when signs of the equal distances are given, is the excenter with corresponding signs).

Some major pieces are deferred to followups, in particular definitions of touchpoints, tangency of exspheres and insphere to faces, and the relation to angle bisectors in various forms. But since the file is already over 600 lines, I think this is a reasonable starting point (and since the lemmas do show that the definitions have their characteristic properties of points being equidistant from the faces on the desired sides, I think it sufficiently justifies that the definitions are correct and usable as-is).

Feel free to golf; the calculations involved in showing that the excenter opposite a vertex always exists (in dimensions 2 and greater) are rather long.



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-euclidean-geometry Affine and axiomatic geometry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants