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.Surgery.StandardCap.Existence.Analysis.Basic.PartialImageTopology |
| 2 | import Mathlib.Geometry.Manifold.ContMDiff.Basic |
| 3 | import Mathlib.Geometry.Manifold.MFDeriv.FDeriv |
| 4 | import Mathlib.Geometry.Manifold.MFDeriv.NormedSpace |
| 5 | |
| 6 | /-! |
| 7 | # Regular local sublevels under actual smooth partial maps |
| 8 | |
| 9 | The defining function is composed with the actual inverse and its nonzero |
| 10 | differential is evaluated on the actual pushed tangent vector. Source: |
| 11 | Definition 9.72 and Proposition 9.79(3), pp. 230-234; |
| 12 | cap-image-topology.md. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter |
| 18 | open scoped Manifold ContDiff Bundle Topology |
| 19 | |
| 20 | namespace OpenPartialHomeomorph |
| 21 | |
| 22 | variable {E F H H' M X : Type*} |
| 23 | [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 24 | [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 25 | [TopologicalSpace H] [TopologicalSpace H'] |
| 26 | {I : ModelWithCorners ℝ E H} {J : ModelWithCorners ℝ F H'} |
| 27 | [TopologicalSpace M] [TopologicalSpace X] [ChartedSpace H M] [ChartedSpace H' X] |
| 28 | |
| 29 | /-- An actual smooth partial homeomorphism transports a regular local |
| 30 | sublevel into any captured open neighborhood of its base point. |
| 31 | No metric, completeness or uniform neighborhood size is assumed. -/ |
| 32 | theorem exists_regular_sublevel_on_image |
| 33 | {m : ℕ∞ω} (hm : 1 ≤ m) |
| 34 | (e : OpenPartialHomeomorph M X) |
| 35 | (hf : ContMDiffOn I J m e e.source) (hi : ContMDiffOn J I m e.symm e.target) |
| 36 | {S W : Set M} (hS : S ⊆ e.source) (hW : IsOpen W) (hWs : W ⊆ e.source) |
| 37 | {x : M} (hxW : x ∈ W) |
| 38 | (hlocal : ∃ U : Set M, ∃ f : M → ℝ, |
| 39 | IsOpen U ∧ x ∈ U ∧ (∀ y ∈ U, y ∈ S ↔ f y ≤ 0) ∧ f x = 0 ∧ |
| 40 | ContMDiffOn I 𝓘(ℝ, ℝ) m f U ∧ |
| 41 | ∃ d : TangentSpace I x, mvfderiv I f x d ≠ 0) : |
| 42 | ∃ V : Set X, ∃ g : X → ℝ, |
| 43 | IsOpen V ∧ e x ∈ V ∧ V ⊆ e '' W ∧ |
| 44 | (∀ y ∈ V, y ∈ e '' S ↔ g y ≤ 0) ∧ g (e x) = 0 ∧ |
| 45 | ContMDiffOn J 𝓘(ℝ, ℝ) m g V ∧ |
| 46 | ∃ d : TangentSpace J (e x), d ≠ 0 ∧ mvfderiv J g (e x) d ≠ 0 := by |
| 47 | have hm0 : m ≠ 0 := by |
| 48 | intro hzero |
| 49 | simp [hzero] at hm |
| 50 | obtain ⟨U, f, hU, hxU, hdefine, hzero, hsmooth, d, hd⟩ := hlocal |
| 51 | let V := e '' (U ∩ W) |
| 52 | let g : X → ℝ := f ∘ e.symm |
| 53 | have hUW : U ∩ W ⊆ e.source := fun _ hz => hWs hz.2 |
| 54 | have hVo : IsOpen V := e.isOpen_image_of_subset_source (hU.inter hW) hUW |
| 55 | have hxV : e x ∈ V := ⟨x, ⟨hxU, hxW⟩, rfl⟩ |
| 56 | have hVt : V ⊆ e.target := by |
| 57 | rintro _ ⟨z, hz, rfl⟩ |
| 58 | exact e.map_source (hUW hz) |
| 59 | have hmap : MapsTo e.symm V U := by |
| 60 | rintro _ ⟨z, hz, rfl⟩ |
| 61 | simpa only [e.left_inv (hUW hz)] using hz.1 |
| 62 | have hg : ContMDiffOn J 𝓘(ℝ, ℝ) m g V := |
| 63 | hsmooth.comp (hi.mono hVt) hmap |
| 64 | have hxs := hWs hxW |
| 65 | have hfa := ((hf x hxs).contMDiffAt (e.open_source.mem_nhds hxs)).mdifferentiableAt |
| 66 | hm0 |
| 67 | have hga := ((hg (e x) hxV).contMDiffAt (hVo.mem_nhds hxV)).mdifferentiableAt hm0 |
| 68 | have heq : g ∘ e =ᶠ[𝓝 x] f := by |
| 69 | filter_upwards [e.open_source.mem_nhds hxs] with z hz |
| 70 | simp only [g, Function.comp_apply, e.left_inv hz] |
| 71 | have hderiv := heq.mfderiv_eq (I := I) (I' := 𝓘(ℝ, ℝ)) |
| 72 | have hread : mvfderiv J g (e x) (mfderiv I J e x d) = mvfderiv I f x d := by |
| 73 | change mfderiv J 𝓘(ℝ, ℝ) g (e x) (mfderiv I J e x d) = |
| 74 | mfderiv I 𝓘(ℝ, ℝ) f x d |
| 75 | exact (mfderiv_comp_apply x hga hfa d).symm.trans (congrArg (fun A => A d) hderiv) |
| 76 | have hnonzero : mvfderiv J g (e x) (mfderiv I J e x d) ≠ 0 := hread ▸ hd |
| 77 | refine ⟨V, g, hVo, hxV, image_mono inter_subset_right, ?_, ?_, hg, |
| 78 | mfderiv I J e x d, ?_, hnonzero⟩ |
| 79 | · rintro y ⟨z, hz, rfl⟩ |
| 80 | rw [(e.isImage_image_of_subset_source hS).apply_mem_iff (hUW hz)] |
| 81 | simpa only [g, Function.comp_apply, e.left_inv (hUW hz)] using hdefine z hz.1 |
| 82 | · simpa only [g, Function.comp_apply, e.left_inv hxs] using hzero |
| 83 | · intro hzero |
| 84 | exact hnonzero (by rw [hzero, map_zero]) |
| 85 | |
| 86 | end OpenPartialHomeomorph |