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.Curvature.Calculus |
| 2 | import PoincareLib.Geometry.RicciFlow.Harnack.Matrix.Positivity.PerturbedTimeContact |
| 3 | import PoincareLib.Geometry.RicciFlow.Harnack.Noncompact.Barriers |
| 4 | |
| 5 | /-! |
| 6 | # Strict ordinary-time contact for the Hamilton barriers |
| 7 | |
| 8 | The explicit reciprocal-time exhaustion perturbation and exponential two-form |
| 9 | perturbation give a positive ordinary derivative at every nonzero null direction. |
| 10 | This is the strict-contact step of Chow et al., Part II, Section 15.4.5, |
| 11 | printed p. 287, using the scalar barriers of Lemma 15.23, printed p. 283. |
| 12 | -/ |
| 13 | |
| 14 | set_option autoImplicit false |
| 15 | set_option backward.isDefEq.respectTransparency false |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle BigOperators Topology |
| 18 | |
| 19 | universe u |
| 20 | |
| 21 | namespace Poincare.RicciFlow.Harnack |
| 22 | |
| 23 | open PoincareMT |
| 24 | |
| 25 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 26 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 27 | [T2Space M] {J : Set ℝ} {F : RicciFlow n M J} {O : M} |
| 28 | |
| 29 | /-- At a nonzero null direction of the perturbed Hamilton block, the scalar |
| 30 | barriers dominate all geometric reaction and prescribed-jet errors. -/ |
| 31 | theorem deriv_perturbedHamiltonFixedQuadratic_pos |
| 32 | (hC : RicciFlowCurvatureCalculus.{u}) (S : RicciFlow.SmoothExhaustion F O) |
| 33 | {t K T ε δ A : ℝ} (ht : t ∈ interior J) (htpos : 0 < t) |
| 34 | (hT : t ≤ T) (hK : 0 ≤ K) (x : M) |
| 35 | (hbound : ∀ j ≤ 2, (F.connection t).curvatureDerivativeNorm j x ≤ K) |
| 36 | (hε : 0 < ε) (hδ : 0 < δ) |
| 37 | (hA : hamiltonPerturbationErrorBound n K T + (n : ℝ) * S.bound < A) |
| 38 | (hsmall : hamiltonPerturbationErrorBound n K T * δ ≤ ε) |
| 39 | (hψone : δ * Real.exp (A * t) ≤ 1) |
| 40 | (U : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → |
| 41 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 42 | (W : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) x)) → ℝ) |
| 43 | (hU : ∀ a c, U a c = -U c a) |
| 44 | (hnonzero : Real.sqrt (∑ a, ∑ c, (U a c) ^ 2) ≠ 0 ∨ |
| 45 | Real.sqrt (∑ a, (W a) ^ 2) ≠ 0) |
| 46 | (hQ : ∀ᶠ y in 𝓝 x, let b := (F.metric t).orthonormalBasis y |
| 47 | (Matrix.fromBlocks |
| 48 | (fun ac de : Fin (Module.finrank ℝ (TangentSpace (𝓡 n) y)) × |
| 49 | Fin (Module.finrank ℝ (TangentSpace (𝓡 n) y)) => |
| 50 | (F.connection t).curvatureTensor y (b ac.1) (b ac.2) (b de.1) (b de.2) + |
| 51 | (δ * Real.exp (A * t)) * twoFormIdentity ac.1 ac.2 de.1 de.2) |
| 52 | (fun ac d => hamiltonP (F.connection t) y (b ac.1) (b ac.2) (b d)) |
| 53 | (fun c de => hamiltonP (F.connection t) y (b de.1) (b de.2) (b c)) |
| 54 | (fun a c => hamiltonM (F.connection t) t y (b a) (b c) + |
| 55 | (ε * Real.exp (A * t) * S.toFun y / t) * (if a = c then 1 else 0))).PosSemidef) |
| 56 | (hnull : perturbedHamiltonFixedQuadratic F 0 t x |
| 57 | (fun s y => ε * Real.exp (A * s) * S.toFun y / s) |
| 58 | (fun s => δ * Real.exp (A * s)) U W t = 0) : |
| 59 | 0 < deriv (perturbedHamiltonFixedQuadratic F 0 t x |
| 60 | (fun s y => ε * Real.exp (A * s) * S.toFun y / s) |
| 61 | (fun s => δ * Real.exp (A * s)) U W) t := by |
| 62 | have hαtime := ((S.hasDerivAt_exp_mul ε A t x).div |
| 63 | (hasDerivAt_id t) htpos.ne').differentiableAt |
| 64 | have hψtime := (((hasDerivAt_id t).const_mul A).exp.const_mul δ).differentiableAt |
| 65 | have hαspace : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 66 | (fun y => ε * Real.exp (A * t) * S.toFun y / t) := by |
| 67 | simpa only [mul_div_right_comm, Pi.mul_apply] using! |
| 68 | (contMDiff_const.mul S.smooth : ContMDiff (𝓡 n) 𝓘(ℝ, ℝ) ∞ |
| 69 | (fun y => (ε * Real.exp (A * t) / t) * S.toFun y)) |
| 70 | have hα : 0 ≤ ε * Real.exp (A * t) * S.toFun x / t := |
| 71 | div_nonneg (mul_nonneg (mul_nonneg hε.le (Real.exp_nonneg _)) |
| 72 | (zero_le_one.trans (S.one_le x))) htpos.le |
| 73 | have hd := deriv_perturbedHamiltonFixedQuadratic_ge_of_bound hC F 0 |
| 74 | ht (by simpa using htpos) (by simpa using hT) hK x hbound |
| 75 | (fun s y => ε * Real.exp (A * s) * S.toFun y / s) |
| 76 | (fun s => δ * Real.exp (A * s)) hαtime hψtime hαspace |
| 77 | hα (mul_nonneg hδ.le (Real.exp_nonneg _)) hψone U W hU |
| 78 | (by simpa only [sub_zero] using hQ) hnull |
| 79 | have hs := S.exp_mul_div_quadratic_heat_gt hε hδ hA |
| 80 | (interior_subset ht) htpos hsmall hnonzero x |
| 81 | simp only [Real.sq_sqrt (Finset.sum_nonneg (fun a _ => sq_nonneg (W a))), |
| 82 | Real.sq_sqrt (Finset.sum_nonneg (fun a _ => |
| 83 | Finset.sum_nonneg (fun c _ => sq_nonneg (U a c))))] at hs |
| 84 | exact hs.trans_le (by simpa only [sub_zero] using hd) |
| 85 | |
| 86 | end Poincare.RicciFlow.Harnack |