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.ReducedGeometry.ReducedLength.Calculus.SpatialDifferentialJet |
| 2 | import Mathlib.Analysis.Calculus.MeanValue |
| 3 | import Mathlib.Topology.Compactness.Compact |
| 4 | |
| 5 | /-! |
| 6 | # Uniform first-order control of spatial differentials |
| 7 | |
| 8 | The tube lemma makes the actual mixed derivative estimate uniform on a |
| 9 | compact initial set. The real mean-value inequality retains the factor time. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped ContDiff Topology |
| 16 | |
| 17 | namespace PoincareMT.ReducedLength |
| 18 | |
| 19 | variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 20 | [NormedAddCommGroup V] [NormedSpace ℝ V] |
| 21 | |
| 22 | set_option backward.isDefEq.respectTransparency false in |
| 23 | theorem exists_uniform_initialSlice_fderiv_bound (f : E × ℝ → V) (U : Set (E × ℝ)) |
| 24 | (hU : IsOpen U) (hf : ContDiffOn ℝ ∞ f U) |
| 25 | (hzeroU : ∀ x, (x, (0 : ℝ)) ∈ U) (q : V) (hzero : ∀ x, f (x, 0) = q) |
| 26 | (L : E →L[ℝ] V) (hjet : ∀ x, HasDerivAt (fun t ↦ f (x, t)) (L x) 0) |
| 27 | (K : Set E) (hK : IsCompact K) (ε : ℝ) (hε : 0 < ε) : |
| 28 | ∃ δ : ℝ, 0 < δ ∧ ∀ x ∈ K, ∀ s, 0 ≤ s → s < δ → |
| 29 | (x, s) ∈ U ∧ ‖fderiv ℝ (fun y ↦ f (y, s)) x - s • L‖ ≤ ε * s := by |
| 30 | let B : E × ℝ → E →L[ℝ] V := fun z ↦ fderiv ℝ (fun y ↦ f (y, z.2)) z.1 |
| 31 | let C : E × ℝ → E →L[ℝ] V := fun z ↦ deriv (fun t ↦ B (z.1, t)) z.2 |
| 32 | have hB : ContDiffOn ℝ ∞ B U := contDiffOn_initialSlice_fderiv f U hU hf |
| 33 | have hC : ContDiffOn ℝ ∞ C U := contDiffOn_timeSlice_deriv B U hU hB |
| 34 | have hBzero (x : E) : B (x, 0) = 0 := initialSlice_fderiv_zero f q hzero x |
| 35 | have hCzero (x : E) : C (x, 0) = L := |
| 36 | (hasDerivAt_initialSlice_fderiv_zero f U hU hf hzeroU L hjet x).deriv |
| 37 | let W := U ∩ C ⁻¹' Metric.ball L ε |
| 38 | have hW : IsOpen W := hC.continuousOn.isOpen_inter_preimage hU Metric.isOpen_ball |
| 39 | have hKW : K ×ˢ {(0 : ℝ)} ⊆ W := by |
| 40 | rintro ⟨x, t⟩ ⟨_, ht⟩ |
| 41 | have ht0 : t = 0 := ht |
| 42 | subst t |
| 43 | refine ⟨hzeroU x, ?_⟩ |
| 44 | simpa only [Set.mem_preimage, hCzero, Metric.mem_ball, dist_self] using hε |
| 45 | obtain ⟨N, V0, _, hV0, hKN, hzeroV, hNV⟩ := |
| 46 | generalized_tube_lemma hK isCompact_singleton hW hKW |
| 47 | obtain ⟨δ, hδ, hδV⟩ := Metric.mem_nhds_iff.mp |
| 48 | (hV0.mem_nhds (hzeroV (Set.mem_singleton 0))) |
| 49 | have hnear (x : E) (hx : x ∈ K) (r : ℝ) (hr : 0 ≤ r) (hrδ : r < δ) : |
| 50 | (x, r) ∈ W := by |
| 51 | apply hNV |
| 52 | refine ⟨hKN hx, hδV ?_⟩ |
| 53 | simpa only [Metric.mem_ball, dist_zero_right, Real.norm_eq_abs, abs_of_nonneg hr] using hrδ |
| 54 | refine ⟨δ, hδ, ?_⟩ |
| 55 | intro x hx s hs hsδ |
| 56 | refine ⟨(hnear x hx s hs hsδ).1, ?_⟩ |
| 57 | let H : ℝ → E →L[ℝ] V := fun r ↦ B (x, r) - r • L |
| 58 | have hD (r : ℝ) (hr : r ∈ Set.Icc 0 s) : HasDerivAt H (C (x, r) - L) r := by |
| 59 | have hb : DifferentiableAt ℝ (fun t ↦ B (x, t)) r := |
| 60 | ((hB.contDiffAt (hU.mem_nhds (hnear x hx r hr.1 (hr.2.trans_lt hsδ)).1)).comp r |
| 61 | (contDiffAt_const.prodMk contDiffAt_id)).differentiableAt (by simp) |
| 62 | convert! hb.hasDerivAt.sub ((hasDerivAt_id r).smul_const L) using 1 <;> |
| 63 | simp only [H, C, Pi.sub_apply, id_eq, one_smul] |
| 64 | have hbound (r : ℝ) (hr : r ∈ Set.Ico 0 s) : ‖C (x, r) - L‖ ≤ ε := by |
| 65 | have h := (hnear x hx r hr.1 (hr.2.trans hsδ)).2 |
| 66 | exact (show ‖C (x, r) - L‖ < ε by |
| 67 | simpa only [Set.mem_preimage, Metric.mem_ball, dist_eq_norm] using h).le |
| 68 | have hm := norm_image_sub_le_of_norm_deriv_le_segment' |
| 69 | (fun r hr ↦ (hD r hr).hasDerivWithinAt) hbound s ⟨hs, le_rfl⟩ |
| 70 | simpa only [H, hBzero, zero_smul, sub_self, sub_zero] using hm |
| 71 | |
| 72 | end PoincareMT.ReducedLength |