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.Tensor.FixedChartHessian |
| 2 | |
| 3 | /-! |
| 4 | # Fixed-chart Hessians on local scalar neighborhoods |
| 5 | |
| 6 | The derivative of the frozen extension cancels on the common chart germ. |
| 7 | Scalar germ equality also preserves the complete frozen Hessian. |
| 8 | -/ |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | set_option maxSynthPendingDepth 3 |
| 12 | |
| 13 | open scoped Manifold ContDiff Bundle Topology |
| 14 | open Filter |
| 15 | |
| 16 | universe u |
| 17 | |
| 18 | namespace PoincareMT.ReducedLength |
| 19 | |
| 20 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 21 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 22 | [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | theorem hessian_eq_of_eventuallyEq {g : RiemannianMetric n M} |
| 27 | (D : LeviCivitaData g) (f h : M → ℝ) (q : M) |
| 28 | (heq : f =ᶠ[𝓝 q] h) (u v : TangentSpace (𝓡 n) q) : |
| 29 | D.hessian f q u v = D.hessian h q u v := by |
| 30 | have hcongr (f h : M → ℝ) (x : M) (hh : f =ᶠ[𝓝 x] h) : |
| 31 | mvfderiv (𝓡 n) f x = mvfderiv (𝓡 n) h x := by |
| 32 | unfold mvfderiv |
| 33 | rw [hh.eq_of_nhds, hh.mfderiv_eq] |
| 34 | have hfirst : (fun x ↦ mvfderiv (𝓡 n) f x (FiberBundle.extend E v x)) =ᶠ[𝓝 q] |
| 35 | (fun x ↦ mvfderiv (𝓡 n) h x (FiberBundle.extend E v x)) := by |
| 36 | filter_upwards [heq.eventuallyEq_nhds] with x hx |
| 37 | rw [hcongr f h x hx] |
| 38 | unfold LeviCivitaData.hessian LeviCivitaData.hessianOnFields |
| 39 | change mvfderiv (𝓡 n) _ q _ - mvfderiv (𝓡 n) f q _ = |
| 40 | mvfderiv (𝓡 n) _ q _ - mvfderiv (𝓡 n) h q _ |
| 41 | rw [hcongr _ _ q hfirst, hcongr f h q heq] |
| 42 | |
| 43 | set_option maxHeartbeats 1000000 in |
| 44 | -- The local scalar and the frozen extension are differentiated on their common open germ. |
| 45 | set_option backward.isDefEq.respectTransparency false in |
| 46 | theorem hessian_fixedChart_local {g : RiemannianMetric n M} (D : LeviCivitaData g) |
| 47 | (f : M → ℝ) (p q : M) (hq : q ∈ (chartAt E p).source) |
| 48 | (O : Set M) (hO : IsOpen O) (hqO : q ∈ O) |
| 49 | (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) |
| 50 | (u v : E) (A : E →L[ℝ] E) |
| 51 | (hA : ∀ w : E, D.connection (chartVectorField p w) q (chartVectorField p u q) = |
| 52 | chartVectorField p (A w) q) : |
| 53 | let φ : E → ℝ := fun y ↦ f ((chartAt E p).symm y) |
| 54 | D.hessian f q (chartVectorField p u q) (chartVectorField p v q) = |
| 55 | fderiv ℝ (fderiv ℝ φ) ((chartAt E p) q) u v - |
| 56 | fderiv ℝ φ ((chartAt E p) q) (A v) := by |
| 57 | dsimp only |
| 58 | let e := chartAt E p |
| 59 | let U := O ∩ e.source |
| 60 | let V := e.target ∩ e.symm ⁻¹' O |
| 61 | have hU : IsOpen U := hO.inter e.open_source |
| 62 | have hqU : q ∈ U := ⟨hqO, hq⟩ |
| 63 | have he : ContMDiffOn (𝓡 n) (𝓡 n) ∞ e.symm e.target := contMDiffOn_chart_symm |
| 64 | have hV : IsOpen V := he.continuousOn.isOpen_inter_preimage e.open_target hO |
| 65 | have hqV : e q ∈ V := ⟨e.map_source hq, by |
| 66 | change e.symm (e q) ∈ O |
| 67 | rwa [e.left_inv hq]⟩ |
| 68 | let φ : E → ℝ := fun y ↦ f (e.symm y) |
| 69 | let P : M → E →L[ℝ] ℝ := fun x ↦ fderiv ℝ φ (e x) |
| 70 | let X := chartVectorField p u q |
| 71 | let Vq := chartVectorField p v q |
| 72 | let c := frozenChartCoordinates p q Vq |
| 73 | have hφ : ContDiffOn ℝ ∞ φ V := |
| 74 | (hf.comp (he.mono Set.inter_subset_left) (fun y hy ↦ hy.2)).contDiffOn |
| 75 | have hDφ := hφ.fderiv_of_isOpen hV (m := ∞) (by simp) |
| 76 | have hP : ContMDiffOn (𝓡 n) (𝓘(ℝ, E →L[ℝ] ℝ)) ∞ P U := |
| 77 | hDφ.contMDiffOn.comp (contMDiffOn_chart.mono Set.inter_subset_right) (by |
| 78 | intro x hx |
| 79 | exact ⟨e.map_source hx.2, by |
| 80 | change e.symm (e x) ∈ O |
| 81 | rw [e.left_inv hx.2] |
| 82 | exact hx.1⟩) |
| 83 | have hPd := (hP.contMDiffAt (hU.mem_nhds hqU)).mdifferentiableAt (by simp) |
| 84 | have hcd := (frozenChartCoordinates_contMDiffAt p q hq Vq).mdifferentiableAt (by simp) |
| 85 | have hcv : c q = v := frozenChartCoordinates_at_base p q hq v |
| 86 | have hfirst (x : M) (hx : x ∈ U) (w : E) : |
| 87 | mvfderiv (𝓡 n) f x (chartVectorField p w x) = P x w := by |
| 88 | have hfx : MDifferentiableAt (𝓡 n) (𝓘(ℝ, ℝ)) f (e.symm (e x)) := by |
| 89 | rw [e.left_inv hx.2] |
| 90 | exact (hf.contMDiffAt (hO.mem_nhds hx.1)).mdifferentiableAt (by simp) |
| 91 | have h := mvfderiv_chartVectorField_normed p f (e x) w (e.map_source hx.2) hfx |
| 92 | rwa [e.left_inv hx.2] at h |
| 93 | have heq : (fun x ↦ mvfderiv (𝓡 n) f x (FiberBundle.extend E Vq x)) =ᶠ[𝓝 q] |
| 94 | (fun x ↦ P x (c x)) := by |
| 95 | filter_upwards [hU.mem_nhds hqU] with x hx |
| 96 | rw [← frozenChartCoordinates_reconstruct p q x Vq hx.2] |
| 97 | exact hfirst x hx (c x) |
| 98 | have hder : mvfderiv (𝓡 n) |
| 99 | (fun x ↦ mvfderiv (𝓡 n) f x (FiberBundle.extend E Vq x)) q X = |
| 100 | P q (mvfderiv (𝓡 n) c q X) + mvfderiv (𝓡 n) P q X v := by |
| 101 | rw [mvfderiv, heq.mfderiv_eq] |
| 102 | change mvfderiv (𝓡 n) (fun x ↦ P x (c x)) q X = _ |
| 103 | rw [mvfderiv_clm_application P c q hPd hcd X, hcv] |
| 104 | have hPder : mvfderiv (𝓡 n) P q X = fderiv ℝ (fderiv ℝ φ) (e q) u := by |
| 105 | have hPd' : MDifferentiableAt (𝓡 n) (𝓘(ℝ, E →L[ℝ] ℝ)) P (e.symm (e q)) := by |
| 106 | rwa [e.left_inv hq] |
| 107 | have h := mvfderiv_chartVectorField_normed p P (e q) u (e.map_source hq) hPd' |
| 108 | rw [e.left_inv hq] at h |
| 109 | have hgerm : (fun y ↦ P (e.symm y)) =ᶠ[𝓝 (e q)] fderiv ℝ φ := by |
| 110 | filter_upwards [e.open_target.mem_nhds (e.map_source hq)] with y hy |
| 111 | exact congrArg (fderiv ℝ φ) (e.right_inv hy) |
| 112 | exact h.trans (congrArg (fun L : E →L[ℝ] E →L[ℝ] ℝ ↦ L u) |
| 113 | (hgerm.fderiv_eq (𝕜 := ℝ))) |
| 114 | change mvfderiv (𝓡 n) |
| 115 | (fun x ↦ mvfderiv (𝓡 n) f x (FiberBundle.extend E Vq x)) q |
| 116 | (FiberBundle.extend E X q) - |
| 117 | mvfderiv (𝓡 n) f q (D.connection (FiberBundle.extend E Vq) |
| 118 | q (FiberBundle.extend E X q)) = _ |
| 119 | rw [FiberBundle.extend_apply_self, hder, |
| 120 | connection_frozenChartCoordinates D p q hq X A hA v, hfirst q hqU, map_add, hPder] |
| 121 | ring |
| 122 | |
| 123 | end PoincareMT.ReducedLength |