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.Geometry.BackwardNesting |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Geometry.BoundedMinimizingVectors |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Geometry.MinimizingInitialVectors |
| 4 | import Mathlib.Topology.Order.DenselyOrdered |
| 5 | |
| 6 | /-! |
| 7 | # Density of regular endpoints at a fixed time |
| 8 | |
| 9 | Minimizers to slightly later times have uniformly bounded initial vectors. |
| 10 | A compactness argument places their regular prefixes in every open set. |
| 11 | -/ |
| 12 | |
| 13 | set_option autoImplicit false |
| 14 | set_option maxSynthPendingDepth 3 |
| 15 | set_option maxHeartbeats 800000 |
| 16 | |
| 17 | open scoped Manifold ContDiff Bundle Topology |
| 18 | open Filter |
| 19 | |
| 20 | universe u |
| 21 | |
| 22 | namespace PoincareMT.ReducedLength |
| 23 | |
| 24 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 25 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 26 | [ConnectedSpace M] [T3Space M] [SecondCountableTopology M] |
| 27 | |
| 28 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem lExponentialFamily_dense_regular_endpoints {J : Set ℝ} |
| 30 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 31 | (T τmax : ℝ) (hτmax : 0 < τmax) (hwindow : Set.Icc (T - τmax) T ⊆ J) |
| 32 | (hcurvature : CompleteBoundedCurvatureOn F (Set.Icc (T - τmax) T)) |
| 33 | (hL : LGeodesicTheory F T τmax) (p : M) (A : LExponentialFamily F T τmax p) |
| 34 | (t : ℝ) (ht : 0 < t) (hmax : t < τmax) : |
| 35 | Dense {q : M | ∃ Z : TangentSpace (𝓡 n) p, |
| 36 | (Z, t) ∈ A.regularDomain ∧ A.gamma Z t = q} := by |
| 37 | letI : Bundle.RiemannianBundle (TangentSpace (𝓡 n) : M → Type _) := |
| 38 | ⟨(F.metric T).toRiemannianMetric⟩ |
| 39 | let E := TangentSpace (𝓡 n) p |
| 40 | letI : FiniteDimensional ℝ E := |
| 41 | VectorBundle.finiteDimensional ℝ (EuclideanSpace ℝ (Fin n)) |
| 42 | (TangentSpace (𝓡 n) : M → Type _) p |
| 43 | apply dense_iff_inter_open.mpr |
| 44 | intro O hO hOne |
| 45 | obtain ⟨q, hq⟩ := hOne |
| 46 | obtain ⟨b, htb, hbmax⟩ := exists_between hmax |
| 47 | let Q := ({q} : Set M) ×ˢ Set.Icc t b |
| 48 | have hQ : IsCompact Q := isCompact_singleton.prod isCompact_Icc |
| 49 | have hQt : Q ⊆ Set.univ ×ˢ Set.Ioo 0 τmax := fun z hz ↦ |
| 50 | ⟨Set.mem_univ _, ht.trans_le hz.2.1, hz.2.2.trans_lt hbmax⟩ |
| 51 | obtain ⟨R, _, hR⟩ := lExponentialFamily_minimizing_initial_bounded F hM04 T τmax hτmax |
| 52 | hwindow hcurvature hL p A Q hQ hQt |
| 53 | let K := Metric.closedBall (0 : E) R |
| 54 | have hK : IsCompact K := isCompact_closedBall _ _ |
| 55 | have hnear : ∀ᶠ s in 𝓝 t, ∀ Z ∈ K, A.gamma Z t ∈ O ∨ A.gamma Z s ≠ q := by |
| 56 | apply hK.eventually_forall_of_forall_eventually |
| 57 | intro Z _ |
| 58 | have hγ : ContinuousAt (fun z : E × ℝ ↦ A.gamma z.1 z.2) (Z, t) := |
| 59 | (A.gamma_smooth.contMDiffAt ((isOpen_univ.prod isOpen_Ioo).mem_nhds |
| 60 | ⟨Set.mem_univ _, ht, hmax⟩)).continuousAt |
| 61 | have hfixed : ContinuousAt (fun z : ℝ × E ↦ A.gamma z.2 t) (t, Z) := |
| 62 | ContinuousAt.comp (x := (t, Z)) (f := fun z : ℝ × E ↦ (z.2, t)) hγ |
| 63 | ((continuous_snd.prodMk continuous_const).continuousAt) |
| 64 | have hvary : ContinuousAt (fun z : ℝ × E ↦ A.gamma z.2 z.1) (t, Z) := |
| 65 | ContinuousAt.comp (x := (t, Z)) (f := fun z : ℝ × E ↦ (z.2, z.1)) hγ |
| 66 | ((continuous_snd.prodMk continuous_fst).continuousAt) |
| 67 | by_cases hmem : A.gamma Z t ∈ O |
| 68 | · filter_upwards [hfixed.preimage_mem_nhds (hO.mem_nhds hmem)] with z hz |
| 69 | exact Or.inl hz |
| 70 | · have hne : A.gamma Z t ≠ q := by |
| 71 | intro heq |
| 72 | exact hmem (heq.symm ▸ hq) |
| 73 | filter_upwards [hvary.eventually_ne hne] with z hz |
| 74 | exact Or.inr hz |
| 75 | obtain ⟨s, ⟨hsnear, hsb⟩, hts⟩ := nonempty_nhds_inter_Ioi |
| 76 | (hnear.and (isOpen_Iio.mem_nhds htb)) (not_isMax t) |
| 77 | have hs : 0 < s := ht.trans hts |
| 78 | have hsmax : s < τmax := hsb.trans hbmax |
| 79 | obtain ⟨Z, hend, hmin⟩ := lExponentialFamily_exists_minimizing_initialVector |
| 80 | hM04 hL hτmax hwindow A s hs hsmax q |
| 81 | have hendpoint : (A.gamma Z s, s) ∈ Q := by |
| 82 | exact ⟨Set.mem_singleton_iff.mpr hend, hts.le, hsb.le⟩ |
| 83 | have hnorm : ‖Z‖ ≤ R := by |
| 84 | rw [norm_eq_sqrt_real_inner] |
| 85 | exact hR Z s hs hsmax hendpoint hmin |
| 86 | have hZ : Z ∈ K := by |
| 87 | simpa only [K, Metric.mem_closedBall, dist_zero_right] using hnorm |
| 88 | have hOZ : A.gamma Z t ∈ O := (hsnear Z hZ).resolve_right (not_not_intro hend) |
| 89 | exact ⟨A.gamma Z t, hOZ, Z, |
| 90 | lExponentialFamily_regularDomain_strict_prefix hM04 hL hτmax hwindow A Z t s ht hts hsmax hmin, |
| 91 | rfl⟩ |
| 92 | |
| 93 | end PoincareMT.ReducedLength |