Skip to content

Commit d79b3de

Browse files
committed
Merge branch 'main' into lotus
2 parents 4d8f45c + e802f1a commit d79b3de

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

Probability/Probability/Basic.lean

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ theorem condexp_pmf : 𝔼[ X |ᵣ L // P] = (fun i ↦ 𝔼[ X | (L =ᵣ i) /
156156
by sorry
157157

158158

159-
theorem expexp : 𝔼[ 𝔼[ X |ᵣ L // P] // P ] = ∑ i : Fin k, 𝔼[ X | L =ᵣ i // P] * ℙ[ L =ᵣ i // P] := sorry
159+
theorem expexp : 𝔼[ 𝔼[ X |ᵣ L // P] // P ] = ∑ i : Fin k, 𝔼[ X | L =ᵣ i // P] * ℙ[ L =ᵣ i // P] := by
160+
let pmf i := ℙ[ L =ᵣ i // P]
161+
have h_pmf : PMF pmf P L := fun i ↦ rfl
162+
rw [condexp_pmf, LOTUS h_pmf]
163+
apply Finset.sum_congr rfl
164+
intro i _
165+
rw [mul_comm]
160166

161167
-- STEP 2:
162168

@@ -175,14 +181,15 @@ theorem exp_prod_μ : 𝔼[X | B // P] * ℙ[B // P] = 𝔼[X * (𝕀 ∘ B) //
175181

176182
-- STEP 3:
177183
-- proves that μ distributes over the random variables
184+
theorem μ_dist (h : Fin k → FinRV n ℚ) : ∑ i : Fin k, 𝔼[X * (h i) // P] = 𝔼[X * (fun ω ↦ ∑ i : Fin k, (h i) ω) // P] := sorry
178185

179186

180-
theorem μ_dist (h : Fin k → FinRV n ℚ) :
181-
∑ i : Fin k, 𝔼[ X * (h i) // P] = 𝔼[X * (fun ω ↦ ∑ i : Fin k, (h i) ω) // P] := sorry
187+
-- TODO: need to sum all probabilities
188+
182189

183190
theorem fin_sum : ∀ ω : Fin n, ∑ i : Fin k, (𝕀 ∘ (L =ᵣ i)) ω = (1:ℚ) :=
184191
by have := fin_sum_g 1 (L := L)
185-
simp_all
192+
simp_all only [Pi.one_apply, Function.comp_apply, FinRV.eq, one_mul, implies_true]
186193

187194
theorem exp_eq_exp_cond_true : 𝔼[X // P] = 𝔼[X * (fun ω ↦ 1 ) // P] := sorry
188195

0 commit comments

Comments
 (0)