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.Interior.Geodesic |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Boundary.Geometry |
| 3 | import PoincareLib.Geometry.Riemannian.Distance.SegmentSpeed |
| 4 | |
| 5 | /-! |
| 6 | # Exact unit speed of the actual interior constrained minimizer |
| 7 | |
| 8 | The proved local metric-segment identity determines the initial speed |
| 9 | after an affine time change. No normalization is inferred merely from |
| 10 | the geodesic equation. Source: MT Claim 19.40, pp. 470-471, and |
| 11 | minimal-contact derivation, Section 7. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | set_option autoImplicit false |
| 16 | set_option backward.isDefEq.respectTransparency false |
| 17 | |
| 18 | open Set |
| 19 | open scoped Topology ENNReal Manifold ContDiff Bundle |
| 20 | |
| 21 | namespace PoincareMT |
| 22 | |
| 23 | attribute [local instance] normedAddCommGroupTangentSpaceVectorSpace |
| 24 | normedSpaceTangentSpaceVectorSpace |
| 25 | |
| 26 | /-- A smooth intrinsic metric segment with unit affine distance has actual tangent norm one |
| 27 | at its center. Source: MT Claim 19.40, pp. 470-471; |
| 28 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 7. -/ |
| 29 | theorem m64Intrinsic_unit_tangentNorm_of_local_metric_segment |
| 30 | (G : RiemannianMetric 2 AnnulusCoordinates) {gamma : ℝ → AnnulusCoordinates} |
| 31 | {u epsilon : ℝ} (hepsilon : 0 < epsilon) |
| 32 | (hgeo : G.IsGeodesicOn gamma (Ioo (u - epsilon) (u + epsilon))) |
| 33 | (hmetric : ∀ s ∈ Icc (u - epsilon) (u + epsilon), |
| 34 | ∀ t ∈ Icc (u - epsilon) (u + epsilon), |
| 35 | G.edist (gamma s) (gamma t) = ENNReal.ofReal |s - t|) : |
| 36 | G.tangentNorm (gamma u) (deriv gamma u) = 1 := by |
| 37 | let d := epsilon / 3 |
| 38 | have hd : 0 < d := by dsimp only [d]; positivity |
| 39 | have hdu : d < epsilon := by dsimp only [d]; linarith |
| 40 | have hd2 : 2 * d < epsilon := by dsimp only [d]; linarith |
| 41 | let eta := fun t : ℝ => gamma (d * t + u) |
| 42 | have heta : G.IsGeodesicOn eta (Ioo (-1 : ℝ) (1 + 1)) := by |
| 43 | intro t ht |
| 44 | apply hgeo.comp_affine d u |
| 45 | constructor <;> nlinarith [ht.1, ht.2] |
| 46 | have hu : u ∈ Ioo (u - epsilon) (u + epsilon) := ⟨by linarith, by linarith⟩ |
| 47 | have hdgamma : HasDerivAt gamma (deriv gamma u) u := |
| 48 | (contMDiffAt_iff_contDiffAt.mp (hgeo.contMDiffAt hu)).differentiableAt |
| 49 | (by simp) |>.hasDerivAt |
| 50 | have hdet : HasDerivAt eta (d • deriv gamma u) 0 := by |
| 51 | have hdgamma' : HasDerivAt gamma (deriv gamma u) (d * 0 + u) := by |
| 52 | simpa only [mul_zero, zero_add] using hdgamma |
| 53 | have hh := hdgamma'.scomp 0 (((hasDerivAt_id (0 : ℝ)).const_mul d).add_const u) |
| 54 | simpa only [eta, Function.comp_def, id_eq, mul_zero, zero_add, mul_one] using! hh |
| 55 | have hparam (t : ℝ) (ht : t ∈ Icc 0 1) : d * t + u ∈ Icc (u - epsilon) (u + epsilon) := |
| 56 | ⟨by nlinarith [ht.1], by nlinarith [ht.2]⟩ |
| 57 | have hend : G.edist (gamma u) (gamma (d + u)) = ENNReal.ofReal d := by |
| 58 | have hh := hmetric u (Ioo_subset_Icc_self hu) (d + u) (by |
| 59 | simpa only [mul_one] using hparam 1 ⟨zero_le_one, le_rfl⟩) |
| 60 | simpa only [show u - (d + u) = -d by ring, abs_neg, abs_of_pos hd] using hh |
| 61 | have hmin : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |
| 62 | G.edist (eta s) (eta t) = ENNReal.ofReal |s - t| * |
| 63 | G.edist (gamma u) (gamma (d + u)) := by |
| 64 | intro s hs t ht |
| 65 | rw [hmetric _ (hparam s hs) _ (hparam t ht), hend, |
| 66 | show d * s + u - (d * t + u) = d * (s - t) by ring, |
| 67 | abs_mul, abs_of_pos hd, ENNReal.ofReal_mul hd.le, mul_comm] |
| 68 | have hspeed := heta.initial_tangentNorm_eq_of_edist_segment zero_lt_one |
| 69 | (show eta 0 = gamma u by simp only [eta, mul_zero, zero_add]) |
| 70 | (show HasDerivAt (fun t => extChartAt (𝓡 2) (gamma u) (eta t)) |
| 71 | (d • deriv gamma u) 0 from by |
| 72 | simpa only [extChartAt_model_space_eq_id, PartialEquiv.refl_coe, id_eq] using hdet) |
| 73 | hmin |
| 74 | rw [hend] at hspeed |
| 75 | have hreal := (ENNReal.ofReal_eq_ofReal_iff (Real.sqrt_nonneg _) hd.le).mp hspeed |
| 76 | change G.tangentNorm (gamma u) (d • deriv gamma u) = d at hreal |
| 77 | have hscale : G.tangentNorm (gamma u) (d • deriv gamma u) = |
| 78 | d * G.tangentNorm (gamma u) (deriv gamma u) := by |
| 79 | simp only [RiemannianMetric.tangentNorm, map_smul, smul_apply, smul_eq_mul] |
| 80 | rw [← mul_assoc, ← pow_two, Real.sqrt_mul (sq_nonneg d), Real.sqrt_sq hd.le] |
| 81 | rw [hscale] at hreal |
| 82 | exact (mul_left_cancel₀ hd.ne' (hreal.trans (mul_one d).symm)) |
| 83 | |
| 84 | /-- The original constrained minimizer has intrinsic speed exactly one at every parameter |
| 85 | whose image lies in the interior of the region. Source: MT Claim 19.40, pp. 470-471; |
| 86 | `proof-work/tasks/M64/derivations/2026-09-27-minimal-contact-regularity.md`, Section 7. -/ |
| 87 | theorem m64Intrinsic_constrained_minimizer_interior_unit_speed |
| 88 | (G : RiemannianMetric 2 AnnulusCoordinates) {K : Set AnnulusCoordinates} |
| 89 | (hK : IsCompact K) {gamma : ℝ → AnnulusCoordinates} {L : ℝ} |
| 90 | (hlip : ∀ s ∈ Icc 0 L, ∀ t ∈ Icc 0 L, |
| 91 | G.edist (gamma s) (gamma t) ≤ ENNReal.ofReal |s - t|) |
| 92 | (hmin : ∀ a ∈ Icc 0 L, ∀ b ∈ Icc 0 L, a ≤ b → |
| 93 | ∀ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) → |
| 94 | tau 0 = gamma a → tau 1 = gamma b → MapsTo tau (Icc 0 1) K → |
| 95 | ENNReal.ofReal (b - a) ≤ m64IntrinsicCurveVariation G tau 0 1) |
| 96 | {u : ℝ} (hu : u ∈ Ioo 0 L) (hinside : gamma u ∈ interior K) : |
| 97 | G.tangentNorm (gamma u) (deriv gamma u) = 1 := by |
| 98 | obtain ⟨epsilon, hepsilon, _, hmetric⟩ := |
| 99 | m64Intrinsic_constrained_minimizer_local_metric_segment G hK hlip hmin hu hinside |
| 100 | obtain ⟨hgeo, _⟩ := G.isGeodesicOn_and_contMDiffOn_of_edist_affine_segment |
| 101 | (γ := gamma) (a := u - epsilon) (b := u + epsilon) (c := 1) zero_le_one (by |
| 102 | intro s hs t ht |
| 103 | simpa only [one_mul] using hmetric s (Ioo_subset_Icc_self hs) t (Ioo_subset_Icc_self ht)) |
| 104 | exact m64Intrinsic_unit_tangentNorm_of_local_metric_segment G hepsilon hgeo hmetric |
| 105 | |
| 106 | end PoincareMT |