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.ODE.LocalRegularizedEquation |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.ODE.GeometricUniqueness |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.ODE.WithinODEUniqueness |
| 4 | |
| 5 | /-! |
| 6 | # Geometric phase uniqueness including interval endpoints |
| 7 | |
| 8 | The actual coordinate phase satisfies its ODE on the geometric interval. |
| 9 | Within-domain uniqueness retains both position and velocity at endpoints. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | set_option maxHeartbeats 800000 |
| 15 | |
| 16 | open scoped Manifold ContDiff Bundle Topology |
| 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] |
| 25 | |
| 26 | local notation "V" => EuclideanSpace ℝ (Fin n) |
| 27 | |
| 28 | set_option backward.isDefEq.respectTransparency false in |
| 29 | theorem regularizedCurve_phase_eventuallyEqWithin {J : Set ℝ} (F : RicciFlow n M J) |
| 30 | (hM04 : RicciFlowCurvatureTheory.{u}) (T b : ℝ) (hb : 0 < b) |
| 31 | (hwindow : Set.Icc (T - b) T ⊆ J) (γ δ : ℝ → M) |
| 32 | (U K : Set ℝ) (hU : IsOpen U) (hKU : K ⊆ U) |
| 33 | (hK : UniqueDiffOn ℝ K) (hconn : Set.OrdConnected K) |
| 34 | (htime : K ⊆ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 35 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) |
| 36 | (hδ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ δ U) |
| 37 | (Eγ : ParametricAlongCurveExtensionOn (n := n) K γ (curveVelocityWithin (n := n) γ K)) |
| 38 | (Eδ : ParametricAlongCurveExtensionOn (n := n) K δ (curveVelocityWithin (n := n) δ K)) |
| 39 | (heγ : ∀ s ∈ K, regularizedLGeodesicEquation F T γ K Eγ s) |
| 40 | (heδ : ∀ s ∈ K, regularizedLGeodesicEquation F T δ K Eδ s) |
| 41 | (s0 : ℝ) (hs0 : s0 ∈ K) |
| 42 | (hphase : curvePhase (n := n) γ s0 = curvePhase (n := n) δ s0) : |
| 43 | curvePhase (n := n) γ =ᶠ[𝓝[K] s0] curvePhase (n := n) δ := by |
| 44 | let p := γ s0 |
| 45 | let e := chartAt V p |
| 46 | have hbase : γ s0 = δ s0 := congrArg Bundle.TotalSpace.proj hphase |
| 47 | have hvel : (curveVelocity γ s0 : V) = (curveVelocity δ s0 : V) := |
| 48 | congrArg (fun z : TangentBundle (𝓡 n) M ↦ (z.2 : V)) hphase |
| 49 | let W := (U ∩ γ ⁻¹' e.source) ∩ (U ∩ δ ⁻¹' e.source) |
| 50 | have hW : IsOpen W := (hγ.continuousOn.isOpen_inter_preimage hU e.open_source).inter |
| 51 | (hδ.continuousOn.isOpen_inter_preimage hU e.open_source) |
| 52 | have hsW : s0 ∈ W := by |
| 53 | refine ⟨⟨hKU hs0, mem_chart_source V p⟩, hKU hs0, ?_⟩ |
| 54 | change δ s0 ∈ e.source |
| 55 | rw [← hbase] |
| 56 | exact mem_chart_source V p |
| 57 | have hWU : W ⊆ U := fun _ ht ↦ ht.1.1 |
| 58 | have hγd : ∀ t ∈ U, MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) γ t := |
| 59 | fun t ht ↦ (hγ.contMDiffAt (hU.mem_nhds ht)).mdifferentiableAt (by simp) |
| 60 | have hδd : ∀ t ∈ U, MDifferentiableAt (𝓘(ℝ, ℝ)) (𝓡 n) δ t := |
| 61 | fun t ht ↦ (hδ.contMDiffAt (hU.mem_nhds ht)).mdifferentiableAt (by simp) |
| 62 | let a : ℝ → V := fun t ↦ e (γ t) |
| 63 | let c : ℝ → V := fun t ↦ e (δ t) |
| 64 | let f : ℝ → V × V := fun t ↦ (a t, deriv a t) |
| 65 | let g : ℝ → V × V := fun t ↦ (c t, deriv c t) |
| 66 | have ha : ContDiffOn ℝ ∞ a W := |
| 67 | (contMDiffOn_chart.comp (hγ.mono hWU) (fun _ ht ↦ ht.1.2)).contDiffOn |
| 68 | have hc : ContDiffOn ℝ ∞ c W := |
| 69 | (contMDiffOn_chart.comp (hδ.mono hWU) (fun _ ht ↦ ht.2.2)).contDiffOn |
| 70 | have hfsmooth : ContDiffOn ℝ ∞ f W := ha.prodMk (ha.deriv_of_isOpen hW (by simp)) |
| 71 | have hgsmooth : ContDiffOn ℝ ∞ g W := hc.prodMk (hc.deriv_of_isOpen hW (by simp)) |
| 72 | let S : Set (ℝ × (V × V)) := |
| 73 | {z | z.1 ∈ Set.Ioo (-Real.sqrt b) (Real.sqrt b) ∧ z.2.1 ∈ e.target} |
| 74 | let field := regularizedCoordinatePhase (squareChartMetric F T p) (squareChartScalar F T p) |
| 75 | have hS : IsOpen S := (isOpen_Ioo.prod e.open_target).preimage |
| 76 | (continuous_fst.prodMk (continuous_fst.comp continuous_snd)) |
| 77 | have hfield : ContDiffOn ℝ 1 field S := |
| 78 | (regularizedCoordinatePhase_smooth _ _ |
| 79 | (Set.Ioo (-Real.sqrt b) (Real.sqrt b) ×ˢ e.target) |
| 80 | (isOpen_Ioo.prod e.open_target) |
| 81 | (squareChartMetric_smooth F T b hb hwindow p) |
| 82 | (squareChartScalar_smooth F hM04 T b hb hwindow p) |
| 83 | (fun z hz v hv ↦ squareChartMetric_pos F T p z hz.2 v hv)).of_le (by simp) |
| 84 | have hf : ∀ᶠ t in 𝓝[K] s0, (t, f t) ∈ S ∧ HasDerivAt f (field (t, f t)) t := by |
| 85 | filter_upwards [self_mem_nhdsWithin, |
| 86 | mem_nhdsWithin_of_mem_nhds (hW.mem_nhds hsW)] with t htK htW |
| 87 | refine ⟨⟨htime htK, e.map_source htW.1.2⟩, ?_⟩ |
| 88 | exact (regularizedEquation_iff_chart_hasDerivAt F hM04 T b hb hwindow p γ U K |
| 89 | hU hKU hK hγ Eγ t htK (htime htK) htW.1.2).mp (heγ t htK) |
| 90 | have hg : ∀ᶠ t in 𝓝[K] s0, (t, g t) ∈ S ∧ HasDerivAt g (field (t, g t)) t := by |
| 91 | filter_upwards [self_mem_nhdsWithin, |
| 92 | mem_nhdsWithin_of_mem_nhds (hW.mem_nhds hsW)] with t htK htW |
| 93 | refine ⟨⟨htime htK, e.map_source htW.2.2⟩, ?_⟩ |
| 94 | exact (regularizedEquation_iff_chart_hasDerivAt F hM04 T b hb hwindow p δ U K |
| 95 | hU hKU hK hδ Eδ t htK (htime htK) htW.2.2).mp (heδ t htK) |
| 96 | have h0 : f s0 = g s0 := by |
| 97 | apply Prod.ext |
| 98 | · exact congrArg e hbase |
| 99 | · change deriv a s0 = deriv c s0 |
| 100 | rw [(hasDerivAt_chart_curve p γ s0 hsW.1.2 (hγd s0 (hKU hs0))).deriv, |
| 101 | (hasDerivAt_chart_curve p δ s0 hsW.2.2 (hδd s0 (hKU hs0))).deriv] |
| 102 | exact congrArg₂ (fun (q : M) (v : V) ↦ (mfderiv (𝓡 n) (𝓡 n) e q) v) hbase hvel |
| 103 | have hfg := openODE_eventuallyEqWithin S hS field hfield K hconn f g s0 hs0 |
| 104 | ⟨htime hs0, e.map_source hsW.1.2⟩ h0 |
| 105 | (hfsmooth.continuousOn.continuousAt (hW.mem_nhds hsW)).continuousWithinAt |
| 106 | (hgsmooth.continuousOn.continuousAt (hW.mem_nhds hsW)).continuousWithinAt hf hg |
| 107 | filter_upwards [hfg, mem_nhdsWithin_of_mem_nhds (hW.mem_nhds hsW)] with t ht htW |
| 108 | have hx : γ t = δ t := e.injOn htW.1.2 htW.2.2 (congrArg Prod.fst ht) |
| 109 | have hva := chartVectorField_coordinate_velocity p γ t (deriv a t) htW.1.2 |
| 110 | (hγd t (hWU htW)) ((ha.contDiffAt (hW.mem_nhds htW)).differentiableAt (by simp)).hasDerivAt |
| 111 | have hvc := chartVectorField_coordinate_velocity p δ t (deriv c t) htW.2.2 |
| 112 | (hδd t (hWU htW)) ((hc.contDiffAt (hW.mem_nhds htW)).differentiableAt (by simp)).hasDerivAt |
| 113 | have hv : (curveVelocity γ t : V) = (curveVelocity δ t : V) := |
| 114 | hva.symm.trans ((congrArg₂ (fun (q : M) (v : V) ↦ (chartVectorField p v q : V)) |
| 115 | hx (congrArg Prod.snd ht)).trans hvc) |
| 116 | exact Bundle.TotalSpace.ext hx (heq_of_eq hv) |
| 117 | |
| 118 | theorem regularizedCurve_phase_eqOn_preconnected {J : Set ℝ} [T2Space M] |
| 119 | (F : RicciFlow n M J) (hM04 : RicciFlowCurvatureTheory.{u}) |
| 120 | (T b : ℝ) (hb : 0 < b) (hwindow : Set.Icc (T - b) T ⊆ J) |
| 121 | (γ δ : ℝ → M) (U K : Set ℝ) (hU : IsOpen U) (hKU : K ⊆ U) |
| 122 | (hK : UniqueDiffOn ℝ K) (hconn : IsPreconnected K) |
| 123 | (htime : K ⊆ Set.Ioo (-Real.sqrt b) (Real.sqrt b)) |
| 124 | (hγ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ U) |
| 125 | (hδ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ δ U) |
| 126 | (Eγ : ParametricAlongCurveExtensionOn (n := n) K γ (curveVelocityWithin (n := n) γ K)) |
| 127 | (Eδ : ParametricAlongCurveExtensionOn (n := n) K δ (curveVelocityWithin (n := n) δ K)) |
| 128 | (heγ : ∀ s ∈ K, regularizedLGeodesicEquation F T γ K Eγ s) |
| 129 | (heδ : ∀ s ∈ K, regularizedLGeodesicEquation F T δ K Eδ s) |
| 130 | (s0 : ℝ) (hs0 : s0 ∈ K) |
| 131 | (hphase : curvePhase (n := n) γ s0 = curvePhase (n := n) δ s0) : |
| 132 | Set.EqOn (curvePhase (n := n) γ) (curvePhase (n := n) δ) K := by |
| 133 | let : T2Space (TangentBundle (𝓡 n) M) := tangentBundle_t2Space |
| 134 | let : PreconnectedSpace K := isPreconnected_iff_preconnectedSpace.mp hconn |
| 135 | let A : Set K := {s | curvePhase (n := n) γ s = curvePhase (n := n) δ s} |
| 136 | have hclosed : IsClosed A := isClosed_eq |
| 137 | ((curvePhase_contMDiffOn γ U hU hγ).continuousOn.mono hKU).domRestrict |
| 138 | ((curvePhase_contMDiffOn δ U hU hδ).continuousOn.mono hKU).domRestrict |
| 139 | have hopen : IsOpen A := by |
| 140 | apply isOpen_iff_mem_nhds.mpr |
| 141 | intro t ht |
| 142 | have hlocal := regularizedCurve_phase_eventuallyEqWithin F hM04 T b hb hwindow |
| 143 | γ δ U K hU hKU hK hconn.ordConnected htime hγ hδ Eγ Eδ heγ heδ t t.property ht |
| 144 | exact (eventually_nhds_subtype_iff K t |
| 145 | (fun r ↦ curvePhase (n := n) γ r = curvePhase (n := n) δ r)).mpr hlocal |
| 146 | have hAll : A = Set.univ := IsClopen.eq_univ ⟨hclosed, hopen⟩ ⟨⟨s0, hs0⟩, hphase⟩ |
| 147 | intro t ht |
| 148 | have hm : (⟨t, ht⟩ : K) ∈ A := by rw [hAll]; trivial |
| 149 | exact hm |
| 150 | |
| 151 | end PoincareMT.ReducedLength |