import Mathlib import OAI.Probability.SKBarriers.Coverage.CoverageScale import OAI.Probability.SKBarriers.Dynamics.GreedyNumerics import OAI.Probability.SKBarriers.Dynamics.BankCardinality namespace OAI section noncomputable section open scoped BigOperators Topology open Classical MeasureTheory Filter Set namespace SK.Analytic def scheduledBankSize (c : ℕ → ℝ) (B n : ℕ) {p : ℕ} (j : Fin p) : ℕ := ⌈Real.exp ((c (j.val%B)+1)*levelLogScale n)⌉₊ theorem scheduledBankSize_pos (c : ℕ → ℝ) (B n : ℕ) {p : ℕ} (j : Fin p) : 0 A*levelLogScale n*Real.exp (-levelLogScale n)) atTop (𝓝 0) := by simpa only [levelLogScale,Real.rpow_one,neg_one_mul,mul_assoc,mul_zero,Function.comp_apply] using H filter_upwards [H0.eventually_le_const zero_lt_one] with n hn have HH := mul_le_mul_of_nonneg_right hn (Real.exp_pos (levelLogScale n)).le simpa only [mul_assoc,← Real.exp_add,neg_add_cancel,Real.exp_zero,mul_one,one_mul] using HH theorem greedy_level_count_bound {B : ℕ} (hB : 0 ceil_exp_bound (hc _) (by linarith only [hL]))).trans ?_ calc _ ≤ Real.exp L*Real.exp (A*L) := mul_le_mul_of_nonneg_right hp (Real.exp_pos _).le _ = _ := by rw [← Real.exp_add]; congr 1; ring have he1 : 1≤Real.exp ((A+1)*L) := Real.one_le_exp_iff.mpr (by positivity) have HN3 : N^3≤Real.exp (3*(A+1)*L) := by have H := pow_le_pow_left₀ hN0 hN 3 simpa only [← Real.exp_nat_mul,Nat.cast_ofNat,mul_assoc] using H have HN2 : N^2≤Real.exp (3*(A+1)*L) := by have H := pow_le_pow_left₀ hN0 hN 2 have HH : (Real.exp ((A+1)*L))^2≤(Real.exp ((A+1)*L))^3 := pow_le_pow_right₀ he1 (by decide) exact (H.trans HH).trans_eq (by rw [← Real.exp_nat_mul]; congr 1; ring) have HC : (8*N^3+48*N^2)*v≤56*Real.exp (-17*L) := by calc _ ≤ (56*Real.exp (3*(A+1)*L))*Real.exp (-(3*A+20)*L) := mul_le_mul (by linarith only [HN3,HN2]) hv hv0 (by positivity) _ = _ := by rw [mul_assoc,← Real.exp_add]; congr 2; ring have HE56 : (56:ℝ)≤Real.exp (13*L) := by have H := Real.add_one_le_exp (13*L) dsimp only [L] at H linarith only [H,hL] refine HC.trans ?_ calc _ ≤ Real.exp (13*L)*Real.exp (-17*L) := mul_le_mul_of_nonneg_right HE56 (Real.exp_pos _).le _ = _ := by rw [← Real.exp_add]; congr 1; ring end SK.Analytic end end end OAI