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.ReducedVolume.Regularity.AlmostEverywhere.RegularGerms |
| 2 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 3 | |
| 4 | /-! |
| 5 | # Actual derivative bounds from touching upper barriers |
| 6 | |
| 7 | Fermat's theorem identifies the first derivatives of a smooth reduced-length |
| 8 | germ with those of any touching upper barrier. M09's uniform contact bounds |
| 9 | then give M10's local derivative bounds on the same regular spacetime image. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open scoped Manifold ContDiff Bundle Topology |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedVolume |
| 19 | |
| 20 | /-- Differentiable real functions touching with local domination have equal derivatives. -/ |
| 21 | theorem deriv_eq_of_contact {f g : ℝ → ℝ} {s : ℝ} |
| 22 | (hf : DifferentiableAt ℝ f s) (hg : DifferentiableAt ℝ g s) |
| 23 | (heq : f s = g s) (hle : ∀ᶠ t in 𝓝 s, f t ≤ g t) : |
| 24 | deriv f s = deriv g s := by |
| 25 | have hmin : IsLocalMin (g - f) s := by |
| 26 | filter_upwards [hle] with t ht |
| 27 | simpa only [Pi.sub_apply, heq, sub_self] using sub_nonneg.mpr ht |
| 28 | have hzero := hmin.deriv_eq_zero |
| 29 | rw [deriv_sub hg hf] at hzero |
| 30 | exact (sub_eq_zero.mp hzero).symm |
| 31 | |
| 32 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 33 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 34 | |
| 35 | /-- Fermat's theorem for the actual vector-valued differential in a boundaryless chart. -/ |
| 36 | theorem mvfderiv_eq_zero_of_isLocalMin {f : M → ℝ} {q : M} |
| 37 | (hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f q) (hmin : IsLocalMin f q) : |
| 38 | mvfderiv (𝓡 n) f q = 0 := by |
| 39 | have hmin' : IsLocalMin f ((extChartAt (𝓡 n) q).symm ((extChartAt (𝓡 n) q) q)) := by |
| 40 | simpa only [extChartAt_to_inv] using hmin |
| 41 | have hchart := hmin'.comp_continuous (continuousAt_extChartAt_symm (I := 𝓡 n) q) |
| 42 | rw [hf.mvfderiv] |
| 43 | ext v |
| 44 | change (fderivWithin ℝ (writtenInExtChartAt (𝓡 n) (𝓘(ℝ, ℝ)) q f) |
| 45 | (Set.range (𝓡 n)) ((extChartAt (𝓡 n) q) q)) v = (0 : ℝ) |
| 46 | simpa only [writtenInExtChartAt, extChartAt_self_eq, modelWithCornersSelf_coe, |
| 47 | Function.id_comp, Set.range_id, fderivWithin_univ, zero_apply] |
| 48 | using congrArg (fun L : EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ ↦ L v) |
| 49 | hchart.fderiv_eq_zero |
| 50 | |
| 51 | /-- Spatial first derivatives agree at differentiable contact with local domination. -/ |
| 52 | theorem mvfderiv_eq_of_contact {f g : M → ℝ} {q : M} |
| 53 | (hf : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f q) |
| 54 | (hg : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) g q) |
| 55 | (heq : f q = g q) (hle : ∀ᶠ x in 𝓝 q, f x ≤ g x) : |
| 56 | mvfderiv (𝓡 n) f q = mvfderiv (𝓡 n) g q := by |
| 57 | have hmin : IsLocalMin (g - f) q := by |
| 58 | filter_upwards [hle] with x hx |
| 59 | simpa only [Pi.sub_apply, heq, sub_self] using sub_nonneg.mpr hx |
| 60 | have hzero := mvfderiv_eq_zero_of_isLocalMin (hg.sub hf) hmin |
| 61 | rw [mvfderiv_sub hg hf] at hzero |
| 62 | exact (sub_eq_zero.mp hzero).symm |
| 63 | |
| 64 | variable [IsManifold (𝓡 n) ∞ M] |
| 65 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p q : M} {τ : ℝ} |
| 66 | |
| 67 | /-- At regular contact, the barrier and actual reduced length have the same time derivative. -/ |
| 68 | theorem barrier_time_deriv_eq (r : ReducedLengthRegularPoint F T τmax p q τ) |
| 69 | (B : ReducedLengthUpperBarrier F T p q τ) : |
| 70 | deriv (fun s ↦ B.representative (q, s)) τ = |
| 71 | deriv (fun s ↦ reducedLength F T p q s) τ := by |
| 72 | obtain ⟨d, hd⟩ := B.representative_time_derivative |
| 73 | have hdom : ∀ᶠ z : M × ℝ in 𝓝 (q, τ), |
| 74 | reducedLength F T p z.1 z.2 ≤ B.representative z := |
| 75 | Filter.eventually_of_mem (B.neighborhood_open.mem_nhds B.center_mem) B.dominates |
| 76 | exact (deriv_eq_of_contact (reducedLength_hasDerivAt r).differentiableAt |
| 77 | hd.differentiableAt B.touches.symm |
| 78 | ((continuous_const.prodMk continuous_id).continuousAt hdom)).symm |
| 79 | |
| 80 | /-- At regular contact, the barrier and actual reduced length have the same spatial differential. -/ |
| 81 | theorem barrier_spatial_differential_eq |
| 82 | (r : ReducedLengthRegularPoint F T τmax p q τ) |
| 83 | (B : ReducedLengthUpperBarrier F T p q τ) : |
| 84 | mvfderiv (𝓡 n) (fun x ↦ B.representative (x, τ)) q = |
| 85 | mvfderiv (𝓡 n) (fun x ↦ reducedLength F T p x τ) q := by |
| 86 | have hdom : ∀ᶠ z : M × ℝ in 𝓝 (q, τ), |
| 87 | reducedLength F T p z.1 z.2 ≤ B.representative z := |
| 88 | Filter.eventually_of_mem (B.neighborhood_open.mem_nhds B.center_mem) B.dominates |
| 89 | exact (mvfderiv_eq_of_contact |
| 90 | ((reducedLength_space_contMDiffAt r).mdifferentiableAt (by simp)) |
| 91 | (B.representative_space_smooth.mdifferentiableAt (by simp)) B.touches.symm |
| 92 | ((continuous_id.prodMk continuous_const).continuousAt hdom)).symm |
| 93 | |
| 94 | /-- Squared gradient norms use the same selected slice metric at a contact point. -/ |
| 95 | theorem barrier_gradientNormSq_eq (r : ReducedLengthRegularPoint F T τmax p q τ) |
| 96 | (B : ReducedLengthUpperBarrier F T p q τ) : |
| 97 | reducedLengthGradientNormSq F T B.representative τ q = |
| 98 | reducedLengthGradientNormSq F T (fun z ↦ reducedLength F T p z.1 z.2) τ q := by |
| 99 | unfold reducedLengthGradientNormSq |
| 100 | rw [barrier_spatial_differential_eq r B] |
| 101 | |
| 102 | /-- M09's barrier bounds control the actual derivatives on its regular image. -/ |
| 103 | theorem reducedLength_local_derivative_bounds [ConnectedSpace M] |
| 104 | (hDifferential : ReducedLengthDifferentialTheory F T τmax) |
| 105 | (G : LExponentialGeometry F T τmax p) |
| 106 | (z : M × ℝ) (hz : z ∈ Set.univ ×ˢ Set.Ioo 0 τmax) : |
| 107 | ∃ U : Set (M × ℝ), IsOpen U ∧ z ∈ U ∧ |
| 108 | U ⊆ Set.univ ×ˢ Set.Ioo 0 τmax ∧ |
| 109 | ∃ C : ℝ, 0 ≤ C ∧ ∀ w ∈ U ∩ G.regularImage, |
| 110 | |deriv (fun s ↦ reducedLength F T p w.1 s) w.2| ≤ C ∧ |
| 111 | reducedLengthGradientNormSq F T |
| 112 | (fun y ↦ reducedLength F T p y.1 y.2) w.2 w.1 ≤ C := by |
| 113 | obtain ⟨N, hNopen, hzN, hNtime, C, hC, hbounds⟩ := |
| 114 | hDifferential.local_upper_barrier_bounds p z hz |
| 115 | refine ⟨N, hNopen, hzN, hNtime, C, hC, ?_⟩ |
| 116 | intro w hw |
| 117 | obtain ⟨B, htime, hspace, _⟩ := hbounds w hw.1 |
| 118 | let r := G.regular_point w hw.2 |
| 119 | rw [barrier_time_deriv_eq r B] at htime |
| 120 | rw [barrier_gradientNormSq_eq r B] at hspace |
| 121 | exact ⟨htime, hspace⟩ |
| 122 | |
| 123 | end PoincareMT.ReducedVolume |