Download data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticTarget.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.23 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticTarget.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticTarget.lean
-
curl -L -o AsymptoticTarget.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algorithms/SubexponentialSAT/SqrtLog/AsymptoticTarget.lean
7.23 kB
| import OAI.Algorithms.SubexponentialSAT.LeanCompat | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.AsymptoticOverhead | |
| import OAI.Algorithms.SubexponentialSAT.SqrtLog.StatementScale | |
| namespace OAI.Algorithms | |
| /-! Conversion to the exact natural-logarithm target and absorption of | |
| fixed polylogarithmic construction, search, and arithmetic overheads. -/ | |
| namespace SubexponentialSAT.SqrtLog.Asymptotic | |
| open Filter | |
| open scoped Topology | |
| theorem log_two_bounds : (1 : β) / 2 β€ Real.log 2 β§ Real.log 2 β€ 1 := by | |
| constructor | |
| Β· have h := Real.one_sub_inv_le_log_of_pos (by norm_num : (0 : β) < 2) | |
| norm_num at h β’ | |
| linarith | |
| Β· have h := Real.log_le_sub_one_of_pos (by norm_num : (0 : β) < 2) | |
| norm_num at h β’ | |
| exact h | |
| theorem logSize_natural_bounds (n : β) : | |
| Real.log ((n : β) + 16) β€ logSize n β§ | |
| logSize n β€ 2 * Real.log ((n : β) + 16) := by | |
| have hpos := Statement.log_shift_pos n | |
| have hb := log_two_bounds | |
| have htwo : 0 < Real.log (2 : β) := by linarith | |
| unfold logSize Real.logb | |
| constructor | |
| Β· apply (le_div_iffβ htwo).2 | |
| nlinarith | |
| Β· apply (div_le_iffβ htwo).2 | |
| nlinarith | |
| theorem logLogSize_le_natural (n : β) : | |
| logLogSize n β€ 4 * Real.log (Real.log ((n : β) + 16)) := by | |
| have ha := Statement.two_le_log_shift n | |
| have hap := Statement.log_shift_pos n | |
| have hb := log_two_bounds | |
| have htwo : 0 < Real.log (2 : β) := by linarith | |
| have hlog : Real.log 2 β€ Real.log (Real.log ((n : β) + 16)) := | |
| Real.log_le_log (by norm_num) ha | |
| have ht : 0 < logSize n := by have := four_le_logSize n; linarith | |
| have htlog : Real.log (logSize n) β€ | |
| Real.log 2 + Real.log (Real.log ((n : β) + 16)) := by | |
| calc | |
| Real.log (logSize n) β€ Real.log (2 * Real.log ((n : β) + 16)) := | |
| Real.log_le_log ht (logSize_natural_bounds n).2 | |
| _ = _ := Real.log_mul (by norm_num : (2 : β) β 0) hap.ne' | |
| unfold logLogSize Real.logb | |
| apply (div_le_iffβ htwo).2 | |
| nlinarith | |
| theorem binaryScale_le_target (n : β) : | |
| binaryScale n β€ 16 * Statement.runtimeScale n := by | |
| have hW := logLogSize_le_natural n | |
| have hW0 : 0 β€ logLogSize n := by have := two_le_logLogSize n; linarith | |
| have hroot := Real.sqrt_le_sqrt (logSize_natural_bounds n).1 | |
| have ha := Statement.sqrt_log_shift_pos n | |
| have hb : 0 < Real.sqrt (logSize n) := by linarith | |
| have hsq : logLogSize n ^ 2 β€ | |
| 16 * Real.log (Real.log ((n : β) + 16)) ^ 2 := by nlinarith | |
| unfold binaryScale Statement.runtimeScale | |
| calc | |
| (n : β) * logLogSize n ^ 2 / Real.sqrt (logSize n) β€ | |
| (n : β) * (16 * Real.log (Real.log ((n : β) + 16)) ^ 2) / | |
| Real.sqrt (Real.log ((n : β) + 16)) := by gcongr | |
| _ = _ := by ring | |
| theorem eventually_inverse_schedule_target : | |
| βαΆ n : β in atTop, (n : β) / s n β€ 128 * Statement.runtimeScale n := by | |
| filter_upwards [eventually_inverse_schedule_le] with n hn | |
| have h := binaryScale_le_target n | |
| linarith | |
| theorem eventually_polylog_le_target (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, C * logSize n ^ q β€ Statement.runtimeScale n := by | |
| filter_upwards [eventually_logSize_power_le q (show 0 < 16 * C by positivity)] with n hn | |
| have h := binaryScale_le_target n | |
| nlinarith | |
| theorem eventually_search_exponent_target (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, | |
| C * ((s n : β) + 2) ^ q * Real.logb 2 ((n : β) + 1) β€ | |
| Statement.runtimeScale n := by | |
| filter_upwards [eventually_schedule_search_exponent q | |
| (show 0 < 16 * C by positivity)] with n hn | |
| have h := binaryScale_le_target n | |
| nlinarith | |
| theorem eventually_variable_search_target (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 : β) ^ Statement.runtimeScale n := by | |
| filter_upwards [hdegree, eventually_search_exponent_target 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 | |
| /-- Any explicitly bounded fixed polylogarithm is absorbed, irrespective of | |
| which stage of the construction produced it. -/ | |
| theorem eventually_polylog_bounded_target (f : β β β) (q : β) | |
| {C : β} (hC : 0 < C) | |
| (hf : βαΆ n : β in atTop, f n β€ C * logSize n ^ q) : | |
| βαΆ n : β in atTop, f n β€ Statement.runtimeScale n := by | |
| filter_upwards [hf, eventually_polylog_le_target q hC] with n hn hb | |
| exact hn.trans hb | |
| theorem eventually_exp_polylog_target (f : β β β) (q : β) | |
| {C : β} (hC : 0 < C) | |
| (hf : βαΆ n : β in atTop, f n β€ C * logSize n ^ q) : | |
| βαΆ n : β in atTop, (2 : β) ^ f n β€ (2 : β) ^ Statement.runtimeScale n := by | |
| filter_upwards [eventually_polylog_bounded_target f q hC hf] with n hn | |
| exact Real.rpow_le_rpow_of_exponent_le (by norm_num) hn | |
| theorem eventually_natural_log_power_target (q : β) {C : β} (hC : 0 < C) : | |
| βαΆ n : β in atTop, | |
| C * Real.log ((n : β) + 16) ^ q β€ Statement.runtimeScale n := by | |
| filter_upwards [eventually_polylog_le_target q hC] with n hn | |
| exact (mul_le_mul_of_nonneg_left | |
| (pow_le_pow_leftβ (Statement.log_shift_pos n).le (logSize_natural_bounds n).1 q) | |
| hC.le).trans hn | |
| /-- Numerical finite-prefix absorption. This does not construct or dispatch | |
| a small-input machine; it only supplies the uniform multiplicative constant | |
| once the work at each exceptional dimension has already been bounded. -/ | |
| theorem finite_prefix_absorption (f : β β β) {A : β} (hA : 0 β€ A) | |
| (hf : βαΆ n : β in atTop, f n β€ (2 : β) ^ (A * Statement.runtimeScale n)) : | |
| β C : β, 0 < C β§ β n, f n β€ C * (2 : β) ^ (A * Statement.runtimeScale n) := by | |
| obtain β¨N, hNβ© := eventually_atTop.1 hf | |
| let C : β := (β i β Finset.range N, |f i|) + 1 | |
| have hsum : 0 β€ β i β Finset.range N, |f i| := | |
| Finset.sum_nonneg (fun _ _ => abs_nonneg _) | |
| have hC : 1 β€ C := by dsimp [C]; linarith | |
| refine β¨C, by linarith, ?_β© | |
| intro n | |
| have he : 1 β€ (2 : β) ^ (A * Statement.runtimeScale n) := | |
| Real.one_le_rpow (by norm_num) (mul_nonneg hA (Statement.runtimeScale_nonneg n)) | |
| by_cases hn : N β€ n | |
| Β· exact (hN n hn).trans (le_mul_of_one_le_left (by positivity) hC) | |
| Β· have hnmem : n β Finset.range N := Finset.mem_range.2 (by omega) | |
| have hfn : |f n| β€ β i β Finset.range N, |f i| := | |
| Finset.single_le_sum (f := fun i : β => |f i|) (fun _ _ => abs_nonneg _) hnmem | |
| have hsmall : f n β€ C := by have := le_abs_self (f n); dsimp [C]; linarith | |
| exact hsmall.trans (le_mul_of_one_le_right (by linarith) he) | |
| end SubexponentialSAT.SqrtLog.Asymptotic | |
| end OAI.Algorithms | |