Poincaré conjecture: the Lean proof, cleaned up together
The 2026 Lean proof of the Poincaré conjecture after Morgan and Tian, 3 million lines, cleaned up together: smaller, faster to build, more readable, the theorems unchanged

| 1 | import Mathlib.Analysis.SpecialFunctions.Trigonometric.DerivHyp |
| 2 | import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse |
| 3 | |
| 4 | /-! |
| 5 | # Hyperbolic comparison angles |
| 6 | |
| 7 | The angle opposite the third side in the curvature minus one model is given |
| 8 | by the hyperbolic cosine rule. Continuity only requires positivity of the two |
| 9 | adjacent sides, including when the triangle is degenerate. |
| 10 | |
| 11 | Reference: Burago--Gromov--Perelman (1992), Definition 2.3, p. 5. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Filter Topology |
| 18 | |
| 19 | namespace Poincare.Alexandrov |
| 20 | |
| 21 | /-- The hyperbolic comparison angle with adjacent sides `r`, `s` and opposite |
| 22 | side `t`, in the model of constant curvature minus one. -/ |
| 23 | def comparisonAngle (r s t : ℝ) : ℝ := |
| 24 | Real.arccos ((Real.cosh r * Real.cosh s - Real.cosh t) / |
| 25 | (Real.sinh r * Real.sinh s)) |
| 26 | |
| 27 | theorem comparisonAngle_nonneg (r s t : ℝ) : 0 ≤ comparisonAngle r s t := |
| 28 | Real.arccos_nonneg _ |
| 29 | |
| 30 | theorem comparisonAngle_le_pi (r s t : ℝ) : comparisonAngle r s t ≤ Real.pi := |
| 31 | Real.arccos_le_pi _ |
| 32 | |
| 33 | theorem comparisonAngle_comm (r s t : ℝ) : |
| 34 | comparisonAngle r s t = comparisonAngle s r t := by |
| 35 | simp only [comparisonAngle, mul_comm] |
| 36 | |
| 37 | /-- The hyperbolic cosine expression belongs to the domain of the inverse |
| 38 | cosine for side lengths satisfying the triangle inequalities. -/ |
| 39 | theorem comparisonCos_mem_Icc {r s t : ℝ} |
| 40 | (hr : 0 < r) (hs : 0 < s) (ht : 0 ≤ t) |
| 41 | (hrs : |r - s| ≤ t) (htop : t ≤ r + s) : |
| 42 | (Real.cosh r * Real.cosh s - Real.cosh t) / (Real.sinh r * Real.sinh s) ∈ |
| 43 | Set.Icc (-1 : ℝ) 1 := by |
| 44 | have hden : 0 < Real.sinh r * Real.sinh s := |
| 45 | mul_pos (Real.sinh_pos_iff.mpr hr) (Real.sinh_pos_iff.mpr hs) |
| 46 | have hupper : Real.cosh t ≤ Real.cosh (r + s) := |
| 47 | Real.cosh_le_cosh.mpr (by |
| 48 | simpa only [abs_of_nonneg ht, abs_of_pos (add_pos hr hs)] using htop) |
| 49 | have hlower : Real.cosh (r - s) ≤ Real.cosh t := |
| 50 | Real.cosh_le_cosh.mpr (by simpa only [abs_of_nonneg ht] using hrs) |
| 51 | rw [Real.cosh_add] at hupper |
| 52 | rw [Real.cosh_sub] at hlower |
| 53 | constructor |
| 54 | · apply (le_div_iff₀ hden).mpr |
| 55 | linarith |
| 56 | · apply (div_le_iff₀ hden).mpr |
| 57 | linarith |
| 58 | |
| 59 | /-- The comparison angle satisfies the hyperbolic cosine rule without using |
| 60 | the totalized inverse cosine outside its geometric domain. -/ |
| 61 | theorem cos_comparisonAngle {r s t : ℝ} |
| 62 | (hr : 0 < r) (hs : 0 < s) (ht : 0 ≤ t) |
| 63 | (hrs : |r - s| ≤ t) (htop : t ≤ r + s) : |
| 64 | Real.cos (comparisonAngle r s t) = |
| 65 | (Real.cosh r * Real.cosh s - Real.cosh t) / (Real.sinh r * Real.sinh s) := by |
| 66 | exact Real.cos_arccos (comparisonCos_mem_Icc hr hs ht hrs htop).1 |
| 67 | (comparisonCos_mem_Icc hr hs ht hrs htop).2 |
| 68 | |
| 69 | /-- Hyperbolic comparison angles are continuous under convergence of side |
| 70 | lengths as long as both limiting adjacent sides are positive. -/ |
| 71 | theorem tendsto_comparisonAngle {ι : Type*} {l : Filter ι} |
| 72 | {r s t : ι → ℝ} {r₀ s₀ t₀ : ℝ} |
| 73 | (hr : Tendsto r l (𝓝 r₀)) (hs : Tendsto s l (𝓝 s₀)) |
| 74 | (ht : Tendsto t l (𝓝 t₀)) (hr₀ : 0 < r₀) (hs₀ : 0 < s₀) : |
| 75 | Tendsto (fun i => comparisonAngle (r i) (s i) (t i)) l |
| 76 | (𝓝 (comparisonAngle r₀ s₀ t₀)) := by |
| 77 | exact Real.continuous_arccos.continuousAt.tendsto.comp |
| 78 | (((Real.continuous_cosh.tendsto _ |>.comp hr).mul |
| 79 | (Real.continuous_cosh.tendsto _ |>.comp hs) |>.sub |
| 80 | (Real.continuous_cosh.tendsto _ |>.comp ht)).div |
| 81 | ((Real.continuous_sinh.tendsto _ |>.comp hr).mul |
| 82 | (Real.continuous_sinh.tendsto _ |>.comp hs)) |
| 83 | (mul_ne_zero (ne_of_gt (Real.sinh_pos_iff.mpr hr₀)) |
| 84 | (ne_of_gt (Real.sinh_pos_iff.mpr hs₀)))) |
| 85 | |
| 86 | end Poincare.Alexandrov |