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.Tube.IntrinsicGeometry.IntrinsicCompetitors |
| 3 | import PoincareLib.Geometry.Riemannian.Metric.LocalDiffeomorph |
| 4 | |
| 5 | /-! |
| 6 | # The actual metric on a selected open region |
| 7 | |
| 8 | Claim 10.3 of Morgan--Tian, printed pp. 248-249, minimizes among paths in |
| 9 | the selected region. The inclusion pulls back the ambient metric, preserves |
| 10 | the literal lengths of C1 paths, and identifies its distance with the frozen |
| 11 | region infimum. Total inverses are used only on the tested path interval. |
| 12 | See the M28 cap-topology intrinsic-open-metric derivation. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | set_option backward.isDefEq.respectTransparency false |
| 18 | |
| 19 | open Set Filter MeasureTheory |
| 20 | open scoped Manifold ContDiff Topology ENNReal Bundle |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.M28 |
| 25 | |
| 26 | variable {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin 3)) M] |
| 28 | [IsManifold (𝓡 3) ∞ M] |
| 29 | |
| 30 | omit [IsManifold (𝓡 3) ∞ M] in |
| 31 | /-- The actual total inverse of open inclusion is smooth on its true target. -/ |
| 32 | theorem openSubtypeInverse_contMDiffOn (U : TopologicalSpace.Opens M) |
| 33 | (hne : Nonempty U) : |
| 34 | ContMDiffOn (𝓡 3) (𝓡 3) ∞ |
| 35 | (U.openPartialHomeomorphSubtypeCoe hne).symm (U : Set M) := by |
| 36 | let e := U.openPartialHomeomorphSubtypeCoe hne |
| 37 | intro y hy |
| 38 | have heq : (Subtype.val ∘ e.symm) =ᶠ[𝓝 y] (id : M → M) := by |
| 39 | filter_upwards [U.isOpen.mem_nhds hy] with z hz |
| 40 | exact e.right_inv (by simpa only [e, |
| 41 | TopologicalSpace.Opens.openPartialHomeomorphSubtypeCoe_target] using hz) |
| 42 | apply ContMDiffAt.contMDiffWithinAt |
| 43 | apply (ContMDiffAt.subtypeVal_comp_iff U e.symm y).mp |
| 44 | exact contMDiffAt_id.congr_of_eventuallyEq heq |
| 45 | |
| 46 | omit [IsManifold (𝓡 3) ∞ M] in |
| 47 | /-- Open inclusion is a local diffeomorphism for the inherited subtype charts. -/ |
| 48 | theorem openSubtype_isLocalDiffeomorph (U : TopologicalSpace.Opens M) : |
| 49 | IsLocalDiffeomorph (𝓡 3) (𝓡 3) ∞ (Subtype.val : U → M) := by |
| 50 | intro x |
| 51 | let hne : Nonempty U := ⟨x⟩ |
| 52 | let e := U.openPartialHomeomorphSubtypeCoe hne |
| 53 | let d : PartialDiffeomorph (𝓡 3) (𝓡 3) U M ∞ := { |
| 54 | toPartialEquiv := e.toPartialEquiv |
| 55 | open_source := e.open_source |
| 56 | open_target := e.open_target |
| 57 | contMDiffOn_toFun := by |
| 58 | exact (contMDiff_subtype_val (I := 𝓡 3) (U := U)).contMDiffOn |
| 59 | contMDiffOn_invFun := by |
| 60 | change ContMDiffOn (𝓡 3) (𝓡 3) ∞ e.symm e.target |
| 61 | rw [show e.target = (U : Set M) from |
| 62 | U.openPartialHomeomorphSubtypeCoe_target hne] |
| 63 | exact openSubtypeInverse_contMDiffOn U hne } |
| 64 | change IsLocalDiffeomorphAt (𝓡 3) (𝓡 3) ∞ d x |
| 65 | refine ⟨d, ?_, Set.eqOn_refl _ _⟩ |
| 66 | · change x ∈ e.source |
| 67 | simp only [e, TopologicalSpace.Opens.openPartialHomeomorphSubtypeCoe_source, mem_univ] |
| 68 | |
| 69 | /-- The selected region carries the literal pullback of the ambient metric. -/ |
| 70 | def intrinsicOpenMetric (g : RiemannianMetric 3 M) (U : TopologicalSpace.Opens M) : |
| 71 | RiemannianMetric 3 U := |
| 72 | g.pullbackOfLocalDiffeomorph (Subtype.val : U → M) |
| 73 | (openSubtype_isLocalDiffeomorph U) |
| 74 | |
| 75 | /-- The restricted inner product is exactly the inclusion pullback. -/ |
| 76 | @[simp] theorem intrinsicOpenMetric_inner (g : RiemannianMetric 3 M) |
| 77 | (U : TopologicalSpace.Opens M) (x : U) (v w : TangentSpace (𝓡 3) x) : |
| 78 | (intrinsicOpenMetric g U).inner x v w = |
| 79 | g.inner (x : M) |
| 80 | (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x v) |
| 81 | (mfderiv (𝓡 3) (𝓡 3) (Subtype.val : U → M) x w) := rfl |
| 82 | |
| 83 | /-- Pushdown of a C1 path preserves its actual derivative-integral length, |
| 84 | including when only the tested closed interval is differentiable. -/ |
| 85 | theorem intrinsicOpenMetric_pathELength (g : RiemannianMetric 3 M) |
| 86 | (U : TopologicalSpace.Opens M) {η : ℝ → U} {a b : ℝ} (hab : a ≤ b) |
| 87 | (hη : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 η (Icc a b)) : |
| 88 | (intrinsicOpenMetric g U).pathELength η a b = |
| 89 | g.pathELength (Subtype.val ∘ η) a b := by |
| 90 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 91 | ⟨g.toRiemannianMetric⟩ |
| 92 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : U → Type _) := |
| 93 | ⟨(intrinsicOpenMetric g U).toRiemannianMetric⟩ |
| 94 | rcases eq_or_lt_of_le hab with rfl | hab |
| 95 | · simp only [RiemannianMetric.pathELength, Manifold.pathELength_self] |
| 96 | have hnormM (x : M) (v : TangentSpace (𝓡 3) x) : |
| 97 | ENNReal.ofReal (g.tangentNorm x v) = ‖v‖ₑ := by |
| 98 | rw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 99 | rfl |
| 100 | have hnormU (x : U) (v : TangentSpace (𝓡 3) x) : |
| 101 | ENNReal.ofReal ((intrinsicOpenMetric g U).tangentNorm x v) = ‖v‖ₑ := by |
| 102 | rw [← ofReal_norm, norm_eq_sqrt_real_inner] |
| 103 | rfl |
| 104 | change Manifold.pathELength (𝓡 3) η a b = |
| 105 | Manifold.pathELength (𝓡 3) (Subtype.val ∘ η) a b |
| 106 | rw [Manifold.pathELength_eq_lintegral_mfderivWithin_Icc, |
| 107 | Manifold.pathELength_eq_lintegral_mfderivWithin_Icc] |
| 108 | apply setLIntegral_congr_fun measurableSet_Icc |
| 109 | intro t ht |
| 110 | dsimp only |
| 111 | have huniq : UniqueMDiffWithinAt 𝓘(ℝ, ℝ) (Icc a b) t := by |
| 112 | rw [uniqueMDiffWithinAt_iff_uniqueDiffWithinAt] |
| 113 | exact uniqueDiffOn_Icc hab t ht |
| 114 | have hi : MDifferentiableAt (𝓡 3) (𝓡 3) (Subtype.val : U → M) (η t) := |
| 115 | (contMDiff_subtype_val (I := 𝓡 3) (U := U) (n := 1)).mdifferentiable one_ne_zero (η t) |
| 116 | rw [mfderiv_comp_mfderivWithin t hi |
| 117 | (hη.mdifferentiableOn one_ne_zero t ht) huniq] |
| 118 | rw [← hnormU, ← hnormM] |
| 119 | rfl |
| 120 | |
| 121 | /-- An ambient path in the selected region lifts on its tested interval, |
| 122 | with exact pointwise pushdown and exact length. No total containment of the |
| 123 | ambient path outside that interval is required. -/ |
| 124 | theorem exists_intrinsicOpenMetric_path_lift (g : RiemannianMetric 3 M) |
| 125 | (U : TopologicalSpace.Opens M) {γ : ℝ → M} {a b : ℝ} (hab : a ≤ b) |
| 126 | (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 γ (Icc a b)) |
| 127 | (hγU : MapsTo γ (Icc a b) (U : Set M)) : |
| 128 | ∃ η : ℝ → U, ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 η (Icc a b) ∧ |
| 129 | EqOn (Subtype.val ∘ η) γ (Icc a b) ∧ |
| 130 | (intrinsicOpenMetric g U).pathELength η a b = g.pathELength γ a b := by |
| 131 | let hne : Nonempty U := ⟨⟨γ a, hγU ⟨le_rfl, hab⟩⟩⟩ |
| 132 | let e := U.openPartialHomeomorphSubtypeCoe hne |
| 133 | let η := e.symm ∘ γ |
| 134 | have hη : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 η (Icc a b) := |
| 135 | ((openSubtypeInverse_contMDiffOn U hne).of_le (by simp)).comp hγ hγU |
| 136 | have heq : EqOn (Subtype.val ∘ η) γ (Icc a b) := by |
| 137 | intro t ht |
| 138 | exact e.right_inv (by simpa only [e, |
| 139 | TopologicalSpace.Opens.openPartialHomeomorphSubtypeCoe_target] using hγU ht) |
| 140 | refine ⟨η, hη, heq, ?_⟩ |
| 141 | rw [intrinsicOpenMetric_pathELength g U hab hη] |
| 142 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : M → Type _) := |
| 143 | ⟨g.toRiemannianMetric⟩ |
| 144 | exact Manifold.pathELength_congr heq |
| 145 | |
| 146 | /-- The actual open-subtype metric distance equals the frozen infimum over |
| 147 | region-valued C1 competitors. It is not identified with ambient distance. -/ |
| 148 | theorem intrinsicOpenMetric_edist (g : RiemannianMetric 3 M) |
| 149 | (U : TopologicalSpace.Opens M) (p q : U) : |
| 150 | (intrinsicOpenMetric g U).edist p q = |
| 151 | intrinsicEDist g (U : Set M) (p : M) (q : M) := by |
| 152 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 3) : U → Type _) := |
| 153 | ⟨(intrinsicOpenMetric g U).toRiemannianMetric⟩ |
| 154 | apply le_antisymm |
| 155 | · rw [intrinsicEDist] |
| 156 | apply le_sInf |
| 157 | rintro L ⟨γ, hγ, h0, h1, hγU, rfl⟩ |
| 158 | obtain ⟨η, hη, heq, hlength⟩ := exists_intrinsicOpenMetric_path_lift g U |
| 159 | zero_le_one hγ (fun t ht => hγU ⟨t, ht, rfl⟩) |
| 160 | rw [← hlength] |
| 161 | apply Manifold.riemannianEDist_le_pathELength hη _ _ zero_le_one |
| 162 | · exact Subtype.ext ((heq (by norm_num)).trans h0) |
| 163 | · exact Subtype.ext ((heq (by norm_num)).trans h1) |
| 164 | · apply le_of_forall_gt_imp_ge_of_dense |
| 165 | intro l hl |
| 166 | obtain ⟨η, h0, h1, hη, hlen⟩ := |
| 167 | Manifold.exists_lt_of_riemannianEDist_lt hl |
| 168 | have hpush : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 3) 1 |
| 169 | (Subtype.val ∘ η) (Icc (0 : ℝ) 1) := |
| 170 | (contMDiff_subtype_val (I := 𝓡 3) (U := U)).comp_contMDiffOn hη |
| 171 | have hle := intrinsicEDist_le_pathELength g zero_le_one hpush |
| 172 | (fun t (_ : t ∈ Icc (0 : ℝ) 1) => (η t).property) |
| 173 | rw [← intrinsicOpenMetric_pathELength g U zero_le_one hη] at hle |
| 174 | simpa only [Function.comp_apply, h0, h1] using hle.trans hlen.le |
| 175 | |
| 176 | end PoincareMT.M28 |