File size: 7,228 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 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
|