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.Variation.Differential.VariationAction |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Variation.Differential.VariationSecondBoundary |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Tensor.HessianCurveChainRule |
| 4 | |
| 5 | /-! |
| 6 | # Exact Hessians from an actual variation action germ |
| 7 | |
| 8 | The endpoint acceleration is retained in both second derivatives and |
| 9 | cancels by the spatial covector identity, for the same derivative witness. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | open Filter |
| 17 | |
| 18 | universe u |
| 19 | |
| 20 | namespace PoincareMT.ReducedLength |
| 21 | |
| 22 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 23 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] |
| 24 | [IsManifold (𝓡 n) ∞ M] [ConnectedSpace M] |
| 25 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 26 | |
| 27 | set_option maxHeartbeats 1000000 in |
| 28 | -- Twice differentiating the genuine scalar germ preserves the endpoint acceleration. |
| 29 | set_option backward.isDefEq.respectTransparency false in |
| 30 | theorem lExponentialFamily_hessian_eq_variation_index |
| 31 | (hM04 : RicciFlowCurvatureTheory.{u}) (hL : LGeodesicTheory F T τmax) |
| 32 | (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 33 | (A : LExponentialFamily F T τmax p) (Z : TangentSpace (𝓡 n) p) |
| 34 | (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 35 | (hmin : IsMinimizingBackwardLPath F T 0 b (A.path Z b hb hmax)) |
| 36 | (f : M → ℝ) (O : Set M) (hO : IsOpen O) (hqO : A.gamma Z b ∈ O) |
| 37 | (hf : ContMDiffOn (𝓡 n) (𝓘(ℝ, ℝ)) ∞ f O) |
| 38 | (hdf : ∀ v : TangentSpace (𝓡 n) (A.gamma Z b), |
| 39 | mvfderiv (𝓡 n) f (A.gamma Z b) v = |
| 40 | (F.metric (T - b)).inner (A.gamma Z b) (curveVelocity (A.gamma Z) b) v) |
| 41 | (V : InitialFixedLVariation F T 0 b (A.path Z b hb hmax)) |
| 42 | (hbase : V.toLVariation.baseSquareCurve = A.squareFamily Z) |
| 43 | (hpull : (fun u ↦ f (V.squareFamily (Real.sqrt b) u)) =ᶠ[𝓝 (0 : ℝ)] |
| 44 | (fun u ↦ variationLLength V.toLVariation u / (2 * Real.sqrt b))) : |
| 45 | ∃ D : LVariationDerivativeData V.toLVariation, |
| 46 | (F.connection (T - b)).hessian f (A.gamma Z b) |
| 47 | (squareVariationField V.toLVariation (Real.sqrt b)) |
| 48 | (squareVariationField V.toLVariation (Real.sqrt b)) = |
| 49 | secondVariationIndexForm V.toLVariation D / (2 * Real.sqrt b) := by |
| 50 | let c := Real.sqrt b |
| 51 | have hc : 0 < c := Real.sqrt_pos.mpr hb |
| 52 | have hc2 : c ^ 2 = b := Real.sq_sqrt hb.le |
| 53 | have hcK : c ∈ sqrtParameterInterval 0 b := ⟨Real.sqrt_le_sqrt hb.le, le_rfl⟩ |
| 54 | let I := V.toLVariation.parameterDomain |
| 55 | have hI : IsOpen I := isOpen_Ioo |
| 56 | have h0I : (0 : ℝ) ∈ I := ⟨neg_lt_zero.mpr V.radius_pos, V.radius_pos⟩ |
| 57 | let η := V.squareFamily c |
| 58 | let S := variationLLength V.toLVariation |
| 59 | let g : ℝ → ℝ := fun u ↦ f (η u) |
| 60 | have hη : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ η I := |
| 61 | variation_endpoint_contMDiffOn V.toLVariation c hcK |
| 62 | have hη0 : η 0 = A.gamma Z b := by |
| 63 | change V.toLVariation.baseSquareCurve c = A.gamma Z b |
| 64 | rw [hbase, A.square_agrees Z c ⟨hc.le, Real.sqrt_lt_sqrt hb.le hmax⟩, hc2] |
| 65 | have hS : ContDiffAt ℝ ∞ S 0 := |
| 66 | variationLLength_contDiffAt hM04 hτmax hwindow hb hmax V.toLVariation 0 h0I |
| 67 | have hg : ContDiffAt ℝ ∞ g 0 := |
| 68 | ((hf.contMDiffAt (hO.mem_nhds (hη0.symm ▸ hqO))).comp 0 |
| 69 | (hη.contMDiffAt (hI.mem_nhds h0I))).contDiffAt |
| 70 | obtain ⟨D, Q, hQ, hQeq⟩ := hL.second_variation 0 b le_rfl hb hmax.le |
| 71 | (A.path Z b hb hmax) (hL.euler_lagrange 0 b le_rfl hb hmax.le _ hmin) V.toLVariation |
| 72 | have hchain := secondDeriv_comp_eq_hessian_add_acceleration F (T - c ^ 2) η I hI hη |
| 73 | (D.endpoint_extension c hcK) 0 h0I f O hO (hη0.symm ▸ hqO) hf |
| 74 | change deriv (deriv g) 0 = |
| 75 | (F.connection (T - c ^ 2)).hessian f (η 0) |
| 76 | (squareVariationField V.toLVariation c) (squareVariationField V.toLVariation c) + |
| 77 | mvfderiv (𝓡 n) f (η 0) (variationEndpointAcceleration V.toLVariation D c hcK) at hchain |
| 78 | rw [hc2, hη0, hdf] at hchain |
| 79 | have hscaled : S =ᶠ[𝓝 (0 : ℝ)] (fun u ↦ (2 * c) * g u) := by |
| 80 | filter_upwards [hpull] with u hu |
| 81 | change g u = S u / (2 * c) at hu |
| 82 | rw [hu, mul_div_cancel₀ _ (mul_pos zero_lt_two hc).ne'] |
| 83 | have hgd : HasDerivAt (deriv g) (deriv (deriv g) 0) 0 := |
| 84 | ((hg.derivWithin (m := ∞) (by simp)).differentiableAt (by simp)).hasDerivAt |
| 85 | have hgn : ∀ᶠ u in 𝓝 (0 : ℝ), DifferentiableAt ℝ g u := |
| 86 | ((hg.of_le (show (1 : ℕ∞ω) ≤ ∞ by simp)).eventually (by simp)).mono |
| 87 | (fun u hu ↦ hu.differentiableAt (by simp)) |
| 88 | have hderivscaled : (fun u ↦ (2 * c) * deriv g u) =ᶠ[𝓝 (0 : ℝ)] |
| 89 | deriv (fun u ↦ (2 * c) * g u) := by |
| 90 | filter_upwards [hgn] with u hu |
| 91 | exact (hu.hasDerivAt.const_mul (2 * c)).deriv.symm |
| 92 | have hsecond : HasDerivAt (deriv S) ((2 * c) * deriv (deriv g) 0) 0 := |
| 93 | (hgd.const_mul (2 * c)).congr_of_eventuallyEq (hscaled.deriv.trans hderivscaled.symm) |
| 94 | have hactual := hQ.unique hsecond |
| 95 | rw [hQeq, hchain, |
| 96 | lExponentialFamily_initialFixedVariation_secondBoundary A Z b hb hmax V D hbase] at hactual |
| 97 | refine ⟨D, (eq_div_iff (mul_pos zero_lt_two hc).ne').mpr ?_⟩ |
| 98 | nlinarith |
| 99 | |
| 100 | end PoincareMT.ReducedLength |