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.LGeometry.Variation.VariationCoordinates |
| 2 | |
| 3 | /-! Adapted from Mapher `PoincareMT/Proofs/M08/VariationMetricPair.lean` at |
| 4 | `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. -/ |
| 5 | |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | noncomputable section |
| 11 | |
| 12 | open Set Filter Topology |
| 13 | open scoped Manifold ContDiff Bundle |
| 14 | |
| 15 | universe u |
| 16 | |
| 17 | namespace PoincareMT.LGeometry |
| 18 | |
| 19 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | |
| 22 | local instance variationMetricPairDualGroup : NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 23 | ContinuousLinearMap.toNormedAddCommGroup |
| 24 | local instance variationMetricPairDualSpace : NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 25 | ContinuousLinearMap.toNormedSpace |
| 26 | local instance variationMetricPairBilinGroup : |
| 27 | NormedAddCommGroup (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 28 | ContinuousLinearMap.toNormedAddCommGroup |
| 29 | local instance variationMetricPairBilinSpace : |
| 30 | NormedSpace ℝ (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) := |
| 31 | ContinuousLinearMap.toNormedSpace |
| 32 | |
| 33 | theorem chartFrame_curveVelocity {α : ℝ → M} {x : M} {s : ℝ} |
| 34 | (hx : α s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 35 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s) : |
| 36 | chartFrame x (deriv ((extChartAt (𝓡 n) x) ∘ α) s) (α s) = |
| 37 | curveVelocity (n := n) α s := by |
| 38 | unfold chartFrame |
| 39 | rw [chart_deriv_eq_velocity hx hα] |
| 40 | exact Bundle.Trivialization.symmL_continuousLinearMapAt |
| 41 | (trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x) hx _ |
| 42 | |
| 43 | set_option maxHeartbeats 1000000 in |
| 44 | theorem parametricExtension_metric_pair_moving_graph {J I : Set ℝ} |
| 45 | (F : RicciFlow n M J) (T : ℝ) (hI : IsOpen I) {α : ℝ → M} |
| 46 | (E : ParametricAlongCurveExtensionOn I α (curveVelocityWithin (n := n) α I)) |
| 47 | {x : M} {s : ℝ} (hs : s ∈ I) |
| 48 | (hx : α s ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 49 | (hα : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) α s) |
| 50 | (ht : T - s ^ 2 ∈ interior J) |
| 51 | {w : ℝ → EuclideanSpace ℝ (Fin n)} {k : EuclideanSpace ℝ (Fin n)} |
| 52 | (hw : HasDerivAt w k s) : |
| 53 | HasDerivAt (fun r ↦ (F.metric (T - r ^ 2)).inner (α r) |
| 54 | (E.extension r (α r)) (chartFrame x (w r) (α r))) |
| 55 | ((F.metric (T - s ^ 2)).inner (α s) |
| 56 | (pullbackCovariantDerivative F (fun r ↦ T - r ^ 2) α |
| 57 | (curveVelocityWithin (n := n) α I) I E s) (chartFrame x (w s) (α s)) + |
| 58 | 4 * s * (F.connection (T - s ^ 2)).ricci (α s) |
| 59 | (curveVelocityWithin (n := n) α I s) (chartFrame x (w s) (α s)) + |
| 60 | spatialFDeriv (chartActionMetric F T x) (s, extChartAt (𝓡 n) x (α s)) |
| 61 | (w s) (deriv ((extChartAt (𝓡 n) x) ∘ α) s) |
| 62 | (deriv ((extChartAt (𝓡 n) x) ∘ α) s) / 2 + |
| 63 | chartActionMetric F T x (s, extChartAt (𝓡 n) x (α s)) |
| 64 | (deriv ((extChartAt (𝓡 n) x) ∘ α) s) k) s := by |
| 65 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n)) x |
| 66 | let c := fun r ↦ e.continuousLinearMapAt ℝ (α r) (E.extension r (α r)) |
| 67 | let G := fun r ↦ chartActionMetric F T x (r, extChartAt (𝓡 n) x (α r)) |
| 68 | let P := fun r ↦ G r (c r) |
| 69 | have hud : DifferentiableAt ℝ ((extChartAt (𝓡 n) x) ∘ α) s := |
| 70 | ((((contMDiffAt_extChartAt' (I := 𝓡 n) (n := ∞) hx).mdifferentiableAt |
| 71 | (by simp)).comp s hα)).differentiableAt |
| 72 | have hdom : (s, extChartAt (𝓡 n) x (α s)) ∈ chartActionDomain F T x := by |
| 73 | refine ⟨ht, (extChartAt (𝓡 n) x).map_source ?_⟩ |
| 74 | simpa only [extChartAt_source] using hx |
| 75 | have hGbase := (((chartActionMetric_contDiffOn F T x) _ hdom).contDiffAt |
| 76 | ((chartActionDomain_open F T x).mem_nhds hdom)).differentiableAt (by simp) |
| 77 | have hG : DifferentiableAt ℝ G s := |
| 78 | hGbase.comp (f := fun r : ℝ ↦ (r, extChartAt (𝓡 n) x (α r))) s |
| 79 | (differentiableAt_id.prodMk hud) |
| 80 | have hc : DifferentiableAt ℝ c s := by |
| 81 | have hcoord := (parametricExtension_chart_contMDiffAt E hx |
| 82 | (E.graph_mem s hs)).mdifferentiableAt (by simp) |
| 83 | exact (hcoord.comp (f := fun r : ℝ ↦ (r, α r)) s |
| 84 | (mdifferentiableAt_id.prodMk hα)).differentiableAt |
| 85 | have hP : DifferentiableAt ℝ P s := hG.clm_apply hc |
| 86 | have hnear : ∀ᶠ r in 𝓝 s, α r ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source := |
| 87 | hα.continuousAt.preimage_mem_nhds |
| 88 | ((chartAt (EuclideanSpace ℝ (Fin n)) x).open_source.mem_nhds hx) |
| 89 | have hpair (r : ℝ) (hr : α r ∈ (chartAt (EuclideanSpace ℝ (Fin n)) x).source) |
| 90 | (z : EuclideanSpace ℝ (Fin n)) : P r z = |
| 91 | (F.metric (T - r ^ 2)).inner (α r) (E.extension r (α r)) (chartFrame x z (α r)) := by |
| 92 | dsimp only [P, G] |
| 93 | rw [chartActionMetric_apply F T hr] |
| 94 | exact congrArg (fun v : TangentSpace (𝓡 n) (α r) ↦ |
| 95 | (F.metric (T - r ^ 2)).inner (α r) v (chartFrame x z (α r))) |
| 96 | (e.symmL_continuousLinearMapAt hr _) |
| 97 | have hfixed := parametricExtension_metric_pair_graph F T hI E hs hx hα ht (w s) |
| 98 | have hfixedP := hfixed.congr_of_eventuallyEq |
| 99 | (show (fun r ↦ P r (w s)) =ᶠ[𝓝 s] _ from hnear.mono (fun r hr ↦ hpair r hr (w s))) |
| 100 | have h := linear_moving_vector_hasDerivAt hP hw hfixedP |
| 101 | have hcs : c s = deriv ((extChartAt (𝓡 n) x) ∘ α) s := by |
| 102 | dsimp only [c] |
| 103 | rw [E.agrees s hs] |
| 104 | simp only [curveVelocityWithin, mfderivWithin_of_mem_nhds (hI.mem_nhds hs)] |
| 105 | exact (chart_deriv_eq_velocity hx hα).symm |
| 106 | have hPk : P s k = chartActionMetric F T x (s, extChartAt (𝓡 n) x (α s)) |
| 107 | (deriv ((extChartAt (𝓡 n) x) ∘ α) s) k := by |
| 108 | dsimp only [P, G] |
| 109 | rw [hcs] |
| 110 | rw [hPk] at h |
| 111 | exact h.congr_of_eventuallyEq |
| 112 | (hnear.mono (fun r hr ↦ (hpair r hr (w r)).symm)) |
| 113 | |
| 114 | end PoincareMT.LGeometry |