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.CurveShortening.Connection.Pullback |
| 2 | import Mathlib.Analysis.Calculus.Deriv.Prod |
| 3 | |
| 4 | /-! |
| 5 | # Evolving metric pairings along a parameter curve |
| 6 | |
| 7 | The actual Ricci flow equation contributes `-2 Ric` in addition to the |
| 8 | fixed-time pullback product rule. This is the metric variation used in |
| 9 | Morgan--Tian Lemma 19.6, pp. 441-442, and correction Lemma 0.1, p. 3. |
| 10 | See `references/ricci-flow/mapher/curve-evolution/derivations/2026-09-19-evolving-metric-pairing.md`. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.M62 |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 24 | {a b : ℝ} |
| 25 | |
| 26 | set_option backward.isDefEq.respectTransparency false in |
| 27 | /-- Differentiate the actual evolving metric and both fields along a curve. |
| 28 | Time is interior; correction Lemma 0.1, p. 3, and MT2007 Lemma 19.6, pp. 441-442. -/ |
| 29 | theorem hasDerivAt_flow_metric_pairing (F : RicciFlow n M (Set.Icc a b)) |
| 30 | {γ : ℝ → M} {Y Z : (s : ℝ) → TangentSpace (𝓡 n) (γ s)} |
| 31 | {x : ℝ} (hx : x ∈ Set.Ioo a b) |
| 32 | (hγ : MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ x) |
| 33 | (hY : MDifferentiableAt (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) |
| 34 | (fun s ↦ (⟨γ s, Y s⟩ : TangentBundle (𝓡 n) M)) x) |
| 35 | (hZ : MDifferentiableAt (𝓘(ℝ, ℝ)) ((𝓡 n).prod (𝓡 n)) |
| 36 | (fun s ↦ (⟨γ s, Z s⟩ : TangentBundle (𝓡 n) M)) x) : |
| 37 | HasDerivAt (fun s ↦ (F.metric s).inner (γ s) (Y s) (Z s)) |
| 38 | (-2 * (F.connection x).ricci (γ x) (Y x) (Z x) + |
| 39 | (F.metric x).inner (γ x) |
| 40 | (rampHorizontalCovariantDerivative (F.connection x) γ Y x) (Z x) + |
| 41 | (F.metric x).inner (γ x) (Y x) |
| 42 | (rampHorizontalCovariantDerivative (F.connection x) γ Z x)) x := by |
| 43 | let B : ℝ × ℝ → ℝ := fun z ↦ (F.metric z.1).inner (γ z.2) (Y z.2) (Z z.2) |
| 44 | have hdomain : Set.Icc a b ×ˢ (Set.univ : Set M) ∈ 𝓝 (x, γ x) := |
| 45 | prod_mem_nhds (Icc_mem_nhds hx.1 hx.2) Filter.univ_mem |
| 46 | have hmetric := (F.smooth.contMDiffAt hdomain).mdifferentiableAt (by simp) |
| 47 | have hfst : MDifferentiableAt (𝓘(ℝ, ℝ × ℝ)) (𝓘(ℝ, ℝ)) |
| 48 | (Prod.fst : ℝ × ℝ → ℝ) (x, x) := differentiableAt_fst.mdifferentiableAt |
| 49 | have hsnd : MDifferentiableAt (𝓘(ℝ, ℝ × ℝ)) (𝓘(ℝ, ℝ)) |
| 50 | (Prod.snd : ℝ × ℝ → ℝ) (x, x) := differentiableAt_snd.mdifferentiableAt |
| 51 | have hgraph : MDifferentiableAt (𝓘(ℝ, ℝ × ℝ)) ((𝓘(ℝ, ℝ)).prod (𝓡 n)) |
| 52 | (fun z : ℝ × ℝ ↦ (z.1, γ z.2)) (x, x) := |
| 53 | hfst.prodMk (hγ.comp (x, x) hsnd) |
| 54 | have hpair : MDifferentiableAt (𝓘(ℝ, ℝ × ℝ)) ((𝓡 n).prod (𝓘(ℝ, ℝ))) |
| 55 | (fun z : ℝ × ℝ ↦ Bundle.TotalSpace.mk' ℝ (E := Bundle.Trivial M ℝ) |
| 56 | (γ z.2) (B z)) (x, x) := |
| 57 | (hmetric.comp (x, x) hgraph).clm_bundle_apply₂ |
| 58 | (hY.comp (x, x) hsnd) (hZ.comp (x, x) hsnd) |
| 59 | have hB : DifferentiableAt ℝ B (x, x) := by |
| 60 | rw [mdifferentiableAt_totalSpace] at hpair |
| 61 | exact hpair.2.differentiableAt |
| 62 | have htime := (F.equation x (Set.Ioo_subset_Icc_self hx) (γ x) (Y x) (Z x)).hasDerivAt |
| 63 | (Icc_mem_nhds hx.1 hx.2) |
| 64 | have hspace := hasDerivAt_metric_pairing (F.connection x) hγ hY hZ |
| 65 | have hfirst := hB.hasFDerivAt.comp_hasDerivAt (f := fun s : ℝ ↦ (s, x)) x |
| 66 | ((hasDerivAt_id x).prodMk (hasDerivAt_const x x)) |
| 67 | have hsecond := hB.hasFDerivAt.comp_hasDerivAt (f := fun s : ℝ ↦ (x, s)) x |
| 68 | ((hasDerivAt_const x x).prodMk (hasDerivAt_id x)) |
| 69 | have hdiag := hB.hasFDerivAt.comp_hasDerivAt (f := fun s : ℝ ↦ (s, s)) x |
| 70 | ((hasDerivAt_id x).prodMk (hasDerivAt_id x)) |
| 71 | have hfirst_value : fderiv ℝ B (x, x) (1, 0) = |
| 72 | -2 * (F.connection x).ricci (γ x) (Y x) (Z x) := hfirst.unique htime |
| 73 | have hsecond_value : fderiv ℝ B (x, x) (0, 1) = |
| 74 | (F.metric x).inner (γ x) |
| 75 | (rampHorizontalCovariantDerivative (F.connection x) γ Y x) (Z x) + |
| 76 | (F.metric x).inner (γ x) (Y x) |
| 77 | (rampHorizontalCovariantDerivative (F.connection x) γ Z x) := hsecond.unique hspace |
| 78 | apply hdiag.congr_deriv |
| 79 | have hv : ((1 : ℝ), (1 : ℝ)) = (1, 0) + (0, 1) := by simp |
| 80 | rw [hv, map_add, hfirst_value, hsecond_value] |
| 81 | ring |
| 82 | |
| 83 | end PoincareMT.M62 |