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.ReducedGeometry.ReducedLength.ODE.TimeDependentFlow |
| 2 | import Mathlib.Analysis.Calculus.FDeriv.CompCLM |
| 3 | |
| 4 | /-! |
| 5 | # A uniform local time radius for linear transport |
| 6 | |
| 7 | Scaling an arbitrary initial vector into the constructed local flow near |
| 8 | zero gives a lifespan independent of the size of that vector. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped ContDiff Topology |
| 14 | open Set Metric |
| 15 | |
| 16 | namespace PoincareMT.ReducedLength |
| 17 | |
| 18 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 19 | [FiniteDimensional ℝ E] |
| 20 | |
| 21 | theorem exists_uniform_local_linear_solution (U : Set ℝ) (hU : IsOpen U) |
| 22 | (A : ℝ → E →L[ℝ] E) (hA : ContDiffOn ℝ ∞ A U) (s0 : ℝ) (hs0 : s0 ∈ U) : |
| 23 | ∃ (W : Set ℝ) (d : ℝ), IsOpen W ∧ s0 ∈ W ∧ W ⊆ U ∧ 0 < d ∧ |
| 24 | ∀ t0 ∈ W, ∀ v : E, ∃ f : ℝ → E, |
| 25 | Set.Ioo (t0 - d) (t0 + d) ⊆ U ∧ f t0 = v ∧ |
| 26 | ContDiffOn ℝ ∞ f (Set.Ioo (t0 - d) (t0 + d)) ∧ |
| 27 | ∀ t ∈ Set.Ioo (t0 - d) (t0 + d), HasDerivAt f (A t (f t)) t := by |
| 28 | let S : Set (ℝ × E) := U ×ˢ Set.univ |
| 29 | let B : ℝ × E → E := fun z ↦ A z.1 z.2 |
| 30 | have hB : ContDiffOn ℝ ∞ B S := |
| 31 | (hA.comp contDiffOn_fst (fun z hz ↦ hz.1)).clm_apply contDiffOn_snd |
| 32 | obtain ⟨beta, V, d, hV, hstart, hVS, hd, hbeta, hinit, hode⟩ := |
| 33 | exists_local_smooth_timeDependent_flow S (hU.prod isOpen_univ) B hB (s0, 0) |
| 34 | ⟨hs0, Set.mem_univ _⟩ |
| 35 | obtain ⟨r, hr, hrV⟩ := Metric.isOpen_iff.mp hV (s0, 0) hstart |
| 36 | let W := Metric.ball s0 (r / 2) |
| 37 | have hzV (t0 : ℝ) (ht0 : t0 ∈ W) (w : E) (hw : ‖w‖ < r) : (t0, w) ∈ V := by |
| 38 | apply hrV |
| 39 | change dist (t0, w) (s0, (0 : E)) < r |
| 40 | rw [Prod.dist_eq, dist_zero_right] |
| 41 | have ht : dist t0 s0 < r / 2 := ht0 |
| 42 | exact max_lt (by linarith) hw |
| 43 | refine ⟨W, d, isOpen_ball, mem_ball_self (by positivity), ?_, hd, ?_⟩ |
| 44 | · intro t0 ht0 |
| 45 | exact (hVS (hzV t0 ht0 0 (by simpa only [norm_zero] using hr))).1 |
| 46 | · intro t0 ht0 v |
| 47 | let c := (r / 2) / (‖v‖ + 1) |
| 48 | have hden : 0 < ‖v‖ + 1 := by positivity |
| 49 | have hc : 0 < c := by dsimp [c]; positivity |
| 50 | have hcmul : c * (‖v‖ + 1) = r / 2 := div_mul_cancel₀ _ hden.ne' |
| 51 | have hsmall : ‖c • v‖ < r := by |
| 52 | rw [norm_smul, Real.norm_eq_abs, abs_of_pos hc] |
| 53 | nlinarith |
| 54 | have hstartV := hzV t0 ht0 (c • v) hsmall |
| 55 | let f : ℝ → E := fun t ↦ c⁻¹ • beta ((t0, c • v), t - t0) |
| 56 | have hshift (t : ℝ) (ht : t ∈ Set.Ioo (t0 - d) (t0 + d)) : |
| 57 | t - t0 ∈ Set.Ioo (-d) d := by constructor <;> linarith [ht.1, ht.2] |
| 58 | have htime : ∀ t ∈ Set.Ioo (t0 - d) (t0 + d), t ∈ U := by |
| 59 | intro t ht |
| 60 | have h := (hode (t0, c • v) hstartV (t - t0) (hshift t ht)).1.1 |
| 61 | simpa only [add_sub_cancel] using h |
| 62 | have hmap : Set.MapsTo (fun t : ℝ ↦ ((t0, c • v), t - t0)) |
| 63 | (Set.Ioo (t0 - d) (t0 + d)) (V ×ˢ Set.Ioo (-d) d) := |
| 64 | fun t ht ↦ ⟨hstartV, hshift t ht⟩ |
| 65 | have hcomp : ContDiffOn ℝ ∞ (fun t : ℝ ↦ beta ((t0, c • v), t - t0)) |
| 66 | (Set.Ioo (t0 - d) (t0 + d)) := |
| 67 | hbeta.comp (contDiff_const.prodMk (contDiff_id.sub contDiff_const)).contDiffOn hmap |
| 68 | refine ⟨f, htime, ?_, contDiffOn_const.smul hcomp, ?_⟩ |
| 69 | · dsimp only [f] |
| 70 | rw [sub_self, hinit (t0, c • v) hstartV, smul_smul, inv_mul_cancel₀ hc.ne', one_smul] |
| 71 | · intro t ht |
| 72 | have h := (hode (t0, c • v) hstartV (t - t0) (hshift t ht)).2 |
| 73 | have h' := (h.scomp t ((hasDerivAt_id t).sub_const t0)).const_smul c⁻¹ |
| 74 | simpa only [Function.comp_def, id_eq, one_smul, B, add_sub_cancel, f, |
| 75 | map_smul, Pi.smul_def] using h' |
| 76 | |
| 77 | end PoincareMT.ReducedLength |