File size: 3,276 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 | import OAI.Combinatorics.LowSpaceSubsetSum.Compression.BudgetedCompressionSource
namespace OAI
/-! # Paying for all stopped compression joins with the source ledger -/
namespace LowSpaceSubsetSum.CompressionData
open scoped BigOperators
variable {n : β} (D : CompressionData n)
theorem sum_pass_allowance (B : β) (e : Equiv.Perm (Fin n))
(q : CompressionSetup.PrimeSpace n) (he : D.compactTests e = true) :
(β z, BudgetedCompressionPass.allowance D.input (compressionDictionaryCapacity n) B
(D.passData e q z)) β€ inputScale D.input ^ 5 * (D.trialLedger B e q).queries +
B * (D.trialLedger B e q).copies + 16 * q.val := by
have h := Finset.sum_le_sum (fun z (_ : z β (Finset.univ : Finset (Fin q.val))) =>
D.pass_allowance B e q z he)
simpa only [trialLedger, Finset.sum_add_distrib, β Finset.mul_sum, Finset.sum_const,
Finset.card_univ, Fintype.card_fin, smul_eq_mul, Nat.mul_comm q.val 16] using h
theorem sum_pass_allowance_scale (B : β) (e : Equiv.Perm (Fin n))
(q : CompressionSetup.PrimeSpace n) (he : D.compactTests e = true) (hn : 10000 β€ n) :
(β z, BudgetedCompressionPass.allowance D.input (compressionDictionaryCapacity n) B
(D.passData e q z)) β€ inputScale D.input ^ 6 * 2 ^ ((n + 1) / 2) := by
let T := 2 ^ ((n + 1) / 2)
have hpow : (2 : β) ^ ((n : β) / 2) β€ (T : β) := by
change (2 : β) ^ ((n : β) / 2) β€ ((2 ^ ((n + 1) / 2) : β) : β)
rw [Nat.cast_pow, Nat.cast_ofNat, β Real.rpow_natCast]
apply Real.rpow_le_rpow_of_exponent_le (by norm_num)
have hh : (n : β) β€ 2 * (((n + 1) / 2 : β) : β) := by
exact_mod_cast (show n β€ 2 * ((n + 1) / 2) by omega)
linarith
have hl := D.trialLedger_half_exponential B e q (by omega)
have hqueries : (D.trialLedger B e q).queries β€ 30 * T := by
have h := hl.1.trans (mul_le_mul_of_nonneg_left hpow (by norm_num : (0 : β) β€ 30))
exact_mod_cast h
have hcopies : B * (D.trialLedger B e q).copies β€ 4 * T := by
have h := hl.2.2.1.trans (mul_le_mul_of_nonneg_left hpow (by norm_num : (0 : β) β€ 4))
exact_mod_cast h
have hprime : q.val β€ T := by
apply (Nat.le_of_mem_primesLE (Finset.mem_filter.mp q.property).1).trans
apply Nat.pow_le_pow_right (by decide)
unfold compressionPrimeExponent
omega
have hu : 10000 β€ inputScale D.input := by unfold inputScale; omega
have hu5 : 1 β€ inputScale D.input ^ 5 := Nat.one_le_pow _ _ (by omega)
have hcoef : 30 * inputScale D.input ^ 5 + 20 β€ inputScale D.input ^ 6 := by
have hh : 50 * inputScale D.input ^ 5 β€ inputScale D.input ^ 6 := by
calc
_ β€ inputScale D.input * inputScale D.input ^ 5 := Nat.mul_le_mul_right _ (by omega)
_ = _ := (pow_succ' _ _).symm
omega
calc
_ β€ inputScale D.input ^ 5 * (D.trialLedger B e q).queries +
B * (D.trialLedger B e q).copies + 16 * q.val := D.sum_pass_allowance B e q he
_ β€ (30 * inputScale D.input ^ 5 + 20) * T := by
have hmul := Nat.mul_le_mul_left (inputScale D.input ^ 5) hqueries
have hq := Nat.mul_le_mul_left 16 hprime
nlinarith only [hmul, hcopies, hq]
_ β€ inputScale D.input ^ 6 * T := Nat.mul_le_mul_right T hcoef
end LowSpaceSubsetSum.CompressionData
end OAI
|