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 PoincareLib.Geometry.Alexandrov.ComparisonAngle |
| 2 | import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent |
| 3 | |
| 4 | /-! |
| 5 | # The Euclidean limit of small hyperbolic comparison angles |
| 6 | |
| 7 | After dividing out a vanishing common scale, the hyperbolic cosine rule tends |
| 8 | to the Euclidean cosine rule, also for varying side lengths. This is an |
| 9 | analytic intermediate for the rescaling argument in Petrunin (2009), |
| 10 | Section 3.7, author manuscript p. 7. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Filter Topology |
| 16 | |
| 17 | namespace Poincare.Alexandrov |
| 18 | |
| 19 | private theorem tendsto_sinh_mul_div |
| 20 | {ι : Type*} {l : Filter ι} {t a : ι → ℝ} {a₀ : ℝ} |
| 21 | (ht : Tendsto t l (𝓝 0)) (htne : ∀ᶠ j in l, t j ≠ 0) |
| 22 | (ha : Tendsto a l (𝓝 a₀)) : |
| 23 | Tendsto (fun j => Real.sinh (t j * a j) / t j) l (𝓝 a₀) := by |
| 24 | have hprod : Tendsto (fun j => t j * a j) l (𝓝 0) := by |
| 25 | simpa only [zero_mul] using ht.mul ha |
| 26 | have heq := (Real.isEquivalent_sinh.comp_tendsto hprod).div |
| 27 | (Asymptotics.IsEquivalent.refl (u := t) (l := l)) |
| 28 | apply heq.symm.tendsto_nhds |
| 29 | apply ha.congr' |
| 30 | filter_upwards [htne] with j hj |
| 31 | simp only [Pi.div_apply, Function.comp_apply, id_eq, mul_div_cancel_left₀ _ hj] |
| 32 | |
| 33 | private theorem cosh_sub_one_eq_two_mul_sinh_half_sq (x : ℝ) : |
| 34 | Real.cosh x - 1 = 2 * Real.sinh (x / 2) ^ 2 := by |
| 35 | have hdouble := Real.cosh_two_mul (x / 2) |
| 36 | rw [mul_div_cancel₀ _ (by norm_num : (2 : ℝ) ≠ 0)] at hdouble |
| 37 | nlinarith only [hdouble, Real.cosh_sq_sub_sinh_sq (x / 2)] |
| 38 | |
| 39 | private theorem tendsto_cosh_mul_sub_one_div_sq |
| 40 | {ι : Type*} {l : Filter ι} {t a : ι → ℝ} {a₀ : ℝ} |
| 41 | (ht : Tendsto t l (𝓝 0)) (htne : ∀ᶠ j in l, t j ≠ 0) |
| 42 | (ha : Tendsto a l (𝓝 a₀)) : |
| 43 | Tendsto (fun j => (Real.cosh (t j * a j) - 1) / t j ^ 2) l |
| 44 | (𝓝 (a₀ ^ 2 / 2)) := by |
| 45 | have h := (tendsto_sinh_mul_div ht htne (ha.div_const 2)).pow 2 |
| 46 | have htwo := h.const_mul 2 |
| 47 | convert htwo using 1 |
| 48 | · ext j |
| 49 | rw [cosh_sub_one_eq_two_mul_sinh_half_sq] |
| 50 | rw [show t j * a j / 2 = t j * (a j / 2) by ring] |
| 51 | ring |
| 52 | · congr 1 |
| 53 | ring |
| 54 | |
| 55 | /-- Varying side lengths have the Euclidean comparison-angle limit as a |
| 56 | nonzero common scale tends to zero. The third limiting side may vanish. -/ |
| 57 | theorem tendsto_comparisonAngle_mul_of_tendsto_zero |
| 58 | {ι : Type*} {l : Filter ι} {t a b d : ι → ℝ} {a₀ b₀ d₀ : ℝ} |
| 59 | (ht : Tendsto t l (𝓝 0)) (htne : ∀ᶠ j in l, t j ≠ 0) |
| 60 | (ha : Tendsto a l (𝓝 a₀)) (hb : Tendsto b l (𝓝 b₀)) |
| 61 | (hd : Tendsto d l (𝓝 d₀)) (ha₀ : 0 < a₀) (hb₀ : 0 < b₀) : |
| 62 | Tendsto (fun j => comparisonAngle (t j * a j) (t j * b j) (t j * d j)) l |
| 63 | (𝓝 (Real.arccos ((a₀ ^ 2 + b₀ ^ 2 - d₀ ^ 2) / (2 * a₀ * b₀)))) := by |
| 64 | have hsina := tendsto_sinh_mul_div ht htne ha |
| 65 | have hsinb := tendsto_sinh_mul_div ht htne hb |
| 66 | have hca := tendsto_cosh_mul_sub_one_div_sq ht htne ha |
| 67 | have hcb := tendsto_cosh_mul_sub_one_div_sq ht htne hb |
| 68 | have hcd := tendsto_cosh_mul_sub_one_div_sq ht htne hd |
| 69 | have hcosb : Tendsto (fun j => Real.cosh (t j * b j)) l (𝓝 1) := by |
| 70 | simpa only [zero_mul, Real.cosh_zero, Function.comp_def] using |
| 71 | Real.continuous_cosh.continuousAt.tendsto.comp (ht.mul hb) |
| 72 | have hquot := (((hca.mul hcosb).add hcb).sub hcd).div (hsina.mul hsinb) |
| 73 | (mul_ne_zero ha₀.ne' hb₀.ne') |
| 74 | have hratio : Tendsto (fun j => |
| 75 | (Real.cosh (t j * a j) * Real.cosh (t j * b j) - Real.cosh (t j * d j)) / |
| 76 | (Real.sinh (t j * a j) * Real.sinh (t j * b j))) l |
| 77 | (𝓝 ((a₀ ^ 2 + b₀ ^ 2 - d₀ ^ 2) / (2 * a₀ * b₀))) := by |
| 78 | have heq : (fun j => |
| 79 | (((Real.cosh (t j * a j) - 1) / t j ^ 2) * Real.cosh (t j * b j) + |
| 80 | (Real.cosh (t j * b j) - 1) / t j ^ 2 - |
| 81 | (Real.cosh (t j * d j) - 1) / t j ^ 2) / |
| 82 | ((Real.sinh (t j * a j) / t j) * (Real.sinh (t j * b j) / t j))) =ᶠ[l] |
| 83 | (fun j => |
| 84 | (Real.cosh (t j * a j) * Real.cosh (t j * b j) - Real.cosh (t j * d j)) / |
| 85 | (Real.sinh (t j * a j) * Real.sinh (t j * b j))) := by |
| 86 | filter_upwards [htne] with j hj |
| 87 | field_simp |
| 88 | ring |
| 89 | convert hquot.congr' heq using 1 |
| 90 | congr 1 |
| 91 | ring |
| 92 | exact Real.continuous_arccos.continuousAt.tendsto.comp hratio |
| 93 | |
| 94 | /-- The constant-side specialization along positive scales tending to zero. -/ |
| 95 | theorem tendsto_comparisonAngle_mul_zero_right |
| 96 | {a b d : ℝ} (ha : 0 < a) (hb : 0 < b) : |
| 97 | Tendsto (fun t : ℝ => comparisonAngle (t * a) (t * b) (t * d)) (𝓝[>] 0) |
| 98 | (𝓝 (Real.arccos ((a ^ 2 + b ^ 2 - d ^ 2) / (2 * a * b)))) := by |
| 99 | apply tendsto_comparisonAngle_mul_of_tendsto_zero |
| 100 | (tendsto_id.mono_left nhdsWithin_le_nhds) ?_ |
| 101 | tendsto_const_nhds tendsto_const_nhds tendsto_const_nhds ha hb |
| 102 | filter_upwards [self_mem_nhdsWithin] with t ht |
| 103 | exact ne_of_gt ht |
| 104 | |
| 105 | /-- A strict Euclidean angular margin gives a hyperbolic angular margin on |
| 106 | all sufficiently small equal-radius hinges, uniformly in the third side. -/ |
| 107 | theorem exists_pos_comparisonAngle_gt_of_euclidean_angle_ge |
| 108 | {θ θ' : ℝ} (hθ : 0 < θ) (hθθ' : θ < θ') (hθ'pi : θ' < Real.pi) : |
| 109 | ∃ R₀ : ℝ, 0 < R₀ ∧ ∀ R d : ℝ, 0 < R → R < R₀ → |
| 110 | 0 ≤ d → d ≤ 2 * R → |
| 111 | θ' ≤ Real.arccos ((2 * R ^ 2 - d ^ 2) / (2 * R ^ 2)) → |
| 112 | θ < comparisonAngle R R d := by |
| 113 | let D := Real.sqrt (2 - 2 * Real.cos θ') |
| 114 | have hD : 0 ≤ D := Real.sqrt_nonneg _ |
| 115 | have hDsq : D ^ 2 = 2 - 2 * Real.cos θ' := |
| 116 | Real.sq_sqrt (by linarith [Real.cos_le_one θ']) |
| 117 | have htheta : Real.arccos ((1 ^ 2 + 1 ^ 2 - D ^ 2) / (2 * 1 * 1)) = θ' := by |
| 118 | rw [hDsq] |
| 119 | convert Real.arccos_cos (hθ.trans hθθ').le hθ'pi.le using 1 |
| 120 | congr 1 |
| 121 | ring |
| 122 | have hlimit := tendsto_comparisonAngle_mul_zero_right (d := D) zero_lt_one zero_lt_one |
| 123 | rw [htheta] at hlimit |
| 124 | simp only [mul_one] at hlimit |
| 125 | obtain ⟨R₀, hR₀, hsmall⟩ := mem_nhdsGT_iff_exists_Ioo_subset.mp |
| 126 | (hlimit.eventually_const_lt hθθ') |
| 127 | refine ⟨R₀, hR₀, ?_⟩ |
| 128 | intro R d hR hRR₀ hd hdR hangle |
| 129 | have hden : 0 < 2 * R ^ 2 := by positivity |
| 130 | have hratio_lower : -1 ≤ (2 * R ^ 2 - d ^ 2) / (2 * R ^ 2) := by |
| 131 | apply (le_div_iff₀ hden).mpr |
| 132 | nlinarith only [hd, hdR, hR] |
| 133 | have hratio_upper : (2 * R ^ 2 - d ^ 2) / (2 * R ^ 2) ≤ 1 := by |
| 134 | apply (div_le_iff₀ hden).mpr |
| 135 | nlinarith only [sq_nonneg d] |
| 136 | have hcos := Real.cos_le_cos_of_nonneg_of_le_pi (hθ.trans hθθ').le |
| 137 | (Real.arccos_le_pi _) hangle |
| 138 | rw [Real.cos_arccos hratio_lower hratio_upper] at hcos |
| 139 | have hsqbound := (div_le_iff₀ hden).mp hcos |
| 140 | have hchord : R * D ≤ d := by |
| 141 | have hscaled := congrArg (fun x : ℝ => R ^ 2 * x) hDsq |
| 142 | nlinarith only [hsqbound, hscaled, hd, mul_nonneg hR.le hD] |
| 143 | have hcosh : Real.cosh (R * D) ≤ Real.cosh d := by |
| 144 | apply Real.cosh_le_cosh.mpr |
| 145 | simpa only [abs_of_nonneg (mul_nonneg hR.le hD), abs_of_nonneg hd] using hchord |
| 146 | have hmono : comparisonAngle R R (R * D) ≤ comparisonAngle R R d := by |
| 147 | unfold comparisonAngle |
| 148 | apply Real.arccos_le_arccos |
| 149 | exact div_le_div_of_nonneg_right (sub_le_sub_left hcosh _) |
| 150 | (mul_nonneg (Real.sinh_pos_iff.mpr hR).le (Real.sinh_pos_iff.mpr hR).le) |
| 151 | exact (hsmall ⟨hR, hRR₀⟩).trans_le hmono |
| 152 | |
| 153 | end Poincare.Alexandrov |