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.PartitionedCovariance |
| 2 | import NavierStokes.UniformCone |
| 3 | import NavierStokes.SimilarityHomogeneity |
| 4 | import Mathlib.Topology.UniformSpace.HeineCantor |
| 5 | |
| 6 | /-! |
| 7 | # Actual grid representatives and uniform primary reference parameters |
| 8 | |
| 9 | Representatives are selected in the intersection of the actual closed mask |
| 10 | support and the fixed closed active set. The enlarged-box distance is then a |
| 11 | consequence of the mesh, rather than a hypothesis on the selected point. |
| 12 | -/ |
| 13 | |
| 14 | noncomputable section |
| 15 | |
| 16 | namespace NavierStokes.PrimaryRepresentatives |
| 17 | |
| 18 | open Set Function Filter |
| 19 | open scoped ContDiff Topology InnerProductSpace |
| 20 | |
| 21 | abbrev Slow := PhaseCalculus.Slow |
| 22 | abbrev Plane := MovingFrameODE.Plane |
| 23 | abbrev Grid := SlotColoring.Grid |
| 24 | abbrev Label := PartitionedCovariance.UnsignedLabel |
| 25 | abbrev Position := SlotColoring.Position |
| 26 | |
| 27 | noncomputable def position (q : Slow) : Position := ![q.1, q.2.1, q.2.2] |
| 28 | noncomputable def slow (x : Position) : Slow := (x 0, (x 1, x 2)) |
| 29 | |
| 30 | @[simp] theorem position_slow (x : Position) : position (slow x) = x := by |
| 31 | ext j |
| 32 | fin_cases j <;> rfl |
| 33 | |
| 34 | @[simp] theorem slow_position (q : Slow) : slow (position q) = q := rfl |
| 35 | |
| 36 | theorem position_smooth : ContDiff ℝ ∞ position := by |
| 37 | apply contDiff_pi.mpr |
| 38 | intro j |
| 39 | fin_cases j |
| 40 | · exact contDiff_fst |
| 41 | · exact contDiff_snd.fst |
| 42 | · exact contDiff_snd.snd |
| 43 | |
| 44 | theorem slow_smooth : ContDiff ℝ ∞ slow := |
| 45 | (contDiff_apply ℝ ℝ 0).prodMk |
| 46 | ((contDiff_apply ℝ ℝ 1).prodMk (contDiff_apply ℝ ℝ 2)) |
| 47 | |
| 48 | theorem norm_slow_sub_le {x y : Position} {c : ℝ} |
| 49 | (h : ∀ j, |x j - y j| ≤ c) : ‖slow x - slow y‖ ≤ c := by |
| 50 | change max |x 0 - y 0| (max |x 1 - y 1| |x 2 - y 2|) ≤ c |
| 51 | exact max_le (h 0) (max_le (h 1) (h 2)) |
| 52 | |
| 53 | noncomputable def nativeMask (n : ℕ) (k : Grid) (q : Slow) : ℝ := |
| 54 | SquaredPartition.slowMask n k (position q) |
| 55 | |
| 56 | noncomputable def gridBox (n : ℕ) (k : Grid) (a : ℝ) : Set Slow := |
| 57 | {q | ∀ j, |position q j - SquaredPartition.nativeSpacing n * (k j : ℝ)| ≤ |
| 58 | a * SquaredPartition.nativeSpacing n} |
| 59 | |
| 60 | theorem gridBox_closed (n : ℕ) (k : Grid) (a : ℝ) : IsClosed (gridBox n k a) := by |
| 61 | simp only [gridBox, Set.ofPred_forall] |
| 62 | exact isClosed_iInter fun j => isClosed_le |
| 63 | (((continuous_apply j).comp position_smooth.continuous).sub continuous_const).abs continuous_const |
| 64 | |
| 65 | theorem nativeMask_smooth (n : ℕ) (k : Grid) : ContDiff ℝ ∞ (nativeMask n k) := |
| 66 | (SquaredPartition.slowMask_smooth n k).comp position_smooth |
| 67 | |
| 68 | theorem nativeMask_tsupport_subset {n : ℕ} (hn : 1 ≤ n) (k : Grid) : |
| 69 | tsupport (nativeMask n k) ⊆ gridBox n k 1 := by |
| 70 | apply closure_minimal _ (gridBox_closed n k 1) |
| 71 | intro q hq j |
| 72 | have hx : position q ∈ tsupport (SquaredPartition.slowMask n k) := subset_closure hq |
| 73 | have hj := SquaredPartition.slowMask_tsupport_subset hn k hx j (mem_univ _) |
| 74 | change |position q j - SquaredPartition.nativeSpacing n * (k j : ℝ)| ≤ |
| 75 | 1 * SquaredPartition.nativeSpacing n |
| 76 | rw [one_mul, abs_le] |
| 77 | constructor <;> linarith [hj.1, hj.2] |
| 78 | |
| 79 | theorem gridBox_distance {n : ℕ} {k : Grid} {a b : ℝ} {q q₀ : Slow} |
| 80 | (hq : q ∈ gridBox n k a) (h₀ : q₀ ∈ gridBox n k b) : |
| 81 | ‖q - q₀‖ ≤ (a + b) * SquaredPartition.nativeSpacing n := by |
| 82 | rw [← slow_position q, ← slow_position q₀] |
| 83 | apply norm_slow_sub_le |
| 84 | intro j |
| 85 | have ht := abs_sub_le (position q j) |
| 86 | (SquaredPartition.nativeSpacing n * (k j : ℝ)) (position q₀ j) |
| 87 | rw [abs_sub_comm (SquaredPartition.nativeSpacing n * (k j : ℝ))] at ht |
| 88 | linarith [hq j, h₀ j] |
| 89 | |
| 90 | /-- Exactly the labels whose closed mask support meets the closed active set. -/ |
| 91 | noncomputable def ActiveLabel (K : Set Slow) := |
| 92 | {L : Label // 1 ≤ L.1 ∧ (K ∩ tsupport (nativeMask L.1 L.2)).Nonempty} |
| 93 | |
| 94 | noncomputable def representative (K : Set Slow) (L : ActiveLabel K) : Slow := |
| 95 | Classical.choose L.property.2 |
| 96 | |
| 97 | theorem representative_mem (K : Set Slow) (L : ActiveLabel K) : representative K L ∈ K := |
| 98 | (Classical.choose_spec L.property.2).1 |
| 99 | |
| 100 | theorem representative_mem_tsupport (K : Set Slow) (L : ActiveLabel K) : |
| 101 | representative K L ∈ tsupport (nativeMask L.val.1 L.val.2) := |
| 102 | (Classical.choose_spec L.property.2).2 |
| 103 | |
| 104 | /-- The sharp bound furnished by a one-mesh support and a two-mesh pad. -/ |
| 105 | theorem representative_enlarged_distance (K : Set Slow) (L : ActiveLabel K) |
| 106 | {q : Slow} (hq : q ∈ gridBox L.val.1 L.val.2 2) : |
| 107 | ‖q - representative K L‖ ≤ 3 / ChartScales.S L.val.1 ^ 3 := by |
| 108 | have h₀ := nativeMask_tsupport_subset L.property.1 L.val.2 (representative_mem_tsupport K L) |
| 109 | simpa only [show (2 : ℝ) + 1 = 3 by norm_num, SquaredPartition.nativeSpacing, |
| 110 | div_eq_mul_inv] using gridBox_distance hq h₀ |
| 111 | |
| 112 | theorem representative_support_distance (K : Set Slow) (L : ActiveLabel K) |
| 113 | {q : Slow} (hq : q ∈ tsupport (nativeMask L.val.1 L.val.2)) : |
| 114 | ‖q - representative K L‖ ≤ 2 / ChartScales.S L.val.1 ^ 3 := by |
| 115 | have h₀ := nativeMask_tsupport_subset L.property.1 L.val.2 (representative_mem_tsupport K L) |
| 116 | have hq' := nativeMask_tsupport_subset L.property.1 L.val.2 hq |
| 117 | simpa only [show (1 : ℝ) + 1 = 2 by norm_num, SquaredPartition.nativeSpacing, |
| 118 | div_eq_mul_inv] using gridBox_distance hq' h₀ |
| 119 | |
| 120 | noncomputable def normalizedSlow (D : ℝ) (n : ℕ) (x : Position) : Slow := |
| 121 | slow (SquaredPartition.slowCoordinates D n x) |
| 122 | |
| 123 | theorem width_eq_scaled_spacing (D : ℝ) (n : ℕ) (j : Fin 3) : |
| 124 | SlotColoring.width D j n = ChartScales.Q n ^ SlotColoring.axisExponent D j * |
| 125 | SquaredPartition.nativeSpacing n := by |
| 126 | unfold SlotColoring.width |
| 127 | rw [SlotColoring.spacing_eq_scaled_mesh] |
| 128 | simp only [ChartScales.Q, SquaredPartition.nativeSpacing, ChartScales.S, one_div] |
| 129 | |
| 130 | theorem physicalBox_normalizes (D : ℝ) (L : SlotColoring.Label) {x : Position} |
| 131 | (hx : x ∈ SlotColoring.physicalBox D L) : |
| 132 | normalizedSlow D L.1 x ∈ gridBox L.1 L.2.1 2 := by |
| 133 | intro j |
| 134 | have hp : 0 < ChartScales.Q L.1 ^ SlotColoring.axisExponent D j := |
| 135 | Real.rpow_pos_of_pos (ChartScales.Q_pos _) _ |
| 136 | have he : position (normalizedSlow D L.1 x) j - |
| 137 | SquaredPartition.nativeSpacing L.1 * (L.2.1 j : ℝ) = |
| 138 | (x j - SlotColoring.width D j L.1 * (L.2.1 j : ℝ)) / |
| 139 | (ChartScales.Q L.1 ^ SlotColoring.axisExponent D j) := by |
| 140 | simp only [normalizedSlow, position_slow, SquaredPartition.slowCoordinates, |
| 141 | width_eq_scaled_spacing] |
| 142 | field_simp |
| 143 | rw [he, abs_div, abs_of_pos hp] |
| 144 | apply (div_le_iff₀ hp).mpr |
| 145 | have hj := hx j |
| 146 | rw [width_eq_scaled_spacing] at hj |
| 147 | rw [width_eq_scaled_spacing] |
| 148 | nlinarith |
| 149 | |
| 150 | theorem physicalMask_nativeMask (D : ℝ) (L : Label) (q : ℝ) (x : Position) : |
| 151 | PartitionedCovariance.mask D L q x = SquaredPartition.dyadicMask (L.1 : ℤ) q * |
| 152 | nativeMask L.1 L.2 (normalizedSlow D L.1 x) := by |
| 153 | simp only [PartitionedCovariance.mask, PartitionedCovariance.physicalMask, |
| 154 | PartitionedCovariance.signedLabel, nativeMask, normalizedSlow, position_slow, |
| 155 | SquaredPartition.physicalSlowMask] |
| 156 | |
| 157 | /-- Every nonzero actual physical mask on the active set produces one of |
| 158 | the labels for which the representative was constructed. -/ |
| 159 | theorem physicalMask_active (K : Set Slow) (D : ℝ) (L : Label) |
| 160 | (hL : 1 ≤ L.1) {q : ℝ} {x : Position} |
| 161 | (hx : normalizedSlow D L.1 x ∈ K) (hm : PartitionedCovariance.mask D L q x ≠ 0) : |
| 162 | ∃ A : ActiveLabel K, A.val = L := by |
| 163 | refine ⟨⟨L, hL, normalizedSlow D L.1 x, hx, ?_⟩, rfl⟩ |
| 164 | apply subset_closure |
| 165 | rw [physicalMask_nativeMask] at hm |
| 166 | exact (mul_ne_zero_iff.mp hm).2 |
| 167 | |
| 168 | theorem grid_mesh_tendsto_zero : |
| 169 | Tendsto (fun n : ℕ => 3 / ChartScales.S n ^ 3) atTop (𝓝 0) := by |
| 170 | have hS : Tendsto (fun n : ℕ => ChartScales.S n ^ 3) atTop atTop := |
| 171 | (tendsto_pow_atTop (by norm_num : (3 : ℕ) ≠ 0)).comp PhaseEstimates.chart_S_tendsto_atTop |
| 172 | have hi : Tendsto (fun n : ℕ => (ChartScales.S n ^ 3)⁻¹) atTop (𝓝 (0 : ℝ)) := |
| 173 | hS.inv_tendsto_atTop |
| 174 | simpa only [div_eq_mul_inv, mul_zero] using hi.const_mul (3 : ℝ) |
| 175 | |
| 176 | /-- All enlarged boxes of active sufficiently fine labels lie in a single |
| 177 | prescribed open base-control chart. -/ |
| 178 | theorem enlarged_eventually_in_chart {K U : Set Slow} (hK : IsCompact K) |
| 179 | (hU : IsOpen U) (hKU : K ⊆ U) : |
| 180 | ∃ N : ℕ, ∀ L : ActiveLabel K, N ≤ L.val.1 → gridBox L.val.1 L.val.2 2 ⊆ U := by |
| 181 | obtain ⟨r, hr, hsub⟩ := hK.exists_cthickening_subset_open hU hKU |
| 182 | obtain ⟨N, hN⟩ := eventually_atTop.mp ((tendsto_order.1 grid_mesh_tendsto_zero).2 r hr) |
| 183 | refine ⟨N, fun L hL q hq => hsub ?_⟩ |
| 184 | apply Metric.mem_cthickening_of_dist_le q (representative K L) r K (representative_mem K L) |
| 185 | simpa only [dist_eq_norm] using |
| 186 | (representative_enlarged_distance K L hq).trans (hN _ hL).le |
| 187 | |
| 188 | /-! ## Reference frame and exact unstable-mode parameters -/ |
| 189 | |
| 190 | noncomputable def normalDirection (g : Plane) : Plane := ‖g‖⁻¹ • g |
| 191 | noncomputable def transverseDirection (g : Plane) : Plane := |
| 192 | -MovingFrameODE.quarterTurn (normalDirection g) |
| 193 | noncomputable def coupling (F : ℝ) (g : Plane) : ℝ := 2 * F * normalDirection g 0 |
| 194 | noncomputable def lambda0 (F : ℝ) (g : Plane) : ℝ := |
| 195 | Real.sqrt (-(coupling F g) * (coupling F g + ‖g‖)) |
| 196 | noncomputable def c0 (F : ℝ) (g : Plane) : ℝ := lambda0 F g / coupling F g |
| 197 | |
| 198 | /-- Primitive strict shear conditions. The last inequality is the positive |
| 199 | opening of the unstable two-dimensional reference system. -/ |
| 200 | structure ReferenceCone (F : ℝ) (g : Plane) : Prop where |
| 201 | frequency_pos : 0 < F |
| 202 | theta_neg : g 0 < 0 |
| 203 | opening_pos : 0 < 2 * F * g 0 + ‖g‖ ^ 2 |
| 204 | |
| 205 | theorem ReferenceCone.shear_ne_zero {F : ℝ} {g : Plane} (h : ReferenceCone F g) : g ≠ 0 := by |
| 206 | intro hg |
| 207 | simpa [hg] using h.theta_neg |
| 208 | |
| 209 | /-- The manuscript's shear coordinates give the primitive reference cone |
| 210 | from `a > 0` and `a²+b² > 2a`. -/ |
| 211 | theorem referenceCone_of_shear_coordinates {F a b : ℝ} (hF : 0 < F) (ha : 0 < a) |
| 212 | (hv : 2 * a < a ^ 2 + b ^ 2) : ReferenceCone F (F • !₂[-a, b]) := by |
| 213 | refine ⟨hF, ?_, ?_⟩ |
| 214 | · change F * -a < 0 |
| 215 | exact mul_neg_of_pos_of_neg hF (neg_neg_of_pos ha) |
| 216 | · have hn := ViscousPropagator.plane_norm_sq (F • !₂[-a, b]) |
| 217 | change ‖F • !₂[-a, b]‖ ^ 2 = (F * -a) ^ 2 + (F * b) ^ 2 at hn |
| 218 | change 0 < 2 * F * (F * -a) + ‖F • !₂[-a, b]‖ ^ 2 |
| 219 | rw [hn] |
| 220 | nlinarith [mul_pos (sq_pos_of_pos hF) (sub_pos.mpr hv)] |
| 221 | |
| 222 | theorem normalDirection_unit {g : Plane} (hg : g ≠ 0) : ‖normalDirection g‖ = 1 := by |
| 223 | simp only [normalDirection, norm_smul, norm_inv, norm_norm] |
| 224 | exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hg) |
| 225 | |
| 226 | theorem transverseDirection_unit {g : Plane} (hg : g ≠ 0) : ‖transverseDirection g‖ = 1 := by |
| 227 | rw [transverseDirection, norm_neg, PhaseEstimates.quarterTurn_norm, normalDirection_unit hg] |
| 228 | |
| 229 | theorem quarterTurn_transverseDirection (g : Plane) : |
| 230 | MovingFrameODE.quarterTurn (transverseDirection g) = normalDirection g := by |
| 231 | rw [transverseDirection, map_neg, MovingFrameODE.quarterTurn_square, neg_neg] |
| 232 | |
| 233 | theorem norm_smul_normalDirection {g : Plane} (hg : g ≠ 0) : |
| 234 | ‖g‖ • normalDirection g = g := by |
| 235 | rw [normalDirection, smul_smul, mul_inv_cancel₀ (norm_ne_zero_iff.mpr hg), one_smul] |
| 236 | |
| 237 | theorem transverseDirection_inner_shear (g : Plane) : |
| 238 | ⟪transverseDirection g, g⟫_ℝ = 0 := by |
| 239 | rw [transverseDirection, normalDirection, map_smul, inner_neg_left, real_inner_smul_left, |
| 240 | real_inner_comm, MovingFrameODE.inner_quarterTurn_self] |
| 241 | ring |
| 242 | |
| 243 | theorem normalDirection_theta (g : Plane) : normalDirection g 0 = g 0 / ‖g‖ := by |
| 244 | simp [normalDirection, div_eq_mul_inv, mul_comm] |
| 245 | |
| 246 | theorem coupling_eq (F : ℝ) (g : Plane) : coupling F g = (2 * F * g 0) / ‖g‖ := by |
| 247 | rw [coupling, normalDirection_theta] |
| 248 | ring |
| 249 | |
| 250 | theorem ReferenceCone.coupling_neg {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 251 | coupling F g < 0 := by |
| 252 | rw [coupling_eq] |
| 253 | exact div_neg_of_neg_of_pos (mul_neg_of_pos_of_neg (by linarith [h.frequency_pos]) h.theta_neg) |
| 254 | (norm_pos_iff.mpr h.shear_ne_zero) |
| 255 | |
| 256 | theorem ReferenceCone.normalDirection_theta_neg {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 257 | normalDirection g 0 < 0 := by |
| 258 | rw [normalDirection_theta] |
| 259 | exact div_neg_of_neg_of_pos h.theta_neg (norm_pos_iff.mpr h.shear_ne_zero) |
| 260 | |
| 261 | theorem ReferenceCone.coupling_add_norm_pos {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 262 | 0 < coupling F g + ‖g‖ := by |
| 263 | have hg := norm_pos_iff.mpr h.shear_ne_zero |
| 264 | have he : coupling F g + ‖g‖ = (2 * F * g 0 + ‖g‖ ^ 2) / ‖g‖ := by |
| 265 | rw [coupling_eq] |
| 266 | field_simp |
| 267 | rw [he] |
| 268 | exact div_pos h.opening_pos hg |
| 269 | |
| 270 | theorem ReferenceCone.lambda0_pos {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 271 | 0 < lambda0 F g := |
| 272 | Real.sqrt_pos.mpr (mul_pos (neg_pos.mpr h.coupling_neg) h.coupling_add_norm_pos) |
| 273 | |
| 274 | theorem ReferenceCone.lambda0_sq {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 275 | lambda0 F g ^ 2 = -(coupling F g) * (coupling F g + ‖g‖) := |
| 276 | Real.sq_sqrt (mul_pos (neg_pos.mpr h.coupling_neg) h.coupling_add_norm_pos).le |
| 277 | |
| 278 | theorem ReferenceCone.c0_neg {F : ℝ} {g : Plane} (h : ReferenceCone F g) : c0 F g < 0 := |
| 279 | div_neg_of_pos_of_neg h.lambda0_pos h.coupling_neg |
| 280 | |
| 281 | theorem ReferenceCone.lambda0_div_c0 {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 282 | lambda0 F g / c0 F g = 2 * F * normalDirection g 0 := by |
| 283 | rw [c0, div_div_eq_mul_div, mul_div_cancel_left₀ _ h.lambda0_pos.ne'] |
| 284 | rfl |
| 285 | |
| 286 | theorem ReferenceCone.lambda0_mul_c0 {F : ℝ} {g : Plane} (h : ReferenceCone F g) : |
| 287 | lambda0 F g * c0 F g = -(2 * F * normalDirection g 0 + ‖g‖) := by |
| 288 | change lambda0 F g * (lambda0 F g / coupling F g) = -(coupling F g + ‖g‖) |
| 289 | rw [← mul_div_assoc, ← pow_two, h.lambda0_sq] |
| 290 | field_simp [h.coupling_neg.ne] |
| 291 | |
| 292 | section Continuity |
| 293 | |
| 294 | variable {X : Type*} [TopologicalSpace X] {K : Set X} {F : X → ℝ} {g : X → Plane} |
| 295 | |
| 296 | theorem normalDirection_continuousOn (hg : ContinuousOn g K) |
| 297 | (hne : ∀ q ∈ K, g q ≠ 0) : ContinuousOn (fun q => normalDirection (g q)) K := |
| 298 | (hg.norm.inv₀ (fun q hq => norm_ne_zero_iff.mpr (hne q hq))).smul hg |
| 299 | |
| 300 | theorem transverseDirection_continuousOn (hg : ContinuousOn g K) |
| 301 | (hne : ∀ q ∈ K, g q ≠ 0) : ContinuousOn (fun q => transverseDirection (g q)) K := |
| 302 | (MovingFrameODE.quarterTurn.continuous.comp_continuousOn |
| 303 | (normalDirection_continuousOn hg hne)).neg |
| 304 | |
| 305 | theorem coupling_continuousOn (hF : ContinuousOn F K) (hg : ContinuousOn g K) |
| 306 | (hne : ∀ q ∈ K, g q ≠ 0) : ContinuousOn (fun q => coupling (F q) (g q)) K := by |
| 307 | exact (continuousOn_const.mul hF).mul |
| 308 | ((PiLp.continuous_apply 2 _ 0).comp_continuousOn (normalDirection_continuousOn hg hne)) |
| 309 | |
| 310 | theorem lambda0_continuousOn (hF : ContinuousOn F K) (hg : ContinuousOn g K) |
| 311 | (hne : ∀ q ∈ K, g q ≠ 0) : ContinuousOn (fun q => lambda0 (F q) (g q)) K := by |
| 312 | have hc := coupling_continuousOn hF hg hne |
| 313 | exact (hc.neg.mul (hc.add hg.norm)).sqrt |
| 314 | |
| 315 | theorem c0_continuousOn (hF : ContinuousOn F K) (hg : ContinuousOn g K) |
| 316 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) : ContinuousOn (fun q => c0 (F q) (g q)) K := |
| 317 | (lambda0_continuousOn hF hg (fun q hq => (hc q hq).shear_ne_zero)).div |
| 318 | (coupling_continuousOn hF hg (fun q hq => (hc q hq).shear_ne_zero)) |
| 319 | (fun q hq => (hc q hq).coupling_neg.ne) |
| 320 | |
| 321 | end Continuity |
| 322 | |
| 323 | noncomputable def parameterScalars (F : Slow → ℝ) (g : Slow → Plane) (q : Slow) : Fin 9 → ℝ := |
| 324 | ![q.1, F q, ‖g q‖, lambda0 (F q) (g q), c0 (F q) (g q), |
| 325 | q.1⁻¹, ‖g q‖⁻¹, (lambda0 (F q) (g q))⁻¹, (c0 (F q) (g q))⁻¹] |
| 326 | |
| 327 | theorem parameterScalars_continuousOn {K : Set Slow} {F : Slow → ℝ} {g : Slow → Plane} |
| 328 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hR : ∀ q ∈ K, 0 < q.1) |
| 329 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) : ContinuousOn (parameterScalars F g) K := by |
| 330 | have hn : ∀ q ∈ K, g q ≠ 0 := fun q hq => (hc q hq).shear_ne_zero |
| 331 | have hlam := lambda0_continuousOn hF hg hn |
| 332 | have hc0 := c0_continuousOn hF hg hc |
| 333 | apply continuousOn_pi.mpr |
| 334 | intro i |
| 335 | fin_cases i |
| 336 | · exact continuous_fst.continuousOn |
| 337 | · exact hF |
| 338 | · exact hg.norm |
| 339 | · exact hlam |
| 340 | · exact hc0 |
| 341 | · exact continuous_fst.continuousOn.inv₀ (fun q hq => (hR q hq).ne') |
| 342 | · exact hg.norm.inv₀ (fun q hq => norm_ne_zero_iff.mpr (hn q hq)) |
| 343 | · exact hlam.inv₀ (fun q hq => (hc q hq).lambda0_pos.ne') |
| 344 | · exact hc0.inv₀ (fun q hq => (hc q hq).c0_neg.ne) |
| 345 | |
| 346 | /-- The same constant controls every representative parameter and reciprocal. -/ |
| 347 | structure ParameterBounds (M R F : ℝ) (g : Plane) : Prop where |
| 348 | radius : R ≤ M |
| 349 | frequency : |F| ≤ M |
| 350 | shear : ‖g‖ ≤ M |
| 351 | lambda : lambda0 F g ≤ M |
| 352 | ratio : |c0 F g| ≤ M |
| 353 | radius_inv : R⁻¹ ≤ M |
| 354 | shear_inv : ‖g‖⁻¹ ≤ M |
| 355 | lambda_inv : (lambda0 F g)⁻¹ ≤ M |
| 356 | ratio_inv : |c0 F g|⁻¹ ≤ M |
| 357 | |
| 358 | theorem compact_parameter_bounds {K : Set Slow} (hK : IsCompact K) |
| 359 | {F : Slow → ℝ} {g : Slow → Plane} (hF : ContinuousOn F K) (hg : ContinuousOn g K) |
| 360 | (hR : ∀ q ∈ K, 0 < q.1) (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) : |
| 361 | ∃ M : ℝ, 1 ≤ M ∧ ∀ q ∈ K, ParameterBounds M q.1 (F q) (g q) := by |
| 362 | obtain ⟨B, hB⟩ := hK.exists_bound_of_continuousOn (parameterScalars_continuousOn hF hg hR hc) |
| 363 | refine ⟨max 1 B, le_max_left _ _, fun q hq => ?_⟩ |
| 364 | have hb (i : Fin 9) : |parameterScalars F g q i| ≤ max 1 B := by |
| 365 | exact (norm_le_pi_norm (parameterScalars F g q) i).trans |
| 366 | ((hB q hq).trans (le_max_right _ _)) |
| 367 | have hgq : 0 < ‖g q‖ := norm_pos_iff.mpr (hc q hq).shear_ne_zero |
| 368 | refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ |
| 369 | · simpa [parameterScalars, abs_of_pos (hR q hq)] using hb 0 |
| 370 | · simpa [parameterScalars] using hb 1 |
| 371 | · simpa [parameterScalars] using hb 2 |
| 372 | · simpa [parameterScalars, abs_of_pos (hc q hq).lambda0_pos] using hb 3 |
| 373 | · simpa [parameterScalars] using hb 4 |
| 374 | · simpa [parameterScalars, abs_of_pos (inv_pos.mpr (hR q hq))] using hb 5 |
| 375 | · simpa [parameterScalars, abs_of_pos (inv_pos.mpr hgq)] using hb 6 |
| 376 | · simpa [parameterScalars, abs_of_pos (inv_pos.mpr (hc q hq).lambda0_pos)] using hb 7 |
| 377 | · simpa [parameterScalars, abs_inv] using hb 8 |
| 378 | |
| 379 | private theorem reciprocal_lower {M x : ℝ} (hM : 0 < M) (hx : 0 < x) (h : x⁻¹ ≤ M) : |
| 380 | M⁻¹ ≤ x := by |
| 381 | have hb := mul_le_mul_of_nonneg_right h hx.le |
| 382 | rw [inv_mul_cancel₀ hx.ne'] at hb |
| 383 | have he : M * M⁻¹ = 1 := mul_inv_cancel₀ hM.ne' |
| 384 | nlinarith |
| 385 | |
| 386 | theorem ParameterBounds.mono {M M' R F : ℝ} {g : Plane} |
| 387 | (h : ParameterBounds M R F g) (hMM' : M ≤ M') : ParameterBounds M' R F g := |
| 388 | ⟨h.radius.trans hMM', h.frequency.trans hMM', h.shear.trans hMM', h.lambda.trans hMM', |
| 389 | h.ratio.trans hMM', h.radius_inv.trans hMM', h.shear_inv.trans hMM', |
| 390 | h.lambda_inv.trans hMM', h.ratio_inv.trans hMM'⟩ |
| 391 | |
| 392 | theorem ParameterBounds.positive_lower {M R F : ℝ} {g : Plane} |
| 393 | (h : ParameterBounds M R F g) (hM : 1 ≤ M) (hR : 0 < R) (hc : ReferenceCone F g) : |
| 394 | M⁻¹ ≤ R ∧ M⁻¹ ≤ ‖g‖ ∧ M⁻¹ ≤ lambda0 F g ∧ M⁻¹ ≤ |c0 F g| := by |
| 395 | have hM0 : 0 < M := lt_of_lt_of_le zero_lt_one hM |
| 396 | exact ⟨reciprocal_lower hM0 hR h.radius_inv, |
| 397 | reciprocal_lower hM0 (norm_pos_iff.mpr hc.shear_ne_zero) h.shear_inv, |
| 398 | reciprocal_lower hM0 hc.lambda0_pos h.lambda_inv, |
| 399 | reciprocal_lower hM0 (abs_pos.mpr hc.c0_neg.ne) h.ratio_inv⟩ |
| 400 | |
| 401 | theorem representative_parameter_bounds {K : Set Slow} (hK : IsCompact K) |
| 402 | {F : Slow → ℝ} {g : Slow → Plane} (hF : ContinuousOn F K) (hg : ContinuousOn g K) |
| 403 | (hR : ∀ q ∈ K, 0 < q.1) (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) : |
| 404 | ∃ M : ℝ, 1 ≤ M ∧ ∀ L : ActiveLabel K, |
| 405 | ParameterBounds M (representative K L).1 (F (representative K L)) (g (representative K L)) := by |
| 406 | obtain ⟨M, hM, hb⟩ := compact_parameter_bounds hK hF hg hR hc |
| 407 | exact ⟨M, hM, fun L => hb _ (representative_mem K L)⟩ |
| 408 | |
| 409 | /-! ## A fixed compact set from the actual normalized similarity range -/ |
| 410 | |
| 411 | /-- Normalized active points, including the limiting time face `T = 0`. -/ |
| 412 | noncomputable def activeReference (h a b : ℝ) : Set Slow := |
| 413 | {p | 0 ≤ p.1 ∧ 0 ≤ p.2.2 ∧ ∃ q ∈ Icc (1 / 2 : ℝ) 2, |
| 414 | SimilarityCoordinates.forwardScalar (2 * h) p.2.1 q = p.2.2 ∧ |
| 415 | p.1 ^ 2 / (2 * q) ∈ Icc a b} |
| 416 | |
| 417 | noncomputable def referenceBox (a b : ℝ) : Set Slow := |
| 418 | Icc (Real.sqrt a) (2 * Real.sqrt b) ×ˢ (Icc (-2 : ℝ) 2 ×ˢ Icc (0 : ℝ) 2) |
| 419 | |
| 420 | noncomputable def referenceCompact (h a b : ℝ) : Set Slow := closure (activeReference h a b) |
| 421 | |
| 422 | theorem activeReference_subset_box {h a b : ℝ} (hh : 0 ≤ h) (hh1 : h < 1 / 2) |
| 423 | (ha : 0 < a) (hab : a ≤ b) : activeReference h a b ⊆ referenceBox a b := by |
| 424 | rintro p ⟨hR, hT, q, hq, he, hX⟩ |
| 425 | have hq0 : 0 < q := by linarith [hq.1] |
| 426 | have hb : 0 < b := ha.trans_le hab |
| 427 | have hp : 0 < q ^ (2 * h) := Real.rpow_pos_of_pos hq0 _ |
| 428 | have hfactor : q ^ (2 * h) * (q ^ (1 - 2 * h) - p.2.1 ^ 2) = p.2.2 := by |
| 429 | rw [← SimilarityCoordinates.forwardScalar_factor hq0] |
| 430 | exact he |
| 431 | have hZ : p.2.1 ^ 2 ≤ q ^ (1 - 2 * h) := by nlinarith |
| 432 | have hqpow : q ^ (1 - 2 * h) ≤ 2 := by |
| 433 | calc |
| 434 | q ^ (1 - 2 * h) ≤ (2 : ℝ) ^ (1 - 2 * h) := |
| 435 | Real.rpow_le_rpow hq0.le hq.2 (by linarith) |
| 436 | _ ≤ (2 : ℝ) ^ (1 : ℝ) := |
| 437 | Real.rpow_le_rpow_of_exponent_le (by norm_num) (by linarith) |
| 438 | _ = 2 := Real.rpow_one _ |
| 439 | have hRlo := (le_div_iff₀ (show 0 < 2 * q by positivity)).mp hX.1 |
| 440 | have hRhi := (div_le_iff₀ (show 0 < 2 * q by positivity)).mp hX.2 |
| 441 | have hRlower : a ≤ p.1 ^ 2 := by nlinarith [hq.1] |
| 442 | have hRupper : p.1 ^ 2 ≤ 4 * b := by nlinarith [hq.2] |
| 443 | have hsa := Real.sq_sqrt ha.le |
| 444 | have hsb := Real.sq_sqrt hb.le |
| 445 | have hTq : p.2.2 ≤ q := by |
| 446 | dsimp [SimilarityCoordinates.forwardScalar] at he |
| 447 | nlinarith [sq_nonneg p.2.1] |
| 448 | refine ⟨⟨?_, ?_⟩, ⟨⟨?_, ?_⟩, ⟨hT, hTq.trans hq.2⟩⟩⟩ |
| 449 | · nlinarith [Real.sqrt_nonneg a] |
| 450 | · nlinarith [Real.sqrt_nonneg b] |
| 451 | · nlinarith |
| 452 | · nlinarith |
| 453 | |
| 454 | theorem referenceCompact_subset_box {h a b : ℝ} (hh : 0 ≤ h) (hh1 : h < 1 / 2) |
| 455 | (ha : 0 < a) (hab : a ≤ b) : referenceCompact h a b ⊆ referenceBox a b := |
| 456 | closure_minimal (activeReference_subset_box hh hh1 ha hab) |
| 457 | (isClosed_Icc.prod (isClosed_Icc.prod isClosed_Icc)) |
| 458 | |
| 459 | theorem referenceCompact_isCompact {h a b : ℝ} (hh : 0 ≤ h) (hh1 : h < 1 / 2) |
| 460 | (ha : 0 < a) (hab : a ≤ b) : IsCompact (referenceCompact h a b) := |
| 461 | (isCompact_Icc.prod (isCompact_Icc.prod isCompact_Icc)).of_isClosed_subset |
| 462 | isClosed_closure (referenceCompact_subset_box hh hh1 ha hab) |
| 463 | |
| 464 | theorem referenceCompact_radius_pos {h a b : ℝ} (hh : 0 ≤ h) (hh1 : h < 1 / 2) |
| 465 | (ha : 0 < a) (hab : a ≤ b) {q : Slow} (hq : q ∈ referenceCompact h a b) : 0 < q.1 := |
| 466 | (Real.sqrt_pos.mpr ha).trans_le (referenceCompact_subset_box hh hh1 ha hab hq).1.1 |
| 467 | |
| 468 | /-- One explicit convex chart containing the whole normalized compact set. -/ |
| 469 | noncomputable def baseChart (a b : ℝ) : Set Slow := |
| 470 | Ioo (Real.sqrt a / 2) (2 * Real.sqrt b + 1) ×ˢ |
| 471 | (Ioo (-3 : ℝ) 3 ×ˢ Ioo (-1 : ℝ) 3) |
| 472 | |
| 473 | theorem baseChart_open (a b : ℝ) : IsOpen (baseChart a b) := |
| 474 | isOpen_Ioo.prod (isOpen_Ioo.prod isOpen_Ioo) |
| 475 | |
| 476 | theorem baseChart_convex (a b : ℝ) : Convex ℝ (baseChart a b) := |
| 477 | (convex_Ioo _ _).prod ((convex_Ioo _ _).prod (convex_Ioo _ _)) |
| 478 | |
| 479 | theorem referenceCompact_subset_baseChart {h a b : ℝ} (hh : 0 ≤ h) (hh1 : h < 1 / 2) |
| 480 | (ha : 0 < a) (hab : a ≤ b) : referenceCompact h a b ⊆ baseChart a b := by |
| 481 | intro q hq |
| 482 | obtain ⟨hR, hZ, hT⟩ := referenceCompact_subset_box hh hh1 ha hab hq |
| 483 | have hsa := Real.sqrt_pos.mpr ha |
| 484 | exact ⟨⟨by linarith [hR.1], by linarith [hR.2]⟩, |
| 485 | ⟨⟨by linarith [hZ.1], by linarith [hZ.2]⟩, |
| 486 | ⟨by linarith [hT.1], by linarith [hT.2]⟩⟩⟩ |
| 487 | |
| 488 | theorem reference_enlarged_eventually_in_chart {h a b : ℝ} (hh : 0 ≤ h) |
| 489 | (hh1 : h < 1 / 2) (ha : 0 < a) (hab : a ≤ b) : |
| 490 | ∃ N : ℕ, ∀ L : ActiveLabel (referenceCompact h a b), N ≤ L.val.1 → |
| 491 | gridBox L.val.1 L.val.2 2 ⊆ baseChart a b := |
| 492 | enlarged_eventually_in_chart (referenceCompact_isCompact hh hh1 ha hab) |
| 493 | (baseChart_open a b) (referenceCompact_subset_baseChart hh hh1 ha hab) |
| 494 | |
| 495 | theorem normalizedSlow_coordinates (D : ℝ) (n : ℕ) (x : Position) : |
| 496 | normalizedSlow D n x = |
| 497 | (x 0 / ChartScales.Q n ^ (1 / 2 : ℝ), (x 1 / ChartScales.Q n ^ D, x 2 / ChartScales.Q n)) := by |
| 498 | simp [normalizedSlow, slow, SquaredPartition.slowCoordinates, SlotColoring.axisExponent] |
| 499 | |
| 500 | /-- The physical similarity equation and the actual dyadic mask put every |
| 501 | active point into the same compact reference set, independent of its label. -/ |
| 502 | theorem physicalMask_normalized_mem {h a b : ℝ} (L : Label) {q : ℝ} {x : Position} |
| 503 | (hq : 0 < q) (hR : 0 ≤ x 0) (hT : 0 ≤ x 2) |
| 504 | (he : SimilarityCoordinates.forwardScalar (2 * h) (x 1) q = x 2) |
| 505 | (hX : x 0 ^ 2 / (2 * q) ∈ Icc a b) |
| 506 | (hm : PartitionedCovariance.mask (CoordinateAlgebra.D h) L q x ≠ 0) : |
| 507 | normalizedSlow (CoordinateAlgebra.D h) L.1 x ∈ referenceCompact h a b := by |
| 508 | apply subset_closure |
| 509 | have hQ := ChartScales.Q_pos L.1 |
| 510 | have hQp : 0 < ChartScales.Q L.1 ^ CoordinateAlgebra.D h := Real.rpow_pos_of_pos hQ _ |
| 511 | rw [physicalMask_nativeMask] at hm |
| 512 | have hd : q ∈ support (SquaredPartition.dyadicMask (L.1 : ℤ)) := (mul_ne_zero_iff.mp hm).1 |
| 513 | rw [SquaredPartition.dyadicMask_support, SquaredPartition.integerQ_nat] at hd |
| 514 | have hqn : q / ChartScales.Q L.1 ∈ Icc (1 / 2 : ℝ) 2 := by |
| 515 | constructor |
| 516 | · apply (le_div_iff₀ hQ).mpr |
| 517 | linarith [hd.1] |
| 518 | · exact (div_le_iff₀ hQ).mpr hd.2.le |
| 519 | have hs := SimilarityHomogeneity.forwardScalar_scale hQ (div_pos hq hQ) (2 * h) |
| 520 | (x 1 / ChartScales.Q L.1 ^ CoordinateAlgebra.D h) |
| 521 | have hD : (1 - 2 * h) / 2 = CoordinateAlgebra.D h := by |
| 522 | unfold CoordinateAlgebra.D |
| 523 | ring |
| 524 | rw [hD, mul_div_cancel₀ _ hQp.ne', mul_div_cancel₀ _ hQ.ne', he] at hs |
| 525 | have hnormeq : SimilarityCoordinates.forwardScalar (2 * h) |
| 526 | (x 1 / ChartScales.Q L.1 ^ CoordinateAlgebra.D h) (q / ChartScales.Q L.1) = |
| 527 | x 2 / ChartScales.Q L.1 := by |
| 528 | apply (eq_div_iff hQ.ne').mpr |
| 529 | nlinarith [hs] |
| 530 | have hroot : (ChartScales.Q L.1 ^ (1 / 2 : ℝ)) ^ 2 = ChartScales.Q L.1 := by |
| 531 | rw [← Real.rpow_mul_natCast hQ.le] |
| 532 | norm_num |
| 533 | have hratio : (x 0 / ChartScales.Q L.1 ^ (1 / 2 : ℝ)) ^ 2 / |
| 534 | (2 * (q / ChartScales.Q L.1)) = x 0 ^ 2 / (2 * q) := by |
| 535 | rw [div_pow, hroot] |
| 536 | field_simp |
| 537 | rw [normalizedSlow_coordinates] |
| 538 | refine ⟨div_nonneg hR (Real.rpow_pos_of_pos hQ _).le, div_nonneg hT hQ.le, |
| 539 | q / ChartScales.Q L.1, hqn, hnormeq, ?_⟩ |
| 540 | simpa only [hratio] using hX |
| 541 | |
| 542 | theorem physicalMask_has_representative {h a b : ℝ} (L : Label) (hL : 1 ≤ L.1) |
| 543 | {q : ℝ} {x : Position} (hq : 0 < q) (hR : 0 ≤ x 0) (hT : 0 ≤ x 2) |
| 544 | (he : SimilarityCoordinates.forwardScalar (2 * h) (x 1) q = x 2) |
| 545 | (hX : x 0 ^ 2 / (2 * q) ∈ Icc a b) |
| 546 | (hm : PartitionedCovariance.mask (CoordinateAlgebra.D h) L q x ≠ 0) : |
| 547 | ∃ A : ActiveLabel (referenceCompact h a b), A.val = L := |
| 548 | physicalMask_active (referenceCompact h a b) (CoordinateAlgebra.D h) L hL |
| 549 | (physicalMask_normalized_mem L hq hR hT he hX hm) hm |
| 550 | |
| 551 | /-! ## One target-direction parameter, with uniform mixed-point slack -/ |
| 552 | |
| 553 | noncomputable def targetRatio (F : ℝ) (g T : Plane) : ℝ := |
| 554 | |c0 F g * ⟪T, transverseDirection g⟫_ℝ / ⟪T, normalDirection g⟫_ℝ| |
| 555 | |
| 556 | /-- `T` is a continuous target direction, including at zero-amplitude edges. -/ |
| 557 | structure TargetCone (F : ℝ) (g T : Plane) : Prop where |
| 558 | inward : ⟪T, normalDirection g⟫_ℝ < 0 |
| 559 | ratio_lt_one : targetRatio F g T < 1 |
| 560 | |
| 561 | noncomputable def slopeRatio (u : ℝ) : ℝ := u / Real.sqrt (1 + u ^ 2) |
| 562 | |
| 563 | theorem exists_slopeRatio_gt {r : ℝ} (hr : 0 ≤ r) (hr1 : r < 1) : |
| 564 | ∃ u : ℝ, 0 < u ∧ r < slopeRatio u := by |
| 565 | have hsq : 0 < 1 - r ^ 2 := by nlinarith |
| 566 | let u := (Real.sqrt (1 - r ^ 2))⁻¹ |
| 567 | have hu : 0 < u := inv_pos.mpr (Real.sqrt_pos.mpr hsq) |
| 568 | have hp : u ^ 2 * (1 - r ^ 2) = 1 := by |
| 569 | dsimp [u] |
| 570 | rw [inv_pow, Real.sq_sqrt hsq.le, inv_mul_cancel₀ hsq.ne'] |
| 571 | have hroot : 0 < Real.sqrt (1 + u ^ 2) := Real.sqrt_pos.mpr (by positivity) |
| 572 | have hsquare : (r * Real.sqrt (1 + u ^ 2)) ^ 2 < u ^ 2 := by |
| 573 | rw [mul_pow, Real.sq_sqrt (show 0 ≤ 1 + u ^ 2 by positivity)] |
| 574 | nlinarith |
| 575 | refine ⟨u, hu, (lt_div_iff₀ hroot).mpr ?_⟩ |
| 576 | by_contra! hn |
| 577 | have hbad := pow_le_pow_left₀ hu.le hn 2 |
| 578 | linarith |
| 579 | |
| 580 | theorem slopeRatio_lt_one (u : ℝ) : slopeRatio u < 1 := by |
| 581 | have hp : 0 < Real.sqrt (1 + u ^ 2) := Real.sqrt_pos.mpr (by positivity) |
| 582 | apply (div_lt_one hp).mpr |
| 583 | have hs := Real.sq_sqrt (show 0 ≤ 1 + u ^ 2 by positivity) |
| 584 | nlinarith [Real.sqrt_nonneg (1 + u ^ 2)] |
| 585 | |
| 586 | theorem targetRatio_continuousOn {K : Set Slow} {F : Slow → ℝ} {g T : Slow → Plane} |
| 587 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 588 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 589 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 590 | ContinuousOn (fun q => targetRatio (F q) (g q) (T q)) K := by |
| 591 | have hn := normalDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero) |
| 592 | have hk := transverseDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero) |
| 593 | exact (((c0_continuousOn hF hg hc).mul (hT.inner hk)).div (hT.inner hn) |
| 594 | (fun q hq => (ht q hq).inward.ne)).abs |
| 595 | |
| 596 | theorem compact_target_choice {K : Set Slow} (hK : IsCompact K) |
| 597 | {F : Slow → ℝ} {g T : Slow → Plane} |
| 598 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 599 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 600 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 601 | ∃ u η : ℝ, 0 < u ∧ 0 < η ∧ ∀ q ∈ K, |
| 602 | ⟪T q, normalDirection (g q)⟫_ℝ ≤ -η ∧ |
| 603 | targetRatio (F q) (g q) (T q) + η ≤ slopeRatio u := by |
| 604 | have hn := normalDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero) |
| 605 | obtain ⟨d, hd, hdb⟩ := UniformCone.positive_uniform_margin hK (hT.inner hn).fun_neg |
| 606 | (fun q hq => neg_pos.mpr (ht q hq).inward) |
| 607 | obtain ⟨e, he, heb⟩ := UniformCone.positive_uniform_margin hK |
| 608 | (continuousOn_const.fun_sub (targetRatio_continuousOn hF hg hT hc ht)) |
| 609 | (fun q hq => sub_pos.mpr (ht q hq).ratio_lt_one) |
| 610 | let r := 1 - min e (1 / 2) |
| 611 | have hr : 0 ≤ r := by dsimp [r]; linarith [min_le_right e (1 / 2 : ℝ)] |
| 612 | have hr1 : r < 1 := by dsimp [r]; linarith [lt_min he (by norm_num : (0 : ℝ) < 1 / 2)] |
| 613 | obtain ⟨u, hu, hur⟩ := exists_slopeRatio_gt hr hr1 |
| 614 | let η := min d ((slopeRatio u - r) / 2) |
| 615 | have hη : 0 < η := lt_min hd (half_pos (sub_pos.mpr hur)) |
| 616 | refine ⟨u, η, hu, hη, fun q hq => ?_⟩ |
| 617 | have hηd : η ≤ d := min_le_left _ _ |
| 618 | have hηr : η ≤ (slopeRatio u - r) / 2 := min_le_right _ _ |
| 619 | have hratio : targetRatio (F q) (g q) (T q) ≤ r := by |
| 620 | dsimp [r] |
| 621 | linarith [heb q hq, min_le_left e (1 / 2 : ℝ)] |
| 622 | refine ⟨by linarith [hdb q hq], ?_⟩ |
| 623 | calc |
| 624 | targetRatio (F q) (g q) (T q) + η ≤ r + (slopeRatio u - r) / 2 := |
| 625 | add_le_add hratio hηr |
| 626 | _ ≤ r + (slopeRatio u - r) := |
| 627 | add_le_add_right (half_le_self (sub_pos.mpr hur).le) r |
| 628 | _ = slopeRatio u := by ring |
| 629 | |
| 630 | /-- A continuous positive diagonal on a compact set stays positive at |
| 631 | nearby pairs, with one distance independent of the base point. -/ |
| 632 | theorem compact_diagonal_positive {K : Set Slow} (hK : IsCompact K) |
| 633 | {f : Slow × Slow → ℝ} (hf : ContinuousOn f (K ×ˢ K)) |
| 634 | (hpos : ∀ q ∈ K, 0 < f (q, q)) : |
| 635 | ∃ δ : ℝ, 0 < δ ∧ ∀ q₀ ∈ K, ∀ q ∈ K, dist q q₀ < δ → 0 < f (q₀, q) := by |
| 636 | have hd : ContinuousOn (fun q => f (q, q)) K := |
| 637 | hf.comp (continuous_id.prodMk continuous_id).continuousOn (fun _ hq => ⟨hq, hq⟩) |
| 638 | obtain ⟨m, hm, hmb⟩ := UniformCone.positive_uniform_margin hK hd hpos |
| 639 | obtain ⟨δ, hδ, hb⟩ := Metric.uniformContinuousOn_iff.mp |
| 640 | ((hK.prod hK).uniformContinuousOn_of_continuous hf) |
| 641 | (m / 2) (half_pos hm) |
| 642 | refine ⟨δ, hδ, fun q₀ h₀ q hq hdist => ?_⟩ |
| 643 | have hp : dist (q₀, q) (q₀, q₀) < δ := by |
| 644 | rw [Prod.dist_eq, dist_self, max_eq_right dist_nonneg] |
| 645 | exact hdist |
| 646 | have hh := hb (q₀, q) ⟨h₀, hq⟩ (q₀, q₀) ⟨h₀, h₀⟩ hp |
| 647 | rw [Real.dist_eq] at hh |
| 648 | have hlo := (abs_lt.mp hh).1 |
| 649 | linarith [hmb q₀ h₀] |
| 650 | |
| 651 | theorem compact_mixed_target {K : Set Slow} (hK : IsCompact K) |
| 652 | {F : Slow → ℝ} {g T : Slow → Plane} |
| 653 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 654 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 655 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 656 | ∃ u δ : ℝ, 0 < u ∧ 0 < δ ∧ ∀ q₀ ∈ K, ∀ q ∈ K, dist q q₀ < δ → |
| 657 | ⟪T q, normalDirection (g q₀)⟫_ℝ < 0 ∧ |
| 658 | |c0 (F q₀) (g q₀) * ⟪T q, transverseDirection (g q₀)⟫_ℝ / |
| 659 | ⟪T q, normalDirection (g q₀)⟫_ℝ| < slopeRatio u := by |
| 660 | obtain ⟨u, η, hu, hη, hb⟩ := compact_target_choice hK hF hg hT hc ht |
| 661 | have hn : ContinuousOn (fun z : Slow × Slow => normalDirection (g z.1)) (K ×ˢ K) := |
| 662 | (normalDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero)).comp |
| 663 | continuous_fst.continuousOn (fun _ hq => hq.1) |
| 664 | have hk : ContinuousOn (fun z : Slow × Slow => transverseDirection (g z.1)) (K ×ˢ K) := |
| 665 | (transverseDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero)).comp |
| 666 | continuous_fst.continuousOn (fun _ hq => hq.1) |
| 667 | have hc0 : ContinuousOn (fun z : Slow × Slow => c0 (F z.1) (g z.1)) (K ×ˢ K) := |
| 668 | (c0_continuousOn hF hg hc).comp continuous_fst.continuousOn (fun _ hq => hq.1) |
| 669 | have ht' : ContinuousOn (fun z : Slow × Slow => T z.2) (K ×ˢ K) := |
| 670 | hT.comp continuous_snd.continuousOn (fun _ hq => hq.2) |
| 671 | let a : Slow × Slow → ℝ := fun z => -⟪T z.2, normalDirection (g z.1)⟫_ℝ |
| 672 | let b : Slow × Slow → ℝ := fun z => slopeRatio u * a z - |
| 673 | |c0 (F z.1) (g z.1) * ⟪T z.2, transverseDirection (g z.1)⟫_ℝ| |
| 674 | have ha : ContinuousOn a (K ×ˢ K) := (ht'.inner hn).neg |
| 675 | have hb' : ContinuousOn b (K ×ˢ K) := |
| 676 | (continuousOn_const.mul ha).sub (hc0.mul (ht'.inner hk)).abs |
| 677 | obtain ⟨δa, hδa, hpa⟩ := compact_diagonal_positive hK ha |
| 678 | (fun q hq => neg_pos.mpr (ht q hq).inward) |
| 679 | have hbp : ∀ q ∈ K, 0 < b (q, q) := by |
| 680 | intro q hq |
| 681 | have hratio : targetRatio (F q) (g q) (T q) < slopeRatio u := by linarith [(hb q hq).2] |
| 682 | rw [targetRatio, abs_div, abs_of_neg (ht q hq).inward] at hratio |
| 683 | exact sub_pos.mpr ((div_lt_iff₀ (neg_pos.mpr (ht q hq).inward)).mp hratio) |
| 684 | obtain ⟨δb, hδb, hpb⟩ := compact_diagonal_positive hK hb' hbp |
| 685 | refine ⟨u, min δa δb, hu, lt_min hδa hδb, fun q₀ h₀ q hq hdist => ?_⟩ |
| 686 | have hneg : ⟪T q, normalDirection (g q₀)⟫_ℝ < 0 := |
| 687 | neg_pos.mp (hpa q₀ h₀ q hq (hdist.trans_le (min_le_left _ _))) |
| 688 | refine ⟨hneg, ?_⟩ |
| 689 | rw [abs_div, abs_of_neg hneg] |
| 690 | apply (div_lt_iff₀ (neg_pos.mpr hneg)).mpr |
| 691 | exact sub_pos.mp (hpb q₀ h₀ q hq (hdist.trans_le (min_le_right _ _))) |
| 692 | |
| 693 | /-- A single `u` works for the actual selected representatives and every |
| 694 | active target point in the enlarged boxes of all sufficiently fine labels. -/ |
| 695 | theorem representative_target_choice {K : Set Slow} (hK : IsCompact K) |
| 696 | {F : Slow → ℝ} {g T : Slow → Plane} |
| 697 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 698 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 699 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 700 | ∃ u : ℝ, 0 < u ∧ ∃ N : ℕ, ∀ L : ActiveLabel K, N ≤ L.val.1 → |
| 701 | ∀ q ∈ K, q ∈ gridBox L.val.1 L.val.2 2 → |
| 702 | ⟪T q, normalDirection (g (representative K L))⟫_ℝ < 0 ∧ |
| 703 | |c0 (F (representative K L)) (g (representative K L)) * |
| 704 | ⟪T q, transverseDirection (g (representative K L))⟫_ℝ / |
| 705 | ⟪T q, normalDirection (g (representative K L))⟫_ℝ| < slopeRatio u := by |
| 706 | obtain ⟨u, δ, hu, hδ, hb⟩ := compact_mixed_target hK hF hg hT hc ht |
| 707 | obtain ⟨N, hN⟩ := eventually_atTop.mp ((tendsto_order.1 grid_mesh_tendsto_zero).2 δ hδ) |
| 708 | refine ⟨u, hu, N, fun L hL q hq hbox => hb _ (representative_mem K L) q hq ?_⟩ |
| 709 | simpa only [dist_eq_norm] using |
| 710 | (representative_enlarged_distance K L hbox).trans_lt (hN _ hL) |
| 711 | |
| 712 | /-- The mixed-point cone has a positive numerical margin independent of |
| 713 | both points. The single selected `u` is strictly above the supremum. -/ |
| 714 | theorem compact_mixed_target_margin {K : Set Slow} (hK : IsCompact K) |
| 715 | {F : Slow → ℝ} {g T : Slow → Plane} |
| 716 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 717 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 718 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 719 | ∃ u η δ : ℝ, 0 < u ∧ 0 < η ∧ 0 < δ ∧ ∀ q₀ ∈ K, ∀ q ∈ K, dist q q₀ < δ → |
| 720 | ⟪T q, normalDirection (g q₀)⟫_ℝ ≤ -η ∧ |
| 721 | |c0 (F q₀) (g q₀) * ⟪T q, transverseDirection (g q₀)⟫_ℝ / |
| 722 | ⟪T q, normalDirection (g q₀)⟫_ℝ| + η ≤ slopeRatio u := by |
| 723 | obtain ⟨u₀, δ₀, hu₀, hδ₀, hbase⟩ := compact_mixed_target hK hF hg hT hc ht |
| 724 | have hr₀ : 0 ≤ slopeRatio u₀ := div_nonneg hu₀.le (Real.sqrt_nonneg _) |
| 725 | obtain ⟨u, hu, hgap⟩ := exists_slopeRatio_gt hr₀ (slopeRatio_lt_one u₀) |
| 726 | have hn₀ := normalDirection_continuousOn hg (fun q hq => (hc q hq).shear_ne_zero) |
| 727 | obtain ⟨m, hm, hmb⟩ := UniformCone.positive_uniform_margin hK (hT.inner hn₀).fun_neg |
| 728 | (fun q hq => neg_pos.mpr (ht q hq).inward) |
| 729 | have hn : ContinuousOn (fun z : Slow × Slow => normalDirection (g z.1)) (K ×ˢ K) := |
| 730 | hn₀.comp continuous_fst.continuousOn (fun _ hq => hq.1) |
| 731 | have hT' : ContinuousOn (fun z : Slow × Slow => T z.2) (K ×ˢ K) := |
| 732 | hT.comp continuous_snd.continuousOn (fun _ hq => hq.2) |
| 733 | have hcont : ContinuousOn (fun z : Slow × Slow => |
| 734 | -⟪T z.2, normalDirection (g z.1)⟫_ℝ - m / 2) (K ×ˢ K) := |
| 735 | (hT'.inner hn).neg.sub continuousOn_const |
| 736 | obtain ⟨δ₁, hδ₁, hden⟩ := compact_diagonal_positive hK hcont |
| 737 | (fun q hq => by dsimp only; linarith [hmb q hq]) |
| 738 | let η := min (m / 2) ((slopeRatio u - slopeRatio u₀) / 2) |
| 739 | have hη : 0 < η := lt_min (half_pos hm) (half_pos (sub_pos.mpr hgap)) |
| 740 | refine ⟨u, η, min δ₀ δ₁, hu, hη, lt_min hδ₀ hδ₁, fun q₀ h₀ q hq hd => ?_⟩ |
| 741 | have hinner := hden q₀ h₀ q hq (hd.trans_le (min_le_right _ _)) |
| 742 | have hratio := (hbase q₀ h₀ q hq (hd.trans_le (min_le_left _ _))).2 |
| 743 | have hηm : η ≤ m / 2 := min_le_left _ _ |
| 744 | have hηgap : η ≤ (slopeRatio u - slopeRatio u₀) / 2 := min_le_right _ _ |
| 745 | refine ⟨by dsimp only at hinner; linarith, ?_⟩ |
| 746 | calc |
| 747 | _ ≤ slopeRatio u₀ + (slopeRatio u - slopeRatio u₀) / 2 := add_le_add hratio.le hηgap |
| 748 | _ ≤ slopeRatio u₀ + (slopeRatio u - slopeRatio u₀) := |
| 749 | add_le_add_right (half_le_self (sub_pos.mpr hgap).le) _ |
| 750 | _ = slopeRatio u := by ring |
| 751 | |
| 752 | theorem representative_target_margin {K : Set Slow} (hK : IsCompact K) |
| 753 | {F : Slow → ℝ} {g T : Slow → Plane} |
| 754 | (hF : ContinuousOn F K) (hg : ContinuousOn g K) (hT : ContinuousOn T K) |
| 755 | (hc : ∀ q ∈ K, ReferenceCone (F q) (g q)) |
| 756 | (ht : ∀ q ∈ K, TargetCone (F q) (g q) (T q)) : |
| 757 | ∃ u η : ℝ, 0 < u ∧ 0 < η ∧ ∃ N : ℕ, ∀ L : ActiveLabel K, N ≤ L.val.1 → |
| 758 | ∀ q ∈ K, q ∈ gridBox L.val.1 L.val.2 2 → |
| 759 | ⟪T q, normalDirection (g (representative K L))⟫_ℝ ≤ -η ∧ |
| 760 | |c0 (F (representative K L)) (g (representative K L)) * |
| 761 | ⟪T q, transverseDirection (g (representative K L))⟫_ℝ / |
| 762 | ⟪T q, normalDirection (g (representative K L))⟫_ℝ| + η ≤ slopeRatio u := by |
| 763 | obtain ⟨u, η, δ, hu, hη, hδ, hb⟩ := compact_mixed_target_margin hK hF hg hT hc ht |
| 764 | obtain ⟨N, hN⟩ := eventually_atTop.mp ((tendsto_order.1 grid_mesh_tendsto_zero).2 δ hδ) |
| 765 | refine ⟨u, η, hu, hη, N, fun L hL q hq hbox => hb _ (representative_mem K L) q hq ?_⟩ |
| 766 | simpa only [dist_eq_norm] using |
| 767 | (representative_enlarged_distance K L hbox).trans_lt (hN _ hL) |
| 768 | |
| 769 | theorem targetRatio_smul (F : ℝ) (g T : Plane) {a : ℝ} (ha : a ≠ 0) : |
| 770 | targetRatio F g (a • T) = targetRatio F g T := by |
| 771 | unfold targetRatio |
| 772 | rw [real_inner_smul_left, real_inner_smul_left] |
| 773 | congr 1 |
| 774 | rw [show c0 F g * (a * ⟪T, transverseDirection g⟫_ℝ) = |
| 775 | a * (c0 F g * ⟪T, transverseDirection g⟫_ℝ) by ring] |
| 776 | exact mul_div_mul_left _ _ ha |
| 777 | |
| 778 | theorem TargetCone.pos_smul {F : ℝ} {g T : Plane} (h : TargetCone F g T) |
| 779 | {a : ℝ} (ha : 0 < a) : TargetCone F g (a • T) := by |
| 780 | refine ⟨?_, ?_⟩ |
| 781 | · rw [real_inner_smul_left] |
| 782 | exact mul_neg_of_pos_of_neg ha h.inward |
| 783 | · rw [targetRatio_smul F g T ha.ne'] |
| 784 | exact h.ratio_lt_one |
| 785 | |
| 786 | end NavierStokes.PrimaryRepresentatives |