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.Triangle.Triangulation |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Three.ArcStraightFan |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Arc.BoundaryFans |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Regional.InteriorFans |
| 5 | |
| 6 | /-! All noncorner fans in the actual three-corner collision mesh. |
| 7 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 8 | Section 9. The original arcs and sole-contact conditions locate every fan. -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set |
| 15 | open scoped Topology ContDiff Manifold Matrix |
| 16 | open PoincareMT.Topology.Surface |
| 17 | |
| 18 | namespace PoincareMT |
| 19 | |
| 20 | open Classical in |
| 21 | /-- Every actual vertex other than the original three corners has the regular boundary or |
| 22 | interior fan. Source: MT Claim 19.40; normal-collision-transversality derivation, Section 9. |
| 23 | Project construction: |
| 24 | `proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md`, Section 9. -/ |
| 25 | theorem m64Intrinsic_triangle_region_regular_vertex_fan |
| 26 | {U V : Set AnnulusCoordinates} (R : M64IntrinsicCoordinateTriangulation (closure U)) |
| 27 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 28 | {base alpha beta : ℝ → AnnulusCoordinates} {D A B : ℝ} |
| 29 | (hc : ContDiff ℝ ∞ base) (ha : ContDiff ℝ ∞ alpha) (hb : ContDiff ℝ ∞ beta) |
| 30 | (hci : InjOn base (Icc 0 D)) (hai : InjOn alpha (Icc 0 A)) |
| 31 | (hbi : InjOn beta (Icc 0 B)) |
| 32 | (hcreg : ∀ t ∈ Ioo 0 D, deriv base t ≠ 0) |
| 33 | (hareg : ∀ t ∈ Ioo 0 A, deriv alpha t ≠ 0) |
| 34 | (hbreg : ∀ t ∈ Ioo 0 B, deriv beta t ≠ 0) |
| 35 | (hstartA : base 0 = alpha 0) (hstartB : base D = beta 0) |
| 36 | (hmeet : alpha A = beta B) |
| 37 | (hbaseA : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 A, base s = alpha t → s = 0 ∧ t = 0) |
| 38 | (hbaseB : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 B, base s = beta t → s = D ∧ t = 0) |
| 39 | (hsides : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, alpha s = beta t → s = A ∧ t = B) |
| 40 | (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 41 | (hfront : frontier U = base '' Icc 0 D ∪ (alpha '' Icc 0 A ∪ beta '' Icc 0 B)) |
| 42 | (hfV : frontier V = frontier U) |
| 43 | (v : Euler.CoordinateVertex R.coordinates R.basis) |
| 44 | (hv0 : v.1 ≠ base 0) (hv1 : v.1 ≠ base D) (hvT : v.1 ≠ alpha A) : |
| 45 | coordinateVertexAngleContribution g R.coordinates R.basis v.1 = |
| 46 | if v.1 ∈ frontier U then Real.pi else 2 * Real.pi := by |
| 47 | have hregular_fan {eta : ℝ → AnnulusCoordinates} {a b p : ℝ} |
| 48 | (he : ContDiff ℝ ∞ eta) (hei : InjOn eta (Icc a b)) (hp : p ∈ Ioo a b) |
| 49 | (hr : deriv eta p ≠ 0) {K : Set AnnulusCoordinates} (hK : IsCompact K) |
| 50 | (hpK : eta p ∉ K) (hf : frontier U = eta '' Icc a b ∪ K) |
| 51 | (hv : v.1 = eta p) : |
| 52 | coordinateVertexAngleContribution g R.coordinates R.basis v.1 = Real.pi := |
| 53 | m64Intrinsic_region_arc_boundary_fan R.face R.coordinates R.basis R.smooth |
| 54 | R.inverse_smooth R.source R.carrier R.boundary R.boundary_injective |
| 55 | R.intersections R.intersection_frontier g he hei hp hr hK hpK |
| 56 | hU hV hUV hf hfV R.cover v hv |
| 57 | by_cases hvboundary : v.1 ∈ frontier U |
| 58 | · rw [if_pos hvboundary] |
| 59 | rw [hfront] at hvboundary |
| 60 | rcases hvboundary with hvc | hva | hvb |
| 61 | · obtain ⟨p, hp, hpv⟩ := hvc |
| 62 | have hp0 : 0 < p := lt_of_le_of_ne hp.1 (fun h => |
| 63 | hv0 (hpv.symm.trans (congrArg base h.symm))) |
| 64 | have hpD : p < D := lt_of_le_of_ne hp.2 (fun h => |
| 65 | hv1 (hpv.symm.trans (congrArg base h))) |
| 66 | have hpK : base p ∉ alpha '' Icc 0 A ∪ beta '' Icc 0 B := by |
| 67 | rintro (⟨t, ht, he⟩ | ⟨t, ht, he⟩) |
| 68 | · exact hp0.ne' (hbaseA p hp t ht he.symm).1 |
| 69 | · exact hpD.ne (hbaseB p hp t ht he.symm).1 |
| 70 | exact hregular_fan hc hci ⟨hp0, hpD⟩ (hcreg p ⟨hp0, hpD⟩) |
| 71 | ((isCompact_Icc.image ha.continuous).union (isCompact_Icc.image hb.continuous)) |
| 72 | hpK hfront hpv.symm |
| 73 | · obtain ⟨p, hp, hpv⟩ := hva |
| 74 | have hp0 : 0 < p := lt_of_le_of_ne hp.1 (fun h => |
| 75 | hv0 (hpv.symm.trans ((congrArg alpha h.symm).trans hstartA.symm))) |
| 76 | have hpA : p < A := lt_of_le_of_ne hp.2 (fun h => |
| 77 | hvT (hpv.symm.trans (congrArg alpha h))) |
| 78 | have hpK : alpha p ∉ base '' Icc 0 D ∪ beta '' Icc 0 B := by |
| 79 | rintro (⟨t, ht, he⟩ | ⟨t, ht, he⟩) |
| 80 | · exact hp0.ne' (hbaseA t ht p hp he).2 |
| 81 | · exact hpA.ne (hsides p hp t ht he.symm).1 |
| 82 | exact hregular_fan ha hai ⟨hp0, hpA⟩ (hareg p ⟨hp0, hpA⟩) |
| 83 | ((isCompact_Icc.image hc.continuous).union (isCompact_Icc.image hb.continuous)) |
| 84 | hpK (hfront.trans (by ac_rfl)) hpv.symm |
| 85 | · obtain ⟨p, hp, hpv⟩ := hvb |
| 86 | have hp0 : 0 < p := lt_of_le_of_ne hp.1 (fun h => |
| 87 | hv1 (hpv.symm.trans ((congrArg beta h.symm).trans hstartB.symm))) |
| 88 | have hpB : p < B := lt_of_le_of_ne hp.2 (fun h => |
| 89 | hvT (hpv.symm.trans ((congrArg beta h).trans hmeet.symm))) |
| 90 | have hpK : beta p ∉ base '' Icc 0 D ∪ alpha '' Icc 0 A := by |
| 91 | rintro (⟨t, ht, he⟩ | ⟨t, ht, he⟩) |
| 92 | · exact hp0.ne' (hbaseB t ht p hp he).2 |
| 93 | · exact hpB.ne (hsides t ht p hp he).2 |
| 94 | exact hregular_fan hb hbi ⟨hp0, hpB⟩ (hbreg p ⟨hp0, hpB⟩) |
| 95 | ((isCompact_Icc.image hc.continuous).union (isCompact_Icc.image ha.continuous)) |
| 96 | hpK (hfront.trans (by ac_rfl)) hpv.symm |
| 97 | · rw [if_neg hvboundary] |
| 98 | have htrace : frontier (⋃ i, (R.face i).carrier) = frontier U := by |
| 99 | rw [R.cover, (m64Intrinsic_jordan_interior_closure hU hV hUV hfV.symm).2] |
| 100 | have hvregion : v.1 ∈ ⋃ i, (R.face i).carrier := by |
| 101 | obtain ⟨⟨i, k⟩, hik⟩ := v.2 |
| 102 | apply mem_iUnion.mpr |
| 103 | refine ⟨i, ?_⟩ |
| 104 | rw [R.carrier] |
| 105 | exact ⟨R.basis i k, subset_convexHull ℝ _ (mem_range_self k), hik⟩ |
| 106 | have hvint : v.1 ∈ interior (⋃ i, (R.face i).carrier) := by |
| 107 | by_contra h |
| 108 | exact hvboundary (htrace ▸ ⟨subset_closure hvregion, h⟩) |
| 109 | exact m64Intrinsic_regional_interior_vertex_fan R.face R.coordinates R.basis |
| 110 | R.smooth R.inverse_smooth R.source R.carrier R.boundary R.boundary_injective |
| 111 | R.intersections R.intersection_frontier g v hvint |
| 112 | |
| 113 | end PoincareMT |