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.Compactness.Embedding.TimeIndependent |
| 2 | import Mathlib.LinearAlgebra.FiniteDimensional.Basic |
| 3 | import Mathlib.Analysis.InnerProductSpace.PiL2 |
| 4 | |
| 5 | /-! |
| 6 | # Regularity of spatial embedding slices |
| 7 | |
| 8 | An open spatial stage turns the frozen spacetime smoothness field into ordinary |
| 9 | smoothness of each fixed-time spatial map. The within-image smooth inverse gives |
| 10 | injectivity of its derivative by differentiating the left-inverse identity. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | |
| 15 | open Set |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | |
| 18 | namespace PoincareMT.SmoothSpacetimeEmbedding |
| 19 | |
| 20 | variable {n : ℕ} {T' T : ℝ} {C D : FlowCarrier n} |
| 21 | {F : BasedFlow n T' T C} {G : BasedFlow n T' T D} |
| 22 | {U : Set C.carrier} |
| 23 | |
| 24 | theorem spatialMap_contMDiffAt |
| 25 | (e : SmoothSpacetimeEmbedding F G (Ioo T' T ×ˢ U)) |
| 26 | (hU : @IsOpen C.carrier C.topologicalSpace U) {t : ℝ} (ht : t ∈ Ioo T' T) |
| 27 | {x : C.carrier} (hx : x ∈ U) : |
| 28 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 29 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 30 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 31 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 32 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 33 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 34 | ContMDiffAt (𝓡 n) (𝓡 n) ∞ (fun y ↦ (e.toFun (t, y)).2) x := by |
| 35 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 36 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 37 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 38 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 39 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 40 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 41 | have hdomain : Ioo T' T ×ˢ U ∈ 𝓝 (t, x) := by |
| 42 | exact (isOpen_Ioo.prod hU).mem_nhds ⟨ht, hx⟩ |
| 43 | have hspacetime := e.smooth_on.contMDiffAt hdomain |
| 44 | have hslice : ContMDiffAt (𝓡 n) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 45 | (fun y : C.carrier ↦ (t, y)) x := by |
| 46 | exact contMDiffAt_const.prodMk contMDiffAt_id |
| 47 | exact (hspacetime.comp x hslice).snd |
| 48 | |
| 49 | theorem spatialMap_mfderiv_injective |
| 50 | (e : SmoothSpacetimeEmbedding F G (Ioo T' T ×ˢ U)) |
| 51 | (hU : @IsOpen C.carrier C.topologicalSpace U) {t : ℝ} (ht : t ∈ Ioo T' T) |
| 52 | {x : C.carrier} (hx : x ∈ U) : |
| 53 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 54 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 55 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 56 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 57 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 58 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 59 | Function.Injective (mfderiv (𝓡 n) (𝓡 n) (fun y ↦ (e.toFun (t, y)).2) x) := by |
| 60 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 61 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 62 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 63 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 64 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 65 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 66 | let f : C.carrier → D.carrier := fun y ↦ (e.toFun (t, y)).2 |
| 67 | let g : D.carrier → C.carrier := fun y ↦ (e.inverse (t, y)).2 |
| 68 | have hpair (y : C.carrier) : e.toFun (t, y) = (t, f y) := |
| 69 | Prod.ext (e.time_preserving t y) rfl |
| 70 | have hmaps : MapsTo (fun y : D.carrier ↦ (t, y)) (f '' U) |
| 71 | (e.toFun '' (Ioo T' T ×ˢ U)) := by |
| 72 | rintro _ ⟨y, hy, rfl⟩ |
| 73 | exact ⟨(t, y), ⟨ht, hy⟩, hpair y⟩ |
| 74 | have hinv : ContMDiffWithinAt (𝓡 n) (𝓡 n) ∞ g (f '' U) (f x) := by |
| 75 | have hs := e.smooth_inverse_on (t, f x) (hmaps ⟨x, hx, rfl⟩) |
| 76 | have hslice : ContMDiffWithinAt (𝓡 n) (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 77 | (fun y : D.carrier ↦ (t, y)) (f '' U) (f x) := |
| 78 | contMDiffWithinAt_const.prodMk contMDiffWithinAt_id |
| 79 | exact (hs.comp (f x) hslice hmaps).snd |
| 80 | have hleft : ∀ y ∈ U, (g ∘ f) y = id y := by |
| 81 | intro y hy |
| 82 | have h := congrArg Prod.snd (e.left_inverse (t, y) ⟨ht, hy⟩) |
| 83 | simpa only [hpair, Function.comp_apply, id_eq, g] using h |
| 84 | have hf : MDifferentiableAt (𝓡 n) (𝓡 n) f x := |
| 85 | (e.spatialMap_contMDiffAt hU ht hx).mdifferentiableAt (by simp) |
| 86 | have hu : UniqueMDiffWithinAt (𝓡 n) U x := hU.uniqueMDiffWithinAt hx |
| 87 | have hcomp := mfderivWithin_comp x (hinv.mdifferentiableWithinAt (by simp)) |
| 88 | hf.mdifferentiableWithinAt (fun y hy ↦ ⟨y, hy, rfl⟩) hu |
| 89 | rw [mfderivWithin_congr_of_mem hleft hx, mfderivWithin_id hu, |
| 90 | mfderivWithin_eq_mfderiv hu hf] at hcomp |
| 91 | change Function.Injective (mfderiv (𝓡 n) (𝓡 n) f x) |
| 92 | intro v w hvw |
| 93 | have h := congrArg (mfderivWithin (𝓡 n) (𝓡 n) g (f '' U) (f x)) hvw |
| 94 | rw [← ContinuousLinearMap.comp_apply, ← ContinuousLinearMap.comp_apply, ← hcomp] at h |
| 95 | exact h |
| 96 | |
| 97 | theorem spatialMap_mfderiv_bijective |
| 98 | (e : SmoothSpacetimeEmbedding F G (Ioo T' T ×ˢ U)) |
| 99 | (hU : @IsOpen C.carrier C.topologicalSpace U) {t : ℝ} (ht : t ∈ Ioo T' T) |
| 100 | {x : C.carrier} (hx : x ∈ U) : |
| 101 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 102 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 103 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 104 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 105 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 106 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 107 | Function.Bijective (mfderiv (𝓡 n) (𝓡 n) (fun y ↦ (e.toFun (t, y)).2) x) := by |
| 108 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 109 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 110 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 111 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 112 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 113 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 114 | have hi := e.spatialMap_mfderiv_injective hU ht hx |
| 115 | have hfin : Module.finrank ℝ (TangentSpace (𝓡 n) x) = |
| 116 | Module.finrank ℝ (TangentSpace (𝓡 n) ((e.toFun (t, x)).2)) := by |
| 117 | unfold TangentSpace |
| 118 | rfl |
| 119 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := by |
| 120 | unfold TangentSpace |
| 121 | exact (EuclideanSpace.basisFun (Fin n) ℝ).toBasis.finiteDimensional_of_finite |
| 122 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) ((e.toFun (t, x)).2)) := by |
| 123 | unfold TangentSpace |
| 124 | exact (EuclideanSpace.basisFun (Fin n) ℝ).toBasis.finiteDimensional_of_finite |
| 125 | refine ⟨hi, ?_⟩ |
| 126 | exact (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hfin).mp hi |
| 127 | |
| 128 | noncomputable def spatialMap_mfderiv_linearEquiv |
| 129 | (e : SmoothSpacetimeEmbedding F G (Ioo T' T ×ˢ U)) |
| 130 | (hU : @IsOpen C.carrier C.topologicalSpace U) {t : ℝ} (ht : t ∈ Ioo T' T) |
| 131 | {x : C.carrier} (hx : x ∈ U) : |
| 132 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 133 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 134 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 135 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 136 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 137 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 138 | TangentSpace (𝓡 n) x ≃ₗ[ℝ] |
| 139 | TangentSpace (𝓡 n) ((e.toFun (t, x)).2) := by |
| 140 | letI : TopologicalSpace C.carrier := C.topologicalSpace |
| 141 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) C.carrier := C.chartedSpace |
| 142 | letI : IsManifold (𝓡 n) ∞ C.carrier := C.isManifold |
| 143 | letI : TopologicalSpace D.carrier := D.topologicalSpace |
| 144 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) D.carrier := D.chartedSpace |
| 145 | letI : IsManifold (𝓡 n) ∞ D.carrier := D.isManifold |
| 146 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := by |
| 147 | unfold TangentSpace |
| 148 | exact (EuclideanSpace.basisFun (Fin n) ℝ).toBasis.finiteDimensional_of_finite |
| 149 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) ((e.toFun (t, x)).2)) := by |
| 150 | unfold TangentSpace |
| 151 | exact (EuclideanSpace.basisFun (Fin n) ℝ).toBasis.finiteDimensional_of_finite |
| 152 | have hb := e.spatialMap_mfderiv_bijective hU ht hx |
| 153 | exact LinearEquiv.ofBijective (mfderiv (𝓡 n) (𝓡 n) |
| 154 | (fun y ↦ (e.toFun (t, y)).2) x).toLinearMap hb |
| 155 | |
| 156 | end PoincareMT.SmoothSpacetimeEmbedding |