File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -501,16 +501,18 @@ theorem law_total_exp : 𝔼[𝔼[X |ᵣ L // P] // P] = 𝔼[X // P] :=
501501 _ = ∑ i : Fin k, 𝔼[X * (L =ᵢ i) // P] := by apply Fintype.sum_congr; intro i; apply exp_congr; rw[indi_eq_indr]
502502 _ = 𝔼[X // P] := by rw [←exp_decompose]
503503
504- example : ∀x, x ∈ Finset.univ.image X ↔ x ∈ (List.ofFn X |> List.dedup) :=
505- by intro x
506- constructor
507- · intro h
508- refine List.mem_dedup.mpr ?_
509- rw [Fin.univ_image_def] at h
510- rw [List.mem_toFinset] at h
511- exact h
512- · intro h
513- sorry
504+ --- shows that using a set and list is the same
505+ lemma finset_image_eq_list_map_dedup : ∀x, x ∈ Finset.univ.image X ↔ x ∈ (List.ofFn X |> List.dedup) :=
506+ by intro x; constructor <;> simp [Fin.univ_image_def,List.mem_toFinset]
507+
508+
509+ #check Finset.sum
510+
511+
512+ example (f : ℚ → ℚ) : (∑ y ∈ (Finset.univ.image X), f y) = ((List.ofFn X |> List.dedup).map f).sum := sorry
513+
514+
515+
514516
515517/-- Shows that our definition of expectation is correct -/
516518theorem expect_def_correct : 𝔼[ X // P] = ∑ y ∈ (Finset.univ.image X), (ℙ[ X =ᵣ y // P] * y) := by
You can’t perform that action at this time.
0 commit comments