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.Restriction |
| 2 | import PoincareLib.Geometry.Spacetime.Horizontal.LieTensor |
| 3 | |
| 4 | /-! |
| 5 | # Connection laws for the raw horizontal derivative |
| 6 | |
| 7 | The spatial Levi-Civita Leibniz rule and the time-bracket Leibniz rule |
| 8 | combine using the tangent decomposition. The resulting connection has |
| 9 | metric defect equal to the time differential times the metric Lie derivative. |
| 10 | |
| 11 | Source: Morgan-Tian, Definition 3.36 and Remark 3.37, pp. 60-61. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | open Bundle Set |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 25 | {I : SpacetimeInterval} {F : GeneralizedFlowSpacetime n X time I} |
| 26 | {S : ∀ t : ℝ, SpacetimeSliceGeometry F t} |
| 27 | |
| 28 | local notation "H% " V => (fun q : F.Point ↦ TotalSpace.mk' |
| 29 | (EuclideanSpace ℝ (Fin n)) (E := F.Horizontal) q (V q)) |
| 30 | |
| 31 | theorem rawLeafwiseCovariantDerivative_add |
| 32 | (D : LeafwiseLeviCivitaFamily F S) {V W : HorizontalSection F} {p : F.Point} |
| 33 | (hV : MDifferentiableAt (spacetimeModel n) |
| 34 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% V) p) |
| 35 | (hW : MDifferentiableAt (spacetimeModel n) |
| 36 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% W) p) : |
| 37 | rawLeafwiseCovariantDerivative D (V + W) p = |
| 38 | rawLeafwiseCovariantDerivative D V p + rawLeafwiseCovariantDerivative D W p := by |
| 39 | let t := F.timeFunction p |
| 40 | let x := spacetimeSlicePoint S p |
| 41 | have hv := (S t).restrictHorizontalSection_differentiableAt V x hV |
| 42 | have hw := (S t).restrictHorizontalSection_differentiableAt W x hW |
| 43 | have hr : restrictHorizontalSection S t (V + W) = |
| 44 | restrictHorizontalSection S t V + restrictHorizontalSection S t W := by |
| 45 | funext y |
| 46 | exact map_add ((S t).tangentEquiv y).symm _ _ |
| 47 | let j := (S t).tangentEquiv x |
| 48 | apply ContinuousLinearMap.ext |
| 49 | intro v |
| 50 | change j ((D.sliceConnection t).connection (restrictHorizontalSection S t (V + W)) x |
| 51 | (j.symm v)) = j ((D.sliceConnection t).connection (restrictHorizontalSection S t V) x |
| 52 | (j.symm v)) + j ((D.sliceConnection t).connection (restrictHorizontalSection S t W) x |
| 53 | (j.symm v)) |
| 54 | erw [hr, (D.sliceConnection t).connection.isCovariantDerivativeOn.add hv hw] |
| 55 | simp only [add_apply, map_add] |
| 56 | rfl |
| 57 | |
| 58 | theorem rawLeafwiseCovariantDerivative_smul |
| 59 | (D : LeafwiseLeviCivitaFamily F S) {V : HorizontalSection F} |
| 60 | {f : F.Point → ℝ} {p : F.Point} |
| 61 | (hf : MDifferentiableAt (spacetimeModel n) 𝓘(ℝ) f p) |
| 62 | (hV : MDifferentiableAt (spacetimeModel n) |
| 63 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% V) p) |
| 64 | (v : F.Horizontal p) : |
| 65 | rawLeafwiseCovariantDerivative D (f • V) p v = |
| 66 | f p • rawLeafwiseCovariantDerivative D V p v + |
| 67 | mvfderiv (spacetimeModel n) f p v.val • V p := by |
| 68 | let t := F.timeFunction p |
| 69 | let : ChartedSpace (EuclideanSpace ℝ (Fin n)) (S t).Point := (S t).chartedSpace |
| 70 | let x := spacetimeSlicePoint S p |
| 71 | let j := (S t).tangentEquiv x |
| 72 | have hv := (S t).restrictHorizontalSection_differentiableAt V x hV |
| 73 | have hi := ((S t).inclusion_smooth x).mdifferentiableAt (by simp) |
| 74 | have hf' : MDifferentiableAt (𝓡 n) 𝓘(ℝ) |
| 75 | (f ∘ (Subtype.val : (S t).Point → F.Point)) x := hf.comp x hi |
| 76 | have hr : restrictHorizontalSection S t (f • V) = |
| 77 | (f ∘ (Subtype.val : (S t).Point → F.Point)) • restrictHorizontalSection S t V := by |
| 78 | funext y |
| 79 | exact map_smul ((S t).tangentEquiv y).symm _ _ |
| 80 | have hd : mvfderiv (𝓡 n) (f ∘ (Subtype.val : (S t).Point → F.Point)) x (j.symm v) = |
| 81 | mvfderiv (spacetimeModel n) f p v.val := by |
| 82 | rw [mvfderiv_comp_apply x hf hi, ← (S t).tangentEquiv_eq] |
| 83 | simp only [j, ContinuousLinearEquiv.apply_symm_apply] |
| 84 | rfl |
| 85 | change j ((D.sliceConnection t).connection (restrictHorizontalSection S t (f • V)) x |
| 86 | (j.symm v)) = _ |
| 87 | erw [hr, (D.sliceConnection t).connection.isCovariantDerivativeOn.leibniz hv hf'] |
| 88 | simp only [add_apply, smul_apply, |
| 89 | ContinuousLinearMap.smulRight_apply, map_add, map_smul, hd] |
| 90 | simp only [j, ContinuousLinearEquiv.apply_symm_apply] |
| 91 | rfl |
| 92 | |
| 93 | theorem rawHorizontalCovariantDerivative_isCovariantDerivative |
| 94 | (D : LeafwiseLeviCivitaFamily F S) : |
| 95 | IsCovariantDerivativeOn (I := spacetimeModel n) (EuclideanSpace ℝ (Fin n)) |
| 96 | (rawHorizontalCovariantDerivative D) univ where |
| 97 | add hV hW _ := by |
| 98 | apply ContinuousLinearMap.ext |
| 99 | intro Z |
| 100 | simp only [rawHorizontalCovariantDerivative, add_apply, |
| 101 | ContinuousLinearMap.comp_apply, ContinuousLinearMap.smulRight_apply, |
| 102 | rawLeafwiseCovariantDerivative_add D hV hW, horizontalTimeBracket_add hV hW, |
| 103 | smul_add] |
| 104 | abel |
| 105 | leibniz := by |
| 106 | intro V f p hV hf _ |
| 107 | apply ContinuousLinearMap.ext |
| 108 | intro Z |
| 109 | simp only [rawHorizontalCovariantDerivative, add_apply, |
| 110 | ContinuousLinearMap.comp_apply, ContinuousLinearMap.smulRight_apply, |
| 111 | smul_apply, rawLeafwiseCovariantDerivative_smul D hf hV, |
| 112 | horizontalTimeBracket_smul hf hV, smul_add, smul_smul] |
| 113 | have hd := congrArg (mvfderiv (spacetimeModel n) f p) (F.tangent_decomposition p Z) |
| 114 | simp only [map_add, map_smul, smul_eq_mul] at hd |
| 115 | rw [hd] |
| 116 | simp only [GeneralizedFlowSpacetime.timeFunction] |
| 117 | module |
| 118 | |
| 119 | /-- The actual raw derivative is a covariant derivative on the horizontal bundle. -/ |
| 120 | noncomputable def rawHorizontalConnection (D : LeafwiseLeviCivitaFamily F S) : |
| 121 | CovariantDerivative (spacetimeModel n) (EuclideanSpace ℝ (Fin n)) F.Horizontal := |
| 122 | ⟨rawHorizontalCovariantDerivative D, rawHorizontalCovariantDerivative_isCovariantDerivative D⟩ |
| 123 | |
| 124 | theorem rawHorizontalCovariantDerivative_time |
| 125 | (D : LeafwiseLeviCivitaFamily F S) (V : HorizontalSection F) (p : F.Point) : |
| 126 | rawHorizontalCovariantDerivative D V p (F.timeVector p) = |
| 127 | horizontalTimeBracket F V p := by |
| 128 | have hp : F.horizontalProjection p (F.timeVector p) = 0 := by |
| 129 | apply Subtype.ext |
| 130 | simp only [F.horizontalProjection_eq, F.timeVector_normalized, one_smul, sub_self] |
| 131 | rfl |
| 132 | change rawLeafwiseCovariantDerivative D V p (F.horizontalProjection p (F.timeVector p)) + |
| 133 | (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) F.timeFunction p (F.timeVector p)) • |
| 134 | horizontalTimeBracket F V p = _ |
| 135 | erw [hp, map_zero, F.timeVector_normalized, one_smul, zero_add] |
| 136 | |
| 137 | theorem rawHorizontalCovariantDerivative_horizontal |
| 138 | (D : LeafwiseLeviCivitaFamily F S) (V : HorizontalSection F) (p : F.Point) |
| 139 | (v : F.Horizontal p) : |
| 140 | rawHorizontalCovariantDerivative D V p v.val = |
| 141 | rawLeafwiseCovariantDerivative D V p v := by |
| 142 | change rawLeafwiseCovariantDerivative D V p (F.horizontalProjection p v.val) + |
| 143 | (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) F.timeFunction p v.val) • |
| 144 | horizontalTimeBracket F V p = _ |
| 145 | erw [F.horizontalProjection_identity, v.property, zero_smul, add_zero] |
| 146 | |
| 147 | theorem rawLeafwiseCovariantDerivative_metric |
| 148 | (D : LeafwiseLeviCivitaFamily F S) {V W : HorizontalSection F} {p : F.Point} |
| 149 | (hV : MDifferentiableAt (spacetimeModel n) |
| 150 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% V) p) |
| 151 | (hW : MDifferentiableAt (spacetimeModel n) |
| 152 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% W) p) |
| 153 | (v : F.Horizontal p) : |
| 154 | mvfderiv (spacetimeModel n) (fun q ↦ F.horizontalMetric.inner q (V q) (W q)) p v.val = |
| 155 | F.horizontalMetric.inner p (rawLeafwiseCovariantDerivative D V p v) (W p) + |
| 156 | F.horizontalMetric.inner p (V p) (rawLeafwiseCovariantDerivative D W p v) := by |
| 157 | let t := F.timeFunction p |
| 158 | let : ChartedSpace (EuclideanSpace ℝ (Fin n)) (S t).Point := (S t).chartedSpace |
| 159 | let x := spacetimeSlicePoint S p |
| 160 | let j := (S t).tangentEquiv x |
| 161 | let : RiemannianBundle (TangentSpace (𝓡 n) : (S t).Point → Type _) := |
| 162 | ⟨(S t).metricOnPoints.toRiemannianMetric⟩ |
| 163 | have hv := (S t).restrictHorizontalSection_differentiableAt V x hV |
| 164 | have hw := (S t).restrictHorizontalSection_differentiableAt W x hW |
| 165 | have hm := (D.sliceConnection t).metricCompatible.mvfderiv_inner_eq |
| 166 | (x := x) (fun _ ↦ j.symm v) hv hw |
| 167 | change mvfderiv (𝓡 n) (fun y : (S t).Point ↦ (S t).metricOnPoints.inner y |
| 168 | (restrictHorizontalSection S t V y) (restrictHorizontalSection S t W y)) x |
| 169 | (j.symm v) = |
| 170 | (S t).metricOnPoints.inner x |
| 171 | ((D.sliceConnection t).connection (restrictHorizontalSection S t V) x (j.symm v)) |
| 172 | (restrictHorizontalSection S t W x) + |
| 173 | (S t).metricOnPoints.inner x (restrictHorizontalSection S t V x) |
| 174 | ((D.sliceConnection t).connection (restrictHorizontalSection S t W) x (j.symm v)) at hm |
| 175 | have he : (fun y : (S t).Point ↦ (S t).metricOnPoints.inner y |
| 176 | (restrictHorizontalSection S t V y) (restrictHorizontalSection S t W y)) = |
| 177 | (fun q : F.Point ↦ F.horizontalMetric.inner q (V q) (W q)) ∘ Subtype.val := by |
| 178 | funext y |
| 179 | exact ((S t).metric_eq y _ _).trans (by |
| 180 | simp only [restrictHorizontalSection, ContinuousLinearEquiv.apply_symm_apply] |
| 181 | rfl) |
| 182 | have hg := (F.horizontalMetric.contMDiff p).mdifferentiableAt (by simp) |
| 183 | have hh := hg.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := fun _ : F.Point ↦ ℝ) hV hW |
| 184 | rw [mdifferentiableAt_totalSpace] at hh |
| 185 | have hpair : MDifferentiableAt (spacetimeModel n) 𝓘(ℝ) |
| 186 | (fun q ↦ F.horizontalMetric.inner q (V q) (W q)) p := hh.2 |
| 187 | have hi := ((S t).inclusion_smooth x).mdifferentiableAt (by simp) |
| 188 | erw [he, mvfderiv_comp_apply x hpair hi, ← (S t).tangentEquiv_eq] at hm |
| 189 | simp only [j, ContinuousLinearEquiv.apply_symm_apply] at hm |
| 190 | erw [(S t).metric_eq, (S t).metric_eq] at hm |
| 191 | simpa only [restrictHorizontalSection, rawLeafwiseCovariantDerivative, |
| 192 | ContinuousLinearEquiv.apply_symm_apply, ContinuousLinearMap.comp_apply] using! hm |
| 193 | |
| 194 | theorem rawHorizontalCovariantDerivative_metric_defect |
| 195 | (D : LeafwiseLeviCivitaFamily F S) {V W : HorizontalSection F} {p : F.Point} |
| 196 | (hV : MDifferentiableAt (spacetimeModel n) |
| 197 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% V) p) |
| 198 | (hW : MDifferentiableAt (spacetimeModel n) |
| 199 | ((spacetimeModel n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) (H% W) p) |
| 200 | (Z : TangentSpace (spacetimeModel n) p) : |
| 201 | mvfderiv (spacetimeModel n) (fun q ↦ F.horizontalMetric.inner q (V q) (W q)) p Z - |
| 202 | F.horizontalMetric.inner p (rawHorizontalCovariantDerivative D V p Z) (W p) - |
| 203 | F.horizontalMetric.inner p (V p) (rawHorizontalCovariantDerivative D W p Z) = |
| 204 | (show ℝ from mfderiv (spacetimeModel n) 𝓘(ℝ) F.timeFunction p Z) * |
| 205 | horizontalMetricLieDerivative F p (V p) (W p) := by |
| 206 | have hd := congrArg |
| 207 | (mvfderiv (spacetimeModel n) (fun q ↦ F.horizontalMetric.inner q (V q) (W q)) p) |
| 208 | (F.tangent_decomposition p Z) |
| 209 | simp only [map_add, map_smul, smul_eq_mul, |
| 210 | rawLeafwiseCovariantDerivative_metric D hV hW] at hd |
| 211 | rw [horizontalMetricLieDerivative_on_differentiable_fields hV hW] |
| 212 | simp only [rawHorizontalCovariantDerivative, add_apply, ContinuousLinearMap.comp_apply, |
| 213 | ContinuousLinearMap.smulRight_apply, map_add, map_smul, smul_apply, smul_eq_mul, |
| 214 | horizontalMetricLieDerivativeOnFields] |
| 215 | rw [hd] |
| 216 | simp only [GeneralizedFlowSpacetime.timeFunction] |
| 217 | ring! |
| 218 | |
| 219 | end PoincareMT |