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.Generalized.ReducedGeometry.SourceNames.ReducedLength |
| 2 | import PoincareLib.Geometry.RicciFlow.Generalized.ReducedGeometry.Exponential.Endpoint.EndpointCost |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.ShiftedCostDifferential |
| 4 | |
| 5 | /-! |
| 6 | # Both actual derivatives of the broken cost |
| 7 | |
| 8 | Morgan-Tian Proposition 6.30, pp. 118-119. M09's generic chain rule |
| 9 | applies directly to the actual smooth prefix and continuation actions. |
| 10 | The diagonal and fixed-parameter domains are genuine neighborhoods; |
| 11 | the supplied prefix differential is retained pointwise there. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped ContDiff Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.M14.GaugeEndpointFamily |
| 22 | |
| 23 | variable {n : ℕ} {X : Type u} [TopologicalSpace X] {time : X → ℝ} |
| 24 | {I : SpacetimeInterval} {G : GeneralizedLGeometryTransport n X time I} |
| 25 | {f : ℝ × ℝ → G.Point} {U : Set ℝ} {T b c : ℝ} |
| 26 | {j : G.gaugeCover.index} |
| 27 | {lift : G.Point → (G.timeIntervals.interval (G.gaugeCover.interval j)).Point × |
| 28 | G.gaugeCover.spatial j} |
| 29 | (D : GaugeEndpointFamily f U T 0 b c 0 j lift) |
| 30 | |
| 31 | /-- The two derivatives of the actual shifted broken cost are the |
| 32 | same meeting covector applied to the moving diagonal or independent |
| 33 | spatial direction, Proposition 6.30, pp. 118-119. -/ |
| 34 | theorem cost_first_derivatives (hM12 : GeneralizedRicciGaugeTheory.{u} n) |
| 35 | (hc : c ∈ Ioo 0 b) (P : ℝ → EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 36 | (hprefix : ∀ᶠ r in 𝓝 (0 : ℝ), ∀ w : ℝ × EuclideanSpace ℝ (Fin n), |
| 37 | fderiv ℝ D.prefixAction (r, (lift (f (c, r))).2.val) w = P r w.2) : |
| 38 | ∀ᶠ r in 𝓝 (0 : ℝ), |
| 39 | fderiv ℝ D.cost (r, 0) (1, 0) = |
| 40 | (P r + fderiv ℝ D.tailAction (lift (f (c, r))).2.val) |
| 41 | (deriv (fun t => (lift (f (c, t))).2.val) r) ∧ |
| 42 | ∀ v : EuclideanSpace ℝ (Fin n), fderiv ℝ D.cost (r, 0) (0, v) = |
| 43 | (P r + fderiv ℝ D.tailAction (lift (f (c, r))).2.val) v := by |
| 44 | let a := fun r => (lift (f (c, r))).2.val |
| 45 | have ha : ∀ᶠ r in 𝓝 (0 : ℝ), DifferentiableAt ℝ a r := |
| 46 | ((D.coordinate_smooth.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by simp)).mono |
| 47 | (fun _ h => h.differentiableAt (by simp)) |
| 48 | have hfixed : ∀ᶠ r in 𝓝 (0 : ℝ), (0, a r) ∈ D.parameters := |
| 49 | (continuousAt_const.prodMk D.coordinate_smooth.continuousAt).preimage_mem_nhds |
| 50 | (D.parameters_open.mem_nhds D.center_mem) |
| 51 | filter_upwards [D.diagonal_eventually_mem, hfixed, ha, hprefix] with r hr hrf hra hp |
| 52 | have hL := (D.prefixAction_contDiffAt hM12 hc hr).differentiableAt (by simp) |
| 53 | have hS := (D.tailAction_contDiffAt hM12 hc hrf).differentiableAt (by simp) |
| 54 | have hform (w : ℝ × EuclideanSpace ℝ (Fin n)) : |
| 55 | fderiv ℝ D.cost (r, 0) w = |
| 56 | (P r + fderiv ℝ D.tailAction (a r)) (fderiv ℝ a r w.1 + w.2) := |
| 57 | Proofs.M09.shiftedCost_fderiv D.prefixAction D.tailAction a (P r) r hL hS hra hp 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, a] using hform (0, v) |
| 62 | |
| 63 | end PoincareMT.M14.GaugeEndpointFamily |