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.Basic |
| 2 | import PoincareLib.Geometry.Riemannian.Metric.Gradient |
| 3 | import Mathlib.Geometry.Manifold.ContMDiffMFDeriv |
| 4 | |
| 5 | /-! # Joint smoothness of gradients for evolving metrics -/ |
| 6 | |
| 7 | set_option autoImplicit false |
| 8 | set_option backward.isDefEq.respectTransparency false |
| 9 | |
| 10 | open Bundle Filter Set |
| 11 | open scoped Manifold ContDiff Bundle Topology |
| 12 | |
| 13 | namespace PoincareMT.RicciFlow |
| 14 | |
| 15 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 16 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 17 | {J : Set ℝ} (F : RicciFlow n M J) |
| 18 | |
| 19 | private theorem contMDiffAt_of_metricDual |
| 20 | {Z : ℝ → (x : M) → TangentSpace (𝓡 n) x} {t : ℝ} {x : M} |
| 21 | (ht : t ∈ interior J) |
| 22 | (hZ : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 23 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ)) ∞ |
| 24 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n) →L[ℝ] ℝ) |
| 25 | (E := fun y : M => TangentSpace (𝓡 n) y →L[ℝ] ℝ) |
| 26 | p.2 ((F.metric p.1).inner p.2 (Z p.1 p.2))) (t, x)) : |
| 27 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 28 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 29 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) p.2 (Z p.1 p.2)) |
| 30 | (t, x) := by |
| 31 | let E := EuclideanSpace ℝ (Fin n) |
| 32 | let V := TangentSpace (𝓡 n) (M := M) |
| 33 | let e := trivializationAt E V x |
| 34 | let e' := trivializationAt (E →L[ℝ] ℝ) (fun y => V y →L[ℝ] ℝ) x |
| 35 | let G (p : ℝ × M) := ContinuousLinearMap.inCoordinates E V (E →L[ℝ] ℝ) |
| 36 | (fun y => V y →L[ℝ] ℝ) x p.2 x p.2 ((F.metric p.1).inner p.2) |
| 37 | have hmetric := F.smooth.contMDiffAt |
| 38 | (prod_mem_nhds (mem_interior_iff_mem_nhds.mp ht) (univ_mem : univ ∈ 𝓝 x)) |
| 39 | have hG : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 40 | 𝓘(ℝ, E →L[ℝ] (E →L[ℝ] ℝ)) ∞ G (t, x) := |
| 41 | (contMDiffAt_hom_bundle _).mp hmetric |>.2 |
| 42 | have hGinv (p : ℝ × M) (hy : p.2 ∈ e.baseSet) (hy' : p.2 ∈ e'.baseSet) : |
| 43 | (G p).IsInvertible := by |
| 44 | dsimp only [G] |
| 45 | rw [ContinuousLinearMap.inCoordinates_eq hy hy'] |
| 46 | exact ContinuousLinearMap.isInvertible_equiv.comp |
| 47 | (((F.metric p.1).inner_isInvertible p.2).comp ContinuousLinearMap.isInvertible_equiv) |
| 48 | have hi := (hGinv (t, x) (FiberBundle.mem_baseSet_trivializationAt E V x) |
| 49 | (FiberBundle.mem_baseSet_trivializationAt (E →L[ℝ] ℝ) (fun y => V y →L[ℝ] ℝ) x)).contDiffAt_map_inverse (n := ∞) |
| 50 | have hresult := (hi.contMDiffAt.comp (t, x) hG).clm_apply |
| 51 | (contMDiffAt_totalSpace.mp hZ).2 |
| 52 | rw [contMDiffAt_totalSpace] |
| 53 | refine ⟨contMDiffAt_snd, hresult.congr_of_eventuallyEq ?_⟩ |
| 54 | have hsnd : Tendsto (Prod.snd : ℝ × M → M) (𝓝 (t, x)) (𝓝 x) := continuousAt_snd |
| 55 | filter_upwards [hsnd.eventually |
| 56 | (e.open_baseSet.mem_nhds (FiberBundle.mem_baseSet_trivializationAt E V x)), |
| 57 | hsnd.eventually (e'.open_baseSet.mem_nhds |
| 58 | (FiberBundle.mem_baseSet_trivializationAt (E →L[ℝ] ℝ) (fun y => V y →L[ℝ] ℝ) x))] |
| 59 | with p hp hp' |
| 60 | change (e ⟨p.2, Z p.1 p.2⟩).2 = |
| 61 | (G p).inverse ((e' ⟨p.2, (F.metric p.1).inner p.2 (Z p.1 p.2)⟩).2) |
| 62 | symm |
| 63 | apply (hGinv p hp hp').inverse_apply_eq.mpr |
| 64 | symm |
| 65 | dsimp only [G] |
| 66 | rw [ContinuousLinearMap.inCoordinates_eq hp hp'] |
| 67 | change (e'.continuousLinearEquivAt ℝ p.2 hp') |
| 68 | ((F.metric p.1).inner p.2 ((e.continuousLinearEquivAt ℝ p.2 hp).symm |
| 69 | ((e.continuousLinearEquivAt ℝ p.2 hp) (Z p.1 p.2)))) = _ |
| 70 | rw [ContinuousLinearEquiv.symm_apply_apply] |
| 71 | rfl |
| 72 | |
| 73 | /-- The actual gradient of a jointly smooth potential is jointly smooth in |
| 74 | time and space, using the given evolving metric. -/ |
| 75 | theorem contMDiffAt_gradient |
| 76 | {f : ℝ × M → ℝ} {t : ℝ} {x : M} (ht : t ∈ interior J) |
| 77 | (hf : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f (t, x)) : |
| 78 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 79 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 80 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) p.2 |
| 81 | ((F.connection p.1).gradient (fun y => f (p.1, y)) p.2)) (t, x) := by |
| 82 | apply F.contMDiffAt_of_metricDual (x := x) |
| 83 | (Z := fun s y => (F.connection s).gradient (fun z => f (s, z)) y) ht |
| 84 | have heq (p : ℝ × M) : (F.metric p.1).inner p.2 |
| 85 | ((F.connection p.1).gradient (fun y => f (p.1, y)) p.2) = |
| 86 | mvfderiv (𝓡 n) (fun y => f (p.1, y)) p.2 := by |
| 87 | ext v |
| 88 | exact (F.connection p.1).inner_gradient _ _ v |
| 89 | simp_rw [heq] |
| 90 | rw [contMDiffAt_hom_bundle] |
| 91 | refine ⟨contMDiffAt_snd, ?_⟩ |
| 92 | have hpartial : ContMDiffAt ((𝓘(ℝ, ℝ).prod (𝓡 n)).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ |
| 93 | (Function.uncurry (fun p : ℝ × M => fun y : M => f (p.1, y))) ((t, x), x) := |
| 94 | hf.comp ((t, x), x) |
| 95 | ((contMDiffAt_fst.comp ((t, x), x) contMDiffAt_fst).prodMk contMDiffAt_snd) |
| 96 | convert hpartial.mfderiv (fun p : ℝ × M => fun y : M => f (p.1, y)) |
| 97 | Prod.snd contMDiffAt_snd (m := ∞) (by simp) using 1 |
| 98 | funext p |
| 99 | simp [inTangentCoordinates, ContinuousLinearMap.inCoordinates, mvfderiv, |
| 100 | NormedSpace.fromTangentSpace] |
| 101 | rfl |
| 102 | |
| 103 | theorem contMDiffAt_negative_gradient |
| 104 | {f : ℝ × M → ℝ} {t : ℝ} {x : M} (ht : t ∈ interior J) |
| 105 | (hf : ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) 𝓘(ℝ, ℝ) ∞ f (t, x)) : |
| 106 | ContMDiffAt (𝓘(ℝ, ℝ).prod (𝓡 n)) |
| 107 | ((𝓡 n).prod 𝓘(ℝ, EuclideanSpace ℝ (Fin n))) ∞ |
| 108 | (fun p : ℝ × M => TotalSpace.mk' (EuclideanSpace ℝ (Fin n)) p.2 |
| 109 | (-((F.connection p.1).gradient (fun y => f (p.1, y)) p.2))) (t, x) := by |
| 110 | have h := F.contMDiffAt_gradient ht hf |
| 111 | rw [contMDiffAt_totalSpace] at h ⊢ |
| 112 | refine ⟨contMDiffAt_snd, h.2.neg.congr_of_eventuallyEq ?_⟩ |
| 113 | let e := trivializationAt (EuclideanSpace ℝ (Fin n)) (TangentSpace (𝓡 n) (M := M)) x |
| 114 | have hsnd : Tendsto (Prod.snd : ℝ × M → M) (𝓝 (t, x)) (𝓝 x) := continuousAt_snd |
| 115 | filter_upwards [hsnd.eventually (e.open_baseSet.mem_nhds |
| 116 | (FiberBundle.mem_baseSet_trivializationAt (EuclideanSpace ℝ (Fin n)) |
| 117 | (TangentSpace (𝓡 n) (M := M)) x))] with p hp |
| 118 | exact (e.linear ℝ hp).map_neg _ |
| 119 | |
| 120 | end PoincareMT.RicciFlow |