File size: 5,425 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 | import OAI.NumberTheory.Ostmann.Arithmetic.VariableModulusSupport
namespace OAI
/-! # The numerical rate after the actual arithmetic frequency sum -/
namespace Ostmann
open Filter
/-- The divisor constant is chosen uniformly before the history-dependent
modulus. This is the numerical estimate used by the same-assignment norm. -/
theorem arithmetic_frequency_budget_rate (n : β) (K C Ξ΅ : β) (hC : 0 β€ C) (hΞ΅ : 0 < Ξ΅) :
βαΆ m : β in atTop, β D : β, 0 β€ D β§
(β q : β, q β 0 β (q : β) β€ Real.exp (2 * C * m) β (q.divisors.card : β) β€ D) β§
β N V : β, β Ξ : β, (N : β) β€ Real.exp (C * m) β
(V : β) β€ Real.exp (Ξ + Real.sqrt (4 * m)) β
Real.exp (-(2 ^ n : β) * Ξ + K) *
((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) *
(2 * (V : β)) ^ (2 * 2 ^ n)) β€
Real.exp ((2 ^ n : β) * Ξ + Ξ΅ * m) := by
let r : β := 2 ^ n
have hr : (0 : β) < r := by exact_mod_cast (Nat.two_pow_pos n)
let Ξ΄ : β := Ξ΅ / (2 * r)
have hΞ΄ : 0 < Ξ΄ := div_pos hΞ΅ (by positivity)
have hΞ΄r : Ξ΄ * r = Ξ΅ / 2 := by dsimp [Ξ΄]; field_simp
obtain β¨M, hMβ© := leaf_frequency_budget_sublinear r K (Ξ΅ / 8) (by positivity)
filter_upwards [frequency_budget_subexponential C Ξ΄ hC hΞ΄,
eventually_ge_atTop (M / 4), eventually_ge_atTop (0 : β)] with m hrate hm hm0
obtain β¨D, hD, hdiv, hcostβ© := hrate
refine β¨D, hD, hdiv, ?_β©
intro N V Ξ hN hV
have hC0 : 0 β€ 8 * D ^ 4 * (1 + Real.log N) ^ 3 := by
have := Real.log_natCast_nonneg N
positivity
have hnode : (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) β€
Real.exp ((Ξ΅ / 2) * m) := by
calc
_ β€ Real.exp (Ξ΄ * m) ^ (r - 1) := pow_le_pow_leftβ hC0 (hcost N hN) _
_ = Real.exp ((r - 1 : β) * (Ξ΄ * m)) := (Real.exp_nat_mul _ _).symm
_ β€ _ := by
apply Real.exp_le_exp.mpr
have hcount : ((r - 1 : β) : β) β€ r := by exact_mod_cast Nat.sub_le r 1
have h := mul_le_mul_of_nonneg_right hcount (mul_nonneg hΞ΄.le hm0)
nlinarith [hΞ΄r]
have hleaf : (2 * (V : β)) ^ (2 * r) * Real.exp (-(r : β) * Ξ + K) β€
Real.exp ((r : β) * Ξ + (Ξ΅ / 2) * m) := by
convert hM (4 * m) (by linarith) Ξ V hV using 1
congr 1
ring
calc
_ = (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) *
((2 * (V : β)) ^ (2 * r) * Real.exp (-(r : β) * Ξ + K)) := by ring
_ β€ Real.exp ((Ξ΅ / 2) * m) * Real.exp ((r : β) * Ξ + (Ξ΅ / 2) * m) :=
mul_le_mul hnode hleaf (by positivity) (Real.exp_pos _).le
_ = _ := by rw [β Real.exp_add]; dsimp [r]; congr 1; ring
/-- There are `r*m` bulk Page factors and `m` spectators. Their combined
loss is exactly `2 * 6^(r*m)`, independently of the depth. -/
theorem arithmetic_norm_page_spectator_cost (n m : β) :
(2 : β) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * m) =
2 * Real.exp (Real.log 6 * (2 ^ n : β) * m) := by
rw [mul_right_comm _ 2, β mul_pow, show (2 : β) * 3 = 6 by norm_num, mul_comm _ 2]
congr 1
rw [show Real.log 6 * (2 ^ n : β) * m = ((2 ^ n * m : β) : β) * Real.log 6 by
push_cast
ring, Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : β) < 6)]
/-- Fixed profile constants are absorbed without changing the coefficient
`log 6` of the bulk cost. -/
theorem arithmetic_norm_budget_rate (n : β) (A C Ξ΅ : β) (hA : 0 β€ A) (hC : 0 β€ C) (hΞ΅ : 0 < Ξ΅) :
βαΆ m : β in atTop, β D : β, 0 β€ D β§
(β q : β, q β 0 β (q : β) β€ Real.exp (2 * C * m) β (q.divisors.card : β) β€ D) β§
β N V : β, β Ξ : β, (N : β) β€ Real.exp (C * m) β
(V : β) β€ Real.exp (Ξ + Real.sqrt (4 * m)) β
(A * Real.exp (-(2 ^ n : β) * Ξ)) *
((2 * Real.exp (Real.log 6 * (2 ^ n : β) * m)) *
((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) *
(2 * (V : β)) ^ (2 * 2 ^ n))) β€
Real.exp ((2 ^ n : β) * Ξ + Real.log 6 * (2 ^ n : β) * m + Ξ΅ * m) := by
let K := Real.log (2 * A + 1)
have hK : 2 * A β€ Real.exp K := by
dsimp only [K]
rw [Real.exp_log (by positivity : 0 < 2 * A + 1)]
linarith
filter_upwards [arithmetic_frequency_budget_rate n K C Ξ΅ hC hΞ΅] with m hm
obtain β¨D, hD, hdiv, hcostβ© := hm
refine β¨D, hD, hdiv, ?_β©
intro N V Ξ hN hV
have hb : 0 β€ (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) *
(2 * (V : β)) ^ (2 * 2 ^ n) := by
have := Real.log_natCast_nonneg N
positivity
calc
_ = Real.exp (Real.log 6 * (2 ^ n : β) * m) *
((2 * A) * Real.exp (-(2 ^ n : β) * Ξ) *
((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) *
(2 * (V : β)) ^ (2 * 2 ^ n))) := by ring
_ β€ Real.exp (Real.log 6 * (2 ^ n : β) * m) *
(Real.exp (-(2 ^ n : β) * Ξ + K) *
((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) *
(2 * (V : β)) ^ (2 * 2 ^ n))) := by
apply mul_le_mul_of_nonneg_left _ (Real.exp_pos _).le
rw [Real.exp_add]
exact mul_le_mul_of_nonneg_right
((mul_le_mul_of_nonneg_right hK (Real.exp_pos _).le).trans_eq (mul_comm _ _)) hb
_ β€ Real.exp (Real.log 6 * (2 ^ n : β) * m) *
Real.exp ((2 ^ n : β) * Ξ + Ξ΅ * m) :=
mul_le_mul_of_nonneg_left (hcost N V Ξ hN hV) (Real.exp_pos _).le
_ = _ := by rw [β Real.exp_add]; congr 1; ring
end Ostmann
end OAI
|