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.ComparisonConvergence |
| 2 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Comparison.Jets.ComparisonCovariantJets |
| 3 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Comparison.Jets.ComparisonDilationJets |
| 4 | import PoincareLib.Geometry.RicciFlow.Surgery.Metric.Comparison.ComparisonParameters |
| 5 | |
| 6 | /-! |
| 7 | # The standard-cap comparison certificate |
| 8 | |
| 9 | Morgan--Tian Claim 13.1 and Theorem 13.2, pp. 331-333. A dilation close |
| 10 | to one supplies image containment while keeping the same pullback metric |
| 11 | close in the literal covariant jet norm of the frozen contract. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | -- The actual comparison tensor has two continuous-linear metric slots. |
| 17 | set_option maxSynthPendingDepth 12 |
| 18 | |
| 19 | open scoped Manifold ContDiff Topology |
| 20 | |
| 21 | universe u |
| 22 | |
| 23 | namespace PoincareMT.MetricSurgery |
| 24 | |
| 25 | local notation "E₃" => EuclideanSpace ℝ (Fin 3) |
| 26 | |
| 27 | set_option maxHeartbeats 1200000 in |
| 28 | -- The assembly elaborates ordinary and covariant multilinear derivatives. |
| 29 | /-- The comparison threshold depends only on the standard metric, fixed |
| 30 | surgery parameters and requested comparison scale, before all input necks. -/ |
| 31 | theorem exists_surgeryMetric_standard_close (g₀ : StandardInitialMetric) |
| 32 | (C q : ℝ) (hC : 0 ≤ C) {r : ℝ} (hr : 0 < r) |
| 33 | {eta : ℝ} (heta : 0 < eta) : |
| 34 | ∃ delta : ℝ, 0 < delta ∧ |
| 35 | ∀ {M : Type u} [TopologicalSpace M] [ChartedSpace E₃ M] [IsManifold (𝓡 3) ∞ M] |
| 36 | {g : RiemannianMetric 3 M} (N : EpsilonNeck g) |
| 37 | (hcut : surgeryCapRadius g₀ < N.epsilon⁻¹) (hsmall : N.epsilon < 1 / 200), |
| 38 | N.epsilon ≤ delta → |
| 39 | Nonempty (SurgeryCapClose g₀ |
| 40 | (surgeryBallCarrier g₀ (surgeryOuterRadius g₀ N.epsilon)) |
| 41 | (surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 42 | (neck_contraction_coefficient_pos N hsmall) hr) |
| 43 | (surgeryBallTip g₀ (surgeryOuterRadius_pos g₀ N)) N.scale eta) := by |
| 44 | let R := eta⁻¹ |
| 45 | let t := radialEuclideanRadius g₀ R |
| 46 | let m := ⌊eta⁻¹⌋₊ |
| 47 | have hR : 0 < R := inv_pos.mpr heta |
| 48 | have ht : 0 < t := (radialEuclideanRadius_pos_iff g₀ R).mpr hR |
| 49 | let K : Set E₃ := Metric.closedBall 0 t |
| 50 | let Kbig : Set E₃ := Metric.closedBall 0 (2 * t + 1) |
| 51 | have hK : IsCompact K := isCompact_closedBall _ _ |
| 52 | have hKbig : IsCompact Kbig := isCompact_closedBall _ _ |
| 53 | obtain ⟨B0, hB0, hcovariant⟩ := |
| 54 | exists_comparison_covariant_jet_bound g₀.metric g₀.connection hK m |
| 55 | let rho := eta / (2 * (B0 + 1)) |
| 56 | have hrho : 0 < rho := by dsimp [rho]; positivity |
| 57 | have hbound : B0 * rho ^ 2 < eta ^ 2 := by |
| 58 | dsimp [rho] |
| 59 | rw [div_pow, ← mul_div_assoc] |
| 60 | apply (div_lt_iff₀ (by positivity : 0 < (2 * (B0 + 1)) ^ 2)).mpr |
| 61 | have hc : B0 < (2 * (B0 + 1)) ^ 2 := by nlinarith [sq_nonneg B0] |
| 62 | nlinarith only [mul_lt_mul_of_pos_right hc (sq_pos_of_pos heta)] |
| 63 | obtain ⟨a, ha1, ha2, hdilation⟩ := exists_standardComparison_dilation g₀ hK m |
| 64 | (by linarith only [hrho] : 0 < rho / 2) |
| 65 | have ha : 0 < a := zero_lt_one.trans ha1 |
| 66 | let tolerance := rho / (2 * (2 : ℝ) ^ (m + 2)) |
| 67 | have htolerance : 0 < tolerance := by dsimp [tolerance]; positivity |
| 68 | obtain ⟨deltaN, hdN, hnatural⟩ := |
| 69 | exists_surgeryMetric_chart_jets_small g₀ C q hr hKbig m htolerance |
| 70 | obtain ⟨deltaI, hdI, himage⟩ := exists_standardComparison_image_threshold C |
| 71 | (standardComparison_radial_margin g₀ ha1 hR) |
| 72 | refine ⟨min deltaN deltaI, lt_min hdN hdI, ?_⟩ |
| 73 | intro M _ _ _ g N hcut hsmall hepsilon |
| 74 | let L := surgeryOuterRadius g₀ N.epsilon |
| 75 | let H := surgeryMetric g₀ N hcut C q (1 - 6 * N.epsilon) r N.scalar_center_pos |
| 76 | (neck_contraction_coefficient_pos N hsmall) hr |
| 77 | let f := dilatedSurgeryBallChart g₀ L a |
| 78 | let B := fun p => N.connection.scalarCurvature N.center • H.pullbackCoefficients f p |
| 79 | let F := fun p => N.connection.scalarCurvature N.center • |
| 80 | H.pullbackCoefficients (surgeryBallChart g₀ L) p - g₀.metric.euclideanCoefficients p |
| 81 | obtain ⟨hbigFit, hnaturalJets⟩ := hnatural N hcut |
| 82 | (hepsilon.trans (min_le_left _ _)) (neck_contraction_coefficient_pos N hsmall) |
| 83 | have hroom := (himage N.epsilon N.epsilon_pos.le |
| 84 | (hepsilon.trans (min_le_right _ _))).2 |
| 85 | have hvnorm : ‖(2 * t + 1) • EuclideanSpace.basisFun (Fin 3) ℝ 0‖ = 2 * t + 1 := by |
| 86 | rw [norm_smul, (EuclideanSpace.basisFun (Fin 3) ℝ).norm_eq_one, |
| 87 | mul_one, Real.norm_eq_abs, abs_of_pos (by positivity)] |
| 88 | have hLroom : 2 * t + 1 < radialEuclideanRadius g₀ L := by |
| 89 | have hv := hbigFit (show (2 * t + 1) • EuclideanSpace.basisFun (Fin 3) ℝ 0 ∈ Kbig by |
| 90 | simpa only [Kbig, Metric.mem_closedBall, dist_zero_right, hvnorm] using |
| 91 | (le_refl (2 * t + 1))) |
| 92 | simpa only [Metric.mem_ball, dist_zero_right, hvnorm] using hv |
| 93 | have hfit : a * radialEuclideanRadius g₀ R ≤ radialEuclideanRadius g₀ L := by |
| 94 | change a * t ≤ _ |
| 95 | nlinarith only [ha2, ht, hLroom] |
| 96 | let U : Set E₃ := Metric.ball 0 (t + 1 / 4) |
| 97 | have hU : IsOpen U := Metric.isOpen_ball |
| 98 | have hKU : K ⊆ U := by |
| 99 | intro x hx |
| 100 | rw [Metric.mem_closedBall, dist_zero_right] at hx |
| 101 | rw [Metric.mem_ball, dist_zero_right] |
| 102 | linarith only [hx] |
| 103 | have hmapBig (x : E₃) (hx : x ∈ U) : a • x ∈ Kbig := by |
| 104 | have hxn : ‖x‖ < t + 1 / 4 := by simpa only [U, Metric.mem_ball, dist_zero_right] using hx |
| 105 | rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, abs_of_pos ha] |
| 106 | have hm := mul_lt_mul_of_pos_left hxn ha |
| 107 | nlinarith only [hm, ha2, ht] |
| 108 | have hmapsmooth : ContMDiffOn (𝓡 3) (𝓡 3) ∞ f U := |
| 109 | (surgeryBallChart_contMDiffOn g₀ L).comp |
| 110 | ((contDiff_id.const_smul a).contMDiff.contMDiffOn) |
| 111 | (fun x hx => hbigFit (hmapBig x hx)) |
| 112 | have hBsmooth : ContDiffOn ℝ ∞ B U := by |
| 113 | intro x hx |
| 114 | exact ((H.contDiffAt_pullbackCoefficients |
| 115 | ((hmapsmooth x hx).contMDiffAt (hU.mem_nhds hx))).const_smul |
| 116 | (N.connection.scalarCurvature N.center)).contDiffWithinAt |
| 117 | have hF (x : E₃) (hx : x ∈ Kbig) : ContDiffAt ℝ ∞ F x := |
| 118 | ((H.contDiffAt_pullbackCoefficients |
| 119 | ((surgeryBallChart_contMDiffOn g₀ L x (hbigFit hx)).contMDiffAt |
| 120 | (Metric.isOpen_ball.mem_nhds (hbigFit hx)))).const_smul |
| 121 | (N.connection.scalarCurvature N.center)).sub |
| 122 | (g₀.metric.contDiffAt_euclideanCoefficients x) |
| 123 | have hD : ContDiff ℝ ∞ (standardDilationError g₀ a) := |
| 124 | (standardDilationError_joint_contDiff g₀).comp |
| 125 | (f := fun x : E₃ => (a, x)) (contDiff_const.prodMk contDiff_id) |
| 126 | have hsourceOpen : IsOpen (g₀.metric.ball 0 R) := by |
| 127 | rw [standard_ball_eq_euclidean g₀ hR] |
| 128 | exact Metric.isOpen_ball |
| 129 | have hsourceK : g₀.metric.ball 0 R ⊆ K := by |
| 130 | rw [standard_ball_eq_euclidean g₀ hR] |
| 131 | exact Metric.ball_subset_closedBall |
| 132 | have hjet (p : E₃) (hp : p ∈ g₀.metric.ball 0 R) (j : ℕ) (hj : j ≤ m) : |
| 133 | ‖iteratedFDeriv ℝ j (B - g₀.metric.euclideanCoefficients) p‖ ≤ rho := by |
| 134 | have hpK := hsourceK hp |
| 135 | have hpa := hmapBig p (hKU hpK) |
| 136 | have heq : B - g₀.metric.euclideanCoefficients =ᶠ[nhds p] |
| 137 | fun x => a ^ 2 • F (a • x) + standardDilationError g₀ a x := by |
| 138 | filter_upwards [hsourceOpen.mem_nhds hp] with x hx |
| 139 | exact dilatedSurgeryBallChart_error g₀ ha hR hfit H |
| 140 | (N.connection.scalarCurvature N.center) hx |
| 141 | have hscaled : ContDiffAt ℝ ∞ (fun x => a ^ 2 • F (a • x)) p := |
| 142 | ((hF _ hpa).comp p (contDiffAt_id.const_smul a)).const_smul (a ^ 2) |
| 143 | rw [(heq.iteratedFDeriv ℝ j).self_of_nhds, |
| 144 | fun_iteratedFDeriv_add_apply (i := j) (hscaled.of_le (by exact_mod_cast le_top)) |
| 145 | (hD.contDiffAt.of_le (by exact_mod_cast le_top))] |
| 146 | apply (norm_add_le _ _).trans |
| 147 | have hb := norm_iteratedFDeriv_dilation_at ha ha2.le (hF _ hpa) |
| 148 | htolerance.le (hnaturalJets j hj _ hpa) hj |
| 149 | have hc := hdilation j hj p hpK |
| 150 | have htolerance_eq : (2 : ℝ) ^ (m + 2) * tolerance = rho / 2 := by |
| 151 | dsimp [tolerance] |
| 152 | field_simp |
| 153 | rw [htolerance_eq] at hb |
| 154 | linarith only [hb, hc] |
| 155 | have hbeta : 0 < (1 - 6 * N.epsilon) * Real.exp (-2 * C * N.epsilon) := |
| 156 | mul_pos (neck_contraction_coefficient_pos N hsmall) (Real.exp_pos _) |
| 157 | refine ⟨{ |
| 158 | eta_pos := heta |
| 159 | scale_pos := N.scale_pos |
| 160 | map := f |
| 161 | inverse := dilatedSurgeryBallInverse g₀ L a |
| 162 | map_tip := dilatedSurgeryBallChart_zero g₀ (surgeryOuterRadius_pos g₀ N) a |
| 163 | map_smooth := dilatedSurgeryBallChart_contMDiffOn g₀ ha hR hfit |
| 164 | inverse_smooth := (dilatedSurgeryBallInverse_contMDiff g₀ L a).contMDiffOn |
| 165 | image_contains := dilatedSurgeryBallChart_image_contains g₀ |
| 166 | (surgeryOuterRadius_pos g₀ N) ha hR hfit H N.scale_pos hbeta |
| 167 | (fun y => (surgeryMetric_radial_distance_bounds g₀ N hcut hsmall hC q hr y).1) |
| 168 | hroom.le |
| 169 | left_inverse := dilatedSurgeryBallChart_left_inverse g₀ ha hR hfit |
| 170 | right_inverse := fun y _ => dilatedSurgeryBallChart_right_inverse g₀ ha y |
| 171 | coefficient_smooth := dilatedSurgeryBallChart_coefficient_contDiffOn g₀ ha hR hfit H |
| 172 | jets := ?_ |
| 173 | }⟩ |
| 174 | refine ⟨B0 * rho ^ 2, hbound, ?_⟩ |
| 175 | intro p hp |
| 176 | have htensor : (fun x v => N.scale⁻¹ ^ 2 * surgeryCapPullback H f x v) = |
| 177 | (fun x v => B x (v 0) (v 1)) := by |
| 178 | funext x v |
| 179 | rw [neck_scale_inverse_sq N] |
| 180 | rfl |
| 181 | rw [htensor] |
| 182 | exact hcovariant U hU hKU B hBsmooth rho hrho.le p (hsourceK hp) |
| 183 | (fun j hj => hjet p hp j hj) |
| 184 | |
| 185 | end PoincareMT.MetricSurgery |