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.SmoothSquareActionDifferential |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.SmoothBrokenCost |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.ExponentialPhaseLinearization |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Calculus.VelocityChainRules |
| 5 | |
| 6 | /-! |
| 7 | # The actual endpoint momentum of the prefix action |
| 8 | |
| 9 | The inverse-chart differential preserves the metric pairing and the |
| 10 | endpoint family makes the prefix derivative depend only on its marked point. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 1000000 |
| 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] [IsManifold (𝓡 n) ∞ M] |
| 26 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 27 | |
| 28 | local notation "Q" => EuclideanSpace ℝ (Fin n) |
| 29 | |
| 30 | set_option backward.isDefEq.respectTransparency false in |
| 31 | theorem squareChartMetric_tangent_pairing (F : RicciFlow n M J) (T s : ℝ) |
| 32 | (q x : M) (hx : x ∈ (chartAt Q q).source) |
| 33 | (v : TangentSpace (𝓡 n) x) (w : Q) : |
| 34 | squareChartMetric F T q (s, (chartAt Q q) x) |
| 35 | (mfderiv (𝓡 n) (𝓡 n) (chartAt Q q) x v) w = |
| 36 | (F.metric (T - s ^ 2)).inner x v |
| 37 | (mfderiv (𝓡 n) (𝓡 n) (chartAt Q q).symm ((chartAt Q q) x) w) := by |
| 38 | have hinv : (mfderiv (𝓡 n) (𝓡 n) (chartAt Q q).symm ((chartAt Q q) x)) |
| 39 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt Q q) x) v) = v := by |
| 40 | exact congrArg (fun L : TangentSpace (𝓡 n) x →L[ℝ] TangentSpace (𝓡 n) x ↦ L v) |
| 41 | ((mdifferentiable_chart (I := 𝓡 n) q).symm_comp_deriv hx) |
| 42 | change (F.metric (T - s ^ 2)).inner ((chartAt Q q).symm ((chartAt Q q) x)) |
| 43 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt Q q).symm ((chartAt Q q) x)) |
| 44 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt Q q) x) v)) |
| 45 | ((mfderiv (𝓡 n) (𝓡 n) (chartAt Q q).symm ((chartAt Q q) x)) w) = _ |
| 46 | rw [hinv, (chartAt Q q).left_inv hx] |
| 47 | |
| 48 | noncomputable def lineMeetingMomentum (A : LExponentialFamily F T τmax p) |
| 49 | (Z W : TangentSpace (𝓡 n) p) (c r : ℝ) : Q →L[ℝ] ℝ := |
| 50 | squareChartMetric F T (A.squareFamily Z (Real.sqrt c)) |
| 51 | (Real.sqrt c, lineInteriorCoordinate A Z W c r) |
| 52 | (initialLineChartPhase A Z W (A.squareFamily Z (Real.sqrt c)) (Real.sqrt c, r)).2 |
| 53 | |
| 54 | set_option backward.isDefEq.respectTransparency false in |
| 55 | theorem LineInteriorFamily.prefixAction_fderiv [ConnectedSpace M] |
| 56 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 57 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 58 | {A : LExponentialFamily F T τmax p} {Z W : TangentSpace (𝓡 n) p} {c b : ℝ} |
| 59 | (D : LineInteriorFamily A Z W c b) (hc : 0 < c) (hcb : c < b) (hmax : b < τmax) |
| 60 | (r : ℝ) (hr : (r, lineInteriorCoordinate A Z W c r) ∈ D.parameters) (w : ℝ × Q) : |
| 61 | fderiv ℝ D.prefixAction (r, lineInteriorCoordinate A Z W c r) w = |
| 62 | lineMeetingMomentum A Z W c r w.2 := by |
| 63 | let q := A.squareFamily Z (Real.sqrt c) |
| 64 | let e := chartAt Q q |
| 65 | let a := lineInteriorCoordinate A Z W c |
| 66 | have hsegment (s : ℝ) (hs : s ∈ Set.Icc 0 (Real.sqrt c)) : ((r, a r), s) ∈ D.domain := |
| 67 | D.segment_mem ⟨hr, hs.1, hs.2.trans (Real.sqrt_le_sqrt hcb.le)⟩ |
| 68 | have hcenter (s : ℝ) (hs : s ∈ Set.Icc 0 (Real.sqrt c)) : |
| 69 | D.family ((r, a r), s) = A.squareFamily (Z + r • W) s := |
| 70 | D.recovery (r, a r) hr s ⟨hs.1, hs.2.trans (Real.sqrt_le_sqrt hcb.le)⟩ |
| 71 | have hfirst := fderiv_smoothSquareFamily_action hM04 hL hτmax hwindow |
| 72 | A (Z + r • W) c hc (hcb.trans hmax) D.family D.domain D.domain_open D.smooth |
| 73 | (r, a r) w hsegment hcenter |
| 74 | have hleft : (fun u : ℝ ↦ D.family ((r, a r) + u • w, 0)) = fun _ : ℝ ↦ p := by |
| 75 | funext u |
| 76 | exact D.left _ _ |
| 77 | have hv0 : (curveVelocity (n := n) (fun u : ℝ ↦ D.family ((r, a r) + u • w, 0)) 0 : Q) = 0 := by |
| 78 | rw [hleft] |
| 79 | simp only [curveVelocity, mfderiv_const, ContinuousLinearMap.zero_apply] |
| 80 | have hmark : (fun u : ℝ ↦ D.family ((r, a r) + u • w, Real.sqrt c)) = |
| 81 | fun u : ℝ ↦ e.symm (a r + u • w.2) := by |
| 82 | funext u |
| 83 | exact D.marked _ _ |
| 84 | have htarget : a r ∈ e.target := D.target_mem (r, a r) hr |
| 85 | have hchart : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 86 | have he : MDifferentiableAt (𝓡 n) (𝓡 n) e.symm (a r) := |
| 87 | (hchart.contMDiffAt (e.open_target.mem_nhds htarget)).mdifferentiableAt (by simp) |
| 88 | have hvm : (curveVelocity (n := n) |
| 89 | (fun u : ℝ ↦ D.family ((r, a r) + u • w, Real.sqrt c)) 0 : Q) = |
| 90 | mfderiv (𝓡 n) (𝓡 n) e.symm (a r) w.2 := by |
| 91 | rw [hmark] |
| 92 | exact curveVelocity_comp_initial_line e.symm (a r) w.2 he |
| 93 | have hbase : e.symm (a r) = A.squareFamily (Z + r • W) (Real.sqrt c) := |
| 94 | (D.marked r (a r)).symm.trans (hcenter (Real.sqrt c) ⟨Real.sqrt_nonneg c, le_rfl⟩) |
| 95 | have hsource : A.squareFamily (Z + r • W) (Real.sqrt c) ∈ e.source := |
| 96 | hbase ▸ e.map_target htarget |
| 97 | have hpair := squareChartMetric_tangent_pairing F T (Real.sqrt c) q |
| 98 | (A.squareFamily (Z + r • W) (Real.sqrt c)) hsource |
| 99 | (curveVelocity (A.squareFamily (Z + r • W)) (Real.sqrt c)) w.2 |
| 100 | rw [Real.sq_sqrt hc.le] at hpair |
| 101 | rw [hv0, hvm, map_zero, sub_zero] at hfirst |
| 102 | exact hfirst.trans hpair.symm |
| 103 | |
| 104 | end PoincareMT.ReducedLength |