@@ -8,7 +8,7 @@ import Mathlib.Data.Fintype.BigOperators
88 # Basic properties for probability spaces and expectations
99
1010 The main results:
11- - LOTUS: The law of the unconscious statistician
11+ - LOTUS: The law of the unconscious statistician
1212 - The law of total expectations
1313 - The law of total probabilities
1414 -/
@@ -17,16 +17,16 @@ namespace Findist
1717
1818variable {n : β} {P : Findist n} {B : FinRV n Bool}
1919
20- theorem ge_zero : 0 β€ β[B // P] :=
20+ theorem ge_zero : 0 β€ β[B // P] :=
2121 by rw [prob_eq_exp_ind]
22- calc 0 = πΌ[0 // P] := exp_const.symm
22+ calc 0 = πΌ[0 // P] := exp_const.symm
2323 _ β€ πΌ[π β B//P] := exp_monotone ind_nneg
24+
2425
25-
26- theorem le_one : β[B // P] β€ 1 :=
26+ theorem le_one : β[B // P] β€ 1 :=
2727 by rw [prob_eq_exp_ind]
28- calc πΌ[π β B//P] β€ πΌ[1 // P] := exp_monotone ind_le_one
29- _ = 1 := exp_const
28+ calc πΌ[π β B//P] β€ πΌ[1 // P] := exp_monotone ind_le_one
29+ _ = 1 := exp_const
3030
3131theorem in_prob (P : Findist n) : Prob β[B // P] := β¨ge_zero, le_oneβ©
3232
@@ -36,17 +36,17 @@ end Findist
3636
3737variable {n : β} {P : Findist n} {B C : FinRV n Bool}
3838
39- theorem prob_compl_sums_to_one : β[B // P] + β[Β¬α΅£B // P] = 1 :=
39+ theorem prob_compl_sums_to_one : β[B // P] + β[Β¬α΅£B // P] = 1 :=
4040 by rw [prob_eq_exp_ind, prob_eq_exp_ind, βexp_dists_add, one_of_ind_bool_or_not]
41- exact exp_one
41+ exact exp_one
4242
4343theorem prob_compl_one_minus : β[Β¬α΅£B // P] = 1 - β[B // P] :=
44- by rw [βprob_compl_sums_to_one (P:=P) (B:=B)]; ring
44+ by rw [βprob_compl_sums_to_one (P:=P) (B:=B)]; ring
4545
4646
4747------------------------------ Expectation ---------------------------
4848
49- section Expectation
49+ section Expectation
5050
5151variable {n : β} {P : Findist n}
5252variable {k : β} {X : FinRV n β} {B : FinRV n Bool} {L : FinRV n (Fin k)}
@@ -59,56 +59,38 @@ theorem LOTUS : πΌ[g β L // P ] = β i, β[L =α΅£ i // P] * (g i) :=
5959 intro i
6060 rewrite [βindi_eq_indr]
6161 rewrite [βexp_cond_eq_def (X := g β L) ]
62- by_cases! h : β[L =α΅£ i // P] = 0
62+ by_cases! h : β[L =α΅£ i // P] = 0
6363 Β· rw [h]; simp only [mul_zero, zero_mul]
6464 Β· rw [exp_cond_const i h ]
65- ring
65+ ring
6666
6767theorem law_total_exp : πΌ[πΌ[X |α΅£ L // P] // P] = πΌ[X // P] :=
6868 let g i := πΌ[X | L =α΅£ i // P]
6969 calc
7070 πΌ[πΌ[X |α΅£ L // P] // P ] = β i , β[ L =α΅£ i // P] * πΌ[ X | L =α΅£ i // P ] := LOTUS g
71- _ = β i , πΌ[ X | L =α΅£ i // P ] * β[ L =α΅£ i // P] := by apply Fintype.sum_congr; intro i; ring
71+ _ = β i , πΌ[ X | L =α΅£ i // P ] * β[ L =α΅£ i // P] := by apply Fintype.sum_congr; intro i; ring
7272 _ = β i : Fin k, πΌ[X * (π β (L =α΅£ i)) // P] := by apply Fintype.sum_congr; exact fun a β¦ exp_cond_eq_def
73- _ = β i : Fin k, πΌ[X * (L =α΅’ i) // P] := by apply Fintype.sum_congr; intro i; apply exp_congr; rw[indi_eq_indr]
73+ _ = β i : Fin k, πΌ[X * (L =α΅’ i) // P] := by apply Fintype.sum_congr; intro i; apply exp_congr; rw[indi_eq_indr]
7474 _ = πΌ[X // P] := by rw [βexp_decompose]
7575
76- end Expectation
77-
78-
79- namespace Nondegeneracy
80-
81- -- Absolute value for random variables
82- def abs (X : FinRV n β) : FinRV n β :=
83- fun i => |X i|
84-
85- /-- **Non-degeneracy** -/
86- theorem exp_abs_eq_zero_iff_prob_one_of_zero :
87- πΌ[abs X // P] = 0 β β[X =α΅£ (0 : β) // P] = 1 := by
88- sorry
89-
90- end Nondegeneracy
76+ end Expectation
9177
92-
93-
94-
95-
96- section Probability
78+ section Probability
9779
9880variable {k : β} {L : FinRV n (Fin k)}
9981
10082/-- The law of total probabilities -/
101- theorem law_of_total_probs : β[B // P] = β i, β[B * (L =α΅£ i) // P] :=
83+ theorem law_of_total_probs : β[B // P] = β i, β[B * (L =α΅£ i) // P] :=
10284 by rewrite [prob_eq_exp_ind, rv_decompose (πβB) L, exp_additive]
10385 apply Fintype.sum_congr
104- intro i
105- rewrite [prob_eq_exp_ind]
86+ intro i
87+ rewrite [prob_eq_exp_ind]
10688 apply exp_congr
10789 ext Ο
108- by_cases h1 : L Ο = i
90+ by_cases h1 : L Ο = i
10991 repeat by_cases h2 : B Ο; repeat simp [h1, h2, π, indicator ]
11092
11193
112- end Probability
94+ end Probability
11395
114- #lint
96+ #lint
0 commit comments