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.RicciFlow.Harnack.Noncompact.CurvatureControl.Distance.LengthVariation |
| 2 | import PoincareLib.Geometry.Riemannian.Distance.CurveLength |
| 3 | |
| 4 | /-! # Right increments of a moving endpoint in backward-time metrics -/ |
| 5 | |
| 6 | set_option autoImplicit false |
| 7 | set_option backward.isDefEq.respectTransparency false |
| 8 | |
| 9 | open Set Filter MeasureTheory |
| 10 | open scoped Manifold ContDiff Bundle Topology |
| 11 | |
| 12 | universe u |
| 13 | |
| 14 | namespace PoincareMT.RicciFlow |
| 15 | |
| 16 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 17 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 18 | {J : Set ℝ} |
| 19 | |
| 20 | theorem exists_right_endpoint_distance_increment_bound |
| 21 | (F : RicciFlow n M J) {γ : ℝ → M} {I : Set ℝ} |
| 22 | (hI : IsOpen I) (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) ∞ γ I) |
| 23 | {t : ℝ} (hflow : -t ∈ interior J) (ht : t ∈ I) {ε : ℝ} (hε : 0 < ε) : |
| 24 | ∃ δ : ℝ, 0 < δ ∧ ∀ s ∈ Icc t (t + δ), |
| 25 | ((F.metric (-s)).edist (γ t) (γ s)).toReal ≤ |
| 26 | ((F.metric (-t)).tangentNorm (γ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ t 1) + ε) * |
| 27 | (s - t) := by |
| 28 | have hcont := F.continuousAt_curve_speed hI hγ hflow ht |
| 29 | obtain ⟨d, hd, hclose⟩ := Metric.continuousAt_iff.mp hcont ε hε |
| 30 | obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hI t ht |
| 31 | refine ⟨min d r / 2, by positivity, ?_⟩ |
| 32 | intro s hs |
| 33 | have hs0 : 0 ≤ s - t := sub_nonneg.mpr hs.1 |
| 34 | have hsd : s - t < d := by linarith [min_le_left d r, hs.2] |
| 35 | have hsr : s - t < r := by linarith [min_le_right d r, hs.2] |
| 36 | have hsub : Icc t s ⊆ I := by |
| 37 | intro u hu |
| 38 | apply hball |
| 39 | rw [Metric.mem_ball, Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hu.1)] |
| 40 | linarith [hu.2] |
| 41 | have hbound (u : ℝ) (hu : u ∈ Icc t s) : |
| 42 | (F.metric (-s)).tangentNorm (γ u) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ u 1) ≤ |
| 43 | (F.metric (-t)).tangentNorm (γ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ t 1) + ε := by |
| 44 | have hdu : dist (-s, u) (-t, t) < d := by |
| 45 | rw [Prod.dist_eq, max_lt_iff] |
| 46 | constructor |
| 47 | · simpa only [dist_neg_neg, Real.dist_eq, abs_of_nonneg hs0] using hsd |
| 48 | · rw [Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hu.1)] |
| 49 | linarith [hu.2] |
| 50 | have h := hclose hdu |
| 51 | rw [Real.dist_eq] at h |
| 52 | exact le_of_lt (by linarith [(abs_lt.mp h).2]) |
| 53 | apply ((F.metric (-s)).toReal_edist_le_integral_speed hs.1 hI hsub hγ).trans |
| 54 | calc |
| 55 | _ ≤ ∫ _u in t..s, |
| 56 | (F.metric (-t)).tangentNorm (γ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ t 1) + ε := |
| 57 | intervalIntegral.integral_mono_on hs.1 |
| 58 | (((F.metric (-s)).continuousOn_speed_of_contMDiffOn hI hγ).mono hsub |
| 59 | |>.intervalIntegrable_of_Icc hs.1) intervalIntegrable_const hbound |
| 60 | _ = _ := by rw [intervalIntegral.integral_const, smul_eq_mul, mul_comm] |
| 61 | |
| 62 | end PoincareMT.RicciFlow |