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.RicciFlow.Surgery.Metric.Comparison.ComparisonMetric |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Comparison.Jets.ComparisonWeightedJets |
| 3 | |
| 4 | /-! |
| 5 | # Uniform finite-jet convergence in the natural surgery chart |
| 6 | |
| 7 | Morgan--Tian Claim 13.1 and Theorem 13.2, pp. 331-333. Every threshold |
| 8 | is fixed from the standard metric, compact coordinate set and derivative |
| 9 | order before the manifold or input neck is chosen. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option backward.isDefEq.respectTransparency false |
| 14 | -- The coefficient field retains both continuous-linear metric slots. |
| 15 | set_option maxSynthPendingDepth 12 |
| 16 | |
| 17 | open scoped Manifold ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.MetricSurgery |
| 22 | |
| 23 | local notation "E₃" => EuclideanSpace ℝ (Fin 3) |
| 24 | |
| 25 | theorem exists_comparison_domain_threshold (g₀ : StandardInitialMetric) |
| 26 | {K : Set StandardCapSpace} (hK : IsCompact K) (m : ℕ) : |
| 27 | ∃ delta : ℝ, 0 < delta ∧ ∀ epsilon : ℝ, 0 < epsilon → epsilon ≤ delta → |
| 28 | m ≤ ⌊epsilon⁻¹⌋₊ ∧ |
| 29 | (∀ x ∈ K, standardSurgeryHeight g₀ x ∈ Set.Ioo (-epsilon⁻¹) epsilon⁻¹) ∧ |
| 30 | K ⊆ Metric.ball 0 (radialEuclideanRadius g₀ (surgeryOuterRadius g₀ epsilon)) := by |
| 31 | obtain ⟨B, hB⟩ := hK.exists_bound_of_continuousOn |
| 32 | (standardSurgeryHeight_continuous g₀).continuousOn |
| 33 | have hden : 0 < |B| + (m : ℝ) + 2 := by positivity |
| 34 | refine ⟨1 / (|B| + (m : ℝ) + 2), one_div_pos.mpr hden, ?_⟩ |
| 35 | intro epsilon hepsilon hsmall |
| 36 | have hinv := one_div_le_one_div_of_le hepsilon hsmall |
| 37 | simp only [one_div, inv_inv] at hinv |
| 38 | have hheight (x : StandardCapSpace) (hx : x ∈ K) : |
| 39 | standardSurgeryHeight g₀ x ∈ Set.Ioo (-epsilon⁻¹) epsilon⁻¹ := by |
| 40 | have hb : |standardSurgeryHeight g₀ x| ≤ |B| := by |
| 41 | simpa only [Real.norm_eq_abs] using (hB x hx).trans (le_abs_self B) |
| 42 | have hab := abs_le.mp hb |
| 43 | constructor <;> linarith [Nat.cast_nonneg (α := ℝ) m] |
| 44 | refine ⟨(Nat.le_floor_iff (inv_pos.mpr hepsilon).le).mpr (by |
| 45 | linarith [abs_nonneg B]), hheight, ?_⟩ |
| 46 | intro x hx |
| 47 | rw [Metric.mem_ball, dist_zero_right] |
| 48 | apply (radialArclength_strictMono g₀).lt_iff_lt.mp |
| 49 | rw [radialArclength_euclideanRadius] |
| 50 | have hh := (hheight x hx).1 |
| 51 | dsimp [standardSurgeryHeight, surgeryOuterRadius, surgeryCapRadius] at * |
| 52 | linarith only [hh] |
| 53 | |
| 54 | set_option maxHeartbeats 800000 in |
| 55 | /-- Every finite ordinary jet of the literal normalized chart error tends |
| 56 | uniformly to zero on a fixed compact set, independently of the input neck. -/ |
| 57 | theorem exists_surgeryMetric_chart_jets_small (g₀ : StandardInitialMetric) |
| 58 | (C q : ℝ) {r : ℝ} (hr : 0 < r) |
| 59 | {K : Set StandardCapSpace} (hK : IsCompact K) (m : ℕ) |
| 60 | {tolerance : ℝ} (htolerance : 0 < tolerance) : |
| 61 | ∃ delta : ℝ, 0 < delta ∧ |
| 62 | ∀ {M : Type u} [TopologicalSpace M] [ChartedSpace E₃ M] [IsManifold (𝓡 3) ∞ M] |
| 63 | {g : RiemannianMetric 3 M} (N : EpsilonNeck g) |
| 64 | (hcut : surgeryCapRadius g₀ < N.epsilon⁻¹), N.epsilon ≤ delta → |
| 65 | ∀ heta : 0 < 1 - 6 * N.epsilon, |
| 66 | K ⊆ Metric.ball 0 (radialEuclideanRadius g₀ (surgeryOuterRadius g₀ N.epsilon)) ∧ |
| 67 | ∀ j : ℕ, j ≤ m → ∀ x ∈ K, |
| 68 | ‖iteratedFDeriv ℝ j (fun p => N.connection.scalarCurvature N.center • |
| 69 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r |
| 70 | N.scalar_center_pos heta hr).pullbackCoefficients |
| 71 | (surgeryBallChart g₀ (surgeryOuterRadius g₀ N.epsilon)) p - |
| 72 | g₀.metric.euclideanCoefficients p) x‖ ≤ tolerance := by |
| 73 | let T := K ∩ tsupport (radialNeckWeight g₀) |
| 74 | have hT : IsCompact T := hK.inter_right (isClosed_tsupport (radialNeckWeight g₀)) |
| 75 | obtain ⟨Cn, hCn, hneck⟩ := exists_comparisonNeckMetric_jet_bound g₀ hT |
| 76 | (fun x hx => (radialNeckWeight_support_geometry g₀ hx.2).1) |
| 77 | (fun x hx => (radialNeckWeight_support_geometry g₀ hx.2).2) m |
| 78 | obtain ⟨A, hA, hweight⟩ := exists_radialWeightedError_jet_bound |
| 79 | (F := E₃ →L[ℝ] E₃ →L[ℝ] ℝ) g₀ C q hr hK m |
| 80 | obtain ⟨deltaD, hdD, hdomain⟩ := exists_comparison_domain_threshold g₀ hK m |
| 81 | obtain ⟨d, hd, hscalar⟩ := Metric.eventually_nhds_iff.mp |
| 82 | (standardScalarError_jets_eventually_small g₀ C q hr hK m |
| 83 | (by linarith only [htolerance] : 0 < tolerance / 2)) |
| 84 | have hApos : 0 < A := zero_lt_one.trans_le hA |
| 85 | have hCnpos : 0 < Cn := zero_lt_one.trans_le hCn |
| 86 | refine ⟨min deltaD (min 1 (min (d / 2) (tolerance / (2 * A * Cn)))), |
| 87 | lt_min hdD (lt_min zero_lt_one (lt_min (by positivity) (by positivity))), ?_⟩ |
| 88 | intro M _ _ _ g N hcut hsmall heta |
| 89 | have heD := hsmall.trans (min_le_left _ _) |
| 90 | have he1 := hsmall.trans ((min_le_right _ _).trans (min_le_left _ _)) |
| 91 | have hed := hsmall.trans ((min_le_right _ _).trans |
| 92 | ((min_le_right _ _).trans (min_le_left _ _))) |
| 93 | have heb := hsmall.trans ((min_le_right _ _).trans |
| 94 | ((min_le_right _ _).trans (min_le_right _ _))) |
| 95 | obtain ⟨horder, hheight, hfit⟩ := hdomain N.epsilon N.epsilon_pos heD |
| 96 | have hscalarbound := hscalar (by |
| 97 | rw [Real.dist_eq, sub_zero, abs_of_pos N.epsilon_pos] |
| 98 | linarith only [hed, hd] : dist N.epsilon 0 < d) |
| 99 | let H := surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r |
| 100 | N.scalar_center_pos heta hr |
| 101 | let F := fun p => N.connection.scalarCurvature N.center • |
| 102 | H.pullbackCoefficients (surgeryBallChart g₀ (surgeryOuterRadius g₀ N.epsilon)) p - |
| 103 | g₀.metric.euclideanCoefficients p |
| 104 | let B := fun p => (normalizedNeckMetric N).pullbackCoefficients |
| 105 | (comparisonNeckLift g₀ N) p - g₀.metric.euclideanCoefficients p |
| 106 | let W := fun p => |
| 107 | (radialConformalMultiplier g₀ C q N.epsilon r p * radialNeckWeight g₀ p) • B p |
| 108 | let S := standardScalarError g₀ C q r N.epsilon |
| 109 | have hBsmooth (x : StandardCapSpace) (hx : x ∈ T) : ContDiffAt ℝ ∞ B x := |
| 110 | ((normalizedNeckMetric N).contDiffAt_pullbackCoefficients |
| 111 | (comparisonNeckLift_contMDiffAt g₀ N |
| 112 | (radialNeckWeight_support_geometry g₀ hx.2).1 (hheight x hx.1))).sub |
| 113 | (g₀.metric.contDiffAt_euclideanCoefficients x) |
| 114 | have hWbound (j : ℕ) (hj : j ≤ m) (x : StandardCapSpace) (hx : x ∈ K) : |
| 115 | ‖iteratedFDeriv ℝ j W x‖ ≤ tolerance / 2 := by |
| 116 | apply (hweight N.epsilon ⟨N.epsilon_pos.le, he1⟩ B hBsmooth |
| 117 | (Cn * N.epsilon) (mul_nonneg hCnpos.le N.epsilon_pos.le) |
| 118 | (fun k hk y hy => hneck N horder (fun z hz => hheight z hz.1) |
| 119 | y hy k hk) j hj x hx).trans |
| 120 | have hb := (le_div_iff₀ (by positivity : 0 < 2 * A * Cn)).mp heb |
| 121 | nlinarith only [hb] |
| 122 | refine ⟨hfit, ?_⟩ |
| 123 | intro j hj x hx |
| 124 | have hF : ContDiffAt ℝ ∞ F x := |
| 125 | ((H.contDiffAt_pullbackCoefficients |
| 126 | ((surgeryBallChart_contMDiffOn g₀ _ x (hfit hx)).contMDiffAt |
| 127 | (Metric.isOpen_ball.mem_nhds (hfit hx)))).const_smul |
| 128 | (N.connection.scalarCurvature N.center)).sub |
| 129 | (g₀.metric.contDiffAt_euclideanCoefficients x) |
| 130 | have hS : ContDiffAt ℝ ∞ S x := |
| 131 | ((standardScalarError_joint_contDiff g₀ C q hr).comp |
| 132 | (f := fun y : StandardCapSpace => (N.epsilon, y)) |
| 133 | (contDiff_const.prodMk contDiff_id)).contDiffAt |
| 134 | have heq : F =ᶠ[nhds x] fun p => W p + S p := by |
| 135 | filter_upwards [Metric.isOpen_ball.mem_nhds (hfit hx)] with p hp |
| 136 | exact surgeryMetric_chart_error g₀ N hcut C q r heta hr hp |
| 137 | have hW : ContDiffAt ℝ ∞ W x := (hF.sub hS).congr_of_eventuallyEq (by |
| 138 | filter_upwards [heq] with p hp |
| 139 | change W p = F p - S p |
| 140 | rw [hp, add_sub_cancel_right]) |
| 141 | change ‖iteratedFDeriv ℝ j F x‖ ≤ tolerance |
| 142 | calc |
| 143 | ‖iteratedFDeriv ℝ j F x‖ = |
| 144 | ‖iteratedFDeriv ℝ j (fun p => W p + S p) x‖ := by |
| 145 | rw [(heq.iteratedFDeriv ℝ j).self_of_nhds] |
| 146 | _ ≤ ‖iteratedFDeriv ℝ j W x‖ + ‖iteratedFDeriv ℝ j S x‖ := by |
| 147 | change ‖iteratedFDeriv ℝ j (W + S) x‖ ≤ _ |
| 148 | rw [iteratedFDeriv_add_apply (i := j) |
| 149 | (hW.of_le (by exact_mod_cast le_top)) |
| 150 | (hS.of_le (by exact_mod_cast le_top))] |
| 151 | exact norm_add_le _ _ |
| 152 | _ ≤ tolerance := by |
| 153 | exact (add_le_add (hWbound j hj x hx) |
| 154 | (hscalarbound j hj x hx).le).trans_eq (by ring) |
| 155 | |
| 156 | end PoincareMT.MetricSurgery |