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.InitialTangents |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Opposite.GeodesicJoin |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Closed.CornerRayInjectivity |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Normal.Metric |
| 5 | |
| 6 | /-! Terminal transversality of a digon confined to the parent collision disk. |
| 7 | Source: MT Claim 19.41; short-geodesic-digons derivation, Section 5. |
| 8 | An opposite terminal meeting would give an actual forbidden return. -/ |
| 9 | |
| 10 | noncomputable section |
| 11 | set_option autoImplicit false |
| 12 | set_option backward.isDefEq.respectTransparency false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology ContDiff Manifold Matrix |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | /-- Equal terminal velocities would give an extra backward contact of the two original arcs. |
| 20 | Source: MT Claim 19.41; digon derivation Section 5. Source/construction: |
| 21 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 5. -/ |
| 22 | theorem m64Intrinsic_digon_terminal_velocity_ne |
| 23 | (G : RiemannianMetric 2 AnnulusCoordinates) |
| 24 | {alpha beta : ℝ → AnnulusCoordinates} {A B : ℝ} (hA : 0 < A) (hB : 0 < B) |
| 25 | (hgeoA : G.IsGeodesicOn alpha (Icc 0 A)) |
| 26 | (hgeoB : G.IsGeodesicOn beta (Icc 0 B)) (hend : beta B = alpha A) |
| 27 | (hmeet : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, |
| 28 | alpha s = beta t → (s = 0 ∧ t = 0) ∨ (s = A ∧ t = B)) : |
| 29 | deriv alpha A ≠ deriv beta B := by |
| 30 | have reverse_geo {eta : ℝ → AnnulusCoordinates} {T : ℝ} |
| 31 | (hg : G.IsGeodesicOn eta (Icc 0 T)) : |
| 32 | G.IsGeodesicOn (fun t => eta (T - t)) (Icc 0 T) := by |
| 33 | intro t ht |
| 34 | have h := hg.comp_affine (-1) T t |
| 35 | (show -1 * t + T ∈ Icc 0 T from ⟨by linarith [ht.2], by linarith [ht.1]⟩) |
| 36 | simpa only [neg_one_mul, sub_eq_add_neg, add_comm] using h |
| 37 | have hcontacts : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, |
| 38 | alpha (A - s) = beta (B - t) → (s = 0 ∧ t = 0) ∨ (s = A ∧ t = B) := by |
| 39 | intro s hs t ht he |
| 40 | rcases hmeet (A - s) ⟨by linarith [hs.2], by linarith [hs.1]⟩ |
| 41 | (B - t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ he with h | h |
| 42 | · exact Or.inr ⟨by linarith [h.1], by linarith [h.2]⟩ |
| 43 | · exact Or.inl ⟨by linarith [h.1], by linarith [h.2]⟩ |
| 44 | have hne := m64Intrinsic_digon_initial_velocity_ne G hA hB |
| 45 | (reverse_geo hgeoA) (reverse_geo hgeoB) (by simpa only [sub_zero] using hend) hcontacts |
| 46 | intro he |
| 47 | apply hne |
| 48 | simpa only [deriv_comp_const_sub, sub_zero] using congrArg Neg.neg he |
| 49 | |
| 50 | /-- Neither equal nor opposite terminal velocities are possible for two distinct unit rays |
| 51 | confined from the parent convex corner. The actual joined curve and the earlier |
| 52 | closed-corner return theorem exclude the opposite case. Source: MT Claim 19.41; digon |
| 53 | derivation Section 5. Source/construction: |
| 54 | proof-work/tasks/M64/derivations/2026-09-27-short-geodesic-digons.md, Section 5. -/ |
| 55 | theorem m64Intrinsic_digon_terminal_transverse_at_convex_corner |
| 56 | (N : IntrinsicAnnulus) {K : ℝ} (hK : N.GaussianCurvatureBound K) |
| 57 | (hsmall : max K 0 * intrinsicAnnulusArea N.metric < Real.pi) |
| 58 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 59 | (hpV : IsPreconnected V) (hbV : ¬ Bornology.IsBounded V) |
| 60 | (hUV : Disjoint U V) (hcover : U ∪ V = (frontier U)ᶜ) |
| 61 | (hfront : frontier U = frontier V) (hsub : closure U ⊆ standardAnnulusDomain) |
| 62 | {alpha beta : ℝ → AnnulusCoordinates} (ha : ContDiff ℝ ∞ alpha) |
| 63 | (hb : ContDiff ℝ ∞ beta) {A B : ℝ} (hA : 0 < A) (hB : 0 < B) |
| 64 | (hgeoA : N.metric.IsGeodesicOn alpha (Icc 0 A)) |
| 65 | (hgeoB : N.metric.IsGeodesicOn beta (Icc 0 B)) |
| 66 | (hbase : beta 0 = alpha 0) (hend : beta B = alpha A) |
| 67 | (hmeet : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, |
| 68 | alpha s = beta t → (s = 0 ∧ t = 0) ∨ (s = A ∧ t = B)) |
| 69 | (hunitA : ∀ t ∈ Icc 0 A, N.metric.inner (alpha t) (deriv alpha t) (deriv alpha t) = 1) |
| 70 | (hunitB : ∀ t ∈ Icc 0 B, N.metric.inner (beta t) (deriv beta t) (deriv beta t) = 1) |
| 71 | (hconfA : MapsTo alpha (Icc 0 A) (closure U)) |
| 72 | (hconfB : MapsTo beta (Icc 0 B) (closure U)) |
| 73 | {phi : AnnulusCoordinates → ℝ × ℝ} |
| 74 | (L : AnnulusCoordinates ≃L[ℝ] (ℝ × ℝ)) |
| 75 | (hphi : HasFDerivAt phi L.toContinuousLinearMap (alpha 0)) (hzero : phi (alpha 0) = 0) |
| 76 | (hcorner : ∀ᶠ z in 𝓝 (alpha 0), |
| 77 | z ∈ closure U → 0 ≤ (phi z).1 ∧ 0 ≤ (phi z).2) : |
| 78 | LinearIndependent ℝ (![-deriv alpha A, -deriv beta B] : Fin 2 → AnnulusCoordinates) := by |
| 79 | have hopp : deriv alpha A ≠ -deriv beta B := by |
| 80 | intro he |
| 81 | obtain ⟨gamma, hleft, _, hg, hgeo, hg0, hgT, himage⟩ := |
| 82 | m64Intrinsic_opposite_meeting_smooth_geodesic_join N.metric ha hb |
| 83 | hgeoA hgeoB hA hB hend.symm he |
| 84 | have hnear : gamma =ᶠ[𝓝 (0 : ℝ)] alpha := by |
| 85 | filter_upwards [Iio_mem_nhds hA] with t ht |
| 86 | exact hleft t ht.le |
| 87 | have hzeroUnit : N.metric.inner (gamma 0) (deriv gamma 0 : AnnulusCoordinates) |
| 88 | (deriv gamma 0 : AnnulusCoordinates) = 1 := by |
| 89 | rw [hg0, hnear.deriv_eq] |
| 90 | exact hunitA 0 ⟨le_rfl, hA.le⟩ |
| 91 | have hunit : ∀ t ∈ Icc 0 (A + B), |
| 92 | N.metric.inner (gamma t) (deriv gamma t) (deriv gamma t) = 1 := by |
| 93 | intro t ht |
| 94 | simpa only [m64Intrinsic_curveVelocity_eq_deriv] using |
| 95 | m64Intrinsic_geodesic_velocity_unit N (add_pos hA hB) hgeo Subset.rfl |
| 96 | (by simpa only [m64Intrinsic_curveVelocity_eq_deriv] using hzeroUnit) t ht |
| 97 | have hconf : MapsTo gamma (Icc 0 (A + B)) (closure U) := by |
| 98 | apply mapsTo_iff_image_subset.mpr |
| 99 | rw [himage] |
| 100 | exact union_subset (mapsTo_iff_image_subset.mp hconfA) (mapsTo_iff_image_subset.mp hconfB) |
| 101 | have hinj := m64Intrinsic_closed_corner_ray_injOn N hK hsmall |
| 102 | hU hV hpV hbV hUV hcover hfront hsub hg hgeo hunit hconf L |
| 103 | (hg0.symm ▸ hphi) (hg0.symm ▸ hzero) (hg0.symm ▸ hcorner) |
| 104 | exact (add_pos hA hB).ne (hinj ⟨le_rfl, (add_pos hA hB).le⟩ |
| 105 | ⟨(add_pos hA hB).le, le_rfl⟩ (hg0.trans (hbase.symm.trans hgT.symm))) |
| 106 | have hne := m64Intrinsic_digon_terminal_velocity_ne N.metric hA hB hgeoA hgeoB hend hmeet |
| 107 | have huB : N.metric.inner (alpha A) (deriv beta B : AnnulusCoordinates) |
| 108 | (deriv beta B : AnnulusCoordinates) = 1 := by |
| 109 | rw [← hend] |
| 110 | exact hunitB B ⟨hB.le, le_rfl⟩ |
| 111 | apply m64Intrinsic_unit_tangents_independent N.metric (alpha A) |
| 112 | (-deriv alpha A) (-deriv beta B) |
| 113 | · simpa only [map_neg, neg_apply, neg_neg] using hunitA A ⟨hA.le, le_rfl⟩ |
| 114 | · simpa only [map_neg, neg_apply, neg_neg] using huB |
| 115 | · intro he |
| 116 | exact hne (neg_injective he) |
| 117 | · intro he |
| 118 | apply hopp |
| 119 | simpa only [neg_neg] using congrArg Neg.neg he |
| 120 | |
| 121 | end PoincareMT |