File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,14 +40,19 @@ end Findist
4040
4141namespace Pr
4242
43- variable {n : ℕ} (P : Findist n) (B C : FinRV n Bool)
43+ variable {n : ℕ} {P : Findist n} {B C : FinRV n Bool}
44+
4445
4546theorem prob_compl_sums_to_one : ℙ[B // P] + ℙ[¬ᵣB // P] = 1 :=
46- by unfold probability
47- sorry
47+ by rw [Ex.prob_eq_exp_ind, Ex.prob_eq_exp_ind]
48+ rw [←exp_dists_add]
49+ rw [one_of_ind_bool_or_not]
50+ exact exp_one
51+
52+
4853
4954theorem prob_compl_one_minus : ℙ[¬ᵣB // P] = 1 - ℙ[B // P] :=
50- by have := prob_compl_sums_to_one P B
55+ by have := prob_compl_sums_to_one (P:=P) (B:=B)
5156 linarith
5257
5358
Original file line number Diff line number Diff line change @@ -193,7 +193,14 @@ theorem ind_le_one : 𝕀∘B ≤ (1 : FinRV n ℚ) :=
193193theorem one_of_true : 𝕀 ∘ (1 : Fin n → Bool) = (1 : Fin n → ℚ) := by ext; simp [𝕀, indicator]
194194
195195theorem one_of_bool_or_not : B + (¬ᵣ B) = (1 : FinRV n Bool) := by ext ω; unfold FinRV.not; simp
196-
196+
197+ theorem one_of_ind_bool_or_not : (𝕀∘B) + (𝕀∘(¬ᵣ B)) = (1 : FinRV n ℚ) :=
198+ by ext ω
199+ unfold FinRV.not 𝕀 indicator not
200+ by_cases h : B ω
201+ · simp [h]
202+ · simp [h]
203+
197204variable {X Y: FinRV n ℚ}
198205
199206theorem rv_le_abs : X ≤ abs ∘ X := by intro i; simp [le_abs_self (X i)]
@@ -296,6 +303,11 @@ end Ex
296303section Expectation_properties
297304variable {P : Findist n} {X Y Z: FinRV n ℚ} {B : FinRV n Bool}
298305
306+ theorem exp_congr : (X = Y) → 𝔼[X // P] = 𝔼[Y // P] :=
307+ by intro h
308+ unfold Ex.expect dotProduct
309+ apply Fintype.sum_congr
310+ simp_all
299311
300312theorem exp_dists_add : 𝔼[X + Y // P] = 𝔼[X // P] + 𝔼[Y // P] := by simp [Ex.expect]
301313
@@ -312,6 +324,10 @@ theorem exp_const : 𝔼[(fun _ ↦ c) // P] = c :=
312324 rw [dotProduct_comm, P.prob]
313325 simp
314326
327+ theorem exp_one : 𝔼[ 1 // P] = 1 :=
328+ by calc 𝔼[ 1 // P] = 𝔼[ (fun _ ↦ 1 ) // P] := rfl
329+ _ = 1 := exp_const
330+
315331theorem exp_prod_const : 𝔼[c • X // P] = c * 𝔼[X // P] := by simp only [Ex.expect, dotProduct_smul, smul_eq_mul]
316332
317333lemma constant_mul_eq_smul : (fun ω ↦ c * X ω) = c • X := rfl
You can’t perform that action at this time.
0 commit comments