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.Cap.ChordSigns |
| 2 | import PoincareLib.Topology.Plane.Triangles.CapSeparation |
| 3 | |
| 4 | /-! |
| 5 | # Actual cap separators in the original loop parameter |
| 6 | |
| 7 | The cap chord separator is normalized on the original loop tangent. Its |
| 8 | sign reverses at the terminal endpoint, where the fitted radial axis runs |
| 9 | backward along the loop. |
| 10 | |
| 11 | Morgan--Tian context: Proposition 19.35, printed pp. 467-481, including Claim 19.40, |
| 12 | pp. 470-471. These project constructions provide actual fitted boundary pieces and |
| 13 | contacts for the regional Gauss--Bonnet arguments. |
| 14 | -/ |
| 15 | |
| 16 | noncomputable section |
| 17 | set_option autoImplicit false |
| 18 | set_option backward.isDefEq.respectTransparency false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Topology ContDiff |
| 22 | open Poincare.Topology.Plane.Triangles |
| 23 | |
| 24 | namespace PoincareMT |
| 25 | |
| 26 | /-- The actual smooth cap constructs a chord separator, with the exact outgoing or incoming |
| 27 | normalization on the original loop derivative. Source: |
| 28 | `proof-work/tasks/M64/reviews/2026-09-27-intrinsic-obstacle-bands-review.md`, round_1, check |
| 29 | 5. -/ |
| 30 | theorem m64Intrinsic_exists_cap_endpoint_separator |
| 31 | {gamma : ℝ → AnnulusCoordinates} (hg : ContDiff ℝ ∞ gamma) {T r : ℝ} (hr : 0 < r) |
| 32 | (F : OpenPartialHomeomorph (ℝ × ℝ) AnnulusCoordinates) |
| 33 | (hsource : {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r} ⊆ F.source) |
| 34 | (hF : ContDiffOn ℝ ∞ F F.source) (hFi : ContDiffOn ℝ ∞ F.symm F.target) |
| 35 | (hchord : ∀ t : ℝ, F ((1 - t) * r, t * r) = |
| 36 | (1 - t) • F (r, 0) + t • F (0, r)) |
| 37 | (terminal vertical : Bool) |
| 38 | (haxis : ∀ s ∈ Icc (0 : ℝ) r, |
| 39 | F (if vertical then (0, s) else (s, 0)) = gamma (if terminal then T - s else s)) : |
| 40 | ∃ (ell : AnnulusCoordinates →L[ℝ] ℝ) (W : Set AnnulusCoordinates), |
| 41 | IsOpen W ∧ gamma (if terminal then T - r else r) ∈ W ∧ |
| 42 | ell (deriv gamma (if terminal then T - r else r)) = (if terminal then -1 else 1) ∧ |
| 43 | ell (if vertical then F (r, 0) - F (0, r) else F (0, r) - F (r, 0)) = 0 ∧ |
| 44 | ∀ z ∈ W ∩ F '' {q : ℝ × ℝ | 0 ≤ q.1 ∧ 0 ≤ q.2 ∧ q.1 + q.2 ≤ r}, |
| 45 | ell (z - gamma (if terminal then T - r else r)) ≤ 0 := by |
| 46 | let b : ℝ → AnnulusCoordinates := fun s => F (if vertical then (0, s) else (s, 0)) |
| 47 | let beta : ℝ → AnnulusCoordinates := fun s => gamma (if terminal then T - s else s) |
| 48 | have hrI : r ∈ Icc (0 : ℝ) r := ⟨hr.le, le_rfl⟩ |
| 49 | have hbs : (if vertical then ((0 : ℝ), r) else (r, 0)) ∈ F.source := by |
| 50 | apply hsource |
| 51 | cases vertical <;> simp [hr.le] |
| 52 | have hb : DifferentiableAt ℝ b r := by |
| 53 | have hdF := (hF.contDiffAt (F.open_source.mem_nhds hbs)).differentiableAt (by simp) |
| 54 | cases vertical |
| 55 | · exact hdF.comp r (differentiableAt_id.prodMk (differentiableAt_const (0 : ℝ))) |
| 56 | · exact hdF.comp r ((differentiableAt_const (0 : ℝ)).prodMk differentiableAt_id) |
| 57 | have hbeta : ContDiff ℝ ∞ beta := by |
| 58 | cases terminal |
| 59 | · exact hg |
| 60 | · exact hg.comp (contDiff_const.sub contDiff_id) |
| 61 | have hderiv : deriv b r = deriv beta r := by |
| 62 | rw [← hb.derivWithin (uniqueDiffOn_Icc hr r hrI), |
| 63 | ← ((hbeta.differentiable (by simp)) r).derivWithin (uniqueDiffOn_Icc hr r hrI)] |
| 64 | exact derivWithin_congr haxis (haxis r hrI) |
| 65 | obtain ⟨ell, W, hnorm, hker, hW, hpW, _, hbound⟩ := |
| 66 | exists_cap_chord_separator F hF hFi hr hsource hchord vertical |
| 67 | have hbase : (if vertical then F (0, r) else F (r, 0)) = |
| 68 | gamma (if terminal then T - r else r) := by |
| 69 | cases vertical <;> exact haxis r hrI |
| 70 | have hnorm' : ell (deriv b r) = 1 := by cases vertical <;> exact hnorm |
| 71 | rw [hderiv] at hnorm' |
| 72 | refine ⟨ell, W, hW, hbase ▸ hpW, ?_, hker, ?_⟩ |
| 73 | · cases terminal |
| 74 | · exact hnorm' |
| 75 | · simp only [beta, ite_true, deriv_comp_const_sub, map_neg] at hnorm' |
| 76 | dsimp |
| 77 | linarith |
| 78 | · intro z hz |
| 79 | simpa only [hbase] using hbound z hz |
| 80 | |
| 81 | end PoincareMT |