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.Geometry.Euclidean.Angle.Unoriented.Basic |
| 2 | import Mathlib.Analysis.Normed.Module.FiniteDimension |
| 3 | import Mathlib.Topology.MetricSpace.Pseudo.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Finite packing by angles on a Euclidean unit sphere |
| 7 | |
| 8 | A positive lower bound on the pairwise angles of unit vectors gives a |
| 9 | positive lower bound on their distances. A finite cover of the compact |
| 10 | unit sphere then bounds the cardinality of any such family. |
| 11 | -/ |
| 12 | |
| 13 | noncomputable section |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set InnerProductGeometry |
| 17 | |
| 18 | universe u v |
| 19 | |
| 20 | namespace Poincare.Euclidean |
| 21 | |
| 22 | theorem exists_card_le_of_unit_angle_separated |
| 23 | (V : Type u) [NormedAddCommGroup V] [InnerProductSpace ℝ V] |
| 24 | [FiniteDimensional ℝ V] {α : ℝ} (hα : 0 < α) : |
| 25 | ∃ N : ℕ, ∀ {ι : Type v} [Fintype ι] (v : ι → V), |
| 26 | (∀ i, ‖v i‖ = 1) → |
| 27 | (∀ i j, i ≠ j → α ≤ angle (v i) (v j)) → Fintype.card ι ≤ N := by |
| 28 | classical |
| 29 | let β := min α Real.pi |
| 30 | have hβ : 0 < β := lt_min hα Real.pi_pos |
| 31 | have hβπ : β ≤ Real.pi := min_le_right _ _ |
| 32 | have hcos : Real.cos β < 1 := by |
| 33 | simpa using Real.cos_lt_cos_of_nonneg_of_le_pi (show (0 : ℝ) ≤ 0 by rfl) hβπ hβ |
| 34 | let δ := Real.sqrt (2 - 2 * Real.cos β) |
| 35 | have hδ : 0 < δ := Real.sqrt_pos.2 (by linarith) |
| 36 | have hδsq : δ ^ 2 = 2 - 2 * Real.cos β := Real.sq_sqrt (by linarith) |
| 37 | have hsep {x y : V} (hx : ‖x‖ = 1) (hy : ‖y‖ = 1) |
| 38 | (hxy : α ≤ angle x y) : δ ≤ dist x y := by |
| 39 | have hc : Real.cos (angle x y) ≤ Real.cos β := |
| 40 | Real.cos_le_cos_of_nonneg_of_le_pi hβ.le (angle_le_pi _ _) |
| 41 | ((min_le_left _ _).trans hxy) |
| 42 | have hd := norm_sub_pow_two_real x y |
| 43 | rw [hx, hy, inner_eq_cos_angle_of_norm_eq_one hx hy] at hd |
| 44 | rw [dist_eq_norm] |
| 45 | nlinarith [norm_nonneg (x - y)] |
| 46 | obtain ⟨s, hs, hcover⟩ := Metric.totallyBounded_iff.mp |
| 47 | (isCompact_sphere (0 : V) 1).totallyBounded (δ / 2) (by positivity) |
| 48 | let := hs.fintype |
| 49 | refine ⟨Fintype.card s, ?_⟩ |
| 50 | intro ι _ v hv hangle |
| 51 | have hchoice (i : ι) : ∃ z : s, dist (v i) z < δ / 2 := by |
| 52 | have hi : v i ∈ Metric.sphere (0 : V) 1 := by |
| 53 | simpa only [Metric.mem_sphere, dist_zero_right] using hv i |
| 54 | obtain ⟨z, hz, hiz⟩ := Set.mem_iUnion₂.mp (hcover hi) |
| 55 | exact ⟨⟨z, hz⟩, hiz⟩ |
| 56 | choose z hz using hchoice |
| 57 | apply Fintype.card_le_of_injective z |
| 58 | intro i j hij |
| 59 | by_contra hne |
| 60 | have hlower := hsep (hv i) (hv j) (hangle i j hne) |
| 61 | have hupper := dist_triangle (v i) (z i : V) (v j) |
| 62 | have hj := hz j |
| 63 | rw [← hij, dist_comm] at hj |
| 64 | linarith [hz i] |
| 65 | |
| 66 | end Poincare.Euclidean |