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.Calculus.SmoothSquarePath |
| 2 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Action.ActionCongruence |
| 3 | import PoincareLib.Geometry.RicciFlow.ReducedGeometry.ReducedLength.Basic |
| 4 | |
| 5 | /-! |
| 6 | # Genuine variations from smooth square-time families |
| 7 | |
| 8 | The backward-time family uses the original path at parameter zero, including |
| 9 | outside the geometric interval. Its independent square family remains smooth. |
| 10 | -/ |
| 11 | |
| 12 | set_option autoImplicit false |
| 13 | set_option maxSynthPendingDepth 3 |
| 14 | |
| 15 | open scoped Manifold ContDiff Bundle |
| 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 | {J : Set ℝ} {F : RicciFlow n M J} {T τmax : ℝ} {p : M} |
| 24 | |
| 25 | theorem exists_lVariation_of_smoothSquareFamily |
| 26 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 27 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (A : LExponentialFamily F T τmax p) |
| 28 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 29 | (f : ℝ × ℝ → M) (U : Set (ℝ × ℝ)) (hU : IsOpen U) |
| 30 | (hf : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ f U) |
| 31 | (ρ : ℝ) (hρ : 0 < ρ) (hI : Set.Icc 0 (Real.sqrt b) ×ˢ Set.Ioo (-ρ) ρ ⊆ U) |
| 32 | (hcenter : ∀ s ∈ Set.Icc 0 (Real.sqrt b), f (s, 0) = A.squareFamily Z s) : |
| 33 | ∃ V : LVariation F T 0 b (A.path Z b hb hmax), |
| 34 | V.radius = ρ ∧ (∀ s u, V.squareFamily s u = f (s, u)) ∧ |
| 35 | (∀ u, Set.EqOn (fun t ↦ V.family t u) (fun t ↦ f (Real.sqrt t, u)) (Set.Icc 0 b)) ∧ |
| 36 | ∀ u, variationLLength V u = backwardLLength F T 0 b (fun t ↦ f (Real.sqrt t, u)) := by |
| 37 | classical |
| 38 | let P := A.path Z b hb hmax |
| 39 | let family : ℝ → ℝ → M := fun t u ↦ if u = 0 then P.curve t else f (Real.sqrt t, u) |
| 40 | have heq (u : ℝ) : Set.EqOn (fun t ↦ family t u) (fun t ↦ f (Real.sqrt t, u)) (Set.Icc 0 b) := by |
| 41 | intro t ht |
| 42 | by_cases hu : u = 0 |
| 43 | · subst u |
| 44 | simp only [family, if_pos rfl] |
| 45 | have hs : Real.sqrt t ∈ Set.Icc 0 (Real.sqrt b) := |
| 46 | ⟨Real.sqrt_nonneg t, Real.sqrt_le_sqrt ht.2⟩ |
| 47 | have h := (hcenter (Real.sqrt t) hs).trans (A.square_agrees Z (Real.sqrt t) |
| 48 | ⟨hs.1, hs.2.trans_lt (Real.sqrt_lt_sqrt hb.le hmax)⟩) |
| 49 | rw [Real.sq_sqrt ht.1] at h |
| 50 | exact (congrFun (A.path_eq Z b hb hmax) t).trans h.symm |
| 51 | · simp only [family, if_neg hu] |
| 52 | let V : LVariation F T 0 b P := { |
| 53 | family := family |
| 54 | at_zero := fun t ↦ by simp only [family, if_pos rfl] |
| 55 | radius := ρ |
| 56 | radius_pos := hρ |
| 57 | squareFamily := fun s u ↦ f (s, u) |
| 58 | squareDomain := U |
| 59 | square_open := hU |
| 60 | square_contains := by simpa only [sqrtParameterInterval, Real.sqrt_zero] using hI |
| 61 | square_smooth := hf |
| 62 | square_agrees := by |
| 63 | intro s hs u _ |
| 64 | have hs0 : 0 ≤ s := by simpa only [sqrtParameterInterval, Real.sqrt_zero] using hs.1 |
| 65 | have hsB : s ^ 2 ≤ b := by |
| 66 | have h := mul_self_le_mul_self hs0 hs.2 |
| 67 | simpa only [← pow_two, Real.sq_sqrt hb.le] using h |
| 68 | have h := heq u (show s ^ 2 ∈ Set.Icc 0 b from ⟨sq_nonneg s, hsB⟩) |
| 69 | simpa only [Real.sqrt_sq hs0] using h.symm |
| 70 | l_integrable := by |
| 71 | intro u hu |
| 72 | by_cases hu0 : u = 0 |
| 73 | · subst u |
| 74 | simpa only [family, if_pos rfl] using P.l_integrable |
| 75 | · let D := (fun s : ℝ ↦ (s, u)) ⁻¹' U |
| 76 | have hD : IsOpen D := hU.preimage (continuous_id.prodMk continuous_const) |
| 77 | have hDI : Set.Icc 0 (Real.sqrt b) ⊆ D := fun s hs ↦ hI ⟨hs, hu⟩ |
| 78 | have hα : ContMDiffOn (𝓘(ℝ, ℝ)) (𝓡 n) ∞ (fun s ↦ f (s, u)) D := |
| 79 | hf.comp (contMDiff_id.prodMk contMDiff_const).contMDiffOn (fun s hs ↦ hs) |
| 80 | obtain ⟨Q, hQ, _⟩ := exists_backwardPath_of_smoothSquareCurve F hM04 T τmax hτmax hwindow |
| 81 | b hb hmax (fun s ↦ f (s, u)) D hD hDI hα |
| 82 | have hi := Q.l_integrable |
| 83 | rw [hQ] at hi |
| 84 | simpa only [family, if_neg hu0] using hi |
| 85 | } |
| 86 | refine ⟨V, rfl, fun _ _ ↦ rfl, heq, ?_⟩ |
| 87 | intro u |
| 88 | exact backwardLLength_congr_Ioo F T 0 b hb.le _ _ ((heq u).mono Set.Ioo_subset_Icc_self) |
| 89 | |
| 90 | theorem exists_initialFixedLVariation_of_smoothSquareFamily |
| 91 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 92 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (A : LExponentialFamily F T τmax p) |
| 93 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 94 | (f : ℝ × ℝ → M) (U : Set (ℝ × ℝ)) (hU : IsOpen U) |
| 95 | (hf : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ f U) |
| 96 | (ρ : ℝ) (hρ : 0 < ρ) (hI : Set.Icc 0 (Real.sqrt b) ×ˢ Set.Ioo (-ρ) ρ ⊆ U) |
| 97 | (hcenter : ∀ s ∈ Set.Icc 0 (Real.sqrt b), f (s, 0) = A.squareFamily Z s) |
| 98 | (hleft : ∀ u ∈ Set.Ioo (-ρ) ρ, f (0, u) = f (0, 0)) : |
| 99 | ∃ V : InitialFixedLVariation F T 0 b (A.path Z b hb hmax), |
| 100 | V.radius = ρ ∧ (∀ s u, V.squareFamily s u = f (s, u)) ∧ |
| 101 | (∀ u, Set.EqOn (fun t ↦ V.family t u) (fun t ↦ f (Real.sqrt t, u)) (Set.Icc 0 b)) ∧ |
| 102 | ∀ u, variationLLength V.toLVariation u = backwardLLength F T 0 b (fun t ↦ f (Real.sqrt t, u)) := by |
| 103 | obtain ⟨V, hVr, hVf, hVeq, hVa⟩ := exists_lVariation_of_smoothSquareFamily |
| 104 | hM04 hτmax hwindow A Z b hb hmax f U hU hf ρ hρ hI hcenter |
| 105 | have hfix : ∀ u ∈ Set.Ioo (-V.radius) V.radius, V.family 0 u = (A.path Z b hb hmax).curve 0 := by |
| 106 | intro u hu |
| 107 | have hu' : u ∈ Set.Ioo (-ρ) ρ := by simpa only [hVr] using hu |
| 108 | have h1 := hVeq u (show (0 : ℝ) ∈ Set.Icc 0 b from ⟨le_rfl, hb.le⟩) |
| 109 | have h0 := hVeq 0 (show (0 : ℝ) ∈ Set.Icc 0 b from ⟨le_rfl, hb.le⟩) |
| 110 | dsimp only at h1 h0 |
| 111 | rw [Real.sqrt_zero, hleft u hu'] at h1 |
| 112 | rw [Real.sqrt_zero, V.at_zero] at h0 |
| 113 | exact h1.trans h0.symm |
| 114 | exact ⟨{ toLVariation := V, fixed_left := hfix }, hVr, hVf, hVeq, hVa⟩ |
| 115 | |
| 116 | theorem exists_fixedEndpointLVariation_of_smoothSquareFamily |
| 117 | (hM04 : RicciFlowCurvatureTheory.{u}) (hτmax : 0 < τmax) |
| 118 | (hwindow : Set.Icc (T - τmax) T ⊆ J) (A : LExponentialFamily F T τmax p) |
| 119 | (Z : TangentSpace (𝓡 n) p) (b : ℝ) (hb : 0 < b) (hmax : b < τmax) |
| 120 | (f : ℝ × ℝ → M) (U : Set (ℝ × ℝ)) (hU : IsOpen U) |
| 121 | (hf : ContMDiffOn ((𝓘(ℝ, ℝ)).prod (𝓘(ℝ, ℝ))) (𝓡 n) ∞ f U) |
| 122 | (ρ : ℝ) (hρ : 0 < ρ) (hI : Set.Icc 0 (Real.sqrt b) ×ˢ Set.Ioo (-ρ) ρ ⊆ U) |
| 123 | (hcenter : ∀ s ∈ Set.Icc 0 (Real.sqrt b), f (s, 0) = A.squareFamily Z s) |
| 124 | (hleft : ∀ u ∈ Set.Ioo (-ρ) ρ, f (0, u) = f (0, 0)) |
| 125 | (hright : ∀ u ∈ Set.Ioo (-ρ) ρ, f (Real.sqrt b, u) = f (Real.sqrt b, 0)) : |
| 126 | ∃ V : FixedEndpointLVariation F T 0 b (A.path Z b hb hmax), |
| 127 | V.radius = ρ ∧ (∀ s u, V.squareFamily s u = f (s, u)) ∧ |
| 128 | (∀ u, Set.EqOn (fun t ↦ V.family t u) (fun t ↦ f (Real.sqrt t, u)) (Set.Icc 0 b)) ∧ |
| 129 | ∀ u, variationLLength V.toLVariation u = backwardLLength F T 0 b (fun t ↦ f (Real.sqrt t, u)) := by |
| 130 | obtain ⟨V, hVr, hVf, hVeq, hVa⟩ := exists_initialFixedLVariation_of_smoothSquareFamily |
| 131 | hM04 hτmax hwindow A Z b hb hmax f U hU hf ρ hρ hI hcenter hleft |
| 132 | have hfix : ∀ u ∈ Set.Ioo (-V.radius) V.radius, V.family b u = (A.path Z b hb hmax).curve b := by |
| 133 | intro u hu |
| 134 | have hu' : u ∈ Set.Ioo (-ρ) ρ := by simpa only [hVr] using hu |
| 135 | have h1 := hVeq u (show b ∈ Set.Icc 0 b from ⟨hb.le, le_rfl⟩) |
| 136 | have h0 := hVeq 0 (show b ∈ Set.Icc 0 b from ⟨hb.le, le_rfl⟩) |
| 137 | dsimp only at h1 h0 |
| 138 | rw [hright u hu'] at h1 |
| 139 | rw [V.at_zero] at h0 |
| 140 | exact h1.trans h0.symm |
| 141 | exact ⟨{ toInitialFixedLVariation := V, fixed_right := hfix }, hVr, hVf, hVeq, hVa⟩ |
| 142 | |
| 143 | end PoincareMT.ReducedLength |