theoremiid_expect_sum (P : FiniteLawX) (f : (I ⊕ J→X) →ℝ) :
(P.iid (I ⊕ J)).expect f=(P.iid I).expect (fun z => (P.iid J).expect (fun w => f (Sum.elim z w))) :=by
proof · 12
lines
classical
unfold expect iid pi
calc
_ = ∑z : (I→X) × (J→X), (∏ i, P.weight (z.1 i))*(∏ j, P.weight (z.2 j))*f (Sum.elim z.1 z.2) :=by
apply Fintype.sum_equiv (Equiv.sumArrowEquivProdArrow IJX)
intro z
simp only [Equiv.sumArrowEquivProdArrow_apply_fst,Equiv.sumArrowEquivProdArrow_apply_snd,Fintype.prod_sum_type]
congr 1
congr 1
funext i
cases i <;> rfl
_ = _ :=by simp only [Fintype.sum_prod_type,Finset.mul_sum,mul_assoc]
theoremiid_miss_bound (P : FiniteLawX) (A : X→Prop) (K : ℕ) {a : ℝ}
(_ha : 0≤ a) (hA : a ≤P.prob A) :
(P.iid (FinK)).prob (fun z =>∀ i, ¬A (z i)) ≤Real.exp (-a*K) :=by
proof · 11
lines
haveH:=P.iid_predictable_bound (fun _ _ x =>¬A x) (fun _ =>1-P.prob A)
(fun _ => sub_nonneg.mpr (P.prob_le_one A)) (fun _ _ => (P.prob_not A).le) KhaveH' : (P.iid (FinK)).prob (fun z =>∀ i, ¬A (z i)) ≤ (1-P.prob A)^K:=by
simpa usingH
refine H'.trans ?_
havehbase : 1-P.prob A≤Real.exp (-a) :=byhaveH:=Real.add_one_le_exp (-a)
linarith only [H,hA]
calc
(1-P.prob A)^K≤ (Real.exp (-a))^K:= pow_le_pow_left₀ (sub_nonneg.mpr (P.prob_le_one A)) hbase K
_ = Real.exp (-a*K) :=by rw [←Real.exp_nat_mul]; congr 1; ring
theoremiid_cell_miss_bound (P : FiniteLawX) (S : X→Prop) (R : X→X→Prop)
(K : ℕ) {a δ : ℝ} (ha : 0≤ a)
(hcov : P.prob (fun x =>S x ∧P.prob (fun y =>S y ∧R x y)<a) ≤ δ) :
(P.iid (FinK)).expect (fun z =>P.prob (fun x =>S x ∧∀ i, ¬(S (z i) ∧R x (z i)))) ≤
δ+Real.exp (-a*K) :=by
proof · 20
lines
classical
unfold prob
rw [expect_expect_comm]
calc
_ ≤P.expect (fun x => (ifS x ∧P.prob (fun y =>S y ∧R x y)<a then1else0)+Real.exp (-a*K)) :=by
apply expect_mono
intro x
by_cases hb : S x ∧P.prob (fun y =>S y ∧R x y)<a
· rw [ite_eq_left hb]
exact (prob_le_one _ _).trans (by linarith only [Real.exp_pos (-a*K)])
· rw [ite_eq_right hb,zero_add]
by_cases hx : S x
· havehmass : a ≤P.prob (fun y =>S y ∧R x y) := le_of_not_gt (fun h => hb ⟨hx,h⟩)
simp only [hx,true_and]
rw [expect_indicator_eq_prob]
exact P.iid_miss_bound (fun y =>S y ∧R x y) K ha hmass
· simp only [hx,false_and,ite_false,expect_zero,Real.exp_nonneg]
_ = P.prob (fun x =>S x ∧P.prob (fun y =>S y ∧R x y)<a)+Real.exp (-a*K) :=by
rw [expect_add,expect_const,expect_indicator_eq_prob]
_ ≤ _ :=by linarith only [hcov]