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.SlotGeometry |
| 2 | import Mathlib.Analysis.SpecialFunctions.Pow.Real |
| 3 | import Mathlib.Data.Fintype.Pi |
| 4 | import Mathlib.Data.Fintype.Card |
| 5 | import Mathlib.Data.Fintype.BigOperators |
| 6 | import Mathlib.LinearAlgebra.Matrix.Notation |
| 7 | import Mathlib.Algebra.Order.Floor.Ring |
| 8 | import Mathlib.Algebra.Order.Floor.Semiring |
| 9 | import Mathlib.Order.Interval.Finset.Nat |
| 10 | import Mathlib.Analysis.Real.Sqrt |
| 11 | |
| 12 | /-! |
| 13 | # Physical grid labels, bounded degree, and an explicit finite coloring |
| 14 | |
| 15 | Labels consist of a dyadic level, three integer grid coordinates, and a sign. |
| 16 | The physical mesh at exponent `a` is `2^(-n*a)/n^6`, namely the mesh |
| 17 | `S_n^-3` with `S_n=n²`, rescaled by `Q_n^a` with `Q_n=2^-n`. |
| 18 | Closed boxes of two mesh widths include the fixed small enlargement of the |
| 19 | one-mesh supports in the manuscript. |
| 20 | -/ |
| 21 | |
| 22 | noncomputable section |
| 23 | |
| 24 | namespace NavierStokes.SlotColoring |
| 25 | |
| 26 | open Set |
| 27 | open scoped BigOperators |
| 28 | |
| 29 | abbrev Grid := Fin 3 → ℤ |
| 30 | abbrev Position := Fin 3 → ℝ |
| 31 | abbrev Label := ℕ × (Grid × Bool) |
| 32 | |
| 33 | def dyadicQ (n : ℕ) : ℝ := (2 : ℝ) ^ (-(n : ℝ)) |
| 34 | |
| 35 | def spacing (a : ℝ) (n : ℕ) : ℝ := (2 : ℝ) ^ (-(n : ℝ) * a) / (n : ℝ) ^ 6 |
| 36 | |
| 37 | theorem spacing_eq_scaled_mesh (a : ℝ) (n : ℕ) : |
| 38 | spacing a n = dyadicQ n ^ a * (1 / (((n : ℝ) ^ 2) ^ 3)) := by |
| 39 | unfold spacing dyadicQ |
| 40 | rw [← Real.rpow_mul (by norm_num : (0 : ℝ) ≤ 2)] |
| 41 | simp only [← pow_mul] |
| 42 | norm_num |
| 43 | ring |
| 44 | |
| 45 | theorem spacing_pos (a : ℝ) {n : ℕ} (hn : 1 ≤ n) : 0 < spacing a n := by |
| 46 | have hn' : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) |
| 47 | exact div_pos (Real.rpow_pos_of_pos (by norm_num) _) (pow_pos hn' _) |
| 48 | |
| 49 | theorem spacing_ratio (a : ℝ) {n m : ℕ} (hn : 1 ≤ n) (hm : 1 ≤ m) : |
| 50 | spacing a n / spacing a m = |
| 51 | ((m : ℝ) / (n : ℝ)) ^ 6 * (2 : ℝ) ^ (((m : ℝ) - (n : ℝ)) * a) := by |
| 52 | have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (by omega : n ≠ 0) |
| 53 | have hm' : (m : ℝ) ≠ 0 := by exact_mod_cast (by omega : m ≠ 0) |
| 54 | have he : (2 : ℝ) ^ (-(m : ℝ) * a) ≠ 0 := ne_of_gt (Real.rpow_pos_of_pos (by norm_num) _) |
| 55 | have hp : (2 : ℝ) ^ (((m : ℝ) - (n : ℝ)) * a) = |
| 56 | (2 : ℝ) ^ (-(n : ℝ) * a) / (2 : ℝ) ^ (-(m : ℝ) * a) := by |
| 57 | rw [← Real.rpow_sub (by norm_num : (0 : ℝ) < 2)] |
| 58 | congr 1 |
| 59 | ring |
| 60 | rw [hp] |
| 61 | unfold spacing |
| 62 | rw [div_pow] |
| 63 | field_simp |
| 64 | |
| 65 | /-- The mesh ratio is uniform across levels at distance at most four. -/ |
| 66 | theorem spacing_ratio_le (a A : ℝ) {n m : ℕ} |
| 67 | (hn : 1 ≤ n) (hm : 1 ≤ m) (hnm : n ≤ m + 4) (hmn : m ≤ n + 4) |
| 68 | (ha : |a| ≤ A) : |
| 69 | spacing a n / spacing a m ≤ (5 : ℝ) ^ 6 * (2 : ℝ) ^ (4 * A) := by |
| 70 | rw [spacing_ratio a hn hm] |
| 71 | have hn' : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) |
| 72 | have hm0 : (0 : ℝ) ≤ m := by positivity |
| 73 | have hm5 : (m : ℝ) ≤ 5 * (n : ℝ) := by exact_mod_cast (by omega : m ≤ 5 * n) |
| 74 | have hquot : (m : ℝ) / (n : ℝ) ≤ 5 := (div_le_iff₀ hn').mpr hm5 |
| 75 | have hpow : ((m : ℝ) / (n : ℝ)) ^ 6 ≤ (5 : ℝ) ^ 6 := |
| 76 | pow_le_pow_left₀ (div_nonneg hm0 hn'.le) hquot 6 |
| 77 | have hdiff : |(m : ℝ) - (n : ℝ)| ≤ 4 := by |
| 78 | have h1 : (n : ℝ) ≤ (m : ℝ) + 4 := by exact_mod_cast hnm |
| 79 | have h2 : (m : ℝ) ≤ (n : ℝ) + 4 := by exact_mod_cast hmn |
| 80 | rw [abs_le] |
| 81 | constructor <;> linarith |
| 82 | have hexp : ((m : ℝ) - (n : ℝ)) * a ≤ 4 * A := by |
| 83 | calc |
| 84 | ((m : ℝ) - (n : ℝ)) * a ≤ |((m : ℝ) - (n : ℝ)) * a| := le_abs_self _ |
| 85 | _ = |(m : ℝ) - (n : ℝ)| * |a| := abs_mul _ _ |
| 86 | _ ≤ 4 * |a| := mul_le_mul_of_nonneg_right hdiff (abs_nonneg a) |
| 87 | _ ≤ 4 * A := mul_le_mul_of_nonneg_left ha (by norm_num) |
| 88 | exact mul_le_mul hpow (Real.rpow_le_rpow_of_exponent_le (by norm_num) hexp) |
| 89 | (Real.rpow_nonneg (by norm_num) _) (by positivity) |
| 90 | |
| 91 | def axisExponent (D : ℝ) : Fin 3 → ℝ := ![1 / 2, D, 1] |
| 92 | def width (D : ℝ) (j : Fin 3) (n : ℕ) : ℝ := spacing (axisExponent D j) n |
| 93 | def ratioBound (D : ℝ) : ℝ := (5 : ℝ) ^ 6 * (2 : ℝ) ^ (4 * (1 + |D|)) |
| 94 | |
| 95 | theorem width_pos (D : ℝ) (j : Fin 3) {n : ℕ} (hn : 1 ≤ n) : 0 < width D j n := |
| 96 | spacing_pos _ hn |
| 97 | |
| 98 | theorem width_ratio_le (D : ℝ) (j : Fin 3) {n m : ℕ} |
| 99 | (hn : 1 ≤ n) (hm : 1 ≤ m) (hnm : n ≤ m + 4) (hmn : m ≤ n + 4) : |
| 100 | width D j n / width D j m ≤ ratioBound D := by |
| 101 | apply spacing_ratio_le _ _ hn hm hnm hmn |
| 102 | fin_cases j |
| 103 | · change |(1 / 2 : ℝ)| ≤ 1 + |D| |
| 104 | rw [abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 1 / 2)] |
| 105 | linarith [abs_nonneg D] |
| 106 | · change |D| ≤ 1 + |D| |
| 107 | linarith |
| 108 | · change |(1 : ℝ)| ≤ 1 + |D| |
| 109 | rw [abs_one] |
| 110 | linarith [abs_nonneg D] |
| 111 | |
| 112 | def physicalBox (D : ℝ) (L : Label) : Set Position := |
| 113 | {x | ∀ j, |x j - width D j L.1 * (L.2.1 j : ℝ)| ≤ 2 * width D j L.1} |
| 114 | |
| 115 | /-- The exact enlarged-box interaction relation used for coloring. -/ |
| 116 | structure Adj (D : ℝ) (L M : Label) : Prop where |
| 117 | left_positive : 1 ≤ L.1 |
| 118 | right_positive : 1 ≤ M.1 |
| 119 | distinct : L ≠ M |
| 120 | left_level_le : L.1 ≤ M.1 + 4 |
| 121 | right_level_le : M.1 ≤ L.1 + 4 |
| 122 | overlap : (physicalBox D L ∩ physicalBox D M).Nonempty |
| 123 | |
| 124 | theorem overlapping_centers (D : ℝ) (L M : Label) |
| 125 | (hov : (physicalBox D L ∩ physicalBox D M).Nonempty) (j : Fin 3) : |
| 126 | |width D j L.1 * (L.2.1 j : ℝ) - width D j M.1 * (M.2.1 j : ℝ)| ≤ |
| 127 | 2 * (width D j L.1 + width D j M.1) := by |
| 128 | obtain ⟨x, hx, hy⟩ := hov |
| 129 | have htriangle := abs_sub_le (width D j L.1 * (L.2.1 j : ℝ)) (x j) |
| 130 | (width D j M.1 * (M.2.1 j : ℝ)) |
| 131 | rw [abs_sub_comm (width D j L.1 * (L.2.1 j : ℝ)) (x j)] at htriangle |
| 132 | linarith [hx j, hy j] |
| 133 | |
| 134 | theorem same_level_grid_gap (D : ℝ) (L M : Label) (hn : 1 ≤ L.1) |
| 135 | (hl : L.1 = M.1) (hov : (physicalBox D L ∩ physicalBox D M).Nonempty) (j : Fin 3) : |
| 136 | |L.2.1 j - M.2.1 j| ≤ (4 : ℤ) := by |
| 137 | have h := overlapping_centers D L M hov j |
| 138 | rw [← hl, ← mul_sub, abs_mul, abs_of_pos (width_pos D j hn)] at h |
| 139 | have hr : |(L.2.1 j : ℝ) - (M.2.1 j : ℝ)| ≤ 4 := by |
| 140 | nlinarith [width_pos D j hn] |
| 141 | exact_mod_cast hr |
| 142 | |
| 143 | def intColor (z : ℤ) : Fin 5 := |
| 144 | ⟨(z % 5).toNat, by |
| 145 | have h0 := Int.emod_nonneg z (by norm_num : (5 : ℤ) ≠ 0) |
| 146 | have h1 := Int.emod_lt_of_pos z (by norm_num : (0 : ℤ) < 5) |
| 147 | omega⟩ |
| 148 | |
| 149 | theorem intColor_eq_of_close {z w : ℤ} (hc : intColor z = intColor w) |
| 150 | (hd : |z - w| ≤ 4) : z = w := by |
| 151 | have hv := congrArg Fin.val hc |
| 152 | dsimp [intColor] at hv |
| 153 | have hz0 := Int.emod_nonneg z (by norm_num : (5 : ℤ) ≠ 0) |
| 154 | have hw0 := Int.emod_nonneg w (by norm_num : (5 : ℤ) ≠ 0) |
| 155 | have hdiff := abs_le.mp hd |
| 156 | omega |
| 157 | |
| 158 | abbrev Palette := Fin 9 × ((Fin 3 → Fin 5) × Bool) |
| 159 | |
| 160 | def colorData (L : Label) : Palette := |
| 161 | (⟨L.1 % 9, Nat.mod_lt _ (by norm_num)⟩, (fun j => intColor (L.2.1 j), L.2.2)) |
| 162 | |
| 163 | theorem palette_card : Fintype.card Palette = 2250 := by |
| 164 | norm_num [Palette, Fintype.card_prod, Fintype.card_fun] |
| 165 | |
| 166 | /-- This is a constructed coloring, not a coloring hypothesis. -/ |
| 167 | theorem colorData_proper (D : ℝ) {L M : Label} (h : Adj D L M) : colorData L ≠ colorData M := by |
| 168 | intro hc |
| 169 | have hlevel := congrArg (fun c : Palette => c.1.val) hc |
| 170 | change L.1 % 9 = M.1 % 9 at hlevel |
| 171 | have hl : L.1 = M.1 := by |
| 172 | have h1 := h.left_level_le |
| 173 | have h2 := h.right_level_le |
| 174 | omega |
| 175 | have hg : L.2.1 = M.2.1 := by |
| 176 | funext j |
| 177 | apply intColor_eq_of_close |
| 178 | · exact congrArg (fun c : Palette => c.2.1 j) hc |
| 179 | · exact same_level_grid_gap D L M h.left_positive hl h.overlap j |
| 180 | have hs : L.2.2 = M.2.2 := congrArg (fun c : Palette => c.2.2) hc |
| 181 | exact h.distinct (Prod.ext hl (Prod.ext hg hs)) |
| 182 | |
| 183 | def color (L : Label) : Fin (Fintype.card Palette) := (Fintype.equivFin Palette) (colorData L) |
| 184 | |
| 185 | theorem color_proper (D : ℝ) {L M : Label} (h : Adj D L M) : color L ≠ color M := by |
| 186 | intro hc |
| 187 | exact colorData_proper D h ((Fintype.equivFin Palette).injective hc) |
| 188 | |
| 189 | /-- A reusable one-dimensional bound: overlapping intervals force the finer |
| 190 | grid index to lie within a fixed distance of the rescaled reference index. -/ |
| 191 | theorem normalized_index_gap (h h' B : ℝ) (i j : ℤ) (hh' : 0 < h') |
| 192 | (hratio : h / h' ≤ B) |
| 193 | (hgap : |h * (i : ℝ) - h' * (j : ℝ)| ≤ 2 * (h + h')) : |
| 194 | |h / h' * (i : ℝ) - (j : ℝ)| ≤ 2 * (B + 1) := by |
| 195 | calc |
| 196 | |h / h' * (i : ℝ) - (j : ℝ)| = |(h * (i : ℝ) - h' * (j : ℝ)) / h'| := by |
| 197 | congr 1 |
| 198 | field_simp |
| 199 | _ = |h * (i : ℝ) - h' * (j : ℝ)| / h' := by rw [abs_div, abs_of_pos hh'] |
| 200 | _ ≤ (2 * (h + h')) / h' := div_le_div_of_nonneg_right hgap hh'.le |
| 201 | _ = 2 * (h / h' + 1) := by field_simp |
| 202 | _ ≤ 2 * (B + 1) := by linarith |
| 203 | |
| 204 | theorem index_near_floor (c A : ℝ) (j : ℤ) (K : ℕ) |
| 205 | (hgap : |c - (j : ℝ)| ≤ A) (hK : A + 1 ≤ (K : ℝ)) : |
| 206 | |j - ⌊c⌋| ≤ (K : ℤ) := by |
| 207 | have hfloor : |c - (⌊c⌋ : ℝ)| ≤ 1 := by |
| 208 | rw [abs_of_nonneg (sub_nonneg.mpr (Int.floor_le c))] |
| 209 | linarith [Int.lt_floor_add_one c] |
| 210 | have ht := abs_sub_le (j : ℝ) c (⌊c⌋ : ℝ) |
| 211 | rw [abs_sub_comm (j : ℝ) c] at ht |
| 212 | have hreal : |(j : ℝ) - (⌊c⌋ : ℝ)| ≤ (K : ℝ) := by linarith |
| 213 | exact_mod_cast hreal |
| 214 | |
| 215 | def indexRadius (D : ℝ) : ℕ := ⌈2 * (ratioBound D + 1) + 1⌉₊ |
| 216 | |
| 217 | def indexCenter (D : ℝ) (L : Label) (m : ℕ) (j : Fin 3) : ℤ := |
| 218 | ⌊width D j L.1 / width D j m * (L.2.1 j : ℝ)⌋ |
| 219 | |
| 220 | def candidateGrids (D : ℝ) (L : Label) (m : ℕ) : Finset Grid := |
| 221 | Fintype.piFinset (fun j => Finset.Icc (indexCenter D L m j - (indexRadius D : ℤ)) |
| 222 | (indexCenter D L m j + (indexRadius D : ℤ))) |
| 223 | |
| 224 | def candidatesAtLevel (D : ℝ) (L : Label) (m : ℕ) : Finset Label := |
| 225 | ((candidateGrids D L m).product (Finset.univ : Finset Bool)).image (fun gs => (m, gs)) |
| 226 | |
| 227 | def candidates (D : ℝ) (L : Label) : Finset Label := |
| 228 | (Finset.Icc (L.1 - 4) (L.1 + 4)).biUnion (candidatesAtLevel D L) |
| 229 | |
| 230 | theorem adj_index_bound (D : ℝ) {L M : Label} (h : Adj D L M) (j : Fin 3) : |
| 231 | |M.2.1 j - indexCenter D L M.1 j| ≤ (indexRadius D : ℤ) := by |
| 232 | apply index_near_floor |
| 233 | · exact normalized_index_gap _ _ _ _ _ (width_pos D j h.right_positive) |
| 234 | (width_ratio_le D j h.left_positive h.right_positive h.left_level_le h.right_level_le) |
| 235 | (overlapping_centers D L M h.overlap j) |
| 236 | · exact Nat.le_ceil _ |
| 237 | |
| 238 | theorem adj_mem_candidates (D : ℝ) {L M : Label} (h : Adj D L M) : M ∈ candidates D L := by |
| 239 | apply Finset.mem_biUnion.mpr |
| 240 | refine ⟨M.1, ?_, ?_⟩ |
| 241 | · simp only [Finset.mem_Icc] |
| 242 | have h1 := h.left_level_le |
| 243 | have h2 := h.right_level_le |
| 244 | omega |
| 245 | · apply Finset.mem_image.mpr |
| 246 | refine ⟨M.2, ?_, rfl⟩ |
| 247 | apply Finset.mem_product.mpr |
| 248 | refine ⟨?_, Finset.mem_univ _⟩ |
| 249 | apply Fintype.mem_piFinset.mpr |
| 250 | intro j |
| 251 | have hj := abs_le.mp (adj_index_bound D h j) |
| 252 | simp only [Finset.mem_Icc] |
| 253 | omega |
| 254 | |
| 255 | theorem integer_interval_card (c : ℤ) (K : ℕ) : |
| 256 | (Finset.Icc (c - (K : ℤ)) (c + (K : ℤ))).card = 2 * K + 1 := by |
| 257 | rw [Int.card_Icc] |
| 258 | omega |
| 259 | |
| 260 | theorem candidateGrids_card (D : ℝ) (L : Label) (m : ℕ) : |
| 261 | (candidateGrids D L m).card = (2 * indexRadius D + 1) ^ 3 := by |
| 262 | unfold candidateGrids |
| 263 | rw [Fintype.card_piFinset] |
| 264 | simp only [integer_interval_card, Finset.prod_const, Finset.card_univ, Fintype.card_fin] |
| 265 | |
| 266 | theorem candidatesAtLevel_card_le (D : ℝ) (L : Label) (m : ℕ) : |
| 267 | (candidatesAtLevel D L m).card ≤ (2 * indexRadius D + 1) ^ 3 * 2 := by |
| 268 | calc |
| 269 | (candidatesAtLevel D L m).card ≤ |
| 270 | ((candidateGrids D L m).product (Finset.univ : Finset Bool)).card := Finset.card_image_le |
| 271 | _ = (2 * indexRadius D + 1) ^ 3 * 2 := by |
| 272 | change ((candidateGrids D L m) ×ˢ (Finset.univ : Finset Bool)).card = _ |
| 273 | simpa only [candidateGrids_card, Finset.card_univ, Fintype.card_bool] using |
| 274 | Finset.card_product (candidateGrids D L m) (Finset.univ : Finset Bool) |
| 275 | |
| 276 | def degreeBound (D : ℝ) : ℕ := 18 * (2 * indexRadius D + 1) ^ 3 |
| 277 | |
| 278 | theorem candidates_card_le (D : ℝ) (L : Label) : |
| 279 | (candidates D L).card ≤ degreeBound D := by |
| 280 | have hlevels : (Finset.Icc (L.1 - 4) (L.1 + 4)).card ≤ 9 := by |
| 281 | rw [Nat.card_Icc] |
| 282 | omega |
| 283 | calc |
| 284 | (candidates D L).card ≤ |
| 285 | ∑ m ∈ Finset.Icc (L.1 - 4) (L.1 + 4), (candidatesAtLevel D L m).card := |
| 286 | Finset.card_biUnion_le |
| 287 | _ ≤ ∑ _m ∈ Finset.Icc (L.1 - 4) (L.1 + 4), (2 * indexRadius D + 1) ^ 3 * 2 := |
| 288 | Finset.sum_le_sum (fun m _ => candidatesAtLevel_card_le D L m) |
| 289 | _ = (Finset.Icc (L.1 - 4) (L.1 + 4)).card * ((2 * indexRadius D + 1) ^ 3 * 2) := by simp |
| 290 | _ ≤ 9 * ((2 * indexRadius D + 1) ^ 3 * 2) := Nat.mul_le_mul_right _ hlevels |
| 291 | _ = degreeBound D := by unfold degreeBound; ring |
| 292 | |
| 293 | /-- The actual finite neighbor set, obtained by filtering an explicit finite box. -/ |
| 294 | def neighbors (D : ℝ) (L : Label) : Finset Label := by |
| 295 | classical |
| 296 | exact (candidates D L).filter (Adj D L) |
| 297 | |
| 298 | theorem mem_neighbors_iff (D : ℝ) (L M : Label) : M ∈ neighbors D L ↔ Adj D L M := by |
| 299 | classical |
| 300 | simp only [neighbors, Finset.mem_filter] |
| 301 | exact ⟨And.right, fun h => ⟨adj_mem_candidates D h, h⟩⟩ |
| 302 | |
| 303 | /-- Uniform degree control for every dyadic level, grid point, and sign. -/ |
| 304 | theorem neighbors_card_le (D : ℝ) (L : Label) : (neighbors D L).card ≤ degreeBound D := by |
| 305 | classical |
| 306 | exact (Finset.card_filter_le _ _).trans (candidates_card_le D L) |
| 307 | |
| 308 | theorem label_type_countable : Countable Label := by infer_instance |
| 309 | |
| 310 | /-- The expanding eigenvalue of the actual covering matrix. -/ |
| 311 | def coverGrowth : ℝ := 4 + Real.sqrt 2 |
| 312 | |
| 313 | theorem log_coverGrowth_pos : 0 < Real.log coverGrowth := by |
| 314 | apply Real.log_pos |
| 315 | unfold coverGrowth |
| 316 | linarith [Real.sqrt_nonneg (2 : ℝ)] |
| 317 | |
| 318 | /-- The real expression whose floor defines the manuscript's native index. -/ |
| 319 | def nativeArgument (h : ℝ) (n : ℕ) : ℝ := |
| 320 | Real.log (dyadicQ n ^ (-1 - h) / (n : ℝ) ^ 2) / Real.log coverGrowth |
| 321 | |
| 322 | def nativeIndex (h : ℝ) (n : ℕ) : ℕ := ⌊nativeArgument h n⌋₊ |
| 323 | |
| 324 | theorem nativeArgument_expanded (h : ℝ) {n : ℕ} (hn : 1 ≤ n) : |
| 325 | nativeArgument h n = |
| 326 | ((n : ℝ) * (1 + h) * Real.log 2 - 2 * Real.log (n : ℝ)) / Real.log coverGrowth := by |
| 327 | have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast (by omega : n ≠ 0) |
| 328 | have hq : 0 < dyadicQ n := Real.rpow_pos_of_pos (by norm_num) _ |
| 329 | unfold nativeArgument |
| 330 | rw [Real.log_div (ne_of_gt (Real.rpow_pos_of_pos hq _)) (pow_ne_zero 2 hn'), |
| 331 | Real.log_rpow hq, Real.log_pow] |
| 332 | unfold dyadicQ |
| 333 | rw [Real.log_rpow (by norm_num : (0 : ℝ) < 2)] |
| 334 | norm_num |
| 335 | ring |
| 336 | |
| 337 | def nativeGapBudget (h : ℝ) : ℝ := |
| 338 | (4 * (1 + h) * Real.log 2 + 2 * Real.log 5) / Real.log coverGrowth |
| 339 | |
| 340 | def nativeGap (h : ℝ) : ℕ := ⌈nativeGapBudget h⌉₊ + 1 |
| 341 | |
| 342 | theorem log_level_gap {n m : ℕ} (hn : 1 ≤ n) (hm : 1 ≤ m) |
| 343 | (hnm : n ≤ m + 4) (hmn : m ≤ n + 4) : |
| 344 | |Real.log (n : ℝ) - Real.log (m : ℝ)| ≤ Real.log 5 := by |
| 345 | have hn' : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) |
| 346 | have hm' : (0 : ℝ) < m := by exact_mod_cast (by omega : 0 < m) |
| 347 | have hn5 : (n : ℝ) ≤ 5 * (m : ℝ) := by exact_mod_cast (by omega : n ≤ 5 * m) |
| 348 | have hm5 : (m : ℝ) ≤ 5 * (n : ℝ) := by exact_mod_cast (by omega : m ≤ 5 * n) |
| 349 | have h1 := Real.log_le_log hn' hn5 |
| 350 | have h2 := Real.log_le_log hm' hm5 |
| 351 | rw [Real.log_mul (by norm_num : (5 : ℝ) ≠ 0) (ne_of_gt hm')] at h1 |
| 352 | rw [Real.log_mul (by norm_num : (5 : ℝ) ≠ 0) (ne_of_gt hn')] at h2 |
| 353 | rw [abs_le] |
| 354 | constructor <;> linarith |
| 355 | |
| 356 | theorem nativeArgument_gap (h : ℝ) (hh : 0 ≤ h) {n m : ℕ} |
| 357 | (hn : 1 ≤ n) (hm : 1 ≤ m) (hnm : n ≤ m + 4) (hmn : m ≤ n + 4) : |
| 358 | |nativeArgument h n - nativeArgument h m| ≤ nativeGapBudget h := by |
| 359 | have hlog2 : 0 ≤ Real.log (2 : ℝ) := (Real.log_pos (by norm_num)).le |
| 360 | have h1h : 0 ≤ 1 + h := by linarith |
| 361 | have hdiff : |(n : ℝ) - (m : ℝ)| ≤ 4 := by |
| 362 | have hn' : (n : ℝ) ≤ (m : ℝ) + 4 := by exact_mod_cast hnm |
| 363 | have hm' : (m : ℝ) ≤ (n : ℝ) + 4 := by exact_mod_cast hmn |
| 364 | rw [abs_le] |
| 365 | constructor <;> linarith |
| 366 | have hlogs := log_level_gap hn hm hnm hmn |
| 367 | have hnum : |
| 368 | |((n : ℝ) - (m : ℝ)) * (1 + h) * Real.log 2 - |
| 369 | 2 * (Real.log (n : ℝ) - Real.log (m : ℝ))| ≤ |
| 370 | 4 * (1 + h) * Real.log 2 + 2 * Real.log 5 := by |
| 371 | calc |
| 372 | _ ≤ |((n : ℝ) - (m : ℝ)) * (1 + h) * Real.log 2| + |
| 373 | |2 * (Real.log (n : ℝ) - Real.log (m : ℝ))| := abs_sub _ _ |
| 374 | _ = |(n : ℝ) - (m : ℝ)| * (1 + h) * Real.log 2 + |
| 375 | 2 * |Real.log (n : ℝ) - Real.log (m : ℝ)| := by |
| 376 | rw [abs_mul, abs_mul, abs_of_nonneg hlog2, abs_of_nonneg h1h, |
| 377 | abs_mul, abs_of_nonneg (by norm_num : (0 : ℝ) ≤ 2)] |
| 378 | _ ≤ _ := add_le_add |
| 379 | (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hdiff h1h) hlog2) |
| 380 | (mul_le_mul_of_nonneg_left hlogs (by norm_num)) |
| 381 | calc |
| 382 | |nativeArgument h n - nativeArgument h m| = |
| 383 | |(((n : ℝ) - (m : ℝ)) * (1 + h) * Real.log 2 - |
| 384 | 2 * (Real.log (n : ℝ) - Real.log (m : ℝ))) / Real.log coverGrowth| := by |
| 385 | rw [nativeArgument_expanded h hn, nativeArgument_expanded h hm] |
| 386 | congr 1 |
| 387 | ring |
| 388 | _ = |((n : ℝ) - (m : ℝ)) * (1 + h) * Real.log 2 - |
| 389 | 2 * (Real.log (n : ℝ) - Real.log (m : ℝ))| / Real.log coverGrowth := by |
| 390 | rw [abs_div, abs_of_pos log_coverGrowth_pos] |
| 391 | _ ≤ nativeGapBudget h := div_le_div_of_nonneg_right hnum log_coverGrowth_pos.le |
| 392 | |
| 393 | theorem natFloor_gap_le (u v C : ℝ) (h : u - v ≤ C) : |
| 394 | ⌊u⌋₊ ≤ ⌊v⌋₊ + (⌈C⌉₊ + 1) := by |
| 395 | apply Nat.floor_le_of_le |
| 396 | push_cast |
| 397 | linarith [Nat.lt_floor_add_one v, Nat.le_ceil C] |
| 398 | |
| 399 | /-- The actual adjacent native indices have an explicit uniform gap. -/ |
| 400 | theorem nativeIndex_gap (h : ℝ) (hh : 0 ≤ h) {n m : ℕ} |
| 401 | (hn : 1 ≤ n) (hm : 1 ≤ m) (hnm : n ≤ m + 4) (hmn : m ≤ n + 4) : |
| 402 | nativeIndex h n ≤ nativeIndex h m + nativeGap h ∧ |
| 403 | nativeIndex h m ≤ nativeIndex h n + nativeGap h := by |
| 404 | have hg := abs_le.mp (nativeArgument_gap h hh hn hm hnm hmn) |
| 405 | constructor |
| 406 | · exact natFloor_gap_le _ _ _ hg.2 |
| 407 | · exact natFloor_gap_le _ _ _ (by linarith [hg.1]) |
| 408 | |
| 409 | theorem nat_square_le_two_pow {n : ℕ} (hn : 4 ≤ n) : n ^ 2 ≤ 2 ^ n := by |
| 410 | induction n, hn using Nat.le_induction with |
| 411 | | base => norm_num |
| 412 | | succ n hn ih => |
| 413 | have hmul := Nat.mul_le_mul_right n hn |
| 414 | calc |
| 415 | (n + 1) ^ 2 ≤ 2 * n ^ 2 := by nlinarith |
| 416 | _ ≤ 2 * 2 ^ n := Nat.mul_le_mul_left 2 ih |
| 417 | _ = 2 ^ (n + 1) := by rw [pow_succ]; ring |
| 418 | |
| 419 | /-- `n=4` is already a valid uniform threshold for nonnegative native indices |
| 420 | when `h≥0`; the manuscript subsequently retains still larger bands. -/ |
| 421 | theorem nativeArgument_nonneg (h : ℝ) (hh : 0 ≤ h) {n : ℕ} (hn : 4 ≤ n) : |
| 422 | 0 ≤ nativeArgument h n := by |
| 423 | have hn' : (0 : ℝ) < n := by exact_mod_cast (by omega : 0 < n) |
| 424 | have hsquare : (n : ℝ) ^ 2 ≤ (2 : ℝ) ^ n := by exact_mod_cast nat_square_le_two_pow hn |
| 425 | have hq : (n : ℝ) ^ 2 ≤ dyadicQ n ^ (-1 - h) := by |
| 426 | unfold dyadicQ |
| 427 | rw [← Real.rpow_mul (by norm_num : (0 : ℝ) ≤ 2)] |
| 428 | calc |
| 429 | (n : ℝ) ^ 2 ≤ (2 : ℝ) ^ n := hsquare |
| 430 | _ = (2 : ℝ) ^ (n : ℝ) := (Real.rpow_natCast _ _).symm |
| 431 | _ ≤ (2 : ℝ) ^ (-(n : ℝ) * (-1 - h)) := |
| 432 | Real.rpow_le_rpow_of_exponent_le (by norm_num) (by nlinarith) |
| 433 | have hratio : 1 ≤ dyadicQ n ^ (-1 - h) / (n : ℝ) ^ 2 := by |
| 434 | apply (le_div_iff₀ (pow_pos hn' 2)).mpr |
| 435 | simpa using hq |
| 436 | exact div_nonneg (Real.log_nonneg hratio) log_coverGrowth_pos.le |
| 437 | |
| 438 | theorem nativeIndex_eq_integer_floor (h : ℝ) (hh : 0 ≤ h) {n : ℕ} (hn : 4 ≤ n) : |
| 439 | (nativeIndex h n : ℤ) = ⌊nativeArgument h n⌋ := by |
| 440 | unfold nativeIndex |
| 441 | rw [← Int.floor_toNat, Int.toNat_of_nonneg (Int.floor_nonneg.mpr (nativeArgument_nonneg h hh hn))] |
| 442 | |
| 443 | /-- The constructed finite coloring feeds the proved rational-slot geometry |
| 444 | using the manuscript's actual native covering index, with no coloring or |
| 445 | native-index-gap assumption. -/ |
| 446 | theorem physical_labels_have_auxiliary_slots (D h : ℝ) (hh : 0 ≤ h) |
| 447 | (a b : SlotGeometry.Plane) : |
| 448 | ∃ r : ℝ, 0 < r ∧ ∀ L M : Label, Adj D L M → |
| 449 | Disjoint |
| 450 | (SlotGeometry.liftedSupport (nativeIndex h L.1) |
| 451 | (SlotGeometry.orientedRectangle |
| 452 | (SlotGeometry.center (Fintype.card Palette) (nativeGap h) (color L)) a b (2 * r))) |
| 453 | (SlotGeometry.liftedSupport (nativeIndex h M.1) |
| 454 | (SlotGeometry.orientedRectangle |
| 455 | (SlotGeometry.center (Fintype.card Palette) (nativeGap h) (color M)) a b (2 * r))) := by |
| 456 | apply SlotGeometry.colored_labels_have_slots |
| 457 | (Fintype.card Palette) (nativeGap h) a b (Adj D) color (fun L => nativeIndex h L.1) |
| 458 | · intro L M hLM |
| 459 | exact color_proper D hLM |
| 460 | · intro L M hLM |
| 461 | exact nativeIndex_gap h hh hLM.left_positive hLM.right_positive |
| 462 | hLM.left_level_le hLM.right_level_le |
| 463 | |
| 464 | end NavierStokes.SlotColoring |