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 Mathlib.Geometry.Manifold.LocalDiffeomorph |
| 2 | |
| 3 | /-! |
| 4 | # Local diffeomorphisms and changes of source coordinates |
| 5 | |
| 6 | Local diffeomorphisms depend only on the germ of a map. Cancelling a local |
| 7 | diffeomorphism on the source therefore preserves this property. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | open Set Filter Topology |
| 12 | open scoped Manifold ContDiff |
| 13 | |
| 14 | section |
| 15 | |
| 16 | variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 17 | {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 18 | {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] |
| 19 | {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] |
| 20 | {H : Type*} [TopologicalSpace H] |
| 21 | {H' : Type*} [TopologicalSpace H'] |
| 22 | {H'' : Type*} [TopologicalSpace H''] |
| 23 | {I : ModelWithCorners 𝕜 E H} {J : ModelWithCorners 𝕜 F H'} |
| 24 | {K : ModelWithCorners 𝕜 G H''} |
| 25 | {M : Type*} [TopologicalSpace M] [ChartedSpace H M] |
| 26 | {N : Type*} [TopologicalSpace N] [ChartedSpace H' N] |
| 27 | {P : Type*} [TopologicalSpace P] [ChartedSpace H'' P] |
| 28 | {r : ℕ∞ω} |
| 29 | |
| 30 | theorem IsLocalDiffeomorphAt.congr_of_eventuallyEq |
| 31 | {f g : M → N} {x : M} (hf : IsLocalDiffeomorphAt I J r f x) |
| 32 | (hgf : g =ᶠ[𝓝 x] f) : IsLocalDiffeomorphAt I J r g x := by |
| 33 | obtain ⟨e, hx, he⟩ := hf |
| 34 | obtain ⟨U, hUeq, hU, hxU⟩ := mem_nhds_iff.mp hgf |
| 35 | let e' := e.toOpenPartialHomeomorph.restrOpen U hU |
| 36 | let d : PartialDiffeomorph I J M N r := |
| 37 | { toPartialEquiv := e'.toPartialEquiv |
| 38 | open_source := e'.open_source |
| 39 | open_target := e'.open_target |
| 40 | contMDiffOn_toFun := e.contMDiffOn_toFun.mono inter_subset_left |
| 41 | contMDiffOn_invFun := e.contMDiffOn_invFun.mono inter_subset_left } |
| 42 | refine ⟨d, ⟨hx, hxU⟩, ?_⟩ |
| 43 | intro y hy |
| 44 | exact (hUeq hy.2).trans (he hy.1) |
| 45 | |
| 46 | theorem IsLocalDiffeomorphAt.of_comp |
| 47 | {q : M → N} {f : N → P} {x : M} |
| 48 | (hq : IsLocalDiffeomorphAt I J r q x) |
| 49 | (hf : IsLocalDiffeomorphAt I K r (f ∘ q) x) : |
| 50 | IsLocalDiffeomorphAt J K r f (q x) := by |
| 51 | have hf' : IsLocalDiffeomorphAt I K r (f ∘ q) (hq.localInverse (q x)) := by |
| 52 | rw [hq.localInverse_left_inv hq.localInverse_mem_target] |
| 53 | exact hf |
| 54 | apply (hq.localInverse_isLocalDiffeomorphAt.comp K P hf').congr_of_eventuallyEq |
| 55 | filter_upwards [hq.localInverse_eventuallyEq_right] with y hy |
| 56 | exact congrArg f hy.symm |
| 57 | |
| 58 | end |
| 59 | |
| 60 | namespace Poincare |
| 61 | |
| 62 | theorem isLocalDiffeomorph_subtypeVal |
| 63 | {𝕜 : Type*} [NontriviallyNormedField 𝕜] |
| 64 | {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] |
| 65 | {H : Type*} [TopologicalSpace H] |
| 66 | (I : ModelWithCorners 𝕜 E H) (U : Set H) (hU : IsOpen U) |
| 67 | [Nonempty U] (r : ℕ∞ω) : |
| 68 | letI := hU.isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 69 | IsLocalDiffeomorph I I r (Subtype.val : U → H) := by |
| 70 | let := hU.isOpenEmbedding_subtypeVal.singletonChartedSpace |
| 71 | let e := hU.isOpenEmbedding_subtypeVal.toOpenPartialHomeomorph |
| 72 | let d : PartialDiffeomorph I I U H r := |
| 73 | { toPartialEquiv := e.toPartialEquiv |
| 74 | open_source := e.open_source |
| 75 | open_target := e.open_target |
| 76 | contMDiffOn_toFun := (contMDiff_isOpenEmbedding |
| 77 | (I := I) (n := r) hU.isOpenEmbedding_subtypeVal).contMDiffOn |
| 78 | contMDiffOn_invFun := by |
| 79 | simpa [e] using contMDiffOn_isOpenEmbedding_symm |
| 80 | (I := I) (n := r) hU.isOpenEmbedding_subtypeVal } |
| 81 | intro x |
| 82 | exact ⟨d, mem_univ x, fun _ _ => rfl⟩ |
| 83 | |
| 84 | end Poincare |