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.MovingEndpoints.Increment |
| 2 | import PoincareLib.Geometry.Riemannian.Compactness.IntrinsicMetric |
| 3 | import Mathlib.Analysis.Calculus.MeanValue |
| 4 | |
| 5 | /-! # Moving-endpoint distance slopes from a fixed-endpoint upper support -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set Filter MeasureTheory |
| 11 | open scoped Manifold ContDiff Bundle Topology |
| 12 | |
| 13 | universe u |
| 14 | |
| 15 | namespace PoincareMT.RicciFlow |
| 16 | |
| 17 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] [T3Space M] [PreconnectedSpace M] |
| 18 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 19 | {J : Set ℝ} |
| 20 | |
| 21 | theorem eventually_moving_distance_slope_lt |
| 22 | (F : RicciFlow n M J) {γ η : ℝ → M} {I : Set ℝ} |
| 23 | (hI : IsOpen I) (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) ∞ γ I) |
| 24 | (hη : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 n) ∞ η I) |
| 25 | {t : ℝ} (hflow : -t ∈ interior J) (ht : t ∈ I) |
| 26 | {u : ℝ → ℝ} {d r : ℝ} |
| 27 | (hu : u t = ((F.metric (-t)).edist (γ t) (η t)).toReal) |
| 28 | (hupper : ∀ s, ((F.metric (-s)).edist (γ t) (η t)).toReal ≤ u s) |
| 29 | (hd : HasDerivAt u d t) |
| 30 | (hr : d + (F.metric (-t)).tangentNorm (γ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ t 1) + |
| 31 | (F.metric (-t)).tangentNorm (η t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) η t 1) < r) : |
| 32 | ∀ᶠ s in 𝓝[>] t, |
| 33 | slope (fun s => ((F.metric (-s)).edist (γ s) (η s)).toReal) t s < r := by |
| 34 | let a := (F.metric (-t)).tangentNorm (γ t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) γ t 1) |
| 35 | let b := (F.metric (-t)).tangentNorm (η t) (mfderiv 𝓘(ℝ, ℝ) (𝓡 n) η t 1) |
| 36 | let ε := (r - (d + a + b)) / 4 |
| 37 | have hε : 0 < ε := by dsimp [ε, a, b]; linarith |
| 38 | obtain ⟨δγ, hδγ, hincγ⟩ := F.exists_right_endpoint_distance_increment_bound hI hγ hflow ht hε |
| 39 | obtain ⟨δη, hδη, hincη⟩ := F.exists_right_endpoint_distance_increment_bound hI hη hflow ht hε |
| 40 | have hslope : ∀ᶠ s in 𝓝[>] t, slope u t s < d + ε := by |
| 41 | have hle : 𝓝[>] t ≤ 𝓝[≠] t := nhdsWithin_mono t (fun s hs => by |
| 42 | simpa only [mem_compl_iff, mem_singleton_iff] using ne_of_gt hs) |
| 43 | exact (hd.tendsto_slope.mono_left hle).eventually (Iio_mem_nhds (by linarith)) |
| 44 | filter_upwards [hslope, Ioo_mem_nhdsGT (show t < t + δγ by linarith), |
| 45 | Ioo_mem_nhdsGT (show t < t + δη by linarith)] with s hsu hsγ hsη |
| 46 | have hs : 0 < s - t := sub_pos.mpr hsγ.1 |
| 47 | have hγdist := hincγ s ⟨hsγ.1.le, hsγ.2.le⟩ |
| 48 | have hηdist := hincη s ⟨hsη.1.le, hsη.2.le⟩ |
| 49 | have htri : ((F.metric (-s)).edist (γ s) (η s)).toReal ≤ |
| 50 | ((F.metric (-s)).edist (γ t) (γ s)).toReal + u s + |
| 51 | ((F.metric (-s)).edist (η t) (η s)).toReal := by |
| 52 | let := (F.metric (-s)).toMetricSpace |
| 53 | change dist (γ s) (η s) ≤ dist (γ t) (γ s) + u s + dist (η t) (η s) |
| 54 | have h₁ := dist_triangle (γ s) (γ t) (η s) |
| 55 | have h₂ := dist_triangle (γ t) (η t) (η s) |
| 56 | have h₃ := hupper s |
| 57 | change dist (γ t) (η t) ≤ u s at h₃ |
| 58 | rw [dist_comm (γ s) (γ t)] at h₁ |
| 59 | linarith |
| 60 | rw [slope_def_field, ← hu] |
| 61 | apply (div_lt_iff₀ hs).mpr |
| 62 | rw [slope_def_field] at hsu |
| 63 | have hsu' := (div_lt_iff₀ hs).mp hsu |
| 64 | change _ ≤ (a + ε) * (s - t) at hγdist |
| 65 | change _ ≤ (b + ε) * (s - t) at hηdist |
| 66 | have hgap : d + a + b + 3 * ε < r := by dsimp [ε]; linarith |
| 67 | have hgap' := mul_lt_mul_of_pos_right hgap hs |
| 68 | nlinarith |
| 69 | |
| 70 | end PoincareMT.RicciFlow |