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.Splitting.KernelTransport |
| 2 | import Mathlib.Topology.Order.IntermediateValue |
| 3 | |
| 4 | /-! |
| 5 | # Kernel transport across changes of rank |
| 6 | |
| 7 | Upper semicontinuity of kernel dimension gives constant rank just to the left |
| 8 | of every time in a family with nonincreasing nullity. Continuous induction |
| 9 | therefore extends temporal kernel transport across all rank changes. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter |
| 15 | open scoped Topology |
| 16 | |
| 17 | namespace Poincare.RicciFlow.Splitting |
| 18 | |
| 19 | variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] |
| 20 | [FiniteDimensional ℝ E] |
| 21 | |
| 22 | lemma eventually_finrank_kernel_le |
| 23 | {X : Type*} [TopologicalSpace X] {A : X → E →L[ℝ] E} {S : Set X} {p : X} |
| 24 | (hA : ContinuousWithinAt A S p) (hsym : (A p).toLinearMap.IsSymmetric) : |
| 25 | ∀ᶠ q in 𝓝[S] p, Module.finrank ℝ (A q).ker ≤ Module.finrank ℝ (A p).ker := by |
| 26 | let K := (A p).ker |
| 27 | have hB : (A p + K.starProjection).IsInvertible := |
| 28 | isInvertible_add_kernel_projection (A p) hsym |
| 29 | have hnear : ∀ᶠ q in 𝓝[S] p, IsUnit (A q + K.starProjection) := |
| 30 | (hA.add_const K.starProjection).eventually |
| 31 | (Units.isOpen.mem_nhds (ContinuousLinearMap.isUnit_iff_bijective.mpr hB.bijective)) |
| 32 | filter_upwards [hnear] with q hq |
| 33 | let L : (A q).ker →ₗ[ℝ] K := |
| 34 | K.orthogonalProjectionOnto.toLinearMap.comp (A q).ker.subtype |
| 35 | apply LinearMap.finrank_le_finrank_of_injective (f := L) |
| 36 | intro v w hvw |
| 37 | apply Subtype.ext |
| 38 | apply (ContinuousLinearMap.isUnit_iff_bijective.mp hq).1 |
| 39 | change A q v + K.starProjection v = A q w + K.starProjection w |
| 40 | rw [show A q v = 0 from v.property, show A q w = 0 from w.property, zero_add, zero_add] |
| 41 | exact congrArg Subtype.val hvw |
| 42 | |
| 43 | /-- Kernel vectors at a later time remain null at every earlier time, even |
| 44 | when the kernel dimension changes. -/ |
| 45 | theorem kernel_antitone_of_derivative_annihilates |
| 46 | {A D : ℝ → E →L[ℝ] E} {a b : ℝ} |
| 47 | (hA : ∀ t ∈ Icc a b, HasDerivWithinAt A (D t) (Icc a b) t) |
| 48 | (hsym : ∀ t ∈ Icc a b, (A t).toLinearMap.IsSymmetric) |
| 49 | (hdim : AntitoneOn (fun t => Module.finrank ℝ (A t).ker) (Icc a b)) |
| 50 | (hann : ∀ t ∈ Icc a b, ∀ v, A t v = 0 → D t v = 0) : |
| 51 | AntitoneOn (fun t => (A t).ker) (Icc a b) := by |
| 52 | have hlocal (t : ℝ) (ht : t ∈ Icc a b) : |
| 53 | ∃ r > 0, ∀ s ∈ Icc a t, t - r < s → (A s).ker = (A t).ker := by |
| 54 | have hnear := eventually_finrank_kernel_le (hA t ht).continuousWithinAt (hsym t ht) |
| 55 | obtain ⟨r, hr, hrad⟩ := Metric.mem_nhdsWithin_iff.mp hnear |
| 56 | refine ⟨r, hr, ?_⟩ |
| 57 | intro s hs hst |
| 58 | by_cases heq : s = t |
| 59 | · simp [heq] |
| 60 | have hlt : s < t := lt_of_le_of_ne hs.2 heq |
| 61 | have hsub : Icc s t ⊆ Icc a b := Icc_subset_Icc hs.1 ht.2 |
| 62 | apply kernel_eq_of_derivative_annihilates (k := Module.finrank ℝ (A t).ker) |
| 63 | (convex_Icc s t) (uniqueDiffOn_Icc hlt) |
| 64 | (fun q hq => (hA q (hsub hq)).mono hsub) |
| 65 | (fun q hq => hsym q (hsub hq)) _ (fun q hq => hann q (hsub hq)) |
| 66 | (left_mem_Icc.mpr hs.2) (right_mem_Icc.mpr hs.2) |
| 67 | intro q hq |
| 68 | apply le_antisymm |
| 69 | · apply hrad |
| 70 | refine ⟨?_, hsub hq⟩ |
| 71 | rw [Metric.mem_ball, Real.dist_eq, abs_of_nonpos (sub_nonpos.mpr hq.2)] |
| 72 | linarith [hq.1] |
| 73 | · exact hdim (hsub hq) ht hq.2 |
| 74 | intro s hs t ht hst v hv |
| 75 | let S := {q : ℝ | A q v = 0} |
| 76 | have hcont : ContinuousOn (fun q => A q v) (Icc s t) := |
| 77 | fun q hq => ((hA q (Icc_subset_Icc hs.1 ht.2 hq)).continuousWithinAt.clm_apply |
| 78 | continuousWithinAt_const).mono (Icc_subset_Icc hs.1 ht.2) |
| 79 | have hclosed : IsClosed (S ∩ Icc s t) := by |
| 80 | obtain ⟨C, hC, heq⟩ := continuousOn_iff_isClosed.mp hcont {0} isClosed_singleton |
| 81 | change IsClosed (((fun q => A q v) ⁻¹' {0}) ∩ Icc s t) |
| 82 | rw [heq] |
| 83 | exact hC.inter isClosed_Icc |
| 84 | apply hclosed.mem_of_ge_of_forall_exists_lt hv hst |
| 85 | intro q hq |
| 86 | obtain ⟨r, hr, hrad⟩ := hlocal q ⟨hs.1.trans hq.2.1.le, hq.2.2.trans ht.2⟩ |
| 87 | obtain ⟨z, hz₁, hz₂⟩ := exists_between (max_lt hq.2.1 (sub_lt_self q hr)) |
| 88 | refine ⟨z, ?_, le_of_lt ((le_max_left s (q - r)).trans_lt hz₁), hz₂⟩ |
| 89 | change v ∈ (A z).ker |
| 90 | rw [hrad z ⟨hs.1.trans (le_max_left s (q - r) |>.trans hz₁.le), hz₂.le⟩ |
| 91 | ((le_max_right s (q - r)).trans_lt hz₁)] |
| 92 | exact hq.1 |
| 93 | |
| 94 | end Poincare.RicciFlow.Splitting |