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.Barrier.ComparisonEndpointInverse |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.ActionCongruence |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.PathComparison |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Basic |
| 5 | import Mathlib.Geometry.Manifold.Algebra.LieGroup |
| 6 | |
| 7 | /-! |
| 8 | # Upper barriers retaining the actual comparison parameters |
| 9 | |
| 10 | The endpoint inverse transports a genuine path action. The source identity |
| 11 | retains the original variation fields for subsequent derivative calculations. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option maxSynthPendingDepth 3 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | open Filter |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.ReducedLength |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 26 | [IsManifold (𝓡 n) ∞ M] [ConnectedSpace M] |
| 27 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 28 | {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] |
| 29 | |
| 30 | set_option maxHeartbeats 1600000 in |
| 31 | -- Inverse identities are used only on the genuine source and target domains. |
| 32 | set_option backward.isDefEq.respectTransparency false in |
| 33 | theorem exists_upperBarrier_of_comparison_family |
| 34 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 35 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 36 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 37 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 38 | (hmin : IsMinimizingBackwardLPath F T 0 b (A.path Z b hb hmax)) |
| 39 | (f : E × ℝ → M) (Ω : Set (E × ℝ)) (hΩ : IsOpen Ω) |
| 40 | (hf : ContMDiffOn (𝓘(ℝ, E × ℝ)) (𝓡 n) ∞ f Ω) |
| 41 | (hsegment : ∀ s ∈ Set.Icc 0 (Real.sqrt b), ((0 : E), s) ∈ Ω) |
| 42 | (hbase : ∀ s, f (0, s) = A.squareFamily Z s) |
| 43 | (hfixed : ∀ x, f (x, 0) = p) |
| 44 | (hbij : Function.Bijective (mfderiv (𝓘(ℝ, E)) (𝓡 n) |
| 45 | (fun x ↦ f (x, Real.sqrt b)) 0)) : |
| 46 | ∃ (B : ReducedLengthUpperBarrier F T p (A.gamma Z b) b) |
| 47 | (e : OpenPartialHomeomorph (E × ℝ) (M × ℝ)), |
| 48 | ((0 : E), b) ∈ e.source ∧ |
| 49 | e.source ⊆ squareFamilyParameterDomain Ω τmax ∧ |
| 50 | Set.EqOn e (fun z ↦ (f (z.1, Real.sqrt z.2), z.2)) e.source ∧ |
| 51 | B.neighborhood = e.target ∧ |
| 52 | ContMDiffOn ((𝓡 n).prod (𝓘(ℝ, ℝ))) (𝓘(ℝ, ℝ)) ∞ |
| 53 | B.representative B.neighborhood ∧ |
| 54 | ∀ z ∈ e.source, B.representative (f (z.1, Real.sqrt z.2), z.2) = |
| 55 | backwardLLength F T 0 z.2 (fun t ↦ f (z.1, Real.sqrt t)) / |
| 56 | (2 * Real.sqrt z.2) := by |
| 57 | let S := squareFamilyParameterDomain Ω τmax |
| 58 | have hzS : ((0 : E), b) ∈ S := by |
| 59 | refine ⟨⟨hb, hmax⟩, fun r hr ↦ hsegment _ ?_⟩ |
| 60 | exact ⟨mul_nonneg (Real.sqrt_nonneg _) hr.1, |
| 61 | mul_le_of_le_one_right (Real.sqrt_nonneg _) hr.2⟩ |
| 62 | obtain ⟨e, hze, hsub, he, hinv⟩ := exists_squareFamily_endpoint_inverse |
| 63 | f Ω hΩ hf τmax ((0 : E), b) hzS hbij |
| 64 | have hendpoint : f (0, Real.sqrt b) = A.gamma Z b := by |
| 65 | rw [hbase, A.square_agrees Z (Real.sqrt b) |
| 66 | ⟨Real.sqrt_nonneg _, Real.sqrt_lt_sqrt hb.le hmax⟩, Real.sq_sqrt hb.le] |
| 67 | have hecenter : e (0, b) = (A.gamma Z b, b) := by |
| 68 | simpa only [hendpoint] using he hze |
| 69 | have hcenter_mem : (A.gamma Z b, b) ∈ e.target := hecenter ▸ e.map_source hze |
| 70 | have hinvcenter : e.symm (A.gamma Z b, b) = (0, b) := by |
| 71 | rw [← hecenter, e.left_inv hze] |
| 72 | let Q : E × ℝ → ℝ := fun z ↦ |
| 73 | backwardLLength F T 0 z.2 (fun t ↦ f (z.1, Real.sqrt t)) / (2 * Real.sqrt z.2) |
| 74 | have hQ : ContDiffOn ℝ ∞ Q S := by |
| 75 | intro z hz |
| 76 | have hLsm := contDiffAt_smoothSquareFamily_action F hM04 T τmax hτmax hwindow |
| 77 | f Ω hΩ hf z hz.1 hz.2 |
| 78 | exact (hLsm.div (contDiffAt_const.mul (contDiffAt_snd.sqrt hz.1.1.ne')) |
| 79 | (mul_ne_zero two_ne_zero (Real.sqrt_pos.mpr hz.1.1).ne')).contDiffWithinAt |
| 80 | let C : M × ℝ → ℝ := fun w ↦ Q (e.symm w) |
| 81 | have hC : ContMDiffOn ((𝓡 n).prod (𝓘(ℝ, ℝ))) (𝓘(ℝ, ℝ)) ∞ C e.target := |
| 82 | hQ.contMDiffOn.comp hinv (fun w hw ↦ hsub (e.map_target hw)) |
| 83 | have hcompare (z : E × ℝ) (hz : z ∈ S) : |
| 84 | reducedLength F T p (f (z.1, Real.sqrt z.2)) z.2 ≤ Q z := by |
| 85 | let D := (fun s : ℝ ↦ (z.1, s)) ⁻¹' Ω |
| 86 | have hD : IsOpen D := hΩ.preimage (continuous_const.prodMk continuous_id) |
| 87 | have hKD : Set.Icc 0 (Real.sqrt z.2) ⊆ D := by |
| 88 | intro s hs |
| 89 | have hc : 0 < Real.sqrt z.2 := Real.sqrt_pos.mpr hz.1.1 |
| 90 | have hr : s / Real.sqrt z.2 ∈ Set.Icc (0 : ℝ) 1 := |
| 91 | ⟨div_nonneg hs.1 hc.le, (div_le_one hc).mpr hs.2⟩ |
| 92 | change (z.1, s) ∈ Ω |
| 93 | simpa only [mul_div_cancel₀ s hc.ne'] using hz.2 (s / Real.sqrt z.2) hr |
| 94 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (fun s ↦ f (z.1, s)) D := |
| 95 | hf.comp (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffOn (fun _ hs ↦ hs) |
| 96 | obtain ⟨P, hP, _⟩ := exists_backwardPath_of_smoothSquareCurve F hM04 T τmax hτmax |
| 97 | hwindow z.2 hz.1.1 hz.1.2 (fun s ↦ f (z.1, s)) D hD hKD hα |
| 98 | have hP0 : P.curve 0 = p := by simp only [hP, Real.sqrt_zero, hfixed] |
| 99 | have hPe : P.curve z.2 = f (z.1, Real.sqrt z.2) := congrFun hP z.2 |
| 100 | have h := reducedLength_le_path hL hz.1.1 hz.1.2.le P hP0 hPe |
| 101 | simpa only [hP, Q] using h |
| 102 | have htouch : C (A.gamma Z b, b) = reducedLength F T p (A.gamma Z b) b := by |
| 103 | change Q (e.symm (A.gamma Z b, b)) = _ |
| 104 | rw [hinvcenter] |
| 105 | have hact : backwardLLength F T 0 b (fun t ↦ f (0, Real.sqrt t)) = A.action Z b := by |
| 106 | apply backwardLLength_congr_Ioo F T 0 b hb.le |
| 107 | intro t ht |
| 108 | change f (0, Real.sqrt t) = A.gamma Z t |
| 109 | rw [hbase, A.square_agrees Z (Real.sqrt t) |
| 110 | ⟨Real.sqrt_nonneg _, Real.sqrt_lt_sqrt ht.1.le (ht.2.trans hmax)⟩, |
| 111 | Real.sq_sqrt ht.1.le] |
| 112 | have hminvalue := reducedLength_eq_minimizing_path (p := p) (q := A.gamma Z b) |
| 113 | hL hb hmax.le (A.path Z b hb hmax) |
| 114 | (by rw [A.path_eq]; exact A.gamma_at_zero Z) (by rw [A.path_eq]) hmin |
| 115 | rw [A.path_eq] at hminvalue |
| 116 | exact (congrArg (fun a : ℝ ↦ a / (2 * Real.sqrt b)) hact).trans hminvalue.symm |
| 117 | have hdom (w : M × ℝ) (hw : w ∈ e.target) : reducedLength F T p w.1 w.2 ≤ C w := by |
| 118 | have hcoords : (f ((e.symm w).1, Real.sqrt (e.symm w).2), (e.symm w).2) = w := |
| 119 | (he (e.map_target hw)).symm.trans (e.right_inv hw) |
| 120 | have h := hcompare (e.symm w) (hsub (e.map_target hw)) |
| 121 | change reducedLength F T p w.1 w.2 ≤ Q (e.symm w) |
| 122 | convert h using 1 |
| 123 | exact congrArg₂ (fun x t ↦ reducedLength F T p x t) |
| 124 | (congrArg Prod.fst hcoords).symm (congrArg Prod.snd hcoords).symm |
| 125 | have hcenter := hC.contMDiffAt (e.open_target.mem_nhds hcenter_mem) |
| 126 | have htime : ∃ d : ℝ, HasDerivAt (fun t ↦ C (A.gamma Z b, t)) d b := by |
| 127 | have h := (hcenter.comp b (contMDiffAt_const.prodMk contMDiffAt_id)).contDiffAt |
| 128 | exact ⟨_, (h.differentiableAt (by simp)).hasDerivAt⟩ |
| 129 | let B : ReducedLengthUpperBarrier F T p (A.gamma Z b) b := { |
| 130 | neighborhood := e.target |
| 131 | neighborhood_open := e.open_target |
| 132 | center_mem := hcenter_mem |
| 133 | representative := C |
| 134 | touches := htouch |
| 135 | dominates := hdom |
| 136 | representative_spacetime_smooth := hcenter |
| 137 | representative_space_smooth_on := hC.comp |
| 138 | (contMDiffOn_id.prodMk contMDiffOn_const) (fun _ hx ↦ hx) |
| 139 | representative_space_smooth := hcenter.comp (A.gamma Z b) |
| 140 | (contMDiffAt_id.prodMk contMDiffAt_const) |
| 141 | representative_time_derivative := htime |
| 142 | } |
| 143 | refine ⟨B, e, hze, hsub, he, rfl, hC, ?_⟩ |
| 144 | intro z hz |
| 145 | change Q (e.symm (f (z.1, Real.sqrt z.2), z.2)) = Q z |
| 146 | have hez : e z = (f (z.1, Real.sqrt z.2), z.2) := he hz |
| 147 | rw [← hez, e.left_inv hz] |
| 148 | |
| 149 | end PoincareMT.ReducedLength |