Download data/lean/OAI/Combinatorics/BinaryEdit/FiniteNumeric.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.95 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BinaryEdit/FiniteNumeric.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/BinaryEdit/FiniteNumeric.lean
-
curl -L -o FiniteNumeric.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/BinaryEdit/FiniteNumeric.lean
3.95 kB
| import Mathlib | |
| namespace OAI | |
| /-! | |
| # Arithmetic for the finite-tree obstruction | |
| The parameter estimate and final rearrangement in `prop:finite-lower` hold | |
| with the explicit absolute constant 34. | |
| -/ | |
| namespace TreeEdit.BinaryLower.FiniteNumeric | |
| lemma period_ratio_bound {k : β} (hk : 1 β€ k) : | |
| 2 * (k : β) * (4 * (k : β) ^ (10 * k)) / (k : β) ^ (20 * k) | |
| β€ 8 / (k : β) ^ k := by | |
| have hk0 : (0 : β) < k := by exact_mod_cast (show 0 < k by omega) | |
| have hk1 : (1 : β) β€ k := by exact_mod_cast hk | |
| have ha : 0 < (k : β) ^ (10 * k) := pow_pos hk0 _ | |
| have hb : 0 < (k : β) ^ k := pow_pos hk0 _ | |
| have hp : (k : β) * (k : β) ^ k β€ (k : β) ^ (10 * k) := by | |
| calc | |
| (k : β) * (k : β) ^ k = (k : β) ^ (k + 1) := by ring | |
| _ β€ (k : β) ^ (10 * k) := | |
| pow_le_pow_rightβ hk1 (by omega) | |
| have ht : (k : β) ^ (20 * k) = ((k : β) ^ (10 * k)) ^ 2 := by | |
| rw [β pow_mul] | |
| congr 1 | |
| omega | |
| rw [ht] | |
| have hs : 2 * (k : β) * (4 * (k : β) ^ (10 * k)) / | |
| ((k : β) ^ (10 * k)) ^ 2 = 8 * (k : β) / (k : β) ^ (10 * k) := by | |
| field_simp | |
| ring | |
| rw [hs] | |
| apply (div_le_div_iffβ ha hb).2 | |
| nlinarith | |
| /-- The final line of `eq:finite-root-upper`, with an explicit constant. -/ | |
| theorem finite_root_bound {k : β} {M V : β} (hk : 1 β€ k) (hM : 0 β€ M) | |
| (hV : V β€ 4 * M * | |
| (2 * (k : β) * (4 * (k : β) ^ (10 * k)) / (k : β) ^ (20 * k) + | |
| 1 / (2 * (k : β) ^ k))) : | |
| V β€ 34 * M / (k : β) ^ k := by | |
| have hk0 : (0 : β) < k := by exact_mod_cast (show 0 < k by omega) | |
| have hp : (k : β) ^ k β 0 := ne_of_gt (pow_pos hk0 _) | |
| calc | |
| V β€ 4 * M * | |
| (2 * (k : β) * (4 * (k : β) ^ (10 * k)) / (k : β) ^ (20 * k) + | |
| 1 / (2 * (k : β) ^ k)) := hV | |
| _ β€ 4 * M * (8 / (k : β) ^ k + 1 / (2 * (k : β) ^ k)) := by | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| linarith [period_ratio_bound hk] | |
| _ = 34 * M / (k : β) ^ k := by field_simp; ring | |
| /-- Uniform root separation and the preceding upper displacement estimate | |
| force the source's `(k/4)^k` lower distortion, with constant `1/34`. -/ | |
| theorem finite_distortion_bound {k : β} {M V D : β} | |
| (hk : 1 β€ k) (hM : 0 < M) (hD : 0 < D) | |
| (hlower : M / ((4 : β) ^ k * D) β€ V) | |
| (hupper : V β€ 34 * M / (k : β) ^ k) : | |
| ((k : β) / 4) ^ k / 34 β€ D := by | |
| have hk0 : (0 : β) < k := by exact_mod_cast (show 0 < k by omega) | |
| have hp : 0 < (k : β) ^ k := pow_pos hk0 _ | |
| have hfour : 0 < (4 : β) ^ k := by positivity | |
| have hcompare := hlower.trans hupper | |
| have hcross := (div_le_div_iffβ (mul_pos hfour hD) hp).1 hcompare | |
| have hcancel : (k : β) ^ k β€ 34 * (4 : β) ^ k * D := by | |
| apply (mul_le_mul_iff_of_pos_left hM).1 | |
| nlinarith [hcross] | |
| rw [div_pow, div_div] | |
| apply (div_le_iffβ (mul_pos hfour (by norm_num : (0 : β) < 34))).2 | |
| nlinarith [hcancel] | |
| /-- The source averaging length `J=4k^(10k)` lies within the row budget | |
| `T=k^(20k)` already for every `kβ₯2`. -/ | |
| theorem averaging_length_le_rows {k : β} (hk : 2 β€ k) : | |
| 4 * k ^ (10 * k) β€ k ^ (20 * k) := by | |
| have hfour : 4 β€ k ^ (10 * k) := by | |
| calc | |
| 4 = 2 ^ 2 := by norm_num | |
| _ β€ k ^ 2 := Nat.pow_le_pow_left hk 2 | |
| _ β€ k ^ (10 * k) := Nat.pow_le_pow_right (by omega) (by omega) | |
| calc | |
| 4 * k ^ (10 * k) β€ k ^ (10 * k) * k ^ (10 * k) := | |
| Nat.mul_le_mul_right _ hfour | |
| _ = k ^ (20 * k) := by rw [β pow_add]; congr 1; omega | |
| /-- The bound on a sparse character period at any internal depth implies the | |
| half-averaging-interval bound required by short-period detection. -/ | |
| theorem sparse_period_twice_le {k j r q : β} (hk : 1 β€ k) | |
| (hj : j < k) (hr : r < k) | |
| (hq : q β€ 2 * k ^ (5 * j + 5 * r)) : | |
| 2 * q β€ 4 * k ^ (10 * k) := by | |
| have hp : k ^ (5 * j + 5 * r) β€ k ^ (10 * k) := | |
| Nat.pow_le_pow_right hk (by omega) | |
| nlinarith | |
| end TreeEdit.BinaryLower.FiniteNumeric | |
| end OAI | |