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.Generalized.BoundedDistance.GeometryImports |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.PartialLimits.Geometry.InverseOpenDistance |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.BoundedDistance.PartialLimits.RegularSets.OpenCapture |
| 4 | |
| 5 | /-! |
| 6 | # Regularity from a buffered compact inverse image |
| 7 | |
| 8 | Small intrinsic balls in an actual open image have compact closure when |
| 9 | the inverse is distance controlled and lands in a compact subset of the |
| 10 | domain. The proved first-exit theorem then captures ambient balls. Source: |
| 11 | Morgan--Tian Definition 5.1 and Theorem 5.6, pp. 83-87; M28 derivation 122. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open Set |
| 18 | open scoped Manifold ContDiff ENNReal Topology |
| 19 | |
| 20 | namespace PoincareMT.M28 |
| 21 | |
| 22 | variable {M N : Type*} [TopologicalSpace M] [TopologicalSpace N] [T2Space N] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) N] |
| 25 | [IsManifold (𝓡 3) ∞ M] [IsManifold (𝓡 3) ∞ N] |
| 26 | |
| 27 | /-- A compact inverse buffer gives regularity for the intrinsic metric of |
| 28 | the actual open image, with any positive comparison constant. Source: |
| 29 | Definition 5.1, p. 83, and Theorem 5.6; M28 derivation 132. -/ |
| 30 | theorem mem_intrinsicImage_regularPoints_of_compact_inverse_buffer |
| 31 | (g : RiemannianMetric 3 M) (h : RiemannianMetric 3 N) |
| 32 | (e : PartialDiffeomorph (𝓡 3) (𝓡 3) M N ∞) |
| 33 | (V : TopologicalSpace.Opens M) (hVs : (V : Set M) ⊆ e.source) |
| 34 | {K : Set M} (hK : IsCompact K) (hKV : K ⊆ (V : Set M)) |
| 35 | {C : ℝ} (hC : 0 < C) |
| 36 | (hbound : ∀ x ∈ (V : Set M), ∀ v : TangentSpace (𝓡 3) x, |
| 37 | g.inner x v v ≤ C ^ 2 * h.inner (e x) |
| 38 | (mfderiv (𝓡 3) (𝓡 3) e x v) (mfderiv (𝓡 3) (𝓡 3) e x v)) |
| 39 | {x : M} (hx : x ∈ (V : Set M)) {delta : ℝ} (hdelta : 0 < delta) |
| 40 | (hball : g.ball x (C * delta) ⊆ K) : |
| 41 | let U : TopologicalSpace.Opens N := |
| 42 | ⟨e '' (V : Set M), e.toOpenPartialHomeomorph.isOpen_image_of_subset_source |
| 43 | V.isOpen hVs⟩ |
| 44 | (⟨e x, x, hx, rfl⟩ : U) ∈ regularPoints (intrinsicOpenMetric h U) delta := by |
| 45 | let U : TopologicalSpace.Opens N := |
| 46 | ⟨e '' (V : Set M), e.toOpenPartialHomeomorph.isOpen_image_of_subset_source |
| 47 | V.isOpen hVs⟩ |
| 48 | have hU : (U : Set N) ⊆ e.target := by |
| 49 | rintro _ ⟨z, hz, rfl⟩ |
| 50 | exact e.toPartialEquiv.map_source (hVs hz) |
| 51 | let p : U := ⟨e x, x, hx, rfl⟩ |
| 52 | have hleft : e.symm (p : N) = x := |
| 53 | e.toPartialEquiv.left_inv (hVs hx) |
| 54 | have hdist (q : U) : g.edist x (e.symm (q : N)) ≤ |
| 55 | ENNReal.ofReal C * (intrinsicOpenMetric h U).edist p q := by |
| 56 | rw [← hleft] |
| 57 | apply inverse_edist_le_intrinsicOpenMetric g h e U hU hC |
| 58 | intro y hy v |
| 59 | have hyV : e.symm y ∈ (V : Set M) := by |
| 60 | obtain ⟨z, hz, rfl⟩ := hy |
| 61 | rw [show e.symm (e z) = z from e.toPartialEquiv.left_inv (hVs hz)] |
| 62 | exact hz |
| 63 | exact hbound _ hyV v |
| 64 | have heK : IsCompact (e '' K) := hK.image_of_continuousOn |
| 65 | (e.contMDiffOn.continuousOn.mono (hKV.trans hVs)) |
| 66 | have heKU : e '' K ⊆ range (Subtype.val : U → N) := by |
| 67 | rintro _ ⟨z, hz, rfl⟩ |
| 68 | exact ⟨⟨e z, z, hKV hz, rfl⟩, rfl⟩ |
| 69 | have hQ : IsCompact ((Subtype.val : U → N) ⁻¹' (e '' K)) := |
| 70 | Topology.IsInducing.subtypeVal.isCompact_preimage' heK heKU |
| 71 | change p ∈ regularPoints (intrinsicOpenMetric h U) delta |
| 72 | intro r hr |
| 73 | have hsub : (intrinsicOpenMetric h U).ball p r ⊆ |
| 74 | (Subtype.val : U → N) ⁻¹' (e '' K) := by |
| 75 | intro q hq |
| 76 | have hd : g.edist x (e.symm (q : N)) < ENNReal.ofReal (C * delta) := by |
| 77 | calc |
| 78 | g.edist x (e.symm (q : N)) ≤ |
| 79 | ENNReal.ofReal C * (intrinsicOpenMetric h U).edist p q := hdist q |
| 80 | _ < ENNReal.ofReal C * ENNReal.ofReal delta := |
| 81 | (ENNReal.mul_lt_mul_right (ENNReal.ofReal_pos.mpr hC).ne' |
| 82 | ENNReal.ofReal_ne_top) |
| 83 | (hq.trans ((ENNReal.ofReal_lt_ofReal_iff hdelta).mpr hr)) |
| 84 | _ = ENNReal.ofReal (C * delta) := (ENNReal.ofReal_mul hC.le).symm |
| 85 | exact ⟨e.symm (q : N), hball hd, e.toPartialEquiv.right_inv (hU q.property)⟩ |
| 86 | exact hQ.of_isClosed_subset isClosed_closure |
| 87 | ((closure_mono hsub).trans hQ.isClosed.closure_subset) |
| 88 | |
| 89 | /-- A lower metric bound on a precompact domain and a compact buffer |
| 90 | around the tested point produce literal ambient regularity of its image. |
| 91 | Source: Definition 5.1, p. 83, and Theorem 5.6; M28 derivation 122. -/ |
| 92 | theorem mem_regularPoints_of_compact_inverse_buffer |
| 93 | (g : RiemannianMetric 3 M) (h : RiemannianMetric 3 N) |
| 94 | (e : PartialDiffeomorph (𝓡 3) (𝓡 3) M N ∞) |
| 95 | (V : TopologicalSpace.Opens M) (hVc : IsCompact (closure (V : Set M))) |
| 96 | (hVs : closure (V : Set M) ⊆ e.source) |
| 97 | {K : Set M} (hK : IsCompact K) (hKV : K ⊆ (V : Set M)) |
| 98 | (hbound : ∀ x ∈ (V : Set M), ∀ v : TangentSpace (𝓡 3) x, |
| 99 | g.inner x v v ≤ 4 * h.inner (e x) |
| 100 | (mfderiv (𝓡 3) (𝓡 3) e x v) (mfderiv (𝓡 3) (𝓡 3) e x v)) |
| 101 | {x : M} (hx : x ∈ (V : Set M)) {delta : ℝ} (hdelta : 0 < delta) |
| 102 | (hball : g.ball x (2 * delta) ⊆ K) : |
| 103 | e x ∈ regularPoints h delta := by |
| 104 | let U : TopologicalSpace.Opens N := |
| 105 | ⟨e '' (V : Set M), e.toOpenPartialHomeomorph.isOpen_image_of_subset_source |
| 106 | V.isOpen (subset_closure.trans hVs)⟩ |
| 107 | let p : U := ⟨e x, x, hx, rfl⟩ |
| 108 | have hp : p ∈ regularPoints (intrinsicOpenMetric h U) delta := |
| 109 | mem_intrinsicImage_regularPoints_of_compact_inverse_buffer g h e V |
| 110 | (subset_closure.trans hVs) hK hKV (by norm_num : (0 : ℝ) < 2) |
| 111 | (by simpa only [show (2 : ℝ) ^ 2 = 4 by norm_num] using hbound) hx hdelta hball |
| 112 | have hamb := ambient_ball_subset_open_of_intrinsic_regular h U p hp |
| 113 | have heV : IsCompact (e '' closure (V : Set M)) := |
| 114 | hVc.image_of_continuousOn (e.contMDiffOn.continuousOn.mono hVs) |
| 115 | intro r hr |
| 116 | have hsub : h.ball (e x) r ⊆ e '' closure (V : Set M) := by |
| 117 | intro y hy |
| 118 | obtain ⟨z, hz, rfl⟩ := hamb (hy.trans_le (ENNReal.ofReal_le_ofReal hr.le)) |
| 119 | exact ⟨z, subset_closure hz, rfl⟩ |
| 120 | exact heV.of_isClosed_subset isClosed_closure |
| 121 | ((closure_mono hsub).trans heV.isClosed.closure_subset) |
| 122 | |
| 123 | end PoincareMT.M28 |