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.Generalized.ReducedGeometry.SourceNames.ReducedLength |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Energy.FiniteEnergyDisplacement |
| 3 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Calculus.Energy.BlendDerivativeEstimate |
| 4 | |
| 5 | /-! |
| 6 | # A one-sided blend of finite-energy curves |
| 7 | |
| 8 | The transition used in the corner approximation for Morgan-Tian |
| 9 | Proposition 6.30, pp. 118-119. Two continuous curves sharing their final |
| 10 | point have displacement controlled by their actual interior energies. |
| 11 | A one-sided cutoff therefore has controlled energy even if one |
| 12 | endpoint velocity is unbounded. |
| 13 | -/ |
| 14 | |
| 15 | set_option autoImplicit false |
| 16 | |
| 17 | open Set Filter MeasureTheory |
| 18 | open scoped Topology intervalIntegral |
| 19 | |
| 20 | namespace PoincareMT.M14 |
| 21 | |
| 22 | open Proofs.M09 |
| 23 | |
| 24 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 25 | |
| 26 | /-- Curves sharing an endpoint have squared separation bounded by |
| 27 | their two remaining energies, the displacement term in Proposition |
| 28 | 6.30's corner approximation, pp. 118-119. -/ |
| 29 | theorem sharedEndpoint_distance_sq_le {f g : ℝ → E} {a b s : ℝ} |
| 30 | (hf : ContinuousOn f (Icc a b)) (hg : ContinuousOn g (Icc a b)) |
| 31 | (hdf : DifferentiableOn ℝ f (Ioo a b)) (hdg : DifferentiableOn ℝ g (Ioo a b)) |
| 32 | (hEf : MemLp (deriv f) 2 (volume.restrict (Icc a b))) |
| 33 | (hEg : MemLp (deriv g) 2 (volume.restrict (Icc a b))) |
| 34 | (heq : f b = g b) (hs : s ∈ Icc a b) : |
| 35 | ‖g s - f s‖ ^ 2 ≤ 2 * (b - s) * |
| 36 | ((∫ t in a..b, ‖deriv f t‖ ^ 2) + ∫ t in a..b, ‖deriv g t‖ ^ 2) := by |
| 37 | have hF := norm_sub_sq_le_total_interval_energy hf hdf hEf hs |
| 38 | have hG := norm_sub_sq_le_total_interval_energy hg hdg hEg hs |
| 39 | have htriangle : ‖g s - f s‖ ≤ ‖g b - g s‖ + ‖f b - f s‖ := by |
| 40 | calc |
| 41 | _ ≤ ‖g s - g b‖ + ‖g b - f s‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ |
| 42 | _ = _ := by rw [norm_sub_rev (g s) (g b), ← heq] |
| 43 | have hsq := (sq_le_sq₀ (norm_nonneg _) (by positivity)).mpr htriangle |
| 44 | nlinarith [sq_nonneg (‖g b - g s‖ - ‖f b - f s‖)] |
| 45 | |
| 46 | /-- On the interval [b-2d,b-d], the actual one-sided blend has a |
| 47 | pointwise squared-speed bound in terms of the original speeds and |
| 48 | the energy on [b-2d,b]. This estimate allows unbounded endpoint |
| 49 | velocities in Proposition 6.30, pp. 118-119. -/ |
| 50 | theorem oneSidedBlend_deriv_sq_le {f g : ℝ → E} {b d s K : ℝ} |
| 51 | (hd : 0 < d) (hK : 0 ≤ K) |
| 52 | (hKb : ∀ r ∈ Icc (-1 : ℝ) 1, ‖deriv smoothJoinCutoff r‖ ≤ K) |
| 53 | (hf : ContinuousOn f (Icc (b - 2 * d) b)) |
| 54 | (hg : ContinuousOn g (Icc (b - 2 * d) b)) |
| 55 | (hdf : DifferentiableOn ℝ f (Ioo (b - 2 * d) b)) |
| 56 | (hdg : DifferentiableOn ℝ g (Ioo (b - 2 * d) b)) |
| 57 | (hEf : MemLp (deriv f) 2 (volume.restrict (Icc (b - 2 * d) b))) |
| 58 | (hEg : MemLp (deriv g) 2 (volume.restrict (Icc (b - 2 * d) b))) |
| 59 | (heq : f b = g b) (hs : s ∈ Ioo (b - 2 * d) (b - d)) : |
| 60 | ‖deriv (smoothJoinBlend f g (b - 3 * d / 2) (d / 2)) s‖ ^ 2 ≤ |
| 61 | 12 * (‖deriv f s‖ ^ 2 + ‖deriv g s‖ ^ 2) + (48 * K ^ 2 / d) * |
| 62 | ((∫ t in (b - 2 * d)..b, ‖deriv f t‖ ^ 2) + |
| 63 | ∫ t in (b - 2 * d)..b, ‖deriv g t‖ ^ 2) := by |
| 64 | let e := (∫ t in (b - 2 * d)..b, ‖deriv f t‖ ^ 2) + |
| 65 | ∫ t in (b - 2 * d)..b, ‖deriv g t‖ ^ 2 |
| 66 | have hpos : b - 2 * d ≤ b := by linarith |
| 67 | have he : 0 ≤ e := add_nonneg |
| 68 | (intervalIntegral.integral_nonneg hpos (fun _ _ => sq_nonneg _)) |
| 69 | (intervalIntegral.integral_nonneg hpos (fun _ _ => sq_nonneg _)) |
| 70 | have hsb : s ∈ Ioo (b - 2 * d) b := ⟨hs.1, by linarith [hs.2]⟩ |
| 71 | have hdiff := sharedEndpoint_distance_sq_le hf hg hdf hdg hEf hEg heq |
| 72 | (Ioo_subset_Icc_self hsb) |
| 73 | have hdiff' : ‖g s - f s‖ ^ 2 ≤ 4 * d * e := |
| 74 | hdiff.trans (mul_le_mul_of_nonneg_right (by linarith [hs.1]) he) |
| 75 | have hbound := smoothJoinBlend_deriv_sq_le f g (by linarith : 0 < d / 2) hK hKb |
| 76 | (show s ∈ Icc (b - 3 * d / 2 - d / 2) (b - 3 * d / 2 + d / 2) from |
| 77 | ⟨by linarith [hs.1], by linarith [hs.2]⟩) |
| 78 | ((hdf s hsb).differentiableAt (isOpen_Ioo.mem_nhds hsb)) |
| 79 | ((hdg s hsb).differentiableAt (isOpen_Ioo.mem_nhds hsb)) |
| 80 | have hterm := mul_le_mul_of_nonneg_left hdiff' (by positivity : 0 ≤ 3 * (K / (d / 2)) ^ 2) |
| 81 | have hcancel : 3 * (K / (d / 2)) ^ 2 * (4 * d * e) = (48 * K ^ 2 / d) * e := by |
| 82 | field_simp [hd.ne'] |
| 83 | ring |
| 84 | rw [hcancel] at hterm |
| 85 | change _ ≤ 12 * (‖deriv f s‖ ^ 2 + ‖deriv g s‖ ^ 2) + (48 * K ^ 2 / d) * e |
| 86 | nlinarith [sq_nonneg ‖deriv g s‖] |
| 87 | |
| 88 | end PoincareMT.M14 |