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.Analysis.ODE.ParameterExistence |
| 2 | import PoincareLib.Analysis.ODE.ParameterImplicit |
| 3 | |
| 4 | /-! |
| 5 | # Smooth for parameter dependent ODEs |
| 6 | |
| 7 | Adapted from the corresponding DoCarmo analytic development at workspace |
| 8 | revision 1971ab2f. Supports Morgan--Tian (2007), equation (3.9) and |
| 9 | Claim 3.16, p. 42, through smooth dependence of local flows. |
| 10 | -/ |
| 11 | |
| 12 | noncomputable section |
| 13 | |
| 14 | open Set Filter Function Metric |
| 15 | open scoped Topology ContDiff NNReal |
| 16 | |
| 17 | namespace Poincare.ODE.Parameter |
| 18 | |
| 19 | open Poincare.ODE.Parameter |
| 20 | |
| 21 | variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] |
| 22 | [CompleteSpace F] [FiniteDimensional ℝ F] |
| 23 | |
| 24 | theorem exists_local_flow_contDiffAt (f : F → F) (hf : ContDiff ℝ ∞ f) (z0 : F) : |
| 25 | ∃ (r epsilon T : ℝ) (Z : F → ℝ → F) (L : ℝ≥0) |
| 26 | (sigma : F → C(Set.Icc (0 : ℝ) T, F)) (_hT : 0 < T), |
| 27 | 0 < r ∧ 0 < epsilon ∧ T < epsilon ∧ |
| 28 | (∀ z ∈ closedBall z0 r, |
| 29 | Z z 0 = z ∧ |
| 30 | (∀ t ∈ Icc (-epsilon) epsilon, |
| 31 | HasDerivWithinAt (Z z) (f (Z z t)) (Icc (-epsilon) epsilon) t) ∧ |
| 32 | (∀ t ∈ Icc (-epsilon) epsilon, Z z t ∈ ball z0 1)) ∧ |
| 33 | (∀ t ∈ Icc (-epsilon) epsilon, |
| 34 | LipschitzOnWith L (Z · t) (closedBall z0 r)) ∧ |
| 35 | (∀ z ∈ closedBall z0 r, ∀ t : Set.Icc (0 : ℝ) T, |
| 36 | sigma z t = Z z t.1) ∧ |
| 37 | (∀ x ∈ ball z0 r, ContDiffAt ℝ ∞ sigma x) := by |
| 38 | classical |
| 39 | have hf1 : ContDiffAt ℝ 1 f z0 := hf.contDiffAt.of_le (by norm_num) |
| 40 | have hdf : Continuous (fderiv ℝ f) := hf.continuous_fderiv (by simp) |
| 41 | obtain ⟨C, hC⟩ := (isCompact_closedBall z0 1).exists_bound_of_continuousOn |
| 42 | hdf.continuousOn |
| 43 | have hC0 : 0 ≤ C := |
| 44 | le_trans (norm_nonneg (fderiv ℝ f z0)) (hC z0 (mem_closedBall_self zero_le_one)) |
| 45 | obtain ⟨r, epsilon, Z, L, hr, hepsilon, hflow, hLip⟩ := |
| 46 | Poincare.ODE.Parameter.exists_forall_hasDerivWithinAt_lipschitzOnWith_of_contDiffAt |
| 47 | hf1 (ball_mem_nhds z0 one_pos) |
| 48 | set T : ℝ := min (epsilon / 2) (1 / (2 * (C + 1))) with hTdef |
| 49 | have hT : 0 < T := lt_min (by positivity) (by positivity) |
| 50 | have hTepsilon : T < epsilon := |
| 51 | (min_le_left _ _).trans_lt (half_lt_self hepsilon) |
| 52 | have hTC : T * C < 1 := by |
| 53 | have h1 : T ≤ 1 / (2 * (C + 1)) := min_le_right _ _ |
| 54 | have h2 : (0 : ℝ) < 2 * (C + 1) := by positivity |
| 55 | have h3 : T * C ≤ (1 / (2 * (C + 1))) * C := |
| 56 | mul_le_mul_of_nonneg_right h1 hC0 |
| 57 | have h4 : (1 / (2 * (C + 1))) * (2 * (C + 1)) = 1 := |
| 58 | one_div_mul_cancel (ne_of_gt h2) |
| 59 | nlinarith |
| 60 | have hIccT : Icc (0 : ℝ) T ⊆ Icc (-epsilon) epsilon := fun t ht => |
| 61 | ⟨le_trans (neg_nonpos.mpr hepsilon.le) ht.1, ht.2.trans hTepsilon.le⟩ |
| 62 | set sigma : F → C(Set.Icc (0 : ℝ) T, F) := fun x => |
| 63 | if hx : x ∈ closedBall z0 r then |
| 64 | ⟨fun t => Z x t.1, by |
| 65 | have hcont : ContinuousOn (Z x) (Icc (-epsilon) epsilon) := fun s hs => |
| 66 | ((hflow x hx).2.1 s hs).continuousWithinAt |
| 67 | exact hcont.comp_continuous continuous_subtype_val fun t => hIccT t.2⟩ |
| 68 | else ContinuousMap.const _ z0 with hsigmaDef |
| 69 | have hsigmaBall : ∀ z ∈ closedBall z0 r, ∀ t : Set.Icc (0 : ℝ) T, |
| 70 | sigma z t = Z z t.1 := by |
| 71 | intro z hz t |
| 72 | simp only [hsigmaDef, dif_pos hz] |
| 73 | rfl |
| 74 | refine ⟨r, epsilon, T, Z, L, sigma, hT, hr, hepsilon, hTepsilon, |
| 75 | hflow, hLip, hsigmaBall, ?_⟩ |
| 76 | intro x0 hx0 |
| 77 | have hx0c : x0 ∈ closedBall z0 r := ball_subset_closedBall hx0 |
| 78 | have hconf : ∀ t : Set.Icc (0 : ℝ) T, sigma x0 t ∈ ball z0 1 := fun t => by |
| 79 | rw [hsigmaBall x0 hx0c t] |
| 80 | exact (hflow x0 hx0c).2.2 t.1 (hIccT t.2) |
| 81 | set A0 : C(Set.Icc (0 : ℝ) T, F →L[ℝ] F) := |
| 82 | ⟨fun t => fderiv ℝ f (sigma x0 t), hdf.comp (sigma x0).continuous⟩ with hA0def |
| 83 | have hA0 : ∀ t : Set.Icc (0 : ℝ) T, A0 t = fderiv ℝ f (sigma x0 t) := |
| 84 | fun _ => rfl |
| 85 | have hA0C : ‖A0‖ ≤ C := (ContinuousMap.norm_le _ hC0).mpr fun t => |
| 86 | hC _ (ball_subset_closedBall (hconf t)) |
| 87 | have hTL : T * ‖A0‖ < 1 := |
| 88 | lt_of_le_of_lt (mul_le_mul_of_nonneg_left hA0C hT.le) hTC |
| 89 | have hsigmac : ContinuousAt sigma x0 := by |
| 90 | have hlips : LipschitzOnWith L sigma (closedBall z0 r) := by |
| 91 | refine LipschitzOnWith.of_dist_le_mul fun x hx y hy => ?_ |
| 92 | rw [ContinuousMap.dist_le (mul_nonneg L.coe_nonneg dist_nonneg)] |
| 93 | intro t |
| 94 | rw [hsigmaBall x hx t, hsigmaBall y hy t] |
| 95 | exact (hLip t.1 (hIccT t.2)).dist_le_mul x hx y hy |
| 96 | exact (hlips.continuousOn.continuousWithinAt hx0c).continuousAt |
| 97 | (mem_of_superset (isOpen_ball.mem_nhds hx0) ball_subset_closedBall) |
| 98 | have hsigmaResidual : |
| 99 | ∀ᶠ x in 𝓝 x0, picardResidual hT.le f (x, sigma x) = 0 := by |
| 100 | filter_upwards [isOpen_ball.mem_nhds hx0] with x hx |
| 101 | have hxc : x ∈ closedBall z0 r := ball_subset_closedBall hx |
| 102 | obtain ⟨hzero, hderiv, _⟩ := hflow x hxc |
| 103 | refine picardResidual_eq_zero_of_hasDerivWithinAt hT |
| 104 | hf.continuous.continuousOn hzero (fun t _ => mem_univ _) ?_ |
| 105 | (sigma x) (fun t => hsigmaBall x hxc t) |
| 106 | intro t ht |
| 107 | exact (hderiv t (hIccT ht)).mono hIccT |
| 108 | exact contDiffAt_flow_of_picardResidual hT hf hA0 hTL rfl hsigmac hsigmaResidual |
| 109 | |
| 110 | end Poincare.ODE.Parameter |
| 111 |