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.ConjugateHeat.WeakPairing |
| 2 | import PoincareLib.Geometry.RicciFlow.ConjugateHeat.Coordinates.Laplacian |
| 3 | import PoincareLib.Geometry.Riemannian.ScalarOperators.Divergence.Regularity |
| 4 | |
| 5 | /-! # Smoothness and support of the geometric backward heat test operator -/ |
| 6 | |
| 7 | noncomputable section |
| 8 | set_option autoImplicit false |
| 9 | set_option backward.isDefEq.respectTransparency false |
| 10 | |
| 11 | open Set Filter |
| 12 | open scoped Manifold ContDiff Topology |
| 13 | open Poincare.Analysis.Parabolic.WeakRegularity |
| 14 | open Poincare.Analysis.Elliptic.Iteration |
| 15 | open Poincare.Analysis.Elliptic.InteriorEstimates |
| 16 | |
| 17 | namespace PoincareMT.RicciFlow.ConjugateHeat |
| 18 | |
| 19 | variable {n : ℕ} {M : Type*} [TopologicalSpace M] |
| 20 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 21 | {J : Set ℝ} |
| 22 | |
| 23 | theorem testOperator_eq_zero_of_notMem_tsupport (F : RicciFlow n M J) |
| 24 | {φ : M × ℝ → ℝ} {z : M × ℝ} (hz : z ∉ tsupport φ) : |
| 25 | testOperator F φ z = 0 := by |
| 26 | have heq := notMem_tsupport_iff_eventuallyEq.mp hz |
| 27 | have ht : (fun τ => φ (z.1, τ)) =ᶠ[𝓝 z.2] (fun _ => (0 : ℝ)) := |
| 28 | heq.comp_tendsto ((continuous_const.prodMk continuous_id).tendsto z.2) |
| 29 | have hx : (fun x => φ (x, z.2)) =ᶠ[𝓝 z.1] (fun _ => (0 : ℝ)) := |
| 30 | heq.comp_tendsto ((continuous_id.prodMk continuous_const).tendsto z.1) |
| 31 | rw [testOperator, ht.deriv_eq, |
| 32 | (F.connection (-z.2)).laplacian_eq_zero_of_notMem_tsupport |
| 33 | (notMem_tsupport_iff_eventuallyEq.mpr hx)] |
| 34 | simp |
| 35 | |
| 36 | theorem tsupport_testOperator_subset (F : RicciFlow n M J) (φ : M × ℝ → ℝ) : |
| 37 | tsupport (testOperator F φ) ⊆ tsupport φ := by |
| 38 | apply closure_minimal _ (isClosed_tsupport _) |
| 39 | intro z hz |
| 40 | by_contra hφ |
| 41 | exact hz (testOperator_eq_zero_of_notMem_tsupport F hφ) |
| 42 | |
| 43 | theorem hasCompactSupport_testOperator (F : RicciFlow n M J) |
| 44 | {φ : M × ℝ → ℝ} (hφ : HasCompactSupport φ) : |
| 45 | HasCompactSupport (testOperator F φ) := |
| 46 | hφ.of_isClosed_subset (isClosed_tsupport _) (tsupport_testOperator_subset F φ) |
| 47 | |
| 48 | private theorem partialDeriv_partialDeriv_slice_of_contDiffOn |
| 49 | {f : Spacetime n → ℝ} {V : Set (Spacetime n)} (hV : IsOpen V) |
| 50 | (hf : ContDiffOn ℝ ∞ f V) {z : Spacetime n} (hz : z ∈ V) (i j : Fin n) : |
| 51 | partialDeriv i (partialDeriv j (fun y => f (y, z.2))) z.1 = |
| 52 | Canonical.spatialDeriv i (Canonical.spatialDeriv j f) z := by |
| 53 | have hd : ContDiffOn ℝ ∞ (Canonical.spatialDeriv j f) V := |
| 54 | (hf.fderiv_of_isOpen hV (by simp)).clm_apply contDiffOn_const |
| 55 | have heq : partialDeriv j (fun y => f (y, z.2)) =ᶠ[𝓝 z.1] |
| 56 | (fun y => Canonical.spatialDeriv j f (y, z.2)) := by |
| 57 | filter_upwards [((continuous_id.prodMk continuous_const).tendsto z.1) |
| 58 | (hV.mem_nhds hz)] with y hy |
| 59 | exact BackwardCoordinates.partialDeriv_spatialSlice |
| 60 | ((hf.contDiffAt (hV.mem_nhds hy)).differentiableAt (by simp)) j |
| 61 | change fderiv ℝ (partialDeriv j (fun y => f (y, z.2))) z.1 |
| 62 | (EuclideanSpace.single i 1) = _ |
| 63 | rw [heq.fderiv_eq] |
| 64 | exact BackwardCoordinates.partialDeriv_spatialSlice |
| 65 | ((hd.contDiffAt (hV.mem_nhds hz)).differentiableAt (by simp)) i |
| 66 | |
| 67 | private theorem timeDeriv_eq_deriv_slice {f : Spacetime n → ℝ} {z : Spacetime n} |
| 68 | (hf : DifferentiableAt ℝ f z) : |
| 69 | Canonical.timeDeriv f z = deriv (fun τ => f (z.1, τ)) z.2 := by |
| 70 | have hd := hf.hasFDerivAt.comp_hasDerivAt z.2 |
| 71 | ((hasDerivAt_const z.2 z.1).prodMk (hasDerivAt_id z.2)) |
| 72 | exact hd.deriv.symm |
| 73 | |
| 74 | private theorem contDiffOn_testOperator_coordinates |
| 75 | (F : RicciFlow n M J) |
| 76 | (e : OpenPartialHomeomorph (EuclideanSpace ℝ (Fin n)) M) |
| 77 | (he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source) |
| 78 | (hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target) |
| 79 | {φ : M × ℝ → ℝ} |
| 80 | (hφ : ContMDiff ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ φ) : |
| 81 | ContDiffOn ℝ ∞ (fun z : Spacetime n => testOperator F φ (e z.1, z.2)) |
| 82 | (BackwardCoordinates.domain J e) := by |
| 83 | let ψ : Spacetime n → ℝ := fun z => φ (e z.1, z.2) |
| 84 | let V := BackwardCoordinates.domain J e |
| 85 | have hV : IsOpen V := BackwardCoordinates.isOpen_domain e |
| 86 | have hψ : ContDiffOn ℝ ∞ ψ V := by |
| 87 | intro z hz |
| 88 | have hmap : ContMDiffAt ((𝓡 n).prod 𝓘(ℝ, ℝ)) |
| 89 | ((𝓡 n).prod 𝓘(ℝ, ℝ)) ∞ |
| 90 | (fun y : Spacetime n => (e y.1, y.2)) z := |
| 91 | ((he.contMDiffAt (e.open_source.mem_nhds hz.1)).comp z |
| 92 | contMDiffAt_fst).prodMk contMDiffAt_snd |
| 93 | have h := (hφ (e z.1, z.2)).comp z hmap |
| 94 | simp +instances only [← modelWithCornersSelf_prod, chartedSpaceSelf_prod] at h |
| 95 | exact h.contDiffAt.contDiffWithinAt |
| 96 | have hd (i : Fin n) : ContDiffOn ℝ ∞ (Canonical.spatialDeriv i ψ) V := |
| 97 | (hψ.fderiv_of_isOpen hV (by simp)).clm_apply contDiffOn_const |
| 98 | have hdd (i j : Fin n) : |
| 99 | ContDiffOn ℝ ∞ (Canonical.spatialDeriv i (Canonical.spatialDeriv j ψ)) V := |
| 100 | ((hd j).fderiv_of_isOpen hV (by simp)).clm_apply contDiffOn_const |
| 101 | have htime : ContDiffOn ℝ ∞ (Canonical.timeDeriv ψ) V := |
| 102 | (hψ.fderiv_of_isOpen hV (by simp)).clm_apply contDiffOn_const |
| 103 | have hop : ContDiffOn ℝ ∞ (fun z => Canonical.timeDeriv ψ z + |
| 104 | ((∑ i, ∑ j, BackwardCoordinates.principal F e i j z * |
| 105 | Canonical.spatialDeriv i (Canonical.spatialDeriv j ψ) z) + |
| 106 | ∑ i, BackwardCoordinates.drift F e i z * Canonical.spatialDeriv i ψ z)) V := |
| 107 | htime.add ((ContDiffOn.sum (fun i _ => ContDiffOn.sum (fun j _ => |
| 108 | (BackwardCoordinates.contDiffOn_principal F e he hei i j).mul (hdd i j)))).add |
| 109 | (ContDiffOn.sum (fun i _ => |
| 110 | (BackwardCoordinates.contDiffOn_drift F e he hei i).mul (hd i)))) |
| 111 | apply hop.congr |
| 112 | intro z hz |
| 113 | symm |
| 114 | have hs : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ (fun x => φ (x, z.2)) := |
| 115 | hφ.comp (contMDiff_id.prodMk contMDiff_const) |
| 116 | have hL := LeviCivitaData.Dirichlet.secondOrderOperator_coordinate_eq_laplacian |
| 117 | (F.connection (-z.2)) e he hei isOpen_univ hs.contMDiffOn hz.1 (mem_univ _) |
| 118 | rw [timeDeriv_eq_deriv_slice ((hψ.contDiffAt (hV.mem_nhds hz)).differentiableAt |
| 119 | (by simp))] |
| 120 | change deriv (fun τ => φ (e z.1, τ)) z.2 + _ = testOperator F φ (e z.1, z.2) |
| 121 | rw [testOperator, ← hL] |
| 122 | congr 1 |
| 123 | unfold secondOrderOperator |
| 124 | congr 1 |
| 125 | · apply Finset.sum_congr rfl |
| 126 | intro i _ |
| 127 | apply Finset.sum_congr rfl |
| 128 | intro j _ |
| 129 | rw [← BackwardCoordinates.principal_eq_coordinatePrincipal F e he hei hz.1 i j] |
| 130 | congr 1 |
| 131 | exact (partialDeriv_partialDeriv_slice_of_contDiffOn hV hψ hz i j).symm |
| 132 | · apply Finset.sum_congr rfl |
| 133 | intro i _ |
| 134 | rw [← BackwardCoordinates.drift_eq_coordinateDrift F e he hei hz i] |
| 135 | congr 1 |
| 136 | exact (BackwardCoordinates.partialDeriv_spatialSlice |
| 137 | ((hψ.contDiffAt (hV.mem_nhds hz)).differentiableAt (by simp)) i).symm |
| 138 | |
| 139 | theorem contMDiffOn_testOperator (F : RicciFlow n M J) |
| 140 | {φ : M × ℝ → ℝ} |
| 141 | (hφ : ContMDiff ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ φ) : |
| 142 | ContMDiffOn ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ (testOperator F φ) |
| 143 | (univ ×ˢ ((fun τ : ℝ => -τ) ⁻¹' interior J)) := by |
| 144 | intro z hz |
| 145 | let e := (chartAt (EuclideanSpace ℝ (Fin n)) z.1).symm |
| 146 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e e.source := contMDiffOn_chart_symm |
| 147 | have hei : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart |
| 148 | have hp : z.1 ∈ e.target := mem_chart_source _ z.1 |
| 149 | have hx : (e.symm z.1, z.2) ∈ BackwardCoordinates.domain J e := |
| 150 | ⟨e.map_target hp, hz.2⟩ |
| 151 | have hcoord := (contDiffOn_testOperator_coordinates F e he hei hφ).contDiffAt |
| 152 | ((BackwardCoordinates.isOpen_domain e).mem_nhds hx) |
| 153 | have hmap : ContMDiffAt ((𝓡 n).prod 𝓘(ℝ, ℝ)) |
| 154 | 𝓘(ℝ, Spacetime n) ∞ (fun y : M × ℝ => (e.symm y.1, y.2)) z := |
| 155 | ((hei.contMDiffAt (e.open_target.mem_nhds hp)).comp z |
| 156 | contMDiffAt_fst).prodMk_space contMDiffAt_snd |
| 157 | apply ((hcoord.contMDiffAt.comp z hmap).congr_of_eventuallyEq ?_).contMDiffWithinAt |
| 158 | filter_upwards [(continuous_fst.tendsto z) (e.open_target.mem_nhds hp)] with y hy |
| 159 | change testOperator F φ y = testOperator F φ (e (e.symm y.1), y.2) |
| 160 | rw [e.right_inv hy] |
| 161 | |
| 162 | theorem contMDiff_testOperator_of_tsupport_subset (F : RicciFlow n M J) |
| 163 | {φ : M × ℝ → ℝ} |
| 164 | (hφ : ContMDiff ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ φ) |
| 165 | (hs : tsupport φ ⊆ univ ×ˢ ((fun τ : ℝ => -τ) ⁻¹' interior J)) : |
| 166 | ContMDiff ((𝓡 n).prod 𝓘(ℝ, ℝ)) 𝓘(ℝ, ℝ) ∞ (testOperator F φ) := by |
| 167 | intro z |
| 168 | by_cases hz : z ∈ univ ×ˢ ((fun τ : ℝ => -τ) ⁻¹' interior J) |
| 169 | · exact (contMDiffOn_testOperator F hφ).contMDiffAt |
| 170 | ((isOpen_univ.prod (isOpen_interior.preimage continuous_neg)).mem_nhds hz) |
| 171 | · have hzs : z ∉ tsupport (testOperator F φ) := |
| 172 | fun h => hz (hs (tsupport_testOperator_subset F φ h)) |
| 173 | exact contMDiffAt_const.congr_of_eventuallyEq |
| 174 | (notMem_tsupport_iff_eventuallyEq.mp hzs) |
| 175 | |
| 176 | end PoincareMT.RicciFlow.ConjugateHeat |