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.Riemannian.Tensor.Operations |
| 2 | import Mathlib.Topology.Algebra.Module.FiniteDimension |
| 3 | |
| 4 | /-! |
| 5 | # The local frame selected by the frozen tensor derivative |
| 6 | |
| 7 | The frame agrees locally with the frozen extension. Connection and tensor |
| 8 | differentiation use germ congruence, leaving its arbitrary remote values free. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 14 | |
| 15 | open Filter |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 23 | [IsManifold (𝓡 n) ∞ M] |
| 24 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | noncomputable def extensionMap (p q : M) : |
| 28 | TangentSpace (𝓡 n) p →L[ℝ] TangentSpace (𝓡 n) q := |
| 29 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 30 | (e.symmL ℝ q).comp (e.continuousLinearMapAt ℝ p) |
| 31 | |
| 32 | theorem extensionMap_apply (p q : M) |
| 33 | (hq : q ∈ (trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p).baseSet) |
| 34 | (v : TangentSpace (𝓡 n) p) : |
| 35 | extensionMap p q v = FiberBundle.extend E v q := by |
| 36 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 37 | have hp : p ∈ e.baseSet := FiberBundle.mem_baseSet_trivializationAt' p |
| 38 | change e.symmL ℝ q (e.continuousLinearMapAt ℝ p v) = e.symm q (e ⟨p, v⟩).2 |
| 39 | rw [Bundle.Trivialization.continuousLinearMapAt_apply_of_mem ℝ e hp] |
| 40 | exact e.symmL_apply hq _ |
| 41 | |
| 42 | theorem extensionMap_eventuallyEq (p : M) (v : TangentSpace (𝓡 n) p) : |
| 43 | (fun q ↦ extensionMap p q v) =ᶠ[𝓝 p] |
| 44 | FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E v := by |
| 45 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 46 | filter_upwards [e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' p)] |
| 47 | with q hq |
| 48 | exact extensionMap_apply p q hq v |
| 49 | |
| 50 | theorem extensionMap_self (p : M) : |
| 51 | extensionMap p p = ContinuousLinearMap.id ℝ (TangentSpace (𝓡 n) p) := by |
| 52 | ext v |
| 53 | rw [extensionMap_apply p p (FiberBundle.mem_baseSet_trivializationAt' p), |
| 54 | FiberBundle.extend_apply_self] |
| 55 | rfl |
| 56 | |
| 57 | theorem frozenExtend_add (p : M) (v w : TangentSpace (𝓡 n) p) : |
| 58 | FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E (v + w) =ᶠ[𝓝 p] |
| 59 | FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E v + |
| 60 | FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E w := by |
| 61 | filter_upwards [extensionMap_eventuallyEq p (v + w), extensionMap_eventuallyEq p v, |
| 62 | extensionMap_eventuallyEq p w] with q hvw hv hw |
| 63 | simp only [Pi.add_apply, ← hvw, ← hv, ← hw, map_add] |
| 64 | rfl |
| 65 | |
| 66 | theorem frozenExtend_smul (p : M) (a : ℝ) (v : TangentSpace (𝓡 n) p) : |
| 67 | FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E (a • v) =ᶠ[𝓝 p] |
| 68 | a • FiberBundle.extend («E» := TangentSpace (𝓡 n)) (x := p) E v := by |
| 69 | filter_upwards [extensionMap_eventuallyEq p (a • v), extensionMap_eventuallyEq p v] |
| 70 | with q hav hv |
| 71 | simp only [Pi.smul_apply, ← hav, ← hv, map_smul] |
| 72 | rfl |
| 73 | |
| 74 | noncomputable def extensionEquiv (p q : M) |
| 75 | (hq : q ∈ (trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p).baseSet) : |
| 76 | TangentSpace (𝓡 n) p ≃L[ℝ] TangentSpace (𝓡 n) q := |
| 77 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 78 | (e.continuousLinearEquivAt ℝ p (FiberBundle.mem_baseSet_trivializationAt' p)).trans |
| 79 | (e.continuousLinearEquivAt ℝ q hq).symm |
| 80 | |
| 81 | theorem extensionEquiv_coe (p q : M) |
| 82 | (hq : q ∈ (trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p).baseSet) : |
| 83 | (extensionEquiv p q hq : TangentSpace (𝓡 n) p →L[ℝ] TangentSpace (𝓡 n) q) = |
| 84 | extensionMap p q := by |
| 85 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 86 | ext v |
| 87 | change (e.continuousLinearEquivAt ℝ q hq).symm |
| 88 | (e.continuousLinearEquivAt ℝ p (FiberBundle.mem_baseSet_trivializationAt' p) v) = _ |
| 89 | rw [e.symm_continuousLinearEquivAt_eq hq, |
| 90 | e.coe_continuousLinearEquivAt_eq (FiberBundle.mem_baseSet_trivializationAt' p)] |
| 91 | rfl |
| 92 | |
| 93 | theorem extensionMap_smooth (p : M) (v : TangentSpace (𝓡 n) p) : |
| 94 | ContMDiffOn (𝓡 n) ((𝓡 n).prod (𝓡 n)) ∞ |
| 95 | (T% (fun q ↦ extensionMap p q v)) |
| 96 | (trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p).baseSet := by |
| 97 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 98 | suffices ContMDiffOn (𝓡 n) (𝓡 n) ∞ |
| 99 | (fun q ↦ (e ⟨q, extensionMap p q v⟩).2) e.baseSet by |
| 100 | intro q hq |
| 101 | rw [e.contMDiffWithinAt_section _ hq] |
| 102 | exact this q hq |
| 103 | have h : ContMDiffOn (𝓡 n) (𝓡 n) ∞ (fun _ : M ↦ (e ⟨p, v⟩).2) e.baseSet := |
| 104 | contMDiffOn_const |
| 105 | exact h.congr fun q hq ↦ by |
| 106 | rw [extensionMap_apply p q hq] |
| 107 | simp only [FiberBundle.extend] |
| 108 | change (e ⟨q, e.symm q (e ⟨p, v⟩).2⟩).2 = (e ⟨p, v⟩).2 |
| 109 | simp [hq] |
| 110 | |
| 111 | noncomputable def frozenConnectionEndomorphism {g : RiemannianMetric n M} |
| 112 | (D : LeviCivitaData g) (p : M) (X : TangentSpace (𝓡 n) p) : |
| 113 | TangentSpace (𝓡 n) p →L[ℝ] TangentSpace (𝓡 n) p := by |
| 114 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 115 | ⟨g.toRiemannianMetric⟩ |
| 116 | letI : FiniteDimensional ℝ (TangentSpace (𝓡 n) p) := |
| 117 | VectorBundle.finiteDimensional ℝ E (TangentSpace (𝓡 n) : M → Type _) p |
| 118 | let L : TangentSpace (𝓡 n) p →ₗ[ℝ] TangentSpace (𝓡 n) p := { |
| 119 | toFun := fun v ↦ D.connection (FiberBundle.extend E v) p X |
| 120 | map_add' := by |
| 121 | intro v w |
| 122 | have hv := FiberBundle.mdifferentiableAt_extend (𝓡 n) E v |
| 123 | have hw := FiberBundle.mdifferentiableAt_extend (𝓡 n) E w |
| 124 | have hc := D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq |
| 125 | (FiberBundle.mdifferentiableAt_extend (𝓡 n) E (v + w)) |
| 126 | (mdifferentiableAt_add_section hv hw) (by simp) (frozenExtend_add p v w) |
| 127 | rw [hc, D.connection.isCovariantDerivativeOnUniv.add hv hw] |
| 128 | rfl |
| 129 | map_smul' := by |
| 130 | intro a v |
| 131 | have hv := FiberBundle.mdifferentiableAt_extend (𝓡 n) E v |
| 132 | have hc := D.connection.isCovariantDerivativeOnUniv.congr_of_eventuallyEq |
| 133 | (FiberBundle.mdifferentiableAt_extend (𝓡 n) E (a • v)) |
| 134 | (hv.smul_const_section (a := a)) (by simp) (frozenExtend_smul p a v) |
| 135 | rw [hc, D.connection.isCovariantDerivativeOnUniv.smul_const a hv] |
| 136 | rfl } |
| 137 | exact L.toContinuousLinearMap |
| 138 | |
| 139 | theorem frozenConnectionEndomorphism_apply {g : RiemannianMetric n M} |
| 140 | (D : LeviCivitaData g) (p : M) (X v : TangentSpace (𝓡 n) p) : |
| 141 | frozenConnectionEndomorphism D p X v = D.connection (FiberBundle.extend E v) p X := |
| 142 | rfl |
| 143 | |
| 144 | theorem extensionMetric_derivative {g : RiemannianMetric n M} |
| 145 | (D : LeviCivitaData g) (p : M) (X v w : TangentSpace (𝓡 n) p) : |
| 146 | mvfderiv (𝓡 n) (fun q ↦ g.inner q (extensionMap p q v) (extensionMap p q w)) p X = |
| 147 | g.inner p (frozenConnectionEndomorphism D p X v) w + |
| 148 | g.inner p v (frozenConnectionEndomorphism D p X w) := by |
| 149 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 150 | ⟨g.toRiemannianMetric⟩ |
| 151 | have h := D.metricCompatible.mvfderiv_inner_eq (FiberBundle.extend E X) |
| 152 | (FiberBundle.mdifferentiableAt_extend (𝓡 n) E v) |
| 153 | (FiberBundle.mdifferentiableAt_extend (𝓡 n) E w) |
| 154 | have heq : (fun q ↦ g.inner q (extensionMap p q v) (extensionMap p q w)) =ᶠ[𝓝 p] |
| 155 | (fun q ↦ g.inner q (FiberBundle.extend E v q) (FiberBundle.extend E w q)) := by |
| 156 | filter_upwards [extensionMap_eventuallyEq p v, extensionMap_eventuallyEq p w] |
| 157 | with q hv hw |
| 158 | rw [hv, hw] |
| 159 | rw [mvfderiv, heq.mfderiv_eq] |
| 160 | simpa only [FiberBundle.extend_apply_self, frozenConnectionEndomorphism_apply, |
| 161 | mvfderiv] using! h |
| 162 | |
| 163 | theorem extensionTensor_derivative {g : RiemannianMetric n M} |
| 164 | (D : LeviCivitaData g) {k : ℕ} (T : CovariantTensorEvaluation n M k) |
| 165 | (p : M) (X : TangentSpace (𝓡 n) p) (v : Fin k → TangentSpace (𝓡 n) p) : |
| 166 | mvfderiv (𝓡 n) (fun q ↦ T q (fun i ↦ extensionMap p q (v i))) p X = |
| 167 | D.covariantTensorDerivative T p (Fin.cons X v) + |
| 168 | ∑ i, T p (Function.update v i (frozenConnectionEndomorphism D p X (v i))) := by |
| 169 | classical |
| 170 | have heq : (fun q ↦ T q (fun i ↦ extensionMap p q (v i))) =ᶠ[𝓝 p] |
| 171 | (fun q ↦ T q (fun i ↦ FiberBundle.extend E (v i) q)) := by |
| 172 | let e := trivializationAt E (TangentSpace (𝓡 n) : M → Type _) p |
| 173 | filter_upwards [e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt' p)] |
| 174 | with q hq |
| 175 | simp only [extensionMap_apply p q hq] |
| 176 | have hraw : D.covariantTensorDerivative T p (Fin.cons X v) = |
| 177 | mvfderiv (𝓡 n) (fun q ↦ T q (fun i ↦ FiberBundle.extend E (v i) q)) p X - |
| 178 | ∑ i, T p (Function.update v i (frozenConnectionEndomorphism D p X (v i))) := by |
| 179 | rfl |
| 180 | rw [hraw, sub_add_cancel, mvfderiv, heq.mfderiv_eq] |
| 181 | rfl |
| 182 | |
| 183 | end PoincareMT.ReducedLength |