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 | /- |
| 2 | Provenance and modification notice (recorded 2026-09-29). |
| 3 | Source: https://github.com/qinz1yang/differential-geometry |
| 4 | DifferentialGeometry/Analysis/ODE/Flow/HigherRegularity/VariationalLevelOneSmoothness.lean |
| 5 | Comparison revision: 1b535dd102b94cc42b107cca27059687888f08b3. |
| 6 | Changes: Imports, module paths, and namespaces were adapted to the subject-organized PoincareLib library. |
| 7 | License: Apache-2.0. Source licenses and notices are retained under |
| 8 | PoincareConjecture/provenance/2026-09-29/licenses/. |
| 9 | See PoincareConjecture/MODIFICATIONS.md for the reviewed source mapping. |
| 10 | -/ |
| 11 | |
| 12 | /- |
| 13 | Copyright (c) 2026 The DifferentialGeometry contributors. |
| 14 | Released under Apache 2.0 license. |
| 15 | |
| 16 | Adapted from DifferentialGeometry/Analysis/ODE/Flow/HigherRegularity/VariationalLevelOneSmoothness.lean |
| 17 | at revision 1b535dd102b94cc42b107cca27059687888f08b3. |
| 18 | Original SHA-256: 293c80469a7bfd47a161d49b48adc2d33cdb6a4ad885c9394f6aa543be057036 |
| 19 | Changes: library paths and namespaces. |
| 20 | -/ |
| 21 | import PoincareLib.Analysis.ODE.LocalFlow.HigherRegularity.VariationalOrbitComparison |
| 22 | |
| 23 | |
| 24 | noncomputable section |
| 25 | |
| 26 | open Set Function Filter Metric Asymptotics Real |
| 27 | open scoped Topology NNReal |
| 28 | |
| 29 | namespace Poincare.ODE.LocalFlow |
| 30 | |
| 31 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] |
| 32 | |
| 33 | attribute [local instance] variationalAugmentedEndNormedAddCommGroup |
| 34 | |
| 35 | section LevelOneSmoothnessClause |
| 36 | |
| 37 | variable {f : ℝ → E → E} {t₀ : ℝ} {x₀ : E} |
| 38 | |
| 39 | theorem exists_isLocalFlow_augmentedVectorField_and_contDiffOn_fromAugFlow_one_of_C2 |
| 40 | [FiniteDimensional ℝ E] |
| 41 | (hf_C2 : ContDiffOn ℝ 2 (uncurry f) (Set.univ : Set (ℝ × E))) |
| 42 | (t₀ : ℝ) (x₀ : E) : |
| 43 | ∃ (R_aug : ℝ≥0) (ε_aug : ℝ) (_hR_aug : 0 < R_aug) (_hε_aug : 0 < ε_aug) |
| 44 | (aΦ : (E × (E →L[ℝ] E)) × ℝ → E × (E →L[ℝ] E)) |
| 45 | (T : ℝ) (ρ : ℝ≥0) (_hT : 0 < T) (_hρ : 0 < (ρ : ℝ)), |
| 46 | IsLocalFlow (augmentedVectorField f) t₀ (x₀, ContinuousLinearMap.id ℝ E) R_aug |
| 47 | (t₀ - ε_aug) (t₀ + ε_aug) aΦ ∧ |
| 48 | ContDiffOn ℝ 1 (fromAugFlow aΦ) |
| 49 | ((ball x₀ (ρ : ℝ)) ×ˢ Ioo (t₀ - T) (t₀ + T)) := by |
| 50 | set p₀ : E × (E →L[ℝ] E) := (x₀, ContinuousLinearMap.id ℝ E) with hp₀_def |
| 51 | obtain ⟨R_aug, ε_aug, hR_aug_pos, hε_aug_pos, aΦ, haΦ⟩ := |
| 52 | exists_isLocalFlow_augVF_of_C2 hf_C2 t₀ p₀ |
| 53 | have hf_succ : ContDiffOn ℝ ((1 : ℕ∞) + 1) (uncurry f) (Set.univ : Set (ℝ × E)) := by |
| 54 | norm_num |
| 55 | exact hf_C2 |
| 56 | have h_augVF_C1 : ContDiffOn ℝ 1 (uncurry (augmentedVectorField f)) |
| 57 | (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := |
| 58 | augVF_uncurry_contDiff (k := (1 : ℕ∞)) hf_succ |
| 59 | set R_a_out : ℝ := (R_aug : ℝ) / 2 with hR_a_out_def |
| 60 | have hR_aug_R : (0 : ℝ) < (R_aug : ℝ) := by exact_mod_cast hR_aug_pos |
| 61 | have hR_a_out_pos : 0 < R_a_out := by rw [hR_a_out_def]; linarith |
| 62 | have hR_a_out_lt : R_a_out < (R_aug : ℝ) := by rw [hR_a_out_def]; linarith |
| 63 | set T_a_out : ℝ := ε_aug / 2 with hT_a_out_def |
| 64 | have hT_a_out_pos : 0 < T_a_out := by rw [hT_a_out_def]; linarith |
| 65 | have hT_a_out_lt : T_a_out < ε_aug := by rw [hT_a_out_def]; linarith |
| 66 | have hslab_sub_a : closedBall p₀ R_a_out ×ˢ Icc (t₀ - T_a_out) (t₀ + T_a_out) |
| 67 | ⊆ closedBall p₀ (R_aug : ℝ) ×ˢ Icc (t₀ - ε_aug) (t₀ + ε_aug) := by |
| 68 | refine Set.prod_mono ?_ ?_ |
| 69 | · exact closedBall_subset_closedBall (le_of_lt hR_a_out_lt) |
| 70 | · exact Icc_subset_Icc (by linarith) (by linarith) |
| 71 | have hpartial_a : ContDiffOn ℝ 0 (fun p : ℝ × (E × (E →L[ℝ] E)) => |
| 72 | fderiv ℝ (augmentedVectorField f p.1) p.2) |
| 73 | (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := |
| 74 | contDiffOn_partial_fderiv_of_succ (f := augmentedVectorField f) (k := (0 : ℕ∞)) |
| 75 | (by simpa using h_augVF_C1) |
| 76 | have hpartial_a_cont : ContinuousOn (fun p : ℝ × (E × (E →L[ℝ] E)) => |
| 77 | fderiv ℝ (augmentedVectorField f p.1) p.2) (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := |
| 78 | hpartial_a.continuousOn |
| 79 | have haΦ_cont_full : ContinuousOn aΦ |
| 80 | (closedBall p₀ (R_aug : ℝ) ×ˢ Icc (t₀ - ε_aug) (t₀ + ε_aug)) := |
| 81 | haΦ.continuousOn |
| 82 | have haΦ_cont : ContinuousOn aΦ |
| 83 | (closedBall p₀ R_a_out ×ˢ Icc (t₀ - T_a_out) (t₀ + T_a_out)) := |
| 84 | haΦ_cont_full.mono hslab_sub_a |
| 85 | set Slab : Set ((E × (E →L[ℝ] E)) × ℝ) := |
| 86 | closedBall p₀ R_a_out ×ˢ Icc (t₀ - T_a_out) (t₀ + T_a_out) with hSlab_def |
| 87 | have hSlab_cpt : IsCompact Slab := |
| 88 | (isCompact_closedBall (p₀ : E × (E →L[ℝ] E)) R_a_out).prod isCompact_Icc |
| 89 | have hSlab_ne : Slab.Nonempty := |
| 90 | ⟨(p₀, t₀), Metric.mem_closedBall_self (le_of_lt hR_a_out_pos), |
| 91 | ⟨by linarith, by linarith⟩⟩ |
| 92 | have h_aΦ_pair_cont : ContinuousOn |
| 93 | (fun q : (E × (E →L[ℝ] E)) × ℝ => (q.2, aΦ q)) Slab := |
| 94 | ContinuousOn.prodMk continuous_snd.continuousOn haΦ_cont |
| 95 | have h_fderiv_along_cont : ContinuousOn |
| 96 | (fun q : (E × (E →L[ℝ] E)) × ℝ => fderiv ℝ (augmentedVectorField f q.2) (aΦ q)) |
| 97 | Slab := by |
| 98 | have hmaps : MapsTo (fun q : (E × (E →L[ℝ] E)) × ℝ => (q.2, aΦ q)) |
| 99 | Slab (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := fun _ _ => mem_univ _ |
| 100 | exact hpartial_a_cont.comp h_aΦ_pair_cont hmaps |
| 101 | have h_norm_cont : ContinuousOn |
| 102 | (fun q : (E × (E →L[ℝ] E)) × ℝ => ‖fderiv ℝ (augmentedVectorField f q.2) (aΦ q)‖) |
| 103 | Slab := by |
| 104 | have hnorm : Continuous |
| 105 | (fun A : (E × (E →L[ℝ] E)) →L[ℝ] (E × (E →L[ℝ] E)) => ‖A‖) := |
| 106 | continuous_norm |
| 107 | exact hnorm.comp_continuousOn h_fderiv_along_cont |
| 108 | rcases hSlab_cpt.exists_isMaxOn hSlab_ne h_norm_cont with ⟨qmax, _, hqmax⟩ |
| 109 | set M_aug_pre : ℝ := ‖fderiv ℝ (augmentedVectorField f qmax.2) (aΦ qmax)‖ with hM_aug_pre_def |
| 110 | have hM_aug_pre_nn : 0 ≤ M_aug_pre := norm_nonneg _ |
| 111 | have hM_aug_pre_bd : ∀ q ∈ Slab, ‖fderiv ℝ (augmentedVectorField f q.2) (aΦ q)‖ ≤ M_aug_pre := |
| 112 | fun q hq => hqmax hq |
| 113 | set M_aug : ℝ := M_aug_pre + 1 with hM_aug_def |
| 114 | have hM_aug_nn : 0 ≤ M_aug := by rw [hM_aug_def]; linarith |
| 115 | have hM_aug_pos : 0 < M_aug := by rw [hM_aug_def]; linarith |
| 116 | set T_a_mid' : ℝ := min (T_a_out * 3 / 4) (1 / (2 * M_aug)) with hT_a_mid'_def |
| 117 | have hT_a_mid'_pos : 0 < T_a_mid' := by |
| 118 | refine lt_min ?_ ?_ |
| 119 | · positivity |
| 120 | · have : 0 < 2 * M_aug := by linarith |
| 121 | positivity |
| 122 | have hT_a_mid'_lt_out : T_a_mid' < T_a_out := by |
| 123 | have h1 : T_a_mid' ≤ T_a_out * 3 / 4 := min_le_left _ _ |
| 124 | have h2 : T_a_out * 3 / 4 < T_a_out := by linarith |
| 125 | linarith |
| 126 | have hMTmid' : M_aug * T_a_mid' < 1 := by |
| 127 | have h1 : T_a_mid' ≤ 1 / (2 * M_aug) := min_le_right _ _ |
| 128 | have h2 : M_aug * T_a_mid' ≤ M_aug * (1 / (2 * M_aug)) := |
| 129 | mul_le_mul_of_nonneg_left h1 hM_aug_nn |
| 130 | have h3 : M_aug * (1 / (2 * M_aug)) = 1 / 2 := by field_simp |
| 131 | linarith |
| 132 | set T_a : ℝ := T_a_mid' / 2 with hT_a_def |
| 133 | have hT_a_pos : 0 < T_a := by rw [hT_a_def]; linarith |
| 134 | have hT_a_lt_mid' : T_a < T_a_mid' := by rw [hT_a_def]; linarith |
| 135 | set R_a_mid : ℝ := R_a_out * 3 / 4 with hR_a_mid_def |
| 136 | have hR_a_mid_pos : 0 < R_a_mid := by rw [hR_a_mid_def]; positivity |
| 137 | have hR_a_mid_lt_out : R_a_mid < R_a_out := by rw [hR_a_mid_def]; linarith |
| 138 | set R_a : ℝ := R_a_mid / 2 with hR_a_def |
| 139 | have hR_a_pos : 0 < R_a := by rw [hR_a_def]; linarith |
| 140 | have hR_a_lt_mid : R_a < R_a_mid := by rw [hR_a_def]; linarith |
| 141 | set R_aN : ℝ≥0 := ⟨R_a, le_of_lt hR_a_pos⟩ with hR_aN_def |
| 142 | set R_a_midN : ℝ≥0 := ⟨R_a_mid, le_of_lt hR_a_mid_pos⟩ with hR_a_midN_def |
| 143 | set R_a_outN : ℝ≥0 := ⟨R_a_out, le_of_lt hR_a_out_pos⟩ with hR_a_outN_def |
| 144 | set r'a : ℝ≥0 := ⟨R_aug / 8, by positivity⟩ with hr'a_def |
| 145 | have hr'a_pos : (0 : ℝ) < (r'a : ℝ) := by |
| 146 | rw [hr'a_def] |
| 147 | change 0 < (R_aug : ℝ) / 8 |
| 148 | linarith |
| 149 | have hR_a_outN_eq : (R_a_outN : ℝ) = R_a_out := rfl |
| 150 | have hR_a_midN_eq : (R_a_midN : ℝ) = R_a_mid := rfl |
| 151 | have hR_aN_eq : (R_aN : ℝ) = R_a := rfl |
| 152 | have hρρ_aux : (R_a_midN : ℝ) + (r'a : ℝ) ≤ (R_aug : ℝ) := by |
| 153 | rw [hR_a_midN_eq, hR_a_mid_def, hR_a_out_def] |
| 154 | have : (r'a : ℝ) = (R_aug : ℝ) / 8 := rfl |
| 155 | linarith |
| 156 | have hR_a_out_le_R_aug : (R_a_outN : ℝ) ≤ (R_aug : ℝ) := by |
| 157 | rw [hR_a_outN_eq, hR_a_out_def]; linarith |
| 158 | have hA_bd_a : ∀ p ∈ closedBall p₀ (R_a_outN : ℝ), |
| 159 | ∀ τ ∈ Icc (t₀ - T_a_out) (t₀ + T_a_out), |
| 160 | ‖fderiv ℝ (augmentedVectorField f τ) (aΦ ⟨p, τ⟩)‖ ≤ M_aug := by |
| 161 | intro p hp τ hτ |
| 162 | have hq_in : ((p, τ) : (E × (E →L[ℝ] E)) × ℝ) ∈ Slab := ⟨hp, hτ⟩ |
| 163 | have h_pre : ‖fderiv ℝ (augmentedVectorField f τ) (aΦ ⟨p, τ⟩)‖ ≤ M_aug_pre := |
| 164 | hM_aug_pre_bd ((p, τ) : (E × (E →L[ℝ] E)) × ℝ) hq_in |
| 165 | exact h_pre.trans (le_add_of_nonneg_right zero_le_one) |
| 166 | have hsub_a : Icc (t₀ - T_a_out) (t₀ + T_a_out) ⊆ Icc (t₀ - ε_aug) (t₀ + ε_aug) := |
| 167 | Icc_subset_Icc (by linarith) (by linarith) |
| 168 | have h_aug_C1 : ContDiffOn ℝ 1 aΦ ((ball p₀ (R_aN : ℝ)) |
| 169 | ×ˢ Ioo (t₀ - T_a) (t₀ + T_a)) := by |
| 170 | have hk_aug : (1 : ℕ∞) ≤ 1 := le_refl _ |
| 171 | refine contDiffOn_flow_of_isLocalFlow_of_contDiff (f := augmentedVectorField f) |
| 172 | (t₀ := t₀) (x₀ := p₀) (r := R_aug) (tmin := t₀ - ε_aug) (tmax := t₀ + ε_aug) |
| 173 | (Φ := aΦ) haΦ hk_aug h_augVF_C1 hT_a_pos hT_a_lt_mid' hT_a_mid'_lt_out |
| 174 | hM_aug_nn hMTmid' hsub_a (ρ_out := R_a_outN) (ρ_mid := R_a_midN) (ρ := R_aN) |
| 175 | hr'a_pos |
| 176 | ?_ ?_ ?_ ?_ hA_bd_a |
| 177 | · rw [hR_aN_eq, hR_a_midN_eq]; linarith [hR_a_lt_mid] |
| 178 | · rw [hR_a_midN_eq, hR_a_outN_eq]; linarith [hR_a_mid_lt_out] |
| 179 | · exact hρρ_aux |
| 180 | · exact hR_a_out_le_R_aug |
| 181 | set T : ℝ := T_a / 2 with hT_def |
| 182 | have hT_pos : 0 < T := by rw [hT_def]; linarith |
| 183 | have hT_le_T_a : T ≤ T_a := by rw [hT_def]; linarith |
| 184 | set ρ : ℝ := R_a / 2 with hρ_def |
| 185 | have hρ_pos : 0 < ρ := by rw [hρ_def]; linarith |
| 186 | have hρ_le_R_a : ρ ≤ R_a := by rw [hρ_def]; linarith |
| 187 | set ρN : ℝ≥0 := ⟨ρ, le_of_lt hρ_pos⟩ with hρN_def |
| 188 | have hρN_eq : (ρN : ℝ) = ρ := rfl |
| 189 | have hρN_le_R_aN : (ρN : ℝ) ≤ (R_aN : ℝ) := by rw [hρN_eq, hR_aN_eq]; exact hρ_le_R_a |
| 190 | refine ⟨R_aug, ε_aug, hR_aug_pos, hε_aug_pos, aΦ, T, ρN, hT_pos, hρ_pos, haΦ, ?_⟩ |
| 191 | exact contDiffOn_fromAugFlow_inherits (ρ_a := R_aN) (ρ := ρN) (T_a := T_a) (T := T) |
| 192 | hρN_le_R_aN hT_le_T_a h_aug_C1 |
| 193 | |
| 194 | theorem exists_contDiffOn_fromAugFlow_one_of_C2 |
| 195 | [FiniteDimensional ℝ E] |
| 196 | (hf_C2 : ContDiffOn ℝ 2 (uncurry f) (Set.univ : Set (ℝ × E))) |
| 197 | (t₀ : ℝ) (x₀ : E) : |
| 198 | ∃ (T : ℝ) (ρ : ℝ≥0) (_hT : 0 < T) (_hρ : 0 < (ρ : ℝ)) |
| 199 | (aΦ : (E × (E →L[ℝ] E)) × ℝ → E × (E →L[ℝ] E)), |
| 200 | ContDiffOn ℝ 1 (fromAugFlow aΦ) |
| 201 | ((ball x₀ (ρ : ℝ)) ×ˢ Ioo (t₀ - T) (t₀ + T)) := by |
| 202 | obtain ⟨_, _, _, _, aΦ, T, ρ, hT, hρ, _, h_smooth⟩ := |
| 203 | exists_isLocalFlow_augmentedVectorField_and_contDiffOn_fromAugFlow_one_of_C2 |
| 204 | hf_C2 t₀ x₀ |
| 205 | exact ⟨T, ρ, hT, hρ, aΦ, h_smooth⟩ |
| 206 | |
| 207 | end LevelOneSmoothnessClause |
| 208 | |
| 209 | end Poincare.ODE.LocalFlow |
| 210 | |
| 211 | end |