Download data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticOverhead.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.59 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticOverhead.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticOverhead.lean
-
curl -L -o AsymptoticOverhead.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticOverhead.lean
6.59 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.AsymptoticSchedule | |
| namespace OAI.Algorithms | |
| /-! Absorption of all fixed polylogarithmic exponents. The quantifiers keep | |
| the power and multiplicative constant independent of the input size. -/ | |
| namespace SubexponentialSAT.SqrtLog.Asymptotic | |
| open Filter | |
| open scoped Topology | |
| theorem schedule_shift_le (n : β) : (s n : β) + 2 β€ 3 * logSize n := by | |
| have ht := four_le_logSize n | |
| have hs : (s n : β) β€ L n := by exact_mod_cast s_le_L n | |
| have hL := L_le_twice_logSize n | |
| linarith | |
| theorem eventually_schedule_power_le_n (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, C * ((s n : β) + 2) ^ q β€ n := by | |
| have hb := (tendsto_natCast_atTop_atTop (R := β)).eventually | |
| (SubexpRuntime.eventually_logb_power_le q | |
| (show 0 < C * (3 : β) ^ q by positivity)) | |
| filter_upwards [hb] with n hn | |
| calc | |
| C * ((s n : β) + 2) ^ q β€ C * (3 * logSize n) ^ q := | |
| mul_le_mul_of_nonneg_left | |
| (pow_le_pow_leftβ (by positivity) (schedule_shift_le n) q) hC.le | |
| _ = (C * (3 : β) ^ q) * logSize n ^ q := by rw [mul_pow]; ring | |
| _ β€ n := hn | |
| theorem eventually_polynomial_schedule_le_n (f : β β β) | |
| (hf : SparsificationConstants.PolynomialBound f) : | |
| βαΆ n : β in atTop, f (s n) β€ n := by | |
| obtain β¨q, hqβ© := QuantitativeSparsify.polynomialBound_shift_power hf | |
| filter_upwards [eventually_schedule_power_le_n q (show (0 : β) < 1 by norm_num)] with n hn | |
| have hfn : (f (s n) : β) β€ ((s n : β) + 2) ^ q := by exact_mod_cast hq (s n) | |
| have hn' : ((s n : β) + 2) ^ q β€ n := by simpa only [one_mul] using hn | |
| have h : (f (s n) : β) β€ n := hfn.trans hn' | |
| exact_mod_cast h | |
| theorem eventually_w_power_le_L (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, C * (w n : β) ^ q β€ L n := by | |
| have hb := logSize_tendsto.eventually | |
| (SubexpRuntime.eventually_logb_power_le q | |
| (show 0 < C * (2 : β) ^ q by positivity)) | |
| filter_upwards [hb] with n hn | |
| have hm : logLogSize n β€ Real.logb 2 (logSize n + 16) := | |
| Real.logb_le_logb_of_le (by norm_num) | |
| (by have := four_le_logSize n; linarith) (by linarith) | |
| have hw : (w n : β) β€ 2 * Real.logb 2 (logSize n + 16) := | |
| (w_le_twice_logLogSize n).trans (by linarith) | |
| calc | |
| C * (w n : β) ^ q β€ C * (2 * Real.logb 2 (logSize n + 16)) ^ q := | |
| mul_le_mul_of_nonneg_left (pow_le_pow_leftβ (by positivity) hw q) hC.le | |
| _ = (C * (2 : β) ^ q) * Real.logb 2 (logSize n + 16) ^ q := by | |
| rw [mul_pow]; ring | |
| _ β€ logSize n := hn | |
| _ β€ L n := (logSize_lt_L n).le | |
| theorem eventually_L_power_le_n (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, C * (L n : β) ^ q β€ n := by | |
| have hb := (tendsto_natCast_atTop_atTop (R := β)).eventually | |
| (SubexpRuntime.eventually_logb_power_le q | |
| (show 0 < C * (2 : β) ^ q by positivity)) | |
| filter_upwards [hb] with n hn | |
| calc | |
| C * (L n : β) ^ q β€ C * (2 * logSize n) ^ q := | |
| mul_le_mul_of_nonneg_left | |
| (pow_le_pow_leftβ (by positivity) (L_le_twice_logSize n) q) hC.le | |
| _ = (C * (2 : β) ^ q) * logSize n ^ q := by rw [mul_pow]; ring | |
| _ β€ n := hn | |
| theorem eventually_logSize_power_le (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, C * logSize n ^ q β€ binaryScale n := by | |
| have hmain := (tendsto_natCast_atTop_atTop (R := β)).eventually | |
| (SubexpRuntime.eventually_logb_power_le (q + 1) hC) | |
| filter_upwards [hmain] with n hn | |
| have ht := four_le_logSize n | |
| have hW := two_le_logLogSize n | |
| have ht0 : 0 < Real.sqrt (logSize n) := Real.sqrt_pos.2 (by linarith) | |
| have hroot : Real.sqrt (logSize n) β€ logSize n := by | |
| apply Real.sqrt_le_iff.2 | |
| constructor <;> nlinarith | |
| have hprod : C * logSize n ^ q * Real.sqrt (logSize n) β€ | |
| (n : β) * logLogSize n ^ 2 := by | |
| calc | |
| C * logSize n ^ q * Real.sqrt (logSize n) β€ | |
| C * logSize n ^ q * logSize n := | |
| mul_le_mul_of_nonneg_left hroot (by positivity) | |
| _ = C * logSize n ^ (q + 1) := by rw [pow_succ]; ring | |
| _ β€ n := hn | |
| _ β€ (n : β) * logLogSize n ^ 2 := by | |
| have := Nat.cast_nonneg (Ξ± := β) n | |
| nlinarith [mul_nonneg (show (0 : β) β€ n by positivity) | |
| (show 0 β€ logLogSize n ^ 2 - 1 by nlinarith)] | |
| exact (le_div_iffβ ht0).2 hprod | |
| theorem eventually_schedule_search_exponent (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, | |
| C * ((s n : β) + 2) ^ q * Real.logb 2 ((n : β) + 1) β€ binaryScale n := by | |
| have hmain := eventually_logSize_power_le (q + 1) | |
| (show 0 < C * (3 : β) ^ q by positivity) | |
| filter_upwards [hmain] with n hn | |
| have ht := four_le_logSize n | |
| have hs : (s n : β) β€ 2 * logSize n := | |
| (by exact_mod_cast s_le_L n : (s n : β) β€ L n).trans (L_le_twice_logSize n) | |
| have hp := pow_le_pow_leftβ (show (0 : β) β€ (s n : β) + 2 by positivity) | |
| (show (s n : β) + 2 β€ 3 * logSize n by linarith) q | |
| have hl : Real.logb 2 ((n : β) + 1) β€ logSize n := | |
| Real.logb_le_logb_of_le (by norm_num) (by positivity) (by linarith) | |
| have hl0 : 0 β€ Real.logb 2 ((n : β) + 1) := | |
| Real.logb_nonneg (by norm_num) (by have := Nat.cast_nonneg (Ξ± := β) n; linarith) | |
| calc | |
| C * ((s n : β) + 2) ^ q * Real.logb 2 ((n : β) + 1) β€ | |
| C * (3 * logSize n) ^ q * logSize n := | |
| mul_le_mul (mul_le_mul_of_nonneg_left hp hC.le) hl hl0 (by positivity) | |
| _ = (C * (3 : β) ^ q) * logSize n ^ (q + 1) := by | |
| rw [mul_pow, pow_succ]; ring | |
| _ β€ binaryScale n := hn | |
| theorem eventually_variable_degree_search (degree : β β β) (q : β) | |
| {C : β} (hC : 0 < C) | |
| (hdegree : βαΆ n : β in atTop, (degree n : β) β€ C * ((s n : β) + 2) ^ q) : | |
| βαΆ n : β in atTop, | |
| (((n + 1) ^ degree n : β) : β) β€ (2 : β) ^ binaryScale n := by | |
| filter_upwards [hdegree, eventually_schedule_search_exponent q hC] with n hd hn | |
| have hl0 : 0 β€ Real.logb 2 ((n : β) + 1) := | |
| Real.logb_nonneg (by norm_num) (by have := Nat.cast_nonneg (Ξ± := β) n; linarith) | |
| have hexp := (mul_le_mul_of_nonneg_right hd hl0).trans hn | |
| have heq : (((n + 1) ^ degree n : β) : β) = | |
| (2 : β) ^ ((degree n : β) * Real.logb 2 ((n : β) + 1)) := by | |
| simp only [Nat.cast_pow, Nat.cast_add, Nat.cast_one] | |
| rw [β Real.rpow_natCast] | |
| exact SubexpExponentArithmetic.rpow_eq_two_rpow_logb (by positivity) _ | |
| rw [heq] | |
| exact Real.rpow_le_rpow_of_exponent_le (by norm_num) hexp | |
| end SubexponentialSAT.SqrtLog.Asymptotic | |
| end OAI.Algorithms | |