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.CurveShortening.Comparison.IntrinsicComparison.Constrained.Minimizer |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Subarc.Replacement |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.Analysis.Variation.Concatenation |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Boundary.Geometry |
| 5 | import PoincareLib.Geometry.Riemannian.Distance.Basic |
| 6 | import PoincareLib.Geometry.Riemannian.Distance.PathVariation |
| 7 | |
| 8 | /-! |
| 9 | # Intrinsic shortest curves constrained to a compact region |
| 10 | |
| 11 | The compact minimizing-curve construction is applied to the actual finite |
| 12 | Riemannian distance. Its topology is the original coordinate topology, so a |
| 13 | compact focusing disk supplies compactness without a convexity assumption. |
| 14 | |
| 15 | Morgan--Tian context: Claim 19.40, printed pp. 470-471, in the proof of Proposition |
| 16 | 19.35. The project construction retains the actual constrained path and its boundary |
| 17 | contacts. |
| 18 | -/ |
| 19 | |
| 20 | noncomputable section |
| 21 | set_option autoImplicit false |
| 22 | set_option backward.isDefEq.respectTransparency false |
| 23 | |
| 24 | open Set Filter |
| 25 | open scoped Topology ENNReal NNReal Manifold ContDiff Bundle |
| 26 | |
| 27 | namespace PoincareMT |
| 28 | |
| 29 | @[instance_reducible] private def intrinsicDistanceMetric |
| 30 | (G : RiemannianMetric 2 AnnulusCoordinates) : MetricSpace AnnulusCoordinates := by |
| 31 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 2) : AnnulusCoordinates → Type _) := |
| 32 | ⟨G.toRiemannianMetric⟩ |
| 33 | let : IsContinuousRiemannianBundle (EuclideanSpace ℝ (Fin 2)) |
| 34 | (TangentSpace (𝓡 2) : AnnulusCoordinates → Type _) := |
| 35 | ⟨⟨G.inner, G.toContinuousRiemannianMetric.continuous, fun _ _ _ => rfl⟩⟩ |
| 36 | let : EMetricSpace AnnulusCoordinates := |
| 37 | EMetricSpace.ofRiemannianMetric (𝓡 2) AnnulusCoordinates |
| 38 | exact EMetricSpace.toMetricSpace (fun x y => G.edist_ne_top x y) |
| 39 | |
| 40 | /-- Metric variation measured with the selected intrinsic Riemannian distance, rather than |
| 41 | with the ambient coordinate norm. Source: MT Claim 19.40, pp. 470-471; |
| 42 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 43 | constrained minimizers. -/ |
| 44 | def m64IntrinsicCurveVariation (G : RiemannianMetric 2 AnnulusCoordinates) |
| 45 | (γ : ℝ → AnnulusCoordinates) (a b : ℝ) : ℝ≥0∞ := |
| 46 | @eVariationOn ℝ _ AnnulusCoordinates |
| 47 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace γ (Icc a b) |
| 48 | |
| 49 | /-- Affine changes, including reversal and a constant interval, preserve the actual |
| 50 | intrinsic variation on the corresponding unoriented interval. Source: MT Claim 19.40, pp. |
| 51 | 470-471; `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual |
| 52 | compact-region constrained minimizers. -/ |
| 53 | theorem m64Intrinsic_curveVariation_affine |
| 54 | (G : RiemannianMetric 2 AnnulusCoordinates) (γ : ℝ → AnnulusCoordinates) (a b : ℝ) : |
| 55 | m64IntrinsicCurveVariation G (fun t => γ (a + (b - a) * t)) 0 1 = |
| 56 | m64IntrinsicCurveVariation G γ (min a b) (max a b) := by |
| 57 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 58 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 59 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 60 | let f := fun t : ℝ => a + (b - a) * t |
| 61 | have hf : Continuous f := by dsimp only [f]; fun_prop |
| 62 | have hf0 : f 0 = a := by simp [f] |
| 63 | have hf1 : f 1 = b := by simp [f] |
| 64 | change eVariationOn (γ ∘ f) (Icc (0 : ℝ) 1) = eVariationOn γ (Icc (min a b) (max a b)) |
| 65 | rcases le_total a b with hab | hba |
| 66 | · have hmono : MonotoneOn f (Icc 0 1) := by |
| 67 | intro x _ y _ hxy |
| 68 | dsimp only [f] |
| 69 | exact add_le_add le_rfl (mul_le_mul_of_nonneg_left hxy (sub_nonneg.mpr hab)) |
| 70 | rw [eVariationOn.comp_eq_of_monotoneOn γ f hmono, |
| 71 | hf.continuousOn.image_Icc_of_monotoneOn zero_le_one hmono, hf0, hf1, |
| 72 | min_eq_left hab, max_eq_right hab] |
| 73 | · have hanti : AntitoneOn f (Icc 0 1) := by |
| 74 | intro x _ y _ hxy |
| 75 | dsimp only [f] |
| 76 | exact add_le_add le_rfl (mul_le_mul_of_nonpos_left hxy (sub_nonpos.mpr hba)) |
| 77 | rw [eVariationOn.comp_eq_of_antitoneOn γ f hanti, |
| 78 | hf.continuousOn.image_Icc_of_antitoneOn zero_le_one hanti, hf0, hf1, |
| 79 | min_eq_right hba, max_eq_left hba] |
| 80 | |
| 81 | /-- The joined competitor uses intrinsic variation and retains the exact images of the two |
| 82 | original continuous pieces. Source: MT Claim 19.40, pp. 470-471; |
| 83 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 84 | constrained minimizers. -/ |
| 85 | theorem m64Intrinsic_exists_join_with_variation |
| 86 | (G : RiemannianMetric 2 AnnulusCoordinates) {f g : ℝ → AnnulusCoordinates} |
| 87 | (hf : ContinuousOn f (Icc 0 1)) (hg : ContinuousOn g (Icc 0 1)) |
| 88 | (hjoin : f 1 = g 0) : |
| 89 | ∃ q : ℝ → AnnulusCoordinates, ContinuousOn q (Icc 0 1) ∧ q 0 = f 0 ∧ q 1 = g 1 ∧ |
| 90 | (∀ t ∈ Icc 0 1, q t ∈ f '' Icc 0 1 ∪ g '' Icc 0 1) ∧ |
| 91 | m64IntrinsicCurveVariation G q 0 1 = |
| 92 | m64IntrinsicCurveVariation G f 0 1 + m64IntrinsicCurveVariation G g 0 1 := by |
| 93 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 94 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 95 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 96 | exact m64_exists_join_with_variation hf hg hjoin |
| 97 | |
| 98 | /-- Differentiable competitors control the intrinsic metric variation by their exact |
| 99 | Riemannian derivative-integral length. Source: MT Claim 19.40, pp. 470-471; |
| 100 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 101 | constrained minimizers. -/ |
| 102 | theorem m64Intrinsic_curveVariation_le_pathELength |
| 103 | (G : RiemannianMetric 2 AnnulusCoordinates) {γ : ℝ → AnnulusCoordinates} |
| 104 | {a b : ℝ} (hγ : ContMDiffOn 𝓘(ℝ, ℝ) (𝓡 2) 1 γ (Icc a b)) : |
| 105 | m64IntrinsicCurveVariation G γ a b ≤ G.pathELength γ a b := by |
| 106 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 107 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 108 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 109 | exact G.eVariationOn_le_pathELength_of_edist_le hγ (fun _ _ _ _ => le_rfl) |
| 110 | |
| 111 | /-- An intrinsic Lipschitz bound controls the actual metric variation on the unit interval. |
| 112 | Source: MT Claim 19.40, pp. 470-471; |
| 113 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 114 | constrained minimizers. -/ |
| 115 | theorem m64Intrinsic_curveVariation_le_of_edist_le |
| 116 | (G : RiemannianMetric 2 AnnulusCoordinates) {γ : ℝ → AnnulusCoordinates} |
| 117 | {C : ℝ} (hC : 0 ≤ C) |
| 118 | (hγ : ∀ s ∈ Icc 0 1, ∀ t ∈ Icc 0 1, |
| 119 | G.edist (γ s) (γ t) ≤ ENNReal.ofReal (C * |s - t|)) : |
| 120 | m64IntrinsicCurveVariation G γ 0 1 ≤ ENNReal.ofReal C := by |
| 121 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 122 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 123 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 124 | have hlip : LipschitzOnWith ⟨C, hC⟩ γ (Icc 0 1) := by |
| 125 | intro s hs t ht |
| 126 | change G.edist (γ s) (γ t) ≤ ENNReal.ofNNReal (NNReal.mk C hC) * edist s t |
| 127 | have h := hγ s hs t ht |
| 128 | rw [ENNReal.ofReal_mul hC, ENNReal.ofReal_eq_coe_nnreal hC] at h |
| 129 | simpa only [edist_dist, Real.dist_eq] using h |
| 130 | rw [ENNReal.ofReal_eq_coe_nnreal hC] |
| 131 | exact Poincare.MetricCurves.eVariationOn_le_of_lipschitzOnWith hlip |
| 132 | |
| 133 | /-- A compact region and one finite-length connecting competitor produce an intrinsically |
| 134 | shortest curve in that same region. The parameter interval is fixed and its Lipschitz |
| 135 | constant is its actual attained length. Source: MT Claim 19.40, pp. 470-471; |
| 136 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 137 | constrained minimizers. -/ |
| 138 | theorem m64Intrinsic_exists_compact_region_shortest_curve |
| 139 | (G : RiemannianMetric 2 AnnulusCoordinates) {K : Set AnnulusCoordinates} |
| 140 | (hK : IsCompact K) {p q : AnnulusCoordinates} {σ : ℝ → AnnulusCoordinates} |
| 141 | (hc : ContinuousOn σ (Icc 0 1)) (h0 : σ 0 = p) (h1 : σ 1 = q) |
| 142 | (hconf : MapsTo σ (Icc 0 1) K) {B : ℝ} |
| 143 | (hB : m64IntrinsicCurveVariation G σ 0 1 ≤ ENNReal.ofReal B) : |
| 144 | ∃ (γ : ℝ → AnnulusCoordinates) (L : ℝ), 0 ≤ L ∧ L ≤ max B 0 ∧ |
| 145 | m64IntrinsicCurveVariation G γ 0 1 = ENNReal.ofReal L ∧ |
| 146 | ContinuousOn γ (Icc 0 1) ∧ γ 0 = p ∧ γ 1 = q ∧ MapsTo γ (Icc 0 1) K ∧ |
| 147 | (∀ s ∈ Icc 0 1, ∀ t ∈ Icc 0 1, |
| 148 | G.edist (γ s) (γ t) ≤ ENNReal.ofReal (L * |s - t|)) ∧ |
| 149 | (∀ τ : ℝ → AnnulusCoordinates, ContinuousOn τ (Icc 0 1) → |
| 150 | τ 0 = p → τ 1 = q → MapsTo τ (Icc 0 1) K → |
| 151 | m64IntrinsicCurveVariation G γ 0 1 ≤ m64IntrinsicCurveVariation G τ 0 1) := by |
| 152 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 153 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 154 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 155 | have hv : BoundedVariationOn σ (Icc 0 1) := |
| 156 | ne_top_of_le_ne_top ENNReal.ofReal_ne_top hB |
| 157 | obtain ⟨γ, hγ0, hγ1, hγconf, hγlip, hγv, hγmin⟩ := |
| 158 | m64Intrinsic_exists_compact_constrained_minimizer hK hc h0 h1 hconf hv |
| 159 | let L := (eVariationOn γ (Icc 0 1)).toReal |
| 160 | have hL : 0 ≤ L := ENNReal.toReal_nonneg |
| 161 | have hlength : eVariationOn γ (Icc 0 1) = ENNReal.ofReal L := |
| 162 | (ENNReal.ofReal_toReal hγv).symm |
| 163 | have hLB : L ≤ max B 0 := by |
| 164 | have h := ENNReal.toReal_mono ENNReal.ofReal_ne_top |
| 165 | ((hγmin σ hc h0 h1 hconf).trans hB) |
| 166 | simpa only [ENNReal.toReal_ofReal', L] using h |
| 167 | refine ⟨γ, L, hL, hLB, hlength, hγlip.continuousOn, hγ0, hγ1, hγconf, ?_, ?_⟩ |
| 168 | · intro s hs t ht |
| 169 | have h := hγlip hs ht |
| 170 | change G.edist (γ s) (γ t) ≤ |
| 171 | (↑(eVariationOn γ (Icc 0 1)).toNNReal : ℝ≥0∞) * edist s t at h |
| 172 | rw [ENNReal.coe_toNNReal hγv, hlength, edist_dist, Real.dist_eq, |
| 173 | ← ENNReal.ofReal_mul hL] at h |
| 174 | exact h |
| 175 | · exact hγmin |
| 176 | |
| 177 | /-- A compact region contains an embedded intrinsic unit-speed minimizer. Every subarc has |
| 178 | its exact parameter length and minimizes against all continuous competitors with the same |
| 179 | endpoints in the region. Source: MT Claim 19.40, pp. 470-471; |
| 180 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Actual compact-region |
| 181 | constrained minimizers. -/ |
| 182 | theorem m64Intrinsic_exists_embedded_region_minimizer |
| 183 | (G : RiemannianMetric 2 AnnulusCoordinates) {K : Set AnnulusCoordinates} |
| 184 | (hK : IsCompact K) {p q : AnnulusCoordinates} {σ : ℝ → AnnulusCoordinates} |
| 185 | (hc : ContinuousOn σ (Icc 0 1)) (h0 : σ 0 = p) (h1 : σ 1 = q) |
| 186 | (hconf : MapsTo σ (Icc 0 1) K) {B : ℝ} |
| 187 | (hB : m64IntrinsicCurveVariation G σ 0 1 ≤ ENNReal.ofReal B) : |
| 188 | ∃ (γ : ℝ → AnnulusCoordinates) (L : ℝ), 0 ≤ L ∧ L ≤ max B 0 ∧ |
| 189 | ContinuousOn γ (Icc 0 L) ∧ γ 0 = p ∧ γ L = q ∧ MapsTo γ (Icc 0 L) K ∧ |
| 190 | InjOn γ (Icc 0 L) ∧ |
| 191 | (∀ s ∈ Icc 0 L, ∀ t ∈ Icc 0 L, |
| 192 | G.edist (γ s) (γ t) ≤ ENNReal.ofReal |s - t|) ∧ |
| 193 | (∀ a ∈ Icc 0 L, ∀ b ∈ Icc 0 L, |
| 194 | m64IntrinsicCurveVariation G γ a b = ENNReal.ofReal (b - a)) ∧ |
| 195 | (∀ a ∈ Icc 0 L, ∀ b ∈ Icc 0 L, a ≤ b → |
| 196 | ∀ τ : ℝ → AnnulusCoordinates, ContinuousOn τ (Icc 0 1) → |
| 197 | τ 0 = γ a → τ 1 = γ b → MapsTo τ (Icc 0 1) K → |
| 198 | ENNReal.ofReal (b - a) ≤ m64IntrinsicCurveVariation G τ 0 1) := by |
| 199 | let : MetricSpace AnnulusCoordinates := intrinsicDistanceMetric G |
| 200 | let : PseudoEMetricSpace AnnulusCoordinates := |
| 201 | (intrinsicDistanceMetric G).toEMetricSpace.toPseudoEMetricSpace |
| 202 | have hv : BoundedVariationOn σ (Icc 0 1) := |
| 203 | ne_top_of_le_ne_top ENNReal.ofReal_ne_top hB |
| 204 | obtain ⟨γ, L, hL, hγ0, hγL, hγconf, hγunit, hγlip, hγinj, hγmin⟩ := |
| 205 | m64Intrinsic_exists_embedded_constrained_minimizer hK hc h0 h1 hconf hv |
| 206 | have hLB : L ≤ max B 0 := by |
| 207 | have h := ENNReal.toReal_mono ENNReal.ofReal_ne_top |
| 208 | ((hγmin σ hc h0 h1 hconf).trans hB) |
| 209 | simpa only [ENNReal.toReal_ofReal hL, ENNReal.toReal_ofReal'] using h |
| 210 | refine ⟨γ, L, hL, hLB, hγlip.continuousOn, hγ0, hγL, hγconf, hγinj, ?_, ?_, ?_⟩ |
| 211 | · intro s hs t ht |
| 212 | have h := hγlip hs ht |
| 213 | change G.edist (γ s) (γ t) ≤ (↑(1 : ℝ≥0) : ℝ≥0∞) * edist s t at h |
| 214 | simpa only [ENNReal.coe_one, one_mul, edist_dist, Real.dist_eq] using h |
| 215 | · intro a ha b hb |
| 216 | have h := hγunit ha hb |
| 217 | have hi : Icc 0 L ∩ Icc a b = Icc a b := |
| 218 | inter_eq_right.mpr (Icc_subset_Icc ha.1 hb.2) |
| 219 | change eVariationOn γ (Icc a b) = ENNReal.ofReal (b - a) |
| 220 | simpa only [hi, NNReal.coe_one, one_mul] using h |
| 221 | · intro a ha b hb hab τ hτc hτa hτb hτconf |
| 222 | apply m64Intrinsic_constrained_minimizer_subarc_unitInterval hL |
| 223 | hγlip.continuousOn hγunit hγconf _ ha hb hab hτc hτa hτb hτconf |
| 224 | simpa only [hγ0, hγL] using hγmin |
| 225 | |
| 226 | end PoincareMT |