Require Import Morphisms.
Require Import Equivalence.
Require Import Program.Basics.
Require Import Lra Lia.
Require Import Classical.
Require Import FunctionalExtensionality.
Require Import hilbert.
Require Export Expectation.
Require Import quotient_space.
Require Import Almost.
Require Import utils.Utils.
Require Import List.
Set Bullet Behavior "
Strict Subproofs".
Section fe.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Class IsFiniteExpectation (
rv_X:
Ts->
R)
:=
is_finite_expectation :
match Expectation rv_X with
|
Some (
Finite _) =>
True
|
_ =>
False
end.
Lemma IsFiniteExpectation_Finite (
rv_X:
Ts->
R)
{
isfe:
IsFiniteExpectation rv_X} :
{
x :
R |
Expectation rv_X =
Some (
Finite x)}.
Proof.
red in isfe.
match_destr_in isfe; try contradiction.
destruct r; try contradiction.
eauto.
Qed.
Definition FiniteExpectation (
rv_X:
Ts->
R)
{
isfe:
IsFiniteExpectation rv_X} :
R
:=
proj1_sig (
IsFiniteExpectation_Finite rv_X).
Ltac simpl_finite
:=
repeat match goal with
| [|-
context [
proj1_sig ?
x]] =>
destruct x;
simpl
| [
H:
context [
proj1_sig ?
x] |-
_] =>
destruct x;
simpl in H
end.
Lemma FiniteExpectation_Expectation (
rv_X:
Ts->
R)
{
isfe:
IsFiniteExpectation rv_X} :
Expectation rv_X =
Some (
Finite (
FiniteExpectation rv_X)).
Proof.
Instance Expectation_IsFiniteExpectation (
rv_X:
Ts->
R)
n :
Expectation rv_X =
Some (
Finite n) ->
IsFiniteExpectation rv_X.
Proof.
intros HH.
red.
now rewrite HH.
Qed.
Lemma Expectation_FiniteExpectation (
rv_X:
Ts->
R)
n
{
isfe:
IsFiniteExpectation rv_X} :
Expectation rv_X =
Some (
Finite n) ->
FiniteExpectation rv_X =
n.
Proof.
Lemma Expectation_FiniteExpectation' (
rv_X:
Ts->
R)
n
(
eqq:
Expectation rv_X =
Some (
Finite n)) :
@
FiniteExpectation rv_X (
Expectation_IsFiniteExpectation rv_X n eqq) =
n.
Proof.
Lemma FiniteExpectation_pf_irrel rv_X
{
isfe1:
IsFiniteExpectation rv_X}
{
isfe2:
IsFiniteExpectation rv_X} :
@
FiniteExpectation rv_X isfe1 = @
FiniteExpectation rv_X isfe2.
Proof.
Lemma FiniteExpectation_ext rv_X1 rv_X2
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2}
(
eqq:
rv_eq rv_X1 rv_X2)
:
@
FiniteExpectation rv_X1 isfe1 = @
FiniteExpectation rv_X2 isfe2.
Proof.
Global Instance IsFiniteExpectation_proper
:
Proper (
rv_eq ==>
iff)
IsFiniteExpectation.
Proof.
Lemma FiniteExpectation_ext_alt rv_X1 rv_X2
{
isfe1:
IsFiniteExpectation rv_X1}
(
eqq:
rv_eq rv_X1 rv_X2)
:
@
FiniteExpectation rv_X1 isfe1 =
@
FiniteExpectation rv_X2 (
proj1 (
IsFiniteExpectation_proper _ _ eqq)
isfe1).
Proof.
Global Instance IsFiniteExpectation_const c :
IsFiniteExpectation (
const c).
Proof.
Lemma FiniteExpectation_const c :
FiniteExpectation (
const c) =
c.
Proof.
Hint Rewrite FiniteExpectation_const :
prob.
Global Instance IsFiniteExpectation_plus
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
IsFiniteExpectation (
rvplus rv_X1 rv_X2).
Proof.
red.
red in isfe1,
isfe2.
generalize (
Expectation_sum_finite rv_X1 rv_X2).
repeat match_destr_in isfe1;
try contradiction.
repeat match_destr_in isfe2;
try contradiction.
intros HH.
now rewrite (
HH _ _ (
eq_refl _) (
eq_refl _)).
Qed.
Lemma FiniteExpectation_plus
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
FiniteExpectation (
rvplus rv_X1 rv_X2) =
FiniteExpectation rv_X1 +
FiniteExpectation rv_X2.
Proof.
Hint Rewrite FiniteExpectation_plus :
prob.
Lemma FiniteExpectation_plus':
forall (
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1} {
rv2 :
RandomVariable dom borel_sa rv_X2}
{
rv12 :
RandomVariable dom borel_sa (
rvplus rv_X1 rv_X2)}
{
isfe1 :
IsFiniteExpectation rv_X1} {
isfe2 :
IsFiniteExpectation rv_X2}
{
isfe12 :
IsFiniteExpectation (
rvplus rv_X1 rv_X2)},
FiniteExpectation (
rvplus rv_X1 rv_X2) =
FiniteExpectation rv_X1 +
FiniteExpectation rv_X2.
Proof.
Global Instance IsFiniteExpectation_scale (
c:
R) (
rv_X:
Ts->
R)
{
isfe:
IsFiniteExpectation rv_X} :
IsFiniteExpectation (
rvscale c rv_X).
Proof.
Lemma IsFiniteExpectation_scale_inv c rv_X
{
isfe:
IsFiniteExpectation (
rvscale c rv_X)} :
c <> 0 ->
IsFiniteExpectation rv_X.
Proof.
Lemma FiniteExpectation_scale c rv_X
{
isfe:
IsFiniteExpectation rv_X} :
FiniteExpectation (
rvscale c rv_X) =
c *
FiniteExpectation rv_X.
Proof.
Hint Rewrite FiniteExpectation_scale :
prob.
Lemma FiniteExpectation_scale'
c rv_X
{
isfe:
IsFiniteExpectation rv_X} {
isfe2:
IsFiniteExpectation (
rvscale c rv_X)} :
FiniteExpectation (
rvscale c rv_X) =
c *
FiniteExpectation rv_X.
Proof.
Global Instance IsFiniteExpectation_opp rv_X
{
isfe:
IsFiniteExpectation rv_X} :
IsFiniteExpectation (
rvopp rv_X).
Proof.
Lemma IsFiniteExpectation_opp_inv rv_X
{
isfe:
IsFiniteExpectation (
rvopp rv_X)} :
IsFiniteExpectation rv_X.
Proof.
Lemma FiniteExpectation_opp rv_X
{
isfe:
IsFiniteExpectation rv_X} :
FiniteExpectation (
rvopp rv_X) = -1 *
FiniteExpectation rv_X.
Proof.
Hint Rewrite FiniteExpectation_opp :
prob.
Global Instance IsFiniteExpectation_minus
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
IsFiniteExpectation (
rvminus rv_X1 rv_X2).
Proof.
unfold rvminus.
typeclasses eauto.
Qed.
Lemma FiniteExpectation_minus
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
FiniteExpectation (
rvminus rv_X1 rv_X2) =
FiniteExpectation rv_X1 -
FiniteExpectation rv_X2.
Proof.
Hint Rewrite FiniteExpectation_plus :
prob.
Lemma IsFiniteExpectation_proper_almostR2 rv_X1 rv_X2
{
rrv1:
RandomVariable dom borel_sa rv_X1}
{
rrv2:
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
:
almostR2 prts eq rv_X1 rv_X2 ->
IsFiniteExpectation rv_X2.
Proof.
Lemma FiniteExpectation_proper_almostR2 rv_X1 rv_X2
{
rrv1:
RandomVariable dom borel_sa rv_X1}
{
rrv2:
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2}
:
almostR2 prts eq rv_X1 rv_X2 ->
FiniteExpectation rv_X1 =
FiniteExpectation rv_X2.
Proof.
Lemma FiniteExpectation_le rv_X1 rv_X2
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2}
:
rv_le rv_X1 rv_X2 ->
FiniteExpectation rv_X1 <=
FiniteExpectation rv_X2.
Proof.
Lemma FiniteExpectation_ale rv_X1 rv_X2
{
rrv1:
RandomVariable dom borel_sa rv_X1}
{
rrv2:
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2}
:
almostR2 prts Rle rv_X1 rv_X2 ->
FiniteExpectation rv_X1 <=
FiniteExpectation rv_X2.
Proof.
Lemma IsFiniteExpectation_bounded rv_X1 rv_X2 rv_X3
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X3}
:
rv_le rv_X1 rv_X2 ->
rv_le rv_X2 rv_X3 ->
IsFiniteExpectation rv_X2.
Proof.
intros.
unfold IsFiniteExpectation in *.
unfold Expectation in *.
unfold Rbar_minus'
in *.
match_case_in isfe1
; [
intros ?
eqq1 |
intros eqq1]
;
rewrite eqq1 in isfe1
;
try contradiction.
match_case_in isfe2
; [
intros ?
eqq2 |
intros eqq2]
;
rewrite eqq2 in isfe2
;
try contradiction.
match_destr_in isfe1;
try contradiction.
match_destr_in isfe2;
try contradiction.
apply Finite_Rbar_plus'
in eqq1.
apply Finite_Rbar_plus'
in eqq2.
destruct eqq1 as [
eqq1pos eqq1neg].
destruct eqq2 as [
eqq2pos eqq2neg].
generalize (
rv_le_pos_fun_part _ _ H0).
generalize (
rv_le_neg_fun_part _ _ H).
intros.
rewrite Finite_Rbar_opp in eqq1neg.
rewrite <- (
Finite_NonnegExpectation_le _ _ _ _ H1);
trivial.
rewrite <- (
Finite_NonnegExpectation_le _ _ _ _ H2);
simpl;
trivial.
Qed.
Global Instance IsFiniteExpectation_min
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
IsFiniteExpectation (
rvmin rv_X1 rv_X2).
Proof.
Global Instance IsFiniteExpectation_max
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
IsFiniteExpectation (
rvmax rv_X1 rv_X2).
Proof.
Global Instance IsFiniteExpectation_case
(
c:
Ts ->
bool) (
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
isfe1:
IsFiniteExpectation rv_X1}
{
isfe2:
IsFiniteExpectation rv_X2} :
IsFiniteExpectation (
rvchoice c rv_X1 rv_X2).
Proof.
Lemma FiniteExpectation_pos (
rv_X :
Ts ->
R)
{
nnf :
NonnegativeFunction rv_X}
{
isfe:
IsFiniteExpectation rv_X} :
0 <=
FiniteExpectation rv_X.
Proof.
Lemma FiniteExpectation_zero_pos'
(
X :
Ts ->
R)
{
rv :
RandomVariable dom borel_sa X}
{
pofrf :
NonnegativeFunction X}
{
isfe:
IsFiniteExpectation X} :
FiniteExpectation X = 0%
R ->
ps_P (
preimage_singleton X 0) = 1.
Proof.
Lemma FiniteExpectation_zero_pos
(
X :
Ts ->
R)
{
rv :
RandomVariable dom borel_sa X}
{
pofrf :
NonnegativeFunction X}
{
isfe:
IsFiniteExpectation X} :
FiniteExpectation X = 0%
R ->
almostR2 prts eq X (
const 0).
Proof.
intros eqq1.
apply (
FiniteExpectation_zero_pos'
X)
in eqq1.
exists (
preimage_singleton X 0).
split;
trivial.
Qed.
Lemma FiniteExpectation_sq_nneg (
f :
Ts ->
R)
(
svy2 :
IsFiniteExpectation (
rvsqr f))
:
0 <=
FiniteExpectation (
rvsqr f).
Proof.
Instance series_rv_pos
(
Xn :
nat ->
Ts ->
R)
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n))
(
is_fin_lim :
forall omega,
is_finite (
Lim_seq (
sum_n (
fun n =>
Xn n omega)))):
NonnegativeFunction (
fun omega =>
Lim_seq (
sum_n (
fun n =>
Xn n omega))).
Proof.
Global Instance IsFiniteExpectation_sum (
Xn :
nat ->
Ts ->
R)
{
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n)}
{
isfe:
forall (
n:
nat),
IsFiniteExpectation (
Xn n)} :
forall n,
IsFiniteExpectation (
rvsum Xn n).
Proof.
Lemma sum_expectation
(
Xn :
nat ->
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n))
(
isfe :
forall n,
IsFiniteExpectation (
Xn n)) :
forall (
n:
nat),
sum_n (
fun n0 :
nat =>
FiniteExpectation (
Xn n0))
n =
FiniteExpectation (
rvsum Xn n).
Proof.
Lemma FiniteNonnegExpectation (
X:
Ts->
R)
{
posX:
NonnegativeFunction X}
{
isfeX:
IsFiniteExpectation X} :
FiniteExpectation X =
real (
NonnegExpectation X).
Proof.
Lemma FiniteNonnegExpectation_alt (
X:
Ts->
R)
{
posX:
NonnegativeFunction X}
{
isfeX:
IsFiniteExpectation X} :
Finite (
FiniteExpectation X) = (
NonnegExpectation X).
Proof.
Lemma FiniteNonnegExpectation_real (
X:
Ts->
R)
{
posX:
NonnegativeFunction X}
{
isfeX:
IsFiniteExpectation X} :
FiniteExpectation X =
real (
NonnegExpectation X).
Proof.
Lemma IsFiniteNonnegExpectation (
X:
Ts->
R)
{
posX:
NonnegativeFunction X}
{
isfeX:
IsFiniteExpectation X} :
is_finite (
NonnegExpectation X).
Proof.
red in isfeX.
rewrite Expectation_pos_pofrf with (
nnf:=
posX)
in isfeX.
match_destr_in isfeX;
try tauto.
reflexivity.
Qed.
Lemma monotone_convergence_FiniteExpectation
(
X :
Ts ->
R )
(
Xn :
nat ->
Ts ->
R)
(
rvx :
RandomVariable dom borel_sa X)
(
posX:
NonnegativeFunction X)
(
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n))
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n))
(
isfeX:
IsFiniteExpectation X)
(
isfe:
forall (
n:
nat),
IsFiniteExpectation (
Xn n)) :
(
forall (
n:
nat),
rv_le (
Xn n)
X) ->
(
forall (
n:
nat),
rv_le (
Xn n) (
Xn (
S n))) ->
(
forall (
omega:
Ts),
is_lim_seq (
fun n =>
Xn n omega) (
X omega)) ->
Lim_seq (
fun n =>
FiniteExpectation (
Xn n)) = (
FiniteExpectation X).
Proof.
Lemma Fatou_FiniteExpectation
(
Xn :
nat ->
Ts ->
R)
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n))
(
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n))
(
isfe_Xn :
forall n,
IsFiniteExpectation (
Xn n))
(
isfe_limInf :
IsFiniteExpectation
(
fun omega :
Ts =>
LimInf_seq (
fun n :
nat =>
Xn n omega)))
(
isf:
forall omega,
is_finite (
LimInf_seq (
fun n :
nat =>
Xn n omega)))
(
lim_rv :
RandomVariable dom borel_sa
(
fun omega =>
LimInf_seq (
fun n =>
Xn n omega))) :
Rbar_le (
FiniteExpectation (
fun omega =>
LimInf_seq (
fun n =>
Xn n omega)))
(
LimInf_seq (
fun n =>
FiniteExpectation (
Xn n))).
Proof.
Lemma Lim_seq_increasing_le (
f :
nat ->
R) :
(
forall n,
f n <=
f (
S n)) ->
forall n,
Rbar_le (
f n) (
Lim_seq f).
Proof.
Lemma rvsum_le_series (
Xn :
nat ->
Ts ->
R)
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n)) :
(
forall omega,
is_finite (
Lim_seq (
fun n =>
rvsum Xn n omega))) ->
forall n:
nat,
rv_le (
rvsum Xn n)
(
fun omega =>
Lim_seq (
fun n0 :
nat =>
rvsum Xn n0 omega)).
Proof.
Lemma series_expectation
(
Xn :
nat ->
Ts ->
R)
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n))
(
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n))
(
isfe :
forall n,
IsFiniteExpectation (
Xn n))
(
lim_rv :
RandomVariable dom borel_sa
(
fun omega =>
Lim_seq (
sum_n (
fun n =>
Xn n omega))))
(
lim_fin :
forall omega,
is_finite (
Lim_seq (
fun n :
nat =>
rvsum Xn n omega)))
(
lim_fe :
IsFiniteExpectation
(
fun omega :
Ts =>
Lim_seq (
fun n :
nat =>
rvsum Xn n omega)))
(
lim_pos :
NonnegativeFunction
(
fun omega :
Ts =>
Lim_seq (
fun n :
nat =>
rvsum Xn n omega))):
(
forall omega,
ex_lim_seq (
fun n :
nat =>
rvsum Xn n omega)) ->
Lim_seq (
sum_n (
fun n =>
FiniteExpectation (
Xn n))) =
FiniteExpectation (
fun omega =>
Lim_seq (
fun n =>
rvsum Xn n omega)).
Proof.
Lemma is_finite_Lim_seq_psP (
E :
nat ->
event dom) :
is_finite (
Lim_seq (
fun n =>
ps_P (
E n))).
Proof.
Lemma sum_shift (
f :
nat ->
R) (
n n0 :
nat) :
sum_n_m f n (
n0 +
n) =
sum_n_m (
fun n1 :
nat =>
f (
n1 +
n)%
nat) 0
n0.
Proof.
induction n0.
-
replace (0 +
n)%
nat with n by lia.
do 2
rewrite sum_n_n.
now replace (0 +
n)%
nat with n by lia.
-
replace (
S n0 +
n)%
nat with (
S (
n0 +
n)%
nat)
by lia.
rewrite sum_n_Sm; [|
lia].
rewrite sum_n_Sm; [|
lia].
replace (
S n0 +
n)%
nat with (
S (
n0 +
n)%
nat)
by lia.
now apply Rplus_eq_compat_r.
Qed.
Lemma Lim_series_tails (
f :
nat ->
R) :
ex_series f ->
(
forall n, 0 <=
f n) ->
Lim_seq (
fun k :
nat =>
Series (
fun n :
nat =>
f (
n +
k)%
nat)) = 0.
Proof.
Lemma ps_union_le_ser col :
ex_series (
fun n0 :
nat =>
ps_P (
col n0)) ->
ps_P (
union_of_collection col) <=
Series (
fun n0 :
nat =>
ps_P (
col n0)).
Proof.
Theorem Borel_Cantelli (
E :
nat ->
event dom) :
(
forall (
n:
nat),
sa_sigma (
E n)) ->
ex_series (
fun n =>
ps_P (
E n)) ->
ps_P (
inter_of_collection
(
fun k =>
union_of_collection
(
fun n =>
E (
n +
k)%
nat))) = 0.
Proof.
Lemma IsFiniteExpectation_abs_id (
f :
Ts ->
R)
{
rvf :
RandomVariable dom borel_sa f} :
IsFiniteExpectation (
rvabs f) ->
IsFiniteExpectation f.
Proof.
Lemma IsFiniteExpectation_abs_bound (
f g :
Ts ->
R)
{
rvf :
RandomVariable dom borel_sa f}
{
rvg :
RandomVariable dom borel_sa g} :
rv_le (
rvabs f)
g ->
IsFiniteExpectation g ->
IsFiniteExpectation f.
Proof.
Lemma IsFiniteExpectation_abs_bound_almost (
f g :
Ts ->
R)
{
rvf :
RandomVariable dom borel_sa f}
{
rvg :
RandomVariable dom borel_sa g} :
almostR2 prts Rle (
rvabs f)
g ->
IsFiniteExpectation g ->
IsFiniteExpectation f.
Proof.
Instance Dominated_convergence0
(
fn :
nat ->
Ts ->
R)
(
g :
Ts ->
R)
{
rvn :
forall n,
RandomVariable dom borel_sa (
fn n)}
{
rvg :
RandomVariable dom borel_sa g} :
(
forall n,
rv_le (
rvabs (
fn n))
g) ->
IsFiniteExpectation g ->
forall n,
IsFiniteExpectation (
fn n).
Proof.
Instance Dominated_convergence1
(
fn :
nat ->
Ts ->
R)
(
f g :
Ts ->
R)
{
rvn :
forall n,
RandomVariable dom borel_sa (
fn n)}
{
rvf :
RandomVariable dom borel_sa f}
{
rvg :
RandomVariable dom borel_sa g}
(
isfeg :
IsFiniteExpectation g)
(
le_fn_g : (
forall n,
rv_le (
rvabs (
fn n))
g))
(
lim :
almost prts (
fun x =>
is_lim_seq (
fun n =>
fn n x) (
f x))) :
IsFiniteExpectation f.
Proof.
Instance Dominated_convergence1_almost
(
fn :
nat ->
Ts ->
R)
(
f g :
Ts ->
R)
{
rvn :
forall n,
RandomVariable dom borel_sa (
fn n)}
{
rvf :
RandomVariable dom borel_sa f}
{
rvg :
RandomVariable dom borel_sa g}
(
isfeg :
IsFiniteExpectation g)
(
le_fn_g :
forall n,
almostR2 prts Rle (
rvabs (
fn n))
g)
(
lim :
almost prts (
fun x =>
is_lim_seq (
fun n =>
fn n x) (
f x))) :
IsFiniteExpectation f.
Proof.
Lemma FiniteExpectation_simple (
rv_X :
Ts ->
R)
{
rvx_rv :
RandomVariable dom borel_sa rv_X}
{
frf :
FiniteRangeFunction rv_X}
{
isfe :
IsFiniteExpectation rv_X} :
FiniteExpectation rv_X =
SimpleExpectation rv_X.
Proof.
Instance IsFiniteExpectation_simple (
rv_X :
Ts ->
R)
{
rvx_rv :
RandomVariable dom borel_sa rv_X}
{
frf :
FiniteRangeFunction rv_X} :
IsFiniteExpectation rv_X.
Proof.
Lemma simple_FiniteExpectation (
rv_X :
Ts ->
R)
{
rvx_rv :
RandomVariable dom borel_sa rv_X}
{
frf :
FiniteRangeFunction rv_X} :
SimpleExpectation rv_X =
FiniteExpectation rv_X.
Proof.
Lemma FiniteExpectation_indicator {
P :
event dom}
(
dec :
forall x :
Ts, {
P x} + {~
P x}) :
FiniteExpectation (
EventIndicator dec) =
ps_P P.
Proof.
Instance list_sum_rv {
T}
f l
{
rv:
forall c,
RandomVariable dom borel_sa (
f c)}
:
RandomVariable dom borel_sa
(
fun omega :
Ts =>
RealAdd.list_sum (
map (
fun c :
T =>
f c omega)
l)).
Proof.
induction l;
simpl.
-
apply rvconst.
-
generalize @
rvplus_rv;
unfold rvplus;
intros HH.
apply HH;
trivial.
Qed.
Instance list_sum_in_rv {
T}
f l
{
rv:
forall c,
In c l ->
RandomVariable dom borel_sa (
f c)}
:
RandomVariable dom borel_sa
(
fun omega :
Ts =>
RealAdd.list_sum (
map (
fun c :
T =>
f c omega)
l)).
Proof.
induction l;
simpl.
-
apply rvconst.
-
generalize @
rvplus_rv;
unfold rvplus;
intros HH.
apply HH;
simpl in *;
auto.
Qed.
Lemma FiniteExpectation_list_sum {
T}
f l
{
rv:
forall c,
RandomVariable dom borel_sa (
f c)}
{
isfe:
forall c,
IsFiniteExpectation (
f c)} :
Expectation
(
fun omega =>
RealAdd.list_sum
(
map
(
fun c :
T =>
(
f c omega))
l)) =
Some (
Finite
(
RealAdd.list_sum
(
map
(
fun c :
T =>
FiniteExpectation (
f c))
l))).
Proof.
Lemma FiniteExpectation_list_sum_in {
T}
f l
{
rv:
forall c,
In c l ->
RandomVariable dom borel_sa (
f c)}
{
isfe:
forall c,
In c l ->
IsFiniteExpectation (
f c)} :
Expectation
(
fun omega =>
RealAdd.list_sum
(
map
(
fun c :
T =>
(
f c omega))
l)) =
Some (
Finite
(
RealAdd.list_sum
(
map_onto l
(
fun c pf =>
FiniteExpectation (
f c) (
isfe:=
isfe c pf))
))).
Proof.
Lemma IsFiniteExpectation_list_sum {
T} (
f :
T ->
Ts ->
R) (
l :
list T)
{
rv:
forall c :
T,
RandomVariable dom borel_sa (
f c)}
{
isfe :
forall c :
T,
IsFiniteExpectation (
f c)} :
IsFiniteExpectation (
fun omega :
Ts =>
RealAdd.list_sum (
map (
fun c :
T =>
f c omega)
l)).
Proof.
Lemma IsFiniteExpectation_list_sum_in {
T} (
f :
T ->
Ts ->
R) (
l :
list T)
{
rv:
forall c :
T,
In c l ->
RandomVariable dom borel_sa (
f c)}
{
isfe :
forall c :
T,
In c l ->
IsFiniteExpectation (
f c)} :
IsFiniteExpectation (
fun omega :
Ts =>
RealAdd.list_sum (
map (
fun c :
T =>
f c omega)
l)).
Proof.
End fe.
Hint Rewrite FiniteExpectation_const FiniteExpectation_plus FiniteExpectation_scale FiniteExpectation_opp FiniteExpectation_minus:
prob.
Section ExpNonNeg.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Lemma IsFiniteExpectation_parts f :
IsFiniteExpectation prts f ->
IsFiniteExpectation prts (
pos_fun_part f) /\
IsFiniteExpectation prts (
neg_fun_part f).
Proof.
Lemma IsFiniteExpectation_from_parts f :
IsFiniteExpectation prts (
pos_fun_part f) ->
IsFiniteExpectation prts (
neg_fun_part f) ->
IsFiniteExpectation prts f.
Proof.
Lemma IsFiniteExpectation_from_fin_parts f :
Rbar_lt (
NonnegExpectation (
pos_fun_part f))
p_infty ->
Rbar_lt (
NonnegExpectation (
neg_fun_part f))
p_infty ->
IsFiniteExpectation prts f.
Proof.
Global Instance IsFiniteExpectation_abs f
{
rv:
RandomVariable dom borel_sa f} :
IsFiniteExpectation prts f ->
IsFiniteExpectation prts (
rvabs f).
Proof.
Global Instance IsFiniteExpectation_indicator f {
P} (
dec:
dec_pre_event P)
{
rv :
RandomVariable dom borel_sa f}:
sa_sigma P ->
IsFiniteExpectation prts f ->
IsFiniteExpectation prts (
rvmult f (
EventIndicator dec)).
Proof.
Lemma IsFiniteExpectation_prod_parts f g
{
dom2 :
SigmaAlgebra Ts}
(
sub :
sa_sub dom2 dom)
{
rvf :
RandomVariable dom borel_sa (
rvmult f g)}
{
rvg :
RandomVariable dom2 borel_sa g} :
IsFiniteExpectation prts (
rvmult f g) ->
IsFiniteExpectation prts (
rvmult f (
pos_fun_part g)) /\
IsFiniteExpectation prts (
rvmult f (
neg_fun_part g)).
Proof.
Lemma Expectation_mult_indicator_almost_le
(
X1 X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa X1}
{
rv2 :
RandomVariable dom borel_sa X2}
{
isfe2:
IsFiniteExpectation prts X2} :
(
forall P (
dec:
dec_event P),
match Expectation (
rvmult X1 (
EventIndicator dec)),
Expectation (
rvmult X2 (
EventIndicator dec))
with
|
Some r1,
Some r2 =>
Rbar_le r1 r2
|
_,
_ =>
False
end) ->
almostR2 prts Rle X1 X2.
Proof.
End ExpNonNeg.
Section sa_sub.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom)
{
dom2 :
SigmaAlgebra Ts}
(
sub :
sa_sub dom2 dom).
Lemma IsFiniteExpectation_prob_space_sa_sub
(
x:
Ts->
R)
{
rv:
RandomVariable dom2 borel_sa x}
{
isfe:
IsFiniteExpectation (
prob_space_sa_sub prts sub)
x} :
IsFiniteExpectation prts x.
Proof.
Lemma IsFiniteExpectation_prob_space_sa_sub_f
(
x:
Ts->
R)
{
rv:
RandomVariable dom2 borel_sa x}
{
isfe:
IsFiniteExpectation prts x} :
IsFiniteExpectation (
prob_space_sa_sub prts sub)
x.
Proof.
Lemma FiniteExpectation_prob_space_sa_sub
(
x:
Ts->
R)
{
rv:
RandomVariable dom2 borel_sa x}
{
isfe1:
IsFiniteExpectation (
prob_space_sa_sub prts sub)
x}
{
isfe2:
IsFiniteExpectation prts x} :
FiniteExpectation (
prob_space_sa_sub prts sub)
x =
FiniteExpectation prts x.
Proof.
End sa_sub.