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 | /- Adapted from Mapher `PoincareMT/Proofs/M03/Existence/ImplicitLocalFlowNative.lean` at |
| 2 | f927d9e1f0810042766d3b5f64d3f4da02ee93cc. See |
| 3 | `references/ricci-flow/mapher/local-theory/port.json`. -/ |
| 4 | |
| 5 | import PoincareLib.Analysis.Parabolic.Quasilinear.FixedPoint.ContinuousPathComposition |
| 6 | import Mathlib.Analysis.Calculus.ImplicitContDiff |
| 7 | import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus |
| 8 | import Mathlib.Topology.ContinuousMap.Interval |
| 9 | |
| 10 | /-! |
| 11 | # Rescaled integral equation for smooth local flows |
| 12 | |
| 13 | Time is rescaled onto a fixed unit interval. At elapsed time zero the |
| 14 | partial derivative in the unknown continuous path is the identity. |
| 15 | -/ |
| 16 | |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set Filter MeasureTheory |
| 20 | open scoped Topology ContDiff |
| 21 | |
| 22 | noncomputable section |
| 23 | |
| 24 | namespace PoincareMT.ImplicitLocalFlowNative |
| 25 | |
| 26 | theorem exists_contDiff_implicit_on |
| 27 | {X Y : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X] |
| 28 | [NormedAddCommGroup Y] [NormedSpace ℝ Y] [CompleteSpace Y] |
| 29 | {k : ℕ∞} (f : X × Y → Y) (hf : ContDiff ℝ k f) (hk : k ≠ 0) (b : X × Y) |
| 30 | (hinv : (fderiv ℝ f b ∘L ContinuousLinearMap.inr ℝ X Y).IsInvertible) : |
| 31 | ∃ U : X → Y, ∃ S : Set X, |
| 32 | IsOpen S ∧ b.1 ∈ S ∧ ContDiffOn ℝ k U S ∧ U b.1 = b.2 ∧ |
| 33 | (∀ x ∈ S, f (x, U x) = f b) ∧ |
| 34 | ∀ᶠ v in 𝓝 b, f v = f b → U v.1 = v.2 := by |
| 35 | have hk' : (k : ℕ∞ω) ≠ 0 := by exact_mod_cast hk |
| 36 | let D : ImplicitFunctionData ℝ (X × Y) Y X := |
| 37 | (hf.contDiffAt.hasStrictFDerivAt hk').implicitFunctionDataOfProdDomain hinv |
| 38 | let H := D.toOpenPartialHomeomorph |
| 39 | have hD : ContDiff ℝ k D.prodFun := hf.prodMk contDiff_fst |
| 40 | obtain ⟨e, he⟩ := D.isInvertible_fderiv_prodFun |
| 41 | have heN := e.nhds |
| 42 | rw [he] at heN |
| 43 | have hN : {v : X × Y | (fderiv ℝ D.prodFun v).IsInvertible} ∈ 𝓝 b := |
| 44 | (hD.continuous_fderiv hk').continuousAt.preimage_mem_nhds heN |
| 45 | obtain ⟨V, hV, hVo, hbV⟩ := mem_nhds_iff.mp hN |
| 46 | let G := H.restrOpen V hVo |
| 47 | have hbG : b ∈ G.source := ⟨D.pt_mem_toOpenPartialHomeomorph_source, hbV⟩ |
| 48 | let S : Set X := (fun x => (f b, x)) ⁻¹' G.target |
| 49 | let U : X → Y := fun x => (G.symm (f b, x)).2 |
| 50 | have hSo : IsOpen S := G.open_target.preimage (continuous_const.prodMk continuous_id) |
| 51 | have hbS : b.1 ∈ S := G.map_source hbG |
| 52 | have hUb : U b.1 = b.2 := congrArg Prod.snd (G.left_inv hbG) |
| 53 | have hU : ContDiffOn ℝ k U S := by |
| 54 | intro x hx |
| 55 | have hback := G.map_target hx |
| 56 | obtain ⟨e', he'⟩ := hV hback.2 |
| 57 | have hder : HasFDerivAt G (e' : (X × Y) →L[ℝ] Y × X) |
| 58 | (G.symm (f b, x)) := by |
| 59 | change HasFDerivAt D.prodFun _ _ |
| 60 | rw [he'] |
| 61 | exact (hD.differentiable hk' _).hasFDerivAt |
| 62 | have hi : ContDiffAt ℝ k G.symm (f b, x) := |
| 63 | G.contDiffAt_symm hx hder hD.contDiffAt |
| 64 | exact ((hi.comp x (contDiffAt_const.prodMk contDiffAt_id)).snd).contDiffWithinAt |
| 65 | refine ⟨U, S, hSo, hbS, hU, hUb, ?_, ?_⟩ |
| 66 | · intro x hx |
| 67 | have hright := G.right_inv hx |
| 68 | have hfirst : (G.symm (f b, x)).1 = x := congrArg Prod.snd hright |
| 69 | have hvalue : f (G.symm (f b, x)) = f b := congrArg Prod.fst hright |
| 70 | have hpair : (x, U x) = G.symm (f b, x) := Prod.ext hfirst.symm rfl |
| 71 | rw [hpair] |
| 72 | exact hvalue |
| 73 | · filter_upwards [G.open_source.mem_nhds hbG] with v hv hval |
| 74 | have hleft := congrArg Prod.snd (G.left_inv hv) |
| 75 | change (G.symm (f v, v.1)).2 = v.2 at hleft |
| 76 | simpa only [hval] using hleft |
| 77 | |
| 78 | theorem exists_smooth_implicit_on |
| 79 | {X Y : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] [CompleteSpace X] |
| 80 | [NormedAddCommGroup Y] [NormedSpace ℝ Y] [CompleteSpace Y] |
| 81 | (f : X × Y → Y) (hf : ContDiff ℝ ∞ f) (b : X × Y) |
| 82 | (hinv : (fderiv ℝ f b ∘L ContinuousLinearMap.inr ℝ X Y).IsInvertible) : |
| 83 | ∃ U : X → Y, ∃ S : Set X, |
| 84 | IsOpen S ∧ b.1 ∈ S ∧ ContDiffOn ℝ ∞ U S ∧ U b.1 = b.2 ∧ |
| 85 | (∀ x ∈ S, f (x, U x) = f b) ∧ |
| 86 | ∀ᶠ v in 𝓝 b, f v = f b → U v.1 = v.2 := |
| 87 | exists_contDiff_implicit_on f hf (by simp) b hinv |
| 88 | |
| 89 | abbrev UnitInterval := Icc (0 : ℝ) 1 |
| 90 | |
| 91 | def unitZero : UnitInterval := ⟨0, le_rfl, zero_le_one⟩ |
| 92 | |
| 93 | def unitOne : UnitInterval := ⟨1, zero_le_one, le_rfl⟩ |
| 94 | |
| 95 | def unitParameter : C(UnitInterval, ℝ) := ⟨Subtype.val, continuous_subtype_val⟩ |
| 96 | |
| 97 | def unitProjection : C(ℝ, UnitInterval) := |
| 98 | ⟨projIcc 0 1 zero_le_one, continuous_projIcc⟩ |
| 99 | |
| 100 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 101 | |
| 102 | abbrev Path (E : Type*) [TopologicalSpace E] := C(UnitInterval, E) |
| 103 | |
| 104 | def extendPath (u : Path E) : C(ℝ, E) := u.comp unitProjection |
| 105 | |
| 106 | @[simp] theorem extendPath_apply_coe (u : Path E) (s : UnitInterval) : |
| 107 | extendPath u s = u s := by |
| 108 | change u (projIcc 0 1 zero_le_one s) = u s |
| 109 | congr 1 |
| 110 | exact Subtype.ext (by simp [projIcc, s.property.1, s.property.2]) |
| 111 | |
| 112 | def pathIntegral (u : Path E) : Path E := |
| 113 | ⟨fun s => ∫ r in (0 : ℝ)..(s : ℝ), extendPath u r, |
| 114 | (intervalIntegral.differentiable_integral_of_continuous |
| 115 | (extendPath u).continuous).continuous.comp continuous_subtype_val⟩ |
| 116 | |
| 117 | @[simp] theorem pathIntegral_apply (u : Path E) (s : UnitInterval) : |
| 118 | pathIntegral u s = ∫ r in (0 : ℝ)..(s : ℝ), extendPath u r := rfl |
| 119 | |
| 120 | @[simp] theorem pathIntegral_zero (u : Path E) : pathIntegral u unitZero = 0 := by |
| 121 | simp [pathIntegral, unitZero] |
| 122 | |
| 123 | theorem norm_pathIntegral_le (u : Path E) : ‖pathIntegral u‖ ≤ ‖u‖ := by |
| 124 | apply (ContinuousMap.norm_le _ (norm_nonneg _)).mpr |
| 125 | intro s |
| 126 | calc |
| 127 | ‖pathIntegral u s‖ ≤ ‖u‖ * |(s : ℝ) - 0| := |
| 128 | intervalIntegral.norm_integral_le_of_norm_le_const |
| 129 | (fun r _ => u.norm_coe_le_norm (unitProjection r)) |
| 130 | _ ≤ ‖u‖ * 1 := by |
| 131 | apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) |
| 132 | simpa only [sub_zero, abs_of_nonneg s.property.1] using s.property.2 |
| 133 | _ = ‖u‖ := mul_one _ |
| 134 | |
| 135 | def pathIntegralCLM : Path E →L[ℝ] Path E := |
| 136 | LinearMap.mkContinuous |
| 137 | { toFun := pathIntegral |
| 138 | map_add' := by |
| 139 | intro u v |
| 140 | ext s |
| 141 | exact intervalIntegral.integral_add |
| 142 | ((extendPath u).continuous.intervalIntegrable _ _) |
| 143 | ((extendPath v).continuous.intervalIntegrable _ _) |
| 144 | map_smul' := by |
| 145 | intro c u |
| 146 | ext s |
| 147 | exact intervalIntegral.integral_smul c (extendPath u) } |
| 148 | 1 (fun u => by simpa using norm_pathIntegral_le u) |
| 149 | |
| 150 | @[simp] theorem pathIntegralCLM_apply (u : Path E) : pathIntegralCLM u = pathIntegral u := rfl |
| 151 | |
| 152 | abbrev Parameters (E : Type*) := ℝ × (ℝ × E) |
| 153 | |
| 154 | def timePath (q : Parameters E) : Path ℝ := |
| 155 | ContinuousMap.const UnitInterval q.1 + q.2.1 • unitParameter |
| 156 | |
| 157 | def spacetimePath (q : Parameters E × Path E) : Path (ℝ × E) := |
| 158 | (ContinuousLinearMap.inl ℝ ℝ E).compLeftContinuous ℝ UnitInterval (timePath q.1) + |
| 159 | (ContinuousLinearMap.inr ℝ ℝ E).compLeftContinuous ℝ UnitInterval q.2 |
| 160 | |
| 161 | @[simp] theorem spacetimePath_apply (q : Parameters E × Path E) (s : UnitInterval) : |
| 162 | spacetimePath q s = (q.1.1 + q.1.2.1 * s, q.2 s) := by |
| 163 | simp [spacetimePath, timePath, unitParameter] |
| 164 | |
| 165 | theorem contDiff_timePath : ContDiff ℝ ∞ (timePath (E := E)) := by |
| 166 | exact ((ContinuousLinearMap.const ℝ UnitInterval : ℝ →L[ℝ] Path ℝ).contDiff.comp |
| 167 | contDiff_fst).add |
| 168 | (contDiff_snd.fst.smul contDiff_const) |
| 169 | |
| 170 | theorem contDiff_spacetimePath : ContDiff ℝ ∞ (spacetimePath (E := E)) := by |
| 171 | exact (((ContinuousLinearMap.inl ℝ ℝ E).compLeftContinuous ℝ UnitInterval).contDiff.comp |
| 172 | (contDiff_timePath.comp contDiff_fst)).add |
| 173 | (((ContinuousLinearMap.inr ℝ ℝ E).compLeftContinuous ℝ UnitInterval).contDiff.comp |
| 174 | contDiff_snd) |
| 175 | |
| 176 | def residual (f : C(ℝ × E, E)) (q : Parameters E × Path E) : Path E := |
| 177 | q.2 - ContinuousMap.const UnitInterval q.1.2.2 - |
| 178 | q.1.2.1 • pathIntegral (f.comp (spacetimePath q)) |
| 179 | |
| 180 | theorem contDiff_residual_of_order {k : ℕ∞} (f : C(ℝ × E, E)) |
| 181 | (hf : ContDiff ℝ k (f : ℝ × E → E)) : |
| 182 | ContDiff ℝ k (residual f) := by |
| 183 | have hsource := |
| 184 | (ContinuousPathCompositionNative.contDiff_postcomp_of_order UnitInterval f hf).comp |
| 185 | (contDiff_spacetimePath.of_le (WithTop.coe_le_coe.mpr le_top)) |
| 186 | exact (contDiff_snd.sub |
| 187 | ((ContinuousLinearMap.const ℝ UnitInterval).contDiff.comp contDiff_fst.snd.snd)).sub |
| 188 | (contDiff_fst.snd.fst.smul (pathIntegralCLM.contDiff.comp hsource)) |
| 189 | |
| 190 | theorem contDiff_residual (f : C(ℝ × E, E)) (hf : ContDiff ℝ ∞ (f : ℝ × E → E)) : |
| 191 | ContDiff ℝ ∞ (residual f) := |
| 192 | contDiff_residual_of_order f hf |
| 193 | |
| 194 | @[simp] theorem residual_zero_time (f : C(ℝ × E, E)) (a : ℝ) (x : E) (u : Path E) : |
| 195 | residual f ((a, (0, x)), u) = u - ContinuousMap.const UnitInterval x := by |
| 196 | simp [residual] |
| 197 | |
| 198 | set_option backward.isDefEq.respectTransparency false in |
| 199 | theorem residual_partial_zero_time_of_order {k : ℕ∞} (f : C(ℝ × E, E)) |
| 200 | (hf : ContDiff ℝ k (f : ℝ × E → E)) (hk : k ≠ 0) (a : ℝ) (x : E) : |
| 201 | fderiv ℝ (residual f) ((a, (0, x)), ContinuousMap.const UnitInterval x) ∘L |
| 202 | ContinuousLinearMap.inr ℝ (Parameters E) (Path E) = |
| 203 | ContinuousLinearMap.id ℝ (Path E) := by |
| 204 | have hfull := ((contDiff_residual_of_order f hf).differentiable (by exact_mod_cast hk) |
| 205 | ((a, (0, x)), ContinuousMap.const UnitInterval x)).hasFDerivAt |
| 206 | have hpartial := hfull.comp (ContinuousMap.const UnitInterval x) |
| 207 | (hasFDerivAt_prodMk_right (a, (0, x)) (ContinuousMap.const UnitInterval x)) |
| 208 | have hsimple : HasFDerivAt (fun u : Path E => residual f ((a, (0, x)), u)) |
| 209 | (ContinuousLinearMap.id ℝ (Path E)) (ContinuousMap.const UnitInterval x) := by |
| 210 | apply HasFDerivAt.of_isLittleOTVS |
| 211 | exact (Asymptotics.IsLittleOTVS.zero _ _).congr_left fun u => by |
| 212 | simp only [residual_zero_time, sub_self, sub_zero, ContinuousLinearMap.id_apply, |
| 213 | Pi.zero_apply] |
| 214 | exact hpartial.unique hsimple |
| 215 | |
| 216 | theorem residual_partial_zero_time (f : C(ℝ × E, E)) |
| 217 | (hf : ContDiff ℝ ∞ (f : ℝ × E → E)) (a : ℝ) (x : E) : |
| 218 | fderiv ℝ (residual f) ((a, (0, x)), ContinuousMap.const UnitInterval x) ∘L |
| 219 | ContinuousLinearMap.inr ℝ (Parameters E) (Path E) = |
| 220 | ContinuousLinearMap.id ℝ (Path E) := |
| 221 | residual_partial_zero_time_of_order f hf (by simp) a x |
| 222 | |
| 223 | theorem exists_smooth_integral_path (f : C(ℝ × E, E)) |
| 224 | (hf : ContDiff ℝ ∞ (f : ℝ × E → E)) (a : ℝ) (x : E) : |
| 225 | ∃ U : Parameters E → Path E, |
| 226 | U (a, (0, x)) = ContinuousMap.const UnitInterval x ∧ |
| 227 | ContDiffAt ℝ ∞ U (a, (0, x)) ∧ |
| 228 | ∀ᶠ q in 𝓝 (a, (0, x)), |
| 229 | U q = ContinuousMap.const UnitInterval q.2.2 + |
| 230 | q.2.1 • pathIntegral (f.comp (spacetimePath (q, U q))) := by |
| 231 | let b : Parameters E × Path E := ((a, (0, x)), ContinuousMap.const UnitInterval x) |
| 232 | have hR : ContDiffAt ℝ ∞ (residual f) b := (contDiff_residual f hf).contDiffAt |
| 233 | have hinv : (fderiv ℝ (residual f) b ∘L |
| 234 | ContinuousLinearMap.inr ℝ (Parameters E) (Path E)).IsInvertible := by |
| 235 | rw [residual_partial_zero_time f hf a x] |
| 236 | exact ⟨ContinuousLinearEquiv.refl ℝ (Path E), rfl⟩ |
| 237 | let U := hR.implicitFunction (by simp) hinv |
| 238 | refine ⟨U, hR.implicitFunction_apply_self (by simp) hinv, |
| 239 | hR.contDiffAt_implicitFunction (by simp) hinv, ?_⟩ |
| 240 | filter_upwards [hR.eventually_apply_implicitFunction (by simp) hinv] with q hq |
| 241 | have hzero : residual f (q, U q) = 0 := by |
| 242 | simpa [b, residual_zero_time] using hq |
| 243 | change U q - ContinuousMap.const UnitInterval q.2.2 - |
| 244 | q.2.1 • pathIntegral (f.comp (spacetimePath (q, U q))) = 0 at hzero |
| 245 | simpa only [add_comm] using sub_eq_iff_eq_add.mp (sub_eq_zero.mp hzero) |
| 246 | |
| 247 | theorem exists_contDiff_integral_path_on {k : ℕ∞} (f : C(ℝ × E, E)) |
| 248 | (hf : ContDiff ℝ k (f : ℝ × E → E)) (hk : k ≠ 0) (a : ℝ) (x : E) : |
| 249 | ∃ U : Parameters E → Path E, ∃ S : Set (Parameters E), |
| 250 | IsOpen S ∧ (a, (0, x)) ∈ S ∧ ContDiffOn ℝ k U S ∧ |
| 251 | U (a, (0, x)) = ContinuousMap.const UnitInterval x ∧ |
| 252 | (∀ q ∈ S, U q = ContinuousMap.const UnitInterval q.2.2 + |
| 253 | q.2.1 • pathIntegral (f.comp (spacetimePath (q, U q)))) ∧ |
| 254 | ∀ᶠ v in 𝓝 ((a, (0, x)), ContinuousMap.const UnitInterval x), |
| 255 | residual f v = 0 → U v.1 = v.2 := by |
| 256 | have hinv : (fderiv ℝ (residual f) |
| 257 | ((a, (0, x)), ContinuousMap.const UnitInterval x) ∘L |
| 258 | ContinuousLinearMap.inr ℝ (Parameters E) (Path E)).IsInvertible := by |
| 259 | rw [residual_partial_zero_time_of_order f hf hk a x] |
| 260 | exact ⟨ContinuousLinearEquiv.refl ℝ (Path E), rfl⟩ |
| 261 | obtain ⟨U, S, hSo, hb, hU, hUb, hEq, hUnique⟩ := |
| 262 | exists_contDiff_implicit_on (residual f) (contDiff_residual_of_order f hf) hk |
| 263 | ((a, (0, x)), ContinuousMap.const UnitInterval x) hinv |
| 264 | refine ⟨U, S, hSo, hb, hU, hUb, ?_, ?_⟩ |
| 265 | · intro q hq |
| 266 | have hzero : residual f (q, U q) = 0 := by |
| 267 | simpa only [residual_zero_time, sub_self] using hEq q hq |
| 268 | change U q - ContinuousMap.const UnitInterval q.2.2 - |
| 269 | q.2.1 • pathIntegral (f.comp (spacetimePath (q, U q))) = 0 at hzero |
| 270 | simpa only [add_comm] using sub_eq_iff_eq_add.mp (sub_eq_zero.mp hzero) |
| 271 | · simpa only [residual_zero_time, sub_self] using hUnique |
| 272 | |
| 273 | theorem exists_smooth_integral_path_on (f : C(ℝ × E, E)) |
| 274 | (hf : ContDiff ℝ ∞ (f : ℝ × E → E)) (a : ℝ) (x : E) : |
| 275 | ∃ U : Parameters E → Path E, ∃ S : Set (Parameters E), |
| 276 | IsOpen S ∧ (a, (0, x)) ∈ S ∧ ContDiffOn ℝ ∞ U S ∧ |
| 277 | U (a, (0, x)) = ContinuousMap.const UnitInterval x ∧ |
| 278 | (∀ q ∈ S, U q = ContinuousMap.const UnitInterval q.2.2 + |
| 279 | q.2.1 • pathIntegral (f.comp (spacetimePath (q, U q)))) ∧ |
| 280 | ∀ᶠ v in 𝓝 ((a, (0, x)), ContinuousMap.const UnitInterval x), |
| 281 | residual f v = 0 → U v.1 = v.2 := |
| 282 | exists_contDiff_integral_path_on f hf (by simp) a x |
| 283 | |
| 284 | end PoincareMT.ImplicitLocalFlowNative |
| 285 | |
| 286 | end |