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.AngleBound |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Triangle.TerminalCorner |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Region.Curvature |
| 4 | |
| 5 | /-! The actual small normal triangle has a convex terminal sector. |
| 6 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 7 | Section 9. The mesh and its angle bound are constructed from the raw geometry. -/ |
| 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 Matrix |
| 15 | open PoincareMT.Topology.Surface |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | /-- The original area and turning budget gives convex terminal coordinates for the two |
| 20 | actual normal sides. No mesh or occupied-sector premise is needed. Source: MT Claim 19.40; |
| 21 | normal-collision-transversality derivation, Section 9. Project construction: |
| 22 | `proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md`, Section 9. -/ |
| 23 | theorem m64Intrinsic_small_triangle_terminal_convex_coordinates |
| 24 | (N : IntrinsicAnnulus) |
| 25 | {base alpha beta : ℝ → AnnulusCoordinates} {D A B : ℝ} |
| 26 | (hc : ContDiff ℝ ∞ base) (ha : ContDiff ℝ ∞ alpha) (hb : ContDiff ℝ ∞ beta) |
| 27 | (hD : 0 < D) (hA : 0 < A) (hB : 0 < B) |
| 28 | (hci : InjOn base (Icc 0 D)) (hai : InjOn alpha (Icc 0 A)) |
| 29 | (hbi : InjOn beta (Icc 0 B)) |
| 30 | (hcreg : ∀ t ∈ Icc 0 D, deriv base t ≠ 0) |
| 31 | (hstartA : base 0 = alpha 0) (hstartB : base D = beta 0) |
| 32 | (hmeet : alpha A = beta B) |
| 33 | (hbaseA : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 A, base s = alpha t → s = 0 ∧ t = 0) |
| 34 | (hbaseB : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 B, base s = beta t → s = D ∧ t = 0) |
| 35 | (hsides : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, alpha s = beta t → s = A ∧ t = B) |
| 36 | (horth0 : N.metric.inner (base 0) (deriv base 0) (deriv alpha 0) = 0) |
| 37 | (horth1 : N.metric.inner (base D) (deriv base D) (deriv beta 0) = 0) |
| 38 | (hageo : N.metric.IsGeodesicOn alpha (Icc 0 A)) |
| 39 | (hbgeo : N.metric.IsGeodesicOn beta (Icc 0 B)) |
| 40 | (haunit : ∀ t ∈ Icc 0 A, N.metric.inner (alpha t) (deriv alpha t) (deriv alpha t) = 1) |
| 41 | (hbunit : ∀ t ∈ Icc 0 B, N.metric.inner (beta t) (deriv beta t) (deriv beta t) = 1) |
| 42 | (hindT : LinearIndependent ℝ |
| 43 | (![-deriv alpha A, -deriv beta B] : Fin 2 → AnnulusCoordinates)) |
| 44 | {a b : ℝ} (habound : a ≤ b) |
| 45 | (hcircleInj : InjOn (intrinsicAnnulusBoundary 1) (Icc a b)) |
| 46 | (hcircle : base '' Icc 0 D = intrinsicAnnulusBoundary 1 '' Icc a b) |
| 47 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 48 | (hUV : Disjoint U V) |
| 49 | (hfront : frontier U = base '' Icc 0 D ∪ (alpha '' Icc 0 A ∪ beta '' Icc 0 B)) |
| 50 | (hfV : frontier V = frontier U) |
| 51 | (hclosure : closure U ∪ closure V = univ) (hVconn : IsPreconnected V) |
| 52 | (hinward0 : 0 < inner ℝ (base 0) (deriv alpha 0)) |
| 53 | (hinward1 : 0 < inner ℝ (base D) (deriv beta 0)) |
| 54 | (hsub : closure U ⊆ standardAnnulusDomain) |
| 55 | {K : ℝ} (hK : N.GaussianCurvatureBound K) |
| 56 | (hbudget : max K 0 * intrinsicAnnulusArea N.metric + |
| 57 | intrinsicGeodesicCurvatureIntegral N.metric N.connection 1 a b < Real.pi) : |
| 58 | ∃ (phi : AnnulusCoordinates → ℝ × ℝ) |
| 59 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)), |
| 60 | HasFDerivAt phi L.toContinuousLinearMap (alpha A) ∧ phi (alpha A) = 0 ∧ |
| 61 | L.symm (1, 0) = -deriv alpha A ∧ L.symm (0, 1) = -deriv beta B ∧ |
| 62 | (∀ᶠ z in 𝓝 (alpha A), z ∈ closure U ↔ 0 ≤ (phi z).1 ∧ 0 ≤ (phi z).2) := by |
| 63 | have hareg (t : ℝ) (ht : t ∈ Icc 0 A) : deriv alpha t ≠ 0 := by |
| 64 | intro hz |
| 65 | have hu := haunit t ht |
| 66 | simp only [hz, map_zero] at hu |
| 67 | norm_num at hu |
| 68 | have hbreg (t : ℝ) (ht : t ∈ Icc 0 B) : deriv beta t ≠ 0 := by |
| 69 | intro hz |
| 70 | have hu := hbunit t ht |
| 71 | simp only [hz, map_zero] at hu |
| 72 | norm_num at hu |
| 73 | have orth_independent (p u v : AnnulusCoordinates) (hu : u ≠ 0) (hv : v ≠ 0) |
| 74 | (ho : N.metric.inner p u v = 0) : |
| 75 | LinearIndependent ℝ (![u, v] : Fin 2 → AnnulusCoordinates) := by |
| 76 | rw [linearIndependent_fin2] |
| 77 | refine ⟨hv, ?_⟩ |
| 78 | intro c he |
| 79 | change c • v = u at he |
| 80 | have hpos := N.metric.pos p v hv |
| 81 | rw [← he, map_smul, smul_apply, smul_eq_mul] at ho |
| 82 | have hc0 : c = 0 := (mul_eq_zero.mp ho).resolve_right hpos.ne' |
| 83 | apply hu |
| 84 | simpa only [hc0, zero_smul] using he.symm |
| 85 | have hindA := orth_independent (base 0) (deriv base 0) (deriv alpha 0) |
| 86 | (hcreg 0 ⟨le_rfl, hD.le⟩) (hareg 0 ⟨le_rfl, hA.le⟩) horth0 |
| 87 | have hindB := orth_independent (base D) (-deriv base D) (deriv beta 0) |
| 88 | (neg_ne_zero.mpr (hcreg D ⟨hD.le, le_rfl⟩)) (hbreg 0 ⟨le_rfl, hB.le⟩) |
| 89 | (by rw [map_neg, neg_apply, horth1, neg_zero]) |
| 90 | have hcompact : IsCompact (closure U) := |
| 91 | m64Intrinsic_standardAnnulus_isCompact.of_isClosed_subset isClosed_closure hsub |
| 92 | obtain ⟨R, v0, v1, vT, hv0, hv1, hvT⟩ := m64Intrinsic_exists_triangle_region_triangulation |
| 93 | hc ha hb hD hA hB hci hai hbi |
| 94 | (fun t ht => hcreg t (Ioo_subset_Icc_self ht)) |
| 95 | (fun t ht => hareg t (Ioo_subset_Icc_self ht)) |
| 96 | (fun t ht => hbreg t (Ioo_subset_Icc_self ht)) hstartA hstartB hmeet |
| 97 | hbaseA hbaseB hsides hindA hindB hindT hU hV hUV hfront hfV hcompact |
| 98 | have hangle := m64Intrinsic_triangle_region_angle_le_original_turning N R hc ha hb |
| 99 | hD hA hB hci hai hbi (fun t ht => hcreg t (Ioo_subset_Icc_self ht)) |
| 100 | hstartA hstartB hmeet hbaseA hbaseB hsides |
| 101 | (hcreg 0 ⟨le_rfl, hD.le⟩) (hcreg D ⟨hD.le, le_rfl⟩) horth0 horth1 |
| 102 | hageo hbgeo haunit hbunit habound hcircleInj hcircle hU hV hUV hfront hfV |
| 103 | hclosure hVconn hinward0 hinward1 hsub v0 v1 vT hv0 hv1 hvT |
| 104 | have hcurvature := m64Intrinsic_region_gaussian_integral_le_area N hK hcompact hsub |
| 105 | have hsmall : coordinateVertexAngleContribution N.metric R.coordinates R.basis vT.1 < |
| 106 | Real.pi := by linarith only [hangle, hcurvature, hbudget] |
| 107 | exact m64Intrinsic_triangle_terminal_convex_coordinates R N.metric hc ha hb hA hB |
| 108 | hai hbi hmeet hbaseA hindT hU hV hUV hfront hfV vT hvT hsmall |
| 109 | |
| 110 | end PoincareMT |