File size: 3,810 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 | import OAI.Algorithms.SubexponentialSAT.LeanCompat
import OAI.Algorithms.SubexponentialSAT.SqrtLog.AsymptoticLayoutRate
namespace OAI.Algorithms
namespace SubexponentialSAT.SqrtLog.Asymptotic
open Filter
open scoped Topology
private theorem label_log_bound (N B Q : β) (R : β)
(hN : 1 β€ N) (hB : 1 β€ B) (hQ : 1 β€ Q) :
Real.log (4 * N * B * (8 * Q) ^ (2 * R) + 1) β€
7 + Real.log N + Real.log B + (2 * R : β) * (7 + Real.log Q) := by
have hN0 : 0 < N := by linarith
have hB0 : 0 < B := by linarith
have hQ0 : 0 < Q := by linarith
have hp : 1 β€ (8 * Q) ^ (2 * R) := one_le_powβ (by linarith)
have hz : 1 β€ 4 * N * B * (8 * Q) ^ (2 * R) := by
have hNB := one_le_mul_of_one_le_of_one_le hN hB
have hNBp := one_le_mul_of_one_le_of_one_le hNB hp
nlinarith
have hlog8 : Real.log 8 β€ 7 := by
have h := Real.log_le_sub_one_of_pos (by norm_num : (0 : β) < 8)
linarith
calc
Real.log (4 * N * B * (8 * Q) ^ (2 * R) + 1) β€
Real.log (8 * N * B * (8 * Q) ^ (2 * R)) :=
Real.log_le_log (by positivity) (by nlinarith)
_ = Real.log 8 + Real.log N + Real.log B +
(2 * R : β) * (Real.log 8 + Real.log Q) := by
simp [Real.log_mul, Real.log_pow, hN0.ne', hB0.ne', hQ0.ne']
_ β€ 7 + Real.log N + Real.log B + (2 * R : β) * (7 + Real.log Q) := by gcongr
theorem eventually_layout_label_log (b : β β β) (q : β)
(hb : βαΆ n : β in atTop, 1 β€ b n β§ b n β€ L n ^ q) :
βαΆ n : β in atTop,
Real.log (4 * (n : β) * b n * (8 * (layoutQ n : β)) ^
(2 * layoutCutoff n (b n)) + 1) β€ 4 * (L n : β) ^ 2 := by
have hbp : βαΆ n : β in atTop, b n β€ L n ^ q := hb.mono fun _ h => h.2
filter_upwards [hb, eventually_layout_fits b q hbp, eventually_layoutQ_ge 1,
eventually_L_ge (max 16 q), eventually_ge_atTop (1 : β)] with n hbn hfit hQ hL hn
have hL16 : (16 : β) β€ L n := by exact_mod_cast (le_max_left 16 q).trans hL
have hqL : (q : β) β€ L n := by exact_mod_cast (le_max_right 16 q).trans hL
have hN : (1 : β) β€ n := by exact_mod_cast hn
have hB : (1 : β) β€ b n := by exact_mod_cast hbn.1
have hQ' : (1 : β) β€ layoutQ n := by exact_mod_cast hQ
have hR : (layoutCutoff n (b n) : β) β€ L n := by
have hQle : layoutQ n β€ L n := Nat.div_le_self _ _
exact_mod_cast (show layoutCutoff n (b n) β€ L n by omega)
have hLn : Real.log (n : β) β€ L n := by
calc
Real.log (n : β) β€ Real.log ((n : β) + 16) := Real.log_le_log (by linarith) (by linarith)
_ β€ logSize n := (logSize_natural_bounds n).1
_ β€ L n := (logSize_lt_L n).le
have hLL : Real.log (L n : β) β€ L n := by
have h := Real.log_le_sub_one_of_pos (by linarith : (0 : β) < L n)
linarith
have hLB : Real.log (b n : β) β€ (q : β) * (L n : β) := by
calc
Real.log (b n : β) β€ Real.log ((L n : β) ^ q) :=
Real.log_le_log (by linarith) (by exact_mod_cast hbn.2)
_ = (q : β) * Real.log (L n : β) := Real.log_pow _ _
_ β€ (q : β) * (L n : β) := mul_le_mul_of_nonneg_left hLL (Nat.cast_nonneg q)
have hLQ : Real.log (layoutQ n : β) β€ L n := by
calc
Real.log (layoutQ n : β) β€ Real.log (L n : β) :=
Real.log_le_log (by linarith) (by exact_mod_cast Nat.div_le_self (L n) (layoutDen n))
_ β€ L n := hLL
have hmain := label_log_bound (n : β) (b n : β) (layoutQ n : β)
(layoutCutoff n (b n)) hN hB hQ'
have hprod : (2 * layoutCutoff n (b n) : β) * (7 + Real.log (layoutQ n : β)) β€
2 * (L n : β) * (7 + (L n : β)) := by
push_cast
gcongr
have hqb := mul_le_mul_of_nonneg_right hqL (show (0 : β) β€ L n by positivity)
nlinarith
end SubexponentialSAT.SqrtLog.Asymptotic
end OAI.Algorithms
|