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.ReducedGeometry.ReducedLength.Calculus.LocalSmoothInverse |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace |
| 3 | import Mathlib.Geometry.Manifold.ContMDiff.Atlas |
| 4 | import Mathlib.Geometry.Manifold.MFDeriv.Atlas |
| 5 | |
| 6 | /-! |
| 7 | # A local inverse into an ordinary manifold |
| 8 | |
| 9 | The chart reduction keeps all source and target restrictions explicit. |
| 10 | Forward agreement is asserted on the source of the constructed inverse. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {E F N : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 21 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 22 | [FiniteDimensional ℝ E] [FiniteDimensional ℝ F] |
| 23 | [TopologicalSpace N] [ChartedSpace F N] [IsManifold (𝓘(ℝ, F)) ∞ N] |
| 24 | |
| 25 | set_option backward.isDefEq.respectTransparency false in |
| 26 | theorem exists_manifold_local_inverse (f : E → N) (S : Set E) (hS : IsOpen S) |
| 27 | (hf : ContMDiffOn (𝓘(ℝ, E)) (𝓘(ℝ, F)) ∞ f S) (x : E) (hx : x ∈ S) |
| 28 | (hbij : Function.Bijective (mfderiv (𝓘(ℝ, E)) (𝓘(ℝ, F)) f x)) : |
| 29 | ∃ e : OpenPartialHomeomorph E N, x ∈ e.source ∧ e.source ⊆ S ∧ |
| 30 | Set.EqOn (e : E → N) f e.source ∧ |
| 31 | ContMDiffOn (𝓘(ℝ, F)) (𝓘(ℝ, E)) ∞ e.symm e.target ∧ |
| 32 | ∀ y ∈ e.source, Function.Bijective (mfderiv (𝓘(ℝ, E)) (𝓘(ℝ, F)) f y) := by |
| 33 | let c := chartAt F (f x) |
| 34 | let D := S ∩ f ⁻¹' c.source |
| 35 | let g : E → F := fun y ↦ c (f y) |
| 36 | have hD : IsOpen D := hf.continuousOn.isOpen_inter_preimage hS c.open_source |
| 37 | have hxD : x ∈ D := ⟨hx, mem_chart_source F (f x)⟩ |
| 38 | have hg : ContDiffOn ℝ ∞ g D := |
| 39 | (contMDiffOn_chart.comp (hf.mono Set.inter_subset_left) (fun y hy ↦ hy.2)).contDiffOn |
| 40 | have hchain (y : E) (hy : y ∈ D) : fderiv ℝ g y = |
| 41 | (mfderiv (𝓘(ℝ, F)) (𝓘(ℝ, F)) c (f y)).comp |
| 42 | (mfderiv (𝓘(ℝ, E)) (𝓘(ℝ, F)) f y) := by |
| 43 | have hc := (mdifferentiable_chart (I := 𝓘(ℝ, F)) (f x)).mdifferentiableAt hy.2 |
| 44 | have hfy := (hf.contMDiffAt (hS.mem_nhds hy.1)).mdifferentiableAt (by simp) |
| 45 | have hcomp : HasFDerivAt g |
| 46 | ((mfderiv (𝓘(ℝ, F)) (𝓘(ℝ, F)) c (f y)).comp |
| 47 | (mfderiv (𝓘(ℝ, E)) (𝓘(ℝ, F)) f y)) y := |
| 48 | (hc.hasMFDerivAt.comp y hfy.hasMFDerivAt).hasFDerivAt |
| 49 | exact hcomp.fderiv |
| 50 | have hchart (y : E) (hy : y ∈ D) : |
| 51 | Function.Bijective (mfderiv (𝓘(ℝ, F)) (𝓘(ℝ, F)) c (f y)) := |
| 52 | (mdifferentiable_chart (I := 𝓘(ℝ, F)) (f x)).mfderiv_bijective hy.2 |
| 53 | have hgx : Function.Bijective (fderiv ℝ g x) := by |
| 54 | rw [hchain x hxD] |
| 55 | exact (hchart x hxD).comp hbij |
| 56 | obtain ⟨e0, hx0, h0D, he0, hinv, hderiv⟩ := exists_smooth_local_inverse g D hD hg x hxD hgx |
| 57 | let e := e0.trans c.symm |
| 58 | have hxsrc : x ∈ e.source := by |
| 59 | refine ⟨hx0, ?_⟩ |
| 60 | change e0 x ∈ c.target |
| 61 | rw [he0] |
| 62 | exact c.map_source hxD.2 |
| 63 | have hsrcD : e.source ⊆ D := fun y hy ↦ h0D hy.1 |
| 64 | refine ⟨e, hxsrc, (fun y hy ↦ (hsrcD hy).1), ?_, ?_, ?_⟩ |
| 65 | · intro y hy |
| 66 | change c.symm (e0 y) = f y |
| 67 | rw [he0] |
| 68 | exact c.left_inv (hsrcD hy).2 |
| 69 | · have hc : ContMDiffOn (𝓘(ℝ, F)) (𝓘(ℝ, F)) ∞ c e.target := |
| 70 | contMDiffOn_chart.mono (fun y hy ↦ hy.1) |
| 71 | exact hinv.contMDiffOn.comp hc (fun y hy ↦ hy.2) |
| 72 | · intro y hy |
| 73 | have hb := hderiv y hy.1 |
| 74 | rw [hchain y (hsrcD hy)] at hb |
| 75 | constructor |
| 76 | · intro v w hvw |
| 77 | apply hb.1 |
| 78 | exact congrArg (mfderiv (𝓘(ℝ, F)) (𝓘(ℝ, F)) c (f y)) hvw |
| 79 | · intro v |
| 80 | obtain ⟨w, hw⟩ := hb.2 (mfderiv (𝓘(ℝ, F)) (𝓘(ℝ, F)) c (f y) v) |
| 81 | exact ⟨w, (hchart y (hsrcD hy)).1 hw⟩ |
| 82 | |
| 83 | end PoincareMT.ReducedLength |