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/VariationalCoproductDerivative.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/VariationalCoproductDerivative.lean |
| 17 | at revision 1b535dd102b94cc42b107cca27059687888f08b3. |
| 18 | Original SHA-256: d0ebc0ff22e92416c85964db894a831518d90ec96e59606702c804ec9762c0e2 |
| 19 | Changes: library paths and namespaces. |
| 20 | -/ |
| 21 | import PoincareLib.Analysis.ODE.LocalFlow.HigherRegularity.VariationalLevelOneSmoothness |
| 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 VariationalLinearMapCongr |
| 36 | |
| 37 | variable {f : ℝ → E → E} {t₀ : ℝ} |
| 38 | |
| 39 | theorem variationalLinearMapAt_congr_of_eqOn |
| 40 | {α₁ α₂ : ℝ → E} {T M : ℝ} (hT : 0 < T) (hM : 0 ≤ M) (hMT : M * T < 1) |
| 41 | (hA_cont_1 : ContinuousOn (fun t => fderiv ℝ (f t) (α₁ t)) (Icc (t₀ - T) (t₀ + T))) |
| 42 | (hA_bd_1 : ∀ t ∈ Icc (t₀ - T) (t₀ + T), ‖fderiv ℝ (f t) (α₁ t)‖ ≤ M) |
| 43 | (hA_cont_2 : ContinuousOn (fun t => fderiv ℝ (f t) (α₂ t)) (Icc (t₀ - T) (t₀ + T))) |
| 44 | (hA_bd_2 : ∀ t ∈ Icc (t₀ - T) (t₀ + T), ‖fderiv ℝ (f t) (α₂ t)‖ ≤ M) |
| 45 | (h_eq : EqOn α₁ α₂ (Icc (t₀ - T) (t₀ + T))) |
| 46 | {t : ℝ} (ht : t ∈ Icc (t₀ - T) (t₀ + T)) : |
| 47 | variationalLinearMapAt (f := f) (α := α₁) (t₀ := t₀) hT hM hMT hA_cont_1 hA_bd_1 ht |
| 48 | = variationalLinearMapAt (f := f) (α := α₂) (t₀ := t₀) hT hM hMT hA_cont_2 hA_bd_2 ht := by |
| 49 | apply ContinuousLinearMap.ext |
| 50 | intro δ |
| 51 | have h_sol_1 := variationalSolutionFun_isSolution hT hM hMT hA_cont_1 hA_bd_1 δ |
| 52 | have h_sol_2 := variationalSolutionFun_isSolution hT hM hMT hA_cont_2 hA_bd_2 δ |
| 53 | set y₂ : ℝ → E := variationalSolutionFun hT hM hMT hA_cont_2 hA_bd_2 δ |
| 54 | have h_sol_2_as_1 : IsVariationalSolutionOn f α₁ δ t₀ y₂ (Icc (t₀ - T) (t₀ + T)) := by |
| 55 | refine ⟨h_sol_2.initial, fun s hs => ?_⟩ |
| 56 | have h_dw := h_sol_2.hasDerivWithinAt s hs |
| 57 | have hα_eq : α₁ s = α₂ s := h_eq hs |
| 58 | rw [hα_eq] |
| 59 | exact h_dw |
| 60 | have h_eq_y := IsVariationalSolutionOn.unique_Icc hT hA_cont_1 h_sol_1 h_sol_2_as_1 |
| 61 | rw [variationalLinearMapAt_apply, variationalLinearMapAt_apply] |
| 62 | exact h_eq_y ht |
| 63 | |
| 64 | end VariationalLinearMapCongr |
| 65 | |
| 66 | section CoproductHelper |
| 67 | |
| 68 | variable {f : ℝ → E → E} {t₀ : ℝ} {x₀ : E} {r : ℝ≥0} {tmin tmax : ℝ} |
| 69 | {Φ : E × ℝ → E} |
| 70 | |
| 71 | omit [CompleteSpace E] in |
| 72 | private theorem fderiv_along_continuousOn |
| 73 | {f : ℝ → E → E} {γ : ℝ → E} {K : Set ℝ} |
| 74 | (hf : ContDiffOn ℝ 0 (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) Set.univ) |
| 75 | (hγ : ContinuousOn γ K) : |
| 76 | ContinuousOn (fun s : ℝ => fderiv ℝ (f s) (γ s)) K := by |
| 77 | have hpair : ContinuousOn (fun s : ℝ => (s, γ s)) K := |
| 78 | continuousOn_id.prodMk hγ |
| 79 | exact hf.continuousOn.comp hpair (fun _ _ => mem_univ _) |
| 80 | |
| 81 | theorem fderiv_Phi_eq_coprod_fromAugFlow_aux |
| 82 | [FiniteDimensional ℝ E] |
| 83 | (hΦ : IsLocalFlow f t₀ x₀ r tmin tmax Φ) |
| 84 | (hf_C1 : ContDiffOn ℝ 1 (uncurry f) (Set.univ : Set (ℝ × E))) |
| 85 | (ht₀_Ioo : t₀ ∈ Ioo tmin tmax) |
| 86 | (hr_pos : (0 : ℝ) < (r : ℝ)) |
| 87 | {R_aug : ℝ≥0} {tmin_a tmax_a : ℝ} |
| 88 | {aΦ : (E × (E →L[ℝ] E)) × ℝ → E × (E →L[ℝ] E)} |
| 89 | (haΦ : IsLocalFlow (augmentedVectorField f) t₀ (x₀, ContinuousLinearMap.id ℝ E) R_aug |
| 90 | tmin_a tmax_a aΦ) |
| 91 | (ht₀_a_Ioo : t₀ ∈ Ioo tmin_a tmax_a) |
| 92 | (hR_aug_pos : (0 : ℝ) < (R_aug : ℝ)) : |
| 93 | ∃ (T : ℝ) (ρ : ℝ≥0) (_hT : 0 < T) (_hρ : 0 < (ρ : ℝ)), |
| 94 | ∀ q ∈ (Metric.ball x₀ (ρ : ℝ)) ×ˢ Set.Ioo (t₀ - T) (t₀ + T), |
| 95 | fderiv ℝ Φ q = (fromAugFlow aΦ q).coprod (timePieceFn f Φ q) := by |
| 96 | classical |
| 97 | set p₀ : E × (E →L[ℝ] E) := (x₀, ContinuousLinearMap.id ℝ E) with hp₀_def |
| 98 | have ht₀_minus_tmin : 0 < t₀ - tmin := by linarith [ht₀_Ioo.1] |
| 99 | have htmax_minus_t₀ : 0 < tmax - t₀ := by linarith [ht₀_Ioo.2] |
| 100 | have ht₀_minus_tmin_a : 0 < t₀ - tmin_a := by linarith [ht₀_a_Ioo.1] |
| 101 | have htmax_a_minus_t₀ : 0 < tmax_a - t₀ := by linarith [ht₀_a_Ioo.2] |
| 102 | set T_outer : ℝ := min (min (t₀ - tmin) (tmax - t₀)) |
| 103 | (min (t₀ - tmin_a) (tmax_a - t₀)) / 2 with hT_outer_def |
| 104 | have hT_outer_pos : 0 < T_outer := by |
| 105 | rw [hT_outer_def] |
| 106 | exact div_pos |
| 107 | (lt_min (lt_min ht₀_minus_tmin htmax_minus_t₀) |
| 108 | (lt_min ht₀_minus_tmin_a htmax_a_minus_t₀)) (by norm_num) |
| 109 | have hT_outer_le_tmin_half : T_outer ≤ (t₀ - tmin) / 2 := by |
| 110 | rw [hT_outer_def] |
| 111 | have h1 : min (min (t₀ - tmin) (tmax - t₀)) (min (t₀ - tmin_a) (tmax_a - t₀)) |
| 112 | ≤ min (t₀ - tmin) (tmax - t₀) := min_le_left _ _ |
| 113 | have h2 : min (t₀ - tmin) (tmax - t₀) ≤ t₀ - tmin := min_le_left _ _ |
| 114 | linarith |
| 115 | have hT_outer_le_tmax_half : T_outer ≤ (tmax - t₀) / 2 := by |
| 116 | rw [hT_outer_def] |
| 117 | have h1 : min (min (t₀ - tmin) (tmax - t₀)) (min (t₀ - tmin_a) (tmax_a - t₀)) |
| 118 | ≤ min (t₀ - tmin) (tmax - t₀) := min_le_left _ _ |
| 119 | have h2 : min (t₀ - tmin) (tmax - t₀) ≤ tmax - t₀ := min_le_right _ _ |
| 120 | linarith |
| 121 | have hT_outer_le_tmin_a_half : T_outer ≤ (t₀ - tmin_a) / 2 := by |
| 122 | rw [hT_outer_def] |
| 123 | have h1 : min (min (t₀ - tmin) (tmax - t₀)) (min (t₀ - tmin_a) (tmax_a - t₀)) |
| 124 | ≤ min (t₀ - tmin_a) (tmax_a - t₀) := min_le_right _ _ |
| 125 | have h2 : min (t₀ - tmin_a) (tmax_a - t₀) ≤ t₀ - tmin_a := min_le_left _ _ |
| 126 | linarith |
| 127 | have hT_outer_le_tmax_a_half : T_outer ≤ (tmax_a - t₀) / 2 := by |
| 128 | rw [hT_outer_def] |
| 129 | have h1 : min (min (t₀ - tmin) (tmax - t₀)) (min (t₀ - tmin_a) (tmax_a - t₀)) |
| 130 | ≤ min (t₀ - tmin_a) (tmax_a - t₀) := min_le_right _ _ |
| 131 | have h2 : min (t₀ - tmin_a) (tmax_a - t₀) ≤ tmax_a - t₀ := min_le_right _ _ |
| 132 | linarith |
| 133 | have hsub_outer_orig : Icc (t₀ - T_outer) (t₀ + T_outer) ⊆ Icc tmin tmax := |
| 134 | Icc_subset_Icc (by linarith) (by linarith) |
| 135 | have hsub_outer_aug : Icc (t₀ - T_outer) (t₀ + T_outer) ⊆ Icc tmin_a tmax_a := |
| 136 | Icc_subset_Icc (by linarith) (by linarith) |
| 137 | set ρ_outer : ℝ := (r : ℝ) / 2 with hρ_outer_def |
| 138 | have hρ_outer_pos : 0 < ρ_outer := by rw [hρ_outer_def]; linarith |
| 139 | have hρ_outer_le_r : ρ_outer ≤ (r : ℝ) := by rw [hρ_outer_def]; linarith |
| 140 | set R_aug_out : ℝ := (R_aug : ℝ) / 2 with hR_aug_out_def |
| 141 | have hR_aug_out_pos : 0 < R_aug_out := by rw [hR_aug_out_def]; linarith |
| 142 | have hR_aug_out_lt : R_aug_out < (R_aug : ℝ) := by rw [hR_aug_out_def]; linarith |
| 143 | set Slab_a_outer : Set ((E × (E →L[ℝ] E)) × ℝ) := |
| 144 | closedBall p₀ R_aug_out ×ˢ Icc (t₀ - T_outer) (t₀ + T_outer) with hSlab_a_outer_def |
| 145 | have hSlab_a_outer_cpt : IsCompact Slab_a_outer := |
| 146 | (isCompact_closedBall (p₀ : E × (E →L[ℝ] E)) R_aug_out).prod isCompact_Icc |
| 147 | have hSlab_a_outer_ne : Slab_a_outer.Nonempty := |
| 148 | ⟨(p₀, t₀), Metric.mem_closedBall_self (le_of_lt hR_aug_out_pos), |
| 149 | ⟨by linarith, by linarith⟩⟩ |
| 150 | have hslab_aug_sub : closedBall p₀ R_aug_out ×ˢ Icc (t₀ - T_outer) (t₀ + T_outer) |
| 151 | ⊆ closedBall p₀ (R_aug : ℝ) ×ˢ Icc tmin_a tmax_a := by |
| 152 | exact Set.prod_mono (closedBall_subset_closedBall (le_of_lt hR_aug_out_lt)) |
| 153 | hsub_outer_aug |
| 154 | have haΦ_cont_full : ContinuousOn aΦ |
| 155 | (closedBall p₀ (R_aug : ℝ) ×ˢ Icc tmin_a tmax_a) := haΦ.continuousOn |
| 156 | have haΦ_cont : ContinuousOn aΦ Slab_a_outer := |
| 157 | haΦ_cont_full.mono hslab_aug_sub |
| 158 | have h_aΦ_norm_cont : ContinuousOn (fun q : (E × (E →L[ℝ] E)) × ℝ => ‖(aΦ q).1 - x₀‖) |
| 159 | Slab_a_outer := by |
| 160 | have h_fst_cont : ContinuousOn (fun q : (E × (E →L[ℝ] E)) × ℝ => (aΦ q).1) Slab_a_outer := |
| 161 | continuous_fst.continuousOn.comp haΦ_cont (fun _ _ => mem_univ _) |
| 162 | have h_sub_cont : ContinuousOn (fun q : (E × (E →L[ℝ] E)) × ℝ => (aΦ q).1 - x₀) |
| 163 | Slab_a_outer := h_fst_cont.sub continuousOn_const |
| 164 | exact continuous_norm.comp_continuousOn h_sub_cont |
| 165 | rcases hSlab_a_outer_cpt.exists_isMaxOn hSlab_a_outer_ne h_aΦ_norm_cont |
| 166 | with ⟨qmax_R, _, hqmax_R⟩ |
| 167 | set R_aΦ_image_pre : ℝ := ‖(aΦ qmax_R).1 - x₀‖ with hR_aΦ_image_pre_def |
| 168 | have hR_aΦ_image_pre_nn : 0 ≤ R_aΦ_image_pre := norm_nonneg _ |
| 169 | have hR_aΦ_image_pre_bd : ∀ q ∈ Slab_a_outer, ‖(aΦ q).1 - x₀‖ ≤ R_aΦ_image_pre := |
| 170 | fun q hq => hqmax_R hq |
| 171 | set Slab_Φ_outer : Set (E × ℝ) := |
| 172 | closedBall x₀ ρ_outer ×ˢ Icc (t₀ - T_outer) (t₀ + T_outer) with hSlab_Φ_outer_def |
| 173 | have hSlab_Φ_outer_cpt : IsCompact Slab_Φ_outer := |
| 174 | (isCompact_closedBall x₀ ρ_outer).prod isCompact_Icc |
| 175 | have hSlab_Φ_outer_ne : Slab_Φ_outer.Nonempty := |
| 176 | ⟨(x₀, t₀), Metric.mem_closedBall_self (le_of_lt hρ_outer_pos), |
| 177 | ⟨by linarith, by linarith⟩⟩ |
| 178 | have hSlab_Φ_outer_sub_orig : Slab_Φ_outer ⊆ closedBall x₀ (r : ℝ) ×ˢ Icc tmin tmax := by |
| 179 | exact Set.prod_mono (closedBall_subset_closedBall hρ_outer_le_r) hsub_outer_orig |
| 180 | have hΦ_cont_slab : ContinuousOn Φ Slab_Φ_outer := hΦ.continuousOn.mono hSlab_Φ_outer_sub_orig |
| 181 | have h_Φ_norm_cont : ContinuousOn (fun p : E × ℝ => ‖Φ p - x₀‖) Slab_Φ_outer := by |
| 182 | have h_sub_cont : ContinuousOn (fun p : E × ℝ => Φ p - x₀) Slab_Φ_outer := |
| 183 | hΦ_cont_slab.sub continuousOn_const |
| 184 | exact continuous_norm.comp_continuousOn h_sub_cont |
| 185 | rcases hSlab_Φ_outer_cpt.exists_isMaxOn hSlab_Φ_outer_ne h_Φ_norm_cont |
| 186 | with ⟨pmax_R, _, hpmax_R⟩ |
| 187 | set R_Φ_image_pre : ℝ := ‖Φ pmax_R - x₀‖ with hR_Φ_image_pre_def |
| 188 | have hR_Φ_image_pre_nn : 0 ≤ R_Φ_image_pre := norm_nonneg _ |
| 189 | have hR_Φ_image_pre_bd : ∀ p ∈ Slab_Φ_outer, ‖Φ p - x₀‖ ≤ R_Φ_image_pre := |
| 190 | fun p hp => hpmax_R hp |
| 191 | set r₀_lip : ℝ := max R_aΦ_image_pre R_Φ_image_pre + 1 with hr₀_lip_def |
| 192 | have hr₀_lip_pos : 0 < r₀_lip := by |
| 193 | rw [hr₀_lip_def] |
| 194 | have : 0 ≤ max R_aΦ_image_pre R_Φ_image_pre := |
| 195 | le_max_of_le_left hR_aΦ_image_pre_nn |
| 196 | linarith |
| 197 | have hr₀_lip_ge_aΦ : R_aΦ_image_pre ≤ r₀_lip := by |
| 198 | rw [hr₀_lip_def] |
| 199 | have : R_aΦ_image_pre ≤ max R_aΦ_image_pre R_Φ_image_pre := le_max_left _ _ |
| 200 | linarith |
| 201 | have hr₀_lip_ge_Φ : R_Φ_image_pre ≤ r₀_lip := by |
| 202 | rw [hr₀_lip_def] |
| 203 | have : R_Φ_image_pre ≤ max R_aΦ_image_pre R_Φ_image_pre := le_max_right _ _ |
| 204 | linarith |
| 205 | set Slab_f : Set (ℝ × E) := |
| 206 | Icc (t₀ - T_outer) (t₀ + T_outer) ×ˢ closedBall x₀ r₀_lip with hSlab_f_def |
| 207 | have hSlab_f_cpt : IsCompact Slab_f := |
| 208 | isCompact_Icc.prod (isCompact_closedBall x₀ r₀_lip) |
| 209 | have hSlab_f_ne : Slab_f.Nonempty := |
| 210 | ⟨(t₀, x₀), ⟨by linarith, by linarith⟩, Metric.mem_closedBall_self (le_of_lt hr₀_lip_pos)⟩ |
| 211 | have hpartial_f : ContDiffOn ℝ 0 (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) |
| 212 | (Set.univ : Set (ℝ × E)) := |
| 213 | contDiffOn_partial_fderiv_of_succ (f := f) (k := (0 : ℕ∞)) |
| 214 | (by simpa using hf_C1) |
| 215 | have hpartial_f_cont : ContinuousOn (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) Slab_f := |
| 216 | hpartial_f.continuousOn.mono (subset_univ _) |
| 217 | have hpartial_f_norm_cont : ContinuousOn (fun p : ℝ × E => ‖fderiv ℝ (f p.1) p.2‖) Slab_f := |
| 218 | continuous_norm.comp_continuousOn hpartial_f_cont |
| 219 | rcases hSlab_f_cpt.exists_isMaxOn hSlab_f_ne hpartial_f_norm_cont |
| 220 | with ⟨pmax_K, _, hpmax_K⟩ |
| 221 | set K_pre : ℝ := ‖fderiv ℝ (f pmax_K.1) pmax_K.2‖ with hK_pre_def |
| 222 | have hK_pre_nn : 0 ≤ K_pre := norm_nonneg _ |
| 223 | have hK_pre_bd : ∀ p ∈ Slab_f, ‖fderiv ℝ (f p.1) p.2‖ ≤ K_pre := fun p hp => hpmax_K hp |
| 224 | set K_orig : ℝ := K_pre + 1 with hK_orig_def |
| 225 | have hK_orig_pos : 0 < K_orig := by rw [hK_orig_def]; linarith |
| 226 | have hK_orig_nn : 0 ≤ K_orig := le_of_lt hK_orig_pos |
| 227 | set K_origN : ℝ≥0 := ⟨K_orig, hK_orig_nn⟩ with hK_origN_def |
| 228 | have hK_origN_eq : (K_origN : ℝ) = K_orig := rfl |
| 229 | set T_mid : ℝ := min (T_outer * 3 / 4) (1 / (2 * K_orig)) with hT_mid_def |
| 230 | have hT_mid_pos : 0 < T_mid := by |
| 231 | have hleft : 0 < T_outer * 3 / 4 := by positivity |
| 232 | have hright : 0 < 1 / (2 * K_orig) := by positivity |
| 233 | exact lt_min hleft hright |
| 234 | have hT_mid_lt_outer : T_mid < T_outer := by |
| 235 | have h1 : T_mid ≤ T_outer * 3 / 4 := min_le_left _ _ |
| 236 | linarith |
| 237 | have hKT_mid : K_orig * T_mid < 1 := by |
| 238 | have h1 : T_mid ≤ 1 / (2 * K_orig) := min_le_right _ _ |
| 239 | have h2 : K_orig * T_mid ≤ K_orig * (1 / (2 * K_orig)) := |
| 240 | mul_le_mul_of_nonneg_left h1 hK_orig_nn |
| 241 | have h3 : K_orig * (1 / (2 * K_orig)) = 1 / 2 := by field_simp |
| 242 | linarith |
| 243 | set T_final : ℝ := T_mid / 2 with hT_final_def |
| 244 | have hT_final_pos : 0 < T_final := by rw [hT_final_def]; linarith |
| 245 | have hT_final_lt_mid : T_final < T_mid := by rw [hT_final_def]; linarith |
| 246 | set ρ_final : ℝ := min ρ_outer R_aug_out / 8 with hρ_final_def |
| 247 | have hρ_final_pos : 0 < ρ_final := by |
| 248 | rw [hρ_final_def] |
| 249 | exact div_pos (lt_min hρ_outer_pos hR_aug_out_pos) (by norm_num) |
| 250 | have hρ_final_le_outer_8 : ρ_final ≤ ρ_outer / 8 := by |
| 251 | rw [hρ_final_def] |
| 252 | have : min ρ_outer R_aug_out ≤ ρ_outer := min_le_left _ _ |
| 253 | linarith |
| 254 | have hρ_final_le_outer : ρ_final ≤ ρ_outer := by linarith |
| 255 | have hρ_final_le_R_aug_out_8 : ρ_final ≤ R_aug_out / 8 := by |
| 256 | rw [hρ_final_def] |
| 257 | have : min ρ_outer R_aug_out ≤ R_aug_out := min_le_right _ _ |
| 258 | linarith |
| 259 | have hρ_final_le_R_aug_out : ρ_final ≤ R_aug_out := by linarith |
| 260 | set ρ_finalN : ℝ≥0 := ⟨ρ_final, le_of_lt hρ_final_pos⟩ with hρ_finalN_def |
| 261 | have hρ_finalN_eq : (ρ_finalN : ℝ) = ρ_final := rfl |
| 262 | suffices hfinal : ∀ q ∈ |
| 263 | (Metric.ball x₀ (ρ_finalN : ℝ)) ×ˢ Set.Ioo (t₀ - T_final) (t₀ + T_final), |
| 264 | fderiv ℝ Φ q = (fromAugFlow aΦ q).coprod (timePieceFn f Φ q) by |
| 265 | exact ⟨T_final, ρ_finalN, hT_final_pos, hρ_final_pos, hfinal⟩ |
| 266 | intro q hq |
| 267 | rcases hq with ⟨hq_x, hq_t⟩ |
| 268 | obtain ⟨x, t⟩ := q |
| 269 | rw [mem_ball] at hq_x |
| 270 | change dist x x₀ < ρ_final at hq_x |
| 271 | have hx_closed_ρ_final : x ∈ closedBall x₀ ρ_final := mem_closedBall.mpr (le_of_lt hq_x) |
| 272 | have hx_closed_ρ_outer : x ∈ closedBall x₀ ρ_outer := |
| 273 | closedBall_subset_closedBall hρ_final_le_outer hx_closed_ρ_final |
| 274 | have hx_closed_r : x ∈ closedBall x₀ (r : ℝ) := |
| 275 | closedBall_subset_closedBall hρ_outer_le_r hx_closed_ρ_outer |
| 276 | have hx_id_closed_R_aug_out : (x, ContinuousLinearMap.id ℝ E) ∈ closedBall p₀ R_aug_out := by |
| 277 | rw [mem_closedBall] |
| 278 | change max (dist x x₀) (dist (ContinuousLinearMap.id ℝ E) |
| 279 | (ContinuousLinearMap.id ℝ E)) ≤ R_aug_out |
| 280 | rw [dist_self, max_eq_left dist_nonneg] |
| 281 | rw [mem_closedBall] at hx_closed_ρ_final |
| 282 | exact le_trans hx_closed_ρ_final hρ_final_le_R_aug_out |
| 283 | have hx_id_closed_R_aug : (x, ContinuousLinearMap.id ℝ E) ∈ closedBall p₀ (R_aug : ℝ) := |
| 284 | closedBall_subset_closedBall (le_of_lt hR_aug_out_lt) hx_id_closed_R_aug_out |
| 285 | have ht_Ioo_final : t ∈ Ioo (t₀ - T_final) (t₀ + T_final) := hq_t |
| 286 | have ht_Icc_final : t ∈ Icc (t₀ - T_final) (t₀ + T_final) := Ioo_subset_Icc_self ht_Ioo_final |
| 287 | have hsub_final_outer : Icc (t₀ - T_final) (t₀ + T_final) ⊆ Icc (t₀ - T_outer) (t₀ + T_outer) := |
| 288 | Icc_subset_Icc (by linarith) (by linarith) |
| 289 | have hsub_final_orig : Icc (t₀ - T_final) (t₀ + T_final) ⊆ Icc tmin tmax := |
| 290 | hsub_final_outer.trans hsub_outer_orig |
| 291 | have hsub_final_aug : Icc (t₀ - T_final) (t₀ + T_final) ⊆ Icc tmin_a tmax_a := |
| 292 | hsub_final_outer.trans hsub_outer_aug |
| 293 | have h_Φ_in_r₀ : ∀ s ∈ Ioo (t₀ - T_final) (t₀ + T_final), Φ ⟨x, s⟩ ∈ closedBall x₀ r₀_lip := by |
| 294 | intro s hs |
| 295 | have hs_Icc_outer : s ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := |
| 296 | hsub_final_outer (Ioo_subset_Icc_self hs) |
| 297 | have h_pair_in_outer : ((x, s) : E × ℝ) ∈ Slab_Φ_outer := |
| 298 | ⟨hx_closed_ρ_outer, hs_Icc_outer⟩ |
| 299 | have h_pre : ‖Φ (x, s) - x₀‖ ≤ R_Φ_image_pre := hR_Φ_image_pre_bd _ h_pair_in_outer |
| 300 | rw [mem_closedBall, dist_eq_norm] |
| 301 | exact le_trans h_pre hr₀_lip_ge_Φ |
| 302 | have h_aΦ_fst_in_r₀ : ∀ s ∈ Ioo (t₀ - T_final) (t₀ + T_final), |
| 303 | (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1 ∈ closedBall x₀ r₀_lip := by |
| 304 | intro s hs |
| 305 | have hs_Icc_outer : s ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := |
| 306 | hsub_final_outer (Ioo_subset_Icc_self hs) |
| 307 | have h_pair_in_a_outer : (((x, ContinuousLinearMap.id ℝ E), s) : |
| 308 | (E × (E →L[ℝ] E)) × ℝ) ∈ Slab_a_outer := |
| 309 | ⟨hx_id_closed_R_aug_out, hs_Icc_outer⟩ |
| 310 | have h_pre : ‖(aΦ ((x, ContinuousLinearMap.id ℝ E), s)).1 - x₀‖ ≤ R_aΦ_image_pre := |
| 311 | hR_aΦ_image_pre_bd _ h_pair_in_a_outer |
| 312 | rw [mem_closedBall, dist_eq_norm] |
| 313 | exact le_trans h_pre hr₀_lip_ge_aΦ |
| 314 | have h_lip_on_r₀ : ∀ τ ∈ Ioo (t₀ - T_final) (t₀ + T_final), |
| 315 | LipschitzOnWith K_origN (f τ) (closedBall x₀ r₀_lip) := by |
| 316 | intro τ hτ |
| 317 | have hτ_Icc : τ ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := |
| 318 | hsub_final_outer (Ioo_subset_Icc_self hτ) |
| 319 | have hf_τ_diff_at : ∀ z, DifferentiableAt ℝ (f τ) z := fun z => by |
| 320 | have hcd_at : ContDiffAt ℝ 1 (uncurry f) (τ, z) := |
| 321 | hf_C1.contDiffAt (IsOpen.mem_nhds isOpen_univ (mem_univ _)) |
| 322 | exact (hcd_at.differentiableAt one_ne_zero).comp z |
| 323 | (((differentiableAt_const τ).prodMk differentiableAt_id)) |
| 324 | have hbound : ∀ z ∈ closedBall x₀ r₀_lip, ‖fderiv ℝ (f τ) z‖₊ ≤ K_origN := by |
| 325 | intro z hz |
| 326 | have hp_in : ((τ, z) : ℝ × E) ∈ Slab_f := ⟨hτ_Icc, hz⟩ |
| 327 | have h_pre : ‖fderiv ℝ (f τ) z‖ ≤ K_pre := |
| 328 | hK_pre_bd ((τ, z) : ℝ × E) hp_in |
| 329 | have h_le_K_orig : ‖fderiv ℝ (f τ) z‖ ≤ K_orig := by rw [hK_orig_def]; linarith |
| 330 | rw [← NNReal.coe_le_coe, coe_nnnorm, hK_origN_eq] |
| 331 | exact h_le_K_orig |
| 332 | exact (convex_closedBall x₀ r₀_lip).lipschitzOnWith_of_nnnorm_fderiv_le |
| 333 | (f := f τ) (C := K_origN) (fun z _ => hf_τ_diff_at z) hbound |
| 334 | have ht₀_Ioo_final : t₀ ∈ Ioo (t₀ - T_final) (t₀ + T_final) := |
| 335 | ⟨by linarith, by linarith⟩ |
| 336 | have h_orbit_eqOn : EqOn (fun s => Φ ⟨x, s⟩) |
| 337 | (fun s => (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) |
| 338 | (Icc (t₀ - T_final) (t₀ + T_final)) := |
| 339 | orbit_eq_Icc_of_augFlow_isLocalFlow hΦ haΦ hx_closed_r hx_id_closed_R_aug |
| 340 | hsub_final_orig hsub_final_aug ht₀_Ioo_final |
| 341 | (r₀ := r₀_lip) (K := K_origN) h_Φ_in_r₀ h_aΦ_fst_in_r₀ h_lip_on_r₀ |
| 342 | have hA_cont_orbit_a : ContinuousOn (fun s : ℝ => fderiv ℝ (f s) |
| 343 | ((aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1)) (Icc (t₀ - T_final) (t₀ + T_final)) := by |
| 344 | have h_pair_cont : ContinuousOn (fun s : ℝ => (s, (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1)) |
| 345 | (Icc (t₀ - T_final) (t₀ + T_final)) := by |
| 346 | have h_orbit_cont : ContinuousOn |
| 347 | (fun s : ℝ => aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩) |
| 348 | (Icc (t₀ - T_final) (t₀ + T_final)) := |
| 349 | (haΦ.orbit_continuousOn (x, ContinuousLinearMap.id ℝ E) hx_id_closed_R_aug).mono |
| 350 | (by intro s hs; exact hsub_final_aug hs) |
| 351 | have h_fst_cont : ContinuousOn (fun s : ℝ => (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) |
| 352 | (Icc (t₀ - T_final) (t₀ + T_final)) := |
| 353 | continuous_fst.continuousOn.comp h_orbit_cont (fun _ _ => mem_univ _) |
| 354 | exact continuousOn_id.prodMk h_fst_cont |
| 355 | have hpartial_cont : ContinuousOn (fun p : ℝ × E => fderiv ℝ (f p.1) p.2) |
| 356 | (Set.univ : Set (ℝ × E)) := hpartial_f.continuousOn |
| 357 | have hmaps : MapsTo (fun s : ℝ => (s, (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1)) |
| 358 | (Icc (t₀ - T_final) (t₀ + T_final)) (Set.univ : Set (ℝ × E)) := |
| 359 | fun _ _ => mem_univ _ |
| 360 | exact hpartial_cont.comp h_pair_cont hmaps |
| 361 | have hA_bd_orbit_a : ∀ s ∈ Icc (t₀ - T_final) (t₀ + T_final), |
| 362 | ‖fderiv ℝ (f s) ((aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1)‖ ≤ K_orig := by |
| 363 | intro s hs |
| 364 | have hs_outer_Icc : s ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := hsub_final_outer hs |
| 365 | have h_orbit_in_r₀ : (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1 ∈ closedBall x₀ r₀_lip := by |
| 366 | have h_pair_in_a_outer : (((x, ContinuousLinearMap.id ℝ E), s) : |
| 367 | (E × (E →L[ℝ] E)) × ℝ) ∈ Slab_a_outer := |
| 368 | ⟨hx_id_closed_R_aug_out, hs_outer_Icc⟩ |
| 369 | have h_pre : ‖(aΦ ((x, ContinuousLinearMap.id ℝ E), s)).1 - x₀‖ ≤ R_aΦ_image_pre := |
| 370 | hR_aΦ_image_pre_bd _ h_pair_in_a_outer |
| 371 | rw [mem_closedBall, dist_eq_norm] |
| 372 | exact le_trans h_pre hr₀_lip_ge_aΦ |
| 373 | have h_pair_in_f : ((s, (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) : ℝ × E) ∈ Slab_f := |
| 374 | ⟨hs_outer_Icc, h_orbit_in_r₀⟩ |
| 375 | have h_pre : ‖fderiv ℝ (f s) ((aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1)‖ ≤ K_pre := |
| 376 | hK_pre_bd ((s, (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) : ℝ × E) h_pair_in_f |
| 377 | rw [hK_orig_def] |
| 378 | exact h_pre.trans (le_add_of_nonneg_right zero_le_one) |
| 379 | have h_KT_final : K_orig * T_final < 1 := by |
| 380 | have : K_orig * T_final < K_orig * T_mid := |
| 381 | mul_lt_mul_of_pos_left hT_final_lt_mid hK_orig_pos |
| 382 | linarith |
| 383 | have h_aΦ_snd_eq : (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), t⟩).2 |
| 384 | = variationalLinearMapAt (f := f) |
| 385 | (α := fun s => (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) (t₀ := t₀) |
| 386 | hT_final_pos hK_orig_nn h_KT_final hA_cont_orbit_a hA_bd_orbit_a ht_Icc_final := |
| 387 | augFlow_snd_eq_variationalLinearMapAt (aΦ := aΦ) (R := R_aug) (tmin' := tmin_a) |
| 388 | (tmax' := tmax_a) (p₀ := p₀) haΦ |
| 389 | (T := T_final) (M := K_orig) hT_final_pos hK_orig_nn h_KT_final hsub_final_aug |
| 390 | (x := x) hx_id_closed_R_aug hA_cont_orbit_a hA_bd_orbit_a ht_Icc_final |
| 391 | have hA_cont_orbit_Φ : ContinuousOn (fun s : ℝ => fderiv ℝ (f s) (Φ ⟨x, s⟩)) |
| 392 | (Icc (t₀ - T_final) (t₀ + T_final)) := by |
| 393 | have h_orbit_cont : ContinuousOn (fun s : ℝ => Φ ⟨x, s⟩) (Icc tmin tmax) := |
| 394 | hΦ.orbit_continuousOn x hx_closed_r |
| 395 | exact fderiv_along_continuousOn (E := E) (f := f) |
| 396 | (γ := fun s : ℝ => Φ ⟨x, s⟩) |
| 397 | (K := Icc (t₀ - T_final) (t₀ + T_final)) hpartial_f |
| 398 | (h_orbit_cont.mono hsub_final_orig) |
| 399 | have hA_bd_orbit_Φ : ∀ s ∈ Icc (t₀ - T_final) (t₀ + T_final), |
| 400 | ‖fderiv ℝ (f s) (Φ ⟨x, s⟩)‖ ≤ K_orig := by |
| 401 | intro s hs |
| 402 | have hs_outer_Icc : s ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := hsub_final_outer hs |
| 403 | have h_pair_in_outer : ((x, s) : E × ℝ) ∈ Slab_Φ_outer := |
| 404 | ⟨hx_closed_ρ_outer, hs_outer_Icc⟩ |
| 405 | have h_orbit_in_r₀ : Φ ⟨x, s⟩ ∈ closedBall x₀ r₀_lip := by |
| 406 | have h_pre : ‖Φ (x, s) - x₀‖ ≤ R_Φ_image_pre := hR_Φ_image_pre_bd _ h_pair_in_outer |
| 407 | rw [mem_closedBall, dist_eq_norm] |
| 408 | exact le_trans h_pre hr₀_lip_ge_Φ |
| 409 | have h_pair_in_f : ((s, Φ ⟨x, s⟩) : ℝ × E) ∈ Slab_f := ⟨hs_outer_Icc, h_orbit_in_r₀⟩ |
| 410 | have h_pre : ‖fderiv ℝ (f s) (Φ ⟨x, s⟩)‖ ≤ K_pre := |
| 411 | hK_pre_bd ((s, Φ ⟨x, s⟩) : ℝ × E) h_pair_in_f |
| 412 | rw [hK_orig_def] |
| 413 | exact h_pre.trans (le_add_of_nonneg_right zero_le_one) |
| 414 | have h_var_congr := variationalLinearMapAt_congr_of_eqOn (f := f) |
| 415 | (α₁ := fun s => (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), s⟩).1) |
| 416 | (α₂ := fun s => Φ ⟨x, s⟩) (t₀ := t₀) (T := T_final) (M := K_orig) |
| 417 | hT_final_pos hK_orig_nn h_KT_final |
| 418 | hA_cont_orbit_a hA_bd_orbit_a hA_cont_orbit_Φ hA_bd_orbit_Φ |
| 419 | h_orbit_eqOn.symm ht_Icc_final |
| 420 | have h_aΦ_snd_eq_Φ : (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), t⟩).2 |
| 421 | = variationalLinearMapAt (f := f) (α := fun s => Φ ⟨x, s⟩) (t₀ := t₀) |
| 422 | hT_final_pos hK_orig_nn h_KT_final hA_cont_orbit_Φ hA_bd_orbit_Φ ht_Icc_final := by |
| 423 | rw [h_aΦ_snd_eq, h_var_congr] |
| 424 | set ρ_outerN : ℝ≥0 := ⟨ρ_outer, le_of_lt hρ_outer_pos⟩ |
| 425 | set r'_φ : ℝ≥0 := ⟨ρ_outer / 2, by positivity⟩ |
| 426 | have hr'_φ_pos : (0 : ℝ) < (r'_φ : ℝ) := by change 0 < ρ_outer / 2; linarith |
| 427 | have hρρ'_φ : (ρ_outerN : ℝ) + (r'_φ : ℝ) ≤ (r : ℝ) := by |
| 428 | change ρ_outer + ρ_outer / 2 ≤ (r : ℝ) |
| 429 | have : ρ_outer + ρ_outer / 2 = ρ_outer * 3 / 2 := by ring |
| 430 | rw [this, hρ_outer_def] |
| 431 | have : (r : ℝ) / 2 * 3 / 2 ≤ (r : ℝ) := by linarith |
| 432 | linarith |
| 433 | have hA_bd_Φ_jointly : ∀ y ∈ closedBall x₀ (ρ_outerN : ℝ), |
| 434 | ∀ τ ∈ Icc (t₀ - T_mid) (t₀ + T_mid), |
| 435 | ‖fderiv ℝ (f τ) (Φ ⟨y, τ⟩)‖ ≤ K_orig := by |
| 436 | intro y hy τ hτ |
| 437 | have hy_closed_ρ_outer : y ∈ closedBall x₀ ρ_outer := by |
| 438 | change dist y x₀ ≤ ρ_outer |
| 439 | rw [mem_closedBall] at hy |
| 440 | exact hy |
| 441 | have hy_closed_r : y ∈ closedBall x₀ (r : ℝ) := |
| 442 | closedBall_subset_closedBall hρ_outer_le_r hy_closed_ρ_outer |
| 443 | have hτ_outer : τ ∈ Icc (t₀ - T_outer) (t₀ + T_outer) := by |
| 444 | exact ⟨by linarith [hτ.1], by linarith [hτ.2]⟩ |
| 445 | have h_pair_in_outer : ((y, τ) : E × ℝ) ∈ Slab_Φ_outer := ⟨hy_closed_ρ_outer, hτ_outer⟩ |
| 446 | have h_orbit_in_r₀ : Φ ⟨y, τ⟩ ∈ closedBall x₀ r₀_lip := by |
| 447 | have h_pre : ‖Φ (y, τ) - x₀‖ ≤ R_Φ_image_pre := hR_Φ_image_pre_bd _ h_pair_in_outer |
| 448 | rw [mem_closedBall, dist_eq_norm] |
| 449 | exact le_trans h_pre hr₀_lip_ge_Φ |
| 450 | have h_pair_in_f : ((τ, Φ ⟨y, τ⟩) : ℝ × E) ∈ Slab_f := ⟨hτ_outer, h_orbit_in_r₀⟩ |
| 451 | have h_pre : ‖fderiv ℝ (f τ) (Φ ⟨y, τ⟩)‖ ≤ K_pre := |
| 452 | hK_pre_bd ((τ, Φ ⟨y, τ⟩) : ℝ × E) h_pair_in_f |
| 453 | rw [hK_orig_def] |
| 454 | exact h_pre.trans (le_add_of_nonneg_right zero_le_one) |
| 455 | have hsub_mid_orig : Icc (t₀ - T_mid) (t₀ + T_mid) ⊆ Icc tmin tmax := by |
| 456 | exact Icc_subset_Icc (by linarith [hT_mid_lt_outer]) |
| 457 | (by linarith [hT_mid_lt_outer]) |
| 458 | have ht_Ioo_mid : t ∈ Ioo (t₀ - T_mid) (t₀ + T_mid) := by |
| 459 | exact ⟨by linarith [ht_Ioo_final.1, hT_final_lt_mid], |
| 460 | by linarith [ht_Ioo_final.2, hT_final_lt_mid]⟩ |
| 461 | have hx_closed_ρ_outerN : x ∈ closedBall x₀ (ρ_outerN : ℝ) := by |
| 462 | change dist x x₀ ≤ ρ_outer |
| 463 | rw [mem_closedBall] at hx_closed_ρ_outer |
| 464 | exact hx_closed_ρ_outer |
| 465 | have h_jointFD := hasFDerivAt_flow_jointly_at hΦ hf_C1 |
| 466 | hT_mid_pos hK_orig_nn hKT_mid hsub_mid_orig hr'_φ_pos hρρ'_φ hA_bd_Φ_jointly |
| 467 | hx_closed_ρ_outerN ht_Ioo_mid |
| 468 | have hfderiv_Φ_eq := h_jointFD.fderiv |
| 469 | set Lmap_mid := variationalLinearMapAt (f := f) (α := fun s => Φ ⟨x, s⟩) (t₀ := t₀) |
| 470 | hT_mid_pos hK_orig_nn hKT_mid |
| 471 | ((hΦ.continuousOn_fderiv_along_orbit hf_C1 x hx_closed_r).mono hsub_mid_orig) |
| 472 | (fun τ hτ => hA_bd_Φ_jointly x hx_closed_ρ_outerN τ hτ) |
| 473 | (Ioo_subset_Icc_self ht_Ioo_mid) |
| 474 | set Lti : ℝ →L[ℝ] E := (ContinuousLinearMap.id ℝ ℝ).smulRight (f t (Φ ⟨x, t⟩)) |
| 475 | have hgoal_lhs : fderiv ℝ Φ (x, t) = Lmap_mid.coprod Lti := hfderiv_Φ_eq |
| 476 | have hLmap_mid_restricted_to_final : Lmap_mid = |
| 477 | variationalLinearMapAt (f := f) (α := fun s => Φ ⟨x, s⟩) (t₀ := t₀) |
| 478 | hT_final_pos hK_orig_nn h_KT_final hA_cont_orbit_Φ hA_bd_orbit_Φ ht_Icc_final := by |
| 479 | apply ContinuousLinearMap.ext |
| 480 | intro δ |
| 481 | have h_sol_mid := variationalSolutionFun_isSolution hT_mid_pos hK_orig_nn hKT_mid |
| 482 | ((hΦ.continuousOn_fderiv_along_orbit hf_C1 x hx_closed_r).mono hsub_mid_orig) |
| 483 | (fun τ hτ => hA_bd_Φ_jointly x hx_closed_ρ_outerN τ hτ) δ |
| 484 | have h_sol_final := variationalSolutionFun_isSolution hT_final_pos hK_orig_nn h_KT_final |
| 485 | hA_cont_orbit_Φ hA_bd_orbit_Φ δ |
| 486 | have hsub_final_mid : Icc (t₀ - T_final) (t₀ + T_final) ⊆ Icc (t₀ - T_mid) (t₀ + T_mid) := |
| 487 | Icc_subset_Icc |
| 488 | (sub_le_sub_left (le_of_lt hT_final_lt_mid) t₀) |
| 489 | (add_le_add_right (le_of_lt hT_final_lt_mid) t₀) |
| 490 | have h_sol_mid_restricted := h_sol_mid.mono hsub_final_mid |
| 491 | have h_eq_y := IsVariationalSolutionOn.unique_Icc hT_final_pos hA_cont_orbit_Φ |
| 492 | h_sol_mid_restricted h_sol_final |
| 493 | rw [variationalLinearMapAt_apply, variationalLinearMapAt_apply] |
| 494 | exact h_eq_y ht_Icc_final |
| 495 | have hLmap_mid_eq_aΦ_snd : Lmap_mid = (aΦ ⟨(x, ContinuousLinearMap.id ℝ E), t⟩).2 := by |
| 496 | rw [hLmap_mid_restricted_to_final, ← h_aΦ_snd_eq_Φ] |
| 497 | rw [hgoal_lhs, hLmap_mid_eq_aΦ_snd] |
| 498 | rfl |
| 499 | |
| 500 | end CoproductHelper |
| 501 | |
| 502 | end Poincare.ODE.LocalFlow |
| 503 | |
| 504 | end |