Buckets:
| import OAI.LinearAlgebra.MatrixMultiplication.Separation.FiniteCover | |
| import Mathlib.Algebra.Order.Floor.Semiring | |
| import Mathlib.Analysis.SpecialFunctions.Log.Basic | |
| import Mathlib.Tactic.FieldSimp | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.NormNum | |
| import Mathlib.Tactic.Ring | |
| namespace OAI | |
| /-! Finite orbit symmetries, masks and exact recovery operations. -/ | |
| noncomputable section | |
| namespace MatrixMultiplication.RecoveryGrowth | |
| open Filter | |
| open scoped Topology BigOperators | |
| def shiftCount (b C : โ) (N : โ) : โ := | |
| โ(b + 1) * (N : โ) / Real.log ((N : โ) / (3 * C))โโ | |
| def replicationCount (b C : โ) (N : โ) : โ := | |
| 2 ^ (3 * shiftCount b C N) | |
| theorem shiftCount_pos {b C : โ} {N : โ} | |
| (hb : 0 โค b) (hC : 0 < C) (hN : 3 * C < (N : โ)) : | |
| 0 < shiftCount b C N := by | |
| have hC3 : 0 < 3 * C := by linarith | |
| have hN0 : 0 < (N : โ) := hC3.trans hN | |
| have hlog : 0 < Real.log ((N : โ) / (3 * C)) := | |
| Real.log_pos ((one_lt_div hC3).2 hN) | |
| exact Nat.ceil_pos.2 (div_pos (mul_pos (by linarith) hN0) hlog) | |
| theorem support_loss_bound {b C : โ} {N : โ} | |
| (hC : 0 < C) (hN : 3 * C < (N : โ)) : | |
| Real.exp (b * N) * (3 * C / (N : โ)) ^ shiftCount b C N โค | |
| Real.exp (-(N : โ)) := by | |
| have hC3 : 0 < 3 * C := by linarith | |
| have hN0 : 0 < (N : โ) := hC3.trans hN | |
| have hlog : 0 < Real.log ((N : โ) / (3 * C)) := | |
| Real.log_pos ((one_lt_div hC3).2 hN) | |
| have hceil : (b + 1) * (N : โ) โค | |
| (shiftCount b C N : โ) * Real.log ((N : โ) / (3 * C)) := by | |
| exact (div_le_iffโ hlog).1 (Nat.le_ceil _) | |
| have hbase : 3 * C / (N : โ) = | |
| Real.exp (-Real.log ((N : โ) / (3 * C))) := by | |
| rw [Real.exp_neg, Real.exp_log (div_pos hN0 hC3)] | |
| simp | |
| rw [hbase, โ Real.exp_nat_mul, โ Real.exp_add] | |
| apply Real.exp_le_exp.mpr | |
| nlinarith | |
| theorem cardinal_budget {b C : โ} {N S t g : โ} | |
| (hC : 0 < C) (hN : 3 * C < (N : โ)) (hg : 0 < g) | |
| (hS : (S : โ) โค Real.exp (b * N)) | |
| (ht : (t : โ) / (g : โ) โค 3 * C / (N : โ)) : | |
| S * t ^ shiftCount b C N < g ^ shiftCount b C N := by | |
| have hgr : 0 < (g : โ) := by exact_mod_cast hg | |
| have hN0 : 0 < (N : โ) := by linarith | |
| have hpow := pow_le_pow_leftโ | |
| (div_nonneg (Nat.cast_nonneg t) hgr.le) ht (shiftCount b C N) | |
| have hprob : (S : โ) * ((t : โ) / (g : โ)) ^ shiftCount b C N < 1 := by | |
| calc | |
| (S : โ) * ((t : โ) / (g : โ)) ^ shiftCount b C N โค | |
| Real.exp (b * N) * (3 * C / (N : โ)) ^ shiftCount b C N := | |
| mul_le_mul hS hpow (pow_nonneg (div_nonneg (Nat.cast_nonneg t) hgr.le) _) | |
| (Real.exp_pos _).le | |
| _ โค Real.exp (-(N : โ)) := support_loss_bound hC hN | |
| _ < 1 := by rw [Real.exp_lt_one_iff]; linarith | |
| rw [div_pow, โ mul_div_assoc] at hprob | |
| have hreal := (div_lt_iffโ (pow_pos hgr (shiftCount b C N))).1 hprob | |
| simp only [one_mul] at hreal | |
| exact_mod_cast hreal | |
| theorem exists_cover {M G : Type*} [Fintype G] [Nonempty G] | |
| [DecidableEq G] [DecidableEq M] | |
| (s : Finset M) (good : G โ M โ Prop) [โ g, DecidablePred (good g)] | |
| {b C : โ} {N : โ} (hC : 0 < C) (hN : 3 * C < (N : โ)) | |
| (hs : (s.card : โ) โค Real.exp (b * N)) | |
| (hbad : โ m โ s, | |
| ((Finset.univ.filter fun g => ยฌgood g m).card : โ) / Fintype.card G โค | |
| 3 * C / (N : โ)) : | |
| โ f : Fin (shiftCount b C N) โ G, โ m โ s, โ i, good (f i) m := by | |
| let t := โ(3 * C / (N : โ)) * Fintype.card Gโโ | |
| have hg : 0 < (Fintype.card G : โ) := by exact_mod_cast Fintype.card_pos | |
| have harg : 0 โค (3 * C / (N : โ)) * Fintype.card G := by | |
| exact mul_nonneg (div_nonneg (by linarith) (Nat.cast_nonneg N)) hg.le | |
| apply FiniteCover.exists_cover s good t (shiftCount b C N) | |
| ยท intro m hm | |
| exact Nat.le_floor ((div_le_iffโ hg).1 (hbad m hm)) | |
| ยท apply cardinal_budget hC hN Fintype.card_pos hs | |
| exact (div_le_iffโ hg).2 (Nat.floor_le harg) | |
| theorem shiftCount_div_nat_le {b C : โ} {N : โ} | |
| (hb : 0 < b) (hC : 0 < C) (hN : 3 * C < (N : โ)) : | |
| (shiftCount b C N : โ) / (N : โ) โค | |
| (b + 1) / Real.log ((N : โ) / (3 * C)) + 1 / (N : โ) := by | |
| have hC3 : 0 < 3 * C := by linarith | |
| have hN0 : 0 < (N : โ) := hC3.trans hN | |
| have hlog : 0 < Real.log ((N : โ) / (3 * C)) := | |
| Real.log_pos ((one_lt_div hC3).2 hN) | |
| have harg : 0 โค (b + 1) * (N : โ) / Real.log ((N : โ) / (3 * C)) := | |
| div_nonneg (mul_nonneg (by linarith) hN0.le) hlog.le | |
| have hceil := div_le_div_of_nonneg_right (Nat.ceil_lt_add_one harg).le hN0.le | |
| change (shiftCount b C N : โ) / (N : โ) โค _ at hceil | |
| convert hceil using 1 | |
| field_simp [hN0.ne', hlog.ne'] | |
| theorem tendsto_shiftCount_div_nat {b C : โ} (hb : 0 < b) (hC : 0 < C) : | |
| Tendsto (fun N : โ => (shiftCount b C N : โ) / (N : โ)) atTop (๐ 0) := by | |
| have hnat : Tendsto (fun N : โ => (N : โ)) atTop atTop := | |
| tendsto_natCast_atTop_atTop | |
| have hlog : Tendsto (fun N : โ => Real.log ((N : โ) / (3 * C))) atTop atTop := | |
| Real.tendsto_log_atTop.comp (hnat.atTop_div_const (by linarith)) | |
| have hmain : Tendsto (fun N : โ => | |
| (b + 1) / Real.log ((N : โ) / (3 * C))) atTop (๐ 0) := | |
| tendsto_const_nhds.div_atTop hlog | |
| have herr : Tendsto (fun N : โ => 1 / (N : โ)) atTop (๐ 0) := | |
| tendsto_const_nhds.div_atTop hnat | |
| apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds | |
| (by simpa only [add_zero] using hmain.add herr) | |
| ยท exact Eventually.of_forall fun N => div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) | |
| ยท filter_upwards [hnat.eventually_gt_atTop (3 * C)] with N hN | |
| exact shiftCount_div_nat_le hb hC hN | |
| theorem eventually_shiftCount_div_nat_le_log {b C : โ} (hb : 0 < b) (hC : 0 < C) : | |
| โแถ N : โ in atTop, (shiftCount b C N : โ) / (N : โ) โค | |
| (2 * b + 3) / Real.log (N : โ) := by | |
| have hnat : Tendsto (fun N : โ => (N : โ)) atTop atTop := | |
| tendsto_natCast_atTop_atTop | |
| have hlognat := Real.tendsto_log_atTop.comp hnat | |
| filter_upwards [hnat.eventually_gt_atTop (3 * C), hnat.eventually_gt_atTop 1, | |
| hlognat.eventually_ge_atTop (2 * Real.log (3 * C))] with N hN hN1 hlarge | |
| change 2 * Real.log (3 * C) โค Real.log (N : โ) at hlarge | |
| have hN0 : 0 < (N : โ) := lt_trans zero_lt_one hN1 | |
| have hC3 : 0 < 3 * C := by linarith | |
| have hlog : 0 < Real.log (N : โ) := Real.log_pos hN1 | |
| have hden : 0 < Real.log ((N : โ) / (3 * C)) := | |
| Real.log_pos ((one_lt_div hC3).2 hN) | |
| have hhalf : Real.log (N : โ) โค 2 * Real.log ((N : โ) / (3 * C)) := by | |
| rw [Real.log_div hN0.ne' hC3.ne'] | |
| linarith | |
| have hmain : (b + 1) / Real.log ((N : โ) / (3 * C)) โค | |
| (2 * (b + 1)) / Real.log (N : โ) := by | |
| apply (div_le_div_iffโ hden hlog).2 | |
| nlinarith [mul_le_mul_of_nonneg_left hhalf (show 0 โค b + 1 by linarith)] | |
| have herr : 1 / (N : โ) โค 1 / Real.log (N : โ) := | |
| div_le_div_of_nonneg_left zero_le_one hlog (Real.log_le_self hN0.le) | |
| calc | |
| (shiftCount b C N : โ) / (N : โ) โค | |
| (b + 1) / Real.log ((N : โ) / (3 * C)) + 1 / (N : โ) := | |
| shiftCount_div_nat_le hb hC hN | |
| _ โค (2 * (b + 1)) / Real.log (N : โ) + 1 / Real.log (N : โ) := | |
| add_le_add hmain herr | |
| _ = (2 * b + 3) / Real.log (N : โ) := by ring | |
| theorem log_replicationCount (b C : โ) (N : โ) : | |
| Real.log (replicationCount b C N : โ) = | |
| (3 * Real.log 2) * (shiftCount b C N : โ) := by | |
| simp only [replicationCount, Nat.cast_pow, Real.log_pow, Nat.cast_mul, Nat.cast_ofNat] | |
| ring | |
| theorem eventually_log_replicationCount_div_nat_le_log {b C : โ} | |
| (hb : 0 < b) (hC : 0 < C) : | |
| โแถ N : โ in atTop, Real.log (replicationCount b C N : โ) / (N : โ) โค | |
| (3 * Real.log 2 * (2 * b + 3)) / Real.log (N : โ) := by | |
| filter_upwards [eventually_shiftCount_div_nat_le_log hb hC] with N hN | |
| have hlog2 : 0 โค 3 * Real.log 2 := | |
| mul_nonneg (by norm_num) (Real.log_nonneg (by norm_num)) | |
| simpa only [log_replicationCount, mul_div_assoc] using | |
| mul_le_mul_of_nonneg_left hN hlog2 | |
| theorem tendsto_log_replicationCount_div_nat {b C : โ} (hb : 0 < b) (hC : 0 < C) : | |
| Tendsto (fun N : โ => Real.log (replicationCount b C N : โ) / (N : โ)) | |
| atTop (๐ 0) := by | |
| have h := (tendsto_shiftCount_div_nat hb hC).const_mul (3 * Real.log 2) | |
| simp only [mul_zero] at h | |
| convert h using 1 | |
| ext N | |
| simp only [log_replicationCount] | |
| ring | |
| theorem eventually_replicationCount_le_exp {b C ฮต : โ} | |
| (hb : 0 < b) (hC : 0 < C) (hฮต : 0 < ฮต) : | |
| โแถ N : โ in atTop, (replicationCount b C N : โ) โค Real.exp (ฮต * N) := by | |
| filter_upwards [(tendsto_log_replicationCount_div_nat hb hC).eventually_lt_const hฮต, | |
| eventually_gt_atTop (0 : โ)] with N hrate hN | |
| have hN0 : 0 < (N : โ) := by exact_mod_cast hN | |
| have hrep : 0 < (replicationCount b C N : โ) := by | |
| simp only [replicationCount, Nat.cast_pow, Nat.cast_ofNat] | |
| exact pow_pos (by norm_num) _ | |
| exact (Real.log_le_iff_le_exp hrep).1 ((div_lt_iffโ hN0).1 hrate).le | |
| theorem tendsto_log_prod_div_nat {J : Type*} (s : Finset J) | |
| {r : J โ โ โ โ} | |
| (hr : โ j โ s, โ N, 0 < r j N) | |
| (hlim : โ j โ s, Tendsto (fun N => Real.log (r j N : โ) / (N : โ)) | |
| atTop (๐ 0)) : | |
| Tendsto (fun N => Real.log ((โ j โ s, r j N : โ) : โ) / (N : โ)) | |
| atTop (๐ 0) := by | |
| have hsum := tendsto_finsetSum s hlim | |
| simp only [Finset.sum_const_zero] at hsum | |
| apply hsum.congr | |
| intro N | |
| rw [Nat.cast_prod, Real.log_prod (s := s) (f := fun j => (r j N : โ)) | |
| (fun j hj => Nat.cast_ne_zero.mpr (Nat.ne_of_gt (hr j hj N)))] | |
| simp only [div_eq_mul_inv, Finset.sum_mul] | |
| end MatrixMultiplication.RecoveryGrowth | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 9.68 kB
- Xet hash:
- bd65b5a6bc206cf909ae6349951ec1a422dbf5e754996505a95df0250b8d40fb
ยท
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.