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.Calculus.SmoothSquarePath |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.ChartCurveExtension |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Coordinates.SquareChartMetric |
| 4 | |
| 5 | /-! |
| 6 | # Coordinate control of comparison-path action densities |
| 7 | |
| 8 | Compact position and velocity sets bound the actual square-time action |
| 9 | density. Curve germs determine the density, including its actual velocity. |
| 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 | |
| 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 | |
| 25 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 26 | |
| 27 | noncomputable def squareCurveActionDensity {J : Set ℝ} (F : RicciFlow n M J) |
| 28 | (T : ℝ) (α : ℝ → M) (s : ℝ) : ℝ := |
| 29 | 2 * s ^ 2 * (F.connection (T - s ^ 2)).scalarCurvature (α s) + |
| 30 | (1 / 2 : ℝ) * regularizedCurveEnergy F T α s |
| 31 | |
| 32 | noncomputable def squareChartActionDensity {J : Set ℝ} (F : RicciFlow n M J) |
| 33 | (T : ℝ) (p : M) (z : (ℝ × E) × E) : ℝ := |
| 34 | 2 * z.1.1 ^ 2 * squareChartScalar F T p z.1 + |
| 35 | (1 / 2 : ℝ) * squareChartMetric F T p z.1 z.2 z.2 |
| 36 | |
| 37 | theorem squareCurveActionDensity_contDiffOn {J : Set ℝ} |
| 38 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 39 | (T τmax : ℝ) (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 40 | (α : ℝ → M) (D : Set ℝ) (hD : IsOpen D) |
| 41 | (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α D) |
| 42 | (htime : D ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) : |
| 43 | ContDiffOn ℝ ∞ (squareCurveActionDensity F T α) D := by |
| 44 | obtain ⟨hR, hE⟩ := smoothSquareCurve_scalar_energy F hM04 T τmax hτmax hwindow |
| 45 | α D hD hα htime |
| 46 | exact ((contDiffOn_const.mul (contDiffOn_id.pow 2)).mul hR).add (contDiffOn_const.mul hE) |
| 47 | |
| 48 | set_option backward.isDefEq.respectTransparency false in |
| 49 | theorem squareCurveActionDensity_congr {J : Set ℝ} (F : RicciFlow n M J) |
| 50 | (T : ℝ) (α β : ℝ → M) (s : ℝ) (heq : α =ᶠ[𝓝 s] β) : |
| 51 | squareCurveActionDensity F T α s = squareCurveActionDensity F T β s := by |
| 52 | have hb := heq.self_of_nhds |
| 53 | have hv : (curveVelocity (n := n) α s : E) = curveVelocity (n := n) β s := |
| 54 | congrArg (fun L : ℝ →L[ℝ] E ↦ L 1) |
| 55 | (heq.mfderiv_eq (I := 𝓘(ℝ, ℝ)) (I' := 𝓡 n)) |
| 56 | let Q : M → E → ℝ := fun q v ↦ |
| 57 | 2 * s ^ 2 * (F.connection (T - s ^ 2)).scalarCurvature q + |
| 58 | (1 / 2 : ℝ) * (F.metric (T - s ^ 2)).inner q v v |
| 59 | change Q (α s) (curveVelocity (n := n) α s) = Q (β s) (curveVelocity (n := n) β s) |
| 60 | exact congrArg₂ Q hb hv |
| 61 | |
| 62 | set_option backward.isDefEq.respectTransparency false in |
| 63 | theorem squareCurveActionDensity_inverseChart {J : Set ℝ} (F : RicciFlow n M J) |
| 64 | (T : ℝ) (p : M) (a : ℝ → E) (s : ℝ) (v : E) |
| 65 | (ha : HasDerivAt a v s) (hy : a s ∈ (chartAt E p).target) : |
| 66 | squareCurveActionDensity F T (fun t ↦ (chartAt E p).symm (a t)) s = |
| 67 | squareChartActionDensity F T p ((s, a s), v) := by |
| 68 | have hv := curveVelocityWithin_inverseChart p a Set.univ s v |
| 69 | uniqueDiffWithinAt_univ ha hy |
| 70 | simp only [curveVelocityWithin, mfderivWithin_univ] at hv |
| 71 | change 2 * s ^ 2 * (F.connection (T - s ^ 2)).scalarCurvature ((chartAt E p).symm (a s)) + |
| 72 | (1 / 2 : ℝ) * (F.metric (T - s ^ 2)).inner ((chartAt E p).symm (a s)) |
| 73 | (curveVelocity (fun t ↦ (chartAt E p).symm (a t)) s) |
| 74 | (curveVelocity (fun t ↦ (chartAt E p).symm (a t)) s) = _ |
| 75 | change curveVelocity (fun t ↦ (chartAt E p).symm (a t)) s = _ at hv |
| 76 | rw [hv] |
| 77 | rfl |
| 78 | |
| 79 | theorem squareChartActionDensity_contDiffOn {J : Set ℝ} (F : RicciFlow n M J) |
| 80 | (hM04 : RicciFlowCurvatureTheory.{u}) (T τmax : ℝ) (hτmax : 0 < τmax) |
| 81 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (p : M) : |
| 82 | ContDiffOn ℝ ∞ (squareChartActionDensity F T p) |
| 83 | ((Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ×ˢ (chartAt E p).target) ×ˢ Set.univ) := by |
| 84 | let S := (Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ×ˢ (chartAt E p).target) ×ˢ |
| 85 | (Set.univ : Set E) |
| 86 | have hG := (squareChartMetric_smooth F T τmax hτmax hwindow p).comp |
| 87 | contDiffOn_fst (fun z (hz : z ∈ S) ↦ hz.1) |
| 88 | have hR := (squareChartScalar_smooth F hM04 T τmax hτmax hwindow p).comp |
| 89 | contDiffOn_fst (fun z (hz : z ∈ S) ↦ hz.1) |
| 90 | have ht : ContDiffOn ℝ ∞ (fun z : (ℝ × E) × E ↦ z.1.1) |
| 91 | ((Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ×ˢ (chartAt E p).target) ×ˢ Set.univ) := |
| 92 | (contDiff_fst.comp contDiff_fst).contDiffOn |
| 93 | exact ((contDiffOn_const.mul (ht.pow 2)).mul hR).add |
| 94 | (contDiffOn_const.mul ((hG.clm_apply contDiffOn_snd).clm_apply contDiffOn_snd)) |
| 95 | |
| 96 | theorem squareChartActionDensity_bounded {J : Set ℝ} (F : RicciFlow n M J) |
| 97 | (hM04 : RicciFlowCurvatureTheory.{u}) (T τmax : ℝ) (hτmax : 0 < τmax) |
| 98 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (p : M) |
| 99 | (I : Set ℝ) (K : Set E) (hI : IsCompact I) (hK : IsCompact K) |
| 100 | (hIt : I ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 101 | (hKt : K ⊆ (chartAt E p).target) (R : ℝ) : |
| 102 | ∃ C : ℝ, 0 ≤ C ∧ ∀ s ∈ I, ∀ y ∈ K, ∀ v : E, ‖v‖ ≤ R → |
| 103 | |squareChartActionDensity F T p ((s, y), v)| ≤ C := by |
| 104 | have hcompact := (hI.prod hK).prod (isCompact_closedBall (0 : E) R) |
| 105 | have hsub : (I ×ˢ K) ×ˢ Metric.closedBall (0 : E) R ⊆ |
| 106 | (Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax) ×ˢ (chartAt E p).target) ×ˢ Set.univ := |
| 107 | fun z hz ↦ ⟨⟨hIt hz.1.1, hKt hz.1.2⟩, Set.mem_univ _⟩ |
| 108 | obtain ⟨C, hC⟩ := hcompact.exists_bound_of_continuousOn |
| 109 | ((squareChartActionDensity_contDiffOn F hM04 T τmax hτmax hwindow p).continuousOn.mono hsub) |
| 110 | refine ⟨max C 0, le_max_right _ _, ?_⟩ |
| 111 | intro s hs y hy v hv |
| 112 | have hm : ((s, y), v) ∈ (I ×ˢ K) ×ˢ Metric.closedBall (0 : E) R := |
| 113 | ⟨⟨hs, hy⟩, by simpa only [Metric.mem_closedBall, dist_zero_right] using hv⟩ |
| 114 | exact (hC _ hm).trans (le_max_left _ _) |
| 115 | |
| 116 | end PoincareMT.ReducedLength |