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.Affine.CollisionBoundaryAvoidance |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Compact.GeodesicRepresentative |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Interior.UnitSpeed |
| 4 | |
| 5 | /-! The actual confined minimizer as a smooth closed unit geodesic. |
| 6 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 7 | Section 17. Compact continuation preserves the original closed segment. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set Filter |
| 14 | open scoped Topology ContDiff Manifold ENNReal |
| 15 | |
| 16 | namespace PoincareMT |
| 17 | |
| 18 | /-- A positive-length compact minimizer whose open image is in the open constraint region |
| 19 | has a smooth representative with unit speed on the whole closed interval. Its closed values |
| 20 | and actual endpoint derivatives are retained. Source: MT Claim 19.40; derivation Section 17. |
| 21 | Source: MT Claim 19.40, pp. 470-471; |
| 22 | `proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md`, Section |
| 23 | 17. -/ |
| 24 | theorem m64Intrinsic_constrained_minimizer_smooth_unit_geodesic |
| 25 | (G : RiemannianMetric 2 AnnulusCoordinates) {U : Set AnnulusCoordinates} |
| 26 | (hU : IsOpen U) (hcompact : IsCompact (closure U)) |
| 27 | {gamma : ℝ → AnnulusCoordinates} {T : ℝ} (hT : 0 < T) |
| 28 | (hc : ContinuousOn gamma (Icc 0 T)) (hinside : MapsTo gamma (Ioo 0 T) U) |
| 29 | (hlip : ∀ s ∈ Icc 0 T, ∀ t ∈ Icc 0 T, |
| 30 | G.edist (gamma s) (gamma t) ≤ ENNReal.ofReal |s - t|) |
| 31 | (hmin : ∀ s ∈ Icc 0 T, ∀ t ∈ Icc 0 T, s ≤ t → |
| 32 | ∀ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) → |
| 33 | tau 0 = gamma s → tau 1 = gamma t → MapsTo tau (Icc 0 1) (closure U) → |
| 34 | ENNReal.ofReal (t - s) ≤ m64IntrinsicCurveVariation G tau 0 1) : |
| 35 | ∃ eta : ℝ → AnnulusCoordinates, |
| 36 | ContDiff ℝ ∞ eta ∧ EqOn eta gamma (Icc 0 T) ∧ |
| 37 | G.IsGeodesicOn eta (Icc 0 T) ∧ |
| 38 | (∀ t ∈ Icc 0 T, G.inner (eta t) (deriv eta t) (deriv eta t) = 1) ∧ |
| 39 | (∀ t ∈ Icc 0 T, deriv eta t ≠ 0) ∧ |
| 40 | HasDerivWithinAt gamma (deriv eta 0) (Ioi 0) 0 ∧ |
| 41 | HasDerivWithinAt gamma (deriv eta T) (Iio T) T := by |
| 42 | obtain ⟨hgeo, _⟩ := |
| 43 | m64Intrinsic_constrained_minimizer_geodesic_of_open_confinement |
| 44 | G hU hcompact hinside hlip hmin |
| 45 | obtain ⟨eta, heta, heq, hegeo, hd0, hdT⟩ := |
| 46 | m64Intrinsic_compact_geodesic_smooth_representative G hcompact hT hc hgeo |
| 47 | (fun t ht => subset_closure (hinside ht)) |
| 48 | have hm : T / 2 ∈ Ioo 0 T := ⟨by linarith, by linarith⟩ |
| 49 | have hmcc := Ioo_subset_Icc_self hm |
| 50 | have hUi : U ⊆ interior (closure U) := by |
| 51 | calc |
| 52 | U = interior U := hU.interior_eq.symm |
| 53 | _ ⊆ interior (closure U) := interior_mono subset_closure |
| 54 | have hmid : G.tangentNorm (eta (T / 2)) (deriv eta (T / 2)) = 1 := by |
| 55 | have hnear : eta =ᶠ[𝓝 (T / 2)] gamma := by |
| 56 | filter_upwards [isOpen_Ioo.mem_nhds hm] with t ht |
| 57 | exact heq (Ioo_subset_Icc_self ht) |
| 58 | rw [heq hmcc, hnear.deriv_eq] |
| 59 | exact m64Intrinsic_constrained_minimizer_interior_unit_speed |
| 60 | G hcompact hlip hmin hm (hUi (hinside hm)) |
| 61 | have hspeed (t : ℝ) (ht : t ∈ Icc 0 T) : |
| 62 | G.tangentNorm (eta t) (deriv eta t) = 1 := by |
| 63 | have hd (s : ℝ) (hs : s ∈ Icc 0 T) : |
| 64 | HasDerivWithinAt (fun x => G.tangentNorm (eta x) (deriv eta x)) 0 (Icc 0 T) s := by |
| 65 | have hh := hegeo.hasDerivAt_tangentNorm_zero hs |
| 66 | change HasDerivAt |
| 67 | (fun x => G.tangentNorm (eta x) (curveVelocity (n := 2) eta x)) 0 s at hh |
| 68 | simp_rw [m64Intrinsic_curveVelocity_eq_deriv] at hh |
| 69 | exact hh.hasDerivWithinAt |
| 70 | have hh := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le hd |
| 71 | (show ∀ s ∈ Icc 0 T, ‖(0 : ℝ)‖ ≤ 0 from fun _ _ => by simp) |
| 72 | (convex_Icc 0 T) hmcc ht |
| 73 | have hequal : G.tangentNorm (eta t) (deriv eta t) = |
| 74 | G.tangentNorm (eta (T / 2)) (deriv eta (T / 2)) := by |
| 75 | simpa only [zero_mul, norm_le_zero_iff, sub_eq_zero] using hh |
| 76 | exact hequal.trans hmid |
| 77 | have hreg (t : ℝ) (ht : t ∈ Icc 0 T) : deriv eta t ≠ 0 := by |
| 78 | intro hz |
| 79 | have hu := hspeed t ht |
| 80 | simp only [hz, RiemannianMetric.tangentNorm, map_zero, Real.sqrt_zero] at hu |
| 81 | exact zero_ne_one hu |
| 82 | refine ⟨eta, heta, heq, hegeo, ?_, hreg, hd0, hdT⟩ |
| 83 | intro t ht |
| 84 | have hsq : G.tangentNorm (eta t) (deriv eta t) ^ 2 = |
| 85 | G.inner (eta t) (deriv eta t) (deriv eta t) := |
| 86 | Real.sq_sqrt (G.pos (eta t) (deriv eta t) (hreg t ht)).le |
| 87 | rw [hspeed t ht, one_pow] at hsq |
| 88 | exact hsq.symm |
| 89 | |
| 90 | end PoincareMT |