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.Basic |
| 2 | import Mathlib.Analysis.Calculus.TangentCone.Real |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 4 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 5 | |
| 6 | /-! Adapted from Mapher06/Poincare-MorganTian, `PoincareMT/Proofs/M04/RicciEvolutionEndpoints.lean`, |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. See the curvature import record under |
| 8 | `references/ricci-flow/mapher/curvature/`. -/ |
| 9 | |
| 10 | /-! |
| 11 | # Fixed-vector Ricci time regularity and included endpoints |
| 12 | |
| 13 | The actual metric equation gives smooth Ricci pairings on the entire |
| 14 | flow interval. Continuous interior velocities then extend to its endpoints. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle |
| 20 | open Set Topology Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.RicciFlowAnalysis |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 28 | {J : Set ℝ} |
| 29 | |
| 30 | set_option maxHeartbeats 800000 in |
| 31 | -- The fixed-fiber conversion of spacetime metric smoothness needs extra elaboration. |
| 32 | set_option backward.isDefEq.respectTransparency false in |
| 33 | private theorem contDiffOn_metric_pairing_timeSlice (F : RicciFlow n M J) |
| 34 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 35 | ContDiffOn ℝ ∞ (fun t ↦ (F.metric t).inner x u v) J := by |
| 36 | let E := EuclideanSpace ℝ (Fin n) |
| 37 | have hslice : ContMDiff 𝓘(ℝ, ℝ) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 38 | (fun t : ℝ ↦ (t, x)) := contMDiff_id.prodMk contMDiff_const |
| 39 | have hfamily := F.smooth.comp hslice.contMDiffOn |
| 40 | (show MapsTo (fun t : ℝ ↦ (t, x)) J (J ×ˢ univ) from |
| 41 | fun _ ht ↦ ⟨ht, mem_univ x⟩) |
| 42 | have hm : ContMDiffOn 𝓘(ℝ, ℝ) 𝓘(ℝ, ℝ) ∞ |
| 43 | (fun t ↦ (F.metric t).inner x u v) J := by |
| 44 | intro t ht |
| 45 | have he : ContMDiffWithinAt 𝓘(ℝ, ℝ) ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ |
| 46 | (fun s ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) |
| 47 | x ((F.metric s).inner x u v)) J t := |
| 48 | (hfamily t ht).clm_bundle_apply₂ |
| 49 | (contMDiffWithinAt_const (c := Bundle.TotalSpace.mk' E x u)) |
| 50 | (contMDiffWithinAt_const (c := Bundle.TotalSpace.mk' E x v)) |
| 51 | simp only [Bundle.contMDiffWithinAt_totalSpace] at he |
| 52 | exact he.2 |
| 53 | exact hm.contDiffOn |
| 54 | |
| 55 | set_option maxHeartbeats 800000 in |
| 56 | -- The spacetime-to-time-slice bundle conversion needs extra elaboration. |
| 57 | set_option backward.isDefEq.respectTransparency false in |
| 58 | theorem contDiffOn_ricci_timeSlice (F : RicciFlow n M J) |
| 59 | (x : M) (u v : TangentSpace (𝓡 n) x) : |
| 60 | ContDiffOn ℝ ∞ (fun t ↦ (F.connection t).ricci x u v) J := by |
| 61 | have hJ : UniqueDiffOn ℝ J := uniqueDiffOn_convex F.interval.convex |
| 62 | (F.interval.convex.nontrivial_iff_nonempty_interior.mp F.nontrivial) |
| 63 | have hm := contDiffOn_metric_pairing_timeSlice F x u v |
| 64 | have hd : ContDiffOn ℝ ∞ |
| 65 | (derivWithin (fun t ↦ (F.metric t).inner x u v) J) J := |
| 66 | hm.derivWithin hJ (by simp) |
| 67 | have hs : ContDiffOn ℝ ∞ |
| 68 | (fun t ↦ (-1 / 2 : ℝ) * derivWithin (fun s ↦ (F.metric s).inner x u v) J t) J := |
| 69 | contDiffOn_const.mul hd |
| 70 | apply hs.congr |
| 71 | intro t ht |
| 72 | have he := (F.equation t ht x u v).derivWithin (hJ t ht) |
| 73 | linarith |
| 74 | |
| 75 | theorem ricci_timeDerivative_extend (F : RicciFlow n M J) |
| 76 | (x : M) (u v : TangentSpace (𝓡 n) x) (w : ℝ → ℝ) |
| 77 | (hw : ContinuousOn w J) |
| 78 | (hi : ∀ t ∈ interior J, |
| 79 | HasDerivAt (fun s ↦ (F.connection s).ricci x u v) (w t) t) : |
| 80 | ∀ t ∈ J, HasDerivWithinAt (fun s ↦ (F.connection s).ricci x u v) (w t) J t := by |
| 81 | let f := fun t ↦ (F.connection t).ricci x u v |
| 82 | have hf : ContDiffOn ℝ ∞ f J := contDiffOn_ricci_timeSlice F x u v |
| 83 | have hconv : Convex ℝ J := F.interval.convex |
| 84 | have hne : (interior J).Nonempty := hconv.nontrivial_iff_nonempty_interior.mp F.nontrivial |
| 85 | have hJ : UniqueDiffOn ℝ J := uniqueDiffOn_convex hconv hne |
| 86 | have hdense : J ⊆ closure (interior J) := by |
| 87 | rw [hconv.closure_interior_eq_closure_of_nonempty_interior hne] |
| 88 | exact subset_closure |
| 89 | have hinside : EqOn (derivWithin f J) w (interior J) := by |
| 90 | intro t ht |
| 91 | exact (hi t ht).hasDerivWithinAt.derivWithin (hJ t (interior_subset ht)) |
| 92 | have heq : EqOn (derivWithin f J) w J := hinside.of_subset_closure |
| 93 | (hf.continuousOn_derivWithin hJ (by simp)) hw interior_subset hdense |
| 94 | intro t ht |
| 95 | exact ((hf t ht).differentiableWithinAt (by simp)).hasDerivWithinAt.congr_deriv (heq ht) |
| 96 | |
| 97 | end PoincareMT.RicciFlowAnalysis |
| 98 |