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.AlgebraicTopology.HomotopyGroup.LoopSpace.Comparison.PathClassTopology |
| 2 | import Mathlib.Analysis.Convex.Contractible |
| 3 | import Mathlib.Geometry.Manifold.ChartedSpace |
| 4 | import Mathlib.Analysis.Normed.Module.Convex |
| 5 | |
| 6 | /-! |
| 7 | # Simply connected neighborhoods in charts |
| 8 | |
| 9 | Convex balls provide the simply connected neighborhood basis used by the |
| 10 | path-class cover. It transfers through charts and also applies to convex |
| 11 | subspaces such as the unit interval. Source: Hatcher, Section 1.3, printed |
| 12 | pp. 63-65; used in MT Claim 18.16, p. 430. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Metric |
| 18 | open scoped unitInterval Topology |
| 19 | |
| 20 | universe u v |
| 21 | |
| 22 | namespace LocallySimplyConnectedSpace |
| 23 | |
| 24 | /-- Normed real spaces have a basis of convex, hence simply connected, balls. |
| 25 | Source: Hatcher, Section 1.3, printed p. 63. -/ |
| 26 | instance of_normedSpace {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] : |
| 27 | LocallySimplyConnectedSpace E where |
| 28 | exists_open_simplyConnected x U hx hU := by |
| 29 | obtain ⟨r, hr, hsub⟩ := Metric.isOpen_iff.mp hU x hx |
| 30 | have : ContractibleSpace (ball x r) := |
| 31 | (convex_ball x r).contractibleSpace ⟨x, mem_ball_self hr⟩ |
| 32 | exact ⟨ball x r, isOpen_ball, (inferInstance : SimplyConnectedSpace (ball x r)), |
| 33 | mem_ball_self hr, hsub⟩ |
| 34 | |
| 35 | /-- Relative balls in a convex subspace are again simply connected. |
| 36 | Source: Hatcher, Section 1.3, printed p. 63. -/ |
| 37 | theorem of_convex {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 38 | {s : Set E} (hs : Convex ℝ s) : LocallySimplyConnectedSpace s where |
| 39 | exists_open_simplyConnected x U hx hU := by |
| 40 | obtain ⟨r, hr, hsub⟩ := Metric.isOpen_iff.mp hU x hx |
| 41 | have : ContractibleSpace ↥(ball (x : E) r ∩ s) := |
| 42 | ((convex_ball (x : E) r).inter hs).contractibleSpace ⟨x, mem_ball_self hr, x.2⟩ |
| 43 | have him : IsSimplyConnected (Subtype.val '' ball x r : Set E) := by |
| 44 | rw [Subtype.image_ball] |
| 45 | exact (inferInstance : SimplyConnectedSpace ↥(ball (x : E) r ∩ s)) |
| 46 | have hsc := Topology.IsEmbedding.subtypeVal.isSimplyConnected_image.mp him |
| 47 | exact ⟨ball x r, isOpen_ball, hsc, mem_ball_self hr, hsub⟩ |
| 48 | |
| 49 | /-- In particular the interval has open simply connected relative neighborhoods. |
| 50 | Source: Hatcher, Section 1.3, printed p. 63. -/ |
| 51 | instance unitInterval : LocallySimplyConnectedSpace I := |
| 52 | of_convex (convex_Icc (0 : ℝ) 1) |
| 53 | |
| 54 | /-- An open partial homeomorphism transfers simply connected neighborhoods |
| 55 | from its target. Source: Hatcher, Section 1.3, printed p. 63. -/ |
| 56 | theorem exists_of_openPartialHomeomorph |
| 57 | {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] |
| 58 | [LocallySimplyConnectedSpace Y] (e : OpenPartialHomeomorph X Y) |
| 59 | {x : X} (hx : x ∈ e.source) {U : Set X} (hxU : x ∈ U) (hU : IsOpen U) : |
| 60 | ∃ W : Set X, IsOpen W ∧ IsSimplyConnected W ∧ x ∈ W ∧ W ⊆ U := by |
| 61 | obtain ⟨V, hV, hscV, hxV, hsub⟩ := exists_open_simplyConnected (e x) |
| 62 | (e.target ∩ e.symm ⁻¹' U) |
| 63 | ⟨e.map_source hx, by change e.symm (e x) ∈ U; simpa only [e.left_inv hx]⟩ |
| 64 | (e.isOpen_inter_preimage_symm hU) |
| 65 | have htarget : V ⊆ e.target := hsub.trans inter_subset_left |
| 66 | have he : e '' (e.source ∩ e ⁻¹' V) = V := by |
| 67 | apply Set.Subset.antisymm |
| 68 | · rintro _ ⟨y, hy, rfl⟩ |
| 69 | exact hy.2 |
| 70 | · intro y hy |
| 71 | exact ⟨e.symm y, ⟨e.map_target (htarget hy), |
| 72 | by change e (e.symm y) ∈ V; simpa only [e.right_inv (htarget hy)]⟩, |
| 73 | e.right_inv (htarget hy)⟩ |
| 74 | have : SimplyConnectedSpace V := hscV |
| 75 | have hsc : IsSimplyConnected (e.source ∩ e ⁻¹' V) := |
| 76 | (e.homeomorphOfImageSubsetSource inter_subset_left he).toHomotopyEquiv.simplyConnectedSpace |
| 77 | refine ⟨e.source ∩ e ⁻¹' V, e.isOpen_inter_preimage hV, hsc, ⟨hx, hxV⟩, ?_⟩ |
| 78 | intro y hy |
| 79 | have h := (hsub hy.2).2 |
| 80 | change e.symm (e y) ∈ U at h |
| 81 | simpa only [e.left_inv hy.1] using h |
| 82 | |
| 83 | end LocallySimplyConnectedSpace |
| 84 | |
| 85 | /-- A space charted over a locally simply connected model has the same |
| 86 | neighborhood property. Source: Hatcher, Section 1.3, printed p. 63. -/ |
| 87 | theorem ChartedSpace.locallySimplyConnectedSpace |
| 88 | (H : Type u) [TopologicalSpace H] [LocallySimplyConnectedSpace H] |
| 89 | (M : Type v) [TopologicalSpace M] [ChartedSpace H M] : LocallySimplyConnectedSpace M where |
| 90 | exists_open_simplyConnected x _U hx hU := |
| 91 | LocallySimplyConnectedSpace.exists_of_openPartialHomeomorph (chartAt H x) |
| 92 | (mem_chart_source H x) hx hU |