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.Riemannian.HyperbolicHinge |
| 2 | import PoincareLib.Geometry.Alexandrov.Riemannian.MinimizingSegments |
| 3 | import PoincareLib.Geometry.Alexandrov.TangentComparison |
| 4 | import PoincareLib.Geometry.Euclidean.Angle.Packing |
| 5 | |
| 6 | /-! |
| 7 | # Dimension-dependent packing of hyperbolic comparison angles |
| 8 | |
| 9 | Choose minimizing segments from the common vertex. Hyperbolic hinge |
| 10 | comparison bounds the comparison angles by the angles of their initial |
| 11 | unit tangents. An orthonormal basis transports these vectors to the fixed |
| 12 | Euclidean unit sphere, whose angular packing bound depends only on the |
| 13 | dimension and prescribed positive separation. |
| 14 | |
| 15 | This retains the finite directional packing used by Burago--Gromov--Perelman |
| 16 | (1992), Sections 7.3--7.5, pp. 23--24, directly from the smooth approximants. |
| 17 | -/ |
| 18 | |
| 19 | noncomputable section |
| 20 | set_option autoImplicit false |
| 21 | set_option backward.isDefEq.respectTransparency false |
| 22 | |
| 23 | open Set |
| 24 | open scoped Manifold ContDiff Bundle |
| 25 | open Poincare.Alexandrov |
| 26 | |
| 27 | universe u v |
| 28 | |
| 29 | namespace PoincareMT.RiemannianMetric |
| 30 | |
| 31 | theorem exists_comparisonAngle_packing_bound |
| 32 | (n : ℕ) {α : ℝ} (hα : 0 < α) : |
| 33 | ∃ N : ℕ, |
| 34 | ∀ {M : Type u} [TopologicalSpace M] [T3Space M] [PreconnectedSpace M] |
| 35 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 36 | [IsManifold (𝓡 n) ∞ M], |
| 37 | ∀ (g : RiemannianMetric n M) (D : LeviCivitaData g), |
| 38 | MetricComplete g → |
| 39 | (∀ x (v w : TangentSpace (𝓡 n) x), -1 ≤ D.sectionalCurvature x v w) → |
| 40 | ∀ (p : M) {ι : Type v} [Fintype ι] (q : ι → M), |
| 41 | (∀ i, q i ≠ p) → |
| 42 | (∀ i j, i ≠ j → |
| 43 | α ≤ Poincare.Alexandrov.comparisonAngle |
| 44 | (g.edist p (q i)).toReal (g.edist p (q j)).toReal |
| 45 | (g.edist (q i) (q j)).toReal) → |
| 46 | Fintype.card ι ≤ N := by |
| 47 | classical |
| 48 | obtain ⟨N, hN⟩ := Poincare.Euclidean.exists_card_le_of_unit_angle_separated |
| 49 | (EuclideanSpace ℝ (Fin n)) hα |
| 50 | refine ⟨N, ?_⟩ |
| 51 | intro M _ _ _ _ _ g D hcomplete hsec p ι _ q hq hsep |
| 52 | let : MetricSpace M := g.toMetricSpace |
| 53 | let : Nonempty M := ⟨p⟩ |
| 54 | let : ConnectedSpace M := ⟨inferInstance⟩ |
| 55 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 56 | ⟨g.toRiemannianMetric⟩ |
| 57 | let r : ι → ℝ := fun i => (g.edist p (q i)).toReal |
| 58 | have hr (i : ι) : 0 < r i := by |
| 59 | change 0 < dist p (q i) |
| 60 | exact dist_pos.mpr (hq i).symm |
| 61 | choose γ hγ0 hγend hγgeo hγspeed hγmin using fun i => |
| 62 | g.exists_unit_speed_minimizing_geodesic_of_metricComplete hcomplete p (q i) (hr i) |
| 63 | let T : ι → TangentSpace (𝓡 n) p := |
| 64 | fun i => mfderiv 𝓘(ℝ, ℝ) (𝓡 n) (γ i) 0 1 |
| 65 | have hT (i : ι) : ‖T i‖ = 1 := by |
| 66 | change g.tangentNorm p (T i) = 1 |
| 67 | have heq := congrArg (fun x : M => g.tangentNorm x |
| 68 | (show EuclideanSpace ℝ (Fin n) from T i)) (hγ0 i) |
| 69 | exact heq.symm.trans (hγspeed i 0 ⟨le_rfl, (hr i).le⟩) |
| 70 | have hangle (i j : ι) : |
| 71 | comparisonAngle (r i) (r j) (dist (q i) (q j)) ≤ |
| 72 | InnerProductGeometry.angle (T i) (T j) := by |
| 73 | apply comparisonAngle_le_angle_of_cosh_le (hr i) (hr j) (hT i) (hT j) |
| 74 | have h := Alexandrov.hyperbolic_hinge g D hcomplete hsec (hr i) (hr j) |
| 75 | (hγgeo i) (hγgeo j) (hγ0 i) (hγ0 j) (hγspeed j) (hγmin i) (hγmin j) |
| 76 | rw [show γ i (r i) = q i from hγend i, |
| 77 | show γ j (r j) = q j from hγend j] at h |
| 78 | exact h |
| 79 | have hdim : Module.finrank ℝ (TangentSpace (𝓡 n) p) = n := by |
| 80 | change Module.finrank ℝ (EuclideanSpace ℝ (Fin n)) = n |
| 81 | simp |
| 82 | let b := (g.orthonormalBasis p).reindex (finCongr hdim) |
| 83 | apply hN (fun i => b.repr (T i)) |
| 84 | · intro i |
| 85 | exact (b.repr.norm_map (T i)).trans (hT i) |
| 86 | · intro i j hij |
| 87 | change α ≤ InnerProductGeometry.angle |
| 88 | (b.repr.toLinearIsometry (T i)) (b.repr.toLinearIsometry (T j)) |
| 89 | rw [b.repr.toLinearIsometry.angle_map] |
| 90 | exact (hsep i j hij).trans (hangle i j) |
| 91 | |
| 92 | end PoincareMT.RiemannianMetric |