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.Pullback |
| 2 | import PoincareLib.Geometry.Manifold.InverseFunction.LocalDiffeomorph |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.Comparison.Basic |
| 4 | import PoincareLib.Geometry.Riemannian.Connection.Construction |
| 5 | import PoincareLib.Geometry.Riemannian.Curvature.LocalIsometryInvariants |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | |
| 9 | open scoped Manifold ContDiff Bundle Topology |
| 10 | |
| 11 | universe u |
| 12 | |
| 13 | namespace PoincareMT |
| 14 | |
| 15 | /-- The smooth open embedding of a selected surgery component is a local |
| 16 | diffeomorphism. The inverse is only given on the open range, so the right |
| 17 | derivative identity is obtained from the local equality with the identity. -/ |
| 18 | noncomputable def selectedComponentInclusionLocalDiffeomorph |
| 19 | {A : GeneralizedSliceCarrier.{u}} |
| 20 | (C : SurgerySelectedComponent A) : |
| 21 | IsLocalDiffeomorph (𝓡 3) (𝓡 3) ∞ C.inclusion := by |
| 22 | apply Poincare.isLocalDiffeomorph_of_contMDiff_bijective_mfderiv |
| 23 | C.inclusion_smooth |
| 24 | intro x |
| 25 | let f := C.inclusion |
| 26 | let g := C.inverse |
| 27 | have hfr : ContMDiffAt (𝓡 3) (𝓡 3) ∞ f x := C.inclusion_smooth.contMDiffAt |
| 28 | have hgr : ContMDiffAt (𝓡 3) (𝓡 3) ∞ g (f x) := by |
| 29 | apply C.inverse_smooth.contMDiffAt |
| 30 | exact C.inclusion_openEmbedding.isOpen_range.mem_nhds ⟨x, rfl⟩ |
| 31 | have hcomp := mfderiv_comp x |
| 32 | (hgr.mdifferentiableAt (by simp)) |
| 33 | (hfr.mdifferentiableAt (by simp)) |
| 34 | have hleft : g ∘ f = id := by |
| 35 | funext y |
| 36 | exact C.left_inverse y |
| 37 | have hcomp' : |
| 38 | (mfderiv (𝓡 3) (𝓡 3) g (f x)).comp |
| 39 | (mfderiv (𝓡 3) (𝓡 3) f x) = |
| 40 | ContinuousLinearMap.id ℝ _ := by |
| 41 | rw [← hcomp, hleft, mfderiv_id] |
| 42 | have hinj : Function.Injective |
| 43 | (mfderiv (𝓡 3) (𝓡 3) f x) := by |
| 44 | intro v w hvw |
| 45 | have hv := congrArg (fun L => L v) hcomp' |
| 46 | have hw := congrArg (fun L => L w) hcomp' |
| 47 | change (mfderiv (𝓡 3) (𝓡 3) g (f x)) |
| 48 | ((mfderiv (𝓡 3) (𝓡 3) f x) v) = v at hv |
| 49 | change (mfderiv (𝓡 3) (𝓡 3) g (f x)) |
| 50 | ((mfderiv (𝓡 3) (𝓡 3) f x) w) = w at hw |
| 51 | exact hv.symm.trans ((congrArg _ hvw).trans hw) |
| 52 | have hright : ∀ᶠ y in 𝓝 (f x), f (g y) = y := by |
| 53 | filter_upwards [C.inclusion_openEmbedding.isOpen_range.mem_nhds ⟨x, rfl⟩] with y hy |
| 54 | obtain ⟨z, rfl⟩ := hy |
| 55 | exact congrArg f (C.left_inverse z) |
| 56 | have hcomp2 := mfderiv_comp (f := g) (g := f) (f x) |
| 57 | (C.left_inverse x ▸ hfr.mdifferentiableAt (by simp)) |
| 58 | (hgr.mdifferentiableAt (by simp)) |
| 59 | have hcomp2' := hcomp2 |
| 60 | rw [show g (f x) = x from C.left_inverse x] at hcomp2' |
| 61 | have hright_eq : (f ∘ g) =ᶠ[𝓝 (f x)] id := by |
| 62 | filter_upwards [hright] with y hy |
| 63 | exact hy |
| 64 | have hcomp2'' : |
| 65 | (mfderiv (𝓡 3) (𝓡 3) f x).comp |
| 66 | (mfderiv (𝓡 3) (𝓡 3) g (f x)) = |
| 67 | ContinuousLinearMap.id ℝ _ := by |
| 68 | rw [← hcomp2', hright_eq.mfderiv_eq, mfderiv_id] |
| 69 | have hsurj : Function.Surjective |
| 70 | (mfderiv (𝓡 3) (𝓡 3) f x) := by |
| 71 | intro y |
| 72 | refine ⟨(mfderiv (𝓡 3) (𝓡 3) g (f x)) y, ?_⟩ |
| 73 | exact congrArg (fun L => L y) hcomp2'' |
| 74 | exact ⟨by simpa [f] using hinj, by simpa [f] using hsurj⟩ |
| 75 | |
| 76 | /-- Pull back an ambient Ricci flow to the fixed carrier of a selected |
| 77 | component. -/ |
| 78 | noncomputable def selectedComponentRicciFlow |
| 79 | {A : GeneralizedSliceCarrier.{u}} |
| 80 | {J : Set ℝ} |
| 81 | (C : SurgerySelectedComponent A) |
| 82 | (F : RicciFlow 3 A.carrier J) : |
| 83 | RicciFlow 3 C.carrier.carrier J := |
| 84 | F.pullbackWithConnection C.inclusion |
| 85 | (selectedComponentInclusionLocalDiffeomorph C) |
| 86 | (fun t => RiemannianMetric.leviCivitaData |
| 87 | ((F.metric t).pullbackOfLocalDiffeomorph C.inclusion |
| 88 | (selectedComponentInclusionLocalDiffeomorph C))) |
| 89 | |
| 90 | @[simp] theorem selectedComponentRicciFlow_metric |
| 91 | {A : GeneralizedSliceCarrier.{u}} |
| 92 | {J : Set ℝ} |
| 93 | (C : SurgerySelectedComponent A) |
| 94 | (F : RicciFlow 3 A.carrier J) (t : ℝ) (x : C.carrier.carrier) |
| 95 | (v w : TangentSpace (𝓡 3) x) : |
| 96 | ((selectedComponentRicciFlow C F).metric t).inner x v w = |
| 97 | (F.metric t).inner (C.inclusion x) |
| 98 | (mfderiv (𝓡 3) (𝓡 3) C.inclusion x v) |
| 99 | (mfderiv (𝓡 3) (𝓡 3) C.inclusion x w) := rfl |
| 100 | |
| 101 | @[simp] theorem selectedComponentRicciFlow_scalarCurvature |
| 102 | {A : GeneralizedSliceCarrier.{u}} |
| 103 | {J : Set ℝ} |
| 104 | (C : SurgerySelectedComponent A) |
| 105 | (F : RicciFlow 3 A.carrier J) (t : ℝ) (x : C.carrier.carrier) : |
| 106 | ((selectedComponentRicciFlow C F).connection t).scalarCurvature x = |
| 107 | (F.connection t).scalarCurvature (C.inclusion x) := by |
| 108 | apply ((selectedComponentRicciFlow C F).connection t).scalarCurvature_eq_of_local_isometry |
| 109 | (F.connection t) isOpen_univ C.inclusion_smooth.contMDiffOn |
| 110 | (fun _ _ _ _ => rfl) (Set.mem_univ x) |
| 111 | |
| 112 | end PoincareMT |