mathlib4 review helperopen PRs by @wwylele on leanprover-community/mathlib4

← queue

#44230 feat(Geometry/Euclidean): prove Euler's theorem in geometry

t-euclidean-geometry maintainer-merge CI success

+111 −0 · 4 files · 3 commits · head 528545f · updated 9 days ago · Files changed on GitHub

In plain words

Proves Euler's theorem in geometry for a triangle: for incenter , circumcenter , circumradius and inradius , and its excenter version ; hence Euler's inequality , and the nine-point radius . It also adds the area formula and a general squared-distance formula from an affine combination to a point. The route: write the in/excenter as an affine combination with weights proportional to the signed side lengths (excenterWeightsFace from #44060), expand the squared distance, and use and . Registered in docs/1000.yaml.

The transcriptions were written for revision af1075d; the PR is now at 528545f. Check them against the code.

Transcriptions are drafted with an LLM from the diff and are a reading aid, not a verified statement: the Lean code is the reference.

PR description

This proves en.wikipedia.org/wiki/Euler%27s_theorem_in_geometry


Conversation on GitHub 11
github-actions[bot] · comment · 2026-09-26
✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions. Thank you!

github-actions[bot] · comment · 2026-09-26
PR summary 528545f253

<details><summary>

Import changes for modified files

</summary>

Dependency changes

| File | Base Count | Head Count | Change | | --- | --- | --- | --- | | Mathlib.Geometry.Euclidean.Volume.Triangle | 2851 | 2872 | +21 (+0.74%) |

<details><summary>Import changes for all files</summary>

|Files|Import difference| |-|-| | Mathlib.Geometry.Euclidean.Volume.Triangle|21|

</details>

</details>


<details><summary>

Declarations diff (regex)

</summary>

+ dist_excenter_circumcenter_sq + dist_excenter_singleton_circumcenter_sq + dist_excenter_sq + dist_incenter_circumcenter_sq + four_mul_volume_mul_circumradius + inradius_le_ninePointCircle_radius + sum_excenterWeightsFace_pos_of_card_le_one + sum_excenterWeightsFace_singleton_pos + sum_excenterWeightsUnnorm_pos_of_card_le_one + two_mul_inradius_le_circumradius + volume_eq_mul_div_circumradius <details> <summary>You can run this locally as follows</summary>

## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

</details>

The doc-module for scripts/pr_summary/declarations_diff.sh in the undefined repository contains some details about this script.

</details>

<details><summary>

Declarations diff (Lean)

</summary>

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 528545f).

  • +11 new declarations
  • −0 removed declarations
+Affine.Simplex.sum_excenterWeightsFace_pos_of_card_le_one
+Affine.Simplex.sum_excenterWeightsFace_singleton_pos
+Affine.Simplex.sum_excenterWeightsUnnorm_pos_of_card_le_one
+Affine.Triangle.dist_excenter_circumcenter_sq
+Affine.Triangle.dist_excenter_singleton_circumcenter_sq
+Affine.Triangle.dist_excenter_sq
+Affine.Triangle.dist_incenter_circumcenter_sq
+Affine.Triangle.four_mul_volume_mul_circumradius
+Affine.Triangle.inradius_le_ninePointCircle_radius
+Affine.Triangle.two_mul_inradius_le_circumradius
+Affine.Triangle.volume_eq_mul_div_circumradius

</details>


No changes to strong technical debt. No changes to weak technical debt.

Current commit 528545f253 Reference commit da6f8cef9e

This script lives in the undefined repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).
mathlib-merge-conflicts[bot] · comment · 2026-09-28

This pull request has conflicts, please merge master and resolve them.

mathlib-dependent-issues[bot] · comment · 2026-11-17

This PR/issue depends on:

  • ~~leanprover-community/mathlib4#44060~~
  • ~~leanprover-community/mathlib4#44102~~
  • ~~leanprover-community/mathlib4#44148~~

By Dependent Issues (🤖). Happy coding!

mathlib-merge-conflicts[bot] · comment · 2026-11-17

This pull request has conflicts, please merge master and resolve them.

vihdzp · on Mathlib/Geometry/Euclidean/Volume/Triangle.lean:160 (outdated) · 2026-11-18
/-- **Euler's theorem in geometry** for excenters. -/
vihdzp · on Mathlib/Geometry/Euclidean/Volume/Triangle.lean:167 (outdated) · 2026-11-18
/-- **Euler's theorem in geometry** for incenters. -/
vihdzp · on Mathlib/Geometry/Euclidean/Volume/Triangle.lean:173 (outdated) · 2026-11-18

I think it's best to reserve the "not larger than" phrasing to partial orders.

/-- **Euler inequality**: the inradius of a triangle is less or equal to half of the circumradius. -/
wwylele · on Mathlib/Geometry/Euclidean/Volume/Triangle.lean:173 (outdated) · 2026-11-18
/-- **Euler inequality**: the inradius of a triangle is less or equal to half of the
circumradius. -/
jsm28 · comment · 2026-11-27

maintainer merge

github-actions[bot] · comment · 2026-11-27

🚀 Pull request has been placed on the maintainer queue by jsm28.

Mathlib/Geometry/Euclidean/Incenter/Basic.lean +8 −0

lemma sum_excenterWeightsUnnorm_singleton_pos [Nat.AtLeastTwo n] (i : Fin (n + 1
302 · rw [Finset.mem_filter_univ] at h
303 simp [excenterWeightsUnnorm, h]
lemma sum_excenterWeightsUnnorm_pos_of_card_le_one newL305–311
305lemma sum_excenterWeightsUnnorm_pos_of_card_le_one [Nat.AtLeastTwo n] {signs : Finset (Fin (n + 1))}
306 (h : signs.card ≤ 1) :
307 0 < ∑ j, s.excenterWeightsUnnorm signs j := by
308 obtain ⟨i, hi⟩ := Finset.card_le_one_iff_subset_singleton.mp h
309 obtain rfl | rfl := Finset.subset_singleton_iff.mp hi
310 · exact s.sum_excenterWeightsUnnorm_empty_pos
311 · exact s.sum_excenterWeightsUnnorm_singleton_pos i
313lemma sign_excenterWeights_singleton_neg [Nat.AtLeastTwo n] (i : Fin (n + 1)) :
314 SignType.sign (s.excenterWeights {i} i) = -1 := by
315 simp_rw [excenterWeights, Pi.smul_apply, smul_eq_mul, sign_mul]

Mathlib/Geometry/Euclidean/Volume/Incenter.lean +11 −0

theorem excenterWeights_eq_excenterWeightsFace_div :
95 excenterWeights, Pi.smul_apply, smul_eq_mul]
96 field [‹NeZero n›.ne]
theorem sum_excenterWeightsFace_singleton_pos newL98–101
98theorem sum_excenterWeightsFace_singleton_pos [Nat.AtLeastTwo n] (i : Fin (n + 1)) :
99 0 < ∑ j, s.excenterWeightsFace {i} j := by
100 simp_rw [excenterWeightsFace_eq_volume_mul_excenterWeightsUnnorm, ← Finset.mul_sum]
101 positivity [‹NeZero n›.pos, s.sum_excenterWeightsUnnorm_singleton_pos i]
theorem sum_excenterWeightsFace_pos_of_card_le_one newL103–107
103theorem sum_excenterWeightsFace_pos_of_card_le_one [Nat.AtLeastTwo n] {signs : Finset (Fin (n + 1))}
104 (h : signs.card ≤ 1) :
105 0 < ∑ j, s.excenterWeightsFace signs j := by
106 simp_rw [excenterWeightsFace_eq_volume_mul_excenterWeightsUnnorm, ← Finset.mul_sum]
107 positivity [‹NeZero n›.pos, s.sum_excenterWeightsUnnorm_pos_of_card_le_one h]
109variable {s signs} in
110theorem ExcenterExists.volume_eq_exradius_mul (h : s.ExcenterExists signs) :
111 s.volume = (↑n)⁻¹ * s.exradius signs * |∑ i, s.excenterWeightsFace signs i| := by

Mathlib/Geometry/Euclidean/Volume/Triangle.lean +87 −0

Authors: Weiyi Wang, Matt Kempster
6module
7
8public import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
9public import Mathlib.Geometry.Euclidean.Incenter.Basic
10public import Mathlib.Geometry.Euclidean.NinePointCircle
11public import Mathlib.Geometry.Euclidean.Volume.Def
13import Mathlib.Geometry.Euclidean.Angle.Sphere
14import Mathlib.Geometry.Euclidean.Triangle
15import Mathlib.Geometry.Euclidean.Volume.Basic
16import Mathlib.Geometry.Euclidean.Volume.Incenter
18/-!
19# Area of a triangle
This file collects formulas for the area of a triangle and other related results
25* `Affine.Triangle.volume_eq_height_mul`: $S = \frac{1}{2}hb$
26* `Affine.Triangle.volume_eq_mul_sin`: $S = \frac{1}{2}ab \sin C$
27* `Affine.Triangle.volume_eq_sqrt_mul_sub_mul_sub_mul_sub`: Heron's formula.
28* `Affine.Triangle.volume_eq_mul_div_circumradius`: $S = abc/(4R)$ where $R$ is the circumradius.
29* `Affine.Triangle.dist_excenter_singleton_circumcenter_sq`:
30 Euler's theorem in geometry for excenter.
31* `Affine.Triangle.dist_incenter_circumcenter_sq`: Euler's theorem in geometry for incenter.
32* `Affine.Triangle.two_mul_inradius_le_circumradius`: Euler's inequality $2r \le R$.
33-/
35public section
theorem volume_sq_eq_mul_sub_mul_sub_mul_sub :
103 rw [← t.volume_eq_sqrt_mul_sub_mul_sub_mul_sub h₁₂ h₁₃ h₂₃] at this
104 simp [t.volume_pos.ne'] at this
106include h₁₂ h₁₃ h₂₃ in
theorem volume_eq_mul_div_circumradius newL107–114
107/-- Triangle area is equal to $abc / (4R)$, where $a$, $b$, and $c$ are side length and $R$ is the
108circumradius. -/
109theorem volume_eq_mul_div_circumradius :
110 t.volume = dist (t.points i₁) (t.points i₂) * dist (t.points i₁) (t.points i₃) *
111 dist (t.points i₂) (t.points i₃) / (4 * t.circumradius) := by
112 have : dist (t.points i₁) (t.points i₃) ≠ 0 := by simpa using t.independent.injective.ne h₁₃
113 rw [t.volume_eq_mul_sin h₁₂ h₁₃ h₂₃, ← t.dist_div_sin_angle_div_two_eq_circumradius h₁₂ h₁₃ h₂₃]
114 field
116include h₁₂ h₁₃ h₂₃ in
theorem four_mul_volume_mul_circumradius newL117–121
117theorem four_mul_volume_mul_circumradius :
118 4 * t.volume * t.circumradius = dist (t.points i₁) (t.points i₂) *
119 dist (t.points i₁) (t.points i₃) * dist (t.points i₂) (t.points i₃) := by
120 rw [t.volume_eq_mul_div_circumradius h₁₂ h₁₃ h₂₃]
121 field [t.circumradius_pos.ne']
123local notation "w" => excenterWeightsFace
theorem dist_excenter_sq newL125–151
125theorem dist_excenter_sq (p : P) {signs : Finset (Fin 3)} (hsigns : signs.card ≤ 1) :
126 dist (t.excenter signs) p ^ 2 = ∑ i, t.excenterWeights signs i * dist (t.points i) p ^ 2 +
127 (if signs = ∅ then -1 else 1) * 2 * t.circumradius * t.exradius signs := by
128 rw [t.excenter_eq_affineCombination, dist_affineCombination_const_sq _ _
129 (t.sum_excenterWeights_eq_one_iff.mpr (t.excenterExists _))]
130 congrm _ + ?_
131 calc
132 _ = -((∑ i, ∑ j, w t signs i * w t signs j * dist (t.points i) (t.points j) ^ 2) / 2 /
133 (∑ i, w t signs i) ^ 2) := by
134 simp_rw [t.excenterWeights_eq_excenterWeightsFace_div, Finset.sum_div]
135 congrm -∑ i, ∑ j, $(by ring)
136 _ = (if signs = ∅ then -1 else 1) *
137 (dist (t.points 0) (t.points 1) * dist (t.points 0) (t.points 2) *
138 dist (t.points 1) (t.points 2)) * (∑ i, w t signs i) / (∑ i, w t signs i) ^ 2 := by
139 obtain ⟨i, hi⟩ := Finset.card_le_one_iff_subset_singleton.mp hsigns
140 obtain rfl | rfl := Finset.subset_singleton_iff.mp hi
141 on_goal 2 => fin_cases i
142 all_goals
143 simp [Fin.sum_univ_three, excenterWeightsFace, faceOpposite_point_eq_point_succAbove,
144 Fin.succAbove, dist_comm (t.points 1) (t.points 0), dist_comm (t.points 2) (t.points 1),
145 dist_comm (t.points 2) (t.points 0)]
146 ring
147 _ = _ := by
148 have h0 := t.sum_excenterWeightsFace_pos_of_card_le_one hsigns
149 rw [← t.four_mul_volume_mul_circumradius (by simp) (by simp) (by simp),
150 (t.excenterExists signs).volume_eq_exradius_mul, abs_of_nonneg h0.le]
151 field
theorem dist_excenter_circumcenter_sq newL153–158
153theorem dist_excenter_circumcenter_sq {signs : Finset (Fin 3)} (hsigns : signs.card ≤ 1) :
154 dist (t.excenter signs) t.circumcenter ^ 2 =
155 t.circumradius * (t.circumradius + (if signs = ∅ then -1 else 1) * 2 * t.exradius signs) := by
156 simp_rw [t.dist_excenter_sq t.circumcenter hsigns, dist_circumcenter_eq_circumradius,
157 ← Finset.sum_mul, t.sum_excenterWeights_eq_one_iff.mpr (t.excenterExists _)]
158 ring
theorem dist_excenter_singleton_circumcenter_sq newL160–165
160/-- **Euler's theorem in geometry** for excenters. -/
161theorem dist_excenter_singleton_circumcenter_sq (i : Fin 3) :
162 dist (t.excenter {i}) t.circumcenter ^ 2 =
163 t.circumradius * (t.circumradius + 2 * t.exradius {i}) := by
164 rw [t.dist_excenter_circumcenter_sq (by simp)]
165 simp
theorem dist_incenter_circumcenter_sq newL167–171
167/-- **Euler's theorem in geometry** for incenters. -/
168theorem dist_incenter_circumcenter_sq :
169 dist t.incenter t.circumcenter ^ 2 = t.circumradius * (t.circumradius - 2 * t.inradius) := by
170 rw [← excenter_empty, t.dist_excenter_circumcenter_sq (by simp), sub_eq_add_neg]
171 simp
theorem two_mul_inradius_le_circumradius newL173–178
173/-- **Euler inequality**: the inradius of a triangle is less or equal to half of the
174circumradius. -/
175theorem two_mul_inradius_le_circumradius : 2 * t.inradius ≤ t.circumradius := by
176 have := sq_nonneg (dist t.incenter t.circumcenter)
177 rw [dist_incenter_circumcenter_sq] at this
178 simpa using nonneg_of_mul_nonneg_right this t.circumradius_pos
theorem inradius_le_ninePointCircle_radius newL180–182
180theorem inradius_le_ninePointCircle_radius : t.inradius ≤ t.ninePointCircle.radius := by
181 grw [ninePointCircle_radius, ← two_mul_inradius_le_circumradius]
182 simp
184end Affine.Triangle

docs/1000.yaml +5 −0

Q1422083:
1670Q1423818:
1671 title: Euler's theorem in geometry
1672 decls:
1673 - Affine.Triangle.dist_excenter_singleton_circumcenter_sq
1674 - Affine.Triangle.dist_incenter_circumcenter_sq
1675 authors: Weiyi Wang
1676 date: 2026
1678Q1424481:
1679 title: Frucht's theorem
0/11 declarations checked

Your review, as Markdown

Paste it as a comment or a review on the PR. Line links to the head commit unfold into code snippets on GitHub.