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 Mathlib.Topology.EMetricSpace.BoundedVariation |
| 2 | import Mathlib.Topology.Piecewise |
| 3 | |
| 4 | /-! Continuous concatenation preserves the exact sum of metric variations. |
| 5 | This supplies the literal two-piece competitor in MT Claim 19.40, p. 470. -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option warningAsError true |
| 10 | |
| 11 | open Set |
| 12 | open scoped ENNReal |
| 13 | |
| 14 | namespace PoincareMT |
| 15 | |
| 16 | /-- Two continuous paths with a common endpoint have a concatenation whose |
| 17 | metric variation is the sum of their variations, including infinite values. |
| 18 | Source: MT Claim 19.40, p. 470; `2026-09-27-minimal-contact-regularity.md`. -/ |
| 19 | theorem m64_exists_join_with_variation |
| 20 | {X : Type*} [PseudoEMetricSpace X] {f g : ℝ → X} |
| 21 | (hf : ContinuousOn f (Icc 0 1)) (hg : ContinuousOn g (Icc 0 1)) |
| 22 | (hjoin : f 1 = g 0) : |
| 23 | ∃ q : ℝ → X, ContinuousOn q (Icc 0 1) ∧ q 0 = f 0 ∧ q 1 = g 1 ∧ |
| 24 | (∀ t ∈ Icc 0 1, q t ∈ f '' Icc 0 1 ∪ g '' Icc 0 1) ∧ |
| 25 | eVariationOn q (Icc 0 1) = eVariationOn f (Icc 0 1) + eVariationOn g (Icc 0 1) := by |
| 26 | let q := fun t : ℝ => if t ≤ 1 / 2 then f (2 * t) else g (2 * t - 1) |
| 27 | have hl (t : ℝ) (ht : t ∈ Icc 0 (1 / 2)) : 2 * t ∈ Icc (0 : ℝ) 1 := by |
| 28 | constructor <;> linarith [ht.1, ht.2] |
| 29 | have hr (t : ℝ) (ht : t ∈ Icc (1 / 2) 1) : 2 * t - 1 ∈ Icc (0 : ℝ) 1 := by |
| 30 | constructor <;> linarith [ht.1, ht.2] |
| 31 | have hleft : EqOn q (fun t => f (2 * t)) (Icc 0 (1 / 2)) := by |
| 32 | intro t ht |
| 33 | exact if_pos ht.2 |
| 34 | have hright : EqOn q (fun t => g (2 * t - 1)) (Icc (1 / 2) 1) := by |
| 35 | intro t ht |
| 36 | rcases ht.1.eq_or_lt with heq | hlt |
| 37 | · subst t |
| 38 | norm_num only [q, le_refl, if_true, mul_div_cancel₀, OfNat.ofNat_ne_zero, |
| 39 | sub_self] |
| 40 | exact hjoin |
| 41 | · exact if_neg (not_le_of_gt hlt) |
| 42 | have hqc : ContinuousOn q (Icc 0 1) := by |
| 43 | apply ContinuousOn.if |
| 44 | · intro t ht |
| 45 | have heq : t = 1 / 2 := by |
| 46 | have hh := ht.2 |
| 47 | change t ∈ frontier (Iic (1 / 2 : ℝ)) at hh |
| 48 | simpa only [frontier_Iic, mem_singleton_iff] using hh |
| 49 | subst t |
| 50 | norm_num only [mul_div_cancel₀, OfNat.ofNat_ne_zero, sub_self] |
| 51 | exact hjoin |
| 52 | · apply hf.comp (continuous_const.mul continuous_id).continuousOn |
| 53 | intro t ht |
| 54 | have ht' : t ≤ 1 / 2 := by |
| 55 | simpa only [show {t : ℝ | t ≤ 1 / 2} = Iic (1 / 2) from rfl, |
| 56 | isClosed_Iic.closure_eq, mem_Iic] using ht.2 |
| 57 | exact hl t ⟨ht.1.1, ht'⟩ |
| 58 | · apply hg.comp ((continuous_const.mul continuous_id).sub continuous_const).continuousOn |
| 59 | intro t ht |
| 60 | have ht' : 1 / 2 ≤ t := by |
| 61 | have hh := ht.2 |
| 62 | simp only [not_le] at hh |
| 63 | change t ∈ closure (Ioi (1 / 2 : ℝ)) at hh |
| 64 | simpa only [closure_Ioi, mem_Ici] using hh |
| 65 | exact hr t ⟨ht', ht.1.2⟩ |
| 66 | refine ⟨q, hqc, by norm_num [q], by norm_num [q], ?_, ?_⟩ |
| 67 | · intro t ht |
| 68 | by_cases h : t ≤ 1 / 2 |
| 69 | · exact Or.inl ⟨2 * t, hl t ⟨ht.1, h⟩, (if_pos h).symm⟩ |
| 70 | · exact Or.inr ⟨2 * t - 1, hr t ⟨(le_of_not_ge h), ht.2⟩, (if_neg h).symm⟩ |
| 71 | · have hsplit := eVariationOn.Icc_add_Icc q (s := univ) |
| 72 | (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num : (1 / 2 : ℝ) ≤ 1) (mem_univ _) |
| 73 | simp only [univ_inter] at hsplit |
| 74 | rw [← hsplit, eVariationOn.eq_of_eqOn hleft, eVariationOn.eq_of_eqOn hright] |
| 75 | have himl : (fun t : ℝ => 2 * t) '' Icc 0 (1 / 2) = Icc (0 : ℝ) 1 := by |
| 76 | norm_num [image_mul_left_Icc' (by norm_num : (0 : ℝ) < 2)] |
| 77 | have himr : (fun t : ℝ => 2 * t - 1) '' Icc (1 / 2) 1 = Icc (0 : ℝ) 1 := by |
| 78 | have hcont : Continuous (fun t : ℝ => 2 * t - 1) := by fun_prop |
| 79 | have hmono : MonotoneOn (fun t : ℝ => 2 * t - 1) (Icc (1 / 2) 1) := by |
| 80 | intro x _ y _ hxy |
| 81 | linarith |
| 82 | convert hcont.continuousOn.image_Icc_of_monotoneOn |
| 83 | (by norm_num : (1 / 2 : ℝ) ≤ 1) hmono using 1 |
| 84 | norm_num |
| 85 | change eVariationOn (f ∘ fun t => 2 * t) (Icc 0 (1 / 2)) + |
| 86 | eVariationOn (g ∘ fun t => 2 * t - 1) (Icc (1 / 2) 1) = _ |
| 87 | rw [eVariationOn.comp_eq_of_monotoneOn f _ (by intro x _ y _ hxy; linarith), himl, |
| 88 | eVariationOn.comp_eq_of_monotoneOn g _ (by intro x _ y _ hxy; linarith), himr] |
| 89 | |
| 90 | end PoincareMT |