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.Flow.Basic |
| 2 | import PoincareLib.Geometry.Riemannian.Metric.LocalDiffeomorph |
| 3 | |
| 4 | /-! |
| 5 | # The positive metric underlying a full surgery limit |
| 6 | |
| 7 | Pull back the terminal metric by the actual diffeomorphism. The two |
| 8 | coefficient functions agree on the open extended-chart target, which is |
| 9 | enough for equality of every jet at its points. No equality outside that |
| 10 | chart domain is asserted. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M51 |
| 21 | |
| 22 | variable {A B : GeneralizedSliceCarrier.{u}} |
| 23 | |
| 24 | /-- The actual pullback metric has the terminal limit's coordinate coefficients. -/ |
| 25 | theorem singularMetricCoefficient_pullback |
| 26 | (gT : RiemannianMetric 3 B.carrier) |
| 27 | (f : Diffeomorph (𝓡 3) (𝓡 3) A.carrier B.carrier ∞) |
| 28 | (q : A.carrier) (a b : Fin 3) |
| 29 | {p : EuclideanSpace ℝ (Fin 3)} (hp : p ∈ (extChartAt (𝓡 3) q).target) : |
| 30 | singularMetricCoefficient (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) |
| 31 | q a b p = |
| 32 | surgeryMetricCoefficient gT (fun z => f ((extChartAt (𝓡 3) q).symm z)) a b p := by |
| 33 | have hc := (contMDiffOn_extChartAt_symm (I := 𝓡 3) (n := ∞) q).contMDiffAt |
| 34 | ((isOpen_extChartAt_target (I := 𝓡 3) q).mem_nhds hp) |
| 35 | have hcomp := mfderiv_comp p (f.mdifferentiable (by simp) _) |
| 36 | (hc.mdifferentiableAt (by simp)) |
| 37 | simp only [singularMetricCoefficient, singularTensorCoefficient, |
| 38 | Matrix.cons_val_zero, Matrix.cons_val_one, |
| 39 | RiemannianMetric.pullbackOfLocalDiffeomorph_inner, surgeryMetricCoefficient] |
| 40 | rw [show (fun z => f ((extChartAt (𝓡 3) q).symm z)) = |
| 41 | f ∘ (extChartAt (𝓡 3) q).symm from rfl, hcomp] |
| 42 | rfl |
| 43 | |
| 44 | /-- Jet equality follows from coefficient equality on an open chart target. -/ |
| 45 | theorem singularMetricJet_pullback |
| 46 | (gT : RiemannianMetric 3 B.carrier) |
| 47 | (f : Diffeomorph (𝓡 3) (𝓡 3) A.carrier B.carrier ∞) |
| 48 | (q : A.carrier) (a b : Fin 3) (k : ℕ) |
| 49 | {p : EuclideanSpace ℝ (Fin 3)} (hp : p ∈ (extChartAt (𝓡 3) q).target) : |
| 50 | iteratedFDeriv ℝ k |
| 51 | (singularMetricCoefficient (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) |
| 52 | q a b) p = |
| 53 | iteratedFDeriv ℝ k |
| 54 | (surgeryMetricCoefficient gT (fun z => f ((extChartAt (𝓡 3) q).symm z)) a b) p := by |
| 55 | have heq : singularMetricCoefficient |
| 56 | (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) q a b =ᶠ[𝓝 p] |
| 57 | surgeryMetricCoefficient gT (fun z => f ((extChartAt (𝓡 3) q).symm z)) a b := by |
| 58 | filter_upwards [(isOpen_extChartAt_target (I := 𝓡 3) q).mem_nhds hp] with z hz |
| 59 | exact singularMetricCoefficient_pullback gT f q a b hz |
| 60 | exact heq.iteratedFDeriv ℝ k |>.eq_of_nhds |
| 61 | |
| 62 | /-- Convergence through the given diffeomorphism is convergence to its |
| 63 | positive pullback on the same carrier. -/ |
| 64 | theorem surgeryMetricLimitOn_pullback |
| 65 | (g : ℝ → RiemannianMetric 3 A.carrier) |
| 66 | (gT : RiemannianMetric 3 B.carrier) |
| 67 | (f : Diffeomorph (𝓡 3) (𝓡 3) A.carrier B.carrier ∞) |
| 68 | {U : Set A.carrier} {T : ℝ} |
| 69 | (hlim : SurgeryMetricLimitOn A B g gT f U T) : |
| 70 | SurgeryMetricLimitOn A A g |
| 71 | (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) id U T := by |
| 72 | intro q hq K hK htarget hU k a b eta heta |
| 73 | obtain ⟨d, hd, hbound⟩ := hlim q hq K hK htarget hU k a b eta heta |
| 74 | refine ⟨d, hd, fun t ht hT p hp => ?_⟩ |
| 75 | have hjet := singularMetricJet_pullback gT f q a b k (htarget hp) |
| 76 | have hcoeff : surgeryMetricCoefficient |
| 77 | (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) |
| 78 | (fun z => id ((extChartAt (𝓡 3) q).symm z)) a b = |
| 79 | singularMetricCoefficient |
| 80 | (gT.pullbackOfLocalDiffeomorph f f.isLocalDiffeomorph) q a b := rfl |
| 81 | rw [hcoeff, hjet] |
| 82 | exact hbound t ht hT p hp |
| 83 | |
| 84 | end PoincareMT.M51 |