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.Manifold.InverseFunction.SmoothInverse |
| 2 | import Mathlib.Geometry.Manifold.Diffeomorph |
| 3 | |
| 4 | /-! |
| 5 | # Smooth inverses between different Euclidean model spaces |
| 6 | |
| 7 | The chart proof of the inverse function theorem applies to distinct model |
| 8 | spaces. This includes the product model for a height and a sphere direction. |
| 9 | -/ |
| 10 | |
| 11 | noncomputable section |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | |
| 15 | open Set Filter |
| 16 | open scoped Manifold ContDiff Topology |
| 17 | |
| 18 | namespace Poincare.Geometry.Manifold |
| 19 | |
| 20 | variable {E F : Type*} |
| 21 | [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 22 | [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] |
| 23 | {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] |
| 24 | [ChartedSpace E M] [ChartedSpace F N] |
| 25 | |
| 26 | /-- An invertible differential gives equality of neighborhood filters, for |
| 27 | boundaryless manifolds modeled on possibly distinct Banach spaces. -/ |
| 28 | theorem map_nhds_eq_of_contMDiffAt_bijective_mfderiv_modelSpaces |
| 29 | {f : M → N} {x : M} (hf : ContMDiffAt 𝓘(ℝ, E) 𝓘(ℝ, F) ∞ f x) |
| 30 | (hbij : Function.Bijective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x)) : |
| 31 | map f (𝓝 x) = 𝓝 (f x) := by |
| 32 | let c := extChartAt 𝓘(ℝ, E) x |
| 33 | let d := extChartAt 𝓘(ℝ, F) (f x) |
| 34 | let A := writtenInExtChartAt 𝓘(ℝ, E) 𝓘(ℝ, F) x f |
| 35 | have hA : ContDiffAt ℝ 1 A (c x) := by |
| 36 | simpa [A, c, writtenInExtChartAt, contDiffWithinAt_univ] using |
| 37 | (contMDiffAt_iff.mp (hf.of_le (by simp : (1 : ℕ∞ω) ≤ ∞))).2 |
| 38 | have hderiv : mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x = fderiv ℝ A (c x) := by |
| 39 | rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] |
| 40 | simp [A, c] |
| 41 | have hAbij : Function.Bijective (fderiv ℝ A (c x)) := by rwa [hderiv] at hbij |
| 42 | let L := ContinuousLinearEquiv.ofBijective (fderiv ℝ A (c x)) |
| 43 | (LinearMap.ker_eq_bot.mpr hAbij.1) (LinearMap.range_eq_top.mpr hAbij.2) |
| 44 | have hstrict : HasStrictFDerivAt A (L : E →L[ℝ] F) (c x) := |
| 45 | hA.hasStrictFDerivAt' (hA.differentiableAt (by norm_num)).hasFDerivAt (by norm_num) |
| 46 | have hcmap : map c.symm (𝓝 (c x)) = 𝓝 x := by |
| 47 | simpa [c] using map_extChartAt_symm_nhdsWithin_range (I := 𝓘(ℝ, E)) x |
| 48 | have hdmap : map d.symm (𝓝 (d (f x))) = 𝓝 (f x) := by |
| 49 | simpa [d] using map_extChartAt_symm_nhdsWithin_range (I := 𝓘(ℝ, F)) (f x) |
| 50 | have hfc : Tendsto (f ∘ c.symm) (𝓝 (c x)) (𝓝 (f x)) := |
| 51 | hf.continuousAt.tendsto.comp hcmap.le |
| 52 | have heq : d.symm ∘ A =ᶠ[𝓝 (c x)] f ∘ c.symm := by |
| 53 | filter_upwards [hfc.eventually |
| 54 | ((isOpen_extChartAt_source (I := 𝓘(ℝ, F)) (f x)).mem_nhds |
| 55 | (mem_extChartAt_source (I := 𝓘(ℝ, F)) (f x)))] with y hy |
| 56 | exact d.left_inv hy |
| 57 | have hAx : A (c x) = d (f x) := by simp [A, c, d, writtenInExtChartAt] |
| 58 | calc |
| 59 | map f (𝓝 x) = map (f ∘ c.symm) (𝓝 (c x)) := by rw [← map_map, hcmap] |
| 60 | _ = map (d.symm ∘ A) (𝓝 (c x)) := map_congr heq.symm |
| 61 | _ = map d.symm (map A (𝓝 (c x))) := (map_map ..).symm |
| 62 | _ = map d.symm (𝓝 (A (c x))) := by rw [hstrict.map_nhds_eq_of_equiv] |
| 63 | _ = 𝓝 (f x) := by rw [hAx, hdmap] |
| 64 | |
| 65 | variable [IsManifold 𝓘(ℝ, E) ∞ M] |
| 66 | |
| 67 | /-- A local left inverse is smooth at a point with bijective differential, |
| 68 | even when the source and target use distinct identity model spaces. -/ |
| 69 | theorem contMDiffAt_of_local_left_inverse_modelSpaces |
| 70 | {f : M → N} {g : N → M} {x : M} |
| 71 | (hf : ContMDiffAt 𝓘(ℝ, E) 𝓘(ℝ, F) ∞ f x) |
| 72 | (hbij : Function.Bijective (mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x)) |
| 73 | (hleft : ∀ᶠ z in 𝓝 x, g (f z) = z) : |
| 74 | ContMDiffAt 𝓘(ℝ, F) 𝓘(ℝ, E) ∞ g (f x) := by |
| 75 | let c := extChartAt 𝓘(ℝ, E) x |
| 76 | let d := extChartAt 𝓘(ℝ, F) (f x) |
| 77 | let A := writtenInExtChartAt 𝓘(ℝ, E) 𝓘(ℝ, F) x f |
| 78 | have hA : ContDiffAt ℝ ∞ A (c x) := by |
| 79 | simpa [A, c, writtenInExtChartAt, contDiffWithinAt_univ] using (contMDiffAt_iff.mp hf).2 |
| 80 | have hderiv : mfderiv 𝓘(ℝ, E) 𝓘(ℝ, F) f x = fderiv ℝ A (c x) := by |
| 81 | rw [mfderiv, if_pos (hf.mdifferentiableAt (by simp))] |
| 82 | simp [A, c] |
| 83 | have hAbij : Function.Bijective (fderiv ℝ A (c x)) := by rwa [hderiv] at hbij |
| 84 | let L := ContinuousLinearEquiv.ofBijective (fderiv ℝ A (c x)) |
| 85 | (LinearMap.ker_eq_bot.mpr hAbij.1) (LinearMap.range_eq_top.mpr hAbij.2) |
| 86 | have hdA : HasFDerivAt A (L : E →L[ℝ] F) (c x) := |
| 87 | (hA.differentiableAt (by simp)).hasFDerivAt |
| 88 | let i := hA.localInverse hdA (by simp) |
| 89 | have hi : ContDiffAt ℝ ∞ i (A (c x)) := hA.to_localInverse hdA (by simp) |
| 90 | have hix : i (A (c x)) = c x := hA.localInverse_apply_image hdA (by simp) |
| 91 | have hAx : A (c x) = d (f x) := by simp [A, c, d, writtenInExtChartAt] |
| 92 | have hil : ∀ᶠ z in 𝓝 (c x), i (A z) = z := |
| 93 | (hA.hasStrictFDerivAt' hdA (by simp)).eventually_left_inverse |
| 94 | have hc : ContinuousAt c x := continuousAt_extChartAt x |
| 95 | have heq : g =ᶠ[𝓝 (f x)] fun y => c.symm (i (d y)) := by |
| 96 | rw [← map_nhds_eq_of_contMDiffAt_bijective_mfderiv_modelSpaces hf hbij] |
| 97 | change ∀ᶠ z in 𝓝 x, g (f z) = c.symm (i (d (f z))) |
| 98 | filter_upwards [hleft, hc.tendsto.eventually hil, |
| 99 | (isOpen_extChartAt_source (I := 𝓘(ℝ, E)) x).mem_nhds (mem_extChartAt_source x)] |
| 100 | with z hz hzi hzc |
| 101 | have hAz : A (c z) = d (f z) := by |
| 102 | simp only [A, writtenInExtChartAt, Function.comp_apply] |
| 103 | rw [c.left_inv hzc] |
| 104 | rw [hz, ← hAz, hzi, c.left_inv hzc] |
| 105 | have hd : ContMDiffAt 𝓘(ℝ, F) 𝓘(ℝ, F) ∞ d (f x) := contMDiffAt_extChartAt |
| 106 | have hi' : ContMDiffAt 𝓘(ℝ, F) 𝓘(ℝ, E) ∞ i (d (f x)) := by |
| 107 | rw [← hAx] |
| 108 | exact hi.contMDiffAt |
| 109 | have hcs : ContMDiffAt 𝓘(ℝ, E) 𝓘(ℝ, E) ∞ c.symm (i (d (f x))) := by |
| 110 | rw [← hAx, hix] |
| 111 | exact (contMDiffOn_extChartAt_symm x).contMDiffAt |
| 112 | ((isOpen_extChartAt_target (I := 𝓘(ℝ, E)) x).mem_nhds (mem_extChartAt_target x)) |
| 113 | exact (hcs.comp (f x) (hi'.comp (f x) hd)).congr_of_eventuallyEq heq |
| 114 | |
| 115 | end Poincare.Geometry.Manifold |