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.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 | /-! Canonical noncorner fans in the original two-arc region. |
| 7 | Source: MT Claim 19.41; short-geodesic-digons derivation, Section 2. -/ |
| 8 | |
| 9 | noncomputable section |
| 10 | set_option autoImplicit false |
| 11 | set_option backward.isDefEq.respectTransparency false |
| 12 | |
| 13 | open Set |
| 14 | open scoped Topology ContDiff Manifold |
| 15 | open PoincareMT.Topology.Surface |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | open Classical in |
| 20 | /-- Every noncorner vertex of the actual two-arc region has its regular boundary or interior |
| 21 | fan. Source: MT Claim 19.41; derivation Section 2. Source/construction: |
| 22 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 2. -/ |
| 23 | theorem m64Intrinsic_digon_regular_vertex_fan |
| 24 | {U V : Set AnnulusCoordinates} (R : M64IntrinsicCoordinateTriangulation (closure U)) |
| 25 | (g : RiemannianMetric 2 AnnulusCoordinates) |
| 26 | {alpha beta : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) |
| 27 | (hb : ContDiff ℝ ∞ beta) {A B : ℝ} |
| 28 | (hai : InjOn alpha (Icc 0 A)) (hbi : InjOn beta (Icc 0 B)) |
| 29 | (hareg : ∀ t ∈ Ioo 0 A, deriv alpha t ≠ 0) |
| 30 | (hbreg : ∀ t ∈ Ioo 0 B, deriv beta t ≠ 0) |
| 31 | (hbase : beta 0 = alpha 0) (hend : beta B = alpha A) |
| 32 | (hmeet : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, |
| 33 | alpha s = beta t → (s = 0 ∧ t = 0) ∨ (s = A ∧ t = B)) |
| 34 | (hU : IsOpen U) (hV : IsOpen V) (hUV : Disjoint U V) |
| 35 | (hfront : frontier U = alpha '' Icc 0 A ∪ beta '' Icc 0 B) |
| 36 | (hfV : frontier V = frontier U) |
| 37 | (v : Euler.CoordinateVertex R.coordinates R.basis) |
| 38 | (hv0 : v.1 ≠ alpha 0) (hv1 : v.1 ≠ alpha A) : |
| 39 | coordinateVertexAngleContribution g R.coordinates R.basis v.1 = |
| 40 | if v.1 ∈ frontier U then Real.pi else 2 * Real.pi := by |
| 41 | have hfan {eta : ℝ → AnnulusCoordinates} {a b p : ℝ} |
| 42 | (he : ContDiff ℝ ∞ eta) (hei : InjOn eta (Icc a b)) (hp : p ∈ Ioo a b) |
| 43 | (hr : deriv eta p ≠ 0) {K : Set AnnulusCoordinates} (hK : IsCompact K) |
| 44 | (hpK : eta p ∉ K) (hf : frontier U = eta '' Icc a b ∪ K) |
| 45 | (hv : v.1 = eta p) : |
| 46 | coordinateVertexAngleContribution g R.coordinates R.basis v.1 = Real.pi := |
| 47 | m64Intrinsic_region_arc_boundary_fan R.face R.coordinates R.basis R.smooth |
| 48 | R.inverse_smooth R.source R.carrier R.boundary R.boundary_injective |
| 49 | R.intersections R.intersection_frontier g he hei hp hr hK hpK |
| 50 | hU hV hUV hf hfV R.cover v hv |
| 51 | by_cases hboundary : v.1 ∈ frontier U |
| 52 | · rw [if_pos hboundary] |
| 53 | rw [hfront] at hboundary |
| 54 | rcases hboundary with ⟨p, hp, hpv⟩ | ⟨p, hp, hpv⟩ |
| 55 | · have hp0 : 0 < p := lt_of_le_of_ne hp.1 (fun h => |
| 56 | hv0 (hpv.symm.trans (congrArg alpha h.symm))) |
| 57 | have hpA : p < A := lt_of_le_of_ne hp.2 (fun h => |
| 58 | hv1 (hpv.symm.trans (congrArg alpha h))) |
| 59 | have hpK : alpha p ∉ beta '' Icc 0 B := by |
| 60 | rintro ⟨t, ht, he⟩ |
| 61 | rcases hmeet p hp t ht he.symm with h | h |
| 62 | · exact hp0.ne' h.1 |
| 63 | · exact hpA.ne h.1 |
| 64 | exact hfan ha hai ⟨hp0, hpA⟩ (hareg p ⟨hp0, hpA⟩) |
| 65 | (isCompact_Icc.image hb.continuous) hpK hfront hpv.symm |
| 66 | · have hp0 : 0 < p := lt_of_le_of_ne hp.1 (fun h => |
| 67 | hv0 (hpv.symm.trans ((congrArg beta h.symm).trans hbase))) |
| 68 | have hpB : p < B := lt_of_le_of_ne hp.2 (fun h => |
| 69 | hv1 (hpv.symm.trans ((congrArg beta h).trans hend))) |
| 70 | have hpK : beta p ∉ alpha '' Icc 0 A := by |
| 71 | rintro ⟨t, ht, he⟩ |
| 72 | rcases hmeet t ht p hp he with h | h |
| 73 | · exact hp0.ne' h.2 |
| 74 | · exact hpB.ne h.2 |
| 75 | exact hfan hb hbi ⟨hp0, hpB⟩ (hbreg p ⟨hp0, hpB⟩) |
| 76 | (isCompact_Icc.image ha.continuous) hpK |
| 77 | (hfront.trans (union_comm _ _)) hpv.symm |
| 78 | · rw [if_neg hboundary] |
| 79 | have htrace : frontier (⋃ i, (R.face i).carrier) = frontier U := by |
| 80 | rw [R.cover, (m64Intrinsic_jordan_interior_closure hU hV hUV hfV.symm).2] |
| 81 | have hregion : v.1 ∈ ⋃ i, (R.face i).carrier := by |
| 82 | obtain ⟨⟨i, k⟩, hik⟩ := v.2 |
| 83 | apply mem_iUnion.mpr |
| 84 | refine ⟨i, ?_⟩ |
| 85 | rw [R.carrier] |
| 86 | exact ⟨R.basis i k, subset_convexHull ℝ _ (mem_range_self k), hik⟩ |
| 87 | have hinside : v.1 ∈ interior (⋃ i, (R.face i).carrier) := by |
| 88 | by_contra h |
| 89 | exact hboundary (htrace ▸ ⟨subset_closure hregion, h⟩) |
| 90 | exact m64Intrinsic_regional_interior_vertex_fan R.face R.coordinates R.basis |
| 91 | R.smooth R.inverse_smooth R.source R.carrier R.boundary R.boundary_injective |
| 92 | R.intersections R.intersection_frontier g v hinside |
| 93 | |
| 94 | end PoincareMT |