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.Singular.RegularLimit.Metric.EndpointEquation |
| 2 | |
| 3 | /-! |
| 4 | # The fixed-carrier regular Ricci flow through the terminal time |
| 5 | |
| 6 | The metric is the original restricted metric at every old time and the |
| 7 | constructed terminal metric at the endpoint. The connection is constructed |
| 8 | from that metric, and the evolution equation includes the endpoint. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | set_option synthInstance.maxHeartbeats 100000 |
| 14 | set_option maxSynthPendingDepth 8 |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | noncomputable section |
| 22 | |
| 23 | namespace PoincareMT.SingularTimeAssumptions |
| 24 | |
| 25 | variable {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 27 | [IsManifold (𝓡 3) ∞ M] [MeasurableSpace M] [BorelSpace M] |
| 28 | [T2Space M] [T3Space M] [SecondCountableTopology M] |
| 29 | {F : GeneralizedRicciFlowData.{u}} {T : ℝ} |
| 30 | |
| 31 | theorem terminalMetricFamily_ricci_of_ne |
| 32 | (H : SingularTimeAssumptions F T M) (P04 : RicciFlowCurvatureTheory.{u}) |
| 33 | {t : ℝ} (ht : t ≠ T) (x : H.regularRegion P04) |
| 34 | (v w : TangentSpace (𝓡 3) x) : |
| 35 | (H.terminalMetricFamily P04 t).leviCivitaData.ricci x v w = |
| 36 | (H.reference.flow.connection t).ricci (x : M) v w := by |
| 37 | have h := (H.terminalMetricFamily P04 t).leviCivitaData.ricci_eq_of_local_isometry |
| 38 | (H.reference.flow.connection t) (f := Subtype.val) isOpen_univ |
| 39 | ((Poincare.isLocalDiffeomorph_opensSubtypeVal (𝓡 3) (H.regularRegion P04)).contMDiff.contMDiffOn) |
| 40 | (fun y _ a b => by |
| 41 | rw [Poincare.Geometry.Manifold.RegularLevel.mfderiv_opens_subtypeVal] |
| 42 | exact H.terminalMetricFamily_inner_of_ne P04 ht y a b) |
| 43 | (mem_univ x) v w |
| 44 | simp only [Poincare.Geometry.Manifold.RegularLevel.mfderiv_opens_subtypeVal] at h |
| 45 | exact h |
| 46 | |
| 47 | /-- The actual Ricci flow on the possibly empty regular region, with its |
| 48 | terminal metric and one-sided endpoint equation. -/ |
| 49 | def terminalFlow (H : SingularTimeAssumptions F T M) |
| 50 | (P04 : RicciFlowCurvatureTheory.{u}) : |
| 51 | RicciFlow 3 (H.regularRegion P04) (Ioc H.reference.tMinus T) where |
| 52 | metric := H.terminalMetricFamily P04 |
| 53 | connection t := (H.terminalMetricFamily P04 t).leviCivitaData |
| 54 | interval := ordConnected_Ioc |
| 55 | nontrivial := ⟨(2 * H.reference.tMinus + T) / 3, |
| 56 | ⟨by linarith [H.reference.tMinus_lt], by linarith [H.reference.tMinus_lt]⟩, |
| 57 | T, ⟨H.reference.tMinus_lt, le_rfl⟩, by linarith [H.reference.tMinus_lt]⟩ |
| 58 | smooth := H.terminalMetricFamily_isSmoothFamilyOn P04 |
| 59 | equation t ht x v w := by |
| 60 | by_cases h : t = T |
| 61 | · subst t |
| 62 | have hRicci : (H.terminalMetricFamily P04 T).leviCivitaData.ricci x v w = |
| 63 | (H.terminalConnection P04).ricci x v w := |
| 64 | congrArg (fun g : RiemannianMetric 3 (H.regularRegion P04) => |
| 65 | g.leviCivitaData.ricci x v w) (H.terminalMetricFamily_at_terminal P04) |
| 66 | rw [hRicci] |
| 67 | exact H.terminalMetricFamily_endpoint_equation P04 x v w |
| 68 | · rw [H.terminalMetricFamily_ricci_of_ne P04 h] |
| 69 | exact (H.terminalMetricFamily_hasDerivAt_of_lt P04 |
| 70 | ⟨ht.1, lt_of_le_of_ne ht.2 h⟩ x v w).hasDerivWithinAt |
| 71 | |
| 72 | theorem terminalFlow_metric_at_terminal |
| 73 | (H : SingularTimeAssumptions F T M) (P04 : RicciFlowCurvatureTheory.{u}) : |
| 74 | (H.terminalFlow P04).metric T = H.terminalMetric P04 := |
| 75 | H.terminalMetricFamily_at_terminal P04 |
| 76 | |
| 77 | theorem terminalFlow_metric_of_lt |
| 78 | (H : SingularTimeAssumptions F T M) (P04 : RicciFlowCurvatureTheory.{u}) |
| 79 | {t : ℝ} (ht : t < T) : |
| 80 | (H.terminalFlow P04).metric t = |
| 81 | (H.reference.flow.restrictToOpen (H.regularRegion P04)).metric t := |
| 82 | H.terminalMetricFamily_of_ne P04 (ne_of_lt ht) |
| 83 | |
| 84 | end PoincareMT.SingularTimeAssumptions |