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.Riemannian.Comparison.Laplacian.Branch.Complete |
| 2 | import PoincareLib.Geometry.Riemannian.Distance.SegmentSpeed |
| 3 | import Mathlib.Topology.MetricSpace.Sequences |
| 4 | |
| 5 | /-! |
| 6 | # Convergent initial directions of minimizing geodesics |
| 7 | |
| 8 | Completeness supplies minimizing geodesics to the escaping endpoints. The |
| 9 | intrinsic initial speed equals the endpoint distance, so normalization gives |
| 10 | actual unit tangent directions. Compactness of the metric unit sphere gives |
| 11 | a convergent subsequence. Both the derivative and endpoint identities are |
| 12 | retained for later application of the hinge comparison. |
| 13 | |
| 14 | Direct statement comparison: completeness and escape of the endpoints are |
| 15 | the inputs. Geodesics, unit directions, and their convergent subsequence |
| 16 | are constructed; no curvature or triangle comparison is assumed. |
| 17 | Source: Morgan--Tian, arXiv:math/0607607v2, Theorem 5.35, pp. 122--123; |
| 18 | Kleiner--Lott, Appendix G, p. 2852 (corrected 2013). |
| 19 | -/ |
| 20 | |
| 21 | set_option autoImplicit false |
| 22 | set_option backward.isDefEq.respectTransparency false |
| 23 | |
| 24 | open Set Filter |
| 25 | open scoped Manifold ContDiff Topology Bundle ENNReal |
| 26 | |
| 27 | namespace PoincareMT.RiemannianMetric |
| 28 | |
| 29 | /-- Escaping endpoints in a complete manifold admit minimizing geodesics |
| 30 | whose actual normalized initial tangents converge along a strict subsequence. -/ |
| 31 | theorem exists_convergent_initial_directions_of_metricComplete |
| 32 | {n : ℕ} {M : Type*} [TopologicalSpace M] [T3Space M] [PreconnectedSpace M] |
| 33 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 34 | (g : RiemannianMetric n M) (hc : MetricComplete g) (p : M) (q : ℕ → M) |
| 35 | (hescape : Tendsto (fun i => (g.edist p (q i)).toReal) atTop atTop) : |
| 36 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 37 | ⟨g.toRiemannianMetric⟩ |
| 38 | ∃ s : ℕ → ℕ, StrictMono s ∧ ∃ ε : ℕ → ℝ, ∃ γ : ℕ → ℝ → M, |
| 39 | ∃ v : ℕ → TangentSpace (𝓡 n) p, ∃ vlim : TangentSpace (𝓡 n) p, |
| 40 | (∀ i, 0 < ε i ∧ g.IsGeodesicOn (γ i) (Ioo (-ε i) (1 + ε i)) ∧ |
| 41 | γ i 0 = p ∧ γ i 1 = q (s i) ∧ |
| 42 | (∀ a ∈ Icc (0 : ℝ) 1, ∀ b ∈ Icc (0 : ℝ) 1, |
| 43 | g.edist (γ i a) (γ i b) = ENNReal.ofReal |a - b| * g.edist p (q (s i))) ∧ |
| 44 | HasDerivAt (fun t => extChartAt (𝓡 n) p (γ i t)) |
| 45 | ((g.edist p (q (s i))).toReal • v i) 0 ∧ |
| 46 | g.tangentNorm p (v i) = 1 ∧ 0 < (g.edist p (q (s i))).toReal) ∧ |
| 47 | Tendsto v atTop (𝓝 vlim) ∧ g.tangentNorm p vlim = 1 ∧ |
| 48 | Tendsto (fun i => (g.edist p (q (s i))).toReal) atTop atTop := by |
| 49 | classical |
| 50 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 51 | ⟨g.toRiemannianMetric⟩ |
| 52 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 53 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 54 | (TangentSpace (𝓡 n) : M → Type _) p |
| 55 | obtain ⟨N, hN⟩ := eventually_atTop.mp (hescape.eventually_gt_atTop 0) |
| 56 | let d : ℕ → ℝ := fun i => (g.edist p (q (N + i))).toReal |
| 57 | have hd (i : ℕ) : 0 < d i := hN (N + i) (Nat.le_add_right N i) |
| 58 | have hsegments (i : ℕ) : ∃ ε : ℝ, ∃ γ : ℝ → M, ∃ v : TangentSpace (𝓡 n) p, |
| 59 | 0 < ε ∧ g.IsGeodesicOn γ (Ioo (-ε) (1 + ε)) ∧ γ 0 = p ∧ γ 1 = q (N + i) ∧ |
| 60 | (∀ a ∈ Icc (0 : ℝ) 1, ∀ b ∈ Icc (0 : ℝ) 1, |
| 61 | g.edist (γ a) (γ b) = ENNReal.ofReal |a - b| * g.edist p (q (N + i))) ∧ |
| 62 | HasDerivAt (fun t => extChartAt (𝓡 n) p (γ t)) (d i • v) 0 ∧ |
| 63 | g.tangentNorm p v = 1 := by |
| 64 | obtain ⟨ε, hε, γ, hγ, hγ0, hγ1, hmin⟩ := |
| 65 | g.exists_minimizing_geodesic_of_metricComplete hc p (q (N + i)) |
| 66 | let w : TangentSpace (𝓡 n) p := deriv (fun t => extChartAt (𝓡 n) p (γ t)) 0 |
| 67 | have hw : HasDerivAt (fun t => extChartAt (𝓡 n) p (γ t)) w 0 := |
| 68 | (hγ.hasDerivAt_chart_at (show (0 : ℝ) ∈ Ioo (-ε) (1 + ε) by |
| 69 | constructor <;> linarith) p |
| 70 | (by simpa only [hγ0] using mem_extChartAt_source p)).1 |
| 71 | have hspeed : g.tangentNorm p w = d i := by |
| 72 | have h := congrArg ENNReal.toReal |
| 73 | (hγ.initial_tangentNorm_eq_of_edist_segment hε hγ0 hw hmin) |
| 74 | rw [ENNReal.toReal_ofReal (show 0 ≤ g.tangentNorm p w from Real.sqrt_nonneg _)] at h |
| 75 | exact h |
| 76 | let v : TangentSpace (𝓡 n) p := (d i)⁻¹ • w |
| 77 | have hnormalized : d i • v = w := by |
| 78 | simp only [v, smul_smul, mul_inv_cancel₀ (hd i).ne', one_smul] |
| 79 | have hnorm : g.tangentNorm p v = 1 := by |
| 80 | change ‖(d i)⁻¹ • w‖ = 1 |
| 81 | have hnormw : ‖w‖ = d i := hspeed |
| 82 | rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr (hd i)), |
| 83 | hnormw, inv_mul_cancel₀ (hd i).ne'] |
| 84 | exact ⟨ε, γ, v, hε, hγ, hγ0, hγ1, hmin, by rwa [hnormalized], hnorm⟩ |
| 85 | choose ε γ v hε hγ hγ0 hγ1 hmin hderiv hnorm using hsegments |
| 86 | obtain ⟨vlim, hvlim, σ, hσ, hvs⟩ := |
| 87 | (isCompact_sphere (0 : TangentSpace (𝓡 n) p) 1).tendsto_subseq |
| 88 | (show ∀ i, v i ∈ Metric.sphere (0 : TangentSpace (𝓡 n) p) 1 by |
| 89 | intro i |
| 90 | rw [Metric.mem_sphere, dist_zero_right] |
| 91 | exact hnorm i) |
| 92 | let s : ℕ → ℕ := fun i => N + σ i |
| 93 | have hs : StrictMono s := fun _ _ hij => Nat.add_lt_add_left (hσ hij) N |
| 94 | refine ⟨s, hs, ε ∘ σ, γ ∘ σ, v ∘ σ, vlim, ?_, hvs, ?_, ?_⟩ |
| 95 | · intro i |
| 96 | exact ⟨hε (σ i), hγ (σ i), hγ0 (σ i), hγ1 (σ i), hmin (σ i), |
| 97 | hderiv (σ i), hnorm (σ i), hd (σ i)⟩ |
| 98 | · change ‖vlim‖ = 1 |
| 99 | simpa using hvlim |
| 100 | · exact hescape.comp hs.tendsto_atTop |
| 101 | |
| 102 | end PoincareMT.RiemannianMetric |