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.Exponential.SquareEndpointFamily |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.SmoothSquareActionDifferential |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.PathComparison |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Exponential.FamilySquareVelocity |
| 5 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.CenteredChartOperators |
| 6 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.ActionCongruence |
| 7 | import Mathlib.Analysis.Calculus.LocalExtr.Basic |
| 8 | |
| 9 | /-! |
| 10 | # The differential of a smooth lower contact |
| 11 | |
| 12 | An actual endpoint comparison family identifies the terminal covector even |
| 13 | when the exponential differential has not been shown invertible. |
| 14 | -/ |
| 15 | |
| 16 | set_option autoImplicit false |
| 17 | set_option maxSynthPendingDepth 3 |
| 18 | |
| 19 | open scoped Manifold ContDiff Bundle Topology |
| 20 | open Filter |
| 21 | |
| 22 | universe u |
| 23 | |
| 24 | namespace PoincareMT.ReducedLength |
| 25 | |
| 26 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 27 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 28 | [IsManifold (𝓡 n) ∞ M] [ConnectedSpace M] |
| 29 | |
| 30 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 31 | |
| 32 | set_option maxHeartbeats 1200000 in |
| 33 | set_option backward.isDefEq.respectTransparency false in |
| 34 | theorem lExponentialFamily_spatial_differential_of_lower_contact |
| 35 | {J : Set ℝ} {F : RicciFlow n M J} |
| 36 | (hM04 : RicciFlowCurvatureTheory.{u}) {T τmax : ℝ} |
| 37 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 38 | (hL : LGeodesicTheory F T τmax) {p : M} |
| 39 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 40 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) (f : M → ℝ) |
| 41 | (hf : ContMDiffAt (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f (A.gamma Z b)) |
| 42 | (hvalue : f (A.gamma Z b) = A.action Z b / (2 * Real.sqrt b)) |
| 43 | (hlower : ∀ᶠ x in 𝓝 (A.gamma Z b), f x ≤ reducedLength F T p x b) |
| 44 | (v : TangentSpace (𝓡 n) (A.gamma Z b)) : |
| 45 | mvfderiv (𝓡 n) f (A.gamma Z b) v = |
| 46 | (F.metric (T - b)).inner (A.gamma Z b) (curveVelocity (A.gamma Z) b) v := by |
| 47 | let q := A.gamma Z b |
| 48 | let H := Real.sqrt b |
| 49 | let e := chartAt E q |
| 50 | let y0 := e q |
| 51 | let v' : E := v |
| 52 | have hH : 0 < H := Real.sqrt_pos.mpr hb |
| 53 | have hden : 2 * H ≠ 0 := (mul_pos zero_lt_two hH).ne' |
| 54 | have hqsrc : q ∈ e.source := mem_chart_source E q |
| 55 | have hytarget : y0 ∈ e.target := e.map_source hqsrc |
| 56 | have heq : e.symm y0 = q := e.left_inv hqsrc |
| 57 | obtain ⟨Φ, U, V, hU, hV, hyV, hVe, hVU, hΦ, hstart, hend, hcenter⟩ := |
| 58 | lExponentialFamily_exists_square_endpoint_family A Z b hb hmax |
| 59 | let B : E → ℝ := fun y ↦ backwardLLength F T 0 b (fun t ↦ Φ (y, Real.sqrt t)) |
| 60 | have hB : ContDiffAt ℝ ∞ B y0 := by |
| 61 | have h := contDiffAt_smoothSquareFamily_action F hM04 T τmax hτmax hwindow |
| 62 | Φ U hU hΦ (y0, b) ⟨hb, hmax⟩ (fun r hr ↦ hVU |
| 63 | ⟨hyV, mul_nonneg hH.le hr.1, mul_le_of_le_one_right hH.le hr.2⟩) |
| 64 | exact h.comp y0 (contDiffAt_id.prodMk contDiffAt_const) |
| 65 | have hB0 : B y0 = A.action Z b := by |
| 66 | apply backwardLLength_congr_Ioo F T 0 b hb.le |
| 67 | intro t ht |
| 68 | change Φ ((chartAt E (A.gamma Z b)) (A.gamma Z b), Real.sqrt t) = A.gamma Z t |
| 69 | rw [hcenter (Real.sqrt t) ⟨Real.sqrt_nonneg t, Real.sqrt_le_sqrt ht.2.le⟩, |
| 70 | A.square_agrees Z (Real.sqrt t) ⟨Real.sqrt_nonneg t, |
| 71 | Real.sqrt_lt_sqrt ht.1.le (ht.2.trans hmax)⟩, Real.sq_sqrt ht.1.le] |
| 72 | have hcompare (y : E) (hy : y ∈ V) : |
| 73 | reducedLength F T p (e.symm y) b ≤ B y / (2 * H) := by |
| 74 | let D := (fun s : ℝ ↦ (y, s)) ⁻¹' U |
| 75 | have hD : IsOpen D := hU.preimage (continuous_const.prodMk continuous_id) |
| 76 | have hφ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (fun s ↦ Φ (y, s)) D := |
| 77 | hΦ.comp (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffOn (fun s hs ↦ hs) |
| 78 | obtain ⟨P, hP, _⟩ := exists_backwardPath_of_smoothSquareCurve F hM04 T τmax hτmax |
| 79 | hwindow b hb hmax (fun s ↦ Φ (y, s)) D hD (fun s hs ↦ hVU ⟨hy, hs⟩) hφ |
| 80 | have hP0 : P.curve 0 = p := by simpa only [hP, Real.sqrt_zero] using hstart y |
| 81 | have hPb : P.curve b = e.symm y := by simpa only [hP] using hend y |
| 82 | simpa only [hP] using reducedLength_le_path hL hb hmax.le P hP0 hPb |
| 83 | have hinv := (mdifferentiable_chart (I := 𝓡 n) q).mdifferentiableAt_symm hytarget |
| 84 | have hf' : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f (e.symm y0) := by |
| 85 | rw [heq] |
| 86 | exact hf.mdifferentiableAt (by simp) |
| 87 | have hfc : DifferentiableAt ℝ (fun y ↦ f (e.symm y)) y0 := |
| 88 | (hf'.comp y0 hinv).differentiableAt |
| 89 | have hnear : ∀ᶠ y in 𝓝 y0, f (e.symm y) ≤ reducedLength F T p (e.symm y) b := by |
| 90 | exact hinv.continuousAt.tendsto.eventually |
| 91 | (p := fun x : M ↦ f x ≤ reducedLength F T p x b) (by |
| 92 | change ∀ᶠ x in 𝓝 (e.symm y0), f x ≤ reducedLength F T p x b |
| 93 | rw [heq] |
| 94 | exact hlower) |
| 95 | have hmin : IsLocalMin (fun y ↦ B y - 2 * H * f (e.symm y)) y0 := by |
| 96 | have hzero : B y0 - 2 * H * f (e.symm y0) = 0 := by |
| 97 | rw [heq, hvalue, hB0, mul_div_cancel₀ _ hden, sub_self] |
| 98 | filter_upwards [hV.mem_nhds hyV, hnear] with y hy hl |
| 99 | rw [hzero] |
| 100 | exact sub_nonneg.mpr (by |
| 101 | simpa only [mul_comm] using |
| 102 | (le_div_iff₀ (mul_pos zero_lt_two hH)).mp (hl.trans (hcompare y hy))) |
| 103 | have hd := hmin.hasFDerivAt_eq_zero |
| 104 | ((hB.differentiableAt (by simp)).hasFDerivAt.sub (hfc.hasFDerivAt.const_mul (2 * H))) |
| 105 | have hstat := congrArg (fun L : E →L[ℝ] ℝ ↦ L v) hd |
| 106 | change fderiv ℝ B y0 v - (2 * H) * fderiv ℝ (fun y ↦ f (e.symm y)) y0 v = 0 at hstat |
| 107 | have hcoord := mvfderiv_chartVectorField q f y0 v hytarget hf' |
| 108 | rw [heq, chartVectorField_self] at hcoord |
| 109 | have hterminal : (curveVelocity (n := n) (fun r : ℝ ↦ Φ (y0 + r • v', H)) 0 : E) = v' := by |
| 110 | have hext : (fun r : ℝ ↦ Φ (y0 + r • v', H)) = fun r ↦ e.symm (y0 + r • v') := |
| 111 | funext (fun r ↦ hend (y0 + r • v')) |
| 112 | rw [hext, curveVelocity_comp_initial_line e.symm y0 v' hinv, |
| 113 | ← chartVectorField_at_inverse q v' y0 hytarget, heq, chartVectorField_self] |
| 114 | have hinitial : (curveVelocity (n := n) (fun r : ℝ ↦ Φ (y0 + r • v', 0)) 0 : E) = 0 := by |
| 115 | have hext : (fun r : ℝ ↦ Φ (y0 + r • v', 0)) = fun _ ↦ p := funext (fun r ↦ hstart _) |
| 116 | rw [hext] |
| 117 | simp only [curveVelocity, mfderiv_const, zero_apply] |
| 118 | have hfirst := fderiv_smoothSquareFamily_action hM04 hL hτmax hwindow A Z b hb hmax |
| 119 | Φ U hU hΦ y0 v' (fun s hs ↦ hVU ⟨hyV, hs⟩) hcenter |
| 120 | have hsmax : H ∈ Set.Ioo 0 (Real.sqrt τmax) := ⟨hH, Real.sqrt_lt_sqrt hb.le hmax⟩ |
| 121 | have hbase : A.squareFamily Z H = q := by |
| 122 | rw [A.square_agrees Z H ⟨hH.le, hsmax.2⟩, Real.sq_sqrt hb.le] |
| 123 | have hvel := lExponentialFamily_square_velocity_eq A Z H hsmax |
| 124 | rw [Real.sq_sqrt hb.le] at hvel |
| 125 | rw [hterminal, hinitial, map_zero, sub_zero, hbase, hvel, map_smul, |
| 126 | ContinuousLinearMap.smul_apply, smul_eq_mul] at hfirst |
| 127 | rw [← hcoord, hfirst] at hstat |
| 128 | exact (mul_left_cancel₀ hden (sub_eq_zero.mp hstat)).symm |
| 129 | |
| 130 | end PoincareMT.ReducedLength |