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.Collision.LastContact |
| 2 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Triangle.Convexity |
| 3 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.Last.TailTransverse |
| 4 | import PoincareLib.Geometry.CurveShortening.Comparison.IntrinsicComparison.No.LastContactTail |
| 5 | |
| 6 | /-! The actual collision minimizer has no further base contacts. |
| 7 | Source: MT Claim 19.40; normal-collision-transversality derivation, |
| 8 | Section 15. Terminal sector selection precedes the last-contact contradiction. -/ |
| 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 ENNReal |
| 16 | |
| 17 | namespace PoincareMT |
| 18 | |
| 19 | /-- An embedded constrained minimizer from an interior base point to the original collision |
| 20 | vertex cannot meet the base again. The original terminal independence is supplied by the |
| 21 | checked normal-collision theorem; all occupied-sector and last-tail facts are derived. |
| 22 | Source: MT Claim 19.40; normal-collision-transversality derivation, Sections 9-15. Source: |
| 23 | MT Claim 19.40, pp. 470-471; |
| 24 | `proof-work/tasks/M64/derivations/2026-09-27-normal-collision-transversality.md`, Sections |
| 25 | 9-15. -/ |
| 26 | theorem m64Intrinsic_short_collision_minimizer_avoids_base |
| 27 | (N : IntrinsicAnnulus) {base alpha beta : ℝ → AnnulusCoordinates} |
| 28 | (hb : ContDiff ℝ ∞ base) (ha : ContDiff ℝ ∞ alpha) (hc : ContDiff ℝ ∞ beta) |
| 29 | {D A B p0 r : ℝ} (hD : 0 < D) (hA : 0 < A) (hB : 0 < B) (hp0 : p0 ∈ Ioo 0 D) |
| 30 | (hbi : InjOn base (Icc 0 D)) (hai : InjOn alpha (Icc 0 A)) |
| 31 | (hci : InjOn beta (Icc 0 B)) |
| 32 | (hstartA : base 0 = alpha 0) (hstartB : base D = beta 0) |
| 33 | (hmeet : alpha A = beta B) |
| 34 | (hbaseA : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 A, base s = alpha t → s = 0 ∧ t = 0) |
| 35 | (hbaseB : ∀ s ∈ Icc 0 D, ∀ t ∈ Icc 0 B, base s = beta t → s = D ∧ t = 0) |
| 36 | (hsides : ∀ s ∈ Icc 0 A, ∀ t ∈ Icc 0 B, alpha s = beta t → s = A ∧ t = B) |
| 37 | (hreg : ∀ t ∈ Icc 0 D, deriv base t ≠ 0) |
| 38 | (horthA : N.metric.inner (base 0) (deriv base 0) (deriv alpha 0) = 0) |
| 39 | (horthB : N.metric.inner (base D) (deriv base D) (deriv beta 0) = 0) |
| 40 | (hgeoA : N.metric.IsGeodesicOn alpha (Icc 0 A)) |
| 41 | (hgeoB : N.metric.IsGeodesicOn beta (Icc 0 B)) |
| 42 | (hunitA : ∀ t ∈ Icc 0 A, N.metric.inner (alpha t) (deriv alpha t) (deriv alpha t) = 1) |
| 43 | (hunitB : ∀ t ∈ Icc 0 B, N.metric.inner (beta t) (deriv beta t) (deriv beta t) = 1) |
| 44 | (hindT : LinearIndependent ℝ (![-deriv alpha A, -deriv beta B] : |
| 45 | Fin 2 → AnnulusCoordinates)) |
| 46 | (hinwardA : 0 < inner ℝ (base 0) (deriv alpha 0)) |
| 47 | (hinwardB : 0 < inner ℝ (base D) (deriv beta 0)) |
| 48 | (harcs : ∀ l ∈ Icc 0 D, ∀ v ∈ Icc 0 D, l ≤ v → |
| 49 | ∃ a b : ℝ, a ≤ b ∧ b ≤ a + rampPeriod ∧ |
| 50 | InjOn (intrinsicAnnulusBoundary 1) (Icc a b) ∧ |
| 51 | base '' Icc l v = intrinsicAnnulusBoundary 1 '' Icc a b ∧ |
| 52 | intrinsicBoundaryLength N.metric 1 a b ≤ r) |
| 53 | {U V : Set AnnulusCoordinates} (hU : IsOpen U) (hV : IsOpen V) |
| 54 | (hpV : IsPreconnected V) (hbV : ¬ Bornology.IsBounded V) (hUV : Disjoint U V) |
| 55 | (hcover : U ∪ V = (frontier U)ᶜ) (hfV : frontier V = frontier U) |
| 56 | (hfront : frontier U = base '' Icc 0 D ∪ (alpha '' Icc 0 A ∪ beta '' Icc 0 B)) |
| 57 | (hsub : closure U ⊆ standardAnnulusDomain) |
| 58 | {gamma : ℝ → AnnulusCoordinates} {T : ℝ} |
| 59 | (hgamma : ContinuousOn gamma (Icc 0 T)) (hgi : InjOn gamma (Icc 0 T)) |
| 60 | (hg0 : gamma 0 = base p0) (hgT : gamma T = alpha A) |
| 61 | (hconf : MapsTo gamma (Icc 0 T) (closure U)) |
| 62 | (hlip : ∀ s ∈ Icc 0 T, ∀ t ∈ Icc 0 T, |
| 63 | N.metric.edist (gamma s) (gamma t) ≤ ENNReal.ofReal |s - t|) |
| 64 | (hmin : ∀ s ∈ Icc 0 T, ∀ t ∈ Icc 0 T, s ≤ t → |
| 65 | ∀ tau : ℝ → AnnulusCoordinates, ContinuousOn tau (Icc 0 1) → |
| 66 | tau 0 = gamma s → tau 1 = gamma t → MapsTo tau (Icc 0 1) (closure U) → |
| 67 | ENNReal.ofReal (t - s) ≤ m64IntrinsicCurveVariation N.metric tau 0 1) |
| 68 | {K delta mu : ℝ} (hK : N.GaussianCurvatureBound K) |
| 69 | (hturn : N.SmallBoundaryTurning delta r) |
| 70 | (harea : intrinsicAnnulusArea N.metric < mu) |
| 71 | (hbudget : max K 0 * mu + delta ≤ Real.pi / 2) : |
| 72 | ∀ t ∈ Ioo 0 T, gamma t ∉ base '' Icc 0 D := by |
| 73 | intro t ht hcontact |
| 74 | obtain ⟨a, b, hab, hperiod, hcircleInj, hcircle, hshort⟩ := |
| 75 | harcs 0 ⟨le_rfl, hD.le⟩ D ⟨hD.le, le_rfl⟩ hD.le |
| 76 | have hnorm (s : ℝ) (hs : s ∈ Icc 0 D) : ‖base s‖ = 1 := by |
| 77 | have hp : base s ∈ intrinsicAnnulusBoundary 1 '' Icc a b := |
| 78 | hcircle ▸ mem_image_of_mem base hs |
| 79 | obtain ⟨z, _, hz⟩ := hp |
| 80 | rw [← hz, m64Intrinsic_inner_boundary_norm] |
| 81 | have hregA (s : ℝ) (hs : s ∈ Icc 0 A) : deriv alpha s ≠ 0 := by |
| 82 | intro hz |
| 83 | have hu := hunitA s hs |
| 84 | simp only [hz, map_zero] at hu |
| 85 | norm_num at hu |
| 86 | have hregB (s : ℝ) (hs : s ∈ Icc 0 B) : deriv beta s ≠ 0 := by |
| 87 | intro hz |
| 88 | have hu := hunitB s hs |
| 89 | simp only [hz, map_zero] at hu |
| 90 | norm_num at hu |
| 91 | have orth_independent (p v w : AnnulusCoordinates) (hv : v ≠ 0) (hw : w ≠ 0) |
| 92 | (ho : N.metric.inner p v w = 0) : |
| 93 | LinearIndependent ℝ (![v, w] : Fin 2 → AnnulusCoordinates) := by |
| 94 | rw [linearIndependent_fin2] |
| 95 | refine ⟨hw, ?_⟩ |
| 96 | intro c he |
| 97 | change c • w = v at he |
| 98 | have hpos := N.metric.pos p w hw |
| 99 | rw [← he, map_smul, smul_apply, smul_eq_mul] at ho |
| 100 | have hc0 : c = 0 := (mul_eq_zero.mp ho).resolve_right hpos.ne' |
| 101 | apply hv |
| 102 | simpa only [hc0, zero_smul] using he.symm |
| 103 | have hindA := orth_independent (base 0) (deriv base 0) (deriv alpha 0) |
| 104 | (hreg 0 ⟨le_rfl, hD.le⟩) (hregA 0 ⟨le_rfl, hA.le⟩) horthA |
| 105 | have hindB := orth_independent (base D) (-deriv base D) (deriv beta 0) |
| 106 | (neg_ne_zero.mpr (hreg D ⟨hD.le, le_rfl⟩)) (hregB 0 ⟨le_rfl, hB.le⟩) |
| 107 | (by rw [map_neg, neg_apply, horthB, neg_zero]) |
| 108 | have hcompact : IsCompact (closure U) := |
| 109 | m64Intrinsic_standardAnnulus_isCompact.of_isClosed_subset isClosed_closure hsub |
| 110 | have hclosure : closure U ∪ closure V = univ := by |
| 111 | apply eq_univ_of_forall |
| 112 | intro z |
| 113 | by_cases hz : z ∈ frontier U |
| 114 | · exact Or.inl (frontier_subset_closure hz) |
| 115 | · have hz' : z ∈ U ∪ V := by rwa [hcover] |
| 116 | exact hz'.elim (fun h => Or.inl (subset_closure h)) (fun h => Or.inr (subset_closure h)) |
| 117 | have hsmall : max K 0 * intrinsicAnnulusArea N.metric + |
| 118 | intrinsicGeodesicCurvatureIntegral N.metric N.connection 1 a b < Real.pi := by |
| 119 | have hscaled := mul_le_mul_of_nonneg_left harea.le (le_max_right K 0) |
| 120 | have hlocal := hturn a b hab hperiod hshort |
| 121 | linarith only [hscaled, hlocal, hbudget, Real.pi_pos] |
| 122 | obtain ⟨phi, J, hphi, hzero, haxisA, haxisB, hcorner⟩ := |
| 123 | m64Intrinsic_small_triangle_terminal_convex_coordinates N hb ha hc hD hA hB hbi hai hci |
| 124 | hreg hstartA hstartB hmeet hbaseA hbaseB hsides horthA horthB hgeoA hgeoB |
| 125 | hunitA hunitB hindT hab hcircleInj hcircle hU hV hUV hfront hfV hclosure hpV |
| 126 | hinwardA hinwardB hsub hK hsmall |
| 127 | obtain ⟨u, p, c, eta, hu, hp, hcne, he, _, hei, heu, heT, heinside, hegeo, |
| 128 | hetan, heunit, hereg⟩ := |
| 129 | m64Intrinsic_collision_minimizer_smooth_last_contact N.metric hb ha hc hD hA hB hp0 |
| 130 | hbi hai hci hstartA hstartB hmeet hbaseA hbaseB hsides |
| 131 | (fun s hs => hreg s (Ioo_subset_Icc_self hs)) |
| 132 | (fun s hs => hregA s (Ioo_subset_Icc_self hs)) |
| 133 | (fun s hs => hregB s (Ioo_subset_Icc_self hs)) |
| 134 | (fun s hs => hgeoA s (Ioo_subset_Icc_self hs)) |
| 135 | (fun s hs => hgeoB s (Ioo_subset_Icc_self hs)) hindA hindB |
| 136 | (hnorm 0 ⟨le_rfl, hD.le⟩) (hnorm D ⟨hD.le, le_rfl⟩) hinwardA hinwardB |
| 137 | hU hV hUV hfront hfV hcompact hsub hgamma hgi hg0 hgT hconf hlip hmin ⟨t, ht, hcontact⟩ |
| 138 | have heinner (s : ℝ) (hs : s ∈ Icc u T) : |
| 139 | N.metric.inner (eta s) (deriv eta s) (deriv eta s) = 1 := by |
| 140 | have hsq : N.metric.tangentNorm (eta s) (deriv eta s) ^ 2 = |
| 141 | N.metric.inner (eta s) (deriv eta s) (deriv eta s) := |
| 142 | Real.sq_sqrt (N.metric.pos (eta s) (deriv eta s) (hereg s hs)).le |
| 143 | rw [heunit s hs, one_pow] at hsq |
| 144 | exact hsq.symm |
| 145 | have hsideA : MapsTo alpha (Icc 0 A) (frontier U) := by |
| 146 | intro s hs |
| 147 | rw [hfront] |
| 148 | exact Or.inr (Or.inl (mem_image_of_mem alpha hs)) |
| 149 | have hsideB : MapsTo beta (Icc 0 B) (frontier U) := by |
| 150 | intro s hs |
| 151 | rw [hfront] |
| 152 | exact Or.inr (Or.inr (mem_image_of_mem beta hs)) |
| 153 | obtain ⟨_, _, heA, heB⟩ := m64Intrinsic_interior_geodesic_arrival_strict_corner |
| 154 | N.metric ha hc he hA hB hu.2 hgeoA hgeoB hegeo heT (heT.trans hmeet) hU |
| 155 | hsideA hsideB heinside (hereg T ⟨hu.2.le, le_rfl⟩) J |
| 156 | (heT.symm ▸ hphi) (heT.symm ▸ hzero) haxisA haxisB |
| 157 | (heT.symm ▸ hcorner.mono (fun _ hz => hz.mp)) |
| 158 | exact m64Intrinsic_short_circle_last_contact_tail_impossible N hb ha hc he hA hB hp hu.2 |
| 159 | hbi hai hci hei hstartA hstartB hmeet heu heT hbaseA hbaseB hreg hcne hetan |
| 160 | horthA horthB hgeoA hgeoB hegeo hunitA hunitB heinner |
| 161 | (LinearIndependent.pair_symm_iff.mpr heA) (LinearIndependent.pair_symm_iff.mpr heB) |
| 162 | hinwardA hinwardB harcs hU hV hpV hbV hUV hcover hfV hfront heinside hsub |
| 163 | hK hturn harea hbudget |
| 164 | |
| 165 | end PoincareMT |