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.Basic |
| 2 | import PoincareLib.Geometry.Riemannian.Curvature.SecondBianchi |
| 3 | import PoincareLib.Geometry.Riemannian.Connection.MetricDuality |
| 4 | import PoincareLib.Geometry.Manifold.VectorField.Derivation |
| 5 | |
| 6 | /-! |
| 7 | # Time regularity of the retained Levi-Civita connection |
| 8 | |
| 9 | The Koszul formula determines the connection on locally smooth fields from |
| 10 | the spacetime metric. Metric inversion then recovers the vector-valued |
| 11 | connection without an additional regularity hypothesis on its representative. |
| 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 Filter Set |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.RicciFlow |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} |
| 27 | |
| 28 | private lemma contDiffAt_clm_of_apply |
| 29 | {E G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 30 | [NormedAddCommGroup G] [NormedSpace ℝ G] [FiniteDimensional ℝ E] |
| 31 | {f : ℝ → E →L[ℝ] G} {t : ℝ} |
| 32 | (hf : ∀ v, ContDiffAt ℝ ∞ (fun s => f s v) t) : |
| 33 | ContDiffAt ℝ ∞ f t := by |
| 34 | let d := Module.finrank ℝ E |
| 35 | have hd : d = Module.finrank ℝ (Fin d → ℝ) := (Module.finrank_fin_fun ℝ).symm |
| 36 | let e₁ : E ≃L[ℝ] (Fin d → ℝ) := ContinuousLinearEquiv.ofFinrankEq hd |
| 37 | let e₂ := (e₁.arrowCongr (1 : G ≃L[ℝ] G)).trans (ContinuousLinearEquiv.piRing (Fin d)) |
| 38 | rw [← Function.id_comp f, ← e₂.symm_comp_self] |
| 39 | exact e₂.symm.contDiff.contDiffAt.comp t |
| 40 | (contDiffAt_pi.mpr fun i => hf _) |
| 41 | |
| 42 | lemma contMDiffAt_inner_fields (F : RicciFlow n M J) {t : ℝ} |
| 43 | (ht : t ∈ interior J) {x : M} |
| 44 | {X Y : (x : M) → TangentSpace (𝓡 n) x} |
| 45 | (hX : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) x) |
| 46 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) x) : |
| 47 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 48 | (fun p : ℝ × M => (F.metric p.1).inner p.2 (X p.2) (Y p.2)) (t, x) := by |
| 49 | have hg := (F.smooth (t, x) ⟨interior_subset ht, mem_univ x⟩).contMDiffAt |
| 50 | (prod_mem_nhds (mem_interior_iff_mem_nhds.mp ht) univ_mem) |
| 51 | have hX' : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 52 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 53 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) p.2 (X p.2)) |
| 54 | (t, x) := hX.comp (t, x) contMDiffAt_snd |
| 55 | have hY' : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 56 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 57 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) p.2 (Y p.2)) |
| 58 | (t, x) := hY.comp (t, x) contMDiffAt_snd |
| 59 | have h := hg.clm_bundle_apply₂ (F₃ := ℝ) (E₃ := fun _ : M => ℝ) hX' hY' |
| 60 | exact (contMDiffAt_totalSpace.mp h).2 |
| 61 | |
| 62 | private lemma contDiffAt_mvfderiv_time |
| 63 | {f : ℝ × M → ℝ} {t : ℝ} {x : M} |
| 64 | (hf : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f (t, x)) |
| 65 | (v : TangentSpace (𝓡 n) x) : |
| 66 | ContDiffAt ℝ ∞ (fun s => mvfderiv (𝓡 n) (fun y => f (s, y)) x v) t := by |
| 67 | let e := extChartAt (𝓡 n) x |
| 68 | have hx : e.symm (e x) = x := e.left_inv (mem_extChartAt_source x) |
| 69 | have hs : ContMDiffAt 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) ∞ e.symm (e x) := |
| 70 | (contMDiffOn_extChartAt_symm x).contMDiffAt |
| 71 | ((isOpen_extChartAt_target x).mem_nhds (mem_extChartAt_target x)) |
| 72 | have hc : ContDiffAt ℝ ∞ |
| 73 | (fun p : ℝ × EuclideanSpace ℝ (Fin n) => f (p.1, e.symm p.2)) (t, e x) := by |
| 74 | have hp : ContMDiffAt (𝓘(ℝ, ℝ).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) |
| 75 | (𝓘(ℝ, ℝ).prod (𝓡 n)) ∞ |
| 76 | (fun p : ℝ × EuclideanSpace ℝ (Fin n) => (p.1, e.symm p.2)) (t, e x) := |
| 77 | contMDiffAt_fst.prodMk (hs.comp (t, e x) contMDiffAt_snd) |
| 78 | have h := hf.comp_of_eq hp (by simp [hx]) |
| 79 | simp +instances only [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 80 | exact h.contDiffAt |
| 81 | have hd := hc.fderiv (f := fun s z => f (s, e.symm z)) |
| 82 | (g := fun _ : ℝ => e x) contDiffAt_const (m := ∞) (by simp) |
| 83 | let w : EuclideanSpace ℝ (Fin n) := |
| 84 | (mfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm (e x)).inverse v |
| 85 | have hh := hd.clm_apply (contDiffAt_const (c := w)) |
| 86 | apply hh.congr_of_eventuallyEq |
| 87 | have hevent : ∀ᶠ s in 𝓝 t, |
| 88 | MDifferentiableAt (𝓡 n) 𝓘(ℝ, ℝ) (fun y => f (s, y)) x := by |
| 89 | have hnear := ((contMDiffAt_iff_contMDiffAt_nhds (by simp)).mp |
| 90 | (hf.of_le (show (1 : WithTop ℕ∞) ≤ ∞ by simp))) |
| 91 | have htime : Tendsto (fun s : ℝ => (s, x)) (𝓝 t) (𝓝 (t, x)) := |
| 92 | continuousAt_id.prodMk continuousAt_const |
| 93 | filter_upwards [htime.eventually hnear] with s hs |
| 94 | exact (hs.comp x (contMDiffAt_const.prodMk contMDiffAt_id)).mdifferentiableAt (by simp) |
| 95 | filter_upwards [hevent] with s hs |
| 96 | have h := Poincare.Manifold.VectorField.fderiv_comp_extChartAt_symm |
| 97 | (p := x) (by simpa [e, hx] using hs) (mem_extChartAt_target x) w |
| 98 | have hi := Poincare.Manifold.VectorField.isInvertible_mfderiv_extChartAt_symm |
| 99 | (I := 𝓡 n) (p := x) (mem_extChartAt_target x) |
| 100 | change fderiv ℝ ((fun y => f (s, y)) ∘ e.symm) (e x) w = |
| 101 | mfderiv (𝓡 n) 𝓘(ℝ, ℝ) (fun y => f (s, y)) (e.symm (e x)) |
| 102 | (mfderiv 𝓘(ℝ, EuclideanSpace ℝ (Fin n)) (𝓡 n) e.symm (e x) w) at h |
| 103 | dsimp only [w] at h |
| 104 | rw [hi.self_apply_inverse, hx] at h |
| 105 | exact h.symm |
| 106 | |
| 107 | lemma contDiffAt_inner_time (F : RicciFlow n M J) {t : ℝ} |
| 108 | (ht : t ∈ interior J) (x : M) (v w : TangentSpace (𝓡 n) x) : |
| 109 | ContDiffAt ℝ ∞ (fun s => (F.metric s).inner x v w) t := by |
| 110 | have h := F.contMDiffAt_inner_fields ht |
| 111 | (FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) v) |
| 112 | (FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) w) |
| 113 | have h' := h.comp t (contMDiffAt_id.prodMk contMDiffAt_const) |
| 114 | simpa only [Function.comp_def, id_eq, FiberBundle.extend_apply_self] using h'.contDiffAt |
| 115 | |
| 116 | /-- The time-dependent metric viewed as a bilinear map in the fixed norm at t. -/ |
| 117 | lemma contDiffAt_inner (F : RicciFlow n M J) {t : ℝ} |
| 118 | (ht : t ∈ interior J) (x : M) : |
| 119 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 120 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 121 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 122 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 123 | letI : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 124 | letI : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 125 | ContDiffAt ℝ ∞ (fun s => (F.metric s).inner x) t := by |
| 126 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 127 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 128 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 129 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 130 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 131 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 132 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 133 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 134 | (TangentSpace (𝓡 n) : M → Type _) x |
| 135 | exact contDiffAt_clm_of_apply fun v => contDiffAt_clm_of_apply fun w => |
| 136 | contDiffAt_inner_time F ht x v w |
| 137 | |
| 138 | private lemma contDiffAt_inner_connection_time |
| 139 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 140 | {X Y Z : (x : M) → TangentSpace (𝓡 n) x} |
| 141 | (hX : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% X) x) |
| 142 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) x) |
| 143 | (hZ : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Z) x) : |
| 144 | ContDiffAt ℝ ∞ (fun s => |
| 145 | (F.metric s).inner x ((F.connection s).connection Y x (X x)) (Z x)) t := by |
| 146 | have h := (((((contDiffAt_mvfderiv_time |
| 147 | (F.contMDiffAt_inner_fields ht hY hZ) (X x)).add |
| 148 | (contDiffAt_mvfderiv_time (F.contMDiffAt_inner_fields ht hZ hX) (Y x))).sub |
| 149 | (contDiffAt_mvfderiv_time (F.contMDiffAt_inner_fields ht hX hY) (Z x))).add |
| 150 | (contDiffAt_inner_time F ht x (VectorField.mlieBracket (𝓡 n) X Y x) (Z x))).sub |
| 151 | (contDiffAt_inner_time F ht x (VectorField.mlieBracket (𝓡 n) Y Z x) (X x))).add |
| 152 | (contDiffAt_inner_time F ht x (VectorField.mlieBracket (𝓡 n) Z X x) (Y x)) |
| 153 | apply (h.const_smul (1 / 2 : ℝ)).congr_of_eventuallyEq |
| 154 | exact Filter.Eventually.of_forall fun s => by |
| 155 | have hk := (F.connection s).koszul_identity |
| 156 | (hX.mdifferentiableAt (by simp)) (hY.mdifferentiableAt (by simp)) |
| 157 | (hZ.mdifferentiableAt (by simp)) |
| 158 | dsimp only [LeviCivitaData.covariantDerivativeOnFields] at hk |
| 159 | simp only [smul_eq_mul] |
| 160 | linarith |
| 161 | |
| 162 | private lemma contDiffAt_connection_apply |
| 163 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 164 | {Y : (y : M) → TangentSpace (𝓡 n) y} |
| 165 | (hY : ContMDiffAt (𝓡 n) ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) x) |
| 166 | (v : TangentSpace (𝓡 n) x) : |
| 167 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 168 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 169 | ContDiffAt ℝ ∞ (fun s => (F.connection s).connection Y x v) t := by |
| 170 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 171 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 172 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x) := inferInstance |
| 173 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x) := inferInstance |
| 174 | let : NormedAddCommGroup (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 175 | let : NormedSpace ℝ (TangentSpace (𝓡 n) x →L[ℝ] ℝ) := inferInstance |
| 176 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 177 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 178 | (TangentSpace (𝓡 n) : M → Type _) x |
| 179 | have hg : ContDiffAt ℝ ∞ (fun s => (F.metric s).inner x) t := |
| 180 | contDiffAt_clm_of_apply fun u => contDiffAt_clm_of_apply fun w => |
| 181 | contDiffAt_inner_time F ht x u w |
| 182 | have hdual : ContDiffAt ℝ ∞ (fun s => |
| 183 | (F.metric s).inner x ((F.connection s).connection Y x v)) t := by |
| 184 | apply contDiffAt_clm_of_apply |
| 185 | intro w |
| 186 | have h := contDiffAt_inner_connection_time F ht |
| 187 | (FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) v) hY |
| 188 | (FiberBundle.contMDiffAt_extend (𝓡 n) (EuclideanSpace ℝ (Fin n)) w) |
| 189 | simpa only [FiberBundle.extend_apply_self] using h |
| 190 | have hi := ((F.metric t).inner_isInvertible x).contDiffAt_map_inverse.comp t hg |
| 191 | have h := hi.clm_apply hdual |
| 192 | apply h.congr_of_eventuallyEq |
| 193 | exact Filter.Eventually.of_forall fun s => |
| 194 | (((F.metric s).inner_isInvertible x).inverse_apply_self _).symm |
| 195 | |
| 196 | /-- Smoothness of the retained connection in time on a locally smooth field, |
| 197 | using the metric at the evaluation time as a fixed norm on the tangent fiber. -/ |
| 198 | theorem contDiffAt_connection |
| 199 | (F : RicciFlow n M J) {t : ℝ} (ht : t ∈ interior J) {x : M} |
| 200 | {Y : (y : M) → TangentSpace (𝓡 n) y} |
| 201 | (hY : ContMDiffAt (𝓡 n) |
| 202 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ (T% Y) x) : |
| 203 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 204 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 205 | ContDiffAt ℝ ∞ (fun s => (F.connection s).connection Y x) t := by |
| 206 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 207 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 208 | let : FiniteDimensional ℝ (TangentSpace (𝓡 n) x) := |
| 209 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 210 | (TangentSpace (𝓡 n) : M → Type _) x |
| 211 | exact contDiffAt_clm_of_apply (contDiffAt_connection_apply F ht hY) |
| 212 | |
| 213 | end PoincareMT.RicciFlow |