Require Import Reals.
Require Import Lra Lia.
Require Import List Permutation.
Require Import Morphisms EquivDec Program.
Require Import Coquelicot.Coquelicot.
Require Import Classical_Prop.
Require Import Classical.
Require Import RealRandomVariable.
Require Import Utils.
Require Export SimpleExpectation Expectation.
Require Import Almost.
Import ListNotations.
Set Bullet Behavior "
Strict Subproofs".
Local Open Scope R.
Require Import RandomVariableFinite.
Section RbarExpectation.
Context
{
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
{
Prts:
ProbSpace dom}.
Local Open Scope prob.
Definition Rbar_NonnegExpectation
(
rv_X :
Ts ->
Rbar)
{
pofrf:
Rbar_NonnegativeFunction rv_X} :
Rbar :=
(
SimpleExpectationSup
(
fun
(
rvx2:
Ts ->
R)
(
rv2 :
RandomVariable dom borel_sa rvx2)
(
frf2:
FiniteRangeFunction rvx2) =>
NonnegativeFunction rvx2 /\
(
Rbar_rv_le rvx2 rv_X))).
Lemma Rbar_NonnegExpectation_ext
{
rv_X1 rv_X2 :
Ts ->
Rbar}
(
nnf1:
Rbar_NonnegativeFunction rv_X1)
(
nnf2:
Rbar_NonnegativeFunction rv_X2):
rv_eq rv_X1 rv_X2 ->
Rbar_NonnegExpectation rv_X1 =
Rbar_NonnegExpectation rv_X2.
Proof.
Lemma Rbar_NonnegExpectation_pf_irrel
{
rv_X:
Ts ->
R}
(
nnf1 nnf2:
Rbar_NonnegativeFunction rv_X) :
Rbar_NonnegExpectation rv_X (
pofrf:=
nnf1) =
Rbar_NonnegExpectation rv_X (
pofrf:=
nnf2).
Proof.
Definition Rbar_pos_fun_part (
f :
Ts ->
Rbar) : (
Ts ->
Rbar) :=
fun x =>
Rbar_max (
f x) 0.
Definition Rbar_neg_fun_part (
f :
Ts ->
Rbar) : (
Ts ->
Rbar) :=
fun x =>
Rbar_max (
Rbar_opp (
f x)) 0.
Program Definition Rbar_neg_fun_part_alt (
f :
Ts ->
Rbar) : (
Ts ->
Rbar) :=
Rbar_pos_fun_part (
fun x =>
Rbar_opp (
f x)).
Lemma Rbar_neg_fun_part_alt_rveq (
f :
Ts ->
Rbar) :
rv_eq (
Rbar_neg_fun_part f) (
Rbar_neg_fun_part_alt f).
Proof.
easy.
Qed.
Instance Rbar_opp_measurable (
f :
Ts ->
Rbar) :
RbarMeasurable f ->
RbarMeasurable (
fun x =>
Rbar_opp (
f x)).
Proof.
Global Instance Rbar_pos_fun_part_measurable (
f :
Ts ->
Rbar) :
RbarMeasurable f ->
RbarMeasurable (
Rbar_pos_fun_part f).
Proof.
Instance Rbar_neg_fun_part_measurable (
f :
Ts ->
Rbar) :
RbarMeasurable f ->
RbarMeasurable (
Rbar_neg_fun_part f).
Proof.
Global Instance Rbar_pos_fun_part_rv (
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f) :
RandomVariable dom Rbar_borel_sa (
Rbar_pos_fun_part f).
Proof.
Global Instance Rbar_neg_fun_part_rv (
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f) :
RandomVariable dom Rbar_borel_sa (
Rbar_neg_fun_part f).
Proof.
Global Instance Rbar_pos_fun_pos (
f :
Ts ->
Rbar) :
Rbar_NonnegativeFunction (
Rbar_pos_fun_part f).
Proof.
Global Instance Rbar_neg_fun_pos (
f :
Ts ->
Rbar) :
Rbar_NonnegativeFunction (
Rbar_neg_fun_part f).
Proof.
Definition Rbar_Expectation (
rv_X :
Ts ->
Rbar) :
option Rbar :=
Rbar_minus' (
Rbar_NonnegExpectation (
Rbar_pos_fun_part rv_X))
(
Rbar_NonnegExpectation (
Rbar_neg_fun_part rv_X)).
Lemma Rbar_Expectation_ext {
rv_X1 rv_X2 :
Ts ->
Rbar} :
rv_eq rv_X1 rv_X2 ->
Rbar_Expectation rv_X1 =
Rbar_Expectation rv_X2.
Proof.
Global Instance Rbar_Expectation_proper :
Proper (
rv_eq ==>
eq)
Rbar_Expectation.
Proof.
Lemma Rbar_NonnegExpectation_le
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
nnf1 :
Rbar_NonnegativeFunction rv_X1}
{
nnf2 :
Rbar_NonnegativeFunction rv_X2} :
Rbar_rv_le rv_X1 rv_X2 ->
Rbar_le (
Rbar_NonnegExpectation rv_X1) (
Rbar_NonnegExpectation rv_X2).
Proof.
Lemma Rbar_NonnegExpectation_const (
c :
R) (
nnc : 0 <=
c) :
(@
Rbar_NonnegExpectation (
const c) (
nnfconst _ nnc)) =
c.
Proof.
Lemma Rbar_NonnegExpectation_const0 :
(@
Rbar_NonnegExpectation (
const 0) (
nnfconst _ z_le_z)) = 0.
Proof.
Lemma Rbar_NonnegExpectation_pos
(
rv_X :
Ts ->
Rbar)
{
nnf :
Rbar_NonnegativeFunction rv_X} :
Rbar_le 0 (
Rbar_NonnegExpectation rv_X).
Proof.
Lemma is_finite_Rbar_NonnegExpectation_le
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
nnf1 :
Rbar_NonnegativeFunction rv_X1}
{
nnf2 :
Rbar_NonnegativeFunction rv_X2} :
Rbar_rv_le rv_X1 rv_X2 ->
is_finite (
Rbar_NonnegExpectation rv_X2) ->
is_finite (
Rbar_NonnegExpectation rv_X1).
Proof.
Lemma NNExpectation_Rbar_NNExpectation
(
rv_X :
Ts ->
R)
(
xpos :
NonnegativeFunction rv_X) :
NonnegExpectation rv_X =
Rbar_NonnegExpectation rv_X.
Proof.
Lemma NNExpectation_Rbar_NNExpectation'
(
rv_X :
Ts ->
R)
(
xpos :
NonnegativeFunction rv_X)
(
xpos' :
Rbar_NonnegativeFunction rv_X) :
NonnegExpectation rv_X =
Rbar_NonnegExpectation rv_X.
Proof.
Lemma simple_Rbar_NonnegExpectation (
rv_X :
Ts ->
R)
{
rv :
RandomVariable dom borel_sa rv_X}
{
rv' :
RandomVariable dom Rbar_borel_sa rv_X}
{
nnf :
Rbar_NonnegativeFunction rv_X}
{
frf :
FiniteRangeFunction rv_X} :
Finite (
SimpleExpectation rv_X) =
Rbar_NonnegExpectation rv_X.
Proof.
Lemma Rbar_pos_fun_pos_fun (
rv_X :
Ts ->
R) :
rv_eq (
Rbar_pos_fun_part rv_X) (
pos_fun_part rv_X).
Proof.
Lemma Rbar_neg_fun_neg_fun (
rv_X :
Ts ->
R) :
rv_eq (
Rbar_neg_fun_part rv_X) (
neg_fun_part rv_X).
Proof.
Lemma Expectation_Rbar_Expectation
(
rv_X :
Ts ->
R) :
Expectation rv_X =
Rbar_Expectation rv_X.
Proof.
Lemma Expectation_rvlim_ge
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
forall n,
Rbar_le (
Rbar_NonnegExpectation (
Xn n)) (
Rbar_NonnegExpectation (
Rbar_rvlim Xn)).
Proof.
Lemma sigma_f_Rbar_ge_g (
f g :
Ts ->
Rbar)
{
rvf:
RandomVariable dom Rbar_borel_sa f}
{
rvg:
RandomVariable dom Rbar_borel_sa g} :
sa_sigma (
fun omega :
Ts =>
Rbar_ge (
f omega) (
g omega)).
Proof.
Lemma ELim_seq_NonnegExpectation_pos
(
rvxn :
nat ->
Ts ->
Rbar)
(
posvn:
forall n,
Rbar_NonnegativeFunction (
rvxn n)) :
Rbar_le 0 (
ELim_seq (
fun n :
nat =>
Rbar_NonnegExpectation (
rvxn n))).
Proof.
Lemma ELim_seq_Expectation_m_infty
(
rvxn :
nat ->
Ts ->
Rbar)
(
posvn:
forall n,
Rbar_NonnegativeFunction (
rvxn n)) :
ELim_seq (
fun n :
nat =>
Rbar_NonnegExpectation (
rvxn n)) =
m_infty ->
False.
Proof.
Lemma Rbar_abs_left1 (
a :
Rbar) :
Rbar_le a 0 ->
Rbar_abs a =
Rbar_opp a.
Proof.
Lemma monotone_convergence_Ec2_Rbar_rvlim
(
Xn :
nat ->
Ts ->
Rbar)
(
cphi :
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
sphi :
FiniteRangeFunction cphi)
(
phi_rv :
RandomVariable dom borel_sa cphi)
(
posphi:
NonnegativeFunction cphi)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
:
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
(
forall (
omega:
Ts),
cphi omega = 0 \/
Rbar_lt (
cphi omega) ((
Rbar_rvlim Xn)
omega)) ->
(
forall (
n:
nat),
sa_sigma (
fun (
omega:
Ts) =>
Rbar_ge (
Xn n omega) (
cphi omega))) /\
pre_event_equiv (
pre_union_of_collection (
fun n =>
fun (
omega:
Ts) => (
Rbar_ge (
Xn n omega) (
cphi omega))))
pre_Ω.
Proof.
intros.
split.
-
intros x.
apply sigma_f_Rbar_ge_g;
trivial.
now apply Real_Rbar_rv.
-
assert (
pre_event_equiv (
pre_event_union (
fun (
omega :
Ts) =>
Rbar_lt (
cphi omega) ((
Rbar_rvlim Xn)
omega))
(
fun (
omega :
Ts) =>
cphi omega = 0))
pre_Ω).
+
intros x.
unfold pre_Ω,
pre_event_union.
specialize (
H0 x).
tauto.
+
rewrite <-
H1.
intros x.
specialize (
H1 x).
unfold pre_Ω
in H1.
split; [
tauto | ].
intros.
unfold pre_union_of_collection;
intros.
unfold Rbar_rvlim in H2.
specialize (
H0 x).
destruct H0.
*
rewrite H0.
exists (0%
nat).
apply Xn_pos.
*
unfold Rbar_rvlim in H0.
generalize (
ex_Elim_seq_incr (
fun n =>
Xn n x));
intros.
apply ELim_seq_correct in H3; [|
intros;
apply H].
generalize (
H3);
intros.
rewrite <-
is_Elim_seq_spec in H3.
unfold is_Elim_seq'
in H3.
match_case_in H3;
intros.
--
rewrite H5 in H3.
specialize (
posphi x).
rewrite H5 in H0;
simpl in H0.
assert (0 <
r -
cphi x)
by lra.
specialize (
H3 (
mkposreal _ H6)).
destruct H3.
exists x0.
specialize (
H3 x0).
simpl in H3.
cut_to H3; [|
lia].
{
rewrite Rbar_abs_left1 in H3.
-
destruct (
Xn x0 x);
simpl in *;
try tauto.
lra.
-
rewrite H5 in H4.
generalize (
is_Elim_seq_incr_compare _ _ H4 (
fun n =>
H n x)
x0);
intros HH.
destruct (
Xn x0 x);
simpl in *;
try tauto;
lra.
}
--
rewrite H5 in H3.
specialize (
H3 (
cphi x)).
destruct H3.
exists x0.
specialize (
H3 x0).
apply Rbar_lt_le.
apply H3;
lia.
--
rewrite H5 in H0.
simpl in H0.
specialize (
posphi x).
lra.
Qed.
Lemma monotone_convergence_E_phi_lim2_Rbar_rvlim
(
Xn :
nat ->
Ts ->
Rbar)
(
cphi :
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
sphi :
FiniteRangeFunction cphi)
(
phi_rv :
RandomVariable dom borel_sa cphi)
(
posphi:
NonnegativeFunction cphi)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
:
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
(
forall (
omega:
Ts),
cphi omega = 0 \/
Rbar_lt (
cphi omega) ((
Rbar_rvlim Xn)
omega)) ->
is_lim_seq (
fun n =>
NonnegExpectation
(
rvmult cphi
(
EventIndicator
(
fun omega =>
Rbar_ge_dec (
Xn n omega) (
cphi omega)))))
(
NonnegExpectation cphi).
Proof.
Lemma monotone_convergence0_cphi2_Rbar_rvlim
(
Xn :
nat ->
Ts ->
Rbar)
(
cphi :
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
sphi :
FiniteRangeFunction cphi)
(
phi_rv :
RandomVariable dom borel_sa cphi)
(
posphi:
NonnegativeFunction cphi)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
:
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
(
forall (
omega:
Ts),
cphi omega = 0 \/
Rbar_lt (
cphi omega) ((
Rbar_rvlim Xn)
omega)) ->
Rbar_le (
NonnegExpectation cphi)
(
ELim_seq (
fun n =>
Rbar_NonnegExpectation (
Xn n))).
Proof.
Lemma monotone_convergence0_Rbar_rvlim (
c:
R)
(
Xn :
nat ->
Ts ->
Rbar)
(
phi :
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
sphi :
FiniteRangeFunction phi)
(
phi_rv :
RandomVariable dom borel_sa phi)
(
posphi:
NonnegativeFunction phi)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
:
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
Rbar_rv_le phi (
Rbar_rvlim Xn) ->
0 <
c < 1 ->
Rbar_le (
Rbar_mult c (
NonnegExpectation phi))
(
ELim_seq (
fun n =>
Rbar_NonnegExpectation (
Xn n))).
Proof.
Lemma monotone_convergence00_Rbar_rvlim
(
Xn :
nat ->
Ts ->
Rbar)
(
phi :
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
sphi :
FiniteRangeFunction phi)
(
phi_rv :
RandomVariable dom borel_sa phi)
(
posphi:
NonnegativeFunction phi)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
Rbar_rv_le phi (
Rbar_rvlim Xn) ->
Rbar_le
(
NonnegExpectation phi)
(
ELim_seq (
fun n => (
Rbar_NonnegExpectation (
Xn n)))).
Proof.
Lemma Rbar_monotone_convergence
(
X :
Ts ->
Rbar)
(
Xn :
nat ->
Ts ->
Rbar)
(
rvx :
RandomVariable dom Rbar_borel_sa X)
(
posX:
Rbar_NonnegativeFunction X)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
(
forall (
n:
nat),
Rbar_rv_le (
Xn n)
X) ->
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
(
forall (
omega:
Ts),
is_Elim_seq (
fun n =>
Xn n omega) (
X omega)) ->
ELim_seq (
fun n =>
Rbar_NonnegExpectation (
Xn n)) = (
Rbar_NonnegExpectation X).
Proof.
Lemma monotone_convergence_Rbar_rvlim
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
(
forall (
n:
nat),
Rbar_rv_le (
Xn n) (
Xn (
S n))) ->
ELim_seq (
fun n =>
Rbar_NonnegExpectation (
Xn n)) =
Rbar_NonnegExpectation (
Rbar_rvlim Xn).
Proof.
Lemma monotone_convergence_Rbar_rvlim_fin
(
Xn :
nat ->
Ts ->
R)
(
Xn_rv :
forall n,
RandomVariable dom borel_sa (
Xn n))
(
Xn_pos :
forall n,
NonnegativeFunction (
Xn n)) :
(
forall (
n:
nat),
rv_le (
Xn n) (
Xn (
S n))) ->
ELim_seq (
fun n =>
NonnegExpectation (
Xn n)) =
Rbar_NonnegExpectation (
Rbar_rvlim Xn).
Proof.
Global Instance Rbar_NonnegativeFunction_const_posreal (
c:
posreal) :
Rbar_NonnegativeFunction (
const (
B:=
Ts)
c).
Proof.
Lemma Rbar_NonnegExpectation_scale (
c:
posreal)
(
rv_X :
Ts ->
Rbar)
{
pofrf:
Rbar_NonnegativeFunction rv_X} :
Rbar_NonnegExpectation (
Rbar_rvmult (
const c)
rv_X) =
Rbar_mult c (
Rbar_NonnegExpectation rv_X).
Proof.
Lemma Rbar_Expectation_scale_pos (
c:
posreal) (
rv_X :
Ts ->
Rbar) :
Rbar_NonnegExpectation (
Rbar_pos_fun_part (
Rbar_rvmult (
const c)
rv_X)) =
Rbar_mult c (
Rbar_NonnegExpectation (
Rbar_pos_fun_part rv_X)).
Proof.
Lemma Rbar_Expectation_scale_neg (
c:
posreal) (
rv_X :
Ts ->
Rbar) :
Rbar_NonnegExpectation (
fun x :
Ts =>
Rbar_neg_fun_part (
Rbar_rvmult (
const c)
rv_X)
x) =
Rbar_mult c (
Rbar_NonnegExpectation (
Rbar_neg_fun_part rv_X)).
Proof.
Lemma Rbar_Expectation_scale_posreal (
c:
posreal)
(
rv_X :
Ts ->
Rbar) :
let Ex_rv :=
Rbar_Expectation rv_X in
let Ex_c_rv :=
Rbar_Expectation (
Rbar_rvmult (
const c)
rv_X)
in
Ex_c_rv =
match Ex_rv with
|
Some x =>
Some (
Rbar_mult c x)
|
None =>
None
end.
Proof.
Lemma Rbar_NonnegExpectation_plus
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
nnf1:
Rbar_NonnegativeFunction rv_X1}
{
nnf2:
Rbar_NonnegativeFunction rv_X2} :
Rbar_NonnegExpectation (
Rbar_rvplus rv_X1 rv_X2) =
Rbar_plus (
Rbar_NonnegExpectation rv_X1) (
Rbar_NonnegExpectation rv_X2).
Proof.
Lemma Rbar_pos_fun_part_pos (
rv_X :
Ts ->
Rbar)
{
nnf :
Rbar_NonnegativeFunction rv_X} :
rv_eq rv_X (
Rbar_pos_fun_part rv_X).
Proof.
Lemma Rbar_neg_fun_part_pos (
rv_X :
Ts ->
Rbar)
{
nnf :
Rbar_NonnegativeFunction rv_X} :
rv_eq (
Rbar_neg_fun_part rv_X) (
fun x => (
const 0)
x).
Proof.
Instance nnf_0 :
(@
Rbar_NonnegativeFunction Ts (
fun x =>
const 0
x)).
Proof.
Lemma Rbar_Expectation_pos_pofrf (
rv_X :
Ts ->
Rbar)
{
nnf :
Rbar_NonnegativeFunction rv_X} :
Rbar_Expectation rv_X =
Some (
Rbar_NonnegExpectation rv_X).
Proof.
Lemma Rbar_Expectation_zero_pos
(
X :
Ts ->
Rbar)
{
rv :
RandomVariable dom Rbar_borel_sa X}
{
pofrf :
Rbar_NonnegativeFunction X} :
Rbar_Expectation X =
Some (
Finite 0) ->
ps_P (
preimage_singleton (
has_pre :=
Rbar_borel_has_preimages)
X (
Finite 0)) = 1.
Proof.
Lemma Rbar_Expectation_nonneg_zero_almost_zero
(
X :
Ts ->
Rbar)
{
rv :
RandomVariable dom Rbar_borel_sa X}
{
pofrf :
Rbar_NonnegativeFunction X} :
Rbar_Expectation X =
Some (
Finite 0) ->
almostR2 Prts eq X (
const (
Finite 0)).
Proof.
Global Instance Rbar_nnfabs
(
rv_X :
Ts ->
Rbar) :
Rbar_NonnegativeFunction (
Rbar_rvabs rv_X).
Proof.
Lemma Rbar_pos_fun_part_le rv_X :
Rbar_rv_le (
Rbar_pos_fun_part rv_X) (
Rbar_rvabs rv_X).
Proof.
Lemma Rbar_neg_fun_part_le rv_X :
Rbar_rv_le (
Rbar_neg_fun_part rv_X) (
Rbar_rvabs rv_X).
Proof.
Lemma Rbar_Expectation_abs_then_finite (
rv_X:
Ts->
Rbar)
:
match Rbar_Expectation (
Rbar_rvabs rv_X)
with
|
Some (
Finite _) =>
True
|
_ =>
False
end ->
match Rbar_Expectation rv_X with
|
Some (
Finite _) =>
True
|
_ =>
False
end.
Proof.
Lemma Rbar_rv_pos_neg_id (
rv_X:
Ts->
Rbar) :
rv_eq (
rv_X) (
Rbar_rvplus (
Rbar_pos_fun_part rv_X) (
Rbar_rvopp (
Rbar_neg_fun_part rv_X))).
Proof.
Lemma Rbar_Expectation_opp
(
rv_X :
Ts ->
Rbar) :
let Ex_rv :=
Rbar_Expectation rv_X in
let Ex_o_rv :=
Rbar_Expectation (
Rbar_rvopp rv_X)
in
Ex_o_rv =
match Ex_rv with
|
Some x =>
Some (
Rbar_opp x)
|
None =>
None
end.
Proof.
Lemma Rbar_Expectation_scale (
c:
R)
(
rv_X :
Ts ->
Rbar) :
c <> 0 ->
let Ex_rv :=
Rbar_Expectation rv_X in
let Ex_c_rv :=
Rbar_Expectation (
Rbar_rvmult (
const c)
rv_X)
in
Ex_c_rv =
match Ex_rv with
|
Some x =>
Some (
Rbar_mult c x)
|
None =>
None
end.
Proof.
Global Instance Rbar_ELimInf_seq_pos
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
Rbar_NonnegativeFunction
(
fun omega :
Ts => (
ELimInf_seq (
fun n :
nat =>
Xn n omega))).
Proof.
Definition EFatou_Y (
Xn :
nat ->
Ts ->
Rbar) (
n:
nat) :=
fun (
omega :
Ts) =>
Inf_seq (
fun (
k:
nat) =>
Xn (
k+
n)%
nat omega).
Instance EFatou_Y_pos
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n)) :
forall (
n:
nat),
Rbar_NonnegativeFunction (
EFatou_Y Xn n).
Proof.
Lemma EFatou_Y_incr_Rbar (
Xn :
nat ->
Ts ->
Rbar)
n omega :
Rbar_le (
EFatou_Y Xn n omega) (
EFatou_Y Xn (
S n)
omega).
Proof.
Instance EFatou_Y_meas
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
(
Xn_rv :
forall n,
RbarMeasurable (
Xn n)) :
forall (
n:
nat),
RbarMeasurable (
EFatou_Y Xn n).
Proof.
Instance EFatou_Y_rv
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
:
forall (
n:
nat),
RandomVariable dom Rbar_borel_sa (
EFatou_Y Xn n).
Proof.
Lemma ElimInf_increasing
(
f :
nat ->
Rbar) :
(
forall (
n:
nat),
Rbar_le (
f n) (
f (
S n))) ->
ELim_seq f =
ELimInf_seq f.
Proof.
Lemma inf_ElimInf
(
f :
nat ->
Rbar) (
n:
nat) :
Rbar_le (
Inf_seq (
fun k :
nat =>
f (
k +
n)%
nat))
(
ELimInf_seq f).
Proof.
Lemma ElimInf_increasing2
(
f :
nat ->
Rbar) :
(
forall (
n:
nat),
Rbar_le (
f n) (
f (
S n))) ->
forall (
l:
Rbar),
is_Elim_seq f l <->
is_ELimInf_seq f l.
Proof.
Lemma incr_Rbar_le_strong f
(
incr:
forall (
n:
nat),
Rbar_le (
f n) (
f (
S n)))
a b :
le a b ->
Rbar_le (
f a) (
f b).
Proof.
Lemma is_ELimInf_Sup_Seq (
f:
nat ->
Rbar)
(
incr:
forall (
n:
nat),
Rbar_le (
f n) (
f (
S n))) :
is_ELimInf_seq f (
Sup_seq f).
Proof.
intros.
unfold Sup_seq.
match goal with
[|-
context [
proj1_sig ?
x ]] =>
destruct x;
simpl
end.
destruct x;
simpl in *.
-
intros eps.
split;
intros.
+
exists N.
split;
try lia.
destruct (
i eps)
as [
HH _].
auto.
+
destruct (
i eps)
as [
_ [
N HH]].
exists N.
intros.
eapply incr_Rbar_le_strong in incr;
try eapply H.
destruct (
f N);
try tauto
;
destruct (
f n);
simpl in *;
try tauto.
eapply Rlt_le_trans;
try eapply HH.
apply incr.
-
intros.
destruct (
i M)
as [
N HH].
exists N.
intros.
eapply incr_Rbar_le_strong in incr;
try eapply H.
destruct (
f N);
try tauto
;
destruct (
f n);
simpl in *;
try tauto.
eapply Rlt_le_trans;
try eapply HH.
apply incr.
-
intros.
eauto.
Qed.
Lemma Elim_seq_Inf_seq
(
f :
nat ->
Rbar)
(
incr:
forall (
n:
nat),
Rbar_le (
Inf_seq (
fun k :
nat =>
f (
k +
n)%
nat))
(
Inf_seq (
fun k :
nat =>
f (
k + (
S n))%
nat))) :
is_Elim_seq
(
fun n :
nat =>
Inf_seq (
fun k :
nat =>
f (
k +
n)%
nat))
(
ELimInf_seq f).
Proof.
Lemma Rbar_NN_Fatou
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
lim_rv :
RandomVariable dom Rbar_borel_sa
(
fun omega =>
ELimInf_seq (
fun n =>
Xn n omega))) :
Rbar_le (
Rbar_NonnegExpectation (
fun omega =>
ELimInf_seq (
fun n =>
Xn n omega)))
(
ELimInf_seq (
fun n =>
Rbar_NonnegExpectation (
Xn n))).
Proof.
End RbarExpectation.
Section EventRestricted.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Lemma event_restricted_Rbar_NonnegExpectation P (
pf1 :
ps_P P = 1)
pf (
f :
Ts ->
Rbar)
(
nnf :
Rbar_NonnegativeFunction f) :
@
Rbar_NonnegExpectation Ts dom prts f nnf =
@
Rbar_NonnegExpectation _ _ (
event_restricted_prob_space prts P pf)
(
event_restricted_function P f)
_.
Proof.
Lemma event_restricted_Rbar_Expectation P (
pf1 :
ps_P P = 1)
pf (
f :
Ts ->
Rbar) :
@
Rbar_Expectation Ts dom prts f =
@
Rbar_Expectation _ _ (
event_restricted_prob_space prts P pf)
(
event_restricted_function P f).
Proof.
End EventRestricted.
Section almost.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}.
Context (
prts:
ProbSpace dom).
Instance Rbar_pos_fun_part_proper_almostR2 :
Proper (
almostR2 prts eq ==>
almostR2 prts eq)
(
fun x x0 =>
Rbar_pos_fun_part x x0).
Proof.
Instance Rbar_neg_fun_part_proper_almostR2 :
Proper (
almostR2 prts eq ==>
almostR2 prts eq)
(
fun x x0 =>
Rbar_neg_fun_part x x0).
Proof.
Lemma Rbar_NonnegExpectation_almostR2_0 x
{
nnf:
Rbar_NonnegativeFunction x} :
almostR2 prts eq x (
const 0) ->
Rbar_NonnegExpectation x = 0.
Proof.
Lemma Rbar_NonnegExpectation_EventIndicator_as x {
P} (
dec:
dec_event P)
{
xrv:
RandomVariable dom Rbar_borel_sa x}
{
xnnf:
Rbar_NonnegativeFunction x}
:
ps_P P = 1 ->
Rbar_NonnegExpectation x =
Rbar_NonnegExpectation (
Rbar_rvmult x (
EventIndicator dec)).
Proof.
Lemma Rbar_NonnegExpectation_almostR2_proper x y
{
xrv:
RandomVariable dom Rbar_borel_sa x}
{
yrv:
RandomVariable dom Rbar_borel_sa y}
{
xnnf:
Rbar_NonnegativeFunction x}
{
ynnf:
Rbar_NonnegativeFunction y} :
almostR2 prts eq x y ->
Rbar_NonnegExpectation x =
Rbar_NonnegExpectation y.
Proof.
Lemma Rbar_Expectation_almostR2_proper x y
{
xrv:
RandomVariable dom Rbar_borel_sa x}
{
yrv:
RandomVariable dom Rbar_borel_sa y} :
almostR2 prts eq x y ->
Rbar_Expectation x =
Rbar_Expectation y.
Proof.
Lemma Rbar_pos_neg_id (
x:
Rbar) :
x =
Rbar_plus (
Rbar_max x 0) (
Rbar_opp (
Rbar_max (
Rbar_opp x) 0)).
Proof.
Lemma Rbar_max_minus_nneg (
x y :
Rbar) :
Rbar_le 0
x ->
Rbar_le 0
y ->
(
x = 0 \/
y = 0) ->
Rbar_max (
Rbar_minus x y) 0 =
x.
Proof.
intros.
unfold Rbar_max,
Rbar_minus.
destruct x;
destruct y;
try tauto.
simpl in H;
simpl in H0.
-
match_destr.
+
simpl in r1.
destruct H1;
apply Rbar_finite_eq in H1;
apply Rbar_finite_eq;
lra.
+
apply Rbar_not_le_lt in n.
simpl;
simpl in n.
destruct H1;
apply Rbar_finite_eq in H1;
apply Rbar_finite_eq;
lra.
-
match_destr;
destruct H1;
try congruence.
rewrite H1 in n.
now simpl in n.
-
destruct H1;
try congruence.
rewrite H1;
simpl.
match_destr;
try congruence.
now simpl in r0.
-
destruct H1;
congruence.
Qed.
Program Definition pinf_Indicator
(
f :
Ts ->
Rbar) :=
EventIndicator (
P := (
fun x => (
f x) =
p_infty))
_.
Next Obligation.
Instance Rbar_positive_indicator_prod (
f :
Ts ->
Rbar) (
c :
posreal) :
Rbar_NonnegativeFunction (
rvscale c (
pinf_Indicator f)).
Proof.
Lemma finite_Rbar_NonnegExpectation_le_inf
(
f :
Ts ->
Rbar)
(
fpos :
Rbar_NonnegativeFunction f)
(
c :
posreal) :
is_finite (
Rbar_NonnegExpectation f) ->
Rbar_le (
NonnegExpectation (
rvscale c (
pinf_Indicator f)))
(
Rbar_NonnegExpectation f).
Proof.
Lemma finite_Rbar_NonnegExpectation_le_inf2
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f)
(
fpos :
Rbar_NonnegativeFunction f) :
is_finite (
Rbar_NonnegExpectation f) ->
forall (
c:
posreal),
Rbar_le (
c * (
ps_P (
exist _ _ (
sa_pinf_Rbar f rv))))
(
Rbar_NonnegExpectation f).
Proof.
Lemma finite_Rbar_NonnegExpectation_never_inf
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f)
(
fpos :
Rbar_NonnegativeFunction f) :
is_finite (
Rbar_NonnegExpectation f) ->
ps_P (
exist sa_sigma _ (
sa_pinf_Rbar f rv)) = 0.
Proof.
Lemma finite_Rbar_NonnegExpectation_almostR2_finite
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f)
(
fpos :
Rbar_NonnegativeFunction f) :
is_finite (
Rbar_NonnegExpectation f) ->
ps_P (
exist sa_sigma _ (
sa_finite_Rbar f rv)) = 1.
Proof.
Lemma finite_Rbar_NonnegExpectation_almost_finite
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f)
(
fpos :
Rbar_NonnegativeFunction f) :
is_finite (
Rbar_NonnegExpectation f) ->
almost prts (
fun x =>
is_finite (
f x)).
Proof.
Class Rbar_IsFiniteExpectation (
rv_X:
Ts->
Rbar)
:=
Rbar_is_finite_expectation :
match Rbar_Expectation rv_X with
|
Some (
Finite _) =>
True
|
_ =>
False
end.
Lemma Rbar_rvabs_plus_posfun_negfun
(
f :
Ts ->
Rbar ) :
rv_eq (
Rbar_rvabs f)
(
Rbar_rvplus (
Rbar_pos_fun_part f) (
Rbar_neg_fun_part f)).
Proof.
intro x.
unfold Rbar_rvabs,
Rbar_rvplus,
Rbar_pos_fun_part,
Rbar_neg_fun_part.
destruct (
f x).
-
simpl.
unfold Rbar_max,
Rabs,
Rbar_plus,
Rbar_plus'.
match_destr;
simpl.
+
destruct (
Rbar_le_dec r 0);
destruct (
Rbar_le_dec (-
r) 0);
unfold Rbar_le in *
;
try lra.
now rewrite Rplus_0_l.
+
destruct (
Rbar_le_dec r 0);
destruct (
Rbar_le_dec (-
r) 0);
unfold Rbar_le in *
;
try lra.
*
assert (
r = 0)
by lra;
subst.
now rewrite Rplus_0_r.
*
now rewrite Rplus_0_r.
-
simpl.
unfold Rbar_max,
Rabs,
Rbar_plus,
Rbar_plus'.
destruct (
Rbar_le_dec p_infty 0);
destruct (
Rbar_le_dec m_infty 0);
unfold Rbar_le in *;
tauto.
-
simpl.
unfold Rbar_max,
Rabs,
Rbar_plus,
Rbar_plus'.
destruct (
Rbar_le_dec p_infty 0);
destruct (
Rbar_le_dec m_infty 0);
unfold Rbar_le in *;
tauto.
Qed.
Instance IsFiniteExpectation_Rbar f :
IsFiniteExpectation prts f ->
Rbar_IsFiniteExpectation f.
Proof.
Lemma finiteExp_Rbar_rvabs
(
f :
Ts ->
Rbar)
{
rv :
RandomVariable dom Rbar_borel_sa f}:
Rbar_IsFiniteExpectation f <->
is_finite (
Rbar_NonnegExpectation (
Rbar_rvabs f)).
Proof.
Lemma finite_Rbar_Expectation_almostR2_finite
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f) :
Rbar_IsFiniteExpectation f ->
ps_P (
exist sa_sigma _ (
sa_finite_Rbar f rv)) = 1.
Proof.
Lemma IsFiniteExpectation_nneg_is_almost_finite (
f :
Ts ->
Rbar)
{
rv :
RandomVariable dom Rbar_borel_sa f}
{
nnf :
Rbar_NonnegativeFunction f} :
Rbar_IsFiniteExpectation f ->
almost prts (
fun x =>
is_finite (
f x)).
Proof.
Lemma Rbar_IsFiniteExpectation_proper_almostR2 rv_X1 rv_X2
{
rv1:
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2:
RandomVariable dom Rbar_borel_sa rv_X2} :
Rbar_IsFiniteExpectation rv_X1 ->
almostR2 prts eq rv_X1 rv_X2 ->
Rbar_IsFiniteExpectation rv_X2.
Proof.
Lemma Rbar_rv_le_pos_fun_part (
rv_X1 rv_X2 :
Ts ->
Rbar) :
Rbar_rv_le rv_X1 rv_X2 ->
Rbar_rv_le (
fun x :
Ts =>
Rbar_pos_fun_part rv_X1 x)
(
fun x :
Ts =>
Rbar_pos_fun_part rv_X2 x).
Proof.
intros le12 a.
unfold Rbar_pos_fun_part,
Rbar_max.
match_destr;
match_destr;
trivial.
-
simpl;
lra.
-
unfold Rbar_le in *.
match_destr.
+
lra.
+
easy.
-
specialize (
le12 a).
unfold Rbar_le in *.
match_destr;
match_destr_in le12;
lra.
Qed.
Lemma Rbar_rv_le_neg_fun_part (
rv_X1 rv_X2 :
Ts ->
Rbar) :
Rbar_rv_le rv_X1 rv_X2 ->
Rbar_rv_le (
fun x :
Ts =>
Rbar_neg_fun_part rv_X2 x)
(
fun x :
Ts =>
Rbar_neg_fun_part rv_X1 x).
Proof.
intros le12 a.
unfold Rbar_neg_fun_part,
Rbar_max;
simpl.
specialize (
le12 a).
rewrite <-
Rbar_opp_le in le12.
match_destr;
match_destr;
trivial.
-
simpl;
lra.
-
unfold Rbar_le in *.
match_destr.
+
lra.
+
easy.
-
unfold Rbar_le in *.
match_destr;
match_destr_in le12;
lra.
Qed.
Lemma Rbar_IsFiniteExpectation_bounded (
rv_X1 rv_X2 rv_X3 :
Ts ->
Rbar)
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X3}
:
Rbar_rv_le rv_X1 rv_X2 ->
Rbar_rv_le rv_X2 rv_X3 ->
Rbar_IsFiniteExpectation rv_X2.
Proof.
Lemma Rbar_IsFiniteExpectation_parts f :
Rbar_IsFiniteExpectation f ->
Rbar_IsFiniteExpectation (
Rbar_pos_fun_part f) /\
Rbar_IsFiniteExpectation (
Rbar_neg_fun_part f).
Proof.
Lemma Rbar_IsFiniteExpectation_from_fin_parts (
f:
Ts->
Rbar) :
Rbar_lt (
Rbar_NonnegExpectation (
Rbar_pos_fun_part f))
p_infty ->
Rbar_lt (
Rbar_NonnegExpectation (
Rbar_neg_fun_part f))
p_infty ->
Rbar_IsFiniteExpectation f.
Proof.
Lemma finexp_almost_finite rv_X
{
rv :
RandomVariable dom Rbar_borel_sa rv_X} :
Rbar_IsFiniteExpectation rv_X ->
almost prts (
fun x =>
is_finite (
rv_X x)).
Proof.
Lemma finexp_almost_finite_part rv_X
{
rv :
RandomVariable dom Rbar_borel_sa rv_X} :
Rbar_IsFiniteExpectation rv_X ->
almostR2 prts eq rv_X (
Rbar_finite_part rv_X).
Proof.
Global Instance finite_part_rv rv_X
{
rv :
RandomVariable dom Rbar_borel_sa rv_X} :
RandomVariable dom borel_sa (
Rbar_finite_part rv_X).
Proof.
Lemma finexp_Rbar_exp_finpart rv_X
{
rv :
RandomVariable dom Rbar_borel_sa rv_X} :
Rbar_IsFiniteExpectation rv_X ->
Rbar_Expectation rv_X =
Expectation (
Rbar_finite_part rv_X).
Proof.
Lemma Rbar_finexp_finexp rv_X
{
rv :
RandomVariable dom Rbar_borel_sa rv_X} :
Rbar_IsFiniteExpectation rv_X ->
IsFiniteExpectation prts (
Rbar_finite_part rv_X).
Proof.
Global Instance Rbar_IsFiniteExpectation_const (
c:
R) :
Rbar_IsFiniteExpectation (
const c).
Proof.
Lemma Rbar_finexp_almost_plus rv_X1 rv_X2
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
Rbar_IsFiniteExpectation rv_X1 ->
Rbar_IsFiniteExpectation rv_X2 ->
almostR2 prts eq (
Rbar_rvplus rv_X1 rv_X2) (
rvplus (
Rbar_finite_part rv_X1) (
Rbar_finite_part rv_X2)).
Proof.
Global Instance Rbar_is_finite_expectation_isfe_plus
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_IsFiniteExpectation (
Rbar_rvplus rv_X1 rv_X2).
Proof.
Global Instance Rbar_IsFiniteExpectation_proper :
Proper (
rv_eq ==>
iff)
Rbar_IsFiniteExpectation.
Proof.
Global Instance Rbar_mult_eq_proper
:
Proper (
rv_eq ==>
rv_eq ==>
rv_eq) (@
Rbar_rvmult Ts).
Proof.
intros ???????.
unfold Rbar_rvmult.
now rewrite H,
H0.
Qed.
Global Instance Rbar_IsFiniteExpectation_min
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_IsFiniteExpectation (
Rbar_rvmin rv_X1 rv_X2).
Proof.
intros.
assert (
isfep:
Rbar_IsFiniteExpectation (
Rbar_rvplus rv_X1 rv_X2))
by typeclasses eauto.
unfold Rbar_IsFiniteExpectation in *.
unfold Rbar_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].
rewrite <- (
is_finite_Rbar_NonnegExpectation_le
((
fun x :
Ts =>
Rbar_pos_fun_part (
Rbar_rvmin rv_X1 rv_X2)
x))
((
fun x :
Ts =>
Rbar_pos_fun_part (
Rbar_rvplus rv_X1 rv_X2)
x))).
-
rewrite <- (
is_finite_Rbar_NonnegExpectation_le
((
fun x :
Ts =>
Rbar_neg_fun_part (
Rbar_rvmin rv_X1 rv_X2)
x))
(
Rbar_rvplus (
fun x :
Ts =>
Rbar_neg_fun_part rv_X1 x) (
fun x :
Ts =>
Rbar_neg_fun_part rv_X2 x))).
+
now simpl.
+
intros a.
unfold Rbar_rvmin,
Rbar_neg_fun_part,
Rbar_rvplus,
Rbar_min,
Rbar_opp,
Rbar_max,
Rmin.
destruct (
rv_X1 a);
destruct (
rv_X2 a);
rbar_prover
;
repeat match_destr;
simpl in *;
try lra.
+
rewrite Rbar_NonnegExpectation_plus;
try typeclasses eauto.
apply ->
Finite_Rbar_opp in eqq1neg.
apply ->
Finite_Rbar_opp in eqq2neg.
rewrite <-
eqq1neg, <-
eqq2neg.
reflexivity.
-
intros a.
unfold Rbar_rvmin,
Rbar_pos_fun_part,
Rbar_rvplus,
Rbar_min,
Rbar_opp,
Rbar_max,
Rmin.
destruct (
rv_X1 a);
destruct (
rv_X2 a);
rbar_prover
;
repeat match_destr;
simpl in *;
try lra.
-
match_case_in isfep
; [
intros ?
eqqp |
intros eqqp]
;
rewrite eqqp in isfep
;
try contradiction.
match_destr_in isfep;
try contradiction.
apply Finite_Rbar_plus'
in eqqp.
destruct eqqp as [
eqqppos eqqpneg].
trivial.
Qed.
Global Instance Rbar_IsFiniteExpectation_max
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_IsFiniteExpectation (
Rbar_rvmax rv_X1 rv_X2).
Proof.
intros.
assert (
isfep:
Rbar_IsFiniteExpectation (
Rbar_rvplus rv_X1 rv_X2))
by typeclasses eauto.
unfold Rbar_IsFiniteExpectation in *.
unfold Rbar_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].
rewrite <- (
is_finite_Rbar_NonnegExpectation_le
((
fun x :
Ts =>
Rbar_pos_fun_part (
Rbar_rvmax rv_X1 rv_X2)
x))
(
Rbar_rvplus (
Rbar_pos_fun_part rv_X1) (
Rbar_pos_fun_part rv_X2))).
-
rewrite <- (
is_finite_Rbar_NonnegExpectation_le
((
fun x :
Ts =>
Rbar_neg_fun_part (
Rbar_rvmax rv_X1 rv_X2)
x))
(
Rbar_rvplus (
fun x :
Ts =>
Rbar_neg_fun_part rv_X1 x) (
fun x :
Ts =>
Rbar_neg_fun_part rv_X2 x))).
+
now simpl.
+
intros a.
unfold Rbar_rvmax,
Rbar_neg_fun_part,
Rbar_rvplus,
Rbar_min,
Rbar_opp,
Rbar_max,
Rmin.
destruct (
rv_X1 a);
destruct (
rv_X2 a);
rbar_prover
;
simpl in *;
try lra
;
repeat destruct (
Rbar_le_dec _ _ )
;
simpl in *;
lra.
+
rewrite Rbar_NonnegExpectation_plus;
try typeclasses eauto.
apply ->
Finite_Rbar_opp in eqq1neg.
apply ->
Finite_Rbar_opp in eqq2neg.
rewrite <-
eqq1neg, <-
eqq2neg.
reflexivity.
-
intros a.
unfold Rbar_rvmax,
Rbar_pos_fun_part,
Rbar_rvplus,
Rbar_min,
Rbar_opp,
Rbar_max,
Rmin.
destruct (
rv_X1 a);
destruct (
rv_X2 a);
rbar_prover
;
repeat match_destr;
simpl in *;
try lra.
-
rewrite Rbar_NonnegExpectation_plus;
try typeclasses eauto.
rewrite <-
eqq1pos, <-
eqq2pos.
reflexivity.
Qed.
Global Instance Rbar_IsFiniteExpectation_choice
(
c:
Ts ->
bool) (
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_IsFiniteExpectation (
Rbar_rvchoice c rv_X1 rv_X2).
Proof.
Global Instance Rbar_IsFiniteExpectation_scale c f :
Rbar_IsFiniteExpectation f ->
Rbar_IsFiniteExpectation (
Rbar_rvmult (
const (
Finite c))
f).
Proof.
Lemma Rbar_Expectation_const (
c:
R) :
Rbar_Expectation (
const c) =
Some (
Finite c).
Proof.
Global Instance Rbar_IsFiniteExpectation_indicator f {
P} (
dec:
dec_pre_event P)
{
rv :
RandomVariable dom Rbar_borel_sa f}:
sa_sigma P ->
Rbar_IsFiniteExpectation f ->
Rbar_IsFiniteExpectation (
Rbar_rvmult f (
EventIndicator dec)).
Proof.
Lemma Rbar_IsFiniteExpectation_Finite (
rv_X:
Ts->
Rbar)
{
isfe:
Rbar_IsFiniteExpectation rv_X} :
{
x :
R |
Rbar_Expectation rv_X =
Some (
Finite x)}.
Proof.
red in isfe.
match_destr_in isfe; try contradiction.
destruct r; try contradiction.
eauto.
Qed.
Definition Rbar_FiniteExpectation (
rv_X:
Ts->
Rbar)
{
isfe:
Rbar_IsFiniteExpectation rv_X} :
R
:=
proj1_sig (
Rbar_IsFiniteExpectation_Finite rv_X).
Ltac Rbar_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 FinExp_Rbar_FinExp (
f:
Ts->
R)
{
rv:
RandomVariable dom borel_sa f}
{
isfe:
IsFiniteExpectation prts f}:
Rbar_FiniteExpectation f =
FiniteExpectation prts f.
Proof.
Lemma Rbar_FiniteExpectation_const (
c:
R) :
Rbar_FiniteExpectation (
const c) =
c.
Proof.
Lemma Rbar_Expectation_sum_finite
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
forall (
e1 e2:
R),
Rbar_Expectation rv_X1 =
Some (
Finite e1) ->
Rbar_Expectation rv_X2 =
Some (
Finite e2) ->
Rbar_Expectation (
Rbar_rvplus rv_X1 rv_X2) =
Some (
Finite (
e1 +
e2)).
Proof.
Lemma pos_part_neg_part_rvplus (
f g :
Ts ->
R) :
rv_eq
(
rvplus
(
pos_fun_part (
rvplus f g))
(
rvplus
(
neg_fun_part f)
(
neg_fun_part g)))
(
rvplus
(
neg_fun_part (
Rbar_rvplus f g))
(
rvplus
(
pos_fun_part f)
(
pos_fun_part g))).
Proof.
intro x.
rv_unfold;
simpl.
unfold Rmax.
repeat match_destr;
lra.
Qed.
Lemma pos_part_neg_part_Rbar_rvplus (
f g :
Ts ->
Rbar) :
(
forall x,
ex_Rbar_plus (
f x) (
g x)) ->
rv_eq
(
Rbar_rvplus
(
Rbar_pos_fun_part (
Rbar_rvplus f g))
(
Rbar_rvplus
(
Rbar_neg_fun_part f)
(
Rbar_neg_fun_part g)))
(
Rbar_rvplus
(
Rbar_neg_fun_part (
Rbar_rvplus f g))
(
Rbar_rvplus
(
Rbar_pos_fun_part f)
(
Rbar_pos_fun_part g))).
Proof.
Lemma Rbar_NonnegExpectation_pos_part_neg_part_Rbar_rvplus (
f g :
Ts ->
Rbar)
{
rvf :
RandomVariable dom Rbar_borel_sa f}
{
rvg :
RandomVariable dom Rbar_borel_sa g} :
(
forall x,
ex_Rbar_plus (
f x) (
g x)) ->
Rbar_plus
(
Rbar_NonnegExpectation (
Rbar_pos_fun_part (
Rbar_rvplus f g)))
(
Rbar_plus
(
Rbar_NonnegExpectation (
Rbar_neg_fun_part f))
(
Rbar_NonnegExpectation (
Rbar_neg_fun_part g))) =
Rbar_plus
(
Rbar_NonnegExpectation (
Rbar_neg_fun_part (
Rbar_rvplus f g)))
(
Rbar_plus
(
Rbar_NonnegExpectation (
Rbar_pos_fun_part f))
(
Rbar_NonnegExpectation (
Rbar_pos_fun_part g))).
Proof.
Lemma Rbar_IsFiniteNonnegExpectation (
X:
Ts->
Rbar)
{
posX:
Rbar_NonnegativeFunction X}
{
isfeX:
Rbar_IsFiniteExpectation X} :
is_finite (
Rbar_NonnegExpectation X).
Proof.
Lemma Rbar_pos_sum_bound (
rv_X1 rv_X2 :
Ts ->
Rbar) :
(
forall x,
ex_Rbar_plus (
rv_X1 x) (
rv_X2 x)) ->
Rbar_rv_le (
Rbar_pos_fun_part (
Rbar_rvplus rv_X1 rv_X2))
(
Rbar_rvplus (
Rbar_pos_fun_part rv_X1)
(
Rbar_pos_fun_part rv_X2)).
Proof.
Lemma Rbar_neg_sum_bound (
rv_X1 rv_X2 :
Ts ->
Rbar) :
(
forall x,
ex_Rbar_plus (
rv_X1 x) (
rv_X2 x)) ->
Rbar_rv_le (
Rbar_neg_fun_part (
Rbar_rvplus rv_X1 rv_X2))
(
Rbar_rvplus (
Rbar_neg_fun_part rv_X1)
(
Rbar_neg_fun_part rv_X2)).
Proof.
Lemma Rbar_Expectation_finite
(
rv_X1 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1} :
Rbar_IsFiniteExpectation rv_X1 ->
is_finite (
Rbar_NonnegExpectation (
Rbar_pos_fun_part rv_X1)) /\
is_finite (
Rbar_NonnegExpectation (
Rbar_neg_fun_part rv_X1)).
Proof.
Lemma Rbar_Expectation_pinf
(
rv_X1 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1} :
Rbar_Expectation rv_X1 =
Some p_infty ->
Rbar_NonnegExpectation (
Rbar_pos_fun_part rv_X1) =
p_infty /\
is_finite (
Rbar_NonnegExpectation (
Rbar_neg_fun_part rv_X1)).
Proof.
Lemma Rbar_Expectation_minf
(
rv_X1 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1} :
Rbar_Expectation rv_X1 =
Some m_infty ->
is_finite (
Rbar_NonnegExpectation (
Rbar_pos_fun_part rv_X1)) /\
Rbar_NonnegExpectation (
Rbar_neg_fun_part rv_X1) =
p_infty.
Proof.
Lemma Rbar_Expectation_sum_finite_left
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
(
forall x,
ex_Rbar_plus (
rv_X1 x) (
rv_X2 x)) ->
forall (
e1:
R) (
e2:
Rbar),
Rbar_Expectation rv_X1 =
Some (
Finite e1) ->
Rbar_Expectation rv_X2 =
Some e2 ->
Rbar_Expectation (
Rbar_rvplus rv_X1 rv_X2) =
Some (
Rbar_plus e1 e2).
Proof.
Lemma Rbar_Expectation_sum_finite_right
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
(
forall x,
ex_Rbar_plus (
rv_X1 x) (
rv_X2 x)) ->
forall (
e1:
Rbar) (
e2:
R),
Rbar_Expectation rv_X1 =
Some e1 ->
Rbar_Expectation rv_X2 =
Some (
Finite e2) ->
Rbar_Expectation (
Rbar_rvplus rv_X1 rv_X2) =
Some (
Rbar_plus e1 e2).
Proof.
Lemma Rbar_Expectation_sum
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
(
forall x,
ex_Rbar_plus (
rv_X1 x) (
rv_X2 x)) ->
forall (
e1 e2:
Rbar),
Rbar_Expectation rv_X1 =
Some e1 ->
Rbar_Expectation rv_X2 =
Some e2 ->
ex_Rbar_plus e1 e2 ->
Rbar_Expectation (
Rbar_rvplus rv_X1 rv_X2) =
Some (
Rbar_plus e1 e2).
Proof.
Lemma Rbar_Expectation_minus_finite
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2} :
forall (
e1 e2:
R),
Rbar_Expectation rv_X1 =
Some (
Finite e1) ->
Rbar_Expectation rv_X2 =
Some (
Finite e2) ->
Rbar_Expectation (
Rbar_rvminus rv_X1 rv_X2) =
Some (
Finite (
e1 -
e2)).
Proof.
Lemma Rbar_FiniteExpectation_Rbar_Expectation (
rv_X:
Ts->
Rbar)
{
isfe:
Rbar_IsFiniteExpectation rv_X} :
Rbar_Expectation rv_X =
Some (
Finite (
Rbar_FiniteExpectation rv_X)).
Proof.
Lemma Rbar_FiniteExpectation_Rbar_NonnegExpectation (
rv_X:
Ts->
Rbar)
{
nnf:
Rbar_NonnegativeFunction rv_X}
{
isfe:
Rbar_IsFiniteExpectation rv_X} :
Rbar_NonnegExpectation rv_X =
Finite (
Rbar_FiniteExpectation rv_X).
Proof.
Lemma Rbar_FiniteExpectation_proper_almostR2 (
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rrv1:
RandomVariable dom Rbar_borel_sa rv_X1}
{
rrv2:
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2}
:
almostR2 prts eq rv_X1 rv_X2 ->
Rbar_FiniteExpectation rv_X1 =
Rbar_FiniteExpectation rv_X2.
Proof.
Lemma Rbar_FiniteExpectation_plus
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_FiniteExpectation (
Rbar_rvplus rv_X1 rv_X2) =
Rbar_FiniteExpectation rv_X1 +
Rbar_FiniteExpectation rv_X2.
Proof.
Lemma Rbar_IsFiniteExpectation_opp (
rv_X :
Ts ->
Rbar)
{
rv :
RandomVariable dom Rbar_borel_sa rv_X}
{
isfe:
Rbar_IsFiniteExpectation rv_X} :
Rbar_IsFiniteExpectation (
Rbar_rvopp rv_X).
Proof.
Global Instance Rbar_is_finite_expectation_isfe_minus
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_IsFiniteExpectation (
Rbar_rvminus rv_X1 rv_X2).
Proof.
Lemma Rbar_FiniteExpectation_minus
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2} :
Rbar_FiniteExpectation (
Rbar_rvminus rv_X1 rv_X2) =
Rbar_FiniteExpectation rv_X1 -
Rbar_FiniteExpectation rv_X2.
Proof.
Lemma Rbar_NonnegExpectation_minus_bounded2
(
rv_X1 :
Ts ->
Rbar)
(
rv_X2 :
Ts ->
Rbar)
{
rv1 :
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2 :
RandomVariable dom Rbar_borel_sa rv_X2}
{
nnf1:
Rbar_NonnegativeFunction rv_X1}
(
c:
R)
(
cpos:0 <=
c)
(
bounded2:
Rbar_rv_le rv_X2 (
const c))
{
nnf2:
Rbar_NonnegativeFunction rv_X2}
{
nnf12:
Rbar_NonnegativeFunction (
Rbar_rvminus rv_X1 rv_X2)} :
Rbar_NonnegExpectation (
Rbar_rvminus rv_X1 rv_X2) =
Rbar_minus (
Rbar_NonnegExpectation rv_X1) (
Rbar_NonnegExpectation rv_X2).
Proof.
Lemma Rbar_FiniteExpectation_ext rv_X1 rv_X2
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
{
isfe2:
Rbar_IsFiniteExpectation rv_X2}
(
eqq:
rv_eq rv_X1 rv_X2)
:
Rbar_FiniteExpectation rv_X1 =
Rbar_FiniteExpectation rv_X2.
Proof.
Lemma Rbar_FiniteExpectation_ext_alt {
rv_X1 rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation rv_X1}
(
eqq:
rv_eq rv_X1 rv_X2)
:
Rbar_FiniteExpectation rv_X1 =
Rbar_FiniteExpectation rv_X2 (
isfe:=
proj1 (
Rbar_IsFiniteExpectation_proper _ _ eqq)
isfe1).
Proof.
Theorem Dominated_convergence
(
fn :
nat ->
Ts ->
Rbar)
(
f :
Ts ->
Rbar) (
g :
Ts ->
R)
{
rvn :
forall n,
RandomVariable dom Rbar_borel_sa (
fn n)}
{
rvf :
RandomVariable dom Rbar_borel_sa f}
{
rvg :
RandomVariable dom Rbar_borel_sa g}
{
isfefn :
forall n,
Rbar_IsFiniteExpectation (
fn n)}
{
isfef:
Rbar_IsFiniteExpectation f}
{
isfeg:
Rbar_IsFiniteExpectation g} :
(
forall n,
Rbar_rv_le (
Rbar_rvabs (
fn n))
g) ->
(
forall x,
is_Elim_seq (
fun n =>
fn n x) (
f x)) ->
is_lim_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)) (
Rbar_FiniteExpectation f).
Proof.
intros le1 lim1.
assert (
forall n,
Rbar_NonnegativeFunction (
Rbar_rvplus g (
fn n))).
{
intros n x.
specialize (
le1 n x).
unfold Rbar_rvplus,
Rbar_rvabs in *.
destruct (
fn n x);
simpl in *;
trivial;
try lra.
unfold Rabs in le1.
match_destr_in le1;
lra.
}
assert (
forall n,
Rbar_NonnegativeFunction (
Rbar_rvminus g (
fn n))).
{
intros n x.
specialize (
le1 n x).
unfold Rbar_rvminus,
Rbar_rvopp,
Rbar_rvplus,
Rbar_rvabs in *.
destruct (
fn n x);
simpl in *;
trivial;
try lra.
unfold Rabs in le1.
match_destr_in le1;
lra.
}
assert (
forall n :
nat,
RandomVariable dom Rbar_borel_sa (
Rbar_rvplus g (
fn n))).
{
intros.
now apply Rbar_rvplus_rv.
}
assert (
forall n :
nat,
RandomVariable dom Rbar_borel_sa (
Rbar_rvminus g (
fn n))).
{
intros.
now apply Rbar_rvminus_rv.
}
assert (
RandomVariable dom Rbar_borel_sa
(
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
Rbar_rvplus g (
fn n)
omega)))
by now apply Rbar_lim_inf_rv.
assert (
RandomVariable dom Rbar_borel_sa
(
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
Rbar_rvminus g (
fn n)
omega)))
by now apply Rbar_lim_inf_rv.
generalize (
Rbar_NN_Fatou (
fun n =>
Rbar_rvplus g (
fn n))
_ _ _);
intros le2.
generalize (
Rbar_NN_Fatou (
fun n =>
Rbar_rvminus g (
fn n))
_ _ _);
intros le3.
assert (
forall n,
Rbar_IsFiniteExpectation (
Rbar_rvplus g (
fn n))).
{
intro n.
now apply Rbar_is_finite_expectation_isfe_plus.
}
assert (
forall n,
Rbar_IsFiniteExpectation (
Rbar_rvminus g (
fn n))).
{
intro n.
now apply Rbar_is_finite_expectation_isfe_minus.
}
-
assert (
rv_eq (
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
Rbar_rvplus g (
fn n)
omega))
(
Rbar_rvplus g f)).
{
intro x.
unfold Rbar_rvplus.
rewrite ELimInf_seq_const_plus.
rewrite is_ELimInf_seq_unique with (
l :=
f x);
trivial.
now apply is_Elim_LimInf_seq.
}
assert (
rv_eq (
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
Rbar_rvminus g (
fn n)
omega))
(
Rbar_rvminus g f)).
{
intro x.
rv_unfold.
unfold Rbar_rvminus,
Rbar_rvplus,
Rbar_rvopp.
rewrite ELimInf_seq_const_plus.
f_equal.
rewrite ELimInf_seq_opp.
rewrite is_ELimSup_seq_unique with (
l:=(
f x));
trivial.
now apply is_Elim_LimSup_seq.
}
erewrite (
Rbar_NonnegExpectation_ext _ _ H7)
in le2.
erewrite (
Rbar_NonnegExpectation_ext _ _ H8)
in le3.
rewrite (
Rbar_FiniteExpectation_Rbar_NonnegExpectation _)
in le2.
rewrite (
Rbar_FiniteExpectation_Rbar_NonnegExpectation _)
in le3.
rewrite (
ELimInf_proper _ (
fun n => (
Rbar_FiniteExpectation g) +
(
Rbar_FiniteExpectation (
fn n))))
in le2.
2: {
intros ?.
erewrite <- (
Rbar_FiniteExpectation_plus _ _).
rewrite (
Rbar_FiniteExpectation_Rbar_NonnegExpectation _).
f_equal.
apply Rbar_FiniteExpectation_ext.
reflexivity.
}
rewrite (
ELimInf_proper _ (
fun n => (
Rbar_FiniteExpectation g) -
(
Rbar_FiniteExpectation (
fn n))))
in le3.
2: {
intros ?.
erewrite <- (
Rbar_FiniteExpectation_minus _ _).
rewrite (
Rbar_FiniteExpectation_Rbar_NonnegExpectation _).
f_equal.
apply Rbar_FiniteExpectation_ext.
reflexivity.
}
rewrite ELimInf_seq_fin in le2.
rewrite ELimInf_seq_fin in le3.
rewrite LimInf_seq_const_plus in le2.
rewrite LimInf_seq_const_minus in le3.
erewrite Rbar_FiniteExpectation_plus in le2.
erewrite Rbar_FiniteExpectation_minus in le3.
assert (
Rbar_le (
Rbar_FiniteExpectation f)
(
LimInf_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)))).
{
case_eq (
LimInf_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)));
intros.
-
rewrite H9 in le2;
simpl in le2.
simpl.
apply Rplus_le_reg_l in le2.
apply le2.
-
now simpl.
-
rewrite H9 in le2;
now simpl in le2.
}
assert (
Rbar_le (
LimSup_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)))
(
Rbar_FiniteExpectation f)).
{
case_eq (
LimSup_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)));
intros.
-
rewrite H10 in le3;
simpl in le3.
apply Rplus_le_reg_l in le3.
simpl.
apply Ropp_le_cancel.
apply le3.
-
rewrite H10 in le3;
now simpl in le3.
-
now simpl.
}
generalize (
Rbar_le_trans _ _ _ H10 H9);
intros.
generalize (
LimSup_LimInf_seq_le (
fun n =>
Rbar_FiniteExpectation (
fn n)));
intros.
generalize (
Rbar_le_antisym _ _ H11 H12);
intros.
rewrite H13 in H10.
generalize (
Rbar_le_antisym _ _ H10 H9);
intros.
assert (
Lim_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)) =
Rbar_FiniteExpectation f).
{
unfold Lim_seq.
rewrite H13,
H14.
now rewrite x_plus_x_div_2.
}
rewrite <-
H15.
apply Lim_seq_correct.
now apply ex_lim_LimSup_LimInf_seq.
Unshelve.
+
intro x.
rv_unfold.
generalize (
is_Elim_seq_le (
fun n => 0) (
fun n =>
Rbar_minus (
g x) (
fn n x)) 0 (
Rbar_minus (
g x) (
f x)));
intros.
unfold Rbar_rvminus,
Rbar_rvplus,
Rbar_rvopp.
apply H9.
*
intros.
apply H0.
*
apply is_Elim_seq_const.
*
eapply is_Elim_seq_minus.
--
apply is_Elim_seq_const.
--
apply lim1.
--
destruct (
f x);
reflexivity.
+
intro x.
rv_unfold.
generalize (
is_Elim_seq_le (
fun n => 0) (
fun n =>
Rbar_plus (
g x) (
fn n x)) 0 (
Rbar_plus (
g x) (
f x)));
intros.
unfold Rbar_rvplus.
apply H9.
*
intros.
apply H.
*
apply is_Elim_seq_const.
*
eapply is_Elim_seq_plus.
--
apply is_Elim_seq_const.
--
apply lim1.
--
destruct (
f x);
reflexivity.
Qed.
Theorem Dominated_convergence_almost
(
fn :
nat ->
Ts ->
Rbar)
(
f g :
Ts ->
Rbar)
{
rvn :
forall n,
RandomVariable dom Rbar_borel_sa (
fn n)}
{
rvf :
RandomVariable dom Rbar_borel_sa f}
{
rvg :
RandomVariable dom Rbar_borel_sa g}
{
isfefn :
forall n,
Rbar_IsFiniteExpectation (
fn n)}
{
isfe:
Rbar_IsFiniteExpectation f} :
Rbar_IsFiniteExpectation g ->
(
forall n,
almostR2 prts Rbar_le (
Rbar_rvabs (
fn n))
g) ->
(
almost prts (
fun x =>
is_Elim_seq (
fun n =>
fn n x) (
f x))) ->
is_lim_seq (
fun n =>
Rbar_FiniteExpectation (
fn n)) (
Rbar_FiniteExpectation f).
Proof.
intros isfeg ale islim.
generalize (
finexp_almost_finite_part g isfeg);
intros almostg.
assert (
fing':
Rbar_IsFiniteExpectation (
Rbar_finite_part g)).
{
generalize (
Rbar_finexp_finexp g isfeg);
intros HH.
unfold Rbar_IsFiniteExpectation.
rewrite <-
Expectation_Rbar_Expectation.
apply HH.
}
assert (
ale'':
forall n :
nat,
almostR2 prts Rbar_le (
Rbar_rvabs (
fn n)) (
Rbar_finite_part g)).
{
intros.
eapply almost_impl; [|
apply almost_and; [
apply ale |
apply almostg]].
apply all_almost;
intros ?[??].
rewrite <-
H0.
apply H.
}
assert (
ale':
forall n,
almostR2 prts (
fun x y => (
fun x y =>
Rbar_le (
Rbar_abs x)
y)
x (
Finite y)) (
fn n) (
Rbar_finite_part g)).
{
intros n;
generalize (
ale''
n).
apply almost_impl;
apply all_almost;
intros ??.
apply H.
}
destruct (
almostR2_Rbar_R_le_forall_l_split prts _ _ ale' (
RR:=(
fun x y =>
Rbar_le (
Rbar_abs x)
y)))
as [
fn' [
g' [
eqqfn [
eqqg [
le' [
rvf'
rvg']]]]]].
assert (
rvfn':
forall n,
RandomVariable dom Rbar_borel_sa (
fn'
n))
by eauto.
assert (
isfefn':
forall n,
Rbar_IsFiniteExpectation (
fn'
n)).
{
intros n.
eapply (
Rbar_IsFiniteExpectation_proper_almostR2 (
fn n));
trivial;
typeclasses eauto.
}
cut (
is_lim_seq (
fun n :
nat =>
Rbar_FiniteExpectation (
fn'
n)) (
Rbar_FiniteExpectation f)).
-
apply is_lim_seq_ext;
intros.
f_equal.
now apply Rbar_FiniteExpectation_proper_almostR2.
-
destruct (
almost_and prts (
almost_forall _ eqqfn)
islim)
as [
p [
pone ph]].
unfold pre_inter_of_collection,
pre_event_inter in ph.
assert (
rvfne:(
forall n :
nat,
RandomVariable dom Rbar_borel_sa (
Rbar_rvmult (
fn n) (
EventIndicator (
classic_dec p))))).
{
intros.
apply Rbar_rvmult_rv;
trivial.
apply Real_Rbar_rv.
apply EventIndicator_rv.
}
assert (
rvfe:
RandomVariable dom Rbar_borel_sa (
Rbar_rvmult f (
EventIndicator (
classic_dec p)))).
{
apply Rbar_rvmult_rv;
trivial.
apply Real_Rbar_rv.
apply EventIndicator_rv.
}
assert (
isfen :
forall n :
nat,
Rbar_IsFiniteExpectation (
Rbar_rvmult (
fn n) (
EventIndicator (
classic_dec p)))).
{
intros.
apply Rbar_IsFiniteExpectation_indicator;
trivial.
now destruct p.
}
assert (
isfe0 :
Rbar_IsFiniteExpectation (
Rbar_rvmult f (
EventIndicator (
classic_dec p)))).
{
apply Rbar_IsFiniteExpectation_indicator;
trivial.
now destruct p.
}
assert (
Rbar_IsFiniteExpectation (
fun x :
Ts =>
g'
x)).
{
unfold Rbar_IsFiniteExpectation.
rewrite <-
Expectation_Rbar_Expectation.
rewrite <- (
Expectation_almostR2_proper _ _ _ eqqg).
rewrite Expectation_Rbar_Expectation.
apply fing'.
}
generalize (
Dominated_convergence
(
fun n =>
Rbar_rvmult (
fn n) (
EventIndicator (
classic_dec p)))
(
Rbar_rvmult f (
EventIndicator (
classic_dec p)))
g'
);
intros HH.
cut_to HH.
+
assert (
eqq1:
Rbar_FiniteExpectation f =
Rbar_FiniteExpectation (
Rbar_rvmult f (
EventIndicator (
classic_dec p)))).
{
apply Rbar_FiniteExpectation_proper_almostR2;
trivial.
exists p;
split;
trivial;
intros.
unfold Rbar_rvmult,
EventIndicator.
match_destr.
-
now rewrite Rbar_mult_1_r.
-
now rewrite Rbar_mult_0_r.
}
rewrite eqq1.
revert HH.
apply is_lim_seq_ext;
intros.
f_equal.
apply Rbar_FiniteExpectation_proper_almostR2;
trivial.
exists p;
split;
trivial;
intros.
unfold Rbar_rvmult,
EventIndicator.
match_destr;
try tauto.
rewrite Rbar_mult_1_r.
now rewrite (
proj1 (
ph x e)).
+
intros ??.
apply (
Rbar_le_trans _ (
Rbar_rvabs (
fn'
n)
a)).
*
unfold Rbar_rvabs,
Rbar_rvmult,
EventIndicator.
match_destr.
--
rewrite Rbar_mult_1_r.
rewrite (
proj1 (
ph a e)).
apply Rbar_le_refl.
--
rewrite Rbar_mult_0_r.
unfold Rbar_abs.
rewrite Rabs_R0.
match_destr;
simpl;
trivial.
apply Rabs_pos.
*
apply le'.
+
intros.
unfold Rbar_rvmult,
EventIndicator.
destruct (
classic_dec p x).
*
rewrite Rbar_mult_1_r.
destruct (
ph x e)
as [
_ islim'].
revert islim'.
apply is_Elim_seq_ext;
intros.
now rewrite Rbar_mult_1_r.
*
rewrite Rbar_mult_0_r.
generalize (
is_Elim_seq_const 0).
apply is_Elim_seq_ext;
intros.
now rewrite Rbar_mult_0_r.
Qed.
End almost.
Section sa_sub.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom)
{
dom2 :
SigmaAlgebra Ts}
(
sub :
sa_sub dom2 dom).
Lemma Rbar_NonnegExpectation_prob_space_sa_sub
(
x:
Ts->
Rbar)
{
pofrf:
Rbar_NonnegativeFunction x}
{
rv:
RandomVariable dom2 Rbar_borel_sa x}
:
@
Rbar_NonnegExpectation Ts dom2 (
prob_space_sa_sub prts sub)
x pofrf =
@
Rbar_NonnegExpectation Ts dom prts x pofrf.
Proof.
Lemma Rbar_Expectation_prob_space_sa_sub
(
x:
Ts->
Rbar)
{
rv:
RandomVariable dom2 Rbar_borel_sa x} :
@
Rbar_Expectation Ts dom2 (
prob_space_sa_sub prts sub)
x =
@
Rbar_Expectation Ts dom prts x.
Proof.
Lemma Rbar_IsFiniteExpectation_prob_space_sa_sub
(
x:
Ts->
Rbar)
{
rv:
RandomVariable dom2 Rbar_borel_sa x}
{
isfe:
Rbar_IsFiniteExpectation (
prob_space_sa_sub prts sub)
x} :
Rbar_IsFiniteExpectation prts x.
Proof.
Lemma Rbar_IsFiniteExpectation_prob_space_sa_sub_f
(
x:
Ts->
Rbar)
{
rv:
RandomVariable dom2 Rbar_borel_sa x}
{
isfe:
Rbar_IsFiniteExpectation prts x} :
Rbar_IsFiniteExpectation (
prob_space_sa_sub prts sub)
x.
Proof.
End sa_sub.
Section more_stuff.
Lemma Rbar_NonnegExpectation_const_pinfty {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
pf:
Rbar_NonnegativeFunction (
const (
B:=
Ts)
p_infty)) :
Rbar_NonnegExpectation (
const p_infty) =
p_infty.
Proof.
Lemma Rbar_NonnegExpectation_const' {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
c :
Rbar) (
nneg:
Rbar_le 0
c) (
nnf:
Rbar_NonnegativeFunction (
const (
B:=
Ts)
c)) :
Rbar_NonnegExpectation (
const c) =
c.
Proof.
Lemma Rbar_NonnegExpectation_inf_mult_indicator {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
{
P :
event dom}
(
dec :
dec_event P)
{
pofrf:
Rbar_NonnegativeFunction (
Rbar_rvmult (
const p_infty) (
EventIndicator dec))} :
ps_P P <> 0 ->
Rbar_NonnegExpectation (
Rbar_rvmult (
const p_infty) (
EventIndicator dec)) =
p_infty.
Proof.
Lemma Rbar_NonnegExpectation_pinfty_prob {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
rv_X
{
rv:
RandomVariable dom Rbar_borel_sa rv_X}
{
pofrf:
Rbar_NonnegativeFunction rv_X} :
ps_P (
exist _ _ (
sa_pinf_Rbar rv_X rv)) <> 0 ->
Rbar_NonnegExpectation rv_X =
p_infty.
Proof.
Lemma Rbar_NonnegExpectation_scale' {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
c
(
rv_X :
Ts ->
Rbar)
{
rv:
RandomVariable dom Rbar_borel_sa rv_X}
{
pofrf:
Rbar_NonnegativeFunction rv_X}
{
pofrf2:
Rbar_NonnegativeFunction (
Rbar_rvmult (
const c)
rv_X)} :
Rbar_le 0
c ->
Rbar_NonnegExpectation (
Rbar_rvmult (
const c)
rv_X) =
Rbar_mult c (
Rbar_NonnegExpectation rv_X).
Proof.
Lemma sum_Rbar_n_rv {
Ts} {
dom:
SigmaAlgebra Ts}
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n)) :
forall n,
RandomVariable dom Rbar_borel_sa (
fun a :
Ts =>
sum_Rbar_n (
fun n=>
Xn n a)
n).
Proof.
Lemma Rbar_NonnegExpectation_sum {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
(
Xlim_pos :
forall n,
Rbar_NonnegativeFunction (
fun omega :
Ts =>
sum_Rbar_n (
fun n :
nat =>
Xn n omega)
n))
:
forall n,
sum_Rbar_n (
fun n =>
Rbar_NonnegExpectation (
Xn n))
n =
Rbar_NonnegExpectation (
fun omega =>
sum_Rbar_n (
fun n => (
Xn n omega))
n).
Proof.
Lemma Rbar_series_expectation {
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
Xn :
nat ->
Ts ->
Rbar)
(
Xn_rv :
forall n,
RandomVariable dom Rbar_borel_sa (
Xn n))
(
Xn_pos :
forall n,
Rbar_NonnegativeFunction (
Xn n))
(
Xlim_pos :
Rbar_NonnegativeFunction (
fun omega :
Ts =>
ELim_seq (
sum_Rbar_n (
fun n :
nat =>
Xn n omega))))
:
ELim_seq
(
sum_Rbar_n
(
fun n :
nat =>
Rbar_NonnegExpectation (
Xn n))) =
Rbar_NonnegExpectation (
fun omega =>
ELim_seq (
sum_Rbar_n (
fun n => (
Xn n omega)))).
Proof.
Lemma Rbar_is_finite_expectation_isfe_minus1
{
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1:
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2:
RandomVariable dom Rbar_borel_sa rv_X2}
{
isfe1:
Rbar_IsFiniteExpectation prts rv_X2}
{
isfe2:
Rbar_IsFiniteExpectation prts (
Rbar_rvminus rv_X1 rv_X2)} :
Rbar_IsFiniteExpectation prts rv_X1.
Proof.
Local Existing Instance Rbar_le_pre.
Lemma Rbar_NonnegExpectation_almostR2_le
{
Ts} {
dom:
SigmaAlgebra Ts} (
prts:
ProbSpace dom)
(
rv_X1 rv_X2 :
Ts ->
Rbar)
{
rv1:
RandomVariable dom Rbar_borel_sa rv_X1}
{
rv2:
RandomVariable dom Rbar_borel_sa rv_X2}
{
nnf1 :
Rbar_NonnegativeFunction rv_X1}
{
nnf2 :
Rbar_NonnegativeFunction rv_X2} :
almostR2 _ Rbar_le rv_X1 rv_X2 ->
Rbar_le (
Rbar_NonnegExpectation rv_X1) (
Rbar_NonnegExpectation rv_X2).
Proof.
Lemma ELimInf_seq_pos_fun_part {
Ts}
f :
Rbar_rv_le
(
fun x :
Ts =>
Rbar_pos_fun_part (
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
f n omega))
x)
(
fun x :
Ts => (
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat => (
Rbar_pos_fun_part (
f n))
omega))
x).
Proof.
Lemma ELimInf_seq_sup_neg_fun_part {
Ts}
f :
Rbar_rv_le
(
Rbar_neg_fun_part (
fun omega :
Ts =>
ELimSup_seq (
fun n :
nat =>
f n omega)))
(
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
Rbar_neg_fun_part (
fun x :
Ts =>
f n x)
omega)).
Proof.
Lemma ELimInf_seq_neg_fun_part {
Ts}
f ts :
ex_Elim_seq (
fun n =>
f n ts) ->
Rbar_le
((
Rbar_neg_fun_part (
fun omega :
Ts =>
ELimInf_seq (
fun n :
nat =>
f n omega)))
ts)
(
ELimInf_seq (
fun n :
nat =>
Rbar_neg_fun_part (
fun x :
Ts =>
f n x)
ts)).
Proof.
End more_stuff.