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.Barrier.SmoothChartJoin |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Barrier.SquareComparisonDensity |
| 3 | |
| 4 | /-! |
| 5 | # Uniform action bounds for the smooth join |
| 6 | |
| 7 | One compact coordinate ball contains every interpolated position. A single |
| 8 | velocity bound gives a compact phase set and hence a uniform density bound. |
| 9 | -/ |
| 10 | |
| 11 | set_option autoImplicit false |
| 12 | set_option maxSynthPendingDepth 3 |
| 13 | set_option maxHeartbeats 800000 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle Topology |
| 16 | |
| 17 | universe u |
| 18 | |
| 19 | namespace PoincareMT.ReducedLength |
| 20 | |
| 21 | variable {n : ℕ} {M : Type u} [TopologicalSpace M] |
| 22 | [ChartedSpace (EuclideanSpace ℝ (Fin n)) M] [IsManifold (𝓡 n) ∞ M] |
| 23 | |
| 24 | local notation "E" => EuclideanSpace ℝ (Fin n) |
| 25 | |
| 26 | theorem exists_smoothJoin_uniform_density {J : Set ℝ} (F : RicciFlow n M J) |
| 27 | (hM04 : RicciFlowCurvatureTheory.{u}) (T τmax : ℝ) (hτmax : 0 < τmax) |
| 28 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (α β : ℝ → M) (D : Set ℝ) |
| 29 | (hD : IsOpen D) (hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ α D) |
| 30 | (hβ : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ β D) |
| 31 | (htime : D ⊆ Set.Ioo (-Real.sqrt τmax) (Real.sqrt τmax)) |
| 32 | (b c : ℝ) (hI : Set.Icc 0 b ⊆ D) (hc : c ∈ Set.Ioo 0 b) (heq : α c = β c) : |
| 33 | ∃ r : ℝ, 0 < r ∧ r < c ∧ c + r < b ∧ ∃ C : ℝ, 0 ≤ C ∧ |
| 34 | ∀ d, 0 < d → d < r → ∃ γ : ℝ → M, |
| 35 | ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ γ D ∧ |
| 36 | Set.EqOn γ α (Set.Iic (c - d)) ∧ Set.EqOn γ β (Set.Ici (c + d)) ∧ |
| 37 | ∀ s ∈ Set.Icc (c - d) (c + d), |
| 38 | |squareCurveActionDensity F T α s| ≤ C ∧ |
| 39 | |squareCurveActionDensity F T β s| ≤ C ∧ |
| 40 | |squareCurveActionDensity F T γ s| ≤ C := by |
| 41 | let p := α c |
| 42 | let e := chartAt E p |
| 43 | let y := e p |
| 44 | have hyp : y ∈ e.target := e.map_source (mem_chart_source E p) |
| 45 | obtain ⟨R, hR, hRK⟩ := Metric.nhds_basis_closedBall.mem_iff.mp (e.open_target.mem_nhds hyp) |
| 46 | let K := Metric.closedBall y R |
| 47 | have hK : IsCompact K := isCompact_closedBall y R |
| 48 | have hKt : K ⊆ e.target := hRK |
| 49 | let W := (D ∩ α ⁻¹' e.source) ∩ (D ∩ β ⁻¹' e.source) |
| 50 | have hW : IsOpen W := (hα.continuousOn.isOpen_inter_preimage hD e.open_source).inter |
| 51 | (hβ.continuousOn.isOpen_inter_preimage hD e.open_source) |
| 52 | have hcD : c ∈ D := hI (Set.Ioo_subset_Icc_self hc) |
| 53 | have hcW : c ∈ W := by |
| 54 | refine ⟨⟨hcD, mem_chart_source E p⟩, hcD, ?_⟩ |
| 55 | change β c ∈ e.source |
| 56 | rw [← heq] |
| 57 | exact mem_chart_source E p |
| 58 | let f : ℝ → E := fun s ↦ e (α s) |
| 59 | let g : ℝ → E := fun s ↦ e (β s) |
| 60 | have hf : ContDiffOn ℝ ∞ f W := |
| 61 | (contMDiffOn_chart.comp (hα.mono (fun _ hs ↦ hs.1.1)) (fun _ hs ↦ hs.1.2)).contDiffOn |
| 62 | have hg : ContDiffOn ℝ ∞ g W := |
| 63 | (contMDiffOn_chart.comp (hβ.mono (fun _ hs ↦ hs.2.1)) (fun _ hs ↦ hs.2.2)).contDiffOn |
| 64 | let V := (W ∩ f ⁻¹' Metric.ball y R) ∩ ((W ∩ g ⁻¹' Metric.ball y R) ∩ Set.Ioo 0 b) |
| 65 | have hV : IsOpen V := (hf.continuousOn.isOpen_inter_preimage hW Metric.isOpen_ball).inter |
| 66 | ((hg.continuousOn.isOpen_inter_preimage hW Metric.isOpen_ball).inter isOpen_Ioo) |
| 67 | have hcV : c ∈ V := by |
| 68 | refine ⟨⟨hcW, ?_⟩, ⟨hcW, ?_⟩, hc⟩ |
| 69 | · exact Metric.mem_ball_self hR |
| 70 | · change e (β c) ∈ Metric.ball (e (α c)) R |
| 71 | rw [heq] |
| 72 | exact Metric.mem_ball_self hR |
| 73 | obtain ⟨r, hr, hrV⟩ := Metric.nhds_basis_closedBall.mem_iff.mp (hV.mem_nhds hcV) |
| 74 | have hrI : Set.Icc (c - r) (c + r) ⊆ V := by |
| 75 | simpa only [Real.closedBall_eq_Icc] using hrV |
| 76 | have hleft := (hrI (show c - r ∈ Set.Icc (c - r) (c + r) from ⟨le_rfl, by linarith⟩)).2.2 |
| 77 | have hright := (hrI (show c + r ∈ Set.Icc (c - r) (c + r) from ⟨by linarith, le_rfl⟩)).2.2 |
| 78 | have hrc : r < c := by linarith [hleft.1] |
| 79 | have hcrb : c + r < b := hright.2 |
| 80 | have hrW : Set.Icc (c - r) (c + r) ⊆ W := fun s hs ↦ (hrI hs).1.1 |
| 81 | have hrD : Set.Icc (c - r) (c + r) ⊆ D := fun s hs ↦ (hrW hs).1.1 |
| 82 | have hfK (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : f s ∈ K := |
| 83 | Metric.ball_subset_closedBall (hrI hs).1.2 |
| 84 | have hgK (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : g s ∈ K := |
| 85 | Metric.ball_subset_closedBall (hrI hs).2.1.2 |
| 86 | obtain ⟨L, _, hL⟩ := exists_smoothJoinBlend_uniform_deriv_bound f g W hW hf hg c r hr hrW |
| 87 | (congrArg e heq) |
| 88 | obtain ⟨Cj, hCj, hCjb⟩ := squareChartActionDensity_bounded F hM04 T τmax hτmax hwindow p |
| 89 | (Set.Icc (c - r) (c + r)) K isCompact_Icc hK (hrD.trans htime) hKt L |
| 90 | have hda := squareCurveActionDensity_contDiffOn F hM04 T τmax hτmax hwindow α D hD hα htime |
| 91 | have hdb := squareCurveActionDensity_contDiffOn F hM04 T τmax hτmax hwindow β D hD hβ htime |
| 92 | obtain ⟨Ca, hCa⟩ := isCompact_Icc.exists_bound_of_continuousOn (hda.continuousOn.mono hI) |
| 93 | obtain ⟨Cb, hCb⟩ := isCompact_Icc.exists_bound_of_continuousOn (hdb.continuousOn.mono hI) |
| 94 | let C := |Cj| + |Ca| + |Cb| |
| 95 | have hC : 0 ≤ C := by dsimp [C]; positivity |
| 96 | have hCaC : Ca ≤ C := by dsimp [C]; linarith [le_abs_self Ca, abs_nonneg Cj, abs_nonneg Cb] |
| 97 | have hCbC : Cb ≤ C := by dsimp [C]; linarith [le_abs_self Cb, abs_nonneg Cj, abs_nonneg Ca] |
| 98 | have hCjC : Cj ≤ C := by dsimp [C]; linarith [le_abs_self Cj, abs_nonneg Ca, abs_nonneg Cb] |
| 99 | refine ⟨r, hr, hrc, hcrb, C, hC, ?_⟩ |
| 100 | intro d hd hdr |
| 101 | let γ := smoothChartJoin (n := n) α β p c r d |
| 102 | let k := smoothJoinBlend f g c d |
| 103 | have hkK (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : k s ∈ K := |
| 104 | smoothJoinBlend_mem_convex f g c d s K (convex_closedBall y R) (hfK s hs) (hgK s hs) |
| 105 | have hαs (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : α s ∈ e.source := (hrW hs).1.2 |
| 106 | have hβs (s : ℝ) (hs : s ∈ Set.Icc (c - r) (c + r)) : β s ∈ e.source := (hrW hs).2.2 |
| 107 | have hγ := smoothChartJoin_contMDiffOn α β p c r d hr hd hdr D hD hrD hα hβ hαs hβs |
| 108 | (fun s hs ↦ hKt (hkK s (Set.Ioo_subset_Icc_self hs))) |
| 109 | refine ⟨γ, hγ, ?_, ?_, ?_⟩ |
| 110 | · intro s hs |
| 111 | exact smoothChartJoin_eq_left α β p c r d hr hd hαs s hs |
| 112 | · intro s hs |
| 113 | exact smoothChartJoin_eq_right α β p c r d hr hd hβs s hs |
| 114 | · intro s hs |
| 115 | have hsI : s ∈ Set.Icc (c - r) (c + r) := ⟨by linarith [hs.1], by linarith [hs.2]⟩ |
| 116 | have hsO : s ∈ Set.Ioo (c - r) (c + r) := ⟨by linarith [hs.1], by linarith [hs.2]⟩ |
| 117 | have hsB : s ∈ Set.Icc 0 b := ⟨by linarith [hs.1], by linarith [hs.2]⟩ |
| 118 | refine ⟨(hCa s hsB).trans hCaC, (hCb s hsB).trans hCbC, ?_⟩ |
| 119 | have he : γ =ᶠ[𝓝 s] (fun t ↦ e.symm (k t)) := by |
| 120 | filter_upwards [isOpen_Ioo.mem_nhds hsO] with t ht |
| 121 | exact smoothChartJoin_eq_middle α β p c r d t (Set.Ioo_subset_Icc_self ht) |
| 122 | have hkd : HasDerivAt k (deriv k s) s := |
| 123 | (((smoothJoinBlend_contDiffOn f g c d W hf hg).contDiffAt |
| 124 | (hW.mem_nhds (hrW hsI))).differentiableAt (by simp)).hasDerivAt |
| 125 | rw [squareCurveActionDensity_congr F T γ _ s he, |
| 126 | squareCurveActionDensity_inverseChart F T p k s (deriv k s) hkd (hKt (hkK s hsI))] |
| 127 | exact (hCjb s hsI (k s) (hkK s hsI) (deriv k s) (hL d hd hdr.le s hs)).trans hCjC |
| 128 | |
| 129 | end PoincareMT.ReducedLength |