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.Action.EndpointMomentum |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.ShiftedCostDifferential |
| 3 | |
| 4 | /-! |
| 5 | # Both first derivatives of the actual broken cost |
| 6 | |
| 7 | All parameter restrictions are genuine neighborhoods of the central |
| 8 | curve. Finite-order eventual differentiability suffices for the chain rule. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | set_option maxHeartbeats 800000 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | open Filter |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 25 | {A : LExponentialFamily F T τmax p} {Z W : TangentSpace (𝓡 n) p} {c b : ℝ} |
| 26 | |
| 27 | local notation "Q" => EuclideanSpace ℝ (Fin n) |
| 28 | |
| 29 | namespace LineInteriorFamily |
| 30 | |
| 31 | noncomputable def meetingCovector (D : LineInteriorFamily A Z W c b) (r : ℝ) : Q →L[ℝ] ℝ := |
| 32 | lineMeetingMomentum A Z W c r + fderiv ℝ D.tailAction (lineInteriorCoordinate A Z W c r) |
| 33 | |
| 34 | theorem cost_first_derivatives [ConnectedSpace M] |
| 35 | (D : LineInteriorFamily A Z W c b) |
| 36 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 37 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 38 | (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) : |
| 39 | ∀ᶠ r in 𝓝 (0 : ℝ), |
| 40 | fderiv ℝ D.cost (r, 0) (1, 0) = D.meetingCovector r (deriv (lineInteriorCoordinate A Z W c) r) ∧ |
| 41 | ∀ v : Q, fderiv ℝ D.cost (r, 0) (0, v) = D.meetingCovector r v := by |
| 42 | let a := lineInteriorCoordinate A Z W c |
| 43 | have ha : ∀ᶠ r in 𝓝 (0 : ℝ), DifferentiableAt ℝ a r := |
| 44 | ((D.coordinate_smooth.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by simp)).mono |
| 45 | (fun _ h ↦ h.differentiableAt (by simp)) |
| 46 | have hfixed : ∀ᶠ r in 𝓝 (0 : ℝ), (0, a r) ∈ D.parameters := |
| 47 | (continuousAt_const.prodMk D.coordinate_smooth.continuousAt).preimage_mem_nhds |
| 48 | (D.parameters_open.mem_nhds D.center_mem) |
| 49 | filter_upwards [D.diagonal_mem, hfixed, ha] with r hr hrf hra |
| 50 | have hprefix := (D.prefixAction_contDiffAt hM04 hτmax hwindow hc hcb hmax (r, a r) hr).differentiableAt |
| 51 | (by simp) |
| 52 | have htail := (D.tailAction_contDiffAt hM04 hτmax hwindow hc hcb hmax (a r) hrf).differentiableAt |
| 53 | (by simp) |
| 54 | have hform (w : ℝ × Q) : fderiv ℝ D.cost (r, 0) w = |
| 55 | D.meetingCovector r (fderiv ℝ a r w.1 + w.2) := |
| 56 | shiftedCost_fderiv D.prefixAction D.tailAction a (lineMeetingMomentum A Z W c r) r |
| 57 | hprefix htail hra (D.prefixAction_fderiv hM04 hL hτmax hwindow hc hcb hmax r hr) w |
| 58 | refine ⟨?_, ?_⟩ |
| 59 | · simpa only [add_zero, fderiv_apply_one_eq_deriv, a] using hform (1, 0) |
| 60 | · intro v |
| 61 | simpa only [map_zero, zero_add] using hform (0, v) |
| 62 | |
| 63 | end LineInteriorFamily |
| 64 | |
| 65 | end PoincareMT.ReducedLength |