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.Digon.RegularFans |
| 2 | |
| 3 | /-! Exact canonical defect sum for the original two-corner region. |
| 4 | Source: MT Claim 19.41; short-geodesic-digons derivation, Section 2. -/ |
| 5 | |
| 6 | noncomputable section |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Set |
| 11 | open scoped Topology ContDiff Manifold |
| 12 | open PoincareMT.Topology.Surface |
| 13 | |
| 14 | namespace PoincareMT |
| 15 | |
| 16 | /-- An actual canonical vertex fan is a sum of nonnegative triangle angles. Source: MT Claim |
| 17 | 19.41; short-geodesic-digons derivation, Section 2. Source/construction: |
| 18 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 2. -/ |
| 19 | theorem m64Intrinsic_coordinate_vertex_angle_nonneg |
| 20 | {I : Type*} [Fintype I] (g : RiemannianMetric 2 AnnulusCoordinates) |
| 21 | (F : I → OpenPartialHomeomorph AnnulusCoordinates AnnulusCoordinates) |
| 22 | (b : I → AffineBasis (Fin 3) ℝ AnnulusCoordinates) (q : AnnulusCoordinates) : |
| 23 | 0 ≤ coordinateVertexAngleContribution g F b q := by |
| 24 | unfold coordinateVertexAngleContribution |
| 25 | apply Finset.sum_nonneg |
| 26 | intro i _ |
| 27 | apply Finset.sum_nonneg |
| 28 | intro k _ |
| 29 | split_ifs |
| 30 | · exact Real.arccos_nonneg _ |
| 31 | · exact le_rfl |
| 32 | |
| 33 | open Classical in |
| 34 | /-- All noncorner defects cancel, leaving exactly pi minus each of the two original occupied |
| 35 | angles. Neither angle is assumed acute or convex. Source: MT Claim 19.41; |
| 36 | short-geodesic-digons derivation, Section 2. Source/construction: |
| 37 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 2. -/ |
| 38 | theorem m64Intrinsic_digon_fan_defects |
| 39 | {U V : Set AnnulusCoordinates} (R : M64IntrinsicCoordinateTriangulation (closure U)) |
| 40 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 41 | {alpha beta : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) |
| 42 | (hb : ContDiff ℝ ∞ beta) {A B : ℝ} (hA : 0 < A) |
| 43 | (hai : InjOn alpha (Icc 0 A)) (hbi : InjOn beta (Icc 0 B)) |
| 44 | (hareg : ∀ t ∈ Ioo 0 A, deriv alpha t ≠ 0) |
| 45 | (hbreg : ∀ t ∈ Ioo 0 B, deriv beta t ≠ 0) |
| 46 | (hbase : beta 0 = alpha 0) (hend : beta B = alpha A) |
| 47 | (hmeet : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, |
| 48 | alpha s = beta t → (s = 0 ∧ t = 0) ∨ (s = A ∧ t = B)) |
| 49 | (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 50 | (hfront : frontier U = alpha '' Icc 0 A ∪ beta '' Icc 0 B) |
| 51 | (hfV : frontier V = frontier U) |
| 52 | (v0 v1 : Euler.CoordinateVertex R.coordinates R.basis) |
| 53 | (hv0 : v0.1 = alpha 0) (hv1 : v1.1 = alpha A) : |
| 54 | let _ := Fintype.ofFinite (Euler.CoordinateVertex R.coordinates R.basis) |
| 55 | (∑ v : Euler.CoordinateVertex R.coordinates R.basis, |
| 56 | ((if v.1 ∈ frontier U then Real.pi else 2 * Real.pi) - |
| 57 | coordinateVertexAngleContribution g R.coordinates R.basis v.1)) = |
| 58 | 2 * Real.pi - coordinateVertexAngleContribution g R.coordinates R.basis v0.1 - |
| 59 | coordinateVertexAngleContribution g R.coordinates R.basis v1.1 := by |
| 60 | classical |
| 61 | let _ := Fintype.ofFinite (Euler.CoordinateVertex R.coordinates R.basis) |
| 62 | let defect (v : Euler.CoordinateVertex R.coordinates R.basis) := |
| 63 | (if v.1 ∈ frontier U then Real.pi else 2 * Real.pi) - |
| 64 | coordinateVertexAngleContribution g R.coordinates R.basis v.1 |
| 65 | change (∑ v, defect v) = _ |
| 66 | have hzero (v : Euler.CoordinateVertex R.coordinates R.basis) |
| 67 | (h0 : v.1 ≠ alpha 0) (h1 : v.1 ≠ alpha A) : defect v = 0 := by |
| 68 | have hf := m64Intrinsic_digon_regular_vertex_fan R g ha hb hai hbi hareg hbreg |
| 69 | hbase hend hmeet hU hV hUV hfront hfV v h0 h1 |
| 70 | simp only [defect, hf, sub_self] |
| 71 | have hmem0 : v0.1 ∈ frontier U := by |
| 72 | rw [hfront] |
| 73 | exact Or.inl ⟨0, ⟨le_rfl, hA.le⟩, hv0.symm⟩ |
| 74 | have hmem1 : v1.1 ∈ frontier U := by |
| 75 | rw [hfront] |
| 76 | exact Or.inl ⟨A, ⟨hA.le, le_rfl⟩, hv1.symm⟩ |
| 77 | have hne : v0 ≠ v1 := by |
| 78 | intro h |
| 79 | exact hA.ne (hai ⟨le_rfl, hA.le⟩ ⟨hA.le, le_rfl⟩ |
| 80 | (hv0.symm.trans ((congrArg Subtype.val h).trans hv1))) |
| 81 | have hsum : (∑ v, defect v) = ∑ v ∈ ({v0, v1} : Finset _), defect v := by |
| 82 | symm |
| 83 | apply Finset.sum_subset (Finset.subset_univ _) |
| 84 | intro v _ hv |
| 85 | apply hzero |
| 86 | · intro h |
| 87 | exact hv (Finset.mem_insert.mpr (Or.inl (Subtype.ext (h.trans hv0.symm)))) |
| 88 | · intro h |
| 89 | exact hv (Finset.mem_insert.mpr (Or.inr |
| 90 | (Finset.mem_singleton.mpr (Subtype.ext (h.trans hv1.symm))))) |
| 91 | rw [hsum, Finset.sum_pair hne] |
| 92 | simp only [defect, if_pos hmem0, if_pos hmem1] |
| 93 | ring |
| 94 | |
| 95 | end PoincareMT |