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.Basic |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.ODE.LocalRegularizedEquation |
| 3 | |
| 4 | /-! |
| 5 | # The family Euler equation and the actual first-variation residual |
| 6 | |
| 7 | Curve germs identify the given regularizations with the coherent square |
| 8 | family. The local-coordinate equivalence applies to every extension |
| 9 | witness, so the first-variation residual vanishes independently of it. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | set_option maxHeartbeats 800000 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology intervalIntegral |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 24 | [IsManifold (𝓡 n) ∞ M] |
| 25 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 26 | |
| 27 | theorem lExponentialFamily_localRegularizedEquation |
| 28 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 29 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (A : LExponentialFamily F T τmax p) |
| 30 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 31 | (s : ℝ) (hs : s ∈ Set.Ioo 0 (Real.sqrt b)) : |
| 32 | LocalRegularizedEquation F T (A.squareFamily Z) s := by |
| 33 | let R := A.regularization Z b hb hmax |
| 34 | let K := sqrtParameterInterval 0 b |
| 35 | have hK : K = Set.Icc 0 (Real.sqrt b) := by simp [K, sqrtParameterInterval] |
| 36 | have hKdiff : UniqueDiffOn ℝ K := hK ▸ uniqueDiffOn_Icc (Real.sqrt_pos.mpr hb) |
| 37 | have hsK : s ∈ K := by rw [hK]; exact Set.Ioo_subset_Icc_self hs |
| 38 | have htime : s ∈ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) := |
| 39 | ⟨(neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans hs.1, |
| 40 | hs.2.trans (Real.sqrt_lt_sqrt hb.le hmax)⟩ |
| 41 | have hlocal := (regularizedEquation_iff_local F hM04 T τmax hτmax hwindow |
| 42 | R.path.curve R.path.domain K R.path.open_domain R.path.interval_subset hKdiff |
| 43 | R.path.smooth R.velocity_extension s hsK htime).mp (R.equation s hsK) |
| 44 | have heq : Set.EqOn R.path.curve (A.squareFamily Z) K := by |
| 45 | intro r hr |
| 46 | have hr0 : 0 ≤ r := by simpa only [Real.sqrt_zero] using hr.1 |
| 47 | have hrmax : r < Real.sqrt τmax := |
| 48 | hr.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax) |
| 49 | exact (R.path.agrees r hr).trans |
| 50 | ((congrFun (A.path_eq Z b hb hmax) (r ^ 2)).trans |
| 51 | (A.square_agrees Z r ⟨hr0, hrmax⟩).symm) |
| 52 | apply hlocal.congr |
| 53 | apply Filter.eventuallyEq_of_mem (isOpen_Ioo.mem_nhds hs) |
| 54 | intro r hr |
| 55 | apply heq |
| 56 | rw [hK] |
| 57 | exact Set.Ioo_subset_Icc_self hr |
| 58 | |
| 59 | set_option backward.isDefEq.respectTransparency false in |
| 60 | theorem lExponentialFamily_firstVariationResidualIntegral_eq_zero |
| 61 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 62 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (A : LExponentialFamily F T τmax p) |
| 63 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 64 | (V : LVariation F T 0 b (A.path Z b hb hmax)) (D : LVariationDerivativeData V) : |
| 65 | firstVariationResidualIntegral V D = 0 := by |
| 66 | let K := sqrtParameterInterval 0 b |
| 67 | let U : Set ℝ := (fun s : ℝ ↦ (s, (0 : ℝ))) ⁻¹' V.squareDomain |
| 68 | have hzero : (0 : ℝ) ∈ Set.Ioo (-V.radius) V.radius := |
| 69 | ⟨neg_lt_zero.mpr V.radius_pos, V.radius_pos⟩ |
| 70 | have hK : K = Set.Icc 0 (Real.sqrt b) := by simp [K, sqrtParameterInterval] |
| 71 | have hKdiff : UniqueDiffOn ℝ K := hK ▸ uniqueDiffOn_Icc (Real.sqrt_pos.mpr hb) |
| 72 | have hU : IsOpen U := V.square_open.preimage (continuous_id.prodMk continuous_const) |
| 73 | have hKU : K ⊆ U := fun s hs ↦ V.square_contains ⟨hs, hzero⟩ |
| 74 | have hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ V.baseSquareCurve U := |
| 75 | V.square_smooth.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn |
| 76 | (fun s (hs : s ∈ U) ↦ hs) |
| 77 | have heq : Set.EqOn V.baseSquareCurve (A.squareFamily Z) K := by |
| 78 | intro s hs |
| 79 | have hs0 : 0 ≤ s := by simpa only [sqrtParameterInterval, Real.sqrt_zero] using hs.1 |
| 80 | have hsmax : s < Real.sqrt τmax := |
| 81 | hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax) |
| 82 | exact (V.square_agrees s hs 0 hzero).trans ((V.at_zero (s ^ 2)).trans |
| 83 | ((congrFun (A.path_eq Z b hb hmax) (s ^ 2)).trans |
| 84 | (A.square_agrees Z s ⟨hs0, hsmax⟩).symm)) |
| 85 | have hresidual : ∀ s ∈ Set.Ioo 0 (Real.sqrt b), |
| 86 | -regularizedEulerResidual F T V.baseSquareCurve K D.velocity_extension s |
| 87 | (squareVariationField V s) = 0 := by |
| 88 | intro s hs |
| 89 | have hsK : s ∈ K := by rw [hK]; exact Set.Ioo_subset_Icc_self hs |
| 90 | have htime : s ∈ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) := |
| 91 | ⟨(neg_lt_zero.mpr (Real.sqrt_pos.mpr hτmax)).trans hs.1, |
| 92 | hs.2.trans (Real.sqrt_lt_sqrt hb.le hmax)⟩ |
| 93 | have hgerm : V.baseSquareCurve =ᶠ[nhds s] A.squareFamily Z := by |
| 94 | apply Filter.eventuallyEq_of_mem (isOpen_Ioo.mem_nhds hs) |
| 95 | intro r hr |
| 96 | apply heq |
| 97 | rw [hK] |
| 98 | exact Set.Ioo_subset_Icc_self hr |
| 99 | have hlocal := (lExponentialFamily_localRegularizedEquation hM04 hτmax hwindow |
| 100 | A Z b hb hmax s hs).congr hgerm.symm |
| 101 | have heuler := (regularizedEquation_iff_local F hM04 T τmax hτmax hwindow |
| 102 | V.baseSquareCurve U K hU hKU hKdiff hβ D.velocity_extension s hsK htime).mpr hlocal |
| 103 | exact neg_eq_zero.mpr (heuler (squareVariationField V s)) |
| 104 | unfold firstVariationResidualIntegral |
| 105 | rw [Real.sqrt_zero] |
| 106 | calc |
| 107 | _ = ∫ _s in (0 : ℝ)..Real.sqrt b, (0 : ℝ) := |
| 108 | intervalIntegral.integral_congr_Ioo_of_le (Real.sqrt_nonneg b) hresidual |
| 109 | _ = 0 := by simp |
| 110 | |
| 111 | end PoincareMT.ReducedLength |