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/Variational.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/Variational.lean |
| 17 | at revision 1b535dd102b94cc42b107cca27059687888f08b3. |
| 18 | Original SHA-256: 857a4e900bc707d0697f82ea293a20c59cf0ca16edf6bd820ebadca02a38a2c9 |
| 19 | Changes: library paths and namespaces. |
| 20 | -/ |
| 21 | import Mathlib.Analysis.ODE.PicardLindelof |
| 22 | import Mathlib.Analysis.ODE.ExistUnique |
| 23 | import Mathlib.Analysis.ODE.Gronwall |
| 24 | import Mathlib.Analysis.ODE.Basic |
| 25 | import Mathlib.Analysis.Calculus.ContDiff.RCLike |
| 26 | |
| 27 | noncomputable section |
| 28 | |
| 29 | open Set Function Filter Metric |
| 30 | open scoped Topology NNReal |
| 31 | |
| 32 | namespace Poincare.ODE |
| 33 | |
| 34 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 35 | |
| 36 | def IsVariationalSolutionOn |
| 37 | (f : ℝ → E → E) (α : ℝ → E) (δ : E) (t₀ : ℝ) (y : ℝ → E) (s : Set ℝ) : Prop := |
| 38 | y t₀ = δ ∧ |
| 39 | ∀ t ∈ s, HasDerivWithinAt y ((fderiv ℝ (f t) (α t)) (y t)) s t |
| 40 | |
| 41 | def IsVariationalSolution |
| 42 | (f : ℝ → E → E) (α : ℝ → E) (δ : E) (t₀ : ℝ) (y : ℝ → E) : Prop := |
| 43 | y t₀ = δ ∧ |
| 44 | ∀ t : ℝ, HasDerivAt y ((fderiv ℝ (f t) (α t)) (y t)) t |
| 45 | |
| 46 | namespace IsVariationalSolutionOn |
| 47 | |
| 48 | variable {f : ℝ → E → E} {α : ℝ → E} {δ : E} {t₀ : ℝ} {y : ℝ → E} {s : Set ℝ} |
| 49 | |
| 50 | lemma initial (hy : IsVariationalSolutionOn f α δ t₀ y s) : y t₀ = δ := hy.1 |
| 51 | |
| 52 | lemma hasDerivWithinAt (hy : IsVariationalSolutionOn f α δ t₀ y s) : |
| 53 | ∀ t ∈ s, HasDerivWithinAt y ((fderiv ℝ (f t) (α t)) (y t)) s t := hy.2 |
| 54 | |
| 55 | lemma mono {s' : Set ℝ} (hy : IsVariationalSolutionOn f α δ t₀ y s) (hs : s' ⊆ s) : |
| 56 | IsVariationalSolutionOn f α δ t₀ y s' := |
| 57 | ⟨hy.1, fun t ht => (hy.2 t (hs ht)).mono hs⟩ |
| 58 | |
| 59 | lemma continuousOn (hy : IsVariationalSolutionOn f α δ t₀ y s) : ContinuousOn y s := |
| 60 | fun t ht => (hy.2 t ht).continuousWithinAt |
| 61 | |
| 62 | lemma hasDerivAt_of_isOpen (hy : IsVariationalSolutionOn f α δ t₀ y s) (hs : IsOpen s) |
| 63 | {t : ℝ} (ht : t ∈ s) : |
| 64 | HasDerivAt y ((fderiv ℝ (f t) (α t)) (y t)) t := |
| 65 | (hy.2 t ht).hasDerivAt (hs.mem_nhds ht) |
| 66 | |
| 67 | end IsVariationalSolutionOn |
| 68 | |
| 69 | namespace IsVariationalSolution |
| 70 | |
| 71 | variable {f : ℝ → E → E} {α : ℝ → E} {δ : E} {t₀ : ℝ} {y : ℝ → E} |
| 72 | |
| 73 | lemma initial (hy : IsVariationalSolution f α δ t₀ y) : y t₀ = δ := hy.1 |
| 74 | |
| 75 | lemma hasDerivAt (hy : IsVariationalSolution f α δ t₀ y) : |
| 76 | ∀ t : ℝ, HasDerivAt y ((fderiv ℝ (f t) (α t)) (y t)) t := hy.2 |
| 77 | |
| 78 | lemma toIsVariationalSolutionOn (hy : IsVariationalSolution f α δ t₀ y) (s : Set ℝ) : |
| 79 | IsVariationalSolutionOn f α δ t₀ y s := |
| 80 | ⟨hy.1, fun t _ => (hy.2 t).hasDerivWithinAt⟩ |
| 81 | |
| 82 | lemma continuous (hy : IsVariationalSolution f α δ t₀ y) : Continuous y := |
| 83 | continuous_iff_continuousAt.mpr (fun t => (hy.2 t).continuousAt) |
| 84 | |
| 85 | end IsVariationalSolution |
| 86 | |
| 87 | section Linearization |
| 88 | |
| 89 | variable {f : ℝ → E → E} {α : ℝ → E} {s : Set ℝ} {u : Set E} |
| 90 | |
| 91 | lemma fderiv_eq_comp_inr {f : ℝ → E → E} {p : ℝ × E} |
| 92 | (hdiff_joint : DifferentiableAt ℝ (uncurry f) p) : |
| 93 | fderiv ℝ (f p.1) p.2 |
| 94 | = (fderiv ℝ (uncurry f) p).comp (ContinuousLinearMap.inr ℝ ℝ E) := by |
| 95 | have hfd_joint : HasFDerivAt (uncurry f) (fderiv ℝ (uncurry f) p) p := |
| 96 | hdiff_joint.hasFDerivAt |
| 97 | have hg : HasFDerivAt (fun y : E => ((p.1 : ℝ), y)) |
| 98 | (ContinuousLinearMap.inr ℝ ℝ E) p.2 := by |
| 99 | have h1 : HasFDerivAt (fun _ : E => (p.1 : ℝ)) (0 : E →L[ℝ] ℝ) p.2 := |
| 100 | hasFDerivAt_const _ _ |
| 101 | have h2 : HasFDerivAt (fun y : E => y) (ContinuousLinearMap.id ℝ E) p.2 := |
| 102 | hasFDerivAt_id _ |
| 103 | have h3 := h1.prodMk h2 |
| 104 | have : (0 : E →L[ℝ] ℝ).prod (ContinuousLinearMap.id ℝ E) |
| 105 | = ContinuousLinearMap.inr ℝ ℝ E := by |
| 106 | ext y <;> simp |
| 107 | rw [this] at h3 |
| 108 | exact h3 |
| 109 | have hp_eq : ((p.1 : ℝ), p.2) = p := by ext <;> rfl |
| 110 | have hfd_joint' : |
| 111 | HasFDerivAt (uncurry f) (fderiv ℝ (uncurry f) p) |
| 112 | ((fun y : E => ((p.1 : ℝ), y)) p.2) := by |
| 113 | change HasFDerivAt (uncurry f) (fderiv ℝ (uncurry f) p) ((p.1, p.2)) |
| 114 | rw [hp_eq] |
| 115 | exact hfd_joint |
| 116 | have hcomp_raw : |
| 117 | HasFDerivAt ((uncurry f) ∘ (fun y : E => ((p.1 : ℝ), y))) |
| 118 | ((fderiv ℝ (uncurry f) p).comp (ContinuousLinearMap.inr ℝ ℝ E)) p.2 := |
| 119 | HasFDerivAt.comp p.2 hfd_joint' hg |
| 120 | have huncurry_eq : (uncurry f) ∘ (fun y : E => ((p.1 : ℝ), y)) = f p.1 := by |
| 121 | funext y; rfl |
| 122 | rw [huncurry_eq] at hcomp_raw |
| 123 | exact hcomp_raw.fderiv |
| 124 | |
| 125 | lemma continuousOn_partialFDeriv_uncurry |
| 126 | (hf : ContDiffOn ℝ 1 (uncurry f) (s ×ˢ u)) (hs : IsOpen s) (hu : IsOpen u) : |
| 127 | ContinuousOn (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) (s ×ˢ u) := by |
| 128 | have hprod_open : IsOpen (s ×ˢ u) := hs.prod hu |
| 129 | have hf_full : |
| 130 | ContinuousOn (fun p : ℝ × E => fderiv ℝ (uncurry f) p) (s ×ˢ u) := |
| 131 | hf.continuousOn_fderiv_of_isOpen hprod_open le_rfl |
| 132 | have hpartial_eq : |
| 133 | EqOn (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) |
| 134 | (fun p : ℝ × E => |
| 135 | (fderiv ℝ (uncurry f) p).comp (ContinuousLinearMap.inr ℝ ℝ E)) |
| 136 | (s ×ˢ u) := by |
| 137 | intro p hp |
| 138 | have hp_open : (s ×ˢ u) ∈ 𝓝 p := hprod_open.mem_nhds hp |
| 139 | have hdiff_joint : DifferentiableAt ℝ (uncurry f) p := |
| 140 | ((hf.contDiffAt hp_open).differentiableAt one_ne_zero) |
| 141 | exact fderiv_eq_comp_inr hdiff_joint |
| 142 | have hcomp_cont : |
| 143 | ContinuousOn (fun p : ℝ × E => |
| 144 | (fderiv ℝ (uncurry f) p).comp (ContinuousLinearMap.inr ℝ ℝ E)) (s ×ˢ u) := by |
| 145 | have hpostL : Continuous |
| 146 | (fun M : (ℝ × E) →L[ℝ] E => M.comp (ContinuousLinearMap.inr ℝ ℝ E)) := by |
| 147 | exact Continuous.clm_comp_const continuous_id (ContinuousLinearMap.inr ℝ ℝ E) |
| 148 | exact hpostL.comp_continuousOn hf_full |
| 149 | exact hcomp_cont.congr hpartial_eq |
| 150 | |
| 151 | lemma continuousOn_fderiv_along_curve |
| 152 | (hf : ContDiffOn ℝ 1 (uncurry f) (s ×ˢ u)) (hs : IsOpen s) (hu : IsOpen u) |
| 153 | (hα : ContinuousOn α s) (hmem : ∀ t ∈ s, α t ∈ u) : |
| 154 | ContinuousOn (fun t => fderiv ℝ (f t) (α t)) s := by |
| 155 | have hpartial := continuousOn_partialFDeriv_uncurry hf hs hu |
| 156 | have hcont_curve : ContinuousOn (fun t : ℝ => (t, α t)) s := |
| 157 | continuousOn_id.prodMk hα |
| 158 | have hmaps : MapsTo (fun t : ℝ => (t, α t)) s (s ×ˢ u) := fun t ht => ⟨ht, hmem t ht⟩ |
| 159 | exact hpartial.comp hcont_curve hmaps |
| 160 | |
| 161 | lemma exists_bound_fderiv_along_curve_Icc {tmin tmax : ℝ} |
| 162 | (hf : ContDiffOn ℝ 1 (uncurry f) (s ×ˢ u)) (hs : IsOpen s) (hu : IsOpen u) |
| 163 | (hα : ContinuousOn α s) (hmem : ∀ t ∈ s, α t ∈ u) |
| 164 | (hsub : Icc tmin tmax ⊆ s) : |
| 165 | ∃ M : ℝ, 0 ≤ M ∧ ∀ t ∈ Icc tmin tmax, ‖fderiv ℝ (f t) (α t)‖ ≤ M := by |
| 166 | rcases le_or_gt tmin tmax with hle | hlt |
| 167 | · have hcont : ContinuousOn (fun t => fderiv ℝ (f t) (α t)) s := |
| 168 | continuousOn_fderiv_along_curve hf hs hu hα hmem |
| 169 | have hcont' : ContinuousOn (fun t => fderiv ℝ (f t) (α t)) (Icc tmin tmax) := |
| 170 | hcont.mono hsub |
| 171 | have hcont_norm : ContinuousOn (fun t => ‖fderiv ℝ (f t) (α t)‖) (Icc tmin tmax) := |
| 172 | continuous_norm.comp_continuousOn hcont' |
| 173 | have hcpt : IsCompact (Icc tmin tmax) := isCompact_Icc |
| 174 | have hne : (Icc tmin tmax).Nonempty := ⟨tmin, left_mem_Icc.mpr hle⟩ |
| 175 | rcases hcpt.exists_isMaxOn hne hcont_norm with ⟨t₁, _, ht₁_max⟩ |
| 176 | exact ⟨‖fderiv ℝ (f t₁) (α t₁)‖, norm_nonneg _, fun t ht => ht₁_max ht⟩ |
| 177 | · refine ⟨0, le_rfl, fun t ht => ?_⟩ |
| 178 | exact absurd (lt_of_le_of_lt ht.1 (lt_of_le_of_lt ht.2 hlt)) (lt_irrefl _) |
| 179 | |
| 180 | end Linearization |
| 181 | |
| 182 | section Uniqueness |
| 183 | |
| 184 | variable {f : ℝ → E → E} {α : ℝ → E} {δ : E} {t₀ : ℝ} |
| 185 | |
| 186 | theorem IsVariationalSolutionOn.unique_Ioo {a b : ℝ} (ht₀ : t₀ ∈ Ioo a b) |
| 187 | {y₁ y₂ : ℝ → E} |
| 188 | (h₁ : IsVariationalSolutionOn f α δ t₀ y₁ (Ioo a b)) |
| 189 | (h₂ : IsVariationalSolutionOn f α δ t₀ y₂ (Ioo a b)) |
| 190 | (hcont : ContinuousOn (fun t => fderiv ℝ (f t) (α t)) (Ioo a b)) : |
| 191 | EqOn y₁ y₂ (Ioo a b) := by |
| 192 | intro t ht |
| 193 | set A : ℝ → E →L[ℝ] E := fun t => fderiv ℝ (f t) (α t) with hA_def |
| 194 | let v : ℝ → E → E := fun t y => (A t) y |
| 195 | set a' := (a + min t t₀) / 2 with ha' |
| 196 | set b' := (b + max t t₀) / 2 with hb' |
| 197 | have hmin_lt : a < min t t₀ := lt_min ht.1 ht₀.1 |
| 198 | have hmax_lt : max t t₀ < b := max_lt ht.2 ht₀.2 |
| 199 | have hmin_le_t : min t t₀ ≤ t := min_le_left _ _ |
| 200 | have hmin_le_t₀ : min t t₀ ≤ t₀ := min_le_right _ _ |
| 201 | have ht_le_max : t ≤ max t t₀ := le_max_left _ _ |
| 202 | have ht₀_le_max : t₀ ≤ max t t₀ := le_max_right _ _ |
| 203 | have ha'_lt_min : a' < min t t₀ := by rw [ha']; linarith |
| 204 | have ha_lt_a' : a < a' := by rw [ha']; linarith |
| 205 | have hmax_lt_b' : max t t₀ < b' := by rw [hb']; linarith |
| 206 | have hb'_lt_b : b' < b := by rw [hb']; linarith |
| 207 | have hsub : Ioo a' b' ⊆ Ioo a b := fun s hs => |
| 208 | ⟨lt_trans ha_lt_a' hs.1, lt_trans hs.2 hb'_lt_b⟩ |
| 209 | have ht_mem' : t ∈ Ioo a' b' := |
| 210 | ⟨lt_of_lt_of_le ha'_lt_min hmin_le_t, lt_of_le_of_lt ht_le_max hmax_lt_b'⟩ |
| 211 | have ht₀_mem' : t₀ ∈ Ioo a' b' := |
| 212 | ⟨lt_of_lt_of_le ha'_lt_min hmin_le_t₀, lt_of_le_of_lt ht₀_le_max hmax_lt_b'⟩ |
| 213 | have hab_le : a' ≤ b' := le_of_lt (lt_trans ha'_lt_min (lt_of_le_of_lt hmin_le_t |
| 214 | (lt_of_lt_of_le ht_mem'.2 (le_refl _)))) |
| 215 | have hIcc_sub : Icc a' b' ⊆ Ioo a b := fun s hs => |
| 216 | ⟨lt_of_lt_of_le ha_lt_a' hs.1, lt_of_le_of_lt hs.2 hb'_lt_b⟩ |
| 217 | have hbd : ∃ M : ℝ, 0 ≤ M ∧ ∀ τ ∈ Icc a' b', ‖A τ‖ ≤ M := by |
| 218 | have hcont' : ContinuousOn A (Icc a' b') := hcont.mono hIcc_sub |
| 219 | have hcont_norm : ContinuousOn (fun τ => ‖A τ‖) (Icc a' b') := |
| 220 | continuous_norm.comp_continuousOn hcont' |
| 221 | have hcpt : IsCompact (Icc a' b') := isCompact_Icc |
| 222 | have hne : (Icc a' b').Nonempty := ⟨a', left_mem_Icc.mpr hab_le⟩ |
| 223 | rcases hcpt.exists_isMaxOn hne hcont_norm with ⟨τ₁, _, hτ₁_max⟩ |
| 224 | exact ⟨‖A τ₁‖, norm_nonneg _, fun τ hτ => hτ₁_max hτ⟩ |
| 225 | obtain ⟨M, hM_nn, hMbd⟩ := hbd |
| 226 | let K : ℝ≥0 := ⟨M, hM_nn⟩ |
| 227 | have hv_lip : ∀ τ ∈ Ioo a' b', LipschitzOnWith K (v τ) univ := by |
| 228 | intro τ hτ |
| 229 | have hlip : LipschitzWith K (A τ) := |
| 230 | (A τ).lipschitzWith_of_opNorm_le (hMbd τ (Ioo_subset_Icc_self hτ)) |
| 231 | exact (LipschitzWith.lipschitzOnWith (s := (univ : Set E)) hlip) |
| 232 | have hy₁_d : ∀ τ ∈ Ioo a' b', |
| 233 | HasDerivAt y₁ ((A τ) (y₁ τ)) τ := by |
| 234 | intro τ hτ |
| 235 | exact (h₁.2 τ (hsub hτ)).hasDerivAt (isOpen_Ioo.mem_nhds (hsub hτ)) |
| 236 | have hy₂_d : ∀ τ ∈ Ioo a' b', |
| 237 | HasDerivAt y₂ ((A τ) (y₂ τ)) τ := by |
| 238 | intro τ hτ |
| 239 | exact (h₂.2 τ (hsub hτ)).hasDerivAt (isOpen_Ioo.mem_nhds (hsub hτ)) |
| 240 | exact (ODE_solution_unique_of_mem_Ioo (v := v) (s := fun _ => univ) (K := K) |
| 241 | hv_lip ht₀_mem' |
| 242 | (fun τ hτ => ⟨hy₁_d τ hτ, mem_univ _⟩) |
| 243 | (fun τ hτ => ⟨hy₂_d τ hτ, mem_univ _⟩) |
| 244 | (by rw [h₁.1, h₂.1])) ht_mem' |
| 245 | |
| 246 | end Uniqueness |
| 247 | |
| 248 | section Existence |
| 249 | |
| 250 | variable [CompleteSpace E] |
| 251 | |
| 252 | theorem exists_isVariationalSolutionOn_Ioo_local |
| 253 | {f : ℝ → E → E} {α : ℝ → E} {s : Set ℝ} {u : Set E} |
| 254 | (hf : ContDiffOn ℝ 1 (uncurry f) (s ×ˢ u)) (hs : IsOpen s) (hu : IsOpen u) |
| 255 | (hα : ContinuousOn α s) (hmem : ∀ t ∈ s, α t ∈ u) |
| 256 | (t₀ : ℝ) (ht₀ : t₀ ∈ s) (δ : E) : |
| 257 | ∃ ε : ℝ, 0 < ε ∧ Ioo (t₀ - ε) (t₀ + ε) ⊆ s ∧ |
| 258 | ∃ y : ℝ → E, IsVariationalSolutionOn f α δ t₀ y (Ioo (t₀ - ε) (t₀ + ε)) := by |
| 259 | have hA_cont : ContinuousOn (fun t => fderiv ℝ (f t) (α t)) s := |
| 260 | continuousOn_fderiv_along_curve hf hs hu hα hmem |
| 261 | rcases Metric.mem_nhds_iff.mp (hs.mem_nhds ht₀) with ⟨ε₀, hε₀, hball⟩ |
| 262 | set ε := ε₀ / 2 with hε_def |
| 263 | have hε : 0 < ε := by positivity |
| 264 | have hε_lt : ε < ε₀ := half_lt_self hε₀ |
| 265 | have hIcc_sub_ball : Icc (t₀ - ε) (t₀ + ε) ⊆ Metric.ball t₀ ε₀ := by |
| 266 | intro τ hτ |
| 267 | rw [Metric.mem_ball, Real.dist_eq, abs_lt] |
| 268 | refine ⟨?_, ?_⟩ |
| 269 | · linarith [hτ.1, hε_lt] |
| 270 | · linarith [hτ.2, hε_lt] |
| 271 | have hIcc_sub_s : Icc (t₀ - ε) (t₀ + ε) ⊆ s := hIcc_sub_ball.trans hball |
| 272 | obtain ⟨M, hM_nn, hMbd⟩ := |
| 273 | exists_bound_fderiv_along_curve_Icc hf hs hu hα hmem hIcc_sub_s |
| 274 | set A : ℝ → E →L[ℝ] E := fun t => fderiv ℝ (f t) (α t) with hA_def |
| 275 | set v : ℝ → E → E := fun t y => (A t) y with hv_def |
| 276 | set r : ℝ := ‖δ‖ with hr_def |
| 277 | have hr_nn : 0 ≤ r := norm_nonneg _ |
| 278 | set a : ℝ := r + 1 with ha_def |
| 279 | have ha_pos : 0 < a := by linarith |
| 280 | set ε' : ℝ := min ε (1 / (M * a + 1)) with hε'_def |
| 281 | have hε' : 0 < ε' := by |
| 282 | apply lt_min hε |
| 283 | apply div_pos one_pos |
| 284 | have : 0 ≤ M * a := mul_nonneg hM_nn (le_of_lt ha_pos) |
| 285 | linarith |
| 286 | have hε'_le_ε : ε' ≤ ε := min_le_left _ _ |
| 287 | have hMa_eps' : M * a * ε' ≤ 1 := by |
| 288 | have h1 : ε' ≤ 1 / (M * a + 1) := min_le_right _ _ |
| 289 | have hMa_nn : 0 ≤ M * a := mul_nonneg hM_nn (le_of_lt ha_pos) |
| 290 | have hMa1_pos : 0 < M * a + 1 := by linarith |
| 291 | have h2 : M * a * ε' ≤ M * a * (1 / (M * a + 1)) := |
| 292 | mul_le_mul_of_nonneg_left h1 hMa_nn |
| 293 | have h3 : M * a * (1 / (M * a + 1)) = M * a / (M * a + 1) := by ring |
| 294 | have h4 : M * a / (M * a + 1) ≤ 1 := by |
| 295 | rw [div_le_one hMa1_pos]; linarith |
| 296 | linarith |
| 297 | let tmin : ℝ := t₀ - ε' |
| 298 | let tmax : ℝ := t₀ + ε' |
| 299 | have htmin_le_tmax : tmin ≤ tmax := by |
| 300 | change t₀ - ε' ≤ t₀ + ε'; linarith |
| 301 | let t₀Icc : Icc tmin tmax := ⟨t₀, by exact ⟨by change t₀ - ε' ≤ t₀; linarith, |
| 302 | by change t₀ ≤ t₀ + ε'; linarith⟩⟩ |
| 303 | have hIcc_sub_eps : Icc tmin tmax ⊆ Icc (t₀ - ε) (t₀ + ε) := by |
| 304 | intro τ hτ |
| 305 | refine ⟨?_, ?_⟩ |
| 306 | · exact le_trans (by change t₀ - ε ≤ t₀ - ε'; linarith) hτ.1 |
| 307 | · exact le_trans hτ.2 (by change t₀ + ε' ≤ t₀ + ε; linarith) |
| 308 | let aN : ℝ≥0 := ⟨a, le_of_lt ha_pos⟩ |
| 309 | let rN : ℝ≥0 := ⟨r, hr_nn⟩ |
| 310 | let LN : ℝ≥0 := ⟨M * a, mul_nonneg hM_nn (le_of_lt ha_pos)⟩ |
| 311 | let KN : ℝ≥0 := ⟨M, hM_nn⟩ |
| 312 | have hpl : IsPicardLindelof v t₀Icc (0 : E) aN rN LN KN := by |
| 313 | refine |
| 314 | { lipschitzOnWith := ?_, |
| 315 | continuousOn := ?_, |
| 316 | norm_le := ?_, |
| 317 | mul_max_le := ?_ } |
| 318 | · intro τ hτ |
| 319 | have hτ_eps : τ ∈ Icc (t₀ - ε) (t₀ + ε) := hIcc_sub_eps hτ |
| 320 | have hlip : LipschitzWith KN (A τ) := |
| 321 | (A τ).lipschitzWith_of_opNorm_le (hMbd τ hτ_eps) |
| 322 | exact LipschitzWith.lipschitzOnWith (s := closedBall (0 : E) aN) hlip |
| 323 | · intro y _ |
| 324 | have hsub : Icc tmin tmax ⊆ s := hIcc_sub_eps.trans hIcc_sub_s |
| 325 | have hA_cont' : ContinuousOn A (Icc tmin tmax) := hA_cont.mono hsub |
| 326 | have happly : Continuous (fun B : E →L[ℝ] E => B y) := |
| 327 | (ContinuousLinearMap.apply ℝ E y).continuous |
| 328 | exact happly.comp_continuousOn hA_cont' |
| 329 | · intro τ hτ y hy |
| 330 | have hτ_eps : τ ∈ Icc (t₀ - ε) (t₀ + ε) := hIcc_sub_eps hτ |
| 331 | have hA_norm : ‖A τ‖ ≤ M := hMbd τ hτ_eps |
| 332 | have hy_norm : ‖y‖ ≤ a := by |
| 333 | rw [mem_closedBall_zero_iff] at hy |
| 334 | change ‖y‖ ≤ a at hy |
| 335 | exact hy |
| 336 | change ‖v τ y‖ ≤ (LN : ℝ) |
| 337 | calc ‖v τ y‖ = ‖(A τ) y‖ := rfl |
| 338 | _ ≤ ‖A τ‖ * ‖y‖ := (A τ).le_opNorm y |
| 339 | _ ≤ M * a := mul_le_mul hA_norm hy_norm (norm_nonneg _) hM_nn |
| 340 | · change (LN : ℝ) * max (tmax - t₀) (t₀ - tmin) ≤ (aN : ℝ) - (rN : ℝ) |
| 341 | have hmax_eq : max (tmax - t₀) (t₀ - tmin) = ε' := by |
| 342 | have h1 : tmax - t₀ = ε' := by change (t₀ + ε') - t₀ = ε'; ring |
| 343 | have h2 : t₀ - tmin = ε' := by change t₀ - (t₀ - ε') = ε'; ring |
| 344 | rw [h1, h2]; exact max_self _ |
| 345 | rw [hmax_eq] |
| 346 | have hLrhs : (aN : ℝ) - (rN : ℝ) = 1 := by change a - r = 1; rw [ha_def]; ring |
| 347 | rw [hLrhs] |
| 348 | change M * a * ε' ≤ 1 |
| 349 | exact hMa_eps' |
| 350 | have hδ_mem : δ ∈ closedBall (0 : E) rN := by |
| 351 | rw [mem_closedBall_zero_iff] |
| 352 | change ‖δ‖ ≤ r |
| 353 | rfl |
| 354 | obtain ⟨y, hy_init, hy_deriv⟩ := |
| 355 | hpl.exists_eq_forall_mem_Icc_hasDerivWithinAt hδ_mem |
| 356 | refine ⟨ε', hε', ?_, y, hy_init, ?_⟩ |
| 357 | · intro τ hτ |
| 358 | apply hIcc_sub_s |
| 359 | refine ⟨le_of_lt ?_, le_of_lt ?_⟩ |
| 360 | · exact lt_of_le_of_lt (by change t₀ - ε ≤ t₀ - ε'; linarith) hτ.1 |
| 361 | · exact lt_of_lt_of_le hτ.2 (by change t₀ + ε' ≤ t₀ + ε; linarith) |
| 362 | · intro τ hτ |
| 363 | have hτ_Icc : τ ∈ Icc tmin tmax := |
| 364 | ⟨le_of_lt hτ.1, le_of_lt hτ.2⟩ |
| 365 | have hd := hy_deriv τ hτ_Icc |
| 366 | have hsub_set : Ioo (t₀ - ε') (t₀ + ε') ⊆ Icc tmin tmax := |
| 367 | Ioo_subset_Icc_self |
| 368 | have hd' := hd.mono hsub_set |
| 369 | have hτ_open : Ioo (t₀ - ε') (t₀ + ε') ∈ 𝓝 τ := isOpen_Ioo.mem_nhds hτ |
| 370 | exact (hd'.hasDerivAt hτ_open).hasDerivWithinAt |
| 371 | |
| 372 | end Existence |
| 373 | |
| 374 | section Linearity |
| 375 | |
| 376 | variable {f : ℝ → E → E} {α : ℝ → E} {t₀ : ℝ} |
| 377 | |
| 378 | theorem IsVariationalSolutionOn.linear_combination |
| 379 | {δ₁ δ₂ : E} {c₁ c₂ : ℝ} {y₁ y₂ : ℝ → E} {s : Set ℝ} |
| 380 | (h₁ : IsVariationalSolutionOn f α δ₁ t₀ y₁ s) |
| 381 | (h₂ : IsVariationalSolutionOn f α δ₂ t₀ y₂ s) : |
| 382 | IsVariationalSolutionOn f α (c₁ • δ₁ + c₂ • δ₂) t₀ |
| 383 | (fun t => c₁ • y₁ t + c₂ • y₂ t) s := by |
| 384 | refine ⟨?_, ?_⟩ |
| 385 | · simp [h₁.1, h₂.1] |
| 386 | · intro t ht |
| 387 | have hd₁ := h₁.2 t ht |
| 388 | have hd₂ := h₂.2 t ht |
| 389 | have hd_sum : HasDerivWithinAt (fun t => c₁ • y₁ t + c₂ • y₂ t) |
| 390 | (c₁ • ((fderiv ℝ (f t) (α t)) (y₁ t)) + c₂ • ((fderiv ℝ (f t) (α t)) (y₂ t))) s t := |
| 391 | (hd₁.const_smul c₁).add (hd₂.const_smul c₂) |
| 392 | have hlin : |
| 393 | (fderiv ℝ (f t) (α t)) (c₁ • y₁ t + c₂ • y₂ t) |
| 394 | = c₁ • ((fderiv ℝ (f t) (α t)) (y₁ t)) |
| 395 | + c₂ • ((fderiv ℝ (f t) (α t)) (y₂ t)) := by |
| 396 | simp [map_add] |
| 397 | rw [hlin] |
| 398 | exact hd_sum |
| 399 | |
| 400 | theorem IsVariationalSolutionOn.const_smul |
| 401 | {δ : E} {c : ℝ} {y : ℝ → E} {s : Set ℝ} |
| 402 | (h : IsVariationalSolutionOn f α δ t₀ y s) : |
| 403 | IsVariationalSolutionOn f α (c • δ) t₀ (fun t => c • y t) s := by |
| 404 | have h₂ : IsVariationalSolutionOn f α (0 : E) t₀ (fun _ => (0 : E)) s := by |
| 405 | refine ⟨by simp, ?_⟩ |
| 406 | intro t _ |
| 407 | have hz : ((fderiv ℝ (f t) (α t)) (0 : E)) = 0 := by simp |
| 408 | rw [hz] |
| 409 | exact hasDerivWithinAt_const t s (0 : E) |
| 410 | have hcomb := h.linear_combination (c₁ := c) (c₂ := 0) h₂ |
| 411 | simpa using hcomb |
| 412 | |
| 413 | theorem IsVariationalSolutionOn.add |
| 414 | {δ₁ δ₂ : E} {y₁ y₂ : ℝ → E} {s : Set ℝ} |
| 415 | (h₁ : IsVariationalSolutionOn f α δ₁ t₀ y₁ s) |
| 416 | (h₂ : IsVariationalSolutionOn f α δ₂ t₀ y₂ s) : |
| 417 | IsVariationalSolutionOn f α (δ₁ + δ₂) t₀ (fun t => y₁ t + y₂ t) s := by |
| 418 | have hcomb := h₁.linear_combination (c₁ := 1) (c₂ := 1) h₂ |
| 419 | simpa using hcomb |
| 420 | |
| 421 | theorem IsVariationalSolutionOn.zero |
| 422 | {s : Set ℝ} : |
| 423 | IsVariationalSolutionOn f α (0 : E) t₀ (fun _ => (0 : E)) s := by |
| 424 | refine ⟨by simp, ?_⟩ |
| 425 | intro t _ |
| 426 | have hz : ((fderiv ℝ (f t) (α t)) (0 : E)) = 0 := by simp |
| 427 | rw [hz] |
| 428 | exact hasDerivWithinAt_const t s (0 : E) |
| 429 | |
| 430 | end Linearity |
| 431 | |
| 432 | end Poincare.ODE |
| 433 | |
| 434 | end |