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 Mathlib.Topology.Piecewise |
| 3 | |
| 4 | /-! |
| 5 | # Loop deletion for constrained shortest curves |
| 6 | |
| 7 | Flattening a repeated-point subarc preserves the region and endpoints and |
| 8 | strictly reduces the length of a unit-speed curve. Consequently an attained |
| 9 | constrained minimizer is an embedded arc even before boundary regularity. |
| 10 | |
| 11 | Morgan--Tian context: Claim 19.40, printed pp. 470-471, in the proof of Proposition |
| 12 | 19.35. The project construction retains the actual constrained path and its boundary |
| 13 | contacts. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | |
| 19 | open Set |
| 20 | open scoped Topology ENNReal NNReal |
| 21 | |
| 22 | namespace PoincareMT |
| 23 | |
| 24 | /-- Positive affine rescaling preserves the full metric variation. Source: MT Claim 19.40, |
| 25 | pp. 470-471; `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded |
| 26 | minimizers and local replacement. -/ |
| 27 | theorem m64Intrinsic_variation_rescale |
| 28 | {X : Type*} [PseudoEMetricSpace X] (γ : ℝ → X) {L : ℝ} (hL : 0 ≤ L) : |
| 29 | eVariationOn (fun t => γ (L * t)) (Icc 0 1) = eVariationOn γ (Icc 0 L) := by |
| 30 | have hmono : MonotoneOn (fun t : ℝ => L * t) (Icc 0 1) := |
| 31 | fun _ _ _ _ h => mul_le_mul_of_nonneg_left h hL |
| 32 | have himage : (fun t : ℝ => L * t) '' Icc 0 1 = Icc 0 L := by |
| 33 | simpa using (continuous_const.mul continuous_id).continuousOn.image_Icc_of_monotoneOn |
| 34 | (by norm_num : (0 : ℝ) ≤ 1) hmono |
| 35 | change eVariationOn (γ ∘ fun t => L * t) (Icc 0 1) = _ |
| 36 | rw [eVariationOn.comp_eq_of_monotoneOn γ _ hmono, himage] |
| 37 | |
| 38 | /-- Removing a nontrivial loop contradicts constrained minimality. This uses neither ambient |
| 39 | convexity nor differentiability of the curve. Source: MT Claim 19.40, pp. 470-471; |
| 40 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded minimizers |
| 41 | and local replacement. -/ |
| 42 | theorem m64Intrinsic_unit_speed_constrained_minimizer_injOn |
| 43 | {X : Type*} [MetricSpace X] {K : Set X} {γ : ℝ → X} {L : ℝ} |
| 44 | (hL : 0 ≤ L) (hc : ContinuousOn γ (Icc 0 L)) |
| 45 | (hunit : HasUnitSpeedOn γ (Icc 0 L)) (hconf : MapsTo γ (Icc 0 L) K) |
| 46 | (hmin : ∀ τ : ℝ → X, ContinuousOn τ (Icc 0 1) → |
| 47 | τ 0 = γ 0 → τ 1 = γ L → MapsTo τ (Icc 0 1) K → |
| 48 | ENNReal.ofReal L ≤ eVariationOn τ (Icc 0 1)) : InjOn γ (Icc 0 L) := by |
| 49 | classical |
| 50 | intro a ha b hb heq |
| 51 | wlog hab : a ≤ b generalizing a b |
| 52 | · exact (this hb ha heq.symm (le_of_not_ge hab)).symm |
| 53 | by_contra hne |
| 54 | have hab' : a < b := lt_of_le_of_ne hab hne |
| 55 | let σ : ℝ → X := (Icc a b).piecewise (fun _ => γ a) γ |
| 56 | have hleft : EqOn σ γ (Icc 0 a) := by |
| 57 | intro t ht |
| 58 | by_cases h : t ∈ Icc a b |
| 59 | · have hta : t = a := le_antisymm ht.2 h.1 |
| 60 | simp [σ, hta, hab] |
| 61 | · simp [σ, h] |
| 62 | have hmiddle : EqOn σ (fun _ => γ a) (Icc a b) := by |
| 63 | intro t ht |
| 64 | simp [σ, ht] |
| 65 | have hright : EqOn σ γ (Icc b L) := by |
| 66 | intro t ht |
| 67 | by_cases h : t ∈ Icc a b |
| 68 | · have htb : t = b := le_antisymm h.2 ht.1 |
| 69 | simp [σ, htb, hab, heq] |
| 70 | · simp [σ, h] |
| 71 | have hσc : ContinuousOn σ (Icc 0 L) := by |
| 72 | apply ContinuousOn.piecewise _ continuousOn_const (hc.mono inter_subset_left) |
| 73 | intro t ht |
| 74 | have ht' := ht.2 |
| 75 | rw [frontier_Icc hab, mem_insert_iff, mem_singleton_iff] at ht' |
| 76 | rcases ht' with rfl | rfl |
| 77 | · rfl |
| 78 | · exact heq |
| 79 | have hσconf : MapsTo σ (Icc 0 L) K := by |
| 80 | intro t ht |
| 81 | by_cases h : t ∈ Icc a b |
| 82 | · simpa [σ, h] using hconf ha |
| 83 | · simpa [σ, h] using hconf ht |
| 84 | have hva : eVariationOn σ (Icc 0 a) = ENNReal.ofReal a := by |
| 85 | rw [eVariationOn.eq_of_eqOn hleft] |
| 86 | have h := hunit (show (0 : ℝ) ∈ Icc 0 L from ⟨le_rfl, hL⟩) ha |
| 87 | have hi : Icc 0 L ∩ Icc 0 a = Icc 0 a := |
| 88 | inter_eq_right.mpr (Icc_subset_Icc le_rfl ha.2) |
| 89 | simpa only [hi, NNReal.coe_one, one_mul, sub_zero] using h |
| 90 | have hvab : eVariationOn σ (Icc a b) = 0 := by |
| 91 | rw [eVariationOn.eq_of_eqOn hmiddle] |
| 92 | apply eVariationOn.constant_on |
| 93 | rintro _ ⟨s, _, rfl⟩ _ ⟨t, _, rfl⟩ |
| 94 | rfl |
| 95 | have hvb : eVariationOn σ (Icc b L) = ENNReal.ofReal (L - b) := by |
| 96 | rw [eVariationOn.eq_of_eqOn hright] |
| 97 | have h := hunit hb (show L ∈ Icc 0 L from ⟨hL, le_rfl⟩) |
| 98 | have hi : Icc 0 L ∩ Icc b L = Icc b L := |
| 99 | inter_eq_right.mpr (Icc_subset_Icc hb.1 le_rfl) |
| 100 | simpa only [hi, NNReal.coe_one, one_mul] using h |
| 101 | have hv0b : eVariationOn σ (Icc 0 b) = ENNReal.ofReal a := by |
| 102 | have h := eVariationOn.Icc_add_Icc σ (s := univ) ha.1 hab (mem_univ a) |
| 103 | simpa only [univ_inter, hva, hvab, add_zero] using h.symm |
| 104 | have hvσ : eVariationOn σ (Icc 0 L) = ENNReal.ofReal (a + (L - b)) := by |
| 105 | have h := eVariationOn.Icc_add_Icc σ (s := univ) hb.1 hb.2 (mem_univ b) |
| 106 | rw [univ_inter, univ_inter, univ_inter, hv0b, hvb, |
| 107 | ← ENNReal.ofReal_add ha.1 (sub_nonneg.mpr hb.2)] at h |
| 108 | exact h.symm |
| 109 | have hscale : MapsTo (fun t : ℝ => L * t) (Icc 0 1) (Icc 0 L) := by |
| 110 | intro t ht |
| 111 | exact ⟨mul_nonneg hL ht.1, by simpa using mul_le_mul_of_nonneg_left ht.2 hL⟩ |
| 112 | have hmin' := hmin (fun t => σ (L * t)) |
| 113 | (hσc.comp (continuous_const.mul continuous_id).continuousOn hscale) |
| 114 | (by simpa only [mul_zero] using hleft ⟨le_rfl, ha.1⟩) |
| 115 | (by simpa only [mul_one] using hright ⟨hb.2, le_rfl⟩) |
| 116 | (hσconf.comp hscale) |
| 117 | rw [m64Intrinsic_variation_rescale σ hL, hvσ] at hmin' |
| 118 | have hreal := (ENNReal.ofReal_le_ofReal_iff |
| 119 | (add_nonneg ha.1 (sub_nonneg.mpr hb.2))).mp hmin' |
| 120 | linarith |
| 121 | |
| 122 | /-- Compact constrained minimization produces an embedded unit-speed arc from one |
| 123 | rectifiable competitor. Source: MT Claim 19.40, pp. 470-471; |
| 124 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded minimizers |
| 125 | and local replacement. -/ |
| 126 | theorem m64Intrinsic_exists_embedded_constrained_minimizer |
| 127 | {X : Type*} [MetricSpace X] {K : Set X} (hK : IsCompact K) |
| 128 | {z y : X} {σ : ℝ → X} |
| 129 | (hc : ContinuousOn σ (Icc 0 1)) (h0 : σ 0 = z) (h1 : σ 1 = y) |
| 130 | (hconf : MapsTo σ (Icc 0 1) K) |
| 131 | (hv : BoundedVariationOn σ (Icc 0 1)) : |
| 132 | ∃ (η : ℝ → X) (L : ℝ), 0 ≤ L ∧ η 0 = z ∧ η L = y ∧ |
| 133 | MapsTo η (Icc 0 L) K ∧ HasUnitSpeedOn η (Icc 0 L) ∧ |
| 134 | LipschitzOnWith 1 η (Icc 0 L) ∧ InjOn η (Icc 0 L) ∧ |
| 135 | (∀ τ : ℝ → X, ContinuousOn τ (Icc 0 1) → τ 0 = z → τ 1 = y → |
| 136 | MapsTo τ (Icc 0 1) K → ENNReal.ofReal L ≤ eVariationOn τ (Icc 0 1)) := by |
| 137 | obtain ⟨η, L, hL, hη0, hη1, hηconf, hηunit, hηlip, _, hηmin⟩ := |
| 138 | m64Intrinsic_exists_unit_speed_constrained_minimizer hK hc h0 h1 hconf hv |
| 139 | refine ⟨η, L, hL, hη0, hη1, hηconf, hηunit, hηlip, ?_, hηmin⟩ |
| 140 | apply m64Intrinsic_unit_speed_constrained_minimizer_injOn hL |
| 141 | hηlip.continuousOn hηunit hηconf |
| 142 | simpa only [hη0, hη1] using hηmin |
| 143 | |
| 144 | end PoincareMT |