Buckets:
| import Mathlib | |
| namespace OAI | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| section | |
| namespace UniqueGames.Foundations.Repetition | |
| noncomputable def logTwo (x : ℝ) : ℝ := Real.log x / Real.log 2 | |
| @[simp] theorem logTwo_one : logTwo 1 = 0 := by simp [logTwo] | |
| theorem logTwo_inv_le_of_half_pow_le {p : ℝ} (m : ℕ) | |
| (h : (1 / 2 : ℝ) ^ m ≤ p) : logTwo (1 / p) ≤ m := by | |
| have hp : 0 < p := (pow_pos (by norm_num : (0 : ℝ) < 1 / 2) m).trans_le h | |
| have hlog := Real.log_le_log (pow_pos (by norm_num : (0 : ℝ) < 1 / 2) m) h | |
| have hhalf : Real.log (1 / 2 : ℝ) = -Real.log 2 := by | |
| rw [one_div, Real.log_inv] | |
| rw [Real.log_pow, hhalf] at hlog | |
| unfold logTwo | |
| rw [one_div, Real.log_inv] | |
| apply (div_le_iff₀ (Real.log_pos (by norm_num : (1 : ℝ) < 2))).2 | |
| nlinarith | |
| theorem contraction_step {v ell : ℝ} {n m : ℕ} {p next : ℝ} | |
| (hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) | |
| (hm : 1 ≤ m) (hmn : m < n) (hp : 0 ≤ p) | |
| (hmono : next ≤ p) | |
| (hprev : p ≤ ((1 + v) / 2) ^ m) | |
| (hcut : 2700 * (m : ℝ) * ell ≤ (1 - v) ^ 2 * ((n : ℝ) - m)) | |
| (hstep : next ≤ p * (v + 15 * Real.sqrt | |
| (((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)))) : | |
| next ≤ ((1 + v) / 2) ^ (m + 1) := by | |
| by_cases hsmall : p ≤ ((1 + v) / 2) ^ (m + 1) | |
| · exact hmono.trans hsmall | |
| have hq : (1 / 2 : ℝ) ≤ (1 + v) / 2 := by linarith | |
| have hhalf : (1 / 2 : ℝ) ^ (m + 1) ≤ p := | |
| (pow_le_pow_left₀ (by norm_num) hq (m + 1)).trans (le_of_not_ge hsmall) | |
| have hlog := logTwo_inv_le_of_half_pow_le (m + 1) hhalf | |
| have hmreal : (1 : ℝ) ≤ m := by exact_mod_cast hm | |
| have hden : 0 < (n : ℝ) - m := by | |
| have hmnreal : (m : ℝ) < n := by exact_mod_cast hmn | |
| linarith | |
| have hmell : (m : ℝ) ≤ (m : ℝ) * ell := by nlinarith | |
| have hbudget : (m : ℝ) * ell + logTwo (1 / p) ≤ 3 * (m : ℝ) * ell := by | |
| simp only [Nat.cast_add, Nat.cast_one] at hlog | |
| nlinarith | |
| have hsqrt : Real.sqrt | |
| (((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)) ≤ (1 - v) / 30 := by | |
| apply (Real.sqrt_le_left (by linarith : 0 ≤ (1 - v) / 30)).2 | |
| apply (div_le_iff₀ hden).2 | |
| nlinarith | |
| have hfactor : v + 15 * Real.sqrt | |
| (((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m)) ≤ (1 + v) / 2 := by | |
| linarith | |
| calc | |
| next ≤ p * (v + 15 * Real.sqrt | |
| (((m : ℝ) * ell + logTwo (1 / p)) / ((n : ℝ) - m))) := hstep | |
| _ ≤ p * ((1 + v) / 2) := mul_le_mul_of_nonneg_left hfactor hp | |
| _ ≤ ((1 + v) / 2) ^ m * ((1 + v) / 2) := | |
| mul_le_mul_of_nonneg_right hprev (by linarith) | |
| _ = ((1 + v) / 2) ^ (m + 1) := (pow_succ _ _).symm | |
| theorem initial_step {v ell next : ℝ} {n : ℕ} | |
| (hstep : next ≤ 1 * (v + 15 * Real.sqrt | |
| (((0 : ℝ) * ell + logTwo (1 / 1)) / ((n : ℝ) - 0)))) : | |
| next ≤ v := by simpa using hstep | |
| theorem cutoff_step {v ell : ℝ} {n m : ℕ} | |
| (hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) | |
| (hm : (m : ℝ) < (n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) : | |
| 2700 * (m : ℝ) * ell ≤ (1 - v) ^ 2 * ((n : ℝ) - m) := by | |
| have hell0 : 0 < ell := by linarith | |
| have hd : (1 - v) ^ 2 ≤ 1 := by nlinarith | |
| have hmul : (m : ℝ) * (2925 * ell) < (n : ℝ) * (1 - v) ^ 2 := | |
| (lt_div_iff₀ (by positivity : 0 < 2925 * ell)).1 hm | |
| have hdell : (1 - v) ^ 2 ≤ 225 * ell := by linarith | |
| have hprod := mul_le_mul_of_nonneg_left hdell (Nat.cast_nonneg m : (0 : ℝ) ≤ m) | |
| nlinarith | |
| theorem cutoff_le_length {v ell : ℝ} (n : ℕ) | |
| (hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) : | |
| (n : ℝ) * (1 - v) ^ 2 / (2925 * ell) ≤ n := by | |
| have hell0 : 0 < ell := by linarith | |
| apply (div_le_iff₀ (by positivity : 0 < 2925 * ell)).2 | |
| have hd : (1 - v) ^ 2 ≤ 2925 * ell := by nlinarith | |
| nlinarith [mul_le_mul_of_nonneg_left hd (Nat.cast_nonneg n : (0 : ℝ) ≤ n)] | |
| def ScalarRecurrence (p : ℕ → ℝ) (n : ℕ) (v ell : ℝ) : Prop := | |
| ∀ m, m < n → p (m + 1) ≤ p m * (v + 15 * Real.sqrt | |
| (((m : ℝ) * ell + logTwo (1 / p m)) / ((n : ℝ) - m))) | |
| theorem decay_to_cutoff (p : ℕ → ℝ) (n : ℕ) {v ell : ℝ} | |
| (hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) | |
| (hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m) | |
| (hpmono : Antitone p) (hrec : ScalarRecurrence p n v ell) : | |
| p n ≤ ((1 + v) / 2) ^ | |
| ((n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) := by | |
| let T : ℝ := (n : ℝ) * (1 - v) ^ 2 / (2925 * ell) | |
| let M : ℕ := Nat.ceil T | |
| have hMn : M ≤ n := Nat.ceil_le.mpr (cutoff_le_length n hv0 hv1 hell) | |
| have hind : ∀ m, m ≤ M → p m ≤ ((1 + v) / 2) ^ m := by | |
| intro m | |
| induction m with | |
| | zero => intro _; simp [hp0] | |
| | succ m ih => | |
| intro hmM | |
| have hmM' : m < M := Nat.lt_of_succ_le hmM | |
| have hmn : m < n := hmM'.trans_le hMn | |
| have hprev := ih (Nat.le_of_lt hmM') | |
| by_cases hm0 : m = 0 | |
| · subst m | |
| have hinit : p 1 ≤ v := by | |
| have hs := hrec 0 hmn | |
| simpa [hp0] using hs | |
| simpa using hinit.trans (by linarith : v ≤ (1 + v) / 2) | |
| · have hmT : (m : ℝ) < T := Nat.lt_ceil.mp hmM' | |
| exact contraction_step hv0 hv1 hell (Nat.one_le_iff_ne_zero.mpr hm0) | |
| hmn (hpnonneg m) (hpmono (Nat.le_succ m)) hprev | |
| (cutoff_step hv0 hv1 hell hmT) (hrec m hmn) | |
| have hq0 : 0 < (1 + v) / 2 := by linarith | |
| have hq1 : (1 + v) / 2 ≤ 1 := by linarith | |
| calc | |
| p n ≤ p M := hpmono hMn | |
| _ ≤ ((1 + v) / 2) ^ M := hind M le_rfl | |
| _ = ((1 + v) / 2) ^ (M : ℝ) := (Real.rpow_natCast _ _).symm | |
| _ ≤ ((1 + v) / 2) ^ T := | |
| Real.rpow_le_rpow_of_exponent_ge hq0 hq1 (Nat.le_ceil T) | |
| theorem block_contraction {v : ℝ} (hv0 : 0 ≤ v) (hv1 : v < 1) : | |
| ((1 + v) / 2) ^ ((1 - v) ^ 2 / 2925 : ℝ) ≤ | |
| 1 - (1 - v) ^ 3 / 5850 := by | |
| have hd : (1 - v) ^ 2 ≤ 1 := by nlinarith | |
| have hb := rpow_one_add_le_one_add_mul_self | |
| (s := -(1 - v) / 2) (p := (1 - v) ^ 2 / 2925) | |
| (by linarith) (by positivity) (by nlinarith) | |
| have hbase : 1 + -(1 - v) / 2 = (1 + v) / 2 := by ring | |
| have hrhs : 1 + (1 - v) ^ 2 / 2925 * (-(1 - v) / 2) = | |
| 1 - (1 - v) ^ 3 / 5850 := by ring | |
| rwa [hbase, hrhs] at hb | |
| theorem scalar_bound_6000 (p : ℕ → ℝ) (n : ℕ) {v ell : ℝ} | |
| (hv0 : 0 ≤ v) (hv1 : v < 1) (hell : 1 ≤ ell) | |
| (hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m) | |
| (hpmono : Antitone p) (hrec : ScalarRecurrence p n v ell) : | |
| p n ≤ (1 - (1 - v) ^ 3 / 6000) ^ ((n : ℝ) / ell) := by | |
| have hell0 : 0 < ell := by linarith | |
| have hq0 : 0 ≤ (1 + v) / 2 := by linarith | |
| have hexp : 0 ≤ (n : ℝ) / ell := by positivity | |
| have hblock := block_contraction hv0 hv1 | |
| have hweak : 1 - (1 - v) ^ 3 / 5850 ≤ 1 - (1 - v) ^ 3 / 6000 := by | |
| have : 0 ≤ (1 - v) ^ 3 := by positivity | |
| nlinarith | |
| calc | |
| p n ≤ ((1 + v) / 2) ^ | |
| ((n : ℝ) * (1 - v) ^ 2 / (2925 * ell)) := | |
| decay_to_cutoff p n hv0 hv1 hell hp0 hpnonneg hpmono hrec | |
| _ = (((1 + v) / 2) ^ ((1 - v) ^ 2 / 2925 : ℝ)) ^ ((n : ℝ) / ell) := by | |
| rw [← Real.rpow_mul hq0] | |
| congr 1 | |
| ring | |
| _ ≤ (1 - (1 - v) ^ 3 / 6000) ^ ((n : ℝ) / ell) := | |
| Real.rpow_le_rpow (Real.rpow_nonneg hq0 _) (hblock.trans hweak) hexp | |
| noncomputable def incidenceRate : ℝ := 1 - 1 / (100000 * 192 ^ 3) | |
| theorem incidenceRate_pos : 0 < incidenceRate := by norm_num [incidenceRate] | |
| theorem incidenceRate_lt_one : incidenceRate < 1 := by norm_num [incidenceRate] | |
| theorem incidenceRate_fourth : | |
| 1 - (1 / 192 : ℝ) ^ 3 / 6000 ≤ incidenceRate ^ 4 := by | |
| norm_num [incidenceRate] | |
| theorem incidence_rate_comparison (n : ℕ) : | |
| (1 - (1 / 192 : ℝ) ^ 3 / 6000) ^ ((n : ℝ) / 4) ≤ incidenceRate ^ n := by | |
| calc | |
| (1 - (1 / 192 : ℝ) ^ 3 / 6000) ^ ((n : ℝ) / 4) | |
| ≤ (incidenceRate ^ 4) ^ ((n : ℝ) / 4) := | |
| Real.rpow_le_rpow (by norm_num) incidenceRate_fourth (by positivity) | |
| _ = incidenceRate ^ ((4 : ℝ) * ((n : ℝ) / 4)) := | |
| (Real.rpow_natCast_mul incidenceRate_pos.le 4 ((n : ℝ) / 4)).symm | |
| _ = incidenceRate ^ (n : ℝ) := by congr 1; ring | |
| _ = incidenceRate ^ n := Real.rpow_natCast _ _ | |
| theorem scalar_incidence_bound (p : ℕ → ℝ) (n : ℕ) {v : ℝ} | |
| (hv : v ≤ 1 - (1 / 192 : ℝ)) | |
| (hp0 : p 0 = 1) (hpnonneg : ∀ m, 0 ≤ p m) | |
| (hpmono : Antitone p) (hrec : ScalarRecurrence p n v 4) : | |
| p n ≤ incidenceRate ^ n := by | |
| have hrec' : ScalarRecurrence p n (1 - (1 / 192 : ℝ)) 4 := by | |
| intro m hm | |
| exact (hrec m hm).trans (mul_le_mul_of_nonneg_left (by linarith) (hpnonneg m)) | |
| have hbound := scalar_bound_6000 p n | |
| (v := 1 - (1 / 192 : ℝ)) (ell := 4) | |
| (by norm_num) (by norm_num) (by norm_num) hp0 hpnonneg hpmono hrec' | |
| norm_num only [sub_sub_cancel] at hbound | |
| have hcomparison := incidence_rate_comparison n | |
| norm_num at hcomparison | |
| exact hbound.trans hcomparison | |
| end UniqueGames.Foundations.Repetition | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 9.25 kB
- Xet hash:
- b7ca57806ecb78a139a43c45fd53ebab120401ba8e1a45f19823d1870148e4e7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.