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.Volume.Surgery.Measure.Coordinates.GramNormalization |
| 2 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Measure.Evolution.MetricTrace |
| 3 | import PoincareLib.Geometry.RicciFlow.Volume.Surgery.Measure.Evolution.JacobianEvolution |
| 4 | |
| 5 | /-! |
| 6 | Adapted from Mapher `PoincareMT/Proofs/M49/VolumeDensity.lean` at |
| 7 | revision `f927d9e1f0810042766d3b5f64d3f4da02ee93cc`. |
| 8 | |
| 9 | # Evolution of the actual coordinate volume density |
| 10 | |
| 11 | Morgan-Tian, Lemma 17.12, p. 410, and Perelman II, Section 7.1, p. 17: |
| 12 | the Ricci flow equation gives `J' = -R J`. The Jacobian here is precisely |
| 13 | the Gram density in M10's calibrated Hausdorff-volume formula. Its source |
| 14 | normalization is frozen at the differentiation time. See |
| 15 | `proof-work/tasks/M49/derivations/02-density-evolution.md`. |
| 16 | -/ |
| 17 | |
| 18 | set_option autoImplicit false |
| 19 | |
| 20 | open Set Filter |
| 21 | open scoped Manifold ContDiff Bundle Topology BigOperators |
| 22 | |
| 23 | universe u |
| 24 | |
| 25 | namespace PoincareMT.SurgeryVolume |
| 26 | |
| 27 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 28 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 29 | {J : Set ℝ} (F : RicciFlow n M J) |
| 30 | |
| 31 | /-- The actual Gram density is time-continuous, including the endpoints in |
| 32 | MT Lemma 17.12, p. 410. -/ |
| 33 | theorem pullbackJacobian_continuousOn_time |
| 34 | (f : EuclideanSpace ℝ (Fin n) → M) (x : EuclideanSpace ℝ (Fin n)) : |
| 35 | ContinuousOn (fun t => SurgeryVolume.Measure.pullbackJacobian (F.metric t) f x) J := by |
| 36 | intro t ht |
| 37 | have hmatrix : ContinuousWithinAt (fun s => (fun i j : Fin n => |
| 38 | SurgeryVolume.Measure.pullbackMetricForm (F.metric s) f x |
| 39 | (EuclideanSpace.basisFun (Fin n) ℝ i) |
| 40 | (EuclideanSpace.basisFun (Fin n) ℝ j))) J t := |
| 41 | continuousWithinAt_pi.mpr fun i => continuousWithinAt_pi.mpr fun j => |
| 42 | (F.equation t ht (f x) |
| 43 | (mfderiv (𝓡 n) (𝓡 n) f x (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 44 | (mfderiv (𝓡 n) (𝓡 n) f x |
| 45 | (EuclideanSpace.basisFun (Fin n) ℝ j))).continuousWithinAt |
| 46 | exact Real.continuous_sqrt.continuousAt.comp_continuousWithinAt |
| 47 | (continuous_id.matrix_det.continuousAt.comp_continuousWithinAt hmatrix) |
| 48 | |
| 49 | set_option backward.isDefEq.respectTransparency false in |
| 50 | /-- At a regular coordinate point, the volume density evolves by `-R J` |
| 51 | (MT Lemma 17.12, p. 410). -/ |
| 52 | theorem pullbackJacobian_hasDerivAt |
| 53 | (f : EuclideanSpace ℝ (Fin n) → M) (x : EuclideanSpace ℝ (Fin n)) |
| 54 | (hD : Function.Bijective (mfderiv (𝓡 n) (𝓡 n) f x)) |
| 55 | {t : ℝ} (ht : J ∈ 𝓝 t) : |
| 56 | HasDerivAt (fun s => SurgeryVolume.Measure.pullbackJacobian (F.metric s) f x) |
| 57 | (-(F.connection t).scalarCurvature (f x) * |
| 58 | SurgeryVolume.Measure.pullbackJacobian (F.metric t) f x) t := by |
| 59 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 60 | ⟨(F.metric t).toRiemannianMetric⟩ |
| 61 | let D : EuclideanSpace ℝ (Fin n) ≃L[ℝ] TangentSpace (𝓡 n) (f x) := |
| 62 | LinearEquiv.toContinuousLinearEquiv |
| 63 | (LinearEquiv.ofBijective (mfderiv (𝓡 n) (𝓡 n) f x).toLinearMap hD) |
| 64 | let C := (SurgeryVolume.Measure.metricCoordinates (F.metric t) (f x)).toContinuousLinearEquiv.trans |
| 65 | D.symm |
| 66 | have hC (v : EuclideanSpace ℝ (Fin n)) : |
| 67 | mfderiv (𝓡 n) (𝓡 n) f x (C v) = SurgeryVolume.Measure.metricCoordinates (F.metric t) (f x) v := by |
| 68 | change D (C v) = _ |
| 69 | simp only [C, ContinuousLinearEquiv.trans_apply, |
| 70 | ContinuousLinearEquiv.apply_symm_apply, LinearIsometryEquiv.coe_toContinuousLinearEquiv] |
| 71 | let A : ℝ → Matrix (Fin n) (Fin n) ℝ := fun s => fun i j => |
| 72 | SurgeryVolume.Measure.pullbackMetricForm (F.metric s) f x |
| 73 | (C (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 74 | (C (EuclideanSpace.basisFun (Fin n) ℝ j)) |
| 75 | let B : Matrix (Fin n) (Fin n) ℝ := fun i j => |
| 76 | -2 * (F.connection t).ricci (f x) |
| 77 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 78 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ j))) |
| 79 | have hA : HasDerivAt A B t := |
| 80 | hasDerivAt_pi.mpr fun i => hasDerivAt_pi.mpr fun j => |
| 81 | (F.equation t (mem_of_mem_nhds ht) (f x) |
| 82 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 83 | (mfderiv (𝓡 n) (𝓡 n) f x |
| 84 | (C (EuclideanSpace.basisFun (Fin n) ℝ j)))).hasDerivAt ht |
| 85 | have hAt : A t = 1 := by |
| 86 | ext i j |
| 87 | change (F.metric t).inner (f x) |
| 88 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 89 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ j))) = _ |
| 90 | rw [hC, hC, SurgeryVolume.Measure.metricCoordinates_basis_inner, Matrix.one_apply] |
| 91 | have hscale : |
| 92 | (fun s => C.toLinearMap.normDet * SurgeryVolume.Measure.pullbackJacobian (F.metric s) f x) =ᶠ[𝓝 t] |
| 93 | (fun s => Real.sqrt (A s).det) := by |
| 94 | apply Eventually.of_forall |
| 95 | intro s |
| 96 | simpa only [A, mul_comm] using! |
| 97 | (SurgeryVolume.Measure.sqrt_det_pullbackMetric_change_source (F.metric s) f x C.toLinearMap).symm |
| 98 | have htrace : B.trace / 2 = -(F.connection t).scalarCurvature (f x) := by |
| 99 | change (∑ i : Fin n, -2 * (F.connection t).ricci (f x) |
| 100 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 101 | (mfderiv (𝓡 n) (𝓡 n) f x (C (EuclideanSpace.basisFun (Fin n) ℝ i)))) / 2 = _ |
| 102 | simp_rw [hC] |
| 103 | rw [← Finset.mul_sum, SurgeryVolume.Measure.sum_metricCoordinates_ricci] |
| 104 | ring |
| 105 | have h := SurgeryVolume.Measure.hasDerivAt_jacobian_of_scaled_normalized_gram |
| 106 | (SurgeryVolume.Measure.source_normalization_normDet_pos C).ne' hscale hA hAt |
| 107 | rw [htrace] at h |
| 108 | simpa only [mul_comm] using h |
| 109 | |
| 110 | end PoincareMT.SurgeryVolume |