Navier–Stokes: the Lean blow-up proof, cleaned up together
OpenAI's 2026 Lean proofs of blowup for forced Navier–Stokes and Euler, rerun by others, not refereed, no ruling from Clay; cleaned up together: more readable, faster to build

| 1 | import NavierStokes.MovingFrameODE |
| 2 | import NavierStokes.ChartScales |
| 3 | import Mathlib.Algebra.Order.Floor.Ring |
| 4 | import Mathlib.Analysis.Calculus.MeanValue |
| 5 | |
| 6 | /-! |
| 7 | # Quantitative estimates for the actual pulse normal |
| 8 | |
| 9 | The rounded frequency is used consistently throughout the actual phase. The |
| 10 | estimates below start from representative data and local base derivative bounds, |
| 11 | rather than assuming that the normal is close to its reference value. |
| 12 | -/ |
| 13 | |
| 14 | namespace NavierStokes.PhaseEstimates |
| 15 | |
| 16 | open Set Filter |
| 17 | open scoped Topology InnerProductSpace |
| 18 | |
| 19 | abbrev Plane := MovingFrameODE.Plane |
| 20 | abbrev Space := MovingFrameODE.Space |
| 21 | abbrev Slow := PhaseCalculus.Slow |
| 22 | |
| 23 | /-- Rounding in the punctured integer lattice. The zero floor is replaced by |
| 24 | one; the distance to the input is still at most one. -/ |
| 25 | noncomputable def nonzeroRound (x : ℝ) : ℤ := if Int.floor x = 0 then 1 else Int.floor x |
| 26 | |
| 27 | theorem nonzeroRound_ne_zero (x : ℝ) : nonzeroRound x ≠ 0 := by |
| 28 | unfold nonzeroRound |
| 29 | split_ifs with h |
| 30 | · norm_num |
| 31 | · exact h |
| 32 | |
| 33 | theorem nonzeroRound_error (x : ℝ) : |(nonzeroRound x : ℝ) - x| ≤ 1 := by |
| 34 | have hlo := Int.floor_le x |
| 35 | have hhi := Int.lt_floor_add_one x |
| 36 | unfold nonzeroRound |
| 37 | split_ifs with h |
| 38 | · rw [h] at hlo hhi |
| 39 | norm_num at hlo hhi ⊢ |
| 40 | exact abs_le.mpr ⟨by linarith, by linarith⟩ |
| 41 | · exact abs_le.mpr ⟨by linarith, by linarith⟩ |
| 42 | |
| 43 | noncomputable def roundedFrequency (k target : ℝ) : ℝ := (nonzeroRound (k * target) : ℝ) / k |
| 44 | |
| 45 | theorem roundedFrequency_integer {k : ℝ} (hk : k ≠ 0) (target : ℝ) : |
| 46 | k * roundedFrequency k target = (nonzeroRound (k * target) : ℝ) := by |
| 47 | unfold roundedFrequency |
| 48 | field_simp |
| 49 | |
| 50 | theorem roundedFrequency_nonzero {k : ℝ} (hk : k ≠ 0) (target : ℝ) : |
| 51 | ∃ m : ℤ, m ≠ 0 ∧ k * roundedFrequency k target = (m : ℝ) := |
| 52 | ⟨nonzeroRound (k * target), nonzeroRound_ne_zero _, roundedFrequency_integer hk target⟩ |
| 53 | |
| 54 | theorem roundedFrequency_ne_zero {k : ℝ} (hk : k ≠ 0) (target : ℝ) : |
| 55 | roundedFrequency k target ≠ 0 := by |
| 56 | apply div_ne_zero _ hk |
| 57 | exact_mod_cast nonzeroRound_ne_zero (k * target) |
| 58 | |
| 59 | theorem roundedFrequency_error {k : ℝ} (hk : 0 < k) (target : ℝ) : |
| 60 | |roundedFrequency k target - target| ≤ 1 / k := by |
| 61 | have heq : roundedFrequency k target - target = |
| 62 | ((nonzeroRound (k * target) : ℝ) - k * target) / k := by |
| 63 | unfold roundedFrequency |
| 64 | field_simp |
| 65 | rw [heq, abs_div, abs_of_pos hk] |
| 66 | exact div_le_div_of_nonneg_right (nonzeroRound_error _) hk.le |
| 67 | |
| 68 | /-- The fixed representative frequency in its two tangential components. -/ |
| 69 | noncomputable def representativeFrequency (B sigma u L : ℝ) (K g : Plane) : Plane := |
| 70 | B • (K - (sigma * u / (L * ‖g‖ ^ 2)) • g) |
| 71 | |
| 72 | theorem representative_slope (B sigma u L : ℝ) (K g : Plane) |
| 73 | (hg : g ≠ 0) (horth : ⟪K, g⟫_ℝ = 0) : |
| 74 | ⟪representativeFrequency B sigma u L K g, g⟫_ℝ = -sigma * B * u / L := by |
| 75 | have hnorm : ‖g‖ ≠ 0 := norm_ne_zero_iff.mpr hg |
| 76 | simp only [representativeFrequency, real_inner_smul_left, inner_sub_left, |
| 77 | real_inner_self_eq_norm_sq, horth] |
| 78 | by_cases hL : L = 0 |
| 79 | · simp [hL] |
| 80 | · field_simp |
| 81 | ring |
| 82 | |
| 83 | theorem representative_tilt (B sigma u L : ℝ) (K g : Plane) : |
| 84 | ‖representativeFrequency B sigma u L K g - B • K‖ = |
| 85 | |B| * |sigma| * |u| / (|L| * ‖g‖) := by |
| 86 | by_cases hg : g = 0 |
| 87 | · simp [representativeFrequency, hg] |
| 88 | have hnorm : ‖g‖ ≠ 0 := norm_ne_zero_iff.mpr hg |
| 89 | have heq : representativeFrequency B sigma u L K g - B • K = |
| 90 | -(B * (sigma * u / (L * ‖g‖ ^ 2))) • g := by |
| 91 | unfold representativeFrequency |
| 92 | module |
| 93 | rw [heq, norm_smul] |
| 94 | simp only [norm_neg, Real.norm_eq_abs, abs_mul, abs_div, abs_pow, abs_norm] |
| 95 | by_cases hL : L = 0 |
| 96 | · simp [hL] |
| 97 | · have habsL : |L| ≠ 0 := abs_ne_zero.mpr hL |
| 98 | field_simp |
| 99 | |
| 100 | /-- A bound on the fixed representative frequency follows from its explicit |
| 101 | tilt; its angular component is later multiplied by the representative radius. -/ |
| 102 | theorem representative_frequency_bound (B sigma u L : ℝ) (K g : Plane) |
| 103 | (hK : ‖K‖ = 1) : |
| 104 | ‖representativeFrequency B sigma u L K g‖ ≤ |
| 105 | |B| + |B| * |sigma| * |u| / (|L| * ‖g‖) := by |
| 106 | have h := norm_add_le (representativeFrequency B sigma u L K g - B • K) (B • K) |
| 107 | rw [sub_add_cancel, representative_tilt, norm_smul, Real.norm_eq_abs, hK, mul_one] at h |
| 108 | linarith only [h] |
| 109 | |
| 110 | noncomputable def signedSlot (sigma u L v : ℝ) : ℝ := sigma * (u / 2 + u * v / L) |
| 111 | |
| 112 | /-- The cancellation producing the intended radial slope is exact for the |
| 113 | unrounded representative data. -/ |
| 114 | theorem radial_reference_identity (B sigma u L v : ℝ) : |
| 115 | sigma * B * u / 2 - v * (-sigma * B * u / L) = B * signedSlot sigma u L v := by |
| 116 | unfold signedSlot |
| 117 | ring |
| 118 | |
| 119 | /-! ## Local C2 control implies the derivative comparison at the representative -/ |
| 120 | |
| 121 | section LocalBase |
| 122 | |
| 123 | variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] |
| 124 | |
| 125 | /-- The second derivative controls variation of the first derivative across |
| 126 | a convex chart. The actual base differs in C1 by the independently supplied |
| 127 | `baseError`, and the chart diameter is `diameter`. -/ |
| 128 | theorem local_first_derivative_close {F F0 : E → ℝ} {U : Set E} {q q0 : E} |
| 129 | {M diameter baseError : ℝ} (hM : 0 ≤ M) (hU : Convex ℝ U) |
| 130 | (hq : q ∈ U) (hq0 : q0 ∈ U) |
| 131 | (hC2 : ∀ x ∈ U, DifferentiableAt ℝ (fderiv ℝ F0) x) |
| 132 | (hsecond : ∀ x ∈ U, ‖fderiv ℝ (fderiv ℝ F0) x‖ ≤ M) |
| 133 | (hdiameter : ‖q - q0‖ ≤ diameter) |
| 134 | (hbase : ‖fderiv ℝ F q - fderiv ℝ F0 q‖ ≤ baseError) : |
| 135 | ‖fderiv ℝ F q - fderiv ℝ F0 q0‖ ≤ M * diameter + baseError := by |
| 136 | have hlocal := hU.norm_image_sub_le_of_norm_fderiv_le hC2 hsecond hq0 hq |
| 137 | calc |
| 138 | _ ≤ ‖fderiv ℝ F q - fderiv ℝ F0 q‖ + ‖fderiv ℝ F0 q - fderiv ℝ F0 q0‖ := |
| 139 | norm_sub_le_norm_sub_add_norm_sub _ _ _ |
| 140 | _ ≤ baseError + M * diameter := add_le_add hbase |
| 141 | (hlocal.trans (mul_le_mul_of_nonneg_left hdiameter hM)) |
| 142 | _ = _ := by ring |
| 143 | |
| 144 | theorem local_directional_derivative_close {F F0 : E → ℝ} {U : Set E} {q q0 e : E} |
| 145 | {M diameter baseError : ℝ} (hM : 0 ≤ M) (hU : Convex ℝ U) |
| 146 | (hq : q ∈ U) (hq0 : q0 ∈ U) |
| 147 | (hC2 : ∀ x ∈ U, DifferentiableAt ℝ (fderiv ℝ F0) x) |
| 148 | (hsecond : ∀ x ∈ U, ‖fderiv ℝ (fderiv ℝ F0) x‖ ≤ M) |
| 149 | (hdiameter : ‖q - q0‖ ≤ diameter) |
| 150 | (hbase : ‖fderiv ℝ F q - fderiv ℝ F0 q‖ ≤ baseError) (he : ‖e‖ ≤ 1) : |
| 151 | |fderiv ℝ F q e - fderiv ℝ F0 q0 e| ≤ M * diameter + baseError := by |
| 152 | have hop := local_first_derivative_close hM hU hq hq0 hC2 hsecond hdiameter hbase |
| 153 | have hbound : 0 ≤ M * diameter + baseError := (norm_nonneg _).trans hop |
| 154 | calc |
| 155 | _ = ‖(fderiv ℝ F q - fderiv ℝ F0 q0) e‖ := (Real.norm_eq_abs _).symm |
| 156 | _ ≤ ‖fderiv ℝ F q - fderiv ℝ F0 q0‖ * ‖e‖ := ContinuousLinearMap.le_opNorm _ _ |
| 157 | _ ≤ (M * diameter + baseError) * 1 := mul_le_mul hop he (norm_nonneg _) hbound |
| 158 | _ = _ := mul_one _ |
| 159 | |
| 160 | end LocalBase |
| 161 | |
| 162 | /-! ## Pointwise error estimates before choosing the band scale -/ |
| 163 | |
| 164 | theorem radial_frequency_error {p target pz a a0 b b0 M rounding base : ℝ} |
| 165 | (hp : |p - target| ≤ rounding) (ha : |a| ≤ M) |
| 166 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) |
| 167 | (ha0 : |a - a0| ≤ base) (hb0 : |b - b0| ≤ base) : |
| 168 | |(p * a + pz * b) - (target * a0 + pz * b0)| ≤ M * rounding + 2 * M * base := by |
| 169 | have hM : 0 ≤ M := (abs_nonneg _).trans ha |
| 170 | have hr : 0 ≤ rounding := (abs_nonneg _).trans hp |
| 171 | have hbase : 0 ≤ base := (abs_nonneg _).trans ha0 |
| 172 | calc |
| 173 | _ = |(p - target) * a + target * (a - a0) + pz * (b - b0)| := by congr 1; ring |
| 174 | _ ≤ |(p - target) * a + target * (a - a0)| + |pz * (b - b0)| := abs_add_le _ _ |
| 175 | _ ≤ (|(p - target) * a| + |target * (a - a0)|) + |pz * (b - b0)| := |
| 176 | add_le_add_left (abs_add_le _ _) _ |
| 177 | _ = (|p - target| * |a| + |target| * |a - a0|) + |pz| * |b - b0| := by |
| 178 | rw [abs_mul, abs_mul, abs_mul] |
| 179 | _ ≤ (rounding * M + M * base) + M * base := add_le_add |
| 180 | (add_le_add (mul_le_mul hp ha (abs_nonneg _) hr) |
| 181 | (mul_le_mul htarget ha0 (abs_nonneg _) hM)) |
| 182 | (mul_le_mul hpz hb0 (abs_nonneg _) hM) |
| 183 | _ = _ := by ring |
| 184 | |
| 185 | theorem angular_frequency_error {p target R R0 M rounding diameter : ℝ} |
| 186 | (hR : R ≠ 0) (hR0 : R0 ≠ 0) |
| 187 | (hp : |p - target| ≤ rounding) (htarget : |target| ≤ M) |
| 188 | (hRi : |1 / R| ≤ M) (hR0i : |1 / R0| ≤ M) (hRd : |R - R0| ≤ diameter) : |
| 189 | |p / R - target / R0| ≤ M * rounding + M ^ 3 * diameter := by |
| 190 | have hM : 0 ≤ M := (abs_nonneg _).trans htarget |
| 191 | have hr : 0 ≤ rounding := (abs_nonneg _).trans hp |
| 192 | have hd : 0 ≤ diameter := (abs_nonneg _).trans hRd |
| 193 | have htriple : |target * (1 / R) * (1 / R0)| ≤ M ^ 3 := by |
| 194 | rw [abs_mul, abs_mul] |
| 195 | calc |
| 196 | _ ≤ (M * M) * M := mul_le_mul |
| 197 | (mul_le_mul htarget hRi (abs_nonneg _) hM) hR0i (abs_nonneg _) (mul_nonneg hM hM) |
| 198 | _ = _ := by ring |
| 199 | have heq : p / R - target / R0 = |
| 200 | (p - target) * (1 / R) + (target * (1 / R) * (1 / R0)) * (R0 - R) := by |
| 201 | field_simp ; ring |
| 202 | rw [heq] |
| 203 | calc |
| 204 | _ ≤ |(p - target) * (1 / R)| + |(target * (1 / R) * (1 / R0)) * (R0 - R)| := abs_add_le _ _ |
| 205 | _ = |p - target| * |1 / R| + |target * (1 / R) * (1 / R0)| * |R0 - R| := by |
| 206 | rw [abs_mul, abs_mul] |
| 207 | _ ≤ rounding * M + M ^ 3 * diameter := add_le_add |
| 208 | (mul_le_mul hp hRi (abs_nonneg _) hr) |
| 209 | (mul_le_mul htriple (by simpa only [abs_sub_comm] using hRd) (abs_nonneg _) (pow_nonneg hM _)) |
| 210 | _ = _ := by ring |
| 211 | |
| 212 | theorem axial_frequency_bound {p target pz a b M rounding : ℝ} |
| 213 | (hM : 1 ≤ M) (hr : rounding ≤ 1) (hp : |p - target| ≤ rounding) |
| 214 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) (ha : |a| ≤ M) (hb : |b| ≤ M) : |
| 215 | |p * a + pz * b| ≤ 3 * M ^ 2 := by |
| 216 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 217 | have hpp : |p| ≤ 2 * M := by |
| 218 | have h := (abs_add_le (p - target) target) |
| 219 | rw [sub_add_cancel] at h |
| 220 | linarith only [h, hp, hr, htarget, hM] |
| 221 | calc |
| 222 | _ ≤ |p * a| + |pz * b| := abs_add_le _ _ |
| 223 | _ = |p| * |a| + |pz| * |b| := by rw [abs_mul, abs_mul] |
| 224 | _ ≤ (2 * M) * M + M * M := add_le_add |
| 225 | (mul_le_mul hpp ha (abs_nonneg _) (by positivity)) |
| 226 | (mul_le_mul hpz hb (abs_nonneg _) hM0) |
| 227 | _ = _ := by ring |
| 228 | |
| 229 | noncomputable def explicitNormal (ε p pz x0 R v FR GR FZ GZ : ℝ) : Space := |
| 230 | !₂[x0 - v * (p * FR + pz * GR), p / R, pz - ε * v * (p * FZ + pz * GZ)] |
| 231 | |
| 232 | noncomputable def referenceNormal (B sigma u L v : ℝ) (K : Plane) : Space := |
| 233 | MovingFrameODE.pack (B * signedSlot sigma u L v) (B • K) |
| 234 | |
| 235 | theorem vec3_norm_le_sum (w : Space) : ‖w‖ ≤ |w 0| + |w 1| + |w 2| := by |
| 236 | have hs := PhaseCalculus.vec3_norm_sq w |
| 237 | nlinarith only [hs, norm_nonneg w, sq_abs (w 0), sq_abs (w 1), sq_abs (w 2), |
| 238 | abs_nonneg (w 0), abs_nonneg (w 1), abs_nonneg (w 2), |
| 239 | mul_nonneg (abs_nonneg (w 0)) (abs_nonneg (w 1)), |
| 240 | mul_nonneg (abs_nonneg (w 0)) (abs_nonneg (w 2)), |
| 241 | mul_nonneg (abs_nonneg (w 1)) (abs_nonneg (w 2))] |
| 242 | |
| 243 | /-- Assembly of the actual normal error from its three independently derived |
| 244 | coefficient errors. Slot length multiplies only the radial and axial defects. -/ |
| 245 | theorem normal_error_from_components |
| 246 | {ε p pz R v FR GR FZ GZ B sigma u L radial angular axial shear : ℝ} {K : Plane} |
| 247 | (hRadial : |p * FR + pz * GR - (-sigma * B * u / L)| ≤ radial) |
| 248 | (hAngular : |p / R - B * K 0| ≤ angular) |
| 249 | (hAxial : |pz - B * K 1| ≤ axial) |
| 250 | (hShear : |p * FZ + pz * GZ| ≤ shear) : |
| 251 | ‖explicitNormal ε p pz (sigma * B * u / 2) R v FR GR FZ GZ - |
| 252 | referenceNormal B sigma u L v K‖ ≤ |
| 253 | |v| * radial + angular + axial + |ε| * |v| * shear := by |
| 254 | have hrad : |sigma * B * u / 2 - v * (p * FR + pz * GR) - B * signedSlot sigma u L v| ≤ |
| 255 | |v| * radial := by |
| 256 | have heq : sigma * B * u / 2 - v * (p * FR + pz * GR) - B * signedSlot sigma u L v = |
| 257 | -v * (p * FR + pz * GR - (-sigma * B * u / L)) := by |
| 258 | unfold signedSlot |
| 259 | ring |
| 260 | rw [heq, abs_mul, abs_neg] |
| 261 | exact mul_le_mul_of_nonneg_left hRadial (abs_nonneg _) |
| 262 | have hz : |pz - ε * v * (p * FZ + pz * GZ) - B * K 1| ≤ axial + |ε| * |v| * shear := by |
| 263 | calc |
| 264 | _ = |(pz - B * K 1) - ε * v * (p * FZ + pz * GZ)| := by congr 1; ring |
| 265 | _ ≤ |pz - B * K 1| + |ε * v * (p * FZ + pz * GZ)| := abs_sub _ _ |
| 266 | _ = |pz - B * K 1| + |ε| * |v| * |p * FZ + pz * GZ| := by rw [abs_mul, abs_mul] |
| 267 | _ ≤ axial + |ε| * |v| * shear := add_le_add hAxial |
| 268 | (mul_le_mul_of_nonneg_left hShear (mul_nonneg (abs_nonneg _) (abs_nonneg _))) |
| 269 | have h := vec3_norm_le_sum (explicitNormal ε p pz (sigma * B * u / 2) R v FR GR FZ GZ - |
| 270 | referenceNormal B sigma u L v K) |
| 271 | change ‖explicitNormal ε p pz (sigma * B * u / 2) R v FR GR FZ GZ - |
| 272 | referenceNormal B sigma u L v K‖ ≤ |
| 273 | |sigma * B * u / 2 - v * (p * FR + pz * GR) - B * signedSlot sigma u L v| + |
| 274 | |p / R - B * K 0| + |pz - ε * v * (p * FZ + pz * GZ) - B * K 1| at h |
| 275 | linarith only [h, hrad, hAngular, hz] |
| 276 | |
| 277 | theorem representative_slope_coordinates |
| 278 | {B sigma u L R0 target pz FR0 GR0 : ℝ} {K g : Plane} |
| 279 | (hR0 : R0 ≠ 0) (hg : g ≠ 0) (horth : ⟪K, g⟫_ℝ = 0) |
| 280 | (hgdef : g = !₂[R0 * FR0, GR0]) |
| 281 | (hfreq : (!₂[target / R0, pz] : Plane) = representativeFrequency B sigma u L K g) : |
| 282 | target * FR0 + pz * GR0 = -sigma * B * u / L := by |
| 283 | have h := representative_slope B sigma u L K g hg horth |
| 284 | rw [← hfreq, hgdef] at h |
| 285 | have hi : ⟪(!₂[target / R0, pz] : Plane), (!₂[R0 * FR0, GR0] : Plane)⟫_ℝ = |
| 286 | target * FR0 + pz * GR0 := by |
| 287 | simp [PiLp.inner_apply, Fin.sum_univ_two] |
| 288 | field_simp |
| 289 | rwa [hi] at h |
| 290 | |
| 291 | theorem representative_coordinate_errors |
| 292 | {B sigma u L R0 target pz : ℝ} {K g : Plane} |
| 293 | (hfreq : (!₂[target / R0, pz] : Plane) = representativeFrequency B sigma u L K g) : |
| 294 | |target / R0 - B * K 0| ≤ |B| * |sigma| * |u| / (|L| * ‖g‖) ∧ |
| 295 | |pz - B * K 1| ≤ |B| * |sigma| * |u| / (|L| * ‖g‖) := by |
| 296 | have h (i : Fin 2) := PiLp.norm_apply_le (representativeFrequency B sigma u L K g - B • K) i |
| 297 | rw [representative_tilt, ← hfreq] at h |
| 298 | constructor |
| 299 | · simpa using h 0 |
| 300 | · simpa using h 1 |
| 301 | |
| 302 | /-- The complete finite estimate starts from the chosen representative and |
| 303 | the local derivatives of the actual base. -/ |
| 304 | theorem explicit_normal_estimate |
| 305 | {ε p target pz R R0 v FR GR FZ GZ FR0 GR0 B sigma u L M rounding diameter base : ℝ} |
| 306 | {K g : Plane} |
| 307 | (hR : R ≠ 0) (hR0 : R0 ≠ 0) (hg : g ≠ 0) (horth : ⟪K, g⟫_ℝ = 0) |
| 308 | (hgdef : g = !₂[R0 * FR0, GR0]) |
| 309 | (hfreq : (!₂[target / R0, pz] : Plane) = representativeFrequency B sigma u L K g) |
| 310 | (hM : 1 ≤ M) (hround : rounding ≤ 1) (hp : |p - target| ≤ rounding) |
| 311 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) |
| 312 | (hRi : |1 / R| ≤ M) (hR0i : |1 / R0| ≤ M) (hRd : |R - R0| ≤ diameter) |
| 313 | (hFR : |FR| ≤ M) (hFZ : |FZ| ≤ M) (hGZ : |GZ| ≤ M) |
| 314 | (hFR0 : |FR - FR0| ≤ base) (hGR0 : |GR - GR0| ≤ base) : |
| 315 | ‖explicitNormal ε p pz (sigma * B * u / 2) R v FR GR FZ GZ - |
| 316 | referenceNormal B sigma u L v K‖ ≤ |
| 317 | |v| * (M * rounding + 2 * M * base) + M * rounding + M ^ 3 * diameter + |
| 318 | 2 * (|B| * |sigma| * |u| / (|L| * ‖g‖)) + |ε| * |v| * (3 * M ^ 2) := by |
| 319 | have hslope := representative_slope_coordinates hR0 hg horth hgdef hfreq |
| 320 | have hrad := radial_frequency_error hp hFR htarget hpz hFR0 hGR0 |
| 321 | rw [hslope] at hrad |
| 322 | have hangle := angular_frequency_error hR hR0 hp htarget hRi hR0i hRd |
| 323 | obtain ⟨hc0, hc1⟩ := representative_coordinate_errors hfreq |
| 324 | have hangular : |p / R - B * K 0| ≤ M * rounding + M ^ 3 * diameter + |
| 325 | |B| * |sigma| * |u| / (|L| * ‖g‖) := by |
| 326 | calc |
| 327 | _ ≤ |p / R - target / R0| + |target / R0 - B * K 0| := abs_sub_le _ _ _ |
| 328 | _ ≤ _ := add_le_add hangle hc0 |
| 329 | have hshear := axial_frequency_bound hM hround hp htarget hpz hFZ hGZ |
| 330 | have h := normal_error_from_components (ε := ε) (v := v) hrad hangular hc1 hshear |
| 331 | linarith only [h] |
| 332 | |
| 333 | theorem phaseNormal_eq_explicit (ε p pz x0 : ℝ) (F G : Slow → ℝ) |
| 334 | (q : PhaseCalculus.Slot) (hε : ε ≠ 0) |
| 335 | (hF : DifferentiableAt ℝ F q.1) (hG : DifferentiableAt ℝ G q.1) : |
| 336 | PhaseCalculus.phaseNormal ε p pz x0 F G q = |
| 337 | explicitNormal ε p pz x0 q.1.1 q.2.2 |
| 338 | (PhaseCalculus.slowR F q.1) (PhaseCalculus.slowR G q.1) |
| 339 | (PhaseCalculus.slowZ F q.1) (PhaseCalculus.slowZ G q.1) := |
| 340 | PhaseCalculus.phaseNormal_formula ε p pz x0 F G q hε hF hG |
| 341 | |
| 342 | noncomputable def phaseError (S ε k : ℝ) : ℝ := 1 / S + S * ε ^ 2 + S / k + ε * S |
| 343 | noncomputable def phaseConstant (M : ℝ) : ℝ := 8 * M ^ 3 + 2 * M ^ 4 |
| 344 | |
| 345 | theorem inverse_cube_bounds {S : ℝ} (hS : 1 ≤ S) : |
| 346 | 1 / S ^ 3 ≤ 1 / S ∧ S * (1 / S ^ 3) ≤ 1 / S := by |
| 347 | have hS0 : 0 < S := lt_of_lt_of_le zero_lt_one hS |
| 348 | have h2 : S ≤ S ^ 2 := by nlinarith only [hS] |
| 349 | have h3 : S ^ 2 ≤ S ^ 3 := by |
| 350 | have h := mul_le_mul_of_nonneg_left hS (sq_nonneg S) |
| 351 | nlinarith only [h] |
| 352 | constructor |
| 353 | · exact one_div_le_one_div_of_le hS0 (h2.trans h3) |
| 354 | · have heq : S * (1 / S ^ 3) = 1 / S ^ 2 := by field_simp |
| 355 | rw [heq] |
| 356 | exact one_div_le_one_div_of_le hS0 h2 |
| 357 | |
| 358 | theorem representative_tilt_scaled {B sigma u L M S : ℝ} {g : Plane} |
| 359 | (hM : 0 ≤ M) (hB : |B| ≤ M) (hsigma : |sigma| = 1) |
| 360 | (hu : |u| ≤ M) (hg : 1 / ‖g‖ ≤ M) (hL : 1 / |L| ≤ M / S) : |
| 361 | |B| * |sigma| * |u| / (|L| * ‖g‖) ≤ M ^ 4 / S := by |
| 362 | rw [hsigma, mul_one] |
| 363 | have hbu : |B| * |u| ≤ M * M := mul_le_mul hB hu (abs_nonneg _) hM |
| 364 | calc |
| 365 | _ = (|B| * |u|) * (1 / ‖g‖) * (1 / |L|) := by ring |
| 366 | _ ≤ (M * M) * M * (M / S) := mul_le_mul |
| 367 | (mul_le_mul hbu hg (one_div_nonneg.mpr (norm_nonneg _)) (mul_nonneg hM hM)) hL |
| 368 | (one_div_nonneg.mpr (abs_nonneg _)) (by positivity) |
| 369 | _ = _ := by ring |
| 370 | |
| 371 | /-- A single algebraic estimate displays every long-slot loss. -/ |
| 372 | theorem assembled_error_scaled {M S ε k v tilt : ℝ} |
| 373 | (hM : 1 ≤ M) (hS : 1 ≤ S) (hk : 0 < k) (hε : 0 ≤ ε) |
| 374 | (hv : |v| ≤ M * S) (htilt : tilt ≤ M ^ 4 / S) : |
| 375 | |v| * (M * (1 / k) + 2 * M * (M * (1 / S ^ 3 + ε ^ 2))) + |
| 376 | M * (1 / k) + M ^ 3 * (1 / S ^ 3) + 2 * tilt + |ε| * |v| * (3 * M ^ 2) ≤ |
| 377 | phaseConstant M * phaseError S ε k := by |
| 378 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 379 | have hS0 : 0 < S := lt_of_lt_of_le zero_lt_one hS |
| 380 | have he0 : 0 ≤ 1 / S := (one_div_pos.mpr hS0).le |
| 381 | have he1 : 0 ≤ S * ε ^ 2 := mul_nonneg hS0.le (sq_nonneg _) |
| 382 | have he2 : 0 ≤ S / k := (div_pos hS0 hk).le |
| 383 | have he3 : 0 ≤ ε * S := mul_nonneg hε hS0.le |
| 384 | have hE : 0 ≤ phaseError S ε k := by unfold phaseError; positivity |
| 385 | have hE0 : 1 / S ≤ phaseError S ε k := by unfold phaseError; linarith only [he1, he2, he3] |
| 386 | have hE01 : 1 / S + S * ε ^ 2 ≤ phaseError S ε k := by unfold phaseError; linarith only [he2, he3] |
| 387 | have hE2 : S / k ≤ phaseError S ε k := by unfold phaseError; linarith only [he0, he1, he3] |
| 388 | have hE3 : ε * S ≤ phaseError S ε k := by unfold phaseError; linarith only [he0, he1, he2] |
| 389 | have hcubes := inverse_cube_bounds hS |
| 390 | have hround : |v| * (M * (1 / k)) ≤ M ^ 2 * phaseError S ε k := by |
| 391 | calc |
| 392 | _ ≤ (M * S) * (M * (1 / k)) := mul_le_mul_of_nonneg_right hv (by positivity) |
| 393 | _ = M ^ 2 * (S / k) := by ring |
| 394 | _ ≤ _ := mul_le_mul_of_nonneg_left hE2 (sq_nonneg M) |
| 395 | have hbase : |v| * (2 * M * (M * (1 / S ^ 3 + ε ^ 2))) ≤ 2 * M ^ 3 * phaseError S ε k := by |
| 396 | calc |
| 397 | _ ≤ (M * S) * (2 * M * (M * (1 / S ^ 3 + ε ^ 2))) := mul_le_mul_of_nonneg_right hv (by positivity) |
| 398 | _ = 2 * M ^ 3 * (S * (1 / S ^ 3) + S * ε ^ 2) := by ring |
| 399 | _ ≤ 2 * M ^ 3 * (1 / S + S * ε ^ 2) := |
| 400 | mul_le_mul_of_nonneg_left (add_le_add_left hcubes.2 _) (by positivity) |
| 401 | _ ≤ _ := mul_le_mul_of_nonneg_left hE01 (by positivity) |
| 402 | have hangle : M * (1 / k) ≤ M * phaseError S ε k := by |
| 403 | apply mul_le_mul_of_nonneg_left _ hM0 |
| 404 | exact (div_le_div_of_nonneg_right hS hk.le).trans hE2 |
| 405 | have hdiam : M ^ 3 * (1 / S ^ 3) ≤ M ^ 3 * phaseError S ε k := |
| 406 | mul_le_mul_of_nonneg_left (hcubes.1.trans hE0) (pow_nonneg hM0 _) |
| 407 | have htilt' : 2 * tilt ≤ 2 * M ^ 4 * phaseError S ε k := by |
| 408 | calc |
| 409 | _ ≤ 2 * (M ^ 4 / S) := mul_le_mul_of_nonneg_left htilt (by norm_num) |
| 410 | _ = (2 * M ^ 4) * (1 / S) := by ring |
| 411 | _ ≤ _ := mul_le_mul_of_nonneg_left hE0 (by positivity) |
| 412 | have haxial : |ε| * |v| * (3 * M ^ 2) ≤ 3 * M ^ 3 * phaseError S ε k := by |
| 413 | rw [abs_of_nonneg hε] |
| 414 | calc |
| 415 | _ ≤ ε * (M * S) * (3 * M ^ 2) := mul_le_mul_of_nonneg_right |
| 416 | (mul_le_mul_of_nonneg_left hv hε) (by positivity) |
| 417 | _ = 3 * M ^ 3 * (ε * S) := by ring |
| 418 | _ ≤ _ := mul_le_mul_of_nonneg_left hE3 (by positivity) |
| 419 | have h2 : M ≤ M ^ 2 := by nlinarith only [hM] |
| 420 | have h3 : M ^ 2 ≤ M ^ 3 := by |
| 421 | have h := mul_le_mul_of_nonneg_left hM (sq_nonneg M) |
| 422 | nlinarith only [h] |
| 423 | have hcoeff : M ^ 2 + M ≤ 2 * M ^ 3 := by linarith only [h2, h3] |
| 424 | have hlast := mul_le_mul_of_nonneg_right hcoeff hE |
| 425 | unfold phaseConstant |
| 426 | nlinarith only [hround, hbase, hangle, hdiam, htilt', haxial, hlast] |
| 427 | |
| 428 | theorem phaseError_le_four_div {S ε k : ℝ} (hS : 0 < S) |
| 429 | (hε2 : S ^ 2 * ε ^ 2 ≤ 1) (hk2 : S ^ 2 / k ≤ 1) (hε1 : ε * S ^ 2 ≤ 1) : |
| 430 | phaseError S ε k ≤ 4 / S := by |
| 431 | have h1 : S * ε ^ 2 ≤ 1 / S := (le_div_iff₀ hS).2 (by nlinarith only [hε2]) |
| 432 | have h2 : S / k ≤ 1 / S := (le_div_iff₀ hS).2 (by |
| 433 | have heq : S / k * S = S ^ 2 / k := by ring |
| 434 | rwa [heq]) |
| 435 | have h3 : ε * S ≤ 1 / S := (le_div_iff₀ hS).2 (by nlinarith only [hε1]) |
| 436 | unfold phaseError |
| 437 | rw [show 4 / S = 4 * (1 / S) by ring] |
| 438 | linarith only [h1, h2, h3] |
| 439 | |
| 440 | noncomputable def normalVelocity (ε p pz FR GR FZ GZ : ℝ) : Space := |
| 441 | !₂[-(p * FR + pz * GR), 0, -ε * (p * FZ + pz * GZ)] |
| 442 | |
| 443 | /-- The slot derivative is estimated from its exact formula, independently of |
| 444 | the estimate for the normal itself. -/ |
| 445 | theorem normalVelocity_bound {ε p pz FR GR FZ GZ slope error shear : ℝ} |
| 446 | (herror : |p * FR + pz * GR - slope| ≤ error) |
| 447 | (hshear : |p * FZ + pz * GZ| ≤ shear) : |
| 448 | ‖normalVelocity ε p pz FR GR FZ GZ‖ ≤ |slope| + error + |ε| * shear := by |
| 449 | have h := vec3_norm_le_sum (normalVelocity ε p pz FR GR FZ GZ) |
| 450 | change ‖normalVelocity ε p pz FR GR FZ GZ‖ ≤ |
| 451 | |-(p * FR + pz * GR)| + |(0 : ℝ)| + |-ε * (p * FZ + pz * GZ)| at h |
| 452 | simp only [abs_neg, abs_zero, add_zero, abs_mul] at h |
| 453 | have hs : |p * FR + pz * GR| ≤ |slope| + error := by |
| 454 | have ht := abs_add_le (p * FR + pz * GR - slope) slope |
| 455 | rw [sub_add_cancel] at ht |
| 456 | linarith only [ht, herror] |
| 457 | have hz := mul_le_mul_of_nonneg_left hshear (abs_nonneg ε) |
| 458 | linarith only [h, hs, hz] |
| 459 | |
| 460 | theorem representative_slope_scaled {B sigma u L M S : ℝ} |
| 461 | (hM : 0 ≤ M) (hB : |B| ≤ M) (hsigma : |sigma| = 1) |
| 462 | (hu : |u| ≤ M) (hL : 1 / |L| ≤ M / S) : |
| 463 | |-sigma * B * u / L| ≤ M ^ 3 / S := by |
| 464 | rw [abs_div, abs_mul, abs_mul, abs_neg, hsigma, one_mul] |
| 465 | calc |
| 466 | _ = (|B| * |u|) * (1 / |L|) := by ring |
| 467 | _ ≤ (M * M) * (M / S) := mul_le_mul |
| 468 | (mul_le_mul hB hu (abs_nonneg _) hM) hL (one_div_nonneg.mpr (abs_nonneg _)) |
| 469 | (mul_nonneg hM hM) |
| 470 | _ = _ := by ring |
| 471 | |
| 472 | theorem velocity_error_scaled {M S ε k : ℝ} |
| 473 | (hM : 1 ≤ M) (hS : 1 ≤ S) (hk : 0 < k) (hε : 0 ≤ ε) : |
| 474 | M ^ 3 / S + (M * (1 / k) + 2 * M * (M * (1 / S ^ 3 + ε ^ 2))) + |
| 475 | |ε| * (3 * M ^ 2) ≤ phaseConstant M * phaseError S ε k := by |
| 476 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 477 | have hS0 : 0 < S := lt_of_lt_of_le zero_lt_one hS |
| 478 | have hE : 0 ≤ phaseError S ε k := by unfold phaseError; positivity |
| 479 | have h0 : 1 / S ≤ phaseError S ε k := by |
| 480 | unfold phaseError |
| 481 | linarith only [mul_nonneg hS0.le (sq_nonneg ε), div_nonneg hS0.le hk.le, mul_nonneg hε hS0.le] |
| 482 | have h1 : 1 / S + S * ε ^ 2 ≤ phaseError S ε k := by |
| 483 | unfold phaseError |
| 484 | linarith only [div_nonneg hS0.le hk.le, mul_nonneg hε hS0.le] |
| 485 | have h2 : S / k ≤ phaseError S ε k := by |
| 486 | unfold phaseError |
| 487 | linarith only [one_div_nonneg.mpr hS0.le, mul_nonneg hS0.le (sq_nonneg ε), mul_nonneg hε hS0.le] |
| 488 | have h3 : ε * S ≤ phaseError S ε k := by |
| 489 | unfold phaseError |
| 490 | linarith only [one_div_nonneg.mpr hS0.le, mul_nonneg hS0.le (sq_nonneg ε), div_nonneg hS0.le hk.le] |
| 491 | have ha : M ^ 3 / S ≤ M ^ 3 * phaseError S ε k := by |
| 492 | simpa only [mul_one_div] using mul_le_mul_of_nonneg_left h0 (pow_nonneg hM0 3) |
| 493 | have hb : M * (1 / k) ≤ M * phaseError S ε k := |
| 494 | mul_le_mul_of_nonneg_left ((div_le_div_of_nonneg_right hS hk.le).trans h2) hM0 |
| 495 | have hc : 2 * M * (M * (1 / S ^ 3 + ε ^ 2)) ≤ 2 * M ^ 2 * phaseError S ε k := by |
| 496 | have hh : 1 / S ^ 3 + ε ^ 2 ≤ phaseError S ε k := |
| 497 | (add_le_add (inverse_cube_bounds hS).1 |
| 498 | (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hS (sq_nonneg ε))).trans h1 |
| 499 | have hh' := mul_le_mul_of_nonneg_left hh (show 0 ≤ 2 * M ^ 2 by positivity) |
| 500 | nlinarith only [hh'] |
| 501 | have hd : |ε| * (3 * M ^ 2) ≤ 3 * M ^ 2 * phaseError S ε k := by |
| 502 | rw [abs_of_nonneg hε] |
| 503 | have hεle : ε ≤ ε * S := by simpa only [mul_one] using mul_le_mul_of_nonneg_left hS hε |
| 504 | have hh : ε ≤ phaseError S ε k := hεle.trans h3 |
| 505 | nlinarith only [mul_le_mul_of_nonneg_left hh (show 0 ≤ 3 * M ^ 2 by positivity)] |
| 506 | have hm2 : M ≤ M ^ 2 := by nlinarith only [hM] |
| 507 | have hm3 : M ^ 2 ≤ M ^ 3 := by |
| 508 | nlinarith only [mul_le_mul_of_nonneg_left hM (sq_nonneg M)] |
| 509 | have hm4 : 0 ≤ M ^ 4 := pow_nonneg hM0 _ |
| 510 | have hcoeff : M ^ 3 + M + 5 * M ^ 2 ≤ phaseConstant M := by |
| 511 | unfold phaseConstant |
| 512 | linarith only [hm2, hm3, hm4, pow_nonneg hM0 3] |
| 513 | nlinarith only [ha, hb, hc, hd, mul_le_mul_of_nonneg_right hcoeff hE] |
| 514 | |
| 515 | /-- Quantitative estimates for the actual rounded phase. The C2 comparison |
| 516 | lemma above supplies the two `M (S⁻³ + ε²)` derivative hypotheses. -/ |
| 517 | theorem rounded_normal_estimates |
| 518 | {ε target pz R R0 v FR GR FZ GZ FR0 GR0 B sigma u L M S k : ℝ} {K g : Plane} |
| 519 | (hR : R ≠ 0) (hR0 : R0 ≠ 0) (hg : g ≠ 0) (horth : ⟪K, g⟫_ℝ = 0) |
| 520 | (hgdef : g = !₂[R0 * FR0, GR0]) |
| 521 | (hfreq : (!₂[target / R0, pz] : Plane) = representativeFrequency B sigma u L K g) |
| 522 | (hM : 1 ≤ M) (hS : 1 ≤ S) (hk : 1 ≤ k) (hε : 0 ≤ ε) |
| 523 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) (hB : |B| ≤ M) |
| 524 | (hsigma : |sigma| = 1) (hu : |u| ≤ M) (hgi : 1 / ‖g‖ ≤ M) |
| 525 | (hL : 1 / |L| ≤ M / S) (hv : |v| ≤ M * S) |
| 526 | (hRi : |1 / R| ≤ M) (hR0i : |1 / R0| ≤ M) (hRd : |R - R0| ≤ 1 / S ^ 3) |
| 527 | (hFR : |FR| ≤ M) (hFZ : |FZ| ≤ M) (hGZ : |GZ| ≤ M) |
| 528 | (hFR0 : |FR - FR0| ≤ M * (1 / S ^ 3 + ε ^ 2)) |
| 529 | (hGR0 : |GR - GR0| ≤ M * (1 / S ^ 3 + ε ^ 2)) : |
| 530 | ‖explicitNormal ε (roundedFrequency k target) pz (sigma * B * u / 2) R v FR GR FZ GZ - |
| 531 | referenceNormal B sigma u L v K‖ ≤ phaseConstant M * phaseError S ε k ∧ |
| 532 | ‖normalVelocity ε (roundedFrequency k target) pz FR GR FZ GZ‖ ≤ |
| 533 | phaseConstant M * phaseError S ε k := by |
| 534 | have hk0 : 0 < k := lt_of_lt_of_le zero_lt_one hk |
| 535 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 536 | have hp := roundedFrequency_error hk0 target |
| 537 | have hround : 1 / k ≤ 1 := (one_div_le_one_div_of_le zero_lt_one hk).trans_eq (one_div_one) |
| 538 | have h := explicit_normal_estimate (ε := ε) (v := v) hR hR0 hg horth hgdef hfreq hM hround hp |
| 539 | htarget hpz hRi hR0i hRd hFR hFZ hGZ hFR0 hGR0 |
| 540 | constructor |
| 541 | · exact h.trans (assembled_error_scaled hM hS hk0 hε hv |
| 542 | (representative_tilt_scaled hM0 hB hsigma hu hgi hL)) |
| 543 | · have hslope := representative_slope_coordinates hR0 hg horth hgdef hfreq |
| 544 | have hrad := radial_frequency_error hp hFR htarget hpz hFR0 hGR0 |
| 545 | rw [hslope] at hrad |
| 546 | have hz := axial_frequency_bound hM hround hp htarget hpz hFZ hGZ |
| 547 | have hn := normalVelocity_bound (ε := ε) hrad hz |
| 548 | have href := representative_slope_scaled hM0 hB hsigma hu hL |
| 549 | exact (hn.trans (add_le_add_left (add_le_add_left href _) _)).trans |
| 550 | (velocity_error_scaled hM hS hk0 hε) |
| 551 | |
| 552 | /-! ## Quantitative lower bounds and the actual normalized frame -/ |
| 553 | |
| 554 | theorem tail_norm_le (n : Space) : ‖MovingFrameODE.tail n‖ ≤ ‖n‖ := by |
| 555 | have h2 := ViscousPropagator.plane_norm_sq (MovingFrameODE.tail n) |
| 556 | have h3 := PhaseCalculus.vec3_norm_sq n |
| 557 | change ‖MovingFrameODE.tail n‖ ^ 2 = (n 1) ^ 2 + (n 2) ^ 2 at h2 |
| 558 | nlinarith only [h2, h3, sq_nonneg (n 0), norm_nonneg (MovingFrameODE.tail n), norm_nonneg n] |
| 559 | |
| 560 | theorem normalScale_close {n : Space} {K : Plane} {B s δ : ℝ} |
| 561 | (hB : 0 < B) (hK : ‖K‖ = 1) |
| 562 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) : |
| 563 | |MovingFrameODE.normalScale n - B| ≤ δ := by |
| 564 | have ht := (tail_norm_le (n - MovingFrameODE.pack (B * s) (B • K))).trans hclose |
| 565 | rw [MovingFrameODE.tail_sub, MovingFrameODE.tail_pack] at ht |
| 566 | have h := (abs_norm_sub_norm_le (MovingFrameODE.tail n) (B • K)).trans ht |
| 567 | simpa only [MovingFrameODE.normalScale, norm_smul, Real.norm_eq_abs, |
| 568 | abs_of_pos hB, hK, mul_one] using h |
| 569 | |
| 570 | /-- Closeness derived above controls the tangential normal as well as the full |
| 571 | normal; the weaker full-normal lower bound alone would not build the frame. -/ |
| 572 | theorem normal_lower_bounds {n : Space} {K : Plane} {B s δ : ℝ} |
| 573 | (hB : 0 < B) (hK : ‖K‖ = 1) (hδ : δ ≤ B / 2) |
| 574 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) : |
| 575 | B / 2 ≤ MovingFrameODE.normalScale n ∧ B / 2 ≤ ‖n‖ ∧ |
| 576 | MovingFrameODE.tail n ≠ 0 ∧ n ≠ 0 := by |
| 577 | have hc := (abs_le.mp (normalScale_close hB hK hclose)).1 |
| 578 | have hlow : B / 2 ≤ MovingFrameODE.normalScale n := by linarith only [hc, hδ] |
| 579 | have hnlow : B / 2 ≤ ‖n‖ := hlow.trans (tail_norm_le n) |
| 580 | refine ⟨hlow, hnlow, ?_, ?_⟩ |
| 581 | · apply norm_pos_iff.mp |
| 582 | exact lt_of_lt_of_le (half_pos hB) hlow |
| 583 | · exact norm_pos_iff.mp (lt_of_lt_of_le (half_pos hB) hnlow) |
| 584 | |
| 585 | theorem radialSlope_close {n : Space} {K : Plane} {B s δ : ℝ} |
| 586 | (hB : 0 < B) (hK : ‖K‖ = 1) (hδ : δ ≤ B / 2) |
| 587 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) : |
| 588 | |MovingFrameODE.radialSlope n - s| ≤ 2 * (1 + |s|) * δ / B := by |
| 589 | have hδ0 : 0 ≤ δ := (norm_nonneg _).trans hclose |
| 590 | obtain ⟨hlow, _, hne, _⟩ := normal_lower_bounds hB hK hδ hclose |
| 591 | have hβ : 0 < MovingFrameODE.normalScale n := MovingFrameODE.normalScale_pos hne |
| 592 | have hscale := normalScale_close hB hK hclose |
| 593 | have hr := (PiLp.norm_apply_le (n - MovingFrameODE.pack (B * s) (B • K)) 0).trans hclose |
| 594 | change |n 0 - B * s| ≤ δ at hr |
| 595 | have heq : MovingFrameODE.radialSlope n - s = |
| 596 | ((n 0 - B * s) + s * (B - MovingFrameODE.normalScale n)) / MovingFrameODE.normalScale n := by |
| 597 | unfold MovingFrameODE.radialSlope |
| 598 | field_simp ; ring |
| 599 | rw [heq, abs_div, abs_of_pos hβ] |
| 600 | have hnum : |(n 0 - B * s) + s * (B - MovingFrameODE.normalScale n)| ≤ δ + |s| * δ := by |
| 601 | calc |
| 602 | _ ≤ |n 0 - B * s| + |s * (B - MovingFrameODE.normalScale n)| := abs_add_le _ _ |
| 603 | _ = |n 0 - B * s| + |s| * |MovingFrameODE.normalScale n - B| := by |
| 604 | rw [abs_mul, abs_sub_comm B] |
| 605 | _ ≤ _ := add_le_add hr (mul_le_mul_of_nonneg_left hscale (abs_nonneg _)) |
| 606 | calc |
| 607 | _ ≤ (δ + |s| * δ) / MovingFrameODE.normalScale n := div_le_div_of_nonneg_right hnum hβ.le |
| 608 | _ ≤ (δ + |s| * δ) / (B / 2) := div_le_div_of_nonneg_left (by positivity) (half_pos hB) hlow |
| 609 | _ = _ := by ring |
| 610 | |
| 611 | theorem normalDirection_close {n : Space} {K : Plane} {B s δ : ℝ} |
| 612 | (hB : 0 < B) (hK : ‖K‖ = 1) (hδ : δ ≤ B / 2) |
| 613 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) : |
| 614 | ‖MovingFrameODE.normalDirection n - K‖ ≤ 4 * δ / B := by |
| 615 | have hδ0 : 0 ≤ δ := (norm_nonneg _).trans hclose |
| 616 | obtain ⟨hlow, _, hne, _⟩ := normal_lower_bounds hB hK hδ hclose |
| 617 | have hβ : 0 < MovingFrameODE.normalScale n := MovingFrameODE.normalScale_pos hne |
| 618 | have ht := (tail_norm_le (n - MovingFrameODE.pack (B * s) (B • K))).trans hclose |
| 619 | rw [MovingFrameODE.tail_sub, MovingFrameODE.tail_pack] at ht |
| 620 | have hc := normalScale_close hB hK hclose |
| 621 | have heq : MovingFrameODE.normalDirection n - K = |
| 622 | (MovingFrameODE.normalScale n)⁻¹ • (MovingFrameODE.tail n - B • K) + |
| 623 | ((B - MovingFrameODE.normalScale n) / MovingFrameODE.normalScale n) • K := by |
| 624 | unfold MovingFrameODE.normalDirection |
| 625 | ext i |
| 626 | simp only [PiLp.add_apply, PiLp.sub_apply, PiLp.smul_apply, smul_eq_mul] |
| 627 | field_simp ; ring |
| 628 | rw [heq] |
| 629 | have hn := norm_add_le ((MovingFrameODE.normalScale n)⁻¹ • (MovingFrameODE.tail n - B • K)) |
| 630 | (((B - MovingFrameODE.normalScale n) / MovingFrameODE.normalScale n) • K) |
| 631 | rw [norm_smul, norm_smul, Real.norm_eq_abs, Real.norm_eq_abs, |
| 632 | abs_of_pos (inv_pos.mpr hβ), hK, mul_one, abs_div, abs_of_pos hβ, |
| 633 | abs_sub_comm B] at hn |
| 634 | have h1 := mul_le_mul_of_nonneg_left ht (inv_nonneg.mpr hβ.le) |
| 635 | have h2 := div_le_div_of_nonneg_right hc hβ.le |
| 636 | have hsum : ‖(MovingFrameODE.normalScale n)⁻¹ • (MovingFrameODE.tail n - B • K) + |
| 637 | ((B - MovingFrameODE.normalScale n) / MovingFrameODE.normalScale n) • K‖ ≤ |
| 638 | 2 * δ / MovingFrameODE.normalScale n := by |
| 639 | calc |
| 640 | _ ≤ (MovingFrameODE.normalScale n)⁻¹ * δ + δ / MovingFrameODE.normalScale n := |
| 641 | hn.trans (add_le_add h1 h2) |
| 642 | _ = _ := by ring |
| 643 | calc |
| 644 | _ ≤ 2 * δ / MovingFrameODE.normalScale n := hsum |
| 645 | _ ≤ 2 * δ / (B / 2) := div_le_div_of_nonneg_left (by positivity) (half_pos hB) hlow |
| 646 | _ = _ := by ring |
| 647 | |
| 648 | theorem quarterTurn_norm (w : Plane) : ‖MovingFrameODE.quarterTurn w‖ = ‖w‖ := by |
| 649 | have h := MovingFrameODE.quarterTurn_inner w w |
| 650 | rw [real_inner_self_eq_norm_sq, real_inner_self_eq_norm_sq] at h |
| 651 | nlinarith only [h, norm_nonneg w, norm_nonneg (MovingFrameODE.quarterTurn w)] |
| 652 | |
| 653 | theorem transverseDirection_close {n : Space} {K : Plane} {B s δ : ℝ} |
| 654 | (hB : 0 < B) (hK : ‖K‖ = 1) (hδ : δ ≤ B / 2) |
| 655 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) : |
| 656 | ‖MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection n) - MovingFrameODE.quarterTurn K‖ ≤ |
| 657 | 4 * δ / B := by |
| 658 | rw [← map_sub, quarterTurn_norm] |
| 659 | exact normalDirection_close hB hK hδ hclose |
| 660 | |
| 661 | noncomputable def scaleDerivative (n n' : Space) : ℝ := |
| 662 | ⟪MovingFrameODE.tail n, MovingFrameODE.tail n'⟫_ℝ / MovingFrameODE.normalScale n |
| 663 | |
| 664 | noncomputable def slopeDerivative (n n' : Space) : ℝ := |
| 665 | (n' 0 - MovingFrameODE.radialSlope n * scaleDerivative n n') / MovingFrameODE.normalScale n |
| 666 | |
| 667 | noncomputable def directionDerivative (n n' : Space) : Plane := |
| 668 | (MovingFrameODE.normalScale n)⁻¹ • |
| 669 | (MovingFrameODE.tail n' - scaleDerivative n n' • MovingFrameODE.normalDirection n) |
| 670 | |
| 671 | noncomputable def angularVelocity (n n' : Space) : ℝ := |
| 672 | ⟪MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection n), directionDerivative n n'⟫_ℝ |
| 673 | |
| 674 | theorem hasDerivAt_normalScale {n : ℝ → Space} {n' : Space} {v : ℝ} |
| 675 | (hn : HasDerivAt n n' v) (hne : MovingFrameODE.tail (n v) ≠ 0) : |
| 676 | HasDerivAt (fun s => MovingFrameODE.normalScale (n s)) (scaleDerivative (n v) n') v := by |
| 677 | have ht : HasDerivAt (fun s => MovingFrameODE.tail (n s)) (MovingFrameODE.tail n') v := |
| 678 | MovingFrameODE.tailCLM.hasFDerivAt.comp_hasDerivAt v hn |
| 679 | have h := ht.norm_sq.sqrt (pow_ne_zero 2 (norm_ne_zero_iff.mpr hne)) |
| 680 | simpa only [MovingFrameODE.normalScale, scaleDerivative, Real.sqrt_sq_eq_abs, abs_norm, |
| 681 | mul_div_mul_left _ _ (by norm_num : (2 : ℝ) ≠ 0)] using h |
| 682 | |
| 683 | theorem hasDerivAt_radialSlope {n : ℝ → Space} {n' : Space} {v : ℝ} |
| 684 | (hn : HasDerivAt n n' v) (hne : MovingFrameODE.tail (n v) ≠ 0) : |
| 685 | HasDerivAt (fun s => MovingFrameODE.radialSlope (n s)) (slopeDerivative (n v) n') v := by |
| 686 | have hβ := MovingFrameODE.normalScale_pos hne |
| 687 | let pr : Space →L[ℝ] ℝ := PiLp.proj 2 (fun _ : Fin 3 => ℝ) 0 |
| 688 | have hr : HasDerivAt (fun s => (n s) 0) (n' 0) v := |
| 689 | pr.hasFDerivAt.comp_hasDerivAt v hn |
| 690 | have heq : slopeDerivative (n v) n' = |
| 691 | (n' 0 * MovingFrameODE.normalScale (n v) - (n v) 0 * scaleDerivative (n v) n') / |
| 692 | MovingFrameODE.normalScale (n v) ^ 2 := by |
| 693 | unfold slopeDerivative MovingFrameODE.radialSlope |
| 694 | field_simp [hβ.ne'] |
| 695 | rw [heq] |
| 696 | exact hr.div (hasDerivAt_normalScale hn hne) hβ.ne' |
| 697 | |
| 698 | theorem hasDerivAt_normalDirection {n : ℝ → Space} {n' : Space} {v : ℝ} |
| 699 | (hn : HasDerivAt n n' v) (hne : MovingFrameODE.tail (n v) ≠ 0) : |
| 700 | HasDerivAt (fun s => MovingFrameODE.normalDirection (n s)) (directionDerivative (n v) n') v := by |
| 701 | have hβ := MovingFrameODE.normalScale_pos hne |
| 702 | have ht : HasDerivAt (fun s => MovingFrameODE.tail (n s)) (MovingFrameODE.tail n') v := |
| 703 | MovingFrameODE.tailCLM.hasFDerivAt.comp_hasDerivAt v hn |
| 704 | convert! ((hasDerivAt_normalScale hn hne).fun_inv hβ.ne').smul ht using 1 |
| 705 | unfold directionDerivative MovingFrameODE.normalDirection |
| 706 | ext i |
| 707 | simp only [PiLp.add_apply, PiLp.sub_apply, PiLp.smul_apply, smul_eq_mul] |
| 708 | field_simp [hβ.ne'] ; ring |
| 709 | |
| 710 | /-- The angular speed is computed from the actual normal derivative. -/ |
| 711 | theorem hasDerivAt_actual_frame {n : ℝ → Space} {n' : Space} {v : ℝ} |
| 712 | (hn : HasDerivAt n n' v) (hne : MovingFrameODE.tail (n v) ≠ 0) : |
| 713 | HasDerivAt (fun s => MovingFrameODE.normalDirection (n s)) |
| 714 | (angularVelocity (n v) n' • MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection (n v))) v ∧ |
| 715 | HasDerivAt (fun s => MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection (n s))) |
| 716 | (-angularVelocity (n v) n' • MovingFrameODE.normalDirection (n v)) v := by |
| 717 | have ht : HasDerivAt (fun s => MovingFrameODE.tail (n s)) (MovingFrameODE.tail n') v := |
| 718 | MovingFrameODE.tailCLM.hasFDerivAt.comp_hasDerivAt v hn |
| 719 | have hunit : ∀ᶠ s in nhds v, ‖MovingFrameODE.normalDirection (n s)‖ = 1 := by |
| 720 | have he : ∀ᶠ s in nhds v, MovingFrameODE.tail (n s) ≠ 0 := ht.continuousAt.eventually_ne hne |
| 721 | filter_upwards [he] with s hs |
| 722 | exact MovingFrameODE.normalDirection_unit hs |
| 723 | have hd := hasDerivAt_normalDirection hn hne |
| 724 | have hrot := MovingFrameODE.unit_curve_rotation hd hunit |
| 725 | have hk : HasDerivAt (fun s => MovingFrameODE.normalDirection (n s)) |
| 726 | (angularVelocity (n v) n' • MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection (n v))) v := |
| 727 | hrot ▸ hd |
| 728 | exact ⟨hk, MovingFrameODE.hasDerivAt_quarterTurn_of_rotation hk⟩ |
| 729 | |
| 730 | theorem scaleDerivative_bound {n n' : Space} (hne : MovingFrameODE.tail n ≠ 0) : |
| 731 | |scaleDerivative n n'| ≤ ‖n'‖ := by |
| 732 | have hβ := MovingFrameODE.normalScale_pos hne |
| 733 | unfold scaleDerivative |
| 734 | rw [abs_div, abs_of_pos hβ] |
| 735 | calc |
| 736 | _ ≤ (‖MovingFrameODE.tail n‖ * ‖MovingFrameODE.tail n'‖) / MovingFrameODE.normalScale n := |
| 737 | div_le_div_of_nonneg_right (abs_real_inner_le_norm _ _) hβ.le |
| 738 | _ = ‖MovingFrameODE.tail n'‖ := by |
| 739 | change (MovingFrameODE.normalScale n * ‖MovingFrameODE.tail n'‖) / MovingFrameODE.normalScale n = _ |
| 740 | exact mul_div_cancel_left₀ _ hβ.ne' |
| 741 | _ ≤ ‖n'‖ := tail_norm_le n' |
| 742 | |
| 743 | theorem slopeDerivative_bound {n n' : Space} {B η : ℝ} |
| 744 | (hB : 0 < B) (hlow : B / 2 ≤ MovingFrameODE.normalScale n) (hn' : ‖n'‖ ≤ η) : |
| 745 | |slopeDerivative n n'| ≤ 2 * (1 + |MovingFrameODE.radialSlope n|) * η / B := by |
| 746 | have hβ : 0 < MovingFrameODE.normalScale n := lt_of_lt_of_le (half_pos hB) hlow |
| 747 | have hne : MovingFrameODE.tail n ≠ 0 := norm_pos_iff.mp hβ |
| 748 | have hη : 0 ≤ η := (norm_nonneg _).trans hn' |
| 749 | have hr : |n' 0| ≤ η := by simpa only [Real.norm_eq_abs] using (PiLp.norm_apply_le n' 0).trans hn' |
| 750 | have hb : |scaleDerivative n n'| ≤ η := (scaleDerivative_bound hne).trans hn' |
| 751 | unfold slopeDerivative |
| 752 | rw [abs_div, abs_of_pos hβ] |
| 753 | calc |
| 754 | _ ≤ (|n' 0| + |MovingFrameODE.radialSlope n * scaleDerivative n n'|) / MovingFrameODE.normalScale n := |
| 755 | div_le_div_of_nonneg_right (abs_sub _ _) hβ.le |
| 756 | _ ≤ (η + |MovingFrameODE.radialSlope n| * η) / MovingFrameODE.normalScale n := by |
| 757 | rw [abs_mul] |
| 758 | exact div_le_div_of_nonneg_right |
| 759 | (add_le_add hr (mul_le_mul_of_nonneg_left hb (abs_nonneg _))) hβ.le |
| 760 | _ ≤ (η + |MovingFrameODE.radialSlope n| * η) / (B / 2) := |
| 761 | div_le_div_of_nonneg_left (by positivity) (half_pos hB) hlow |
| 762 | _ = _ := by ring |
| 763 | |
| 764 | theorem directionDerivative_bound {n n' : Space} {B η : ℝ} |
| 765 | (hB : 0 < B) (hlow : B / 2 ≤ MovingFrameODE.normalScale n) (hn' : ‖n'‖ ≤ η) : |
| 766 | ‖directionDerivative n n'‖ ≤ 4 * η / B := by |
| 767 | have hβ : 0 < MovingFrameODE.normalScale n := lt_of_lt_of_le (half_pos hB) hlow |
| 768 | have hne : MovingFrameODE.tail n ≠ 0 := norm_pos_iff.mp hβ |
| 769 | have hη : 0 ≤ η := (norm_nonneg _).trans hn' |
| 770 | have hb : |scaleDerivative n n'| ≤ η := (scaleDerivative_bound hne).trans hn' |
| 771 | have ht : ‖MovingFrameODE.tail n'‖ ≤ η := (tail_norm_le n').trans hn' |
| 772 | have hs : ‖MovingFrameODE.tail n' - scaleDerivative n n' • MovingFrameODE.normalDirection n‖ ≤ 2 * η := by |
| 773 | have h := norm_sub_le (MovingFrameODE.tail n') (scaleDerivative n n' • MovingFrameODE.normalDirection n) |
| 774 | rw [norm_smul, Real.norm_eq_abs, MovingFrameODE.normalDirection_unit hne, mul_one] at h |
| 775 | linarith only [h, hb, ht] |
| 776 | unfold directionDerivative |
| 777 | rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hβ)] |
| 778 | calc |
| 779 | _ ≤ (MovingFrameODE.normalScale n)⁻¹ * (2 * η) := mul_le_mul_of_nonneg_left hs (inv_nonneg.mpr hβ.le) |
| 780 | _ = 2 * η / MovingFrameODE.normalScale n := by ring |
| 781 | _ ≤ 2 * η / (B / 2) := div_le_div_of_nonneg_left (by positivity) (half_pos hB) hlow |
| 782 | _ = _ := by ring |
| 783 | |
| 784 | theorem angularVelocity_bound {n n' : Space} {B η : ℝ} |
| 785 | (hB : 0 < B) (hlow : B / 2 ≤ MovingFrameODE.normalScale n) (hn' : ‖n'‖ ≤ η) : |
| 786 | |angularVelocity n n'| ≤ 4 * η / B := by |
| 787 | have hβ : 0 < MovingFrameODE.normalScale n := lt_of_lt_of_le (half_pos hB) hlow |
| 788 | have hne : MovingFrameODE.tail n ≠ 0 := norm_pos_iff.mp hβ |
| 789 | unfold angularVelocity |
| 790 | have h := abs_real_inner_le_norm |
| 791 | (MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection n)) (directionDerivative n n') |
| 792 | rw [quarterTurn_norm, MovingFrameODE.normalDirection_unit hne, one_mul] at h |
| 793 | exact h.trans (directionDerivative_bound hB hlow hn') |
| 794 | |
| 795 | /-! ## The actual local base hypotheses -/ |
| 796 | |
| 797 | /-- Local C1/C2 bounds on the given base and its order-zero limit. These are |
| 798 | derivative bounds on actual functions, not a normal-comparison hypothesis. -/ |
| 799 | structure LocalBaseBounds (F G F0 G0 : Slow → ℝ) (U : Set Slow) (M ε : ℝ) : Prop where |
| 800 | convex : Convex ℝ U |
| 801 | actualF : ∀ x ∈ U, DifferentiableAt ℝ F x |
| 802 | actualG : ∀ x ∈ U, DifferentiableAt ℝ G x |
| 803 | referenceF : ∀ x ∈ U, DifferentiableAt ℝ F0 x |
| 804 | referenceG : ∀ x ∈ U, DifferentiableAt ℝ G0 x |
| 805 | secondF : ∀ x ∈ U, DifferentiableAt ℝ (fderiv ℝ F0) x |
| 806 | secondG : ∀ x ∈ U, DifferentiableAt ℝ (fderiv ℝ G0) x |
| 807 | secondF_bound : ∀ x ∈ U, ‖fderiv ℝ (fderiv ℝ F0) x‖ ≤ M |
| 808 | secondG_bound : ∀ x ∈ U, ‖fderiv ℝ (fderiv ℝ G0) x‖ ≤ M |
| 809 | firstF_bound : ∀ x ∈ U, ‖fderiv ℝ F0 x‖ ≤ M |
| 810 | valueF_error : ∀ x ∈ U, |F x - F0 x| ≤ M * ε ^ 2 |
| 811 | firstF_error : ∀ x ∈ U, ‖fderiv ℝ F x - fderiv ℝ F0 x‖ ≤ M * ε ^ 2 |
| 812 | firstG_error : ∀ x ∈ U, ‖fderiv ℝ G x - fderiv ℝ G0 x‖ ≤ M * ε ^ 2 |
| 813 | radialF_bound : ∀ x ∈ U, |PhaseCalculus.slowR F x| ≤ M |
| 814 | axialF_bound : ∀ x ∈ U, |PhaseCalculus.slowZ F x| ≤ M |
| 815 | axialG_bound : ∀ x ∈ U, |PhaseCalculus.slowZ G x| ≤ M |
| 816 | |
| 817 | theorem localBase_derivative_errors {F G F0 G0 : Slow → ℝ} {U : Set Slow} |
| 818 | {M ε diameter : ℝ} {q q0 : Slow} (h : LocalBaseBounds F G F0 G0 U M ε) |
| 819 | (hM : 0 ≤ M) (hq : q ∈ U) (hq0 : q0 ∈ U) (hd : ‖q - q0‖ ≤ diameter) : |
| 820 | |PhaseCalculus.slowR F q - PhaseCalculus.slowR F0 q0| ≤ M * (diameter + ε ^ 2) ∧ |
| 821 | |PhaseCalculus.slowR G q - PhaseCalculus.slowR G0 q0| ≤ M * (diameter + ε ^ 2) := by |
| 822 | have he : ‖((1, (0, 0)) : Slow)‖ ≤ 1 := by norm_num |
| 823 | have hF := local_directional_derivative_close hM h.convex hq hq0 h.secondF h.secondF_bound |
| 824 | hd (h.firstF_error q hq) he |
| 825 | have hG := local_directional_derivative_close hM h.convex hq hq0 h.secondG h.secondG_bound |
| 826 | hd (h.firstG_error q hq) he |
| 827 | simpa only [PhaseCalculus.slowR, mul_add] using And.intro hF hG |
| 828 | |
| 829 | theorem localBase_value_error {F G F0 G0 : Slow → ℝ} {U : Set Slow} |
| 830 | {M ε diameter : ℝ} {q q0 : Slow} (h : LocalBaseBounds F G F0 G0 U M ε) |
| 831 | (hM : 0 ≤ M) (hq : q ∈ U) (hq0 : q0 ∈ U) (hd : ‖q - q0‖ ≤ diameter) : |
| 832 | |F q - F0 q0| ≤ M * (diameter + ε ^ 2) := by |
| 833 | have hlocal := h.convex.norm_image_sub_le_of_norm_fderiv_le h.referenceF h.firstF_bound hq0 hq |
| 834 | have hloc : |F0 q - F0 q0| ≤ M * diameter := by |
| 835 | simpa only [Real.norm_eq_abs] using hlocal.trans (mul_le_mul_of_nonneg_left hd hM) |
| 836 | calc |
| 837 | _ ≤ |F q - F0 q| + |F0 q - F0 q0| := abs_sub_le _ _ _ |
| 838 | _ ≤ M * ε ^ 2 + M * diameter := add_le_add (h.valueF_error q hq) hloc |
| 839 | _ = _ := by ring |
| 840 | |
| 841 | theorem radius_difference_le {q q0 : Slow} {diameter : ℝ} (hd : ‖q - q0‖ ≤ diameter) : |
| 842 | |q.1 - q0.1| ≤ diameter := by |
| 843 | simpa only [Prod.fst_sub, Real.norm_eq_abs] using (norm_fst_le (q - q0)).trans hd |
| 844 | |
| 845 | noncomputable def shearVector (F G : Slow → ℝ) (q : Slow) : Plane := |
| 846 | !₂[q.1 * PhaseCalculus.slowR F q, PhaseCalculus.slowR G q] |
| 847 | |
| 848 | theorem localBase_shear_error {F G F0 G0 : Slow → ℝ} {U : Set Slow} |
| 849 | {M ε diameter : ℝ} {q q0 : Slow} (h : LocalBaseBounds F G F0 G0 U M ε) |
| 850 | (hM : 1 ≤ M) (hq : q ∈ U) (hq0 : q0 ∈ U) (hd : ‖q - q0‖ ≤ diameter) |
| 851 | (hR0 : |q0.1| ≤ M) : |
| 852 | ‖shearVector F G q - shearVector F0 G0 q0‖ ≤ 4 * M ^ 2 * (diameter + ε ^ 2) := by |
| 853 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 854 | have hd0 : 0 ≤ diameter := (norm_nonneg _).trans hd |
| 855 | obtain ⟨hF, hG⟩ := localBase_derivative_errors h hM0 hq hq0 hd |
| 856 | have hR := radius_difference_le hd |
| 857 | have ha : |q.1 * PhaseCalculus.slowR F q - q0.1 * PhaseCalculus.slowR F0 q0| ≤ |
| 858 | M * diameter + M ^ 2 * (diameter + ε ^ 2) := by |
| 859 | calc |
| 860 | _ = |(q.1 - q0.1) * PhaseCalculus.slowR F q + |
| 861 | q0.1 * (PhaseCalculus.slowR F q - PhaseCalculus.slowR F0 q0)| := by congr 1; ring |
| 862 | _ ≤ |(q.1 - q0.1) * PhaseCalculus.slowR F q| + |
| 863 | |q0.1 * (PhaseCalculus.slowR F q - PhaseCalculus.slowR F0 q0)| := abs_add_le _ _ |
| 864 | _ = |q.1 - q0.1| * |PhaseCalculus.slowR F q| + |
| 865 | |q0.1| * |PhaseCalculus.slowR F q - PhaseCalculus.slowR F0 q0| := by rw [abs_mul, abs_mul] |
| 866 | _ ≤ diameter * M + M * (M * (diameter + ε ^ 2)) := add_le_add |
| 867 | (mul_le_mul hR (h.radialF_bound q hq) (abs_nonneg _) hd0) |
| 868 | (mul_le_mul hR0 hF (abs_nonneg _) hM0) |
| 869 | _ = _ := by ring |
| 870 | have hn := MovingFrameODE.plane_norm_le_coordinate_sum (shearVector F G q - shearVector F0 G0 q0) |
| 871 | change ‖shearVector F G q - shearVector F0 G0 q0‖ ≤ |
| 872 | |q.1 * PhaseCalculus.slowR F q - q0.1 * PhaseCalculus.slowR F0 q0| + |
| 873 | |PhaseCalculus.slowR G q - PhaseCalculus.slowR G0 q0| at hn |
| 874 | have hm2 : M ≤ M ^ 2 := by nlinarith only [hM] |
| 875 | have he0 : 0 ≤ diameter + ε ^ 2 := add_nonneg hd0 (sq_nonneg _) |
| 876 | have hh := mul_le_mul_of_nonneg_right hm2 he0 |
| 877 | have hd' : M * diameter ≤ M * (diameter + ε ^ 2) := |
| 878 | mul_le_mul_of_nonneg_left (le_add_of_nonneg_right (sq_nonneg _)) hM0 |
| 879 | nlinarith only [hn, ha, hG, hh, hd', mul_nonneg (sq_nonneg M) he0] |
| 880 | |
| 881 | /-- The principal estimate stated for the actual PhaseCalculus normal, with |
| 882 | local C1/C2 hypotheses and the actual punctured-lattice rounded frequency. -/ |
| 883 | theorem actual_phase_estimates |
| 884 | {F G F0 G0 : Slow → ℝ} {U : Set Slow} {q q0 : Slow} |
| 885 | {ε target pz v θ B sigma u L M S k : ℝ} {K : Plane} |
| 886 | (hbase : LocalBaseBounds F G F0 G0 U M ε) |
| 887 | (hq : q ∈ U) (hq0 : q0 ∈ U) (hdiameter : ‖q - q0‖ ≤ 1 / S ^ 3) |
| 888 | (hR : q.1 ≠ 0) (hR0 : q0.1 ≠ 0) |
| 889 | (hg : shearVector F0 G0 q0 ≠ 0) (horth : ⟪K, shearVector F0 G0 q0⟫_ℝ = 0) |
| 890 | (hfreq : (!₂[target / q0.1, pz] : Plane) = |
| 891 | representativeFrequency B sigma u L K (shearVector F0 G0 q0)) |
| 892 | (hM : 1 ≤ M) (hS : 1 ≤ S) (hk : 1 ≤ k) (hε : 0 < ε) |
| 893 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) (hB : |B| ≤ M) |
| 894 | (hsigma : |sigma| = 1) (hu : |u| ≤ M) (hgi : 1 / ‖shearVector F0 G0 q0‖ ≤ M) |
| 895 | (hL : 1 / |L| ≤ M / S) (hv : |v| ≤ M * S) |
| 896 | (hRi : |1 / q.1| ≤ M) (hR0i : |1 / q0.1| ≤ M) : |
| 897 | ‖PhaseCalculus.phaseNormal ε (roundedFrequency k target) pz (sigma * B * u / 2) F G (q, (θ, v)) - |
| 898 | referenceNormal B sigma u L v K‖ ≤ phaseConstant M * phaseError S ε k ∧ |
| 899 | ‖PhaseCalculus.normalSlotDerivative ε (roundedFrequency k target) pz F G q‖ ≤ |
| 900 | phaseConstant M * phaseError S ε k := by |
| 901 | have hM0 : 0 ≤ M := le_trans zero_le_one hM |
| 902 | obtain ⟨hFR, hGR⟩ := localBase_derivative_errors hbase hM0 hq hq0 hdiameter |
| 903 | have h := rounded_normal_estimates hR hR0 hg horth (rfl : shearVector F0 G0 q0 = _) |
| 904 | hfreq hM hS hk hε.le htarget hpz hB hsigma hu hgi hL hv hRi hR0i |
| 905 | (radius_difference_le hdiameter) (hbase.radialF_bound q hq) (hbase.axialF_bound q hq) |
| 906 | (hbase.axialG_bound q hq) hFR hGR |
| 907 | rw [phaseNormal_eq_explicit ε (roundedFrequency k target) pz (sigma * B * u / 2) |
| 908 | F G (q, (θ, v)) hε.ne' (hbase.actualF q hq) (hbase.actualG q hq)] |
| 909 | exact h |
| 910 | |
| 911 | /-- Punctured-lattice rounding itself already excludes exact zeros of the |
| 912 | tangential normal; the comparison estimate supplies the uniform lower bound. -/ |
| 913 | theorem phase_normal_nonvanishing {ε k target pz x0 : ℝ} {F G : Slow → ℝ} |
| 914 | {q : PhaseCalculus.Slot} (hε : ε ≠ 0) (hk : k ≠ 0) (hR : q.1.1 ≠ 0) |
| 915 | (hF : DifferentiableAt ℝ F q.1) (hG : DifferentiableAt ℝ G q.1) : |
| 916 | MovingFrameODE.tail (PhaseCalculus.phaseNormal ε (roundedFrequency k target) pz x0 F G q) ≠ 0 ∧ |
| 917 | PhaseCalculus.phaseNormal ε (roundedFrequency k target) pz x0 F G q ≠ 0 := by |
| 918 | rw [phaseNormal_eq_explicit ε (roundedFrequency k target) pz x0 F G q hε hF hG] |
| 919 | have hp := div_ne_zero (roundedFrequency_ne_zero hk target) hR |
| 920 | constructor |
| 921 | · intro hz |
| 922 | have h := congrArg (fun w : Plane => w 0) hz |
| 923 | exact hp h |
| 924 | · intro hz |
| 925 | have h := congrArg (fun w : Space => w 1) hz |
| 926 | exact hp h |
| 927 | |
| 928 | /-- The phase's actual derivative, uniform lower bounds and every changing |
| 929 | frame quantity needed in `MovingFrameODE`, from local base and band data. -/ |
| 930 | theorem actual_phase_geometry |
| 931 | {F G F0 G0 : Slow → ℝ} {U : Set Slow} {q q0 : Slow} |
| 932 | {ε target pz v θ B sigma u L M S k : ℝ} {K : Plane} |
| 933 | (hbase : LocalBaseBounds F G F0 G0 U M ε) |
| 934 | (hq : q ∈ U) (hq0 : q0 ∈ U) (hdiameter : ‖q - q0‖ ≤ 1 / S ^ 3) |
| 935 | (hR : q.1 ≠ 0) (hR0 : q0.1 ≠ 0) |
| 936 | (hg : shearVector F0 G0 q0 ≠ 0) (horth : ⟪K, shearVector F0 G0 q0⟫_ℝ = 0) |
| 937 | (hfreq : (!₂[target / q0.1, pz] : Plane) = |
| 938 | representativeFrequency B sigma u L K (shearVector F0 G0 q0)) |
| 939 | (hM : 1 ≤ M) (hS : 1 ≤ S) (hk : 1 ≤ k) (hε : 0 < ε) |
| 940 | (htarget : |target| ≤ M) (hpz : |pz| ≤ M) (hB : |B| ≤ M) |
| 941 | (hsigma : |sigma| = 1) (hu : |u| ≤ M) (hgi : 1 / ‖shearVector F0 G0 q0‖ ≤ M) |
| 942 | (hL : 1 / |L| ≤ M / S) (hv : |v| ≤ M * S) |
| 943 | (hRi : |1 / q.1| ≤ M) (hR0i : |1 / q0.1| ≤ M) |
| 944 | (hBpos : 0 < B) (hK : ‖K‖ = 1) |
| 945 | (hsmall : phaseConstant M * phaseError S ε k ≤ B / 2) : |
| 946 | let N : ℝ → Space := fun w => PhaseCalculus.phaseNormal ε (roundedFrequency k target) pz |
| 947 | (sigma * B * u / 2) F G (q, (θ, w)) |
| 948 | let n' := PhaseCalculus.normalSlotDerivative ε (roundedFrequency k target) pz F G q |
| 949 | let δ := phaseConstant M * phaseError S ε k |
| 950 | HasDerivAt N n' v ∧ |
| 951 | B / 2 ≤ MovingFrameODE.normalScale (N v) ∧ B / 2 ≤ ‖N v‖ ∧ |
| 952 | MovingFrameODE.tail (N v) ≠ 0 ∧ N v ≠ 0 ∧ |
| 953 | |MovingFrameODE.radialSlope (N v) - signedSlot sigma u L v| ≤ |
| 954 | 2 * (1 + |signedSlot sigma u L v|) * δ / B ∧ |
| 955 | ‖MovingFrameODE.normalDirection (N v) - K‖ ≤ 4 * δ / B ∧ |
| 956 | ‖MovingFrameODE.quarterTurn (MovingFrameODE.normalDirection (N v)) - MovingFrameODE.quarterTurn K‖ ≤ |
| 957 | 4 * δ / B ∧ |
| 958 | |slopeDerivative (N v) n'| ≤ 2 * (1 + |MovingFrameODE.radialSlope (N v)|) * δ / B ∧ |
| 959 | |angularVelocity (N v) n'| ≤ 4 * δ / B := by |
| 960 | dsimp only |
| 961 | obtain ⟨hc, hd⟩ := actual_phase_estimates (v := v) (θ := θ) hbase hq hq0 hdiameter |
| 962 | hR hR0 hg horth hfreq hM hS hk hε htarget hpz hB hsigma hu hgi hL hv hRi hR0i |
| 963 | have hl := normal_lower_bounds (s := signedSlot sigma u L v) hBpos hK hsmall hc |
| 964 | refine ⟨?_, hl.1, hl.2.1, hl.2.2.1, hl.2.2.2, ?_, ?_, ?_, ?_, ?_⟩ |
| 965 | · exact PhaseCalculus.hasDerivAt_phaseNormal_slot ε (roundedFrequency k target) pz |
| 966 | (sigma * B * u / 2) θ v F G q hε.ne' (hbase.actualF q hq) (hbase.actualG q hq) |
| 967 | · exact radialSlope_close hBpos hK hsmall hc |
| 968 | · exact normalDirection_close hBpos hK hsmall hc |
| 969 | · exact transverseDirection_close hBpos hK hsmall hc |
| 970 | · exact slopeDerivative_bound hBpos hl.1 hd |
| 971 | · exact angularVelocity_bound hBpos hl.1 hd |
| 972 | |
| 973 | theorem signedSlot_bound {sigma u L v : ℝ} |
| 974 | (hsigma : |sigma| = 1) (hu : 0 ≤ u) (hL : 0 < L) (hv : 0 ≤ v) (hvL : v ≤ L) : |
| 975 | |signedSlot sigma u L v| ≤ 3 * u / 2 := by |
| 976 | have hvdiv : v / L ≤ 1 := (div_le_one hL).2 hvL |
| 977 | have hnonneg : 0 ≤ u / 2 + u * v / L := by positivity |
| 978 | unfold signedSlot |
| 979 | rw [abs_mul, hsigma, one_mul, abs_of_nonneg hnonneg] |
| 980 | have h := mul_le_mul_of_nonneg_left hvdiv hu |
| 981 | simp only [mul_one] at h |
| 982 | rw [mul_div_assoc] |
| 983 | nlinarith only [h] |
| 984 | |
| 985 | theorem radialSlope_uniform_bound {n : Space} {K : Plane} {B s δ A : ℝ} |
| 986 | (hB : 0 < B) (hK : ‖K‖ = 1) (hδ : δ ≤ B / 2) |
| 987 | (hclose : ‖n - MovingFrameODE.pack (B * s) (B • K)‖ ≤ δ) (hs : |s| ≤ A) : |
| 988 | |MovingFrameODE.radialSlope n| ≤ 1 + 2 * A := by |
| 989 | have hc := radialSlope_close hB hK hδ hclose |
| 990 | have hscale : 2 * (1 + |s|) * δ / B ≤ 1 + |s| := by |
| 991 | apply (div_le_iff₀ hB).2 |
| 992 | have h := mul_le_mul_of_nonneg_left hδ (show 0 ≤ 2 * (1 + |s|) by positivity) |
| 993 | nlinarith only [h] |
| 994 | have h := abs_add_le (MovingFrameODE.radialSlope n - s) s |
| 995 | rw [sub_add_cancel] at h |
| 996 | linarith only [hc, hscale, h, hs] |
| 997 | |
| 998 | /-- The representative frequencies are bounded uniformly before rounding; |
| 999 | the bound follows from the specified frequency formula. -/ |
| 1000 | theorem representative_uniform_frequency_bounds |
| 1001 | {B sigma u L M S R0 target pz : ℝ} {K g : Plane} |
| 1002 | (hR0 : R0 ≠ 0) (hM : 0 ≤ M) (hS : 1 ≤ S) |
| 1003 | (hB : |B| ≤ M) (hsigma : |sigma| = 1) (hu : |u| ≤ M) |
| 1004 | (hg : 1 / ‖g‖ ≤ M) (hL : 1 / |L| ≤ M / S) (hK : ‖K‖ = 1) |
| 1005 | (hRbound : |R0| ≤ M) |
| 1006 | (hfreq : (!₂[target / R0, pz] : Plane) = representativeFrequency B sigma u L K g) : |
| 1007 | |target| ≤ M * (M + M ^ 4) ∧ |pz| ≤ M + M ^ 4 := by |
| 1008 | have htilt := representative_tilt_scaled hM hB hsigma hu hg hL |
| 1009 | have hinv : M ^ 4 / S ≤ M ^ 4 := |
| 1010 | (div_le_iff₀ (lt_of_lt_of_le zero_lt_one hS)).2 (by |
| 1011 | simpa only [mul_one] using mul_le_mul_of_nonneg_left hS (pow_nonneg hM 4)) |
| 1012 | have hf : ‖representativeFrequency B sigma u L K g‖ ≤ M + M ^ 4 := by |
| 1013 | exact (representative_frequency_bound B sigma u L K g hK).trans |
| 1014 | (add_le_add hB (htilt.trans hinv)) |
| 1015 | have h0 := (PiLp.norm_apply_le (representativeFrequency B sigma u L K g) 0).trans hf |
| 1016 | have h1 := (PiLp.norm_apply_le (representativeFrequency B sigma u L K g) 1).trans hf |
| 1017 | rw [← hfreq] at h0 h1 |
| 1018 | have htarget : |target / R0| ≤ M + M ^ 4 := by simpa [abs_div] using h0 |
| 1019 | constructor |
| 1020 | · have heq : target = R0 * (target / R0) := by field_simp |
| 1021 | calc |
| 1022 | |target| = |R0| * |target / R0| := by nth_rw 1 [heq]; rw [abs_mul] |
| 1023 | _ ≤ M * (M + M ^ 4) := mul_le_mul hRbound htarget (abs_nonneg _) hM |
| 1024 | · simpa using h1 |
| 1025 | |
| 1026 | theorem chart_carrier_ge_one (h : ℝ) (n : ℕ) : 1 ≤ (ChartScales.carrier h n : ℝ) := by |
| 1027 | have hk : 0 < (ChartScales.carrier h n : ℝ) := |
| 1028 | Scaling.carrier_frequency_pos (ChartScales.epsilon_pos h n) |
| 1029 | have hn : 0 < ChartScales.carrier h n := by exact_mod_cast hk |
| 1030 | exact_mod_cast Nat.succ_le_of_lt hn |
| 1031 | |
| 1032 | theorem chart_S_tendsto_atTop : Tendsto ChartScales.S atTop atTop := by |
| 1033 | exact (tendsto_pow_atTop (by norm_num : (2 : ℕ) ≠ 0)).comp |
| 1034 | (tendsto_natCast_atTop_atTop (R := ℝ)) |
| 1035 | |
| 1036 | /-- The band conditions used in the finite estimate hold on the actual |
| 1037 | dyadic scale and actual ceiling-rounded carrier. -/ |
| 1038 | theorem eventually_band_conditions (h : ℝ) (hh : 0 < h) : |
| 1039 | ∀ᶠ n : ℕ in atTop, |
| 1040 | 1 ≤ ChartScales.S n ∧ |
| 1041 | ChartScales.S n ^ 2 * ChartScales.epsilon h n ^ 2 ≤ 1 ∧ |
| 1042 | ChartScales.S n ^ 2 / (ChartScales.carrier h n : ℝ) ≤ 1 ∧ |
| 1043 | ChartScales.epsilon h n * ChartScales.S n ^ 2 ≤ 1 := by |
| 1044 | have hS := chart_S_tendsto_atTop.eventually (eventually_ge_atTop (1 : ℝ)) |
| 1045 | have h2 := ChartScales.eventually_slow_power_epsilon_lt h hh 2 2 1 (by norm_num) (by norm_num) |
| 1046 | have h1 := ChartScales.eventually_slow_power_epsilon_lt h hh 2 1 1 (by norm_num) (by norm_num) |
| 1047 | have hk := (tendsto_order.1 (ChartScales.slow_power_div_carrier_tendsto_zero h hh 2)).2 1 (by norm_num) |
| 1048 | filter_upwards [hS, h2, hk, h1] with n hn hn2 hnk hn1 |
| 1049 | refine ⟨hn, ?_, ?_, ?_⟩ |
| 1050 | · simpa only [Real.rpow_two] using hn2.le |
| 1051 | · simpa only [Real.rpow_two] using hnk.le |
| 1052 | · simpa only [Real.rpow_two, Real.rpow_one, mul_comm] using hn1.le |
| 1053 | |
| 1054 | theorem eventually_phaseError_le (h : ℝ) (hh : 0 < h) : |
| 1055 | ∀ᶠ n : ℕ in atTop, |
| 1056 | phaseError (ChartScales.S n) (ChartScales.epsilon h n) (ChartScales.carrier h n) ≤ |
| 1057 | 4 / ChartScales.S n := by |
| 1058 | filter_upwards [eventually_band_conditions h hh] with n hn |
| 1059 | exact phaseError_le_four_div (lt_of_lt_of_le zero_lt_one hn.1) hn.2.1 hn.2.2.1 hn.2.2.2 |
| 1060 | |
| 1061 | /-- Any fixed positive representative lower bound eventually dominates the |
| 1062 | derived normal error. This is a cutoff conclusion, not an assumed comparison. -/ |
| 1063 | theorem eventually_error_small (h : ℝ) (hh : 0 < h) {C B : ℝ} (hC : 0 ≤ C) (hB : 0 < B) : |
| 1064 | ∀ᶠ n : ℕ in atTop, |
| 1065 | C * phaseError (ChartScales.S n) (ChartScales.epsilon h n) (ChartScales.carrier h n) ≤ B / 2 := by |
| 1066 | have hS := chart_S_tendsto_atTop.eventually (eventually_ge_atTop (max 1 (8 * C / B))) |
| 1067 | filter_upwards [hS, eventually_phaseError_le h hh] with n hn he |
| 1068 | have hS1 : 1 ≤ ChartScales.S n := (le_max_left _ _).trans hn |
| 1069 | have hS0 : 0 < ChartScales.S n := lt_of_lt_of_le zero_lt_one hS1 |
| 1070 | have hthreshold : 8 * C / B ≤ ChartScales.S n := (le_max_right _ _).trans hn |
| 1071 | have hb := (div_le_iff₀ hB).mp hthreshold |
| 1072 | calc |
| 1073 | _ ≤ C * (4 / ChartScales.S n) := mul_le_mul_of_nonneg_left he hC |
| 1074 | _ = (4 * C) / ChartScales.S n := by ring |
| 1075 | _ ≤ B / 2 := (div_le_iff₀ hS0).mpr (by nlinarith only [hb]) |
| 1076 | |
| 1077 | end NavierStokes.PhaseEstimates |