Require Import Morphisms.
Require Import Equivalence.
Require Import Program.Basics.
Require Import Lra Lia.
Require Import Classical.
Require Import FunctionalExtensionality.
Require Import IndefiniteDescription ClassicalDescription.
Require Import PropExtensionality.
Require Import Reals RealAdd.
Require Import Coquelicot.Coquelicot.
Require Export RandomVariableFinite.
Require Import quotient_space.
Require Import RbarExpectation.
Require Import Almost.
Require Import utils.Utils.
Require Import List.
Set Bullet Behavior "
Strict Subproofs".
This defines the space Lp (https://en.wikipedia.org/wiki/Lp_space) for finite p.
This is the space of RandomVariables, where the pth power of its absolute value
has a finite expectation, module (quotiented by) the a.e relation.
The a.e. (almostR2 equal) relation is an equivalence relation that equates random variables
that are equal with probablity 1.
Local Notation NNR x := (
mknonnegreal x ltac:(
lra)) (
only parsing).
Section Lp.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Global Instance rvnneg_const (
pp:
nonnegreal) :
RandomVariable dom borel_sa (
fun x :
Ts =>
const pp x).
Proof.
destruct pp;
simpl.
apply rvconst.
Qed.
Definition IsLp n (
rv_X:
Ts->
R)
:=
IsFiniteExpectation prts (
rvpower (
rvabs rv_X) (
const n)).
Existing Class IsLp.
Typeclasses Transparent IsLp.
Global Instance Lp_FiniteLp n rv_X
{
islp:
IsLp n rv_X}
:
IsFiniteExpectation prts (
rvpower (
rvabs rv_X) (
const n))
:=
islp.
Global Instance IsLp_proper
:
Proper (
eq ==>
rv_eq ==>
iff)
IsLp.
Proof.
intros ??
eqq1 x y eqq2.
unfold IsLp.
now rewrite eqq1,
eqq2.
Qed.
Lemma IsLp_proper_almostR2 n rv_X1 rv_X2
{
rrv1:
RandomVariable dom borel_sa rv_X1}
{
rrv2:
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp n rv_X1}
:
almostR2 prts eq rv_X1 rv_X2 ->
IsLp n rv_X2.
Proof.
Definition IsLp_Rbar n (
rv_X:
Ts->
Rbar)
:=
is_finite (
Rbar_NonnegExpectation
(
fun omega =>
Rbar_power (
Rbar_abs (
rv_X omega))
n )).
Global Instance IsLp_Rbar_proper
:
Proper (
eq ==>
rv_eq ==>
iff)
IsLp_Rbar.
Proof.
Global Instance almostR2_eq_Rbar_power_proper :
Proper (
almostR2 prts eq ==>
eq ==>
almostR2 prts eq)
Rbar_rvpower.
Proof.
Global Instance almostR2_eq_Rbar_abs_proper :
Proper (
almostR2 prts eq ==>
almostR2 prts eq)
Rbar_rvabs.
Proof.
Lemma Rbar_Expectation_proper_almostR2 (
rv_X1 rv_X2 :
Ts ->
Rbar)
(
rv1pos:
Rbar_NonnegativeFunction rv_X1)
(
rv2pos:
Rbar_NonnegativeFunction rv_X2):
almostR2 prts eq rv_X1 rv_X2 ->
Rbar_NonnegExpectation rv_X1 =
Rbar_NonnegExpectation rv_X2.
Proof.
Lemma IsLp_Rbar_proper_almostR2 n (
rv_X1 rv_X2 :
Ts ->
Rbar)
{
islp1:
IsLp_Rbar n rv_X1} :
almostR2 prts eq rv_X1 rv_X2 ->
IsLp_Rbar n rv_X2.
Proof.
Lemma FiniteExpectation_Lp_pos p y
{
islp:
IsLp p y} :
0 <=
FiniteExpectation prts (
rvpower (
rvabs y) (
const p)).
Proof.
Global Instance IsL0_True (
rv_X:
Ts->
R) :
IsLp (
NNR 0)
rv_X.
Proof.
Lemma IsL1_Finite (
rv_X:
Ts->
R)
{
lp:
IsLp 1
rv_X} :
IsFiniteExpectation prts rv_X.
Proof.
Lemma IsL1_abs_Finite (
rv_X:
Ts->
R)
{
lp:
IsLp 1
rv_X} :
IsFiniteExpectation prts (
rvabs rv_X).
Proof.
red.
red in lp.
now rewrite rvabs_pow1 in lp.
Qed.
Lemma Finite_abs_IsL1 (
rv_X:
Ts->
R)
{
isfe:
IsFiniteExpectation prts (
rvabs rv_X)} :
IsLp 1
rv_X.
Proof.
Lemma IsLp_bounded n rv_X1 rv_X2
(
rle:
rv_le (
rvpower (
rvabs rv_X1) (
const n))
rv_X2)
{
islp:
IsFiniteExpectation prts rv_X2}
:
IsLp n rv_X1.
Proof.
Lemma IsLp_down_le m n (
rv_X:
Ts->
R)
{
rrv:
RandomVariable dom borel_sa rv_X}
(
pfle:0 <=
n <=
m)
{
lp:
IsLp m rv_X} :
IsLp n rv_X.
Proof.
Lemma Expectation_abs_neg_part_finite (
rv_X :
Ts ->
R)
:
is_finite (
NonnegExpectation (
rvabs rv_X)) ->
is_finite (
NonnegExpectation (
neg_fun_part rv_X)).
Proof.
Lemma Expectation_pos_part_finite (
rv_X :
Ts ->
R)
{
isfe:
IsFiniteExpectation prts rv_X} :
is_finite (
NonnegExpectation (
pos_fun_part rv_X)).
Proof.
Lemma Expectation_neg_part_finite (
rv_X :
Ts ->
R)
{
isfe:
IsFiniteExpectation prts rv_X} :
is_finite (
NonnegExpectation (
neg_fun_part rv_X)).
Proof.
Global Instance IsLp_scale p (
c:
R) (
rv_X:
Ts->
R)
{
islp:
IsLp p rv_X} :
IsLp p (
rvscale c rv_X).
Proof.
Lemma IsLp_scale_inv p c rv_X
{
islp:
IsLp p (
rvscale c rv_X)} :
c > 0 ->
IsLp p rv_X.
Proof.
Global Instance IsLp_opp p (
rv_X:
Ts->
R)
{
islp:
IsLp p rv_X} :
IsLp p (
rvopp rv_X).
Proof.
Global Instance IsLp_const p c :
IsLp p (
const c).
Proof.
Global Instance IsLp_abs p
(
rv_X :
Ts ->
R)
{
islp:
IsLp p rv_X} :
IsLp p (
rvabs rv_X).
Proof.
Global Instance IsLp_choice p
c
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp p rv_X1}
{
islp2:
IsLp p rv_X2} :
IsLp p (
rvchoice c rv_X1 rv_X2).
Proof.
Global Instance IsLp_max p
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp p rv_X1}
{
islp2:
IsLp p rv_X2} :
IsLp p (
rvmax rv_X1 rv_X2).
Proof.
Global Instance IsLp_min p
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp p rv_X1}
{
islp2:
IsLp p rv_X2} :
IsLp p (
rvmin rv_X1 rv_X2).
Proof.
Lemma big_nneg n (
nbig: 1 <=
n) : 0 <=
n.
Proof.
lra.
Qed.
Lemma IsLp_Finite n (
rv_X:
Ts->
R)
{
rrv:
RandomVariable dom borel_sa rv_X}
(
nbig:1<=
n)
{
lp:
IsLp n rv_X} :
IsFiniteExpectation prts rv_X.
Proof.
Lemma IsLSp_abs_Finite n (
rv_X:
Ts->
R)
{
rrv:
RandomVariable dom borel_sa rv_X}
(
nbig:1<=
n)
{
lp:
IsLp n rv_X} :
IsFiniteExpectation prts (
rvabs rv_X).
Proof.
Global Instance IsLp_plus (
p:
nonnegreal)
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp p rv_X1}
{
islp2:
IsLp p rv_X2} :
IsLp p (
rvplus rv_X1 rv_X2).
Proof.
Global Instance IsLp_minus (
p:
nonnegreal)
(
rv_X1 rv_X2 :
Ts ->
R)
{
rv1 :
RandomVariable dom borel_sa rv_X1}
{
rv2 :
RandomVariable dom borel_sa rv_X2}
{
islp1:
IsLp p rv_X1}
{
islp2:
IsLp p rv_X2} :
IsLp p (
rvminus rv_X1 rv_X2).
Proof.
Section packed.
Context {
p:
R}.
Record LpRRV :
Type
:=
LpRRV_of {
LpRRV_rv_X :>
Ts ->
R
;
LpRRV_rv :>
RandomVariable dom borel_sa LpRRV_rv_X
;
LpRRV_lp :>
IsLp p LpRRV_rv_X
}.
Global Existing Instance LpRRV_rv.
Global Existing Instance LpRRV_lp.
Global Instance LpRRV_LpS_FiniteLp (
rv_X:
LpRRV)
:
IsFiniteExpectation prts (
rvpower (
rvabs rv_X) (
const p))
:=
LpRRV_lp _.
Definition pack_LpRRV (
rv_X:
Ts ->
R) {
rv:
RandomVariable dom borel_sa rv_X} {
lp:
IsLp p rv_X}
:=
LpRRV_of rv_X rv lp.
Definition LpRRV_seq (
rv1 rv2:
LpRRV)
:=
rv_eq (
LpRRV_rv_X rv1) (
LpRRV_rv_X rv2).
Definition LpRRV_eq (
rv1 rv2:
LpRRV)
:=
almostR2 prts eq rv1 rv2.
Global Instance LpRRV_seq_eq :
subrelation LpRRV_seq LpRRV_eq.
Proof.
Global Instance LpRRV_seq_equiv :
Equivalence (
LpRRV_seq).
Proof.
Global Instance LpRRV_eq_equiv :
Equivalence LpRRV_eq.
Proof.
unfold LpRRV_eq.
constructor.
-
intros [
x?].
reflexivity.
-
intros [
x?] [
y?]
ps1;
simpl in *.
now symmetry.
-
intros [
x??] [
y??] [
z??]
ps1 ps2.
simpl in *.
etransitivity;
eauto.
Qed.
Definition LpRRVconst (
x:
R) :
LpRRV
:=
pack_LpRRV (
const x).
Definition LpRRVzero :
LpRRV :=
LpRRVconst 0.
Program Definition LpRRVscale (
x:
R) (
rv:
LpRRV) :
LpRRV
:=
pack_LpRRV (
rvscale x rv).
Global Instance LpRRV_scale_sproper :
Proper (
eq ==>
LpRRV_seq ==>
LpRRV_seq)
LpRRVscale.
Proof.
unfold Proper,
respectful,
LpRRV_eq.
intros ?
x ? [
x1??] [
x2??]
eqqx.
subst.
simpl in *.
unfold rvscale.
red.
simpl.
red in eqqx.
simpl in *.
now rewrite eqqx.
Qed.
Global Instance LpRRV_scale_proper :
Proper (
eq ==>
LpRRV_eq ==>
LpRRV_eq)
LpRRVscale.
Proof.
unfold Proper,
respectful,
LpRRV_eq.
intros ?
x ? [
x1??] [
x2??]
eqqx.
subst.
simpl in *.
rewrite eqqx.
reflexivity.
Qed.
Definition LpRRVopp (
rv:
LpRRV) :
LpRRV
:=
pack_LpRRV (
rvopp rv).
Global Instance LpRRV_opp_sproper :
Proper (
LpRRV_seq ==>
LpRRV_seq)
LpRRVopp.
Proof.
Global Instance LpRRV_opp_proper :
Proper (
LpRRV_eq ==>
LpRRV_eq)
LpRRVopp.
Proof.
Lemma LpRRVopp_scale (
rv:
LpRRV) :
LpRRV_eq
(
LpRRVopp rv) (
LpRRVscale (-1)
rv).
Proof.
red.
reflexivity.
Qed.
Definition LpRRVabs (
rv:
LpRRV) :
LpRRV
:=
pack_LpRRV (
rvabs rv).
Global Instance LpRRV_abs_sproper :
Proper (
LpRRV_seq ==>
LpRRV_seq)
LpRRVabs.
Proof.
unfold Proper,
respectful.
intros x y eqq.
red in eqq.
red;
simpl.
now rewrite eqq.
Qed.
Global Instance LpRRV_abs_proper :
Proper (
LpRRV_eq ==>
LpRRV_eq)
LpRRVabs.
Proof.
Section quoted.
Definition LpRRVq :
Type :=
quot LpRRV_eq.
Definition LpRRVq_const (
x:
R) :
LpRRVq :=
Quot _ (
LpRRVconst x).
Lemma LpRRVq_constE x :
LpRRVq_const x =
Quot _ (
LpRRVconst x).
Proof.
reflexivity.
Qed.
Hint Rewrite LpRRVq_constE :
quot.
Definition LpRRVq_zero :
LpRRVq :=
LpRRVq_const 0.
Lemma LpRRVq_zeroE :
LpRRVq_zero =
LpRRVq_const 0.
Proof.
reflexivity.
Qed.
Hint Rewrite LpRRVq_zeroE :
quot.
Definition LpRRVq_scale (
x:
R) :
LpRRVq ->
LpRRVq
:=
quot_lift (
LpRRVscale x).
Lemma LpRRVq_scaleE x y :
LpRRVq_scale x (
Quot _ y) =
Quot _ (
LpRRVscale x y).
Proof.
Hint Rewrite LpRRVq_scaleE :
quot.
Definition LpRRVq_opp :
LpRRVq ->
LpRRVq
:=
quot_lift LpRRVopp.
Lemma LpRRVq_oppE x :
LpRRVq_opp (
Quot _ x) =
Quot _ (
LpRRVopp x).
Proof.
Hint Rewrite LpRRVq_oppE :
quot.
Definition LpRRVq_abs :
LpRRVq ->
LpRRVq
:=
quot_lift LpRRVabs.
End quoted.
End packed.
Hint Rewrite @
LpRRVq_constE :
quot.
Hint Rewrite @
LpRRVq_zeroE :
quot.
Hint Rewrite @
LpRRVq_scaleE :
quot.
Hint Rewrite @
LpRRVq_oppE :
quot.
Global Arguments LpRRV :
clear implicits.
Global Arguments LpRRVq :
clear implicits.
Section packednonneg.
Context {
p:
nonnegreal}.
Definition LpRRVplus (
rv1 rv2:
LpRRV p) :
LpRRV p
:=
pack_LpRRV (
rvplus rv1 rv2).
Global Instance LpRRV_plus_sproper :
Proper (
LpRRV_seq ==>
LpRRV_seq ==>
LpRRV_seq)
LpRRVplus.
Proof.
unfold Proper,
respectful,
LpRRV_seq.
intros [
x1??] [
x2??]
eqqx [
y1??] [
y2??]
eqqy.
simpl in *.
simpl in *.
now rewrite eqqx,
eqqy.
Qed.
Global Instance LpRRV_plus_proper :
Proper (
LpRRV_eq ==>
LpRRV_eq ==>
LpRRV_eq)
LpRRVplus.
Proof.
Definition LpRRVminus (
rv1 rv2:
LpRRV p) :
LpRRV p
:=
pack_LpRRV (
rvminus rv1 rv2).
Lemma LpRRVminus_plus (
rv1 rv2:
LpRRV p) :
LpRRV_seq
(
LpRRVminus rv1 rv2) (
LpRRVplus rv1 (
LpRRVopp rv2)).
Proof.
intros ?.
reflexivity.
Qed.
Lemma LpRRValmost_sub_zero_eq (
x y:
LpRRV p)
(
eqq:
almostR2 prts eq (
LpRRVminus x y) (
LpRRVzero (
p:=
p))) :
almostR2 prts eq x y.
Proof.
Global Instance LpRRV_minus_sproper :
Proper (
LpRRV_seq ==>
LpRRV_seq ==>
LpRRV_seq)
LpRRVminus.
Proof.
Global Instance LpRRV_minus_proper :
Proper (
LpRRV_eq ==>
LpRRV_eq ==>
LpRRV_eq)
LpRRVminus.
Proof.
Ltac LpRRV_simpl
:=
repeat match goal with
| [
H :
LpRRV |-
_ ] =>
destruct H as [???]
end
;
unfold LpRRVplus,
LpRRVminus,
LpRRVopp,
LpRRVscale
;
simpl.
Lemma LpRRV_plus_comm x y :
LpRRV_eq (
LpRRVplus x y) (
LpRRVplus y x).
Proof.
Lemma LpRRV_plus_assoc (
x y z :
LpRRV p) :
LpRRV_eq (
LpRRVplus x (
LpRRVplus y z)) (
LpRRVplus (
LpRRVplus x y)
z).
Proof.
Lemma LpRRV_plus_zero (
x :
LpRRV p) :
LpRRV_eq (
LpRRVplus x (
LpRRVconst 0))
x.
Proof.
Lemma LpRRV_plus_inv (
x:
LpRRV p) :
LpRRV_eq (
LpRRVplus x (
LpRRVopp x)) (
LpRRVconst 0).
Proof.
Lemma LpRRV_scale_scale (
x y :
R) (
u :
LpRRV p) :
LpRRV_eq (
LpRRVscale x (
LpRRVscale y u)) (
LpRRVscale (
x *
y)
u).
Proof.
Lemma LpRRV_scale1 (
u :
LpRRV p) :
LpRRV_eq (
LpRRVscale one u)
u.
Proof.
Lemma LpRRV_scale_plus_l (
x :
R) (
u v :
LpRRV p) :
LpRRV_eq (
LpRRVscale x (
LpRRVplus u v)) (
LpRRVplus (
LpRRVscale x u) (
LpRRVscale x v)).
Proof.
Lemma LpRRV_scale_plus_r (
x y :
R) (
u :
LpRRV p) :
LpRRV_eq (
LpRRVscale (
x +
y)
u) (
LpRRVplus (
LpRRVscale x u) (
LpRRVscale y u)).
Proof.
Section quotnneg.
Definition LpRRVq_plus :
LpRRVq p ->
LpRRVq p ->
LpRRVq p
:=
quot_lift2 LpRRVplus.
Lemma LpRRVq_plusE x y :
LpRRVq_plus (
Quot _ x) (
Quot _ y) =
Quot _ (
LpRRVplus x y).
Proof.
Hint Rewrite LpRRVq_plusE :
quot.
Definition LpRRVq_minus :
LpRRVq p ->
LpRRVq p ->
LpRRVq p
:=
quot_lift2 LpRRVminus.
Lemma LpRRVq_minusE x y :
LpRRVq_minus (
Quot _ x) (
Quot _ y) =
Quot _ (
LpRRVminus x y).
Proof.
Hint Rewrite LpRRVq_minusE :
quot.
Ltac LpRRVq_simpl
:=
repeat match goal with
| [
H:
LpRRVq _ |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
end
;
try autorewrite with quot
;
try apply (@
eq_Quot _ _ LpRRV_eq_equiv).
Lemma LpRRVq_minus_plus (
rv1 rv2:
LpRRVq p) :
LpRRVq_minus rv1 rv2 =
LpRRVq_plus rv1 (
LpRRVq_opp rv2).
Proof.
Lemma LpRRVq_opp_scale (
rv:
LpRRVq p) :
LpRRVq_opp rv =
LpRRVq_scale (-1)
rv.
Proof.
Lemma LpRRVq_plus_comm x y :
LpRRVq_plus x y =
LpRRVq_plus y x.
Proof.
Lemma LpRRVq_plus_assoc (
x y z :
LpRRVq p) :
LpRRVq_plus x (
LpRRVq_plus y z) =
LpRRVq_plus (
LpRRVq_plus x y)
z.
Proof.
Lemma LpRRVq_plus_zero (
x :
LpRRVq p) :
LpRRVq_plus x LpRRVq_zero =
x.
Proof.
Lemma LpRRVq_plus_inv (
x:
LpRRVq p) :
LpRRVq_plus x (
LpRRVq_opp x) =
LpRRVq_zero.
Proof.
Definition LpRRVq_AbelianGroup_mixin :
AbelianGroup.mixin_of (
LpRRVq p)
:=
AbelianGroup.Mixin (
LpRRVq p)
LpRRVq_plus LpRRVq_opp LpRRVq_zero
LpRRVq_plus_comm LpRRVq_plus_assoc
LpRRVq_plus_zero LpRRVq_plus_inv.
Canonical LpRRVq_AbelianGroup :=
AbelianGroup.Pack (
LpRRVq p)
LpRRVq_AbelianGroup_mixin (
LpRRVq p).
Ltac LpRRVq_simpl ::=
repeat match goal with
| [
H:
LpRRVq _ |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
| [
H:
AbelianGroup.sort LpRRVq_AbelianGroup |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
end
;
try autorewrite with quot
;
try apply (@
eq_Quot _ _ LpRRV_eq_equiv).
Lemma LpRRVq_scale_scale (
x y :
R_Ring) (
u :
LpRRVq_AbelianGroup) :
LpRRVq_scale x (
LpRRVq_scale y u) =
LpRRVq_scale (
x *
y)
u.
Proof.
Lemma LpRRVq_scale1 (
u :
LpRRVq_AbelianGroup) :
LpRRVq_scale one u =
u.
Proof.
Lemma LpRRVq_scale_plus_l (
x :
R_Ring) (
u v :
LpRRVq_AbelianGroup) :
LpRRVq_scale x (
plus u v) =
plus (
LpRRVq_scale x u) (
LpRRVq_scale x v).
Proof.
Lemma LpRRVq_scale_plus_r (
x y :
R_Ring) (
u :
LpRRVq_AbelianGroup) :
LpRRVq_scale (
plus x y)
u =
plus (
LpRRVq_scale x u) (
LpRRVq_scale y u).
Proof.
Definition LpRRVq_ModuleSpace_mixin :
ModuleSpace.mixin_of R_Ring LpRRVq_AbelianGroup
:=
ModuleSpace.Mixin R_Ring LpRRVq_AbelianGroup
LpRRVq_scale LpRRVq_scale_scale LpRRVq_scale1
LpRRVq_scale_plus_l LpRRVq_scale_plus_r.
Canonical LpRRVq_ModuleSpace :=
ModuleSpace.Pack R_Ring (
LpRRVq p) (
ModuleSpace.Class R_Ring (
LpRRVq p)
LpRRVq_AbelianGroup_mixin LpRRVq_ModuleSpace_mixin) (
LpRRVq p).
End quotnneg.
End packednonneg.
At this point, we will be spliting into three cases:
p = 0 => This is the space of Random Variables modulo almostR2-equal.
We already showed what we know about it. (It is a ModuleSpace)
1 <= p < ∞ => This is a normed vector space
0 < p < 1 => This is a metric space.
Section normish.
For p = 0, this is not really defined.
For 1 <= p this defines a norm.
For 0 < p < 1 this defines a quasi norm
Context {
p:
R}.
Definition LpRRVnorm (
rv_X:
LpRRV p) :
R
:=
power (
FiniteExpectation prts (
rvpower (
rvabs rv_X) (
const p))) (
Rinv p).
Global Instance LpRRV_norm_proper :
Proper (
LpRRV_eq ==>
eq)
LpRRVnorm.
Proof.
Global Instance LpRRV_norm_sproper :
Proper (
LpRRV_seq ==>
eq)
LpRRVnorm.
Proof.
Lemma almostR20_lpf_almostR20 (
rv_X:
Ts->
R)
{
rrv:
RandomVariable dom borel_sa rv_X}
{
isfe:
IsFiniteExpectation prts (
rvpower (
rvabs rv_X) (
const p))}:
almostR2 prts eq rv_X (
const 0) <->
almostR2 prts eq (
rvpower (
rvabs rv_X) (
const p)) (
const 0).
Proof.
intros.
unfold almostR2 in *.
split;
intros [
P [
Pall eq_on]]
;
exists P;
split;
trivial
;
intros a Pa
;
rv_unfold.
-
rewrite eq_on by trivial.
now rewrite Rabs_R0,
power0_Sbase.
-
specialize (
eq_on _ Pa).
apply power_integral in eq_on.
generalize (
Rabs_pos (
rv_X a));
intros.
apply Rabs_eq_0.
lra.
Qed.
Theorem LpFin0_almostR20 (
rv_X:
Ts->
R)
{
rrv:
RandomVariable dom borel_sa rv_X}
{
isfe:
IsFiniteExpectation prts (
rvpower (
rvabs rv_X) (
const p))}:
FiniteExpectation prts (
rvpower (
rvabs rv_X) (
const p)) = 0 ->
almostR2 prts eq rv_X (
const 0).
Proof.
Lemma LpRRV_norm0 (
x:
LpRRV p) :
LpRRVnorm x = 0 ->
almostR2 prts eq x (
LpRRVzero (
p:=
p)).
Proof.
Lemma LpRRVnorm_const c :
p <> 0 ->
LpRRVnorm (
LpRRVconst c) =
Rabs c.
Proof.
Lemma LpRRVnorm0 :
p <> 0 ->
LpRRVnorm LpRRVzero = 0.
Proof.
End normish.
Definition LpRRVpoint (
p:
R) :
LpRRV p :=
LpRRVconst 0.
Definition bignneg n (
nbig: 1 <=
n) :
nonnegreal
:=
mknonnegreal n (
big_nneg n nbig).
Section packedbigp.
Context {
p:
R}.
Context (
pbig:1 <=
p).
Let pnneg :
nonnegreal :=
bignneg p pbig.
Canonical pnneg.
Lemma Minkowski_rv (
x y :
LpRRV p) (
t:
R):
0 <
t < 1 ->
rv_le (
rvpower (
rvplus (
rvabs x) (
rvabs y)) (
const p))
(
rvplus
(
rvscale (
power (/
t) (
p-1)) (
rvpower (
rvabs x) (
const p)))
(
rvscale (
power (/(1-
t)) (
p-1)) (
rvpower (
rvabs y) (
const p)))).
Proof.
Lemma rvpower_plus_le (
x y :
LpRRV p) :
rv_le (
rvpower (
rvabs (
rvplus x y)) (
const p)) (
rvpower (
rvplus (
rvabs x) (
rvabs y)) (
const p)).
Proof.
Lemma Minkowski_1 (
x y :
LpRRV p) (
t:
R):
0 <
t < 1 ->
(
FiniteExpectation prts (
rvpower (
rvabs (
rvplus x y)) (
const p))) <=
(
power (/
t) (
p-1)) * (
FiniteExpectation prts (
rvpower (
rvabs x) (
const p))) +
(
power (/(1-
t)) (
p-1)) * (
FiniteExpectation prts (
rvpower (
rvabs y) (
const p))).
Proof.
Lemma Minkowski_2 (
x y :
LpRRV p)
(
xexppos : 0 <
FiniteExpectation prts (
rvpower (
rvabs x) (
const p)))
(
yexppos : 0 <
FiniteExpectation prts (
rvpower (
rvabs y) (
const p))) :
FiniteExpectation prts (
rvpower (
rvabs (
rvplus x y)) (
const p)) <=
power ((
power (
FiniteExpectation prts (
rvpower (
rvabs x) (
const p))) (/
p)) +
(
power (
FiniteExpectation prts (
rvpower (
rvabs y) (
const p))) (/
p)))
p.
Proof.
Lemma Rle_power_inv_l (
a b :
R) :
0 <
a ->
a <=
b ->
power a (/
p) <=
power b (/
p).
Proof.
Lemma Minkowski_lt (
x y :
LpRRV p)
(
xexppos : 0 <
FiniteExpectation prts (
rvpower (
rvabs x) (
const p)))
(
yexppos : 0 <
FiniteExpectation prts (
rvpower (
rvabs y) (
const p)))
(
xyexppos : 0 <
FiniteExpectation prts (
rvpower (
rvabs (
rvplus x y)) (
const p))) :
power (
FiniteExpectation prts (
rvpower (
rvabs (
rvplus x y)) (
const p))) (/
p) <=
power (
FiniteExpectation prts (
rvpower (
rvabs x) (
const p))) (/
p) +
power (
FiniteExpectation prts (
rvpower (
rvabs y) (
const p))) (/
p).
Proof.
Theorem Minkowski (
x y :
LpRRV p) :
power (
FiniteExpectation prts (
rvpower (
rvabs (
rvplus x y)) (
const p))) (/
p) <=
power (
FiniteExpectation prts (
rvpower (
rvabs x) (
const p))) (/
p) +
power (
FiniteExpectation prts (
rvpower (
rvabs y) (
const p))) (/
p).
Proof.
Lemma LpRRV_norm_plus (
x y:
LpRRV p) :
LpRRVnorm (
LpRRVplus x y) <=
LpRRVnorm x +
LpRRVnorm y.
Proof.
Lemma LpRRV_norm_scal_strong (
x:
R) (
y:
LpRRV p) :
LpRRVnorm (
LpRRVscale x y) =
Rabs x *
LpRRVnorm y.
Proof.
Lemma LpRRV_norm_scal (
x:
R) (
y:
LpRRV p) :
LpRRVnorm (
LpRRVscale x y) <=
Rabs x *
LpRRVnorm y.
Proof.
Definition LpRRVball (
x:
LpRRV p) (
e:
R) (
y:
LpRRV p):
Prop
:=
LpRRVnorm (
LpRRVminus x y) <
e.
Ltac LpRRV_simpl
:=
repeat match goal with
| [
H :
LpRRV _ |-
_ ] =>
destruct H as [???]
end;
unfold LpRRVball,
LpRRVnorm,
LpRRVplus,
LpRRVminus,
LpRRVopp,
LpRRVscale,
LpRRVnorm in *
;
simpl pack_LpRRV;
simpl LpRRV_rv_X in *.
Global Instance LpRRV_ball_sproper :
Proper (
LpRRV_seq ==>
eq ==>
LpRRV_seq ==>
iff)
LpRRVball.
Proof.
intros ??
eqq1 ??
eqq2 ??
eqq3.
unfold LpRRVball in *.
rewrite <-
eqq1, <-
eqq2, <-
eqq3.
reflexivity.
Qed.
Global Instance LpRRV_ball_proper :
Proper (
LpRRV_eq ==>
eq ==>
LpRRV_eq ==>
iff)
LpRRVball.
Proof.
intros ??
eqq1 ??
eqq2 ??
eqq3.
unfold LpRRVball in *.
rewrite <-
eqq1, <-
eqq2, <-
eqq3.
reflexivity.
Qed.
Lemma LpRRV_ball_refl x (
e :
posreal) :
LpRRVball x e x.
Proof.
Lemma LpRRV_ball_sym x y e :
LpRRVball x e y ->
LpRRVball y e x.
Proof.
Lemma LpRRV_ball_trans x y z e1 e2 :
LpRRVball x e1 y ->
LpRRVball y e2 z ->
LpRRVball x (
e1+
e2)
z.
Proof.
Lemma LpRRV_close_close (
x y :
LpRRV p) (
eps :
R) :
LpRRVnorm (
LpRRVminus y x) <
eps ->
LpRRVball x eps y.
Proof.
Definition LpRRVnorm_factor :
R := 1.
Lemma LpRRV_norm_ball_compat (
x y :
LpRRV p) (
eps :
posreal) :
LpRRVball x eps y ->
LpRRVnorm (
LpRRVminus y x) <
LpRRVnorm_factor *
eps.
Proof.
Lemma LpRRV_plus_opp_minus (
x y :
LpRRV p) :
LpRRV_eq (
LpRRVplus x (
LpRRVopp y)) (
LpRRVminus x y).
Proof.
Lemma LpRRV_norm_telescope_minus (
f :
nat ->
LpRRV p) :
forall (
n k:
nat),
LpRRVnorm (
LpRRVminus (
f ((
S k)+
n)%
nat) (
f n)) <=
sum_n_m (
fun m =>
LpRRVnorm (
LpRRVminus (
f (
S m)) (
f m)))
n (
k +
n).
Proof.
Lemma sum_geom (
n :
nat) (
c :
R):
c <> 1 ->
sum_n (
fun k =>
pow c k)
n = (
pow c (
S n) - 1)/(
c - 1).
Proof.
Lemma sum_geom_n_m (
n m :
nat) (
c :
R) :
c <> 1 ->
(
S n <=
m)%
nat ->
sum_n_m (
fun k =>
pow c k) (
S n)
m = (
pow c (
S m) -
pow c (
S n))/(
c-1).
Proof.
Global Instance IsLp_sum (
n :
nat)
(
rv_X :
nat ->
Ts ->
R)
{
rv :
forall n,
RandomVariable dom borel_sa (
rv_X n)}
{
islp:
forall n,
IsLp p (
rv_X n)} :
IsLp p (
rvsum rv_X n).
Proof.
Definition LpRRVsum (
rvn:
nat ->
LpRRV p) (
n:
nat) :
LpRRV p
:=
pack_LpRRV (
rvsum rvn n).
Lemma LpRRV_norm_sum (
f :
nat ->
LpRRV p) :
forall (
n:
nat),
LpRRVnorm (
LpRRVsum f n) <=
sum_n (
fun m =>
LpRRVnorm (
f m))
n.
Proof.
Lemma norm_abs (
f :
LpRRV p) :
LpRRVnorm (
LpRRVabs f) =
LpRRVnorm f.
Proof.
Lemma c_pow_bound(
c :
R) (
n :
nat) :
0 <
c < 1 ->
(1-
c^
n) / (1-
c) <= 1/(1-
c).
Proof.
Lemma lp_telescope_norm_bound (
f :
nat ->
LpRRV p) :
(
forall (
n:
nat),
LpRRVnorm (
LpRRVminus (
f (
S n)) (
f n)) < / (
pow 2
n)) ->
forall (
n:
nat),
LpRRVnorm (
LpRRVsum (
fun n0 =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n) <= 2.
Proof.
Lemma power_inv_le b q c :
0 <
q -> 0 <=
b -> 0 <=
c ->
power b (/
q) <=
c ->
b <=
power c q.
Proof.
Lemma isfin_Lim_seq (
f :
nat ->
Ts ->
R) :
(
forall (
omega:
Ts),
ex_finite_lim_seq (
fun n =>
f n omega)) ->
forall (
omega:
Ts),
is_finite (
Lim_seq (
fun n =>
f n omega)).
Proof.
Lemma rvlim_incr (
f :
nat ->
LpRRV p) :
(
forall (
n:
nat),
NonnegativeFunction (
f n)) ->
(
forall (
n:
nat),
rv_le (
f n) (
f (
S n))) ->
(
forall (
omega:
Ts),
ex_finite_lim_seq (
fun n =>
f n omega)) ->
(
forall (
n:
nat),
rv_le (
f n) (
rvlim f)).
Proof.
Definition p_power (
x:
R) := (
power x p).
Lemma continuity_p_power_pos (
x :
R) :
0 <
x ->
continuity_pt p_power x.
Proof.
Lemma continuity_p_power_Rabs (
x :
R) :
continuity_pt (
fun x0 =>
p_power (
Rabs x0))
x.
Proof.
Lemma islp_rvlim_bounded (
f :
nat ->
LpRRV p) (
c :
R) :
(
forall (
n:
nat),
LpRRVnorm (
f n) <=
c) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
(
forall (
n:
nat),
NonnegativeFunction (
f n)) ->
(
forall (
n:
nat),
rv_le (
f n) (
f (
S n))) ->
(
forall (
omega:
Ts),
ex_finite_lim_seq (
fun n :
nat =>
f n omega)) ->
IsLp p (
rvlim f).
Proof.
intros fnorm f_rv fpos fincr exfinlim.
assert (
cpos: 0 <=
c).
{
specialize (
fnorm 0%
nat).
apply Rle_trans with (
r2 := (
LpRRVnorm (
f 0%
nat)));
trivial.
unfold LpRRVnorm.
apply power_nonneg.
}
generalize (
isfin_Lim_seq _ exfinlim);
intros isfin_flim.
unfold LpRRVnorm in fnorm.
unfold IsLp.
assert (
finexp:
forall n,
FiniteExpectation prts (
rvpower (
rvabs (
f n)) (
const p)) <=
power c p).
{
intros.
apply power_inv_le;
trivial.
lra.
apply FiniteExpectation_Lp_pos.
}
assert (
forall n,
NonnegativeFunction (
rvpower (
rvabs (
f n)) (
const p))).
{
intros.
unfold NonnegativeFunction,
rvpower;
intros.
apply power_nonneg.
}
assert (
rvlim_rv:
RandomVariable dom borel_sa (
rvpower (
rvabs (
rvlim (
fun x :
nat =>
f x))) (
const p))).
apply rvpower_rv.
apply rvabs_rv.
apply rvlim_rv;
trivial.
typeclasses eauto.
generalize (
monotone_convergence
(
rvpower (
rvabs (
rvlim (
fun x :
nat =>
f x))) (
const p))
(
fun n => (
rvpower (
rvabs (
f n)) (
const p)))
_ _ _ _);
intro monc.
cut_to monc.
-
unfold IsFiniteExpectation.
assert (
NonnegativeFunction (
rvpower (
rvabs (
rvlim (
fun x :
nat =>
f x))) (
const p))).
{
unfold NonnegativeFunction,
rvpower;
intros.
apply power_nonneg.
}
rewrite Expectation_pos_pofrf with (
nnf :=
H0).
assert (
Rbar_le
(
Lim_seq (
fun n :
nat =>
NonnegExpectation (
rvpower (
rvabs (
f n)) (
const p)))) (
power c p)).
replace (
Finite (
power c p))
with (
Lim_seq (
fun _ =>
power c p)).
apply Lim_seq_le_loc.
exists (0%
nat).
intros.
specialize (
finexp n).
now rewrite FiniteNonnegExpectation with (
posX := (
H n))
in finexp.
apply Lim_seq_const.
rewrite monc in H1.
cut (
is_finite (
NonnegExpectation (
rvpower (
rvabs (
rvlim (
fun x :
nat =>
f x))) (
const p)))).
+
intros eqq;
now rewrite <-
eqq.
+
eapply bounded_is_finite.
*
eapply NonnegExpectation_pos.
*
eapply H1.
-
intros n x.
unfold rvpower.
apply Rle_power_l; [
unfold const;
lra |].
split; [
apply Rabs_pos |].
unfold rvabs.
rewrite Rabs_right by apply Rle_ge,
fpos.
rewrite Rabs_right.
apply rvlim_incr;
trivial.
apply Rge_trans with (
r2 :=
f n x).
+
apply Rle_ge.
apply rvlim_incr;
trivial.
+
apply Rle_ge,
fpos.
-
intros n x.
apply Rle_power_l.
+
unfold const;
lra.
+
unfold rvabs.
split; [
apply Rabs_pos |].
rewrite Rabs_right by apply Rle_ge,
fpos.
rewrite Rabs_right by apply Rle_ge,
fpos.
apply fincr.
-
intros;
apply IsFiniteNonnegExpectation.
apply (@
LpRRV_LpS_FiniteLp p (
f n)).
-
intros.
unfold rvpower,
rvabs,
rvlim,
const.
apply is_lim_seq_ext with (
u :=
fun n :
nat =>
p_power (
Rabs (
f n omega))).
now unfold p_power.
apply is_lim_seq_continuous with (
f :=
fun x =>
p_power (
Rabs x)).
apply continuity_p_power_Rabs.
generalize (
Lim_seq_correct (
fun n :
nat =>
f n omega));
intros.
rewrite <- (
isfin_flim omega)
in H0.
apply H0.
apply ex_lim_seq_incr.
now unfold rv_le,
pointwise_relation in fincr.
Qed.
Lemma is_lim_power_inf (
f :
nat ->
R) :
is_lim_seq f p_infty ->
is_lim_seq (
fun n =>
power (
f n)
p)
p_infty.
Proof.
Lemma lim_power_inf (
f :
nat ->
R) :
ex_lim_seq f ->
Lim_seq f =
p_infty ->
Lim_seq (
fun n =>
power (
f n)
p) =
p_infty.
Proof.
Lemma Rbar_power_lim_comm (
f :
nat ->
Ts ->
R) (
x:
Ts) :
(
forall (
n:
nat),
rv_le (
f n) (
f (
S n))) ->
Rbar_power (
Rbar_abs (
Lim_seq (
fun n :
nat =>
f n x)))
p =
Lim_seq (
fun n :
nat =>
power (
Rabs (
f n x))
p).
Proof.
Lemma islp_Rbar_rvlim_bounded (
f :
nat ->
LpRRV p) (
c :
R) :
(
forall (
n:
nat),
LpRRVnorm (
f n) <=
c) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
(
forall (
n:
nat),
NonnegativeFunction (
f n)) ->
(
forall (
n:
nat),
rv_le (
f n) (
f (
S n))) ->
IsLp_Rbar p (
Rbar_rvlim (
fun n =>
LpRRV_rv_X (
f n))).
Proof.
Lemma LpRRVsum_pos (
f :
nat ->
LpRRV p) (
n :
nat) :
(
forall n,
NonnegativeFunction (
f n)) ->
NonnegativeFunction (
LpRRVsum f n).
Proof.
Lemma islp_lim_telescope_abs (
f :
nat ->
LpRRV p) :
(
forall (
n:
nat),
LpRRVnorm (
LpRRVminus (
f (
S n)) (
f n)) < / (
pow 2
n)) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
(
forall omega :
Ts,
ex_finite_lim_seq
(
fun n :
nat =>
LpRRVsum (
fun n0 :
nat =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n omega)) ->
IsLp p (
rvlim
(
fun n =>
LpRRVsum (
fun n0 =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n)).
Proof.
Lemma islp_Rbar_lim_telescope_abs_c (
f :
nat ->
LpRRV p) (
c :
R) :
(
forall n :
nat,
LpRRVnorm
(
LpRRVsum (
fun n0 :
nat =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n) <=
c) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
IsLp_Rbar p (
Rbar_rvlim
(
fun n =>
LpRRV_rv_X (
LpRRVsum (
fun n0 =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n))).
Proof.
Lemma islp_Rbar_lim_telescope_abs (
f :
nat ->
LpRRV p) :
(
forall (
n:
nat),
LpRRVnorm (
LpRRVminus (
f (
S n)) (
f n)) < / (
pow 2
n)) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
IsLp_Rbar p (
Rbar_rvlim
(
fun n =>
LpRRV_rv_X (
LpRRVsum (
fun n0 =>
LpRRVabs (
LpRRVminus (
f (
S n0)) (
f n0)))
n))).
Proof.
Lemma lp_norm_seq_pow2 (
f :
nat ->
LpRRV p) :
(
forall (
n:
nat),
LpRRVnorm (
LpRRVminus (
f (
S n)) (
f n)) < / (
pow 2
n)) ->
forall (
n m:
nat), (
m >
S n)%
nat ->
LpRRVnorm (
LpRRVminus (
f m) (
f (
S n))) <= / (
pow 2
n).
Proof.
intros.
generalize (
LpRRV_norm_telescope_minus f (
S n) (
m-
S (
S n))%
nat);
intros.
replace (
S (
m -
S (
S n)) + (
S n))%
nat with (
m)
in H1 by lia.
replace (
m -
S (
S n) + (
S n))%
nat with (
m-1)%
nat in H1 by lia.
apply Rle_trans with
(
r2 :=
sum_n_m (
fun m :
nat =>
LpRRVnorm (
LpRRVminus (
f (
S m)) (
f m))) (
S n) (
m - 1));
trivial.
apply Rle_trans with (
r2 :=
sum_n_m (
fun m0 => / (2 ^
m0)) (
S n) (
m-1)%
nat).
apply sum_n_m_le;
intros;
left.
apply H.
assert (
forall n, (/ (
pow 2
n)) =
pow (/ 2)
n).
intros.
now rewrite <-
Rinv_pow.
rewrite sum_n_m_ext with (
b :=
fun m0 =>
pow (/ 2)
m0);
trivial.
rewrite sum_geom_n_m; [|
lra|
lia].
replace (/2 ^
n)
with ((/2)^
n)
by now rewrite H2.
replace (
S (
m-1))
with (
m)
by lia.
unfold Rdiv.
replace (/2 - 1)
with (-/2)
by lra.
rewrite <-
Ropp_inv_permute; [|
lra].
field_simplify.
simpl.
rewrite <-
Rmult_assoc.
replace (2 * / 2)
with (1)
by lra.
ring_simplify.
replace ((/ 2)^
n)
with (0 + (/ 2)^
n)
at 2
by lra.
apply Rplus_le_compat_r.
apply Ropp_le_cancel.
ring_simplify.
replace (
m)
with (
S (
m-1))
by lia.
simpl.
field_simplify.
apply pow_le;
lra.
Qed.
Definition LpRRV_UniformSpace_mixin :
UniformSpace.mixin_of (
LpRRV p)
:=
UniformSpace.Mixin (
LpRRV p) (
LpRRVpoint p)
LpRRVball
LpRRV_ball_refl
LpRRV_ball_sym
LpRRV_ball_trans.
Canonical LpRRV_UniformSpace :=
UniformSpace.Pack (
LpRRV p)
LpRRV_UniformSpace_mixin (
LpRRV p).
Section quotbigp.
Ltac LpRRVq_simpl :=
repeat match goal with
| [
H:
LpRRVq p |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
| [
H:
AbelianGroup.sort LpRRVq_AbelianGroup |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
end
;
try autorewrite with quot in *
;
try apply (@
eq_Quot _ _ LpRRV_eq_equiv).
Hint Rewrite @
LpRRVq_constE :
quot.
Hint Rewrite @
LpRRVq_zeroE :
quot.
Hint Rewrite @
LpRRVq_scaleE :
quot.
Hint Rewrite @
LpRRVq_oppE :
quot.
Hint Rewrite @
LpRRVq_plusE :
quot.
Hint Rewrite @
LpRRVq_minusE :
quot.
Definition LpRRVq_ball :
LpRRVq p ->
R ->
LpRRVq p ->
Prop
:=
quot_lift_ball LpRRV_eq LpRRVball.
Lemma LpRRVq_ballE x e y :
LpRRVq_ball (
Quot _ x)
e (
Quot _ y) =
LpRRVball x e y.
Proof.
Hint Rewrite LpRRVq_ballE :
quot.
Definition LpRRVq_point :
LpRRVq p
:=
Quot _ (
LpRRVpoint p).
Lemma LpRRVq_pointE :
LpRRVq_point =
Quot _ (
LpRRVpoint p).
Proof.
reflexivity.
Qed.
Hint Rewrite LpRRVq_pointE :
quot.
Lemma LpRRVq_ball_refl x (
e :
posreal) :
LpRRVq_ball x e x.
Proof.
Lemma LpRRVq_ball_sym x y e :
LpRRVq_ball x e y ->
LpRRVq_ball y e x.
Proof.
Lemma LpRRVq_ball_trans x y z e1 e2 :
LpRRVq_ball x e1 y ->
LpRRVq_ball y e2 z ->
LpRRVq_ball x (
e1+
e2)
z.
Proof.
Definition LpRRVq_UniformSpace_mixin :
UniformSpace.mixin_of (
LpRRVq p)
:=
UniformSpace.Mixin (
LpRRVq p)
LpRRVq_point LpRRVq_ball
LpRRVq_ball_refl
LpRRVq_ball_sym
LpRRVq_ball_trans.
Canonical LpRRVq_UniformSpace :=
UniformSpace.Pack (
LpRRVq p)
LpRRVq_UniformSpace_mixin (
LpRRVq p).
Canonical LpRRVq_NormedModuleAux :=
NormedModuleAux.Pack R_AbsRing (
LpRRVq p)
(
NormedModuleAux.Class R_AbsRing (
LpRRVq p)
(
ModuleSpace.class _ LpRRVq_ModuleSpace)
(
LpRRVq_UniformSpace_mixin)) (
LpRRVq p).
Definition LpRRVq_norm : (
LpRRVq p) ->
R
:=
quot_rec LpRRV_norm_proper.
Lemma LpRRVq_normE x :
LpRRVq_norm (
Quot _ x) =
LpRRVnorm x.
Proof.
Hint Rewrite LpRRVq_normE :
quot.
Lemma LpRRVq_norm_plus (
x y:
LpRRVq p) :
LpRRVq_norm (
LpRRVq_plus x y) <=
LpRRVq_norm x +
LpRRVq_norm y.
Proof.
Lemma LpRRVq_norm_scal_strong (
x:
R) (
y:
LpRRVq p) :
LpRRVq_norm (
LpRRVq_scale x y) =
Rabs x *
LpRRVq_norm y.
Proof.
Lemma LpRRVq_norm_scal x (
y:
LpRRVq p) :
LpRRVq_norm (
LpRRVq_scale x y) <=
Rabs x *
LpRRVq_norm y.
Proof.
Lemma LpRRVq_norm0 x :
LpRRVq_norm x = 0 ->
x =
LpRRVq_zero.
Proof.
Lemma LpRRVq_minus_minus (
x y :
LpRRVq p) :
minus x y =
LpRRVq_minus x y.
Proof.
Lemma LpRRVq_minus_plus_opp
(
x y :
LpRRVq p) :
LpRRVq_minus x y =
LpRRVq_plus x (
LpRRVq_opp y).
Proof.
Lemma LpRRVq_close_close (
x y :
LpRRVq p) (
eps :
R) :
LpRRVq_norm (
minus y x) <
eps ->
LpRRVq_ball x eps y.
Proof.
Lemma LpRRVq_norm_ball_compat (
x y :
LpRRVq p) (
eps :
posreal) :
LpRRVq_ball x eps y ->
LpRRVq_norm (
minus y x) <
LpRRVnorm_factor *
eps.
Proof.
Definition LpRRVq_NormedModule_mixin :
NormedModule.mixin_of R_AbsRing LpRRVq_NormedModuleAux
:=
NormedModule.Mixin R_AbsRing LpRRVq_NormedModuleAux
LpRRVq_norm
LpRRVnorm_factor
LpRRVq_norm_plus
LpRRVq_norm_scal
LpRRVq_close_close
LpRRVq_norm_ball_compat
LpRRVq_norm0.
Canonical LpRRVq_NormedModule :=
NormedModule.Pack R_AbsRing (
LpRRVq p)
(
NormedModule.Class R_AbsRing (
LpRRVq p)
(
NormedModuleAux.class _ LpRRVq_NormedModuleAux)
LpRRVq_NormedModule_mixin)
(
LpRRVq p).
End quotbigp.
End packedbigp.
Global Arguments LpRRV :
clear implicits.
Global Arguments LpRRVq :
clear implicits.
End Lp.
Hint Rewrite LpRRVq_constE :
quot.
Hint Rewrite LpRRVq_zeroE :
quot.
Hint Rewrite LpRRVq_scaleE :
quot.
Hint Rewrite LpRRVq_oppE :
quot.
Hint Rewrite LpRRVq_plusE :
quot.
Hint Rewrite LpRRVq_minusE :
quot.
Hint Rewrite @
LpRRVq_constE :
quot.
Hint Rewrite @
LpRRVq_zeroE :
quot.
Hint Rewrite @
LpRRVq_scaleE :
quot.
Hint Rewrite @
LpRRVq_oppE :
quot.
Hint Rewrite @
LpRRVq_plusE :
quot.
Hint Rewrite @
LpRRVq_minusE :
quot.
Hint Rewrite @
LpRRVq_constE :
quot.
Hint Rewrite LpRRVq_normE :
quot.
Global Arguments LpRRVq_AbelianGroup {
Ts} {
dom}
prts p.
Global Arguments LpRRVq_ModuleSpace {
Ts} {
dom}
prts p.
Global Arguments LpRRVq_UniformSpace {
Ts} {
dom}
prts p.
Global Arguments LpRRVq_NormedModule {
Ts} {
dom}
prts p.
Ltac LpRRVq_simpl :=
repeat match goal with
| [
H:
LpRRVq _ _ |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
| [
H:
AbelianGroup.sort (
LpRRVq_AbelianGroup _ _ _) |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
| [
H:
ModuleSpace.sort R_Ring (
LpRRVq_ModuleSpace _ _) |-
_ ] =>
let xx :=
fresh H in destruct (
Quot_inv H)
as [
xx ?];
subst H;
rename xx into H
end
;
try autorewrite with quot in *
;
try apply (@
eq_Quot _ _ (
LpRRV_eq_equiv _)).
Ltac LpRRV_simpl
:=
repeat match goal with
| [
H :
LpRRV _ _ |-
_ ] =>
destruct H as [???]
end
;
unfold LpRRVplus,
LpRRVminus,
LpRRVopp,
LpRRVscale
;
simpl
.
Global Arguments LpRRV_seq {
Ts} {
dom} {
prts} {
p}
rv1 rv2.
Section complete.
Section complete1.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Context {
p:
R}.
Context (
pbig:1 <=
p).
Let pnneg :
nonnegreal :=
bignneg p pbig.
Canonical pnneg.
Lemma LpRRV_norm_opp (
x :
LpRRV prts p) :
LpRRVnorm prts (
LpRRVopp prts x) =
LpRRVnorm prts x.
Proof.
Lemma inv_pow_2_pos (
n :
nat) :
0 < / (2 ^
n) .
Proof.
Definition LpRRV_lim_ball_center_center
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop) :
ProperFilter F ->
cauchy F ->
forall (
n:
nat),
{
b:
LpRRV_UniformSpace prts pbig |
F (
Hierarchy.ball (
M:=
LpRRV_UniformSpace prts pbig)
b (
mkposreal _ (
inv_pow_2_pos n)))}.
Proof.
Definition LpRRV_lim_ball_center
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop) :
ProperFilter F ->
cauchy F ->
forall (
n:
nat), {
b:
LpRRV prts p ->
Prop |
F b}.
Proof.
Definition LpRRV_lim_ball_cumulative
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n:
nat) : {
x:
LpRRV prts p->
Prop |
F x}
:=
fold_right (
fun x y =>
exist _ _ (
Hierarchy.filter_and
_ _ (
proj2_sig x) (
proj2_sig y)))
(
exist _ _ Hierarchy.filter_true)
(
map (
LpRRV_lim_ball_center F PF cF) (
seq 0 (
S n))).
Definition LpRRV_lim_picker
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n:
nat) :
LpRRV prts p
:= (
proj1_sig (
constructive_indefinite_description
_
(
filter_ex
_
(
proj2_sig (
LpRRV_lim_ball_cumulative F PF cF n))))).
Definition LpRRV_lim_picker_ext0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n:
nat) :
LpRRV prts p
:=
match n with
| 0 =>
LpRRVzero prts
|
S n' =>
LpRRV_lim_picker F PF cF n
end.
Lemma lim_picker_cumulative_included
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
N n:
nat) :
(
N <=
n)%
nat ->
forall x,
proj1_sig (
LpRRV_lim_ball_cumulative F PF cF n)
x ->
(
proj1_sig (
LpRRV_lim_ball_center F PF cF N))
x.
Proof.
unfold LpRRV_lim_ball_cumulative.
intros.
assert (
inn:
In N (
seq 0 (
S n))).
{
apply in_seq.
lia.
}
revert inn H0.
generalize (
seq 0 (
S n)).
clear.
induction l;
simpl.
-
tauto.
-
intros [
eqq |
inn];
intros.
+
subst.
tauto.
+
apply (
IHl inn).
tauto.
Qed.
Lemma lim_picker_included
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
N n:
nat) :
(
N <=
n)%
nat ->
(
proj1_sig (
LpRRV_lim_ball_center F PF cF N))
(
LpRRV_lim_picker F PF cF n).
Proof.
Lemma lim_ball_center_ball_center_center (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n:
nat) :
forall (
x:
UniformSpace.sort (
LpRRV_UniformSpace prts pbig)),
(
Hierarchy.ball (
M:=
LpRRV_UniformSpace prts pbig)
(
proj1_sig (
LpRRV_lim_ball_center_center F PF cF n))
(
mkposreal _ (
inv_pow_2_pos n)))
x
<->
proj1_sig (
LpRRV_lim_ball_center F PF cF n)
x.
Proof.
Lemma lim_picker_center_included
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n:
nat) :
(
Hierarchy.ball (
M:=
LpRRV_UniformSpace prts pbig)
(
proj1_sig (
LpRRV_lim_ball_center_center F PF cF n))
(
mkposreal _ (
inv_pow_2_pos n)))
(
LpRRV_lim_picker F PF cF n).
Proof.
Lemma lim_picker_center_included2
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
N:
nat) :
forall (
n:
nat),
(
n >=
N)%
nat ->
(
Hierarchy.ball (
M:=
LpRRV_UniformSpace prts pbig)
(
proj1_sig (
LpRRV_lim_ball_center_center F PF cF N))
(
mkposreal _ (
inv_pow_2_pos N)))
(
LpRRV_lim_picker F PF cF n).
Proof.
Lemma LpRRVq_opp_opp (
x :
LpRRVq_AbelianGroup prts (
bignneg _ pbig)) :
opp x =
LpRRVq_opp prts x.
Proof.
unfold opp;
simpl.
LpRRVq_simpl.
reflexivity.
Qed.
Lemma LpRRVq_minus_plus_opp'
(
x y :
LpRRVq prts p) :
LpRRVq_minus prts x y =
LpRRVq_plus prts x (
LpRRVq_opp prts y).
Proof.
Lemma lim_ball_center_dist (
x y :
LpRRV prts p)
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
N:
nat) :
(
proj1_sig (
LpRRV_lim_ball_center F PF cF N))
x ->
(
proj1_sig (
LpRRV_lim_ball_center F PF cF N))
y ->
LpRRVnorm prts (
LpRRVminus prts x y) < 2 / 2 ^
N.
Proof.
Lemma lim_filter_cauchy
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
forall N :
nat,
forall n m :
nat,
(
n >=
N)%
nat ->
(
m >=
N)%
nat ->
LpRRVnorm prts (
LpRRVminus
prts
(
LpRRV_lim_picker F PF cF n)
(
LpRRV_lim_picker F PF cF m)) < 2 / 2 ^
N.
Proof.
Lemma cauchy_filter_sum_bound
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) (
pbigger:1 <
p):
ex_series (
fun n =>
LpRRVnorm prts
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S n))
(
LpRRV_lim_picker F PF cF n))).
Proof.
Lemma series_sum_le (
f :
nat ->
R) (
x:
R) :
is_series f x ->
(
forall n, 0 <=
f n) ->
forall n,
sum_n f n <=
x.
Proof.
Lemma islp_Rbar_lim_telescope_abs_gen (
f :
nat ->
LpRRV prts p) :
ex_series (
fun n =>
LpRRVnorm prts
(
LpRRVminus prts (
f (
S n)) (
f n))) ->
(
forall (
n:
nat),
RandomVariable dom borel_sa (
f n)) ->
IsLp_Rbar prts p
(
Rbar_rvlim
(
fun n =>
LpRRV_rv_X _ (
LpRRVsum
prts pbig
(
fun n0 =>
LpRRVabs prts (
LpRRVminus prts (
f (
S n0))
(
f n0)))
n))).
Proof.
Lemma cauchy_filter_sum_abs
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar
prts p
(
Rbar_rvlim
(
fun n0 =>
LpRRV_rv_X _
(
LpRRVsum prts pbig
(
fun n =>
(
LpRRVabs prts
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S n)))))
n0))).
Proof.
Lemma cauchy_filter_sum_abs_ext0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar
prts p
(
Rbar_rvlim
(
fun n0 =>
LpRRV_rv_X _ (
LpRRVsum prts pbig
(
fun n =>
(
LpRRVabs prts
(
LpRRVminus prts
(
LpRRV_lim_picker_ext0 F PF cF (
S n))
(
LpRRV_lim_picker_ext0 F PF cF n))))
n0))).
Proof.
Lemma cauchy_filter_sum
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar prts p
(
Rbar_rvlim
(
rvsum
(
fun n =>
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S n)))))).
Proof.
Lemma cauchy_filter_sum_ext0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar prts p
(
Rbar_rvlim
(
rvsum
(
fun n =>
(
LpRRVminus prts
(
LpRRV_lim_picker_ext0 F PF cF (
S n))
(
LpRRV_lim_picker_ext0 F PF cF n))))).
Proof.
Lemma LpRRVsum_telescope0
(
f:
nat ->
LpRRV prts p) :
forall n0,
LpRRV_seq (
LpRRVsum prts pbig
(
fun n => (
LpRRVminus prts (
f (
S n)) (
f n)))
n0)
(
LpRRVminus prts (
f (
S n0)) (
f 0%
nat)).
Proof.
intros;
induction n0.
-
intros x;
simpl.
unfold rvsum.
now rewrite sum_O.
-
simpl in *.
intros x;
simpl.
specialize (
IHn0 x).
simpl in *.
unfold rvsum in *.
rewrite sum_Sn.
rewrite IHn0.
rv_unfold.
unfold plus;
simpl.
lra.
Qed.
Lemma LpRRVsum_telescope
(
f:
nat ->
LpRRV prts p) :
forall n0,
LpRRV_seq (
LpRRVplus prts (
f 0%
nat)
(
LpRRVsum prts pbig
(
fun n => (
LpRRVminus prts (
f (
S n)) (
f n)))
n0))
(
f (
S n0)).
Proof.
Lemma cauchy_filter_sum_telescope
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
forall n0,
LpRRV_seq (
LpRRVplus
prts
(
LpRRV_lim_picker F PF cF (
S 0%
nat))
(
LpRRVsum prts pbig
(
fun n =>
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S n))))
n0))
(
LpRRV_lim_picker F PF cF (
S (
S n0))).
Proof.
Lemma cauchy_filter_Rbar_lim
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar prts p
(
Rbar_rvlim
(
fun n =>
LpRRV_rv_X _ (
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S 0%
nat)))
)).
Proof.
Lemma cauchy_filter_Rbar_lim_ext0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar prts p
(
Rbar_rvlim
(
fun n =>
LpRRV_rv_X _ (
LpRRVminus prts
(
LpRRV_lim_picker_ext0 F PF cF (
S n))
(
LpRRV_lim_picker_ext0 F PF cF 0%
nat)))
).
Proof.
Lemma IsLp_IsLp_Rbar (
f :
LpRRV prts p) :
IsLp_Rbar prts p (
LpRRV_rv_X prts f).
Proof.
Lemma IsLp_Rbar_IsLp (
f :
Ts ->
R) :
IsLp_Rbar prts p f ->
IsLp prts p f.
Proof.
Lemma cauchy_filter_Rbar_rvlim1
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp_Rbar prts p
(
Rbar_rvlim (
fun n => (
LpRRV_rv_X _ (
LpRRV_lim_picker F PF cF (
S n))))).
Proof.
Instance nnf_0 :
(@
Rbar_NonnegativeFunction Ts (
fun x =>
const 0
x)).
Proof.
Lemma Rbar_IsLp_bounded n (
rv_X1 rv_X2 :
Ts ->
Rbar)
(
rle:
Rbar_rv_le (
fun (
omega :
Ts) =>
Rbar_power (
Rbar_abs (
rv_X1 omega))
n)
rv_X2)
{
islp:
Rbar_IsFiniteExpectation prts rv_X2}
:
IsLp_Rbar prts n rv_X1.
Proof.
Instance Rbar_power_pos m (
rv_X:
Ts ->
Rbar) :
Rbar_NonnegativeFunction
(
fun omega =>
Rbar_power (
rv_X omega)
m).
Proof.
Lemma IsLp_Rbar_down_le m n (
rv_X:
Ts->
Rbar)
{
rrv:
RandomVariable dom Rbar_borel_sa rv_X}
(
pfle:0 <=
n <=
m)
{
lp:
IsLp_Rbar prts m rv_X} :
IsLp_Rbar prts n rv_X.
Proof.
Lemma IsL1_Rbar_abs_Finite (
rv_X:
Ts->
Rbar)
{
lp:
IsLp_Rbar prts 1
rv_X} :
is_finite (
Rbar_NonnegExpectation (
Rbar_rvabs rv_X)).
Proof.
Lemma IsL1_Rbar_Finite (
rv_X:
Ts->
Rbar)
{
rv:
RandomVariable dom Rbar_borel_sa rv_X}
{
lp:
IsLp_Rbar prts 1
rv_X} :
Rbar_IsFiniteExpectation prts rv_X.
Proof.
Lemma Rbar_IsLp_IsFiniteExpectation (
f :
Ts ->
Rbar) (
n :
R)
{
rrv:
RandomVariable dom Rbar_borel_sa f} :
1 <=
n ->
IsLp_Rbar prts n f ->
Rbar_IsFiniteExpectation prts f.
Proof.
Lemma Rbar_IsLp_almostR2_finite (
f :
Ts ->
Rbar) (
n :
R)
{
rrv:
RandomVariable dom Rbar_borel_sa f} :
1 <=
n ->
IsLp_Rbar prts n f ->
ps_P (
exist sa_sigma _ (
sa_finite_Rbar f rrv)) = 1.
Proof.
Instance picker_rv
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
n :
nat) :
RandomVariable dom borel_sa (
LpRRV_rv_X prts (
LpRRV_lim_picker F PF cF n)).
Proof.
Lemma Rbar_lim_seq_pos_rv
(
f :
nat ->
Ts ->
Rbar) :
(
forall n,
RandomVariable dom Rbar_borel_sa (
f n)) ->
(
forall n,
Rbar_NonnegativeFunction (
f n)) ->
RandomVariable dom Rbar_borel_sa (
fun omega =>
ELim_seq (
fun n =>
f n omega)).
Proof.
Lemma cauchy_filter_sum_abs_finite00
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
is_finite (
ELim_seq
(
fun n0 =>
LpRRVsum prts pbig
(
fun n =>
(
LpRRVabs prts
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S n)))))
n0 x))).
Proof.
Lemma cauchy_filter_sum_abs_ext0_finite00
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
is_finite (
ELim_seq
(
fun n0 =>
LpRRVsum prts pbig
(
fun n =>
(
LpRRVabs prts
(
LpRRVminus prts
(
LpRRV_lim_picker_ext0 F PF cF (
S n))
(
LpRRV_lim_picker_ext0 F PF cF n))))
n0 x))).
Proof.
Lemma cauchy_filter_sum_finite00
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
ex_finite_lim_seq
(
fun n0 =>
LpRRVsum prts pbig
(
fun n =>
(
LpRRVminus prts
(
LpRRV_lim_picker F PF cF (
S (
S n)))
(
LpRRV_lim_picker F PF cF (
S n))))
n0 x)).
Proof.
Lemma cauchy_filter_sum_ext0_finite00
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
ex_finite_lim_seq
(
fun n0 =>
LpRRVsum prts pbig
(
fun n =>
(
LpRRVminus prts
(
LpRRV_lim_picker_ext0 F PF cF (
S n))
(
LpRRV_lim_picker_ext0 F PF cF n)))
n0 x)).
Proof.
Lemma cauchy_filter_rvlim_finite0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
ex_finite_lim_seq (
fun n => (
LpRRV_lim_picker F PF cF (
S (
S n)))
x)).
Proof.
Lemma cauchy_filter_rvlim_ext0_finite0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
ex_finite_lim_seq (
fun n => (
LpRRV_lim_picker F PF cF (
S n))
x)).
Proof.
Lemma cauchy_filter_rvlim_Sext0_finite0
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
almost prts (
fun x =>
ex_finite_lim_seq (
fun n => (
LpRRV_lim_picker F PF cF n)
x)).
Proof.
Lemma cauchy_filter_rvlim_finite
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
exists (
P:
event dom),
exists (
dec:
forall x, {
P x} + {~
P x}),
ps_P P = 1 /\
(
forall x,
ex_finite_lim_seq (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))
x) ) /\
IsLp prts p
(
rvlim (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n))))).
Proof.
Lemma cauchy_filter_rvlim_finite1
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
{
P:
event dom |
exists dec:
forall x, {
P x} + {~
P x},
ps_P P = 1 /\
(
forall x,
ex_finite_lim_seq (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))
x) ) /\
IsLp prts p
(
rvlim (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))))
}.
Proof.
Lemma cauchy_filter_rvlim_finite2
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
{
P:
event dom &
{
dec:
forall x, {
P x} + {~
P x} |
ps_P P = 1 /\
(
forall x,
ex_finite_lim_seq (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))
x) ) /\
IsLp prts p
(
rvlim (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))))}
}.
Proof.
Definition cauchy_rvlim_fun (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
Ts ->
R
:=
match cauchy_filter_rvlim_finite2 F PF cF with
|
existT P (
exist dec PP) => (
rvlim (
fun n => (
rvmult (
EventIndicator dec)
(
LpRRV_lim_picker F PF cF (
S n)))))
end.
Global Instance cauchy_rvlim_fun_isl2 (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
IsLp prts p (
cauchy_rvlim_fun F PF cF).
Proof.
Global Instance cauchy_rvlim_fun_rv (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
RandomVariable dom borel_sa (
cauchy_rvlim_fun F PF cF).
Proof.
Definition LpRRV_lim_with_conditions (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
LpRRV prts p
:=
pack_LpRRV prts (
cauchy_rvlim_fun F PF cF).
Definition LpRRV_lim (
F : ((
LpRRV prts p ->
Prop) ->
Prop)) :
LpRRV prts p.
Proof.
Lemma Lim_seq_continuous (
f :
R ->
R) (
u :
nat ->
R) :
continuity_pt f (
Lim_seq u) ->
ex_finite_lim_seq u ->
Lim_seq (
fun n =>
f (
u n)) =
f (
Lim_seq u).
Proof.
Lemma is_finite_Lim_seq_continuous (
f :
R ->
R) (
u :
nat ->
R) :
continuity_pt f (
Lim_seq u) ->
ex_finite_lim_seq u ->
is_finite (
Lim_seq (
fun n =>
f (
u n))).
Proof.
Lemma ex_lim_seq_continuous (
f :
R ->
R) (
u :
nat ->
R) :
continuity_pt f (
Lim_seq u) ->
ex_finite_lim_seq u ->
ex_lim_seq (
fun n =>
f (
u n)).
Proof.
Lemma lim_seq_lim_inf (
f :
nat ->
R) :
ex_lim_seq f ->
Lim_seq f =
LimInf_seq f.
Proof.
Lemma is_finite_LimInf_seq_continuous (
f :
R ->
R) (
u :
nat ->
R) :
continuity_pt f (
Lim_seq u) ->
ex_finite_lim_seq u ->
is_finite (
LimInf_seq (
fun n =>
f (
u n))).
Proof.
Lemma LpRRVnorm_NonnegExpectation
(
f :
LpRRV prts p)
(
rv :
RandomVariable dom borel_sa f) :
LpRRVnorm prts f =
power (
NonnegExpectation (
rvpower (
rvabs f) (
const p))) (/
p).
Proof.
Lemma rvpowerabs_rvminus_rvlim_comm (
f :
nat ->
Ts ->
R) (
n:
nat):
(
forall x,
ex_finite_lim_seq (
fun n0 =>
f n0 x)) ->
(
rv_eq
(
rvpower (
rvabs (
rvminus (
rvlim f) (
f n))) (
const p))
(
rvlim (
fun x => (
rvpower (
rvabs (
rvminus (
f x) (
f n))) (
const p))))).
Proof.
Lemma lt_Rbar_lt (
x :
Rbar) (
y :
R) :
0 <
y ->
Rbar_lt x y -> (
real x) <
y.
Proof.
intros.
destruct x.
- now simpl in H.
- now simpl.
- now simpl.
Qed.
Lemma le_Rbar_le (
x :
Rbar) (
y :
R) :
0 <=
y ->
Rbar_le x y -> (
real x) <=
y.
Proof.
intros.
destruct x.
- now simpl in H.
- now simpl.
- now simpl.
Qed.
Lemma LimInf_seq_ext (
f g :
nat ->
R) :
eventually (
fun n =>
f n =
g n) ->
LimInf_seq f =
LimInf_seq g.
Proof.
Instance Rbar_real_rv
(
f :
Ts ->
Rbar)
(
rv :
RandomVariable dom Rbar_borel_sa f) :
RandomVariable dom borel_sa (
fun omega =>
real (
f omega)).
Proof.
Lemma norm_rvminus_rvlim_le
(
f :
nat ->
LpRRV prts p)
(
rvl :
RandomVariable dom borel_sa (
rvlim f))
(
isl :
IsLp prts p (
rvlim f)) :
(
forall x,
ex_finite_lim_seq (
fun n =>
f n x)) ->
(
forall (
eps:
posreal),
exists (
N :
nat),
forall (
n m :
nat),
(
n >=
N)%
nat ->
(
m >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
f m) (
f n))) <
eps) ->
forall (
eps :
posreal),
exists (
N :
nat),
forall (
n :
nat),
(
n >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
pack_LpRRV prts (
rvlim f)) (
f n))) <=
eps.
Proof.
intros.
specialize (
H0 eps).
destruct H0 as [
N ?].
exists N.
intros.
unfold LpRRVnorm,
LpRRVminus,
pack_LpRRV;
simpl.
replace (
pos eps)
with (
power (
power eps p) (/
p))
by (
apply inv_power_cancel; [
left;
apply cond_pos|
lra]).
apply Rle_power_l.
left;
apply Rinv_0_lt_compat;
lra.
split.
apply FiniteExpectation_pos;
typeclasses eauto.
assert (1 <= 2)
by lra.
generalize (
rvpowerabs_rvminus_rvlim_comm f n H);
intros.
rewrite (
FiniteExpectation_ext_alt _ _ _ H3).
assert (
rv_eq
(
rvlim (
fun x :
nat =>
rvpower (
rvabs (
rvminus (
f x) (
f n))) (
const p)))
(
fun omega =>
LimInf_seq (
fun x :
nat =>
rvpower (
rvabs (
rvminus (
f x) (
f n))) (
const p)
omega))).
{
intros z.
unfold rvlim.
rewrite lim_seq_lim_inf;
trivial.
pose (
p_power_abs :=
fun x => @
p_power p (
Rabs x) ).
unfold rvpower,
rvabs,
const,
rvminus,
rvplus,
rvopp,
rvscale.
apply ex_lim_seq_ext with (
u :=
fun n0 =>
p_power_abs (
f n0 z + -1 *
f n z)).
intros.
now unfold p_power_abs,
p_power.
specialize (
H z).
unfold ex_finite_lim_seq in H.
destruct H.
unfold ex_lim_seq.
exists (
p_power_abs (
x + -1 *
f n z)).
apply is_lim_seq_continuous.
apply continuity_p_power_Rabs;
lra.
apply is_lim_seq_plus';
trivial.
apply is_lim_seq_const.
}
rewrite (
FiniteExpectation_ext_alt _ _ _ H4).
unfold LpRRVnorm in H0.
erewrite FiniteNonnegExpectation.
apply le_Rbar_le.
rewrite <- (
power0_Sbase p).
assert (0 <
eps)
by apply cond_pos.
apply Rle_power_l;
lra.
assert (
forall omega :
Ts,
is_finite (
LimInf_seq (
fun n0 :
nat =>
rvpower (
rvabs (
rvminus (
f n0) (
f n))) (
const p)
omega))).
{
intros.
unfold rvpower,
rvabs,
rvminus,
rvplus,
rvopp,
rvscale,
rvlim,
const.
pose (
p_power_abs :=
fun x => @
p_power p (
Rabs x) ).
specialize (
H omega).
generalize (
LimInf_seq_ext
(
fun n0 :
nat =>
power (
Rabs (
f n0 omega + -1 *
f n omega))
p)
(
fun n0 =>
p_power_abs (
f n0 omega + -1 *
f n omega)));
intros.
rewrite H5.
-
apply is_finite_LimInf_seq_continuous.
+
rewrite ex_finite_lim_seq_correct in H.
destruct H.
unfold p_power_abs,
p_power.
rewrite Lim_seq_plus,
Lim_seq_const;
trivial.
*
apply continuity_p_power_Rabs;
lra.
*
apply ex_lim_seq_const.
*
rewrite Lim_seq_const.
rewrite <-
H6.
now simpl.
+
unfold ex_finite_lim_seq.
unfold ex_finite_lim_seq in H.
destruct H.
exists (
x + -1 *
f n omega).
apply is_lim_seq_plus';
trivial.
apply is_lim_seq_const.
-
intros.
exists (0%
nat);
intros.
now unfold p_power_abs.
}
eapply Rbar_le_trans.
-
apply Fatou;
trivial.
+
intros;
typeclasses eauto.
+
intros.
generalize (
IsLp_minus prts pnneg (
f n0) (
f n));
intros.
unfold IsLp in H6.
unfold IsFiniteExpectation in H6.
erewrite Expectation_pos_pofrf in H6.
simpl in H6.
match_case_in H6;
intros.
*
rewrite H7;
now simpl.
*
now rewrite H7 in H6.
*
now rewrite H7 in H6.
+
eapply (
RandomVariable_proper _ _ (
reflexivity _)
_ _ (
reflexivity _)).
{
intros ?.
rewrite <-
ELimInf_seq_fin.
reflexivity.
}
apply borel_Rbar_borel.
generalize Rbar_lim_inf_rv.
intros.
typeclasses eauto.
-
simpl.
unfold LpRRVnorm in H1.
simpl in H1.
assert (
forall n0,
(
n0 >=
N)%
nat ->
NonnegExpectation (
fun omega :
Ts =>
rvpower (
rvabs (
rvminus (
f n0) (
f n))) (
const p)
omega) <=
(
power eps p)).
{
intros.
specialize (
H0 n n0 H1 H6).
generalize (
Rle_power_l (
power (
FiniteExpectation prts (
rvpower (
rvabs (
rvminus (
f n0) (
f n))) (
const p))) (/
p) ) (
pos eps)
p);
intros.
rewrite power_inv_cancel in H7.
erewrite FiniteNonnegExpectation in H7.
apply H7.
lra.
split; [
apply power_nonneg |].
erewrite FiniteNonnegExpectation in H0.
left;
apply H0.
apply FiniteExpectation_pos.
typeclasses eauto.
lra.
}
replace (
Finite (
power eps p))
with (
LimInf_seq (
fun _ =>
power eps p))
by apply LimInf_seq_const.
apply LimInf_le.
exists N;
intros.
apply H6.
lia.
Qed.
Lemma norm_rvminus_rvlim
(
f :
nat ->
LpRRV prts p)
(
rvl :
RandomVariable dom borel_sa (
rvlim f))
(
isl :
IsLp prts p (
rvlim f)) :
(
forall x,
ex_finite_lim_seq (
fun n =>
f n x)) ->
(
forall (
eps:
posreal),
exists (
N :
nat),
forall (
n m :
nat),
(
n >=
N)%
nat ->
(
m >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
f m) (
f n))) <
eps) ->
forall (
eps :
posreal),
exists (
N :
nat),
forall (
n :
nat),
(
n >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
pack_LpRRV prts (
rvlim f)) (
f n))) <
eps.
Proof.
End complete1.
Section complete2.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Context {
p:
R}.
Context (
pbig:1 <=
p).
Let pnneg :
nonnegreal :=
bignneg p pbig.
Canonical pnneg.
Global Instance event_restricted_islp P n (
pf1 :
ps_P P = 1)
pf
(
f :
Ts ->
R)
(
isl:
IsLp prts n f):
IsLp (
event_restricted_prob_space prts P pf)
n (
event_restricted_function P f).
Proof.
Program Definition event_restricted_LpRRV n P (
pf1 :
ps_P P = 1)
pf (
rv:
LpRRV prts n) :
LpRRV (
event_restricted_prob_space prts P pf)
n
:= {|
LpRRV_rv_X :=
event_restricted_function P (
LpRRV_rv_X _ rv)
|} .
Next Obligation.
Lemma restricted_LpRRVminus P (
pf1 :
ps_P P = 1)
pf
(
f g :
LpRRV prts p) :
LpRRV_seq
(
LpRRVminus (
event_restricted_prob_space prts P pf)
(
event_restricted_LpRRV p P pf1 pf f)
(
event_restricted_LpRRV p P pf1 pf g))
(
event_restricted_LpRRV p P pf1 pf (
LpRRVminus prts f g)).
Proof.
easy.
Qed.
Lemma restricted_LpRRVnorm P (
pf1 :
ps_P P = 1)
pf
(
f :
LpRRV prts p) :
LpRRVnorm prts f =
LpRRVnorm (
event_restricted_prob_space prts P pf)
(
event_restricted_LpRRV p P pf1 pf f).
Proof.
Lemma restricted_LpRRV_rvlim P (
pf1 :
ps_P P = 1)
pf
(
f :
nat ->
LpRRV prts p)
(
rv :
RandomVariable dom borel_sa (
rvlim (
fun x :
nat =>
f x)))
(
isl :
IsLp prts p (
rvlim (
fun x :
nat =>
f x)))
(
rve :
RandomVariable (
event_restricted_sigma P)
borel_sa
(
rvlim (
fun x :
nat =>
event_restricted_LpRRV p P pf1 pf (
f x))))
(
isle :
IsLp (
event_restricted_prob_space prts P pf)
p
(
rvlim (
fun x :
nat =>
event_restricted_LpRRV p P pf1 pf (
f x)))) :
ps_P P = 1 ->
LpRRV_seq
(
pack_LpRRV (
event_restricted_prob_space prts P pf)
(
rvlim (
fun x :
nat =>
event_restricted_LpRRV p P pf1 pf (
f x))))
(
event_restricted_LpRRV p P pf1 pf
(
pack_LpRRV prts (
rvlim (
fun x :
nat =>
f x)))).
Proof.
easy.
Qed.
Lemma norm_rvminus_rvlim_almostR2
(
f :
nat ->
LpRRV prts p)
(
rvl :
RandomVariable dom borel_sa (
rvlim f))
(
isl :
IsLp prts p (
rvlim f))
(
P :
event dom) :
ps_P P = 1 ->
(
forall x,
P x ->
ex_finite_lim_seq (
fun n =>
f n x)) ->
(
forall (
eps:
posreal),
exists (
N :
nat),
forall (
n m :
nat),
(
n >=
N)%
nat ->
(
m >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
f m) (
f n))) <
eps) ->
forall (
eps :
posreal),
exists (
N :
nat),
forall (
n :
nat),
(
n >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
pack_LpRRV prts (
rvlim f)) (
f n))) <
eps.
Proof.
Lemma two_pow_gt (
r :
R) :
exists n,
r <
pow 2
n.
Proof.
Lemma inv_two_pow_lt (
eps :
posreal) :
exists n, / (
pow 2
n) <
eps.
Proof.
Lemma Npow_eps (
eps :
posreal) :
exists (
N :
nat), 2 / (
pow 2
N) <
eps.
Proof.
Lemma LpRRVnorm_rvminus_rvlim_almostR2
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
eps :
posreal)
(
rv :
RandomVariable dom borel_sa (
rvlim (
fun n :
nat =>
LpRRV_lim_picker prts pbig F PF cF (
S n))))
(
islp :
IsLp prts p (
rvlim (
fun n :
nat =>
LpRRV_lim_picker prts pbig F PF cF (
S n)))):
let f :=
fun n =>
LpRRV_lim_picker prts pbig F PF cF (
S n)
in
forall (
eps :
posreal),
exists (
N :
nat),
forall (
n :
nat),
(
n >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
pack_LpRRV prts (
rvlim f)) (
f n))) <
eps.
Proof.
Global Instance IsLp_EventIndicator_mult {
P :
event dom} (
dec :
forall x, {
P x} + {~
P x})
(
rv_X:
Ts ->
R)
{
rv :
RandomVariable dom borel_sa rv_X}
{
islp:
IsLp prts p rv_X} :
IsLp prts p (
rvmult (
EventIndicator dec)
rv_X).
Proof.
Definition LpRRVindicator {
P :
event dom} (
dec :
forall x, {
P x} + {~
P x}) (
rv :
LpRRV prts p) :
LpRRV prts p
:=
pack_LpRRV prts (
rvmult (
EventIndicator dec)
rv).
Instance rvlim_rv_almostR2_P
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
{
P :
event dom}
(
dec :
forall x, {
P x} + {~
P x})
(
pf:
forall x :
Ts,
ex_finite_lim_seq
(
fun n :
nat =>
rvmult (
EventIndicator dec) (
LpRRV_lim_picker prts pbig F PF cF (
S n))
x)):
let f :=
fun n :
nat =>
LpRRVindicator dec (
LpRRV_lim_picker prts pbig F PF cF (
S n))
in
RandomVariable dom borel_sa (
rvlim f).
Proof.
Lemma LpRRVminus_indicator_comm {
P :
event dom} (
dec :
forall x, {
P x} + {~
P x})
(
f g :
LpRRV prts p) :
LpRRV_seq
(
LpRRVminus prts (
LpRRVindicator dec f) (
LpRRVindicator dec g))
(
LpRRVindicator dec (
LpRRVminus prts f g)).
Proof.
Lemma LpRRVnorm_indicator {
P :
event dom} (
dec :
forall x, {
P x} + {~
P x})
(
f :
LpRRV prts p) :
ps_P P = 1 ->
LpRRVnorm prts f =
LpRRVnorm prts (
LpRRVindicator dec f).
Proof.
Lemma LpRRVnorm_rvminus_rvlim_almostR2_P
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
eps :
posreal):
let '(
existT P (
exist dec _)) := (
cauchy_filter_rvlim_finite2 prts pbig F PF cF)
in
let f :=
fun n :
nat =>
LpRRVindicator dec (
LpRRV_lim_picker prts pbig F PF cF (
S n))
in
exists (
rv:
RandomVariable dom borel_sa (
rvlim f)),
exists (
isl:
IsLp prts p (
rvlim f)),
ps_P P = 1 /\
(
forall x :
Ts,
ex_finite_lim_seq (
fun n :
nat =>
f n x)) /\
forall (
eps :
posreal),
exists (
N :
nat),
forall (
n :
nat),
(
n >=
N)%
nat ->
(
LpRRVnorm prts (
LpRRVminus prts (
pack_LpRRV prts (
rvlim f)) (
f n))) <
eps.
Proof.
Lemma LpRRVnorm_LpRRV_cauchy_picker
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
eps :
posreal) :
exists (
N :
nat),
exists (
x :
LpRRV prts p),
(
F (
Hierarchy.ball x eps)) /\
(
forall (
n:
nat), (
n >=
N)%
nat ->
((
Hierarchy.ball (
M :=
LpRRV_UniformSpace prts pbig)
x eps)
(
LpRRV_lim_picker prts pbig F PF cF n))).
Proof.
Lemma ball_LpRRV_lim_picker
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
eps :
posreal) :
exists (
N :
nat),
forall (
n :
nat), (
n >=
N)%
nat ->
(
Hierarchy.ball (
M :=
LpRRV_UniformSpace prts pbig)
(
LpRRV_lim_picker prts pbig F PF cF (
S n))
eps (
LpRRV_lim prts pbig F)).
Proof.
generalize (
LpRRVnorm_rvminus_rvlim_almostR2_P F PF cF eps);
intros.
match_case_in H;
intros.
rewrite H0 in H.
match_destr_in H.
simpl in H.
destruct H as [? [? [? [? ?]]]].
specialize (
H2 eps).
destruct H2 as [
N ?].
exists N.
intros.
specialize (
H2 n H3).
unfold LpRRV_lim.
match_destr;
try tauto.
match_destr;
try tauto.
do 2
red;
simpl.
unfold LpRRV_lim_with_conditions.
unfold LpRRVball,
LpRRVnorm.
unfold LpRRVnorm in H1.
unfold bignneg;
simpl.
assert ((
FiniteExpectation prts (
rvpower (
rvabs (
rvminus (
LpRRV_lim_picker prts pbig F PF cF (
S n)) (
cauchy_rvlim_fun prts pbig F p0 c))) (
const p))) =
(
FiniteExpectation prts
(
rvpower
(
rvabs
(
LpRRVminus prts
(
pack_LpRRV prts (
rvlim (
fun n :
nat =>
rvmult (
EventIndicator x0) (
LpRRV_lim_picker prts pbig F PF cF (
S n)))))
(
LpRRVindicator x0 (
LpRRV_lim_picker prts pbig F PF cF (
S n))))) (
const p)))).
{
apply FiniteExpectation_proper_almostR2.
typeclasses eauto.
typeclasses eauto.
unfold almostR2.
exists x.
split;
trivial.
intros.
unfold rvpower,
const.
f_equal.
unfold rvabs,
LpRRVminus,
pack_LpRRV;
simpl.
unfold rvminus,
rvplus,
rvopp,
rvscale,
cauchy_rvlim_fun.
rewrite (
proof_irrelevance _ p0 PF).
rewrite (
proof_irrelevance _ c cF).
rewrite H0.
rewrite <-
Rabs_Ropp at 1.
f_equal.
rewrite Rplus_comm.
ring_simplify.
f_equal.
unfold EventIndicator,
rvmult.
match_destr.
lra.
tauto.
}
unfold LpRRVnorm,
LpRRVminus,
pack_LpRRV in H2.
simpl in H2.
clear H0.
clear a.
erewrite FiniteExpectation_pf_irrel;
rewrite H4.
erewrite FiniteExpectation_pf_irrel in H2.
apply H2.
Qed.
Lemma LpRRVnorm_LpRRV_lim
(
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F)
(
eps :
posreal) :
exists (
x :
LpRRV prts p),
(
F (
Hierarchy.ball x eps)) /\
((
Hierarchy.ball (
M :=
LpRRV_UniformSpace prts pbig)
x eps) (
LpRRV_lim prts pbig F)).
Proof.
Lemma L2RRV_lim_complete (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF :
ProperFilter F)
(
cF :
cauchy F) :
forall eps :
posreal,
F (
Hierarchy.ball (
LpRRV_lim prts pbig F)
eps).
Proof.
Program Definition LpRRVq_lim_with_conditions (
F : (
LpRRV_UniformSpace prts pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
LpRRVq prts p
:=
Quot _ (
LpRRV_lim_with_conditions prts pbig F PF cF).
Lemma LpRRVq_lim_with_conditionsE F PF cF :
LpRRVq_lim_with_conditions F PF cF =
Quot _ (
LpRRV_lim_with_conditions prts pbig F PF cF).
Proof.
reflexivity.
Qed.
Hint Rewrite LpRRVq_lim_with_conditionsE :
quot.
Definition LpRRV_toLpRRVq_set (
s:(
LpRRV prts p)->
Prop) (
x:
LpRRVq prts p) :
Prop
:=
forall y,
x =
Quot _ y ->
s y.
Definition LpRRVq_filter_to_LpRRV_filter (
F:((
LpRRVq prts p)->
Prop)->
Prop) : ((
LpRRV prts p)->
Prop)->
Prop
:= (
fun x:(
LpRRV prts p)->
Prop =>
F (
LpRRV_toLpRRVq_set x)).
Lemma LpRRVq_filter_to_LpRRV_filter_filter (
F:((
LpRRVq prts p)->
Prop)->
Prop)
(
FF:
Filter F) :
Filter (
LpRRVq_filter_to_LpRRV_filter F).
Proof.
destruct FF.
unfold LpRRVq_filter_to_LpRRV_filter,
LpRRV_toLpRRVq_set.
constructor;
intros.
-
eapply filter_imp;
try eapply filter_true;
intros.
destruct (
Quot_inv x);
subst.
eauto.
-
generalize (
filter_and _ _ H H0);
intros HH.
eapply filter_imp;
try eapply HH;
intros ? [??].
intros;
subst.
specialize (
H1 _ (
eq_refl _)).
specialize (
H2 _ (
eq_refl _)).
tauto.
-
eapply filter_imp;
try eapply H0;
simpl;
intros.
subst.
apply H.
now apply H1.
Qed.
Lemma LpRRVq_filter_to_LpRRV_filter_proper (
F:((
LpRRVq prts p)->
Prop)->
Prop)
(
PF:
ProperFilter F) :
ProperFilter (
LpRRVq_filter_to_LpRRV_filter F).
Proof.
Lemma rvpower2 (
x:
Ts->
R) {
posx:
NonnegativeFunction x} :
rv_eq (
rvpower x (
const 2)) (
rvsqr x).
Proof.
Lemma LpRRVq_filter_to_LpRRV_filter_cauchy
(
F : (
LpRRVq_UniformSpace prts p pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
@
cauchy (
LpRRV_UniformSpace prts pbig) (
LpRRVq_filter_to_LpRRV_filter F).
Proof.
Definition LpRRVq_lim_with_conditions2 (
F : (
LpRRVq_UniformSpace prts p pbig ->
Prop) ->
Prop)
(
PF:
ProperFilter F)
(
cF:
cauchy F) :
LpRRVq prts p.
Proof.
Definition LpRRVq_lim (
lim : ((
LpRRVq prts p ->
Prop) ->
Prop)) :
LpRRVq prts p.
Proof.
Lemma LpRRVq_lim_complete (
F : (
LpRRVq_UniformSpace prts p pbig ->
Prop) ->
Prop) :
ProperFilter F ->
cauchy F ->
forall eps :
posreal,
F (
LpRRVq_ball prts pbig (
LpRRVq_lim F)
eps).
Proof.
Lemma LpRRVq_lim_close (
F1 F2 : (
LpRRVq_UniformSpace prts p pbig ->
Prop) ->
Prop) :
filter_le F1 F2 ->
filter_le F2 F1 ->
@
close (
LpRRVq_UniformSpace prts p pbig) (
LpRRVq_lim F1) (
LpRRVq_lim F2).
Proof.
Definition LpRRVq_Complete_mixin :
CompleteSpace.mixin_of (
LpRRVq_UniformSpace prts p pbig)
:=
CompleteSpace.Mixin (
LpRRVq_UniformSpace prts p pbig)
LpRRVq_lim
LpRRVq_lim_complete
LpRRVq_lim_close.
Canonical LpRRVq_Complete :=
CompleteSpace.Pack (
LpRRVq prts p)
(
CompleteSpace.Class _ (
LpRRVq_UniformSpace_mixin prts pbig)
LpRRVq_Complete_mixin)
(
LpRRVq prts p).
Canonical LpRRVq_CompleteNormedModule :=
CompleteNormedModule.Pack R_AbsRing (
LpRRVq prts p)
(
CompleteNormedModule.Class
R_AbsRing (
LpRRVq prts p)
(
NormedModule.class R_AbsRing
(
LpRRVq_NormedModule prts p pbig))
LpRRVq_Complete_mixin)
(
LpRRVq prts p).
End complete2.
End complete.
Section more_Lp_props.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom).
Global Instance EventIndicator_islp (
p:
nonnegreal) {
P} (
dec :
dec_pre_event P) :
IsLp prts p (
EventIndicator dec).
Proof.
Lemma LpRRVnorm_minus_sym {
p:
nonnegreal} (
x y :
LpRRV prts p) :
LpRRVnorm prts (
LpRRVminus prts x y) =
LpRRVnorm prts (
LpRRVminus prts y x).
Proof.
Definition LpRRV_dist {
p:
nonnegreal} (
x y :
LpRRV prts p) :=
LpRRVnorm prts (
LpRRVminus prts x y).
Lemma LpRRV_norm_dist {
p:
nonnegreal} (
x y :
LpRRV prts p) :
LpRRV_dist x y =
LpRRVnorm prts (
LpRRVminus prts x y).
Proof.
easy.
Qed.
Lemma LpRRV_dist_comm {
p:
nonnegreal} (
x y :
LpRRV prts p) :
LpRRV_dist x y =
LpRRV_dist y x.
Proof.
Lemma LpRRV_dist_triang {
p:
R} (
pbig:1<=
p) (
x y z :
LpRRV prts p) :
LpRRV_dist (
p :=
bignneg _ pbig)
x z <=
LpRRV_dist (
p :=
bignneg _ pbig)
x y +
LpRRV_dist (
p :=
bignneg _ pbig)
y z.
Proof.
End more_Lp_props.
Section sa_sub.
Context {
Ts:
Type}
{
dom:
SigmaAlgebra Ts}
(
prts:
ProbSpace dom)
{
dom2 :
SigmaAlgebra Ts}
(
sub :
sa_sub dom2 dom).
Lemma IsLp_prob_space_sa_sub
p (
x:
Ts->
R)
{
rv:
RandomVariable dom2 borel_sa x} :
IsLp prts p x <->
IsLp (
prob_space_sa_sub prts sub)
p x.
Proof.
Definition LpRRV_sa_sub p
(
x:
LpRRV (
prob_space_sa_sub prts sub)
p) :
LpRRV prts p
:=
pack_LpRRV _ x
(
rv:=
RandomVariable_sa_sub sub x)
(
lp:=(
proj2 (
IsLp_prob_space_sa_sub p x))
_).
Definition LpRRV_sa_sub_f p
(
x:
LpRRV prts p)
{
rv:
RandomVariable dom2 borel_sa x}
:
LpRRV (
prob_space_sa_sub prts sub)
p
:=
pack_LpRRV _ x (
lp:=(
proj1 (
IsLp_prob_space_sa_sub p x))
_).
Lemma LpRRV_sa_sub_b_f p (
x:
LpRRV prts p)
{
rv:
RandomVariable dom2 borel_sa x} :
LpRRV_seq (
LpRRV_sa_sub p (
LpRRV_sa_sub_f p x))
x.
Proof.
intros ?.
now destruct x; simpl.
Qed.
Lemma LpRRV_sa_sub_f_b p (
x:
LpRRV (
prob_space_sa_sub prts sub)
p) :
LpRRV_seq (
LpRRV_sa_sub_f p (
LpRRV_sa_sub p x) (
rv:=
LpRRV_rv _ _))
x.
Proof.
intros ?.
now destruct x; simpl.
Qed.
End sa_sub.