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.Boundary.PathLength |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Subarc.LengthDecrease |
| 3 | |
| 4 | /-! The actual short boundary competitor in a collision disk. |
| 5 | The nearer endpoint is selected by intrinsic arc length, then its normal |
| 6 | side is concatenated without requiring smoothness at the corner. |
| 7 | Source: MT Claim 19.40, pp. 470-471. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option warningAsError true |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set |
| 15 | open scoped ENNReal Manifold ContDiff |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | private theorem boundary_side_competitor |
| 20 | (N : IntrinsicAnnulus) {K : Set AnnulusCoordinates} {p q A : ℝ} (hA : 0 ≤ A) |
| 21 | {alpha : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) |
| 22 | (hunit : ∀ t ∈ Icc 0 A, N.metric.inner (alpha t) (deriv alpha t) (deriv alpha t) = 1) |
| 23 | (hstart : alpha 0 = intrinsicAnnulusBoundary 1 q) |
| 24 | (hside : MapsTo alpha (Icc 0 A) K) |
| 25 | (hbase : MapsTo (intrinsicAnnulusBoundary 1) (Icc (min p q) (max p q)) K) : |
| 26 | ∃ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) ∧ |
| 27 | tau 0 = intrinsicAnnulusBoundary 1 p ∧ tau 1 = alpha A ∧ MapsTo tau (Icc 0 1) K ∧ |
| 28 | m64IntrinsicCurveVariation N.metric tau 0 1 ≤ |
| 29 | ENNReal.ofReal (intrinsicBoundaryLength N.metric 1 (min p q) (max p q) + A) := by |
| 30 | let f := fun t : ℝ => intrinsicAnnulusBoundary 1 (p + (q - p) * t) |
| 31 | let g := fun t : ℝ => alpha (A * t) |
| 32 | have hf : ContinuousOn f (Icc 0 1) := |
| 33 | ((m64Intrinsic_contDiff_boundary 1).continuous.comp |
| 34 | (continuous_const.add (continuous_const.mul continuous_id))).continuousOn |
| 35 | have hg : ContinuousOn g (Icc 0 1) := |
| 36 | (ha.continuous.comp (continuous_const.mul continuous_id)).continuousOn |
| 37 | have hj : f 1 = g 0 := by simpa only [f, g, mul_one, add_sub_cancel, mul_zero] using hstart.symm |
| 38 | have hfp (t : ℝ) (ht : t ∈ Icc 0 1) : p + (q - p) * t ∈ Icc (min p q) (max p q) := by |
| 39 | rcases le_total p q with hpq | hqp |
| 40 | · rw [min_eq_left hpq, max_eq_right hpq] |
| 41 | constructor <;> nlinarith [ht.1, ht.2] |
| 42 | · rw [min_eq_right hqp, max_eq_left hqp] |
| 43 | constructor <;> nlinarith [ht.1, ht.2] |
| 44 | have hgp (t : ℝ) (ht : t ∈ Icc 0 1) : A * t ∈ Icc (0 : ℝ) A := by |
| 45 | constructor <;> nlinarith [ht.1, ht.2] |
| 46 | have hfvar : m64IntrinsicCurveVariation N.metric f 0 1 ≤ |
| 47 | ENNReal.ofReal (intrinsicBoundaryLength N.metric 1 (min p q) (max p q)) := by |
| 48 | rw [show f = (fun t => intrinsicAnnulusBoundary 1 (p + (q - p) * t)) from rfl, |
| 49 | m64Intrinsic_curveVariation_affine] |
| 50 | exact m64Intrinsic_boundary_curveVariation_le N one_ne_zero (min_le_max) |
| 51 | have hgvar : m64IntrinsicCurveVariation N.metric g 0 1 ≤ ENNReal.ofReal A := by |
| 52 | have hvar := m64Intrinsic_curveVariation_affine N.metric alpha 0 A |
| 53 | simp only [zero_add, sub_zero, min_eq_left hA, max_eq_right hA] at hvar |
| 54 | rw [show g = (fun t => alpha (A * t)) from rfl, hvar] |
| 55 | simpa only [sub_zero] using m64Intrinsic_unit_curveVariation_le N ha hunit |
| 56 | obtain ⟨tau, htc, ht0, ht1, htimage, htvar⟩ := |
| 57 | m64Intrinsic_exists_join_with_variation N.metric hf hg hj |
| 58 | refine ⟨tau, htc, ?_, ?_, ?_, ?_⟩ |
| 59 | · simpa only [f, mul_zero, add_zero] using ht0 |
| 60 | · simpa only [g, mul_one] using ht1 |
| 61 | · intro t ht |
| 62 | rcases htimage t ht with ⟨s, hs, heq⟩ | ⟨s, hs, heq⟩ |
| 63 | · exact heq ▸ hbase (hfp s hs) |
| 64 | · exact heq ▸ hside (hgp s hs) |
| 65 | · rw [htvar] |
| 66 | have hlength := m64Intrinsic_boundaryLength_nonneg N 1 (min p q) (max p q) min_le_max |
| 67 | exact (add_le_add hfvar hgvar).trans_eq (ENNReal.ofReal_add hlength hA).symm |
| 68 | |
| 69 | /-- The actual base arc and two unit-speed sides provide a path from each base point to |
| 70 | their common vertex, of length at most half the base plus the larger side length. The whole |
| 71 | path stays in the given closed region. Source: MT Claim 19.40, pp. 470-471; |
| 72 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 7. -/ |
| 73 | theorem m64Intrinsic_exists_short_collision_competitor |
| 74 | (N : IntrinsicAnnulus) {K : Set AnnulusCoordinates} |
| 75 | {a b A B p : ℝ} (hp : p ∈ Icc a b) (hA : 0 ≤ A) (hB : 0 ≤ B) |
| 76 | {alpha beta : ℝ → AnnulusCoordinates} |
| 77 | (ha : ContDiff ℝ ∞ alpha) (hb : ContDiff ℝ ∞ beta) |
| 78 | (hunitA : ∀ t ∈ Icc 0 A, N.metric.inner (alpha t) (deriv alpha t) (deriv alpha t) = 1) |
| 79 | (hunitB : ∀ t ∈ Icc 0 B, N.metric.inner (beta t) (deriv beta t) (deriv beta t) = 1) |
| 80 | (ha0 : alpha 0 = intrinsicAnnulusBoundary 1 a) |
| 81 | (hb0 : beta 0 = intrinsicAnnulusBoundary 1 b) (hmeet : alpha A = beta B) |
| 82 | (hsideA : MapsTo alpha (Icc 0 A) K) (hsideB : MapsTo beta (Icc 0 B) K) |
| 83 | (hbase : MapsTo (intrinsicAnnulusBoundary 1) (Icc a b) K) : |
| 84 | ∃ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) ∧ |
| 85 | tau 0 = intrinsicAnnulusBoundary 1 p ∧ tau 1 = alpha A ∧ MapsTo tau (Icc 0 1) K ∧ |
| 86 | m64IntrinsicCurveVariation N.metric tau 0 1 ≤ |
| 87 | ENNReal.ofReal (intrinsicBoundaryLength N.metric 1 a b / 2 + max A B) := by |
| 88 | have hsum : intrinsicBoundaryLength N.metric 1 a b = |
| 89 | intrinsicBoundaryLength N.metric 1 a p + intrinsicBoundaryLength N.metric 1 p b := by |
| 90 | have h := m64Intrinsic_boundaryLength_subarc_decomposition N |
| 91 | (a := a) (b := b) (c := p) (d := p) one_ne_zero |
| 92 | simpa only [intrinsicBoundaryLength, intervalIntegral.integral_same, add_zero] using h |
| 93 | by_cases hleft : intrinsicBoundaryLength N.metric 1 a p ≤ intrinsicBoundaryLength N.metric 1 p b |
| 94 | · have hbase' : MapsTo (intrinsicAnnulusBoundary 1) (Icc (min p a) (max p a)) K := by |
| 95 | rw [min_eq_right hp.1, max_eq_left hp.1] |
| 96 | exact hbase.mono (Icc_subset_Icc le_rfl hp.2) (Subset.rfl) |
| 97 | obtain ⟨tau, htc, ht0, ht1, htconf, htvar⟩ := |
| 98 | boundary_side_competitor N hA ha hunitA ha0 hsideA hbase' |
| 99 | refine ⟨tau, htc, ht0, ht1, htconf, htvar.trans (ENNReal.ofReal_le_ofReal ?_)⟩ |
| 100 | rw [min_eq_right hp.1, max_eq_left hp.1] |
| 101 | linarith [le_max_left A B] |
| 102 | · have hbase' : MapsTo (intrinsicAnnulusBoundary 1) (Icc (min p b) (max p b)) K := by |
| 103 | rw [min_eq_left hp.2, max_eq_right hp.2] |
| 104 | exact hbase.mono (Icc_subset_Icc hp.1 le_rfl) (Subset.rfl) |
| 105 | obtain ⟨tau, htc, ht0, ht1, htconf, htvar⟩ := |
| 106 | boundary_side_competitor N hB hb hunitB hb0 hsideB hbase' |
| 107 | refine ⟨tau, htc, ht0, ht1.trans hmeet.symm, htconf, |
| 108 | htvar.trans (ENNReal.ofReal_le_ofReal ?_)⟩ |
| 109 | rw [min_eq_left hp.2, max_eq_right hp.2] |
| 110 | linarith [le_max_right A B] |
| 111 | |
| 112 | end PoincareMT |