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.Minimizer.Injective |
| 2 | |
| 3 | /-! |
| 4 | # Subarc competitors in a compact focusing region |
| 5 | |
| 6 | Exact additivity of metric variation makes every subarc of a constrained |
| 7 | unit-speed minimizer minimizing among competitors confined to the region. |
| 8 | This is the local replacement input for the geodesic and contact arguments. |
| 9 | |
| 10 | Morgan--Tian context: Claim 19.40, printed pp. 470-471, in the proof of Proposition |
| 11 | 19.35. The project construction retains the actual constrained path and its boundary |
| 12 | contacts. |
| 13 | -/ |
| 14 | |
| 15 | noncomputable section |
| 16 | set_option autoImplicit false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Topology ENNReal NNReal |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | /-- A continuous subarc replacement has exactly the old lengths on the two unchanged outer |
| 24 | intervals plus the metric variation of the new subarc. Source: MT Claim 19.40, pp. 470-471; |
| 25 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded minimizers |
| 26 | and local replacement. -/ |
| 27 | theorem m64Intrinsic_subarc_replacement |
| 28 | {X : Type*} [MetricSpace X] {K : Set X} {γ τ : ℝ → X} {L a b : ℝ} |
| 29 | (hL : 0 ≤ L) (ha : a ∈ Icc 0 L) (hb : b ∈ Icc 0 L) (hab : a ≤ b) |
| 30 | (hc : ContinuousOn γ (Icc 0 L)) (hunit : HasUnitSpeedOn γ (Icc 0 L)) |
| 31 | (hconf : MapsTo γ (Icc 0 L) K) (hτc : ContinuousOn τ (Icc a b)) |
| 32 | (hτa : τ a = γ a) (hτb : τ b = γ b) (hτconf : MapsTo τ (Icc a b) K) : |
| 33 | ∃ σ : ℝ → X, ContinuousOn σ (Icc 0 L) ∧ σ 0 = γ 0 ∧ σ L = γ L ∧ |
| 34 | MapsTo σ (Icc 0 L) K ∧ |
| 35 | eVariationOn σ (Icc 0 L) = |
| 36 | ENNReal.ofReal a + eVariationOn τ (Icc a b) + ENNReal.ofReal (L - b) := by |
| 37 | classical |
| 38 | let σ : ℝ → X := (Icc a b).piecewise τ γ |
| 39 | have hleft : EqOn σ γ (Icc 0 a) := by |
| 40 | intro t ht |
| 41 | by_cases h : t ∈ Icc a b |
| 42 | · have hta : t = a := le_antisymm ht.2 h.1 |
| 43 | simp [σ, hta, hab, hτa] |
| 44 | · simp [σ, h] |
| 45 | have hmiddle : EqOn σ τ (Icc a b) := by |
| 46 | intro t ht |
| 47 | simp [σ, ht] |
| 48 | have hright : EqOn σ γ (Icc b L) := by |
| 49 | intro t ht |
| 50 | by_cases h : t ∈ Icc a b |
| 51 | · have htb : t = b := le_antisymm h.2 ht.1 |
| 52 | simp [σ, htb, hab, hτb] |
| 53 | · simp [σ, h] |
| 54 | have hσc : ContinuousOn σ (Icc 0 L) := by |
| 55 | apply ContinuousOn.piecewise _ _ (hc.mono inter_subset_left) |
| 56 | · intro t ht |
| 57 | have ht' := ht.2 |
| 58 | rw [frontier_Icc hab, mem_insert_iff, mem_singleton_iff] at ht' |
| 59 | rcases ht' with rfl | rfl |
| 60 | · exact hτa |
| 61 | · exact hτb |
| 62 | · simpa only [isClosed_Icc.closure_eq] using hτc.mono |
| 63 | (inter_subset_right : Icc 0 L ∩ Icc a b ⊆ Icc a b) |
| 64 | refine ⟨σ, hσc, hleft ⟨le_rfl, ha.1⟩, hright ⟨hb.2, le_rfl⟩, ?_, ?_⟩ |
| 65 | · intro t ht |
| 66 | by_cases h : t ∈ Icc a b |
| 67 | · simpa [σ, h] using hτconf h |
| 68 | · simpa [σ, h] using hconf ht |
| 69 | · have hva : eVariationOn σ (Icc 0 a) = ENNReal.ofReal a := by |
| 70 | rw [eVariationOn.eq_of_eqOn hleft] |
| 71 | have h := hunit (show (0 : ℝ) ∈ Icc 0 L from ⟨le_rfl, hL⟩) ha |
| 72 | have hi : Icc 0 L ∩ Icc 0 a = Icc 0 a := |
| 73 | inter_eq_right.mpr (Icc_subset_Icc le_rfl ha.2) |
| 74 | simpa only [hi, NNReal.coe_one, one_mul, sub_zero] using h |
| 75 | have hvb : eVariationOn σ (Icc b L) = ENNReal.ofReal (L - b) := by |
| 76 | rw [eVariationOn.eq_of_eqOn hright] |
| 77 | have h := hunit hb (show L ∈ Icc 0 L from ⟨hL, le_rfl⟩) |
| 78 | have hi : Icc 0 L ∩ Icc b L = Icc b L := |
| 79 | inter_eq_right.mpr (Icc_subset_Icc hb.1 le_rfl) |
| 80 | simpa only [hi, NNReal.coe_one, one_mul] using h |
| 81 | have hfirst := eVariationOn.Icc_add_Icc σ (s := univ) ha.1 hab (mem_univ a) |
| 82 | have hsecond := eVariationOn.Icc_add_Icc σ (s := univ) hb.1 hb.2 (mem_univ b) |
| 83 | simp only [univ_inter, hva, eVariationOn.eq_of_eqOn hmiddle] at hfirst |
| 84 | simpa only [univ_inter, ← hfirst, hvb] using hsecond.symm |
| 85 | |
| 86 | /-- Every subarc of an attained constrained unit-speed minimizer minimizes metric variation |
| 87 | among all continuous competitors in the same region. Source: MT Claim 19.40, pp. 470-471; |
| 88 | `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded minimizers |
| 89 | and local replacement. -/ |
| 90 | theorem m64Intrinsic_constrained_minimizer_subarc |
| 91 | {X : Type*} [MetricSpace X] {K : Set X} {γ : ℝ → X} {L : ℝ} |
| 92 | (hL : 0 ≤ L) (hc : ContinuousOn γ (Icc 0 L)) |
| 93 | (hunit : HasUnitSpeedOn γ (Icc 0 L)) (hconf : MapsTo γ (Icc 0 L) K) |
| 94 | (hmin : ∀ τ : ℝ → X, ContinuousOn τ (Icc 0 1) → |
| 95 | τ 0 = γ 0 → τ 1 = γ L → MapsTo τ (Icc 0 1) K → |
| 96 | ENNReal.ofReal L ≤ eVariationOn τ (Icc 0 1)) |
| 97 | {a b : ℝ} (ha : a ∈ Icc 0 L) (hb : b ∈ Icc 0 L) (hab : a ≤ b) |
| 98 | {τ : ℝ → X} (hτc : ContinuousOn τ (Icc a b)) |
| 99 | (hτa : τ a = γ a) (hτb : τ b = γ b) (hτconf : MapsTo τ (Icc a b) K) : |
| 100 | ENNReal.ofReal (b - a) ≤ eVariationOn τ (Icc a b) := by |
| 101 | obtain ⟨σ, hσc, hσ0, hσL, hσconf, hσvar⟩ := |
| 102 | m64Intrinsic_subarc_replacement hL ha hb hab hc hunit hconf hτc hτa hτb hτconf |
| 103 | have hscale : MapsTo (fun t : ℝ => L * t) (Icc 0 1) (Icc 0 L) := by |
| 104 | intro t ht |
| 105 | exact ⟨mul_nonneg hL ht.1, by simpa using mul_le_mul_of_nonneg_left ht.2 hL⟩ |
| 106 | have hmin' := hmin (fun t => σ (L * t)) |
| 107 | (hσc.comp (continuous_const.mul continuous_id).continuousOn hscale) |
| 108 | (by simpa only [mul_zero] using hσ0) (by simpa only [mul_one] using hσL) |
| 109 | (hσconf.comp hscale) |
| 110 | rw [m64Intrinsic_variation_rescale σ hL, hσvar] at hmin' |
| 111 | have hsplit : ENNReal.ofReal L = ENNReal.ofReal a + |
| 112 | ENNReal.ofReal (b - a) + ENNReal.ofReal (L - b) := by |
| 113 | rw [← ENNReal.ofReal_add ha.1 (sub_nonneg.mpr hab), |
| 114 | ← ENNReal.ofReal_add (by linarith [hb.1]) (sub_nonneg.mpr hb.2)] |
| 115 | congr 1 |
| 116 | ring |
| 117 | rw [hsplit, ENNReal.add_le_add_iff_right ENNReal.ofReal_ne_top, |
| 118 | ENNReal.add_le_add_iff_left ENNReal.ofReal_ne_top] at hmin' |
| 119 | exact hmin' |
| 120 | |
| 121 | /-- The same subarc minimum accepts competitors on the fixed unit interval; affine |
| 122 | reparametrization is constructed and its variation is unchanged. Source: MT Claim 19.40, pp. |
| 123 | 470-471; `proof-work/tasks/M64/reports/2026-09-24-intrinsic-radial-scalar.md`, Embedded |
| 124 | minimizers and local replacement. -/ |
| 125 | theorem m64Intrinsic_constrained_minimizer_subarc_unitInterval |
| 126 | {X : Type*} [MetricSpace X] {K : Set X} {γ : ℝ → X} {L : ℝ} |
| 127 | (hL : 0 ≤ L) (hc : ContinuousOn γ (Icc 0 L)) |
| 128 | (hunit : HasUnitSpeedOn γ (Icc 0 L)) (hconf : MapsTo γ (Icc 0 L) K) |
| 129 | (hmin : ∀ τ : ℝ → X, ContinuousOn τ (Icc 0 1) → |
| 130 | τ 0 = γ 0 → τ 1 = γ L → MapsTo τ (Icc 0 1) K → |
| 131 | ENNReal.ofReal L ≤ eVariationOn τ (Icc 0 1)) |
| 132 | {a b : ℝ} (ha : a ∈ Icc 0 L) (hb : b ∈ Icc 0 L) (hab : a ≤ b) |
| 133 | {τ : ℝ → X} (hτc : ContinuousOn τ (Icc 0 1)) |
| 134 | (hτa : τ 0 = γ a) (hτb : τ 1 = γ b) (hτconf : MapsTo τ (Icc 0 1) K) : |
| 135 | ENNReal.ofReal (b - a) ≤ eVariationOn τ (Icc 0 1) := by |
| 136 | rcases hab.eq_or_lt with rfl | hab' |
| 137 | · simp |
| 138 | have hd : 0 < b - a := sub_pos.mpr hab' |
| 139 | let f : ℝ → ℝ := fun t => (t - a) / (b - a) |
| 140 | have hfc : Continuous f := (continuous_id.sub continuous_const).div_const _ |
| 141 | have hfm : MonotoneOn f (Icc a b) := by |
| 142 | intro s _ t _ hst |
| 143 | exact div_le_div_of_nonneg_right (sub_le_sub_right hst a) hd.le |
| 144 | have hf0 : f a = 0 := by simp [f] |
| 145 | have hf1 : f b = 1 := by simp [f, hd.ne'] |
| 146 | have hfimage : f '' Icc a b = Icc 0 1 := by |
| 147 | simpa only [hf0, hf1] using hfc.continuousOn.image_Icc_of_monotoneOn hab hfm |
| 148 | have hfmap : MapsTo f (Icc a b) (Icc 0 1) := by |
| 149 | rw [← hfimage] |
| 150 | exact mapsTo_image _ _ |
| 151 | have h := m64Intrinsic_constrained_minimizer_subarc hL hc hunit hconf hmin ha hb hab |
| 152 | (hτc.comp hfc.continuousOn hfmap) (by simpa only [Function.comp_apply, hf0] using hτa) |
| 153 | (by simpa only [Function.comp_apply, hf1] using hτb) (hτconf.comp hfmap) |
| 154 | change ENNReal.ofReal (b - a) ≤ eVariationOn (τ ∘ f) (Icc a b) at h |
| 155 | rwa [eVariationOn.comp_eq_of_monotoneOn τ f hfm, hfimage] at h |
| 156 | |
| 157 | end PoincareMT |