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.Surgery.CanonicalInduction.Terminal.Germs.TerminalGermsMetricRegularity |
| 2 | import PoincareLib.Geometry.RicciFlow.Limit.TimeDerivative |
| 3 | import Mathlib.Analysis.Calculus.ContDiff.Deriv |
| 4 | import Mathlib.Analysis.Calculus.TangentCone.Real |
| 5 | |
| 6 | /-! |
| 7 | # The actual interior Ricci equation determines included endpoints |
| 8 | |
| 9 | Both the metric velocity and the spatially defined Ricci tensor are |
| 10 | continuous within the closed domain. The interior equation therefore |
| 11 | determines the actual one-sided equation at every included endpoint. |
| 12 | Source: MT Proposition 5.14, pp. 90-91; |
| 13 | derivations/terminal-germs-closed-jets.md, Stage A5f. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set Filter |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | namespace PoincareMT.M47 |
| 22 | |
| 23 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {J : Set ℝ} (g : ℝ → RiemannianMetric n M) (D : ∀ t, LeviCivitaData (g t)) |
| 26 | (hg : RiemannianMetric.IsSmoothFamilyOn g J) |
| 27 | (hinterval : J.OrdConnected) (hnontrivial : J.Nontrivial) |
| 28 | (hequation : ∀ t ∈ interior J, ∀ (x : M) (v w : TangentSpace (𝓡 n) x), |
| 29 | HasDerivAt (fun s => (g s).inner x v w) (-2 * (D t).ricci x v w) t) |
| 30 | |
| 31 | include hg hinterval hnontrivial hequation |
| 32 | |
| 33 | /-- The equation extends from the actual interior by metric-derived |
| 34 | Ricci continuity, without endpoint source-jet convergence. -/ |
| 35 | theorem terminalGerms_equation_of_interior : |
| 36 | ∀ t ∈ J, ∀ (x : M) (v w : TangentSpace (𝓡 n) x), |
| 37 | HasDerivWithinAt (fun s => (g s).inner x v w) (-2 * (D t).ricci x v w) J t := by |
| 38 | have hconvex : Convex ℝ J := hinterval.convex |
| 39 | have hne : (interior J).Nonempty := |
| 40 | hconvex.nontrivial_iff_nonempty_interior.mp hnontrivial |
| 41 | have hJ : UniqueDiffOn ℝ J := uniqueDiffOn_convex hconvex hne |
| 42 | have hdense : J ⊆ closure (interior J) := by |
| 43 | rw [hconvex.closure_interior_eq_closure_of_nonempty_interior hne] |
| 44 | exact subset_closure |
| 45 | intro t ht x v w |
| 46 | have hm : ContDiffOn ℝ ∞ (fun s => (g s).inner x v w) J := |
| 47 | fun s hs => hg.contDiffWithinAt_inner_time hs x v w |
| 48 | have hinside : EqOn (derivWithin (fun s => (g s).inner x v w) J) |
| 49 | (fun s => -2 * (D s).ricci x v w) (interior J) := by |
| 50 | intro s hs |
| 51 | exact (hequation s hs x v w).hasDerivWithinAt.derivWithin (hJ s (interior_subset hs)) |
| 52 | have heq := hinside.of_subset_closure |
| 53 | (hm.continuousOn_derivWithin hJ (by simp)) |
| 54 | (continuousOn_const.mul (terminalGerms_continuousOn_ricci hg D x v w)) |
| 55 | interior_subset hdense |
| 56 | exact ((hm t ht).differentiableWithinAt (by simp)).hasDerivWithinAt.congr_deriv (heq ht) |
| 57 | |
| 58 | /-- The closed smooth positive metric family and its actual interior |
| 59 | equation construct a Ricci flow on the literal included interval. -/ |
| 60 | theorem terminalGerms_exists_flow_of_interior : |
| 61 | ∃ F : RicciFlow n M J, F.metric = g := by |
| 62 | exact ⟨{ |
| 63 | metric := g |
| 64 | connection := D |
| 65 | interval := hinterval |
| 66 | nontrivial := hnontrivial |
| 67 | smooth := hg |
| 68 | equation := terminalGerms_equation_of_interior g D hg hinterval hnontrivial hequation }, rfl⟩ |
| 69 | |
| 70 | end PoincareMT.M47 |