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.Spacetime.Horizontal.Choice |
| 2 | import PoincareLib.Geometry.Riemannian.Connection.MetricDuality |
| 3 | |
| 4 | /-! |
| 5 | # Restriction of horizontal fields to a time slice |
| 6 | |
| 7 | The selected slice tangent equivalence is the differential of its inclusion. |
| 8 | Its coordinate matrices are therefore smooth, as are their inverses. This |
| 9 | transfers local horizontal fields to the selected slice without a regularity |
| 10 | assumption on the choice of slice charts. |
| 11 | |
| 12 | Source: Morgan-Tian, Definitions 3.34-3.36, pp. 59-60. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | open Bundle Set Filter |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT |
| 24 | |
| 25 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 26 | {I : SpacetimeInterval} {F : GeneralizedFlowSpacetime n X time I} |
| 27 | |
| 28 | namespace SpacetimeSliceGeometry |
| 29 | |
| 30 | variable {t : ℝ} (S : SpacetimeSliceGeometry F t) |
| 31 | |
| 32 | private theorem tangentEquiv_coordinates_smooth (x : S.Point) : |
| 33 | ContMDiffAt (𝓡 n) 𝓘(ℝ, EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) ∞ |
| 34 | (fun y : S.Point ↦ ContinuousLinearMap.inCoordinates |
| 35 | (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) : S.Point → Type _) |
| 36 | (EuclideanSpace ℝ (Fin n)) F.Horizontal |
| 37 | x y x.val y.val (S.tangentEquiv y).toContinuousLinearMap) x := by |
| 38 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) S.Point := S.chartedSpace |
| 39 | apply contMDiffAt_clm_of_apply |
| 40 | intro v |
| 41 | let E := EuclideanSpace ℝ (Fin n) |
| 42 | let e := trivializationAt E (TangentSpace (𝓡 n) : S.Point → Type _) x |
| 43 | have hx : x ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt _ _ _ |
| 44 | have hv : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, E)) ∞ |
| 45 | (fun y : S.Point ↦ TotalSpace.mk' E y v) x := by |
| 46 | rw [contMDiffAt_totalSpace] |
| 47 | exact ⟨contMDiffAt_id, by simpa using contMDiffAt_const (c := v)⟩ |
| 48 | have hfield := (e.contMDiffAt_symmL (IB := 𝓡 n) (n := ∞) hx).clm_bundle_apply hv |
| 49 | have hi : ContMDiff (𝓡 n) (spacetimeModel n) ∞ (Subtype.val : S.Point → F.Point) := |
| 50 | S.inclusion_smooth |
| 51 | have hderiv := ((hi x).mfderiv_const (m := ∞) (by simp)).clm_apply_of_inCoordinates |
| 52 | hfield (hi x) |
| 53 | have hproj : ContMDiff |
| 54 | ((spacetimeModel n).prod 𝓘(ℝ, SpacetimeModelVector n)) |
| 55 | ((spacetimeModel n).prod 𝓘(ℝ, E)) ∞ |
| 56 | (fun v : TangentBundle (spacetimeModel n) F.Point ↦ |
| 57 | TotalSpace.mk' E (E := F.Horizontal) v.proj (F.horizontalProjection v.proj v.2)) := |
| 58 | F.horizontalProjection_smooth |
| 59 | have h := (hproj _).comp x hderiv |
| 60 | rw [contMDiffAt_totalSpace] at h |
| 61 | apply h.2.congr_of_eventuallyEq |
| 62 | filter_upwards [hi.continuous.continuousAt.preimage_mem_nhds |
| 63 | ((trivializationAt E F.Horizontal x.val).open_baseSet.mem_nhds |
| 64 | (FiberBundle.mem_baseSet_trivializationAt E F.Horizontal x.val))] with y hy |
| 65 | dsimp only [Function.comp_apply] |
| 66 | rw [ContinuousLinearMap.inCoordinates, ContinuousLinearMap.comp_apply, |
| 67 | ContinuousLinearMap.comp_apply, |
| 68 | Trivialization.continuousLinearMapAt_apply_of_mem ℝ _ hy] |
| 69 | congr 2 |
| 70 | apply congrArg (fun w : F.Horizontal y.val ↦ TotalSpace.mk' E y.val w) |
| 71 | have ht : (S.tangentEquiv y ((e.symmL ℝ y) v)).val = |
| 72 | mfderiv (𝓡 n) (spacetimeModel n) (Subtype.val : S.Point → F.Point) y |
| 73 | ((e.symmL ℝ y) v) := S.tangentEquiv_eq _ _ |
| 74 | change S.tangentEquiv y ((e.symmL ℝ y) v) = _ |
| 75 | exact (F.horizontalProjection_identity y.val _).symm.trans |
| 76 | (congrArg (F.horizontalProjection y.val) ht) |
| 77 | |
| 78 | private theorem tangentEquiv_coordinates_invertible (x : S.Point) : |
| 79 | (ContinuousLinearMap.inCoordinates |
| 80 | (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) : S.Point → Type _) |
| 81 | (EuclideanSpace ℝ (Fin n)) F.Horizontal |
| 82 | x x x.val x.val (S.tangentEquiv x).toContinuousLinearMap).IsInvertible := by |
| 83 | rw [ContinuousLinearMap.inCoordinates_eq |
| 84 | (FiberBundle.mem_baseSet_trivializationAt _ _ _) |
| 85 | (FiberBundle.mem_baseSet_trivializationAt _ _ _)] |
| 86 | exact ContinuousLinearMap.isInvertible_equiv.comp |
| 87 | (ContinuousLinearMap.isInvertible_equiv.comp ContinuousLinearMap.isInvertible_equiv) |
| 88 | |
| 89 | private theorem tangentEquiv_symm_coordinates_smooth (x : S.Point) : |
| 90 | ContMDiffAt (𝓡 n) 𝓘(ℝ, EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) ∞ |
| 91 | (fun y : S.Point ↦ ContinuousLinearMap.inCoordinates |
| 92 | (EuclideanSpace ℝ (Fin n)) F.Horizontal |
| 93 | (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) : S.Point → Type _) |
| 94 | x.val y.val x y (S.tangentEquiv y).symm.toContinuousLinearMap) x := by |
| 95 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) S.Point := S.chartedSpace |
| 96 | have h := (S.tangentEquiv_coordinates_invertible x).contDiffAt_map_inverse.contMDiffAt.comp x |
| 97 | (S.tangentEquiv_coordinates_smooth x) |
| 98 | apply h.congr_of_eventuallyEq |
| 99 | have hi : Continuous (Subtype.val : S.Point → F.Point) := S.inclusion_smooth.continuous |
| 100 | filter_upwards [(trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 101 | (TangentSpace (𝓡 n) : S.Point → Type _) x).open_baseSet.mem_nhds |
| 102 | (FiberBundle.mem_baseSet_trivializationAt _ _ _), |
| 103 | hi.continuousAt.preimage_mem_nhds |
| 104 | ((trivializationAt (EuclideanSpace ℝ (Fin n)) F.Horizontal x.val).open_baseSet.mem_nhds |
| 105 | (FiberBundle.mem_baseSet_trivializationAt _ _ _))] with y hy hy' |
| 106 | simp only [Function.comp_apply] |
| 107 | rw [ContinuousLinearMap.inCoordinates_eq hy hy', |
| 108 | ContinuousLinearMap.inCoordinates_eq hy' hy] |
| 109 | simp only [ContinuousLinearMap.inverse_equiv_comp, ContinuousLinearMap.inverse_equiv, |
| 110 | ContinuousLinearEquiv.symm_symm, ContinuousLinearMap.comp_assoc] |
| 111 | |
| 112 | theorem restrictHorizontalSection_smoothAt |
| 113 | (V : HorizontalSection F) (x : S.Point) |
| 114 | (hV : ContMDiffAt (spacetimeModel n) |
| 115 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 116 | (fun q : F.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 117 | (E := F.Horizontal) q (V q)) x.val) : |
| 118 | ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 119 | (fun y : S.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 120 | (E := (TangentSpace (𝓡 n) : S.Point → Type _)) y |
| 121 | ((S.tangentEquiv y).symm (V y.val))) x := by |
| 122 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) S.Point := S.chartedSpace |
| 123 | have hi : ContMDiff (𝓡 n) (spacetimeModel n) ∞ (Subtype.val : S.Point → F.Point) := |
| 124 | S.inclusion_smooth |
| 125 | exact (S.tangentEquiv_symm_coordinates_smooth x).clm_apply_of_inCoordinates |
| 126 | (b₁ := (Subtype.val : S.Point → F.Point)) (b₂ := id) |
| 127 | (hV.comp x (hi x)) contMDiffAt_id |
| 128 | |
| 129 | theorem restrictHorizontalSection_differentiableAt |
| 130 | (V : HorizontalSection F) (x : S.Point) |
| 131 | (hV : MDifferentiableAt (spacetimeModel n) |
| 132 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 133 | (fun q : F.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 134 | (E := F.Horizontal) q (V q)) x.val) : |
| 135 | MDifferentiableAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 136 | (fun y : S.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 137 | (E := (TangentSpace (𝓡 n) : S.Point → Type _)) y |
| 138 | ((S.tangentEquiv y).symm (V y.val))) x := by |
| 139 | letI : ChartedSpace (EuclideanSpace ℝ (Fin n)) S.Point := S.chartedSpace |
| 140 | have hi : ContMDiff (𝓡 n) (spacetimeModel n) ∞ (Subtype.val : S.Point → F.Point) := |
| 141 | S.inclusion_smooth |
| 142 | have hc := (S.tangentEquiv_symm_coordinates_smooth x).mdifferentiableAt (by simp) |
| 143 | exact hc.clm_apply_of_inCoordinates (b₁ := (Subtype.val : S.Point → F.Point)) (b₂ := id) |
| 144 | (hV.comp x ((hi x).mdifferentiableAt (by simp))) mdifferentiableAt_id |
| 145 | |
| 146 | end SpacetimeSliceGeometry |
| 147 | |
| 148 | variable {S : ∀ t : ℝ, SpacetimeSliceGeometry F t} |
| 149 | |
| 150 | theorem restrictHorizontalSection_smooth |
| 151 | {U : Set F.Point} (hU : IsOpen U) {V : HorizontalSection F} |
| 152 | (hV : IsSmoothHorizontalSectionOn F V U) (t : ℝ) : |
| 153 | ContMDiffOn (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 154 | (T% (restrictHorizontalSection S t V)) (Subtype.val ⁻¹' U) := by |
| 155 | intro x hx |
| 156 | exact ((S t).restrictHorizontalSection_smoothAt V x |
| 157 | (hV.contMDiffAt (hU.mem_nhds hx))).contMDiffWithinAt |
| 158 | |
| 159 | namespace LeafwiseLeviCivitaFamily |
| 160 | |
| 161 | theorem rawLeafwiseCovariantDerivative_eq |
| 162 | (D D' : LeafwiseLeviCivitaFamily F S) {V : HorizontalSection F} {p : F.Point} |
| 163 | (hV : MDifferentiableAt (spacetimeModel n) |
| 164 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 165 | (fun q : F.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 166 | (E := F.Horizontal) q (V q)) p) : |
| 167 | rawLeafwiseCovariantDerivative D V p = rawLeafwiseCovariantDerivative D' V p := by |
| 168 | have hv := (S (F.timeFunction p)).restrictHorizontalSection_differentiableAt V |
| 169 | (spacetimeSlicePoint S p) hV |
| 170 | apply ContinuousLinearMap.ext |
| 171 | intro v |
| 172 | exact congrArg ((S (F.timeFunction p)).tangentEquiv (spacetimeSlicePoint S p)) |
| 173 | ((D.sliceConnection (F.timeFunction p)).connection_eq_of_mdifferentiableAt |
| 174 | (D'.sliceConnection (F.timeFunction p)) hv |
| 175 | (((S (F.timeFunction p)).tangentEquiv (spacetimeSlicePoint S p)).symm v)) |
| 176 | |
| 177 | theorem rawHorizontalCovariantDerivative_eq |
| 178 | (D D' : LeafwiseLeviCivitaFamily F S) {V : HorizontalSection F} {p : F.Point} |
| 179 | (hV : MDifferentiableAt (spacetimeModel n) |
| 180 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 181 | (fun q : F.Point ↦ TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) |
| 182 | (E := F.Horizontal) q (V q)) p) : |
| 183 | rawHorizontalCovariantDerivative D V p = rawHorizontalCovariantDerivative D' V p := by |
| 184 | unfold rawHorizontalCovariantDerivative |
| 185 | rw [D.rawLeafwiseCovariantDerivative_eq D' hV] |
| 186 | |
| 187 | end LeafwiseLeviCivitaFamily |
| 188 | |
| 189 | end PoincareMT |