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.SmoothDomain.Interior |
| 2 | import PoincareLib.Geometry.Manifold.Interior.LocalPathConnected |
| 3 | |
| 4 | /-! |
| 5 | # Connected components of compact smooth neighborhoods |
| 6 | |
| 7 | The component containing a connected set inherits the boundary charts of a |
| 8 | compact smooth neighborhood, on its actual image in the ambient manifold. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Manifold ContDiff Topology |
| 15 | |
| 16 | namespace Poincare.Manifold |
| 17 | |
| 18 | variable {m : ℕ} {M : Type*} [TopologicalSpace M] |
| 19 | [ChartedSpace (EuclideanSpace ℝ (Fin (m + 1))) M] |
| 20 | {K C : Set M} |
| 21 | [ChartedSpace (EuclideanHalfSpace (m + 1)) K] |
| 22 | [IsManifold (𝓡∂ (m + 1)) ∞ K] |
| 23 | |
| 24 | /-- A connected set inside a compact smooth neighborhood lies in the interior |
| 25 | of one compact connected smooth component of that neighborhood. -/ |
| 26 | theorem exists_connected_smooth_component |
| 27 | (hK : IsCompact K) |
| 28 | (hemb : _root_.Manifold.IsSmoothEmbedding (𝓡∂ (m + 1)) (𝓡 (m + 1)) ∞ |
| 29 | (Subtype.val : K → M)) |
| 30 | (hC : IsConnected C) (hCK : C ⊆ interior K) : |
| 31 | ∃ (L : Set M) (CS : ChartedSpace (EuclideanHalfSpace (m + 1)) L), |
| 32 | L ⊆ K ∧ IsCompact L ∧ IsConnected L ∧ C ⊆ interior L ∧ |
| 33 | @IsManifold ℝ _ _ _ _ _ _ (𝓡∂ (m + 1)) ∞ L _ CS ∧ |
| 34 | _root_.Manifold.IsSmoothEmbedding (𝓡∂ (m + 1)) (𝓡 (m + 1)) ∞ |
| 35 | (Subtype.val : L → M) := by |
| 36 | classical |
| 37 | obtain ⟨p, hp⟩ := hC.nonempty |
| 38 | let pK : K := ⟨p, interior_subset (hCK hp)⟩ |
| 39 | let : LocallyPathConnectedSpace K := manifold_locallyPathConnected (I := 𝓡∂ (m + 1)) |
| 40 | let : CompactSpace K := isCompact_iff_compactSpace.mp hK |
| 41 | let S : TopologicalSpace.Opens K := ⟨connectedComponent pK, isOpen_connectedComponent⟩ |
| 42 | have hS : Nonempty S := ⟨⟨pK, mem_connectedComponent⟩⟩ |
| 43 | let L : Set M := Subtype.val '' (S : Set K) |
| 44 | let e : S ≃ₜ L := Topology.IsEmbedding.subtypeVal.homeomorphImage (S : Set K) |
| 45 | let liftChart := fun c : OpenPartialHomeomorph K (EuclideanHalfSpace (m + 1)) => |
| 46 | (c.subtypeRestr hS).lift_openEmbedding e.isOpenEmbedding |
| 47 | let CS : ChartedSpace (EuclideanHalfSpace (m + 1)) L := { |
| 48 | atlas := liftChart '' IsManifold.maximalAtlas (𝓡∂ (m + 1)) ∞ K |
| 49 | chartAt := fun x => liftChart (chartAt _ (e.symm x).val) |
| 50 | mem_chart_source := by |
| 51 | intro x |
| 52 | refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ |
| 53 | simpa only [OpenPartialHomeomorph.subtypeRestr_source, mem_preimage] using |
| 54 | mem_chart_source (EuclideanHalfSpace (m + 1)) (e.symm x).val |
| 55 | chart_mem_atlas := fun x => |
| 56 | ⟨chartAt _ (e.symm x).val, IsManifold.chart_mem_maximalAtlas _, rfl⟩ } |
| 57 | let := CS |
| 58 | have hman : IsManifold (𝓡∂ (m + 1)) ∞ L := { |
| 59 | compatible := by |
| 60 | rintro _ _ ⟨c, hc, rfl⟩ ⟨d, hd, rfl⟩ |
| 61 | rw [OpenPartialHomeomorph.lift_openEmbedding_trans] |
| 62 | apply (contDiffGroupoid ∞ (𝓡∂ (m + 1))).mem_of_eqOnSource |
| 63 | (closedUnderRestriction' |
| 64 | (StructureGroupoid.compatible_of_mem_maximalAtlas hc hd) |
| 65 | (c.isOpen_inter_preimage_symm S.isOpen)) |
| 66 | exact c.subtypeRestr_symm_trans_subtypeRestr hS d } |
| 67 | let := hman |
| 68 | have hCL : C ⊆ L := by |
| 69 | change C ⊆ Subtype.val '' connectedComponent pK |
| 70 | rw [← connectedComponentIn_eq_image pK.property] |
| 71 | exact |
| 72 | hC.isPreconnected.subset_connectedComponentIn hp |
| 73 | (hCK.trans interior_subset) |
| 74 | have hCLint : C ⊆ interior L := by |
| 75 | intro x hx |
| 76 | obtain ⟨y, hy, rfl⟩ := hCL hx |
| 77 | rw [mem_interior_iff_mem_nhds] |
| 78 | have hs := image_mem_map (m := (Subtype.val : K → M)) (S.isOpen.mem_nhds hy) |
| 79 | rw [Topology.IsEmbedding.subtypeVal.map_nhds_of_mem y (by |
| 80 | simpa only [Subtype.range_coe] using (mem_interior_iff_mem_nhds.mp (hCK hx)))] at hs |
| 81 | exact hs |
| 82 | refine ⟨L, CS, image_subset_iff.mpr (fun y _ => y.property), |
| 83 | isClosed_connectedComponent.isCompact.image continuous_subtype_val, |
| 84 | isConnected_connectedComponent.image _ continuous_subtype_val.continuousOn, |
| 85 | hCLint, hman, ?_⟩ |
| 86 | refine ⟨?_, Topology.IsEmbedding.subtypeVal⟩ |
| 87 | refine ⟨hemb.isImmersion.complement, inferInstance, inferInstance, ?_⟩ |
| 88 | intro x |
| 89 | have hi := hemb.isImmersion.isImmersionOfComplement_complement (e.symm x).val |
| 90 | refine _root_.Manifold.IsImmersionAtOfComplement.mk_of_continuousAt |
| 91 | continuous_subtype_val.continuousAt hi.equiv (liftChart hi.domChart) hi.codChart |
| 92 | ?_ ?_ ?_ hi.codChart_mem_maximalAtlas ?_ |
| 93 | · refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ |
| 94 | simpa only [OpenPartialHomeomorph.subtypeRestr_source, mem_preimage] using |
| 95 | hi.mem_domChart_source |
| 96 | · convert hi.mem_codChart_source using 1 |
| 97 | change (x : M) = (e (e.symm x) : M) |
| 98 | rw [e.apply_symm_apply] |
| 99 | · exact IsManifold.subset_maximalAtlas ⟨hi.domChart, hi.domChart_mem_maximalAtlas, rfl⟩ |
| 100 | · intro z hz |
| 101 | rw [OpenPartialHomeomorph.extend_target] at hz |
| 102 | have hz' : z ∈ (hi.domChart.extend (𝓡∂ (m + 1))).target := by |
| 103 | rw [OpenPartialHomeomorph.extend_target] |
| 104 | exact ⟨hi.domChart.subtypeRestr_target_subset hS hz.1, hz.2⟩ |
| 105 | convert hi.writtenInCharts hz' using 1 |
| 106 | dsimp only [Function.comp_apply, OpenPartialHomeomorph.extend_coe_symm] |
| 107 | apply congrArg (hi.codChart.extend (𝓡 (m + 1))) |
| 108 | exact congrArg (Subtype.val : K → M) (hi.domChart.subtypeRestr_symm_apply hS hz.1) |
| 109 | |
| 110 | end Poincare.Manifold |