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.ReducedVolume.Measure.Chart.ChartDensitySmooth |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Exponential.Jacobian.GramNormalization |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Exponential.Jacobian.JacobianEvolution |
| 4 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Metric.Trace.MetricTrace |
| 5 | |
| 6 | /-! |
| 7 | # Directional derivative of the genuine chart Gram density |
| 8 | |
| 9 | One frozen source equivalence makes the central Gram matrix the |
| 10 | identity. The already established normalized determinant derivative |
| 11 | then gives half the metric trace, including dimension zero. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace PoincareMT.ReducedVolume |
| 22 | |
| 23 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 24 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 25 | |
| 26 | set_option backward.isDefEq.respectTransparency false in |
| 27 | set_option synthInstance.maxHeartbeats 80000 in |
| 28 | -- The matrix and nested continuous-linear-map norm instances require a larger search budget. |
| 29 | /-- Differentiating the actual Gram density gives half the metric derivative trace. -/ |
| 30 | theorem pullbackJacobian_fderiv_eq (g : RiemannianMetric n M) |
| 31 | {f : EuclideanSpace ℝ (Fin n) → M} {y : EuclideanSpace ℝ (Fin n)} |
| 32 | (hB : ContDiffAt ℝ 1 (pullbackMetricForm g f) y) |
| 33 | (hD : Function.Injective (mfderiv (𝓡 n) (𝓡 n) f y)) |
| 34 | (C : EuclideanSpace ℝ (Fin n) ≃L[ℝ] EuclideanSpace ℝ (Fin n)) |
| 35 | (hC : ∀ v, mfderiv (𝓡 n) (𝓡 n) f y (C v) = metricCoordinates g (f y) v) |
| 36 | (w : EuclideanSpace ℝ (Fin n)) : |
| 37 | fderiv ℝ (pullbackJacobian g f) y w = pullbackJacobian g f y * |
| 38 | ((∑ i : Fin n, fderiv ℝ (pullbackMetricForm g f) y w |
| 39 | (C (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 40 | (C (EuclideanSpace.basisFun (Fin n) ℝ i))) / 2) := by |
| 41 | let β := fun i : Fin n ↦ C (EuclideanSpace.basisFun (Fin n) ℝ i) |
| 42 | let A := fun s : ℝ ↦ |
| 43 | (fun i j : Fin n ↦ pullbackMetricForm g f (y + s • w) (β i) (β j)) |
| 44 | let Q : Matrix (Fin n) (Fin n) ℝ := fun i j ↦ |
| 45 | fderiv ℝ (pullbackMetricForm g f) y w (β i) (β j) |
| 46 | let J := fun s : ℝ ↦ pullbackJacobian g f (y + s • w) |
| 47 | have hline : HasDerivAt (fun s : ℝ ↦ y + s • w) w 0 := by |
| 48 | simpa using ((hasDerivAt_id (0 : ℝ)).smul_const w).const_add y |
| 49 | have hBD := (hB.differentiableAt one_ne_zero).hasFDerivAt.comp_hasDerivAt_of_eq |
| 50 | 0 hline (by simp) |
| 51 | have hA : HasDerivAt A Q 0 := by |
| 52 | apply hasDerivAt_pi.mpr |
| 53 | intro i |
| 54 | apply hasDerivAt_pi.mpr |
| 55 | intro j |
| 56 | simpa only [Function.comp_def, map_zero, add_zero, zero_add] using |
| 57 | (hBD.clm_apply (hasDerivAt_const 0 (β i))).clm_apply (hasDerivAt_const 0 (β j)) |
| 58 | have hAt : A 0 = (1 : Matrix (Fin n) (Fin n) ℝ) := by |
| 59 | ext i j |
| 60 | dsimp only [A] |
| 61 | rw [zero_smul, add_zero] |
| 62 | change g.inner (f y) |
| 63 | (mfderiv (𝓡 n) (𝓡 n) f y (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 64 | (mfderiv (𝓡 n) (𝓡 n) f y (C (EuclideanSpace.basisFun (Fin n) ℝ j))) = _ |
| 65 | rw [hC, hC, metricCoordinates_basis_inner, Matrix.one_apply] |
| 66 | have hscale : (fun s ↦ C.toLinearMap.normDet * J s) =ᶠ[𝓝 0] |
| 67 | (fun s ↦ Real.sqrt (Matrix.det (A s))) := by |
| 68 | apply Eventually.of_forall |
| 69 | intro s |
| 70 | convert (sqrt_det_pullbackMetric_change_source g f (y + s • w) C.toLinearMap).symm using 1 |
| 71 | · exact mul_comm _ _ |
| 72 | · rfl |
| 73 | have hJ := hasDerivAt_jacobian_of_scaled_normalized_gram |
| 74 | (source_normalization_normDet_pos C).ne' hscale hA hAt |
| 75 | have hactual := ((pullbackJacobian_contDiffAt_of_form g hB hD).differentiableAt |
| 76 | one_ne_zero).hasFDerivAt.comp_hasDerivAt_of_eq 0 hline (by simp) |
| 77 | have heq := hactual.unique hJ |
| 78 | simpa only [J, zero_smul, add_zero, Matrix.trace, Matrix.diag, Q, β] using heq |
| 79 | |
| 80 | end PoincareMT.ReducedVolume |