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.Exponential.Jacobian.EndpointGram |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedVolume.Exponential.Coordinates.ExponentialDifferential |
| 3 | |
| 4 | /-! |
| 5 | # The derivative of the actual exponential Gram matrix |
| 6 | |
| 7 | Fixed source vectors in terminal metric coordinates define the same Gram |
| 8 | matrix used by calibrated measure transport. Its derivative exists entry by |
| 9 | entry; the diagonal is twice Ricci plus twice the actual reduced-length Hessian. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedVolume |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | [ConnectedSpace M] {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 24 | |
| 25 | set_option backward.isDefEq.respectTransparency false in |
| 26 | /-- The derivative of the actual Gram matrix, retaining every fixed source vector. -/ |
| 27 | theorem exponential_gram_hasDerivAt |
| 28 | (hwindow : Icc (T - τmax) T ⊆ J) (hL : LGeodesicTheory F T τmax) |
| 29 | (G : LExponentialGeometry F T τmax p) (x : EuclideanSpace ℝ (Fin n)) {τ : ℝ} |
| 30 | (hreg : (metricCoordinates (F.metric T) p x, τ) ∈ G.toLExponentialFamily.regularDomain) |
| 31 | (C : EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) : |
| 32 | let q := G.gamma (metricCoordinates (F.metric T) p x) τ |
| 33 | let V := fun i : Fin n ↦ G.toLExponentialFamily.sliceDifferential |
| 34 | (metricCoordinates (F.metric T) p x) τ |
| 35 | (metricCoordinates (F.metric T) p (C (EuclideanSpace.basisFun (Fin n) ℝ i))) |
| 36 | ∃ D : Matrix (Fin n) (Fin n) ℝ, |
| 37 | HasDerivAt (fun s ↦ (fun i j : Fin n ↦ |
| 38 | pullbackMetricForm (F.metric (T - s)) (exponentialSliceChart G s) x |
| 39 | (C (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 40 | (C (EuclideanSpace.basisFun (Fin n) ℝ j)))) D τ ∧ |
| 41 | ∀ i, D i i = 2 * (F.connection (T - τ)).ricci q (V i) (V i) + |
| 42 | 2 * (F.connection (T - τ)).hessian (fun y ↦ reducedLength F T p y τ) q (V i) (V i) := by |
| 43 | let : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 44 | ⟨(F.metric T).toRiemannianMetric⟩ |
| 45 | let β := metricCoordinates (F.metric T) p |
| 46 | let z := (β x, τ) |
| 47 | let q := G.gamma z.1 z.2 |
| 48 | let E := endpointCoordinates G q |
| 49 | let B := coordinateBackwardMetric F T q |
| 50 | let W := fun i : Fin n ↦ β (C (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 51 | let A := fun s ↦ (fun i j : Fin n ↦ |
| 52 | pullbackMetricForm (F.metric (T - s)) (exponentialSliceChart G s) x |
| 53 | (C (EuclideanSpace.basisFun (Fin n) ℝ i)) |
| 54 | (C (EuclideanSpace.basisFun (Fin n) ℝ j))) |
| 55 | obtain ⟨hτ, hmax, _, _⟩ := hreg.1 |
| 56 | have hz : z ∈ univ ×ˢ Ioo 0 τmax := ⟨mem_univ _, hτ, hmax⟩ |
| 57 | have hq : G.gamma z.1 z.2 ∈ (chartAt (EuclideanSpace ℝ (Fin n)) q).source := |
| 58 | mem_chart_source _ _ |
| 59 | have hE : ContDiffAt ℝ 2 E z := |
| 60 | (endpointCoordinates_contDiffAt G q z hz hq).of_le (by decide) |
| 61 | have hB : DifferentiableAt ℝ B (E z, τ) := |
| 62 | (coordinateBackwardMetric_contDiffAt hwindow q hτ hmax).differentiableAt (by simp) |
| 63 | have hγ := G.gamma_smooth.contMDiffAt ((isOpen_univ.prod isOpen_Ioo).mem_nhds hz) |
| 64 | have hc : ContinuousAt (fun s ↦ G.gamma (β x) s) τ := |
| 65 | hγ.continuousAt.comp (continuousAt_const.prodMk continuousAt_id) |
| 66 | have hcoords (i j : Fin n) : (fun s ↦ A s i j) =ᶠ[𝓝 τ] |
| 67 | (fun s ↦ B (E (z.1, s), s) |
| 68 | (fderiv ℝ E (z.1, s) (W i, 0)) (fderiv ℝ E (z.1, s) (W j, 0))) := by |
| 69 | filter_upwards [isOpen_Ioo.mem_nhds ⟨hτ, hmax⟩, |
| 70 | hc ((chartAt (EuclideanSpace ℝ (Fin n)) q).open_source.mem_nhds hq)] |
| 71 | with s hs hqs |
| 72 | exact exponentialSlice_pullbackMetric_eq G hs.1 hs.2 x q hqs |
| 73 | (C (EuclideanSpace.basisFun (Fin n) ℝ i)) (C (EuclideanSpace.basisFun (Fin n) ℝ j)) |
| 74 | have hdiff (i j : Fin n) : DifferentiableAt ℝ (fun s ↦ A s i j) τ := |
| 75 | ((endpoint_gram_hasDerivAt hE hB (W i) (W j)).congr_of_eventuallyEq |
| 76 | (hcoords i j)).differentiableAt |
| 77 | let D : Matrix (Fin n) (Fin n) ℝ := fun i j ↦ deriv (fun s ↦ A s i j) τ |
| 78 | refine ⟨D, hasDerivAt_pi.mpr (fun i ↦ hasDerivAt_pi.mpr (fun j ↦ |
| 79 | (hdiff i j).hasDerivAt)), ?_⟩ |
| 80 | intro i |
| 81 | have hd := (endpoint_gram_diagonal_hasDerivAt hwindow hL G z hreg (W i)).congr_of_eventuallyEq |
| 82 | (hcoords i i) |
| 83 | have hv : fderiv ℝ E z (W i, 0) = G.toLExponentialFamily.sliceDifferential z.1 τ (W i) := by |
| 84 | rw [endpointCoordinates_horizontal G q z hz hq, |
| 85 | TangentBundle.continuousLinearMapAt_trivializationAt hq, mfderiv_extChartAt_self] |
| 86 | rfl |
| 87 | have hd' : deriv (fun s ↦ A s i i) τ = |
| 88 | 2 * (F.connection (T - τ)).ricci q (fderiv ℝ E z (W i, 0)) (fderiv ℝ E z (W i, 0)) + |
| 89 | 2 * (F.connection (T - τ)).hessian (fun y ↦ reducedLength F T p y τ) q |
| 90 | (fderiv ℝ E z (W i, 0)) (fderiv ℝ E z (W i, 0)) := hd.deriv |
| 91 | rw [hv] at hd' |
| 92 | exact hd' |
| 93 | |
| 94 | end PoincareMT.ReducedVolume |