Module FormalML.ProbTheory.SimpleExpectation
Class NonEmpty (A : Type) :=
ex : A.
Lemma non_empty_frf_vals
(rv_X : Ts -> R)
(frf : FiniteRangeFunction rv_X) :
NonEmpty Ts -> frf_vals <> nil.
Proof.
intros.
destruct frf.
unfold RandomVariable.frf_vals.
assert (
In (
rv_X ex)
frf_vals)
by apply frf_vals_complete.
intuition.
now subst.
Qed.
Lemma nil_frf_vals_empty_Ts
{rv_X : Ts -> R}
(frf : FiniteRangeFunction rv_X) :
frf_vals = nil -> (forall (x:Ts), False).
Proof.
intros.
destruct frf.
unfold RandomVariable.frf_vals in *;
subst.
simpl in frf_vals_complete.
now specialize (
frf_vals_complete x).
Qed.
Lemma list_union_frf_preimage
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
(frf : FiniteRangeFunction rv_X) :
event_equiv (list_union (map (preimage_singleton rv_X) frf_vals)) Ω .
Proof.
Lemma event_disjoint_preimage_and_disj
f P l
{rv : RandomVariable dom borel_sa f} :
NoDup l ->
ForallOrdPairs event_disjoint (map (fun x => preimage_singleton f x ∩ P) l).
Proof.
induction l;
simpl;
intros nd.
-
constructor.
-
invcs nd.
constructor;
auto.
rewrite Forall_map.
rewrite Forall_forall.
intros x xin e [??] [??].
congruence.
Qed.
Lemma event_disjoint_and_preimage_disj
f P l
{rv : RandomVariable dom borel_sa f} :
NoDup l ->
ForallOrdPairs event_disjoint (map (fun x => P ∩ preimage_singleton f x) l).
Proof.
induction l;
simpl;
intros nd.
-
constructor.
-
invcs nd.
constructor;
auto.
rewrite Forall_map.
rewrite Forall_forall.
intros x xin e [??] [??].
congruence.
Qed.
Lemma event_disjoint_preimage_disj_pairs
f1 f2 l
{rv1 : RandomVariable dom borel_sa f1}
{rv2 : RandomVariable dom borel_sa f2} :
NoDup l ->
ForallOrdPairs event_disjoint
(map (fun (x : R*R) => (preimage_singleton f1 (fst x) ∩ preimage_singleton f2 (snd x))) l).
Proof.
Lemma frf_vals_nodup_preimage_disj
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X} :
ForallOrdPairs event_disjoint (map (preimage_singleton rv_X) (nodup Req_EM_T frf_vals)).
Proof.
Lemma frf_vals_prob_1
(rv_X : Ts -> R)
{rv: RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X} :
list_sum (map (fun x : R => ps_P (preimage_singleton rv_X x))
(nodup Req_EM_T frf_vals)) = 1.
Proof.
Lemma simple_random_all
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X} :
event_equiv (list_union (map (preimage_singleton rv_X) frf_vals))
Ω .
Proof.
unfold Ω,
list_union,
event_equiv.
intros.
destruct frf.
split;
intros.
-
now repeat red.
-
eexists.
split;
trivial.
apply in_map_iff.
now exists (
rv_X x).
now simpl.
Qed.
Lemma prob_inter_all1
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2)
(a:R) :
NoDup (frf_vals (FiniteRangeFunction := frf2)) ->
ps_P (preimage_singleton rv_X1 a) =
list_sum
(map (fun x : R => ps_P (preimage_singleton rv_X1 a ∩ preimage_singleton rv_X2 x))
(frf_vals (FiniteRangeFunction:=frf2))).
Proof.
Lemma prob_inter_all2
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2)
(a:R) :
NoDup (frf_vals (FiniteRangeFunction := frf1)) ->
ps_P (preimage_singleton rv_X2 a) =
list_sum
(map (fun x : R => ps_P (preimage_singleton rv_X1 x ∩ preimage_singleton rv_X2 a))
(frf_vals (FiniteRangeFunction:=frf1))).
Proof.
Lemma RefineEvent
(E : event dom) (lE : list (event dom)):
event_equiv (list_union lE) Ω ->
event_equiv E (list_union (map (event_inter E) lE)).
Proof.
Lemma RefineSimpleExpectation
{rv_X rv_X2 : Ts -> R}
{rv: RandomVariable dom borel_sa rv_X}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf : FiniteRangeFunction rv_X)
(frf2 : FiniteRangeFunction rv_X2) :
list_sum
(map (fun v : R => v * ps_P (preimage_singleton rv_X v))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction:=frf)))) =
list_sum
(map (fun vv : R*R =>
(fst vv) * ps_P ((preimage_singleton rv_X (fst vv)) ∩ (preimage_singleton rv_X2 (snd vv))))
(list_prod (nodup Req_EM_T (frf_vals (FiniteRangeFunction:=frf)))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction:=frf2))))).
Proof.
Lemma zero_prob_or_witness (E : event dom) :
ps_P E <> 0 -> exists (x:Ts), E x.
Proof.
Lemma SimpleExpectation_le
(rv_X1 rv_X2 : Ts -> R)
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :
rv_le rv_X1 rv_X2 ->
SimpleExpectation rv_X1 <= SimpleExpectation rv_X2.
Proof.
Lemma sumSimpleExpectation00
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2) :
NoDup (frf_vals (FiniteRangeFunction := frf1)) ->
NoDup (frf_vals (FiniteRangeFunction := frf2)) ->
list_sum
(map (fun v : R => v * ps_P (preimage_singleton rv_X1 v))
(frf_vals (FiniteRangeFunction := frf1))) =
list_sum
(map
(fun v : R * R =>
(fst v) *
ps_P (preimage_singleton rv_X1 (fst v) ∩ preimage_singleton rv_X2 (snd v)))
(list_prod (frf_vals (FiniteRangeFunction := frf1))
(frf_vals (FiniteRangeFunction := frf2)))).
Proof.
Lemma sumSimpleExpectation11
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2) :
NoDup (frf_vals (FiniteRangeFunction := frf1)) ->
NoDup (frf_vals (FiniteRangeFunction := frf2)) ->
list_sum
(map (fun v : R => v * ps_P (preimage_singleton rv_X2 v))
(frf_vals (FiniteRangeFunction := frf2))) =
list_sum
(map
(fun v : R * R =>
(snd v) *
ps_P (preimage_singleton rv_X1 (fst v) ∩ preimage_singleton rv_X2 (snd v)))
(list_prod (frf_vals (FiniteRangeFunction := frf1))
(frf_vals (FiniteRangeFunction := frf2)))).
Proof.
Lemma sumSimpleExpectation0
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2) :
list_sum
(map (fun v : R => v * ps_P (preimage_singleton rv_X1 v))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf1)))) =
list_sum
(map
(fun v : R * R =>
(fst v) *
ps_P (preimage_singleton rv_X1 (fst v) ∩ preimage_singleton rv_X2 (snd v)))
(list_prod (nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf1)))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf2))))).
Proof.
Lemma sumSimpleExpectation1
{rv_X1 rv_X2 : Ts -> R}
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
(frf1 : FiniteRangeFunction rv_X1)
(frf2 : FiniteRangeFunction rv_X2) :
list_sum
(map (fun v : R => v * ps_P (preimage_singleton rv_X2 v))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf2)))) =
list_sum
(map
(fun v : R * R =>
(snd v) *
ps_P (preimage_singleton rv_X1 (fst v) ∩ preimage_singleton rv_X2 (snd v)))
(list_prod (nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf1)))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction := frf2))))).
Proof.
Definition sums_same (x y:R*R) := fst x + snd x = fst y + snd y.
Instance sums_same_equiv : Equivalence sums_same.
Proof.
unfold sums_same.
constructor;
red.
-
intros [??];
simpl;
trivial.
-
intros [??][??];
simpl;
congruence.
-
intros [??][??][??];
simpl.
congruence.
Qed.
Instance sums_same_dec : EqDec (R*R) sums_same.
Proof.
intros [??] [??].
apply Req_EM_T.
Defined.
Lemma preimage_points_disjoint
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
(c d: R) :
c <> d ->
event_disjoint (preimage_singleton rv_X c)
(preimage_singleton rv_X d).
Proof.
Lemma preimage_point_pairs_disjoint
(rv_X1 rv_X2: Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
(c1 c2 d1 d2: R) :
(c1 <> d1) \/ (c2 <> d2) ->
event_disjoint (event_inter (preimage_singleton rv_X1 c1)
(preimage_singleton rv_X2 c2))
(event_inter (preimage_singleton rv_X1 d1)
(preimage_singleton rv_X2 d2)).
Proof.
Lemma quotient_bucket_NoDup {A:Type} (R:A->A->Prop) {eqR:Equivalence R} {decR:EqDec A R} l :
NoDup l ->
Forall (@NoDup A) (quotient R l).
Proof.
Lemma list_union_sub_cover (l : list (event dom)) (P Q: event dom) :
event_union (list_union l) Q = Ω ->
event_disjoint P Q ->
(forall (e:event dom), In e l -> event_inter P e = e ) ->
event_equiv (list_union l) P.
Proof.
Lemma sumSimpleExpectation
(rv_X1 rv_X2 : Ts -> R)
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :
(SimpleExpectation rv_X1) + (SimpleExpectation rv_X2)%R =
SimpleExpectation (rvplus rv_X1 rv_X2).
Proof.
unfold SimpleExpectation;
intros.
generalize (
sumSimpleExpectation0 frf1 frf2);
intros.
generalize (
sumSimpleExpectation1 frf1 frf2);
intros.
generalize (@
sa_sigma_inter_pts _ _ rv_X1 rv_X2).
intro sa_sigma.
destruct frf1.
destruct frf2.
unfold RandomVariable.frf_vals in *;
intros.
unfold frfplus.
simpl.
unfold event_singleton,
event_preimage.
transitivity (
list_sum
(
map (
fun v :
R*
R => (
fst v +
snd v) *
ps_P
(
preimage_singleton rv_X1 (
fst v) ∩
preimage_singleton rv_X2 (
snd v)))
(
list_prod (
nodup Req_EM_T frf_vals) (
nodup Req_EM_T frf_vals0)))).
-
rewrite H.
rewrite H0.
rewrite <-
list_sum_map_add.
f_equal.
apply map_ext.
intros.
lra.
-
clear H H0.
assert (
HH:
forall x y :
R *
R, {
x =
y} + {
x <>
y})
by apply (
pair_eqdec (
H:=
Req_EM_T) (
H0:=
Req_EM_T)).
transitivity (
list_sum
(
map
(
fun v :
R *
R => (
fst v +
snd v) *
ps_P (
preimage_singleton rv_X1 (
fst v) ∩
preimage_singleton rv_X2 (
snd v)))
(
nodup HH (
list_prod frf_vals frf_vals0)))).
+
f_equal.
f_equal.
symmetry.
apply list_prod_nodup.
+
transitivity (
list_sum
(
map (
fun v :
R =>
v *
ps_P (
preimage_singleton (
rvplus rv_X1 rv_X2)
v))
(
nodup Req_EM_T (
map (
fun ab :
R *
R =>
fst ab +
snd ab) (
nodup HH (
list_prod frf_vals frf_vals0)))))).
*
generalize (
NoDup_nodup HH (
list_prod frf_vals frf_vals0)).
assert (
Hcomplete:
forall x y,
In (
rv_X1 x,
rv_X2 y) (
nodup HH (
list_prod frf_vals frf_vals0))).
{
intros.
apply nodup_In.
apply in_prod;
eauto.
}
revert Hcomplete.
generalize (
nodup HH (
list_prod frf_vals frf_vals0)).
intros.
transitivity (
list_sum
(
map
(
fun v :
R *
R => (
fst v +
snd v) *
ps_P (
preimage_singleton rv_X1 (
fst v) ∩
preimage_singleton rv_X2 (
snd v)))
(
concat (
quotient sums_same l)))).
{
apply list_sum_Proper.
apply Permutation.Permutation_map.
symmetry.
apply unquotient_quotient.
}
rewrite concat_map.
rewrite list_sum_map_concat.
rewrite map_map.
transitivity (
list_sum
(
map (
fun v :
R =>
v *
ps_P (
preimage_singleton (
rvplus rv_X1 rv_X2)
v))
(
map (
fun ab :
R *
R =>
fst ab +
snd ab) (
map (
hd (0,0)) (
quotient sums_same l))))).
--
repeat rewrite map_map;
simpl.
f_equal.
apply map_ext_in;
intros.
generalize (
quotient_nnil sums_same l).
generalize (
quotient_all_equivs sums_same l).
generalize (
quotient_all_different sums_same l).
unfold all_equivs,
all_different.
repeat rewrite Forall_forall.
intros Hdiff Hequiv Hnnil.
specialize (
Hnnil _ H0).
specialize (
Hequiv _ H0).
unfold is_equiv_class,
ForallPairs in Hequiv.
destruct a;
simpl in *; [
congruence | ];
clear Hnnil.
transitivity ((
fst p +
snd p) *
ps_P (
preimage_singleton rv_X1 (
fst p) ∩
preimage_singleton rv_X2 (
snd p)) +
list_sum
(
map
(
fun v :
R *
R => (
fst p +
snd p) *
ps_P (
preimage_singleton rv_X1 (
fst v) ∩
preimage_singleton rv_X2 (
snd v)))
a)).
++
f_equal.
f_equal.
apply map_ext_in;
intros.
f_equal.
apply Hequiv;
auto.
++
rewrite list_sum_const_mul.
simpl.
rewrite <-
Rmult_plus_distr_l.
f_equal.
transitivity (
list_sum (
map (
fun x :
R *
R =>
ps_P (
preimage_singleton rv_X1 (
fst x) ∩
preimage_singleton rv_X2 (
snd x))) (
p::
a))); [
reflexivity |].
rewrite list_sum_fold_right.
rewrite <-
map_map.
rewrite <-
ps_list_disjoint_union.
**
apply ps_proper;
intros x.
unfold preimage_singleton,
pre_event_preimage,
event_inter,
pre_event_inter,
pre_event_singleton,
rvplus;
simpl.
split.
---
intros [
e [
ein ex]].
destruct ein as [?|
ein].
+++
subst;
simpl in *.
destruct ex.
congruence.
+++
apply in_map_iff in ein.
destruct ein as [
ee [?
eein]];
subst.
destruct ex as [
ex1 ex2].
rewrite ex1,
ex2.
apply Hequiv;
eauto.
---
intros.
assert (
Hin:
In (
rv_X1 x,
rv_X2 x)
l)
by apply Hcomplete.
destruct (
quotient_in sums_same _ _ Hin)
as [
xx [
xxin inxx]].
generalize (
all_different_same_eq sums_same (
quotient sums_same l)
xx (
p::
a) (
rv_X1 x,
rv_X2 x) (
fst p,
snd p));
simpl;
trivial;
intros.
rewrite H2 in inxx;
trivial
;
destruct p;
simpl;
eauto.
destruct inxx.
+++
eexists.
split; [
left;
reflexivity | ];
simpl.
invcs H3;
tauto.
+++
eexists.
split.
***
right.
apply in_map.
apply H3.
***
simpl.
tauto.
**
apply event_disjoint_preimage_disj_pairs.
generalize (
quotient_bucket_NoDup sums_same l H);
rewrite Forall_forall;
eauto.
--
apply list_sum_Proper.
apply Permutation_map.
rewrite <- (
nodup_hd_quotient Req_EM_T 0).
rewrite quotient_map.
match goal with
| [|-
Permutation ?
l1 ?
l2 ] =>
replace l1 with l2; [
reflexivity | ]
end.
simpl.
repeat rewrite map_map.
erewrite quotient_ext.
++
eapply map_ext_in.
simpl;
intros.
destruct a;
simpl;
lra.
++
unfold sums_same;
red;
simpl;
intros;
intuition.
*
now rewrite nodup_map_nodup.
Qed.
Lemma not_in_frf_vals_event_none
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf:FiniteRangeFunction rv_X} :
forall (x:R), ~ (In x frf_vals) ->
event_equiv (preimage_singleton rv_X x) event_none.
Proof.
Lemma SimpleExpectation_simpl_incl
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
(frf:FiniteRangeFunction rv_X)
(l:list R)
(lincl : incl frf_vals l) :
SimpleExpectation rv_X (frf:=frf) = SimpleExpectation rv_X (frf:=(FiniteRangeFunction_enlarged frf l lincl)).
Proof.
Lemma SimpleExpectation_rv_irrel
{rv_X : Ts -> R}
(rv1 : RandomVariable dom borel_sa rv_X)
(rv2 : RandomVariable dom borel_sa rv_X)
{frf:FiniteRangeFunction rv_X} :
SimpleExpectation rv_X (rv:=rv1) = SimpleExpectation rv_X (rv:=rv2).
Proof.
Lemma SimpleExpectation_pf_irrel
{rv_X : Ts -> R}
{rv1 : RandomVariable dom borel_sa rv_X}
{rv2 : RandomVariable dom borel_sa rv_X}
(frf1 frf2:FiniteRangeFunction rv_X):
SimpleExpectation rv_X (rv:=rv1) (frf:=frf1) = SimpleExpectation rv_X (rv:=rv2) (frf:=frf2).
Proof.
Lemma sumSimpleExpectation'
(rv_X1 rv_X2 : Ts -> R)
{rv1: RandomVariable dom borel_sa rv_X1}
{rv2: RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
{rv': RandomVariable dom borel_sa (rvplus rv_X1 rv_X2)}
{frf' : FiniteRangeFunction (rvplus rv_X1 rv_X2)} :
SimpleExpectation (rv:=rv') (frf:=frf') (rvplus rv_X1 rv_X2) =
(SimpleExpectation rv_X1) + (SimpleExpectation rv_X2)%R.
Proof.
Lemma SimplePosExpectation_pos_zero x
{rvx:RandomVariable dom borel_sa x}
{xfrf:FiniteRangeFunction x} :
almostR2 Prts eq x (const 0) ->
SimpleExpectation x = 0.
Proof.
Lemma Expectation_simple_proper_almostR2 x y
{rvx:RandomVariable dom borel_sa x}
{rvy:RandomVariable dom borel_sa y}
{xfrf:FiniteRangeFunction x}
{yfrf:FiniteRangeFunction y} :
almostR2 Prts eq x y ->
SimpleExpectation x = SimpleExpectation y.
Proof.
Definition val_indicator (f : Ts -> R) (c : R) :=
EventIndicator (classic_dec (fun omega => f omega = c)).
Definition scale_val_indicator (f : Ts -> R) (c : R) :=
rvscale c (val_indicator f c).
Global Instance val_indicator_rv g c
{rv:RandomVariable dom borel_sa g} :
RandomVariable dom borel_sa (val_indicator g c).
Proof.
Global Instance scale_val_indicator_rv g c
{rv:RandomVariable dom borel_sa g} :
RandomVariable dom borel_sa (scale_val_indicator g c).
Proof.
Definition frf_indicator (f : Ts -> R)
{frf : FiniteRangeFunction f} :=
(fun omega =>
(RealAdd.list_sum (map (fun c => scale_val_indicator f c omega)
(nodup Req_EM_T frf_vals)))).
Lemma frf_indicator_sum_helper f l a:
NoDup l ->
In (f a) l ->
f a =
list_sum (map (fun c : R => scale_val_indicator f c a) l).
Proof.
induction l;
simpl; [
tauto |].
intros nd inn.
invcs nd.
specialize (
IHl H2).
unfold scale_val_indicator,
val_indicator,
EventIndicator,
rvscale in *.
match_destr.
-
field_simplify.
cut (
list_sum
(
map
(
fun c :
R =>
c * (
if classic_dec (
fun omega :
Ts =>
f omega =
c)
a then 1
else 0))
l)
= 0); [
lra | ].
rewrite <-
e in H1.
revert H1.
clear.
induction l;
simpl;
trivial.
intros ninn.
apply not_or_and in ninn.
destruct ninn as [??].
rewrite IHl by trivial.
match_destr;
lra.
-
field_simplify.
apply IHl.
destruct inn;
trivial.
congruence.
Qed.
Theorem frf_indicator_sum (f : Ts -> R)
{frf : FiniteRangeFunction f} :
rv_eq f (frf_indicator f).
Proof.
End SimpleExpectation_sec.
Section EventRestricted.
Context {Ts:Type}
{dom: SigmaAlgebra Ts}
(Prts: ProbSpace dom).
Lemma event_restricted_SimpleExpectation P (pf1 : ps_P P = 1) pf (f : Ts -> R)
{rv : RandomVariable dom borel_sa f}
{frf : FiniteRangeFunction f} :
@SimpleExpectation _ _ Prts f rv frf =
@SimpleExpectation _ _ (event_restricted_prob_space Prts P pf)
(event_restricted_function P f)
(Restricted_RandomVariable P f rv) _.
Proof.
End EventRestricted.
Section SimpleConditionalExpectation.
Context
{Ts:Type}
{dom: SigmaAlgebra Ts}
{Prts: ProbSpace dom}.
Program Definition gen_simple_conditional_expectation_scale (P : event dom)
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x}) :=
rvscale (if (Req_EM_T (ps_P P) 0) then 0 else
((SimpleExpectation ((rvmult rv_X (EventIndicator dec)))) / (ps_P P)))
(EventIndicator dec).
Instance gen_simple_conditional_expectation_scale_rv (P : event dom)
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x}) :
RandomVariable dom borel_sa (gen_simple_conditional_expectation_scale P rv_X dec).
Proof.
Instance gen_simple_conditional_expectation_scale_simpl (P : event dom)
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x}) :
FiniteRangeFunction (gen_simple_conditional_expectation_scale P rv_X dec).
Proof.
Definition with_index_simple {A} (l:list A) : list (nat*A)
:= (combine (seq 0 (length l)) l).
Definition SimpleConditionalExpectationSA
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :=
fold_right rvplus (const 0)
(map
(fun ev => gen_simple_conditional_expectation_scale (dsa_event ev) rv_X (dsa_dec ev))
l).
Instance SimpleConditionalExpectationSA_simpl
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
FiniteRangeFunction (SimpleConditionalExpectationSA rv_X l).
Proof.
Global Instance gen_simple_conditional_expectation_rv
(rv_X : Ts -> R)
{rv:RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
RandomVariable dom borel_sa (SimpleConditionalExpectationSA rv_X l).
Proof.
Definition simple_conditional_expectation_scale_coef (c : R)
(rv_X rv_X2 : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf : FiniteRangeFunction rv_X}
{frf2 : FiniteRangeFunction rv_X2} : R :=
if Req_EM_T (ps_P (preimage_singleton rv_X2 c)) 0 then 0 else
((SimpleExpectation
(rvmult rv_X
(point_preimage_indicator rv_X2 c)))
/ (ps_P (preimage_singleton rv_X2 c))).
Definition SimpleConditionalExpectation_list
(rv_X1 rv_X2 : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X1}
{rv : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
:= map (fun c => (rvscale (simple_conditional_expectation_scale_coef c rv_X1 rv_X2)
(point_preimage_indicator rv_X2 c)))
(nodup Req_EM_T (frf_vals (FiniteRangeFunction:=frf2))).
Definition SimpleConditionalExpectation
(rv_X1 rv_X2 : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X1}
{rv : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :=
fold_right rvplus (const 0)
(SimpleConditionalExpectation_list rv_X1 rv_X2).
Lemma SimpleConditionalExpectation_list_rv
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :
Forall (RandomVariable dom borel_sa) (SimpleConditionalExpectation_list rv_X1 rv_X2).
Proof.
Lemma SimpleConditionalExpectation_list_simple
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :
Forallt FiniteRangeFunction (SimpleConditionalExpectation_list rv_X1 rv_X2).
Proof.
Instance SimpleConditionalExpectation_rv
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
: RandomVariable dom borel_sa (SimpleConditionalExpectation rv_X1 rv_X2).
Proof.
Instance SimpleConditionalExpectation_simple
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
: FiniteRangeFunction (SimpleConditionalExpectation rv_X1 rv_X2).
Proof.
Lemma SimpleExpectation_pre_EventIndicator
{P : pre_event Ts}
(sa_P:sa_sigma P)
(dec: forall x, {P x} + {~ P x}) :
SimpleExpectation (EventIndicator dec)
(rv:=EventIndicator_pre_rv _ dec sa_P)
(frf:=EventIndicator_pre_frf dec)
= ps_P (exist _ P sa_P).
Proof.
Lemma SimpleExpectation_EventIndicator
{P : event dom}
(dec: forall x, {P x} + {~ P x}) :
SimpleExpectation (EventIndicator dec) = ps_P P.
Proof.
Definition fold_rvplus_prod_indicator
(rv_X : Ts -> R)
(l : list dec_sa_event) :=
(fold_right rvplus (const 0)
(map (fun ev =>
rvmult rv_X (EventIndicator (dsa_dec ev))) l)).
Instance fold_rvplus_prod_indicator_rv
(rv_X : Ts -> R)
{frf : RandomVariable dom borel_sa rv_X}
(l : list dec_sa_event) :
RandomVariable dom borel_sa (fold_rvplus_prod_indicator rv_X l).
Proof.
Instance fold_rvplus_prod_indicator_simpl
(rv_X : Ts -> R)
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
FiniteRangeFunction (fold_rvplus_prod_indicator rv_X l).
Proof.
Lemma SimpleExpectation_const c frf : SimpleExpectation (const c) (frf:=frf) = c.
Proof.
Lemma SimpleExpectation_nneg (f : Ts -> R)
{frf: FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
NonnegativeFunction f ->
0 <= SimpleExpectation f.
Proof.
Lemma scaleSimpleExpectation' (c:R)
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
{rv' : RandomVariable dom borel_sa (rvscale c rv_X)}
{frf' : FiniteRangeFunction (rvscale c rv_X)} :
SimpleExpectation (rv:=rv') (frf:=frf') (rvscale c rv_X) = (c * SimpleExpectation rv_X)%R.
Proof.
Instance RandomVariable_transport
{rv_X1 rv_X2:Ts->R}
{rv : RandomVariable dom borel_sa rv_X1}
(eqq:rv_eq rv_X1 rv_X2) :
RandomVariable dom borel_sa rv_X2.
Proof.
now rewrite eqq in rv.
Qed.
Program Instance FiniteRangeFunction_transport
{rv_X1 rv_X2:Ts->R}
(frf1:FiniteRangeFunction rv_X1)
(eqq:rv_eq rv_X1 rv_X2) :
FiniteRangeFunction rv_X2
:= { frf_vals := frf_vals }.
Next Obligation.
Global Instance pre_event_preimage_proper {A B} : Proper (rv_eq ==> pre_event_equiv ==> pre_event_equiv) (@pre_event_preimage A B).
Proof.
Global Instance event_preimage_proper {A B S} : Proper (rv_eq ==> event_equiv ==> pre_event_equiv) (@event_preimage A B S).
Proof.
Lemma SimpleExpectation_transport {rv_X1 rv_X2:Ts->R}
{rv1 : RandomVariable dom borel_sa rv_X1}
(frf1:FiniteRangeFunction rv_X1)
(eqq:rv_eq rv_X1 rv_X2) :
SimpleExpectation rv_X1 = SimpleExpectation rv_X2 (rv:=RandomVariable_transport eqq) (frf:=FiniteRangeFunction_transport frf1 eqq).
Proof.
Lemma SimpleExpectation_ext
{rv_X1 rv_X2 : Ts -> R}
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1:FiniteRangeFunction rv_X1}
{frf2:FiniteRangeFunction rv_X2}:
rv_eq rv_X1 rv_X2 ->
SimpleExpectation rv_X1 = SimpleExpectation rv_X2.
Proof.
Lemma EventIndicator_ext {P1 P2 : Ts->Prop} (dec1:forall x, {P1 x} + {~ P1 x}) (dec2:forall x, {P2 x} + {~ P2 x}) :
pre_event_equiv P1 P2 -> rv_eq (EventIndicator dec1) (EventIndicator dec2).
Proof.
Lemma SimpleConditionalExpectationSA_ext (x y:Ts->R)
{rvx : RandomVariable dom borel_sa x}
{rvy : RandomVariable dom borel_sa y}
{frfx : FiniteRangeFunction x}
{frfy : FiniteRangeFunction y}
(l1 l2 : list dec_sa_event) :
rv_eq x y ->
Forall2 dsa_equiv l1 l2 ->
rv_eq (SimpleConditionalExpectationSA x l1)
(SimpleConditionalExpectationSA y l2).
Proof.
Lemma SimpleConditionalExpectationSA_transport (x y:Ts->R)
{rvx : RandomVariable dom borel_sa x}
{frfx : FiniteRangeFunction x}
(l1 l2 : list dec_sa_event)
(eqq:rv_eq x y) :
Forall2 dsa_equiv l1 l2 ->
rv_eq (SimpleConditionalExpectationSA x l1)
(SimpleConditionalExpectationSA y l2 (rv:=RandomVariable_transport eqq) (frf:=FiniteRangeFunction_transport frfx eqq)).
Proof.
Lemma SimpleConditionalExpectationSA_pf_irrel (x:Ts->R)
{rv1 rv2 : RandomVariable dom borel_sa x}
{frf1 frf2: FiniteRangeFunction x}
l :
SimpleConditionalExpectationSA x l (rv:=rv1) (frf:=frf1) =
(SimpleConditionalExpectationSA x l (rv:=rv1) (frf:=frf2)).
Proof.
Lemma expectation_indicator_sum0
(rv_X : Ts -> R)
(rv : RandomVariable dom borel_sa rv_X)
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
list_sum
(map (fun ev => SimpleExpectation
(rvmult rv_X (EventIndicator (dsa_dec ev)))) l) =
SimpleExpectation
(fold_rvplus_prod_indicator rv_X l).
Proof.
Ltac se_rewrite H :=
match type of H with
| @SimpleExpectation _ _ _ ?x _ ?sx = _ =>
match goal with
| [|- context [@SimpleExpectation _ _ _ ?z _ ?sz]] =>
rewrite (@SimpleExpectation_pf_irrel x sz sx); rewrite H
end
end.
Lemma is_partition_list_nnil : NonEmpty Ts -> ~ is_partition_list [].
Proof.
intros a [??];
unfold list_union in *;
simpl in *.
assert (
HH:Ω
a)
by now compute.
rewrite <- (
H0 a)
in HH.
destruct HH as [? [??]].
tauto.
Qed.
Lemma list_union_dec (l:list dec_sa_event) :
(forall x, sumbool ((list_union (map dsa_event l)) x) (~ (list_union (map dsa_event l)) x)).
Proof.
unfold list_union.
intros x.
induction l;
simpl.
-
right;
intros [?[??]];
tauto.
-
simpl in *.
destruct (
dsa_dec a x).
+
left.
exists (
dsa_event a).
tauto.
+
destruct IHl.
*
left.
destruct e as [? [??]];
eauto.
*
right.
intros [? [[?|?]?]].
--
congruence.
--
apply n0.
eauto.
Defined.
Instance fr_plus0_simple (l : list (Ts -> R))
(frfs : Forallt FiniteRangeFunction l) :
FiniteRangeFunction (fold_right rvplus (const 0) l).
Proof.
induction l;
simpl.
-
typeclasses eauto.
-
invcs frfs.
apply frfplus;
eauto.
Qed.
Lemma very_specific_fold_right_rv_because_barry_waiting l :
Forall (RandomVariable dom borel_sa) l ->
RandomVariable dom borel_sa (fold_right rvplus (const 0) l).
Proof.
induction l;
simpl;
intros HH.
-
typeclasses eauto.
-
invcs HH.
apply rvplus_rv;
eauto.
Qed.
Lemma Forall_Forallt {A : Type} {P : A -> Prop} {l : list A} :
Forall P l -> Forallt P l.
Proof.
induction l;
intros HH;
constructor.
-
rewrite Forall_forall in HH.
apply HH;
simpl;
eauto.
-
apply IHl.
now invcs HH.
Defined.
Lemma Forallt_conj {A : Type} {P1 P2 : A -> Type} {l : list A} :
Forallt P1 l ->
Forallt P2 l ->
Forallt (fun x => prod (P1 x) (P2 x)) l.
Proof.
induction l; intros HH1 HH2.
- constructor.
- invcs HH1.
invcs HH2.
constructor; eauto.
Defined.
Lemma SimpleExpectation_fold_rvplus (l : list (Ts -> R))
(rvs : Forall (RandomVariable dom borel_sa) l)
(frfs : Forallt FiniteRangeFunction l) :
SimpleExpectation (fold_right rvplus (const 0) l) (rv:=very_specific_fold_right_rv_because_barry_waiting _ rvs) (frf:=fr_plus0_simple _ frfs) =
list_sum (Forallt_map (fun x pf => SimpleExpectation x (rv:=fst pf) (frf:=snd pf)) (Forallt_conj (Forall_Forallt rvs) frfs)).
Proof.
Lemma SimpleExpectation_fold_rvplus' (l : list (Ts -> R))
{rv : RandomVariable dom borel_sa (fold_right rvplus (const 0) l)}
{frf : FiniteRangeFunction (fold_right rvplus (const 0) l)}
(rvs : Forall (RandomVariable dom borel_sa) l)
(frfs : Forallt FiniteRangeFunction l) :
SimpleExpectation (fold_right rvplus (const 0) l) (rv:=rv) (frf:=frf) =
list_sum (Forallt_map (fun x pf => SimpleExpectation x (rv:=fst pf) (frf:=snd pf)) (Forallt_conj (Forall_Forallt rvs) frfs)).
Proof.
Lemma indicator_sum (a:Ts)
(l : list dec_sa_event)
(is_disj: ForallOrdPairs event_disjoint (map dsa_event l)) :
(EventIndicator (list_union_dec l) a) =
(list_sum
(map (fun ev => EventIndicator (dsa_dec ev) a) l)).
Proof.
unfold EventIndicator.
induction l.
-
now simpl.
-
invcs is_disj.
specialize (
IHl H2).
simpl.
rewrite Forall_forall in H1.
rewrite <-
IHl;
clear IHl.
destruct (
dsa_dec a0 a).
+
match_destr;
try lra.
destruct e as [? [
inn ?]].
specialize (
H1 _ inn a);
intuition.
+
destruct (
list_union_dec l);
try lra.
Qed.
Lemma expectation_indicator_sum_gen
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event)
(is_disj: ForallOrdPairs event_disjoint (map dsa_event l)) :
SimpleExpectation (rvmult rv_X (EventIndicator (list_union_dec l))) =
list_sum
(map (fun ev => SimpleExpectation
(rvmult rv_X (EventIndicator (dsa_dec ev)))) l).
Proof.
Lemma expectation_indicator_sum
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event)
(is_part: is_partition_list (map dsa_event l)) :
SimpleExpectation rv_X =
list_sum
(map (fun ev => SimpleExpectation
(rvmult rv_X (EventIndicator (dsa_dec ev)))) l).
Proof.
Lemma sub_event_prob_0
(P1 P2 : event dom) :
ps_P P2 = 0 -> event_sub P1 P2 -> ps_P P1 = 0.
Proof.
intros.
generalize (
ps_sub Prts P1 P2);
intros.
cut_to H1;
trivial.
generalize (
ps_pos P1);
intros.
lra.
Qed.
Lemma indicator_prob_0
(P : event dom)
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x})
(a : R) :
ps_P P = 0 ->
a <> 0 ->
ps_P (preimage_singleton (rvmult rv_X (EventIndicator dec)) a) = 0.
Proof.
Lemma expectation_indicator_prob_0
(P : event dom)
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x}) :
ps_P P = 0 ->
SimpleExpectation (rvmult rv_X (EventIndicator dec)) = 0.
Proof.
Lemma gen_simple_conditional_expectation_scale_tower (P : event dom)
{rv_X : Ts -> R}
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(dec:forall x, {P x} + {~ P x}) :
SimpleExpectation (gen_simple_conditional_expectation_scale P rv_X dec) =
SimpleExpectation (rvmult rv_X (EventIndicator dec)).
Proof.
Lemma rv_md_gen_simple_scale
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
Forall (RandomVariable dom borel_sa)
(map (fun ev =>
gen_simple_conditional_expectation_scale
(dsa_event ev) rv_X (dsa_dec ev))
l).
Proof.
induction l; simpl.
- constructor.
- constructor.
+ typeclasses eauto.
+ apply IHl.
Qed.
Lemma frf_md_gen_simple_scale
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
Forallt FiniteRangeFunction
(map (fun ev =>
gen_simple_conditional_expectation_scale
(dsa_event ev) rv_X (dsa_dec ev))
l).
Proof.
induction l; simpl.
- constructor.
- constructor.
+ typeclasses eauto.
+ apply IHl.
Defined.
Lemma gen_conditional_tower_law
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event)
(ispart: is_partition_list (map dsa_event l)) :
SimpleExpectation rv_X =
SimpleExpectation
(SimpleConditionalExpectationSA rv_X l).
Proof.
Program Definition induced_sigma_generators
{rv_X : Ts -> R}
{rv:RandomVariable dom borel_sa rv_X}
(frf : FiniteRangeFunction rv_X)
: list dec_sa_event
:=
map (fun c => Build_dec_sa_event
(preimage_singleton rv_X c) _)
(nodup Req_EM_T frf_vals).
Next Obligation.
Lemma induced_gen_ispart
{rv_X : Ts -> R}
{rv:RandomVariable dom borel_sa rv_X}
(frf : FiniteRangeFunction rv_X) :
is_partition_list (map dsa_event (induced_sigma_generators frf)).
Proof.
Lemma conditional_tower_law
(rv_X1 rv_X2 : Ts -> R)
(rv1 : RandomVariable dom borel_sa rv_X1)
(rv2 : RandomVariable dom borel_sa rv_X2)
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} :
SimpleExpectation (SimpleConditionalExpectation rv_X1 rv_X2) = SimpleExpectation rv_X1.
Proof.
Definition simple_sigma_measurable
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2} : Prop :=
forall (c2:R), In c2 (frf_vals (FiniteRangeFunction:=frf2)) ->
exists (c1:R),
(event_sub (preimage_singleton rv_X2 c2)
(preimage_singleton rv_X1 c1)).
Lemma events_measurable0_b
(l1 l2 : list (event dom)) :
(exists l : list (list (event dom)),
Forall2 (fun x y => event_equiv x (list_union y)) l1 l
/\ Permutation (concat l) l2) ->
(forall (p2:event dom),
In p2 l2 ->
exists (p1:event dom), (In p1 l1) /\ event_sub p2 p1).
Proof.
intros [
l [
Fl Pl]].
intros p2 p2inn.
rewrite <-
Pl in p2inn.
apply concat_In in p2inn.
destruct p2inn as [
ll [
llinn inll]].
destruct (
Forall2_In_r Fl llinn)
as [
x [
xin xequiv]].
exists x.
split;
trivial.
intros y p2y.
apply xequiv.
simpl;
eauto.
Qed.
Lemma classic_filter {A} (P:A->Prop) (l:list A) :
exists l', sublist l' l /\ forall x, In x l' <-> In x l /\ P x.
Proof.
induction l.
-
exists nil.
constructor.
+
constructor.
+
intuition.
-
destruct IHl as [
l' [
subl'
inifl']].
destruct (
classic (
P a)).
+
exists (
a::
l').
split.
*
constructor;
trivial.
*
simpl;
intros ?;
split.
--
intros [?|?].
++
subst;
eauto.
++
apply inifl'
in H0.
tauto.
--
intros [[?|?]?].
++
subst;
eauto.
++
right;
apply inifl';
tauto.
+
exists l'.
split.
*
apply sublist_skip;
trivial.
*
simpl in *.
intros x;
split;
intros.
--
apply inifl'
in H0.
tauto.
--
destruct H0 as [??].
apply inifl'.
split;
trivial.
destruct H0;
congruence.
Qed.
Lemma classic_sub_filter {A} (P:A->Prop) (l:list (list A)) :
exists l', Forall2 sublist l' l /\ Forall2 (fun ll1 ll2 => forall x, In x ll2 <-> In x ll1 /\ P x) l l'.
Proof.
induction l.
-
exists nil.
constructor.
+
constructor.
+
intuition.
-
destruct IHl as [
l' [
subl'
inifl']].
destruct (
classic_filter P a)
as [
a' [
a'
s a'
i]].
exists (
a'::
l').
split.
+
constructor;
trivial.
+
constructor;
trivial.
Qed.
Definition partition_measurable {Td}
{cod:SigmaAlgebra Td}
{has_pre:HasPreimageSingleton cod}
(rv_X : Ts -> Td)
{rv : RandomVariable dom cod rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list (event dom)) : Prop :=
is_partition_list l ->
forall (p:event dom),
In p l ->
exists c, event_sub p (preimage_singleton rv_X c).
Lemma event_none_or_witness (E : event dom) :
E === event_none \/ exists (x:Ts), E x.
Proof.
classical_left.
unfold event_none,
pre_event_none.
intros x;
split;
simpl;
intros y
; [|
tauto].
apply H.
eexists;
apply y.
Qed.
Global Instance pre_union_of_collection_sub_partition_proper {T} :
Proper (pre_sub_partition ==> pre_event_sub) (@pre_union_of_collection T).
Proof.
Lemma is_pre_partition_list_contains_all {l:list (pre_event Ts)} :
is_pre_partition_list l ->
forall a, exists! e, In e l /\ e a.
Proof.
intros [
FP lall]
a.
destruct (
lall a)
as [
_ HH].
destruct (
HH I)
as [
e [??]].
exists e.
split; [
tauto | ].
intros ?[??].
destruct (
ForallOrdPairs_In FP _ _ H H1)
as [?|[?|?]];
trivial.
elim (
H3 _ H0 H2).
elim (
H3 _ H2 H0).
Qed.
Lemma partition_measurable_list_rv_f {Td}
{cod:SigmaAlgebra Td}
{has_pre:HasPreimageSingleton cod}
(rv_X : Ts -> Td)
{rv : RandomVariable dom cod rv_X}
{frf : FiniteRangeFunction rv_X}
(has_singles: forall x, sa_sigma (SigmaAlgebra:=cod) (pre_event_singleton x))
(l : list (event dom))
(isp:is_pre_partition_list (map event_pre l)) :
partition_measurable rv_X l -> RandomVariable (list_partition_sa (map event_pre l)
isp) cod rv_X.
Proof.
Lemma partition_measurable_list_rv_b {Td} {nempty:NonEmpty Td}
{cod:SigmaAlgebra Td}
{has_pre:HasPreimageSingleton cod}
(rv_X : Ts -> Td)
{rv : RandomVariable dom cod rv_X}
{frf : FiniteRangeFunction rv_X}
(has_singles: forall x, sa_sigma (SigmaAlgebra:=cod) (pre_event_singleton x))
(l : list (event dom))
(isp:is_pre_partition_list (map event_pre l)) :
RandomVariable (list_partition_sa (map event_pre l) isp) cod rv_X -> partition_measurable rv_X l.
Proof.
Lemma partition_measurable_list_rv {Td} {nempty:NonEmpty Td}
{cod:SigmaAlgebra Td}
{has_pre:HasPreimageSingleton cod}
(rv_X : Ts -> Td)
{rv : RandomVariable dom cod rv_X}
{frf : FiniteRangeFunction rv_X}
(has_singles: forall x, sa_sigma (SigmaAlgebra:=cod) (pre_event_singleton x))
(l : list (event dom))
(isp:is_pre_partition_list (map event_pre l)) :
partition_measurable rv_X l <-> RandomVariable (list_partition_sa (map event_pre l)
isp) cod rv_X.
Proof.
Lemma nth_map_default_equiv {A} {R} n (l:list A) (d1 d2:A)
{refl:Reflexive R} :
R d1 d2 ->
R (nth n l d1) (nth n l d2).
Proof.
Lemma event_inter_sub_l {T:Type} {σ:SigmaAlgebra T} (A B:event σ) :
event_sub B A -> event_equiv (event_inter A B) B.
Proof.
firstorder.
Qed.
Lemma expectation_const_factor_subset (c:R)
(p : event dom)
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
(dec: (forall x, {p x} + {~ p x})) :
(forall (omega:Ts), p omega -> rv_X1 omega = c) ->
SimpleExpectation
(rvmult (rvmult rv_X1 rv_X2) (EventIndicator dec)) =
c * SimpleExpectation
(rvmult rv_X2 (EventIndicator dec)).
Proof.
Global Instance rvplus_proper : Proper (rv_eq ==> rv_eq ==> rv_eq) (@rvplus Ts).
Proof.
Lemma rvscale0 (rv:Ts->R) : rv_eq (rvscale 0 rv) (const 0).
Proof.
Lemma gen_conditional_scale_measurable
(rv_X1 rv_X2 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
(l : list dec_sa_event) :
is_partition_list (map dsa_event l) ->
partition_measurable rv_X1 (map dsa_event l) ->
rv_eq (SimpleConditionalExpectationSA (rvmult rv_X1 rv_X2) l)
(rvmult rv_X1 (SimpleConditionalExpectationSA rv_X2 l )).
Proof.
unfold partition_measurable,
event_preimage,
event_singleton.
intros is_part meas.
unfold SimpleConditionalExpectationSA.
unfold gen_simple_conditional_expectation_scale.
specialize (
meas is_part).
destruct is_part as [
FP _].
induction l.
-
simpl.
unfold rvmult,
const;
intros ?;
simpl.
field.
-
simpl.
invcs FP.
cut_to IHl;
trivial.
+
rewrite IHl.
clear IHl.
match_destr.
*
unfold rvplus,
rvmult,
rvscale;
intros ?.
field.
*
intros x.
case_eq (
dsa_dec a x); [
intros d _ |
intros d eqq].
--
specialize (
meas (
dsa_event a)).
cut_to meas; [|
simpl;
intuition].
destruct meas as [
c ceq].
rewrite (
expectation_const_factor_subset (
rv_X1 x)).
++
unfold rvscale,
rvplus,
rvmult.
field;
trivial.
++
intros.
apply ceq in H.
apply ceq in d.
congruence.
--
unfold rvplus,
rvscale,
rvmult,
EventIndicator.
repeat rewrite eqq.
field;
trivial.
+
intros.
apply meas;
simpl;
intuition.
Qed.
Lemma conditional_scale_measurable
(rv_X1 rv_X2 rv_X3 : Ts -> R)
{rv1 : RandomVariable dom borel_sa rv_X1}
{rv2 : RandomVariable dom borel_sa rv_X2}
{rv3 : RandomVariable dom borel_sa rv_X3}
{frf1 : FiniteRangeFunction rv_X1}
{frf2 : FiniteRangeFunction rv_X2}
{frf3 : FiniteRangeFunction rv_X3} :
simple_sigma_measurable rv_X1 rv_X3 ->
rv_eq (SimpleConditionalExpectation (rvmult rv_X1 rv_X2) rv_X3)
(rvmult rv_X1 (SimpleConditionalExpectation rv_X2 rv_X3)).
Proof.
Lemma SimpleConditionalExpectationSA_rvscale (c:R)
(rv_X : Ts -> R)
{rv : RandomVariable dom borel_sa rv_X}
{frf : FiniteRangeFunction rv_X}
(l : list dec_sa_event) :
is_partition_list (map dsa_event l) ->
rv_eq (SimpleConditionalExpectationSA (rvscale c rv_X) l)
(rvscale c (SimpleConditionalExpectationSA rv_X l )).
Proof.
End SimpleConditionalExpectation.
Section sa_sub.
Context {Ts:Type}
{dom: SigmaAlgebra Ts}
(prts:ProbSpace dom)
{dom2 : SigmaAlgebra Ts}
(sub : sa_sub dom2 dom).
Lemma SimpleExpectation_prob_space_sa_sub
(x:Ts->R)
{rv:RandomVariable dom borel_sa x}
{rv2:RandomVariable dom2 borel_sa x}
{frf:FiniteRangeFunction x} :
@SimpleExpectation Ts dom2 (prob_space_sa_sub prts sub) x rv2 frf =
@SimpleExpectation Ts dom prts x rv frf.
Proof.
End sa_sub.