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.LineInteriorFamily |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.SmoothSquareAction |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.SquareActionComparison |
| 4 | |
| 5 | /-! |
| 6 | # A smooth broken cost at a minimizing square-time path |
| 7 | |
| 8 | Both comparison slices lie in the genuine smooth domain. Their exact |
| 9 | meeting identity gives the lower bound and diagonal recovery gives contact. |
| 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 |
| 17 | open Filter |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedLength |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 26 | {A : LExponentialFamily F T τmax p} {Z W : TangentSpace (𝓡 n) p} {c b : ℝ} |
| 27 | |
| 28 | local notation "Q" => EuclideanSpace ℝ (Fin n) |
| 29 | |
| 30 | namespace LineInteriorFamily |
| 31 | |
| 32 | noncomputable def prefixAction (D : LineInteriorFamily A Z W c b) (z : ℝ × Q) : ℝ := |
| 33 | backwardLLength F T 0 c (fun t ↦ D.family (z, Real.sqrt t)) |
| 34 | |
| 35 | noncomputable def tailAction (D : LineInteriorFamily A Z W c b) (y : Q) : ℝ := |
| 36 | backwardLLength F T 0 b (fun t ↦ D.family ((0, y), Real.sqrt t)) - D.prefixAction (0, y) |
| 37 | |
| 38 | noncomputable def cost (D : LineInteriorFamily A Z W c b) (z : ℝ × Q) : ℝ := |
| 39 | D.prefixAction (z.1, lineInteriorCoordinate A Z W c z.1 + z.2) + |
| 40 | D.tailAction (lineInteriorCoordinate A Z W c z.1 + z.2) |
| 41 | |
| 42 | theorem action_contDiffAt (D : LineInteriorFamily A Z W c b) |
| 43 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 44 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hmax : b < τmax) |
| 45 | (d : ℝ) (hd : 0 < d) (hdb : d ≤ b) (z : ℝ × Q) (hz : z ∈ D.parameters) : |
| 46 | ContDiffAt ℝ ∞ (fun w ↦ backwardLLength F T 0 d |
| 47 | (fun t ↦ D.family (w, Real.sqrt t))) z := by |
| 48 | have h := contDiffAt_smoothSquareFamily_action F hM04 T τmax hτmax hwindow |
| 49 | D.family D.domain D.domain_open D.smooth (z, d) ⟨hd, hdb.trans_lt hmax⟩ (fun r hr ↦ |
| 50 | D.segment_mem ⟨hz, mul_nonneg (Real.sqrt_nonneg d) hr.1, |
| 51 | (mul_le_of_le_one_right (Real.sqrt_nonneg d) hr.2).trans (Real.sqrt_le_sqrt hdb)⟩) |
| 52 | exact h.comp z (contDiffAt_id.prodMk contDiffAt_const) |
| 53 | |
| 54 | theorem prefixAction_contDiffAt (D : LineInteriorFamily A Z W c b) |
| 55 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 56 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) |
| 57 | (z : ℝ × Q) (hz : z ∈ D.parameters) : ContDiffAt ℝ ∞ D.prefixAction z := |
| 58 | D.action_contDiffAt hM04 hτmax hwindow hmax c hc hcb.le z hz |
| 59 | |
| 60 | theorem tailAction_contDiffAt (D : LineInteriorFamily A Z W c b) |
| 61 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 62 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) |
| 63 | (y : Q) (hy : (0, y) ∈ D.parameters) : ContDiffAt ℝ ∞ D.tailAction y := by |
| 64 | exact ((D.action_contDiffAt hM04 hτmax hwindow hmax b (hc.trans hcb) le_rfl (0, y) hy).comp y |
| 65 | (contDiffAt_const.prodMk contDiffAt_id)).sub |
| 66 | ((D.prefixAction_contDiffAt hM04 hτmax hwindow hc hcb hmax (0, y) hy).comp y |
| 67 | (contDiffAt_const.prodMk contDiffAt_id)) |
| 68 | |
| 69 | theorem cost_contDiffAt (D : LineInteriorFamily A Z W c b) |
| 70 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 71 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) : |
| 72 | ContDiffAt ℝ ∞ D.cost (0, 0) := by |
| 73 | let a := lineInteriorCoordinate A Z W c |
| 74 | have ha : ContDiffAt ℝ ∞ (fun z : ℝ × Q ↦ a z.1 + z.2) (0, 0) := |
| 75 | (D.coordinate_smooth.comp (0, 0) contDiffAt_fst).add contDiffAt_snd |
| 76 | have hL : ContDiffAt ℝ ∞ D.prefixAction (0, a 0 + 0) := by |
| 77 | simpa only [add_zero] using |
| 78 | D.prefixAction_contDiffAt hM04 hτmax hwindow hc hcb hmax (0, a 0) D.center_mem |
| 79 | have hS : ContDiffAt ℝ ∞ D.tailAction (a 0 + 0) := by |
| 80 | simpa only [add_zero] using |
| 81 | D.tailAction_contDiffAt hM04 hτmax hwindow hc hcb hmax (a 0) D.center_mem |
| 82 | exact (hL.comp (0, 0) (contDiffAt_fst.prodMk ha)).add (hS.comp (0, 0) ha) |
| 83 | |
| 84 | theorem prefixAction_diagonal (D : LineInteriorFamily A Z W c b) |
| 85 | (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) : |
| 86 | ∀ᶠ r in 𝓝 (0 : ℝ), |
| 87 | D.prefixAction (r, lineInteriorCoordinate A Z W c r) = A.action (Z + r • W) c := by |
| 88 | filter_upwards [D.diagonal_mem] with r hr |
| 89 | exact lExponentialFamily_action_comp_sqrt_eq_of_eqOn A (Z + r • W) c hc (hcb.trans hmax) |
| 90 | (fun s ↦ D.family ((r, lineInteriorCoordinate A Z W c r), s)) |
| 91 | (fun s hs ↦ D.recovery (r, lineInteriorCoordinate A Z W c r) hr s |
| 92 | ⟨hs.1, hs.2.trans (Real.sqrt_le_sqrt hcb.le)⟩) |
| 93 | |
| 94 | theorem cost_at_zero (D : LineInteriorFamily A Z W c b) |
| 95 | (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) : D.cost (0, 0) = A.action Z b := by |
| 96 | have hrec : Set.EqOn (fun s ↦ D.family ((0, lineInteriorCoordinate A Z W c 0), s)) |
| 97 | (A.squareFamily Z) (Set.Icc 0 (Real.sqrt b)) := by |
| 98 | intro s hs |
| 99 | simpa only [zero_smul, add_zero] using D.recovery _ D.center_mem s hs |
| 100 | have hb := lExponentialFamily_action_comp_sqrt_eq_of_eqOn A Z b (hc.trans hcb) hmax _ hrec |
| 101 | simpa only [cost, tailAction, add_zero, ← add_sub_assoc, add_sub_cancel_left] using hb |
| 102 | |
| 103 | theorem cost_isLocalMin (D : LineInteriorFamily A Z W c b) |
| 104 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 105 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) |
| 106 | (hmin : IsMinimizingBackwardLPath F T 0 b (A.path Z b (hc.trans hcb) hmax)) : |
| 107 | IsLocalMin D.cost (0, 0) := by |
| 108 | let a := lineInteriorCoordinate A Z W c |
| 109 | let k : ℝ × Q → ℝ × Q := fun z ↦ (z.1, a z.1 + z.2) |
| 110 | let l : ℝ × Q → ℝ × Q := fun z ↦ (0, a z.1 + z.2) |
| 111 | have ha : ContinuousAt (fun z : ℝ × Q ↦ a z.1 + z.2) (0, 0) := |
| 112 | ((D.coordinate_smooth.comp (0, 0) contDiffAt_fst).continuousAt).add continuousAt_snd |
| 113 | have hk : ContinuousAt k (0, 0) := continuousAt_fst.prodMk ha |
| 114 | have hl : ContinuousAt l (0, 0) := continuousAt_const.prodMk ha |
| 115 | have hkN : ∀ᶠ z in 𝓝 ((0, 0) : ℝ × Q), k z ∈ D.parameters := by |
| 116 | apply hk.preimage_mem_nhds |
| 117 | simpa only [k, add_zero] using D.parameters_open.mem_nhds D.center_mem |
| 118 | have hlN : ∀ᶠ z in 𝓝 ((0, 0) : ℝ × Q), l z ∈ D.parameters := by |
| 119 | apply hl.preimage_mem_nhds |
| 120 | simpa only [l, add_zero] using D.parameters_open.mem_nhds D.center_mem |
| 121 | change ∀ᶠ z in 𝓝 ((0, 0) : ℝ × Q), D.cost (0, 0) ≤ D.cost z |
| 122 | rw [D.cost_at_zero hc hcb hmax] |
| 123 | filter_upwards [hkN, hlN] with z hz hz' |
| 124 | let α : ℝ → M := fun s ↦ D.family (k z, s) |
| 125 | let β : ℝ → M := fun s ↦ D.family (l z, s) |
| 126 | let U : Set ℝ := (fun s ↦ (k z, s)) ⁻¹' D.domain ∩ |
| 127 | (fun s ↦ (l z, s)) ⁻¹' D.domain |
| 128 | have hU : IsOpen U := |
| 129 | (D.domain_open.preimage (continuous_const.prodMk continuous_id)).inter |
| 130 | (D.domain_open.preimage (continuous_const.prodMk continuous_id)) |
| 131 | have hI : Set.Icc 0 (Real.sqrt b) ⊆ U := fun s hs ↦ |
| 132 | ⟨D.segment_mem ⟨hz, hs⟩, D.segment_mem ⟨hz', hs⟩⟩ |
| 133 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α U := |
| 134 | D.smooth.comp (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffOn (fun _ hs ↦ hs.1) |
| 135 | have hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ β U := |
| 136 | D.smooth.comp (contDiff_const.prodMk contDiff_id).contMDiff.contMDiffOn (fun _ hs ↦ hs.2) |
| 137 | have hmeet : α (Real.sqrt c) = β (Real.sqrt c) := |
| 138 | (D.marked z.1 (a z.1 + z.2)).trans (D.marked 0 (a z.1 + z.2)).symm |
| 139 | have hleft : α 0 = (A.path Z b (hc.trans hcb) hmax).curve 0 := by |
| 140 | rw [A.path_eq] |
| 141 | exact (D.left z.1 (a z.1 + z.2)).trans (A.gamma_at_zero Z).symm |
| 142 | have hright : β (Real.sqrt b) = (A.path Z b (hc.trans hcb) hmax).curve b := by |
| 143 | rw [A.path_eq] |
| 144 | have h := D.right 0 (a z.1 + z.2) |
| 145 | simp only [zero_smul, add_zero] at h |
| 146 | apply h.trans |
| 147 | simpa only [Real.sq_sqrt (hc.trans hcb).le] using A.square_agrees Z (Real.sqrt b) |
| 148 | ⟨Real.sqrt_nonneg b, Real.sqrt_lt_sqrt (hc.trans hcb).le hmax⟩ |
| 149 | have hcomp := minimizing_action_le_broken_action F hM04 T τmax hτmax hwindow |
| 150 | c b hc hcb hmax (A.path Z b (hc.trans hcb) hmax) hmin α β U hU hI hα hβ hmeet hleft hright |
| 151 | rw [A.path_eq] at hcomp |
| 152 | change A.action Z b ≤ _ at hcomp |
| 153 | simpa only [cost, prefixAction, tailAction, α, β, k, l, a, add_sub_assoc] using hcomp |
| 154 | |
| 155 | end LineInteriorFamily |
| 156 | |
| 157 | end PoincareMT.ReducedLength |