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/VariationalLinearMapSmoothness.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/VariationalLinearMapSmoothness.lean |
| 17 | at revision 1b535dd102b94cc42b107cca27059687888f08b3. |
| 18 | Original SHA-256: 0796f2138ff6971caa0425ddb1f335e5ea967edfd3921f27fee7482b1ce22bf2 |
| 19 | Changes: library paths and namespaces. |
| 20 | -/ |
| 21 | import PoincareLib.Analysis.ODE.LocalFlow.HigherRegularity.VariationalLevelZeroWitness |
| 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 ParameterizedCkWitness |
| 36 | |
| 37 | theorem exists_isVariationalFlowProjection_of_C |
| 38 | {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 39 | [CompleteSpace E] [FiniteDimensional ℝ E] |
| 40 | {f : ℝ → E → E} {t₀ : ℝ} {x₀ : E} {r : ℝ≥0} {tmin tmax : ℝ} |
| 41 | {Φ : E × ℝ → E} |
| 42 | (hΦ : IsLocalFlow f t₀ x₀ r tmin tmax Φ) |
| 43 | (ht₀_Ioo : t₀ ∈ Set.Ioo tmin tmax) |
| 44 | (hr_pos : (0 : ℝ) < (r : ℝ)) |
| 45 | (k : ℕ) |
| 46 | (hf_C : ContDiffOn ℝ ((k : ℕ∞) + 1) (Function.uncurry f) |
| 47 | (Set.univ : Set (ℝ × E))) : |
| 48 | ∃ (T : ℝ) (ρ : ℝ≥0) (_hT : 0 < T) (_hρ : 0 < (ρ : ℝ)) |
| 49 | (Y : E × ℝ → (E →L[ℝ] E)), |
| 50 | IsVariationalFlowProjection hΦ T ρ Y (k : ℕ∞) := by |
| 51 | classical |
| 52 | suffices haux : ∀ (k : ℕ) (E : Type _) [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 53 | [CompleteSpace E] [FiniteDimensional ℝ E] |
| 54 | {f : ℝ → E → E} {t₀ : ℝ} {x₀ : E} {r : ℝ≥0} {tmin tmax : ℝ} |
| 55 | {Φ : E × ℝ → E} |
| 56 | (hΦ : IsLocalFlow f t₀ x₀ r tmin tmax Φ) |
| 57 | (_ht₀_Ioo : t₀ ∈ Set.Ioo tmin tmax) |
| 58 | (_hr_pos : (0 : ℝ) < (r : ℝ)) |
| 59 | (_hf_C : ContDiffOn ℝ ((k : ℕ∞) + 1) (Function.uncurry f) |
| 60 | (Set.univ : Set (ℝ × E))), |
| 61 | ∃ (T : ℝ) (ρ : ℝ≥0) (_hT : 0 < T) (_hρ : 0 < (ρ : ℝ)) |
| 62 | (Y : E × ℝ → (E →L[ℝ] E)), |
| 63 | IsVariationalFlowProjection hΦ T ρ Y (k : ℕ∞) by |
| 64 | exact haux k E hΦ ht₀_Ioo hr_pos hf_C |
| 65 | clear hΦ ht₀_Ioo hr_pos hf_C |
| 66 | intro k |
| 67 | induction k with |
| 68 | | zero => |
| 69 | intro E _ _ _ _ f t₀ x₀ r tmin tmax Φ hΦ ht₀_Ioo hr_pos hf_C |
| 70 | have hf_C1 : ContDiffOn ℝ 1 (Function.uncurry f) (Set.univ : Set (ℝ × E)) := by |
| 71 | simpa using hf_C |
| 72 | have h_witness := exists_isVariationalFlowProjection_zero_of_C1 |
| 73 | hΦ ht₀_Ioo hr_pos hf_C1 |
| 74 | obtain ⟨T, ρ, hT, hρ, Y, hY⟩ := h_witness |
| 75 | refine ⟨T, ρ, hT, hρ, Y, ?_⟩ |
| 76 | have h_zero : ((0 : ℕ) : ℕ∞) = (0 : ℕ∞) := by norm_cast |
| 77 | rw [h_zero] |
| 78 | exact hY |
| 79 | | succ n IH => |
| 80 | intro E _ _ _ _ f t₀ x₀ r tmin tmax Φ hΦ ht₀_Ioo hr_pos hf_C |
| 81 | have h_eq_succ_plus_one : (((n + 1 : ℕ) : ℕ∞) + 1 : WithTop ℕ∞) = |
| 82 | ((n : ℕ∞) + 2 : WithTop ℕ∞) := by push_cast; ring |
| 83 | have hf_Cn_plus_2 : ContDiffOn ℝ ((n : ℕ∞) + 2) |
| 84 | (Function.uncurry f) (Set.univ : Set (ℝ × E)) := by |
| 85 | have := hf_C |
| 86 | rw [h_eq_succ_plus_one] at this |
| 87 | exact this |
| 88 | have hf_C1 : ContDiffOn ℝ 1 (Function.uncurry f) (Set.univ : Set (ℝ × E)) := by |
| 89 | refine hf_Cn_plus_2.of_le ?_ |
| 90 | have h1 : (1 : WithTop ℕ∞) ≤ 2 := by decide |
| 91 | have h2 : (2 : WithTop ℕ∞) ≤ ((n : ℕ∞) : WithTop ℕ∞) + 2 := le_add_self |
| 92 | exact le_trans h1 h2 |
| 93 | have hf_Cn_plus_2_as_succ : ContDiffOn ℝ (((n : ℕ∞) + 1) + 1) |
| 94 | (Function.uncurry f) (Set.univ : Set (ℝ × E)) := by |
| 95 | have h_eq_wt : |
| 96 | ((((n : ℕ∞) : WithTop ℕ∞) + 1) + 1 : WithTop ℕ∞) = |
| 97 | (((n : ℕ∞) : WithTop ℕ∞) + 2 : WithTop ℕ∞) := by |
| 98 | have h2 : ((2 : WithTop ℕ∞) = 1 + 1) := by decide |
| 99 | rw [h2, ← add_assoc] |
| 100 | rw [h_eq_wt] |
| 101 | exact hf_Cn_plus_2 |
| 102 | have h_augVF_Cn_plus_1 : |
| 103 | ContDiffOn ℝ ((n : ℕ∞) + 1) (Function.uncurry (augmentedVectorField f)) |
| 104 | (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := |
| 105 | augVF_uncurry_contDiff (k := ((n : ℕ∞) + 1)) hf_Cn_plus_2_as_succ |
| 106 | have h_augVF_C1 : ContDiffOn ℝ 1 (Function.uncurry (augmentedVectorField f)) |
| 107 | (Set.univ : Set (ℝ × (E × (E →L[ℝ] E)))) := by |
| 108 | refine h_augVF_Cn_plus_1.of_le ?_ |
| 109 | have h1 : (1 : ℕ∞) ≤ (n : ℕ∞) + 1 := le_add_self |
| 110 | exact_mod_cast h1 |
| 111 | obtain ⟨R_aug, ε_aug, hR_aug_pos, hε_aug_pos, aΦ, haΦ⟩ := |
| 112 | exists_isLocalFlow_of_contDiffOn_univ (augmentedVectorField f) h_augVF_C1 t₀ |
| 113 | (x₀, ContinuousLinearMap.id ℝ E) |
| 114 | have hR_aug_R : (0 : ℝ) < (R_aug : ℝ) := by exact_mod_cast hR_aug_pos |
| 115 | have ht₀_a_Ioo : t₀ ∈ Set.Ioo (t₀ - ε_aug) (t₀ + ε_aug) := |
| 116 | ⟨by linarith, by linarith⟩ |
| 117 | have hIH := IH (E × (E →L[ℝ] E)) (f := augmentedVectorField f) (t₀ := t₀) |
| 118 | (x₀ := (x₀, ContinuousLinearMap.id ℝ E)) (r := R_aug) |
| 119 | (tmin := t₀ - ε_aug) (tmax := t₀ + ε_aug) (Φ := aΦ) |
| 120 | haΦ ht₀_a_Ioo hR_aug_R h_augVF_Cn_plus_1 |
| 121 | obtain ⟨T_ih, ρ_ih, hT_ih_pos, hρ_ih_pos, Y_ih, hY_ih⟩ := hIH |
| 122 | have h_succ := exists_isVariationalFlowProjection_succ_C_step |
| 123 | (f := f) (t₀ := t₀) (x₀ := x₀) (r := r) (tmin := tmin) (tmax := tmax) |
| 124 | (Φ := Φ) hΦ ht₀_Ioo hr_pos n hf_Cn_plus_2 |
| 125 | (R_aug := R_aug) (tmin_a := t₀ - ε_aug) (tmax_a := t₀ + ε_aug) |
| 126 | (aΦ := aΦ) haΦ ht₀_a_Ioo hR_aug_R |
| 127 | (T_ih := T_ih) (ρ_ih := ρ_ih) (Y_ih := Y_ih) |
| 128 | hT_ih_pos hρ_ih_pos hY_ih |
| 129 | obtain ⟨T, ρ, hT, hρ, Y, hY⟩ := h_succ |
| 130 | refine ⟨T, ρ, hT, hρ, Y, ?_⟩ |
| 131 | have h_lvl : ((n + 1 : ℕ) : ℕ∞) = (n : ℕ∞) + 1 := by push_cast; ring |
| 132 | rw [h_lvl] |
| 133 | exact hY |
| 134 | |
| 135 | end ParameterizedCkWitness |
| 136 | |
| 137 | |
| 138 | end Poincare.ODE.LocalFlow |
| 139 | |
| 140 | end |