Skip to content

Commit 8c4810d

Browse files
committed
removed spurious formatting changes
1 parent 01004c0 commit 8c4810d

1 file changed

Lines changed: 23 additions & 41 deletions

File tree

β€ŽProbability/Probability/Basic.leanβ€Ž

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1818
variable {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

3131
theorem in_prob (P : Findist n) : Prob β„™[B // P] := ⟨ge_zero, le_one⟩
3232

@@ -36,17 +36,17 @@ end Findist
3636

3737
variable {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

4343
theorem 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

5151
variable {n : β„•} {P : Findist n}
5252
variable {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

6767
theorem 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

9880
variable {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

Comments
Β (0)