-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathslln.v
More file actions
7346 lines (7073 loc) · 266 KB
/
slln.v
File metadata and controls
7346 lines (7073 loc) · 266 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Require Import Qreals.
Require Import Lra Lia Reals RealAdd RandomVariableL2 Coquelicot.Coquelicot.
Require Import Morphisms Finite List ListAdd Permutation infprod Almost NumberIso.
Require Import Sums SimpleExpectation PushNeg.
Require Import EquivDec.
Require Import Classical.
Require Import ClassicalChoice.
Require Import IndefiniteDescription ClassicalDescription.
Require QArith.
Require Import BorelSigmaAlgebra.
Require Import utils.Utils.
Require Import ConditionalExpectation.
Require Import Independence.
Require Import sumtest.
Require Import Dynkin.
Require Import Measures.
Set Bullet Behavior "Strict Subproofs".
Set Default Goal Selector "!".
Import ListNotations.
Section slln.
Lemma ash_6_1_1_a {x : nat -> R}{a : nat -> nat -> R} (ha : forall j, is_lim_seq (fun n => (a n j)) 0)
(hb1 : forall n, ex_series(fun j => Rabs(a n j)))
(hb2 : exists c, forall n, Series (fun j => Rabs (a n j)) < c)
(hx1 : bounded x) (hx2 : is_lim_seq x 0) :
let y := fun n => Series (fun j => (a n j)*(x j)) in is_lim_seq y 0.
Proof.
intros y. destruct hx1 as [M HMx].
destruct hb2 as [c Hc].
assert (hy1 : forall n j, Rabs (a n j * x j) <= M*Rabs(a n j))
by (intros ; rewrite Rabs_mult, Rmult_comm ;
apply Rmult_le_compat_r; auto; apply Rabs_pos).
assert (hy2 : forall n M, ex_series(fun j => M*Rabs(a n j)))
by (intros; now apply (ex_series_scal_l) with (a0 := fun j => Rabs(a n j))).
assert (hy3 : forall n, ex_series (fun j : nat => Rabs(a n j * x j))).
{
intros n.
apply (ex_series_le (fun j => Rabs (a n j * x j)) (fun j => M*Rabs(a n j))); trivial.
intros. rewrite Rabs_Rabsolu; auto.
}
assert (hy6 : forall n N, (0 < N)%nat -> Rabs(y n) <= sum_f_R0 (fun j => Rabs (a n j * x j)) (pred N)
+ Series (fun j => Rabs (a n (N + j)%nat * x (N +j)%nat)))
by (intros; unfold y; eapply Rle_trans; try (apply Series_Rabs; trivial);
right; apply Series_incr_n with (a := fun j => Rabs ( a n j * x j)); trivial).
rewrite is_lim_seq_Reals; unfold Un_cv, R_dist; simpl.
intros eps Heps.
setoid_rewrite Rminus_0_r.
assert (Hcc : c > 0).
{
specialize (Hc 0%nat). eapply Rle_lt_trans; try (apply Hc).
eapply Rle_trans; try (apply sum_f_R0_nonneg_le_Series; eauto).
+ apply sum_f_R0_Rabs_pos. Unshelve. exact 0%nat.
+ intros; apply Rabs_pos.
}
assert (hy7 : exists N, forall j, (j >= N)%nat -> Rabs(x j) < eps/(2*c)).
{
rewrite is_lim_seq_Reals in hx2.
assert (Heps' : eps/(2*c) > 0).
{
apply Rlt_gt. apply RIneq.Rdiv_lt_0_compat;lra.
}
specialize (hx2 (eps/(2*c)) Heps'). unfold R_dist in hx2.
setoid_rewrite Rminus_0_r in hx2. exact hx2.
}
assert (hy8 : forall N, is_lim_seq (fun n => sum_f_R0 (fun j => Rabs (a n j * x j)) N) 0).
{ intros N.
apply (is_lim_seq_le_le (fun _ => 0) _ (fun n => M*sum_f_R0 (fun j => Rabs(a n j)) N)).
- intros n.
split ; try (apply sum_f_R0_Rabs_pos).
rewrite <-sum_f_R0_mult_const.
apply sum_f_R0_le; intros.
rewrite Rmult_comm.
rewrite Rabs_mult.
apply Rmult_le_compat_r; auto; try (apply Rabs_pos).
- apply is_lim_seq_const.
- replace (0:Rbar) with (Rbar_mult M 0) by (apply Rbar_mult_0_r).
apply is_lim_seq_scal_l.
apply is_lim_seq_sum_f_R0; intros; auto.
replace 0 with (Rabs 0) by (apply Rabs_R0).
apply is_lim_seq_continuous; auto.
rewrite continuity_pt_filterlim; apply (continuous_Rabs 0).
}
setoid_rewrite is_lim_seq_Reals in hy8.
destruct hy7 as [N0 HN0].
assert (Heps' : eps/2 > 0) by (apply RIneq.Rdiv_lt_0_compat;lra).
specialize (hy8 (N0) (eps/2) Heps').
unfold R_dist in hy8. setoid_rewrite Rminus_0_r in hy8.
destruct hy8 as [N1 HN1].
exists N1; intros. specialize (hy6 n (N0 + 1)%nat).
eapply Rle_lt_trans; try (apply hy6).
** lia.
** replace (eps) with ((eps/2) + c*(eps/(2*c))) by (field;lra).
apply Rplus_le_lt_compat.
-- replace (Init.Nat.pred (N0 + 1)) with N0 by lia.
eapply Rle_trans; try (apply Rle_abs); left; eauto.
-- assert
(hy7 : Series (fun j => Rabs (a n (N0 + 1 + j)%nat * x(N0 + 1 + j)%nat))
<= Series(fun j => (eps/(2*c))*Rabs (a n (N0+1+j)%nat))).
{
apply Series_le; intros.
+ split; try (apply Rabs_pos).
rewrite Rabs_mult, Rmult_comm.
apply Rmult_le_compat_r; try(apply Rabs_pos).
left. apply HN0; lia.
+ apply (ex_series_scal_l) with (c0 := eps/(2*c))(a0 := fun j => Rabs(a n (N0+1+j)%nat)).
now rewrite <-(ex_series_incr_n) with (n0 := (N0 + 1)%nat)(a0:=fun j => Rabs (a n j)).
}
eapply Rle_lt_trans; eauto.
rewrite Series_scal_l. rewrite Rmult_comm.
apply Rmult_lt_compat_r; eauto; try(apply RIneq.Rdiv_lt_0_compat;lra).
generalize (Series_shift_le (fun n0 => Rabs_pos _) (hb1 n) (N0 + 1)); intros.
eapply Rle_lt_trans; eauto.
Qed.
Lemma ash_6_1_1_b {x : nat -> R}{a : nat -> nat -> R} (ha1 : forall j, is_lim_seq (fun n => (a n j)) 0)
(hb1 : forall n, ex_series(fun j => Rabs(a n j)))
(hb2 : exists c, forall n, Series (fun j => Rabs (a n j)) < c)
(hx1 : bounded x) (x0 : R) (hx2 : is_lim_seq x x0)
(ha2 : is_lim_seq (fun n => Series (fun j => a n j)) 1) :
let y := fun n => Series (fun j => (a n j)*(x j)) in is_lim_seq y x0.
Proof.
intros y. unfold y.
destruct hx1 as [M HM].
assert (hy1 : forall n j, Rabs (a n j * x j) <= M*Rabs(a n j))
by (intros ; rewrite Rabs_mult, Rmult_comm ;
apply Rmult_le_compat_r; auto; apply Rabs_pos).
assert (hy2 : forall n M, ex_series(fun j => M*Rabs(a n j)))
by (intros; now apply (ex_series_scal_l) with (a0 := fun j => Rabs(a n j))).
assert (hy3 : forall n, ex_series (fun j : nat => Rabs(a n j * x j))).
{
intros n.
apply (ex_series_le (fun j => Rabs (a n j * x j)) (fun j => M*Rabs(a n j))); trivial.
intros. rewrite Rabs_Rabsolu; auto.
}
assert (hxx : is_lim_seq (fun j => x j - x0) 0).
{
replace 0 with (x0 - x0) by lra.
apply is_lim_seq_minus'; auto.
apply is_lim_seq_const.
}
generalize (ash_6_1_1_a ha1 hb1 hb2 (is_lim_seq_bounded _ 0 hxx) hxx); intros.
unfold y in H.
setoid_rewrite Rmult_minus_distr_l in H.
apply is_lim_seq_ext with (v := fun n => Series(fun j => a n j * x j) - Series(fun j => a n j * x0)) in H.
+ setoid_rewrite Series_scal_r in H.
apply is_lim_seq_plus with (l := x0) (l1 := x0) (u := fun n => Series (a n)*x0) in H.
-- setoid_rewrite Rplus_comm in H.
setoid_rewrite Rplus_assoc in H.
setoid_rewrite Rplus_opp_l in H.
now setoid_rewrite Rplus_0_r in H.
-- generalize (is_lim_seq_scal_r _ x0 _ ha2); intros.
simpl in H0. now rewrite Rmult_1_l in H0.
-- unfold is_Rbar_plus.
simpl. f_equal. rewrite Rbar_finite_eq.
lra.
+ intros n.
apply Series_minus.
** now apply ex_series_Rabs.
** apply ex_series_scal_r. now apply ex_series_Rabs.
Qed.
(* Toeplitz lemma. *)
Lemma ash_6_1_2 {a x : nat -> R} {x0 : R}(ha : forall n, 0 <= a n)
(hb1 : forall n, 0 < sum_f_R0 a n)(hb2 : is_lim_seq (sum_f_R0 a) p_infty) (hx : is_lim_seq x x0):
is_lim_seq (fun n => (sum_f_R0 (fun j => a j * x j) n)/(sum_f_R0 a n)) x0.
Proof.
pose (A := fun (n j : nat) => if (le_dec j n) then (a j)/(sum_f_R0 a n) else 0).
assert (Apos: forall n j, 0 <= A n j).
{
intros.
unfold A.
match_destr; [|lra].
unfold Rdiv.
apply Rmult_le_pos; trivial.
left.
now apply Rinv_0_lt_compat.
}
assert (Aser: forall n, is_series (fun j => A n j) 1).
{
intros.
unfold A.
rewrite <-series_is_lim_seq.
apply is_lim_seq_ext_loc with (u := fun n => 1); [|apply is_lim_seq_const].
exists n.
intros.
rewrite <- sum_n_sum_f_clipped with (N := n); try lia.
rewrite sum_n_Reals.
unfold Rdiv.
rewrite <- scal_sum.
apply Rinv_l_sym.
apply Rgt_not_eq.
apply hb1.
}
apply is_lim_seq_ext with
(u := fun n => Series (fun j => (A n j) * x j)).
- intros.
unfold Series.
unfold A.
rewrite Lim_seq_ext_loc with
(v := fun _ => sum_f_R0 (fun j : nat => a j * x j) n / sum_f_R0 a n).
+ now rewrite Lim_seq_const.
+ exists n; intros.
rewrite sum_n_ext with
(b := (fun j : nat => (if le_dec j n then (((a j)*(x j)) / sum_f_R0 a n) else 0))).
* rewrite <- sum_n_sum_f_clipped with (N := n); try lia.
rewrite sum_n_Reals.
unfold Rdiv.
rewrite <- scal_sum.
now rewrite Rmult_comm at 1.
* intros.
match_destr; lra.
- apply ash_6_1_1_b; trivial.
+ intros.
unfold A.
apply is_lim_seq_ext_loc with (u := fun n => a j / sum_f_R0 a n).
* exists j.
intros.
match_destr; tauto.
* apply is_lim_seq_div with (l1 := a j) (l2 := p_infty); trivial.
-- apply is_lim_seq_const.
-- discriminate.
-- unfold is_Rbar_div; simpl.
unfold is_Rbar_mult; simpl.
now rewrite Rmult_0_r.
+ intros.
apply ex_series_ext with (a0 := fun j => A n j).
* intros.
rewrite Rabs_right; trivial.
specialize (Apos n n0); lra.
* now exists 1.
+ exists 2.
intros.
specialize (Aser n).
apply is_series_unique in Aser.
rewrite Series_ext with (b := (fun j => A n j)); [rewrite Aser;lra|].
intros.
rewrite Rabs_right; trivial.
specialize (Apos n n0); lra.
+ now apply is_lim_seq_bounded with (c := x0).
+ apply is_lim_seq_ext with ( u := fun n => 1); [|apply is_lim_seq_const].
intros.
specialize (Aser n).
apply is_series_unique in Aser; now symmetry.
Qed.
(* Kronecker Lemma *)
Lemma ash_6_1_3 {b x : nat -> R} (hb0: b (0%nat) = 0) (hb1 : forall n, 0 < b (S n) <= b (S (S n))) (hb2 : is_lim_seq b p_infty)
(hx : ex_series x):
is_lim_seq (fun n => (sum_f_R0 (fun j => b j * x j) (S n))/(b (S n))) 0.
Proof.
pose (s := sum_f_R0 x).
assert (forall n, sum_f_R0 (fun j => b j * x j) (S n) =
(b (S n))*(s (S n)) - sum_f_R0 (fun j => (s j) * ((b (S j)) - (b j))) n).
{
intros.
induction n.
- unfold s; simpl.
ring_simplify; lra.
- replace (S (S n)) with (S (n+1)) by lia.
simpl.
replace (n+1)%nat with (S n) by lia.
rewrite IHn.
apply Rplus_eq_reg_r with (r := sum_f_R0 (fun j : nat => s j * (b (S j) - b j)) n).
ring_simplify.
apply Rplus_eq_reg_r with (r := - (b (S n) * s (S n))).
ring_simplify.
unfold s.
replace (S n) with (n+1)%nat by lia.
simpl.
now ring_simplify.
}
assert (forall n, b (S n) <> 0).
{
intros.
apply Rgt_not_eq.
apply hb1.
}
assert (forall n,
(s (S n)) - (sum_f_R0 (fun j : nat => s j * (b (S j) - b j)) n)/(b (S n)) =
(sum_f_R0 (fun j : nat => b j * x j) (S n))/(b (S n))).
{
intros.
symmetry.
unfold Rdiv.
replace (s (S n)) with ((b (S n) * s (S n)) * / b (S n)).
- rewrite <- Rmult_minus_distr_r.
now apply Rmult_eq_compat_r.
- now field_simplify.
}
assert (bser: forall n, b (S n) - b (0%nat) = sum_f_R0 (fun j : nat => b (S j) - b j) n).
{
induction n.
- now simpl.
- simpl.
rewrite <- IHn.
lra.
}
destruct hx.
apply (is_lim_seq_ext _ _ _ H1).
rewrite <- series_is_lim_seq in H2.
apply is_lim_seq_ext with (v := s) in H2.
- apply is_lim_seq_minus with (l1 := x0) (l2 := x0).
+ now rewrite is_lim_seq_incr_1 in H2.
+ generalize (@ash_6_1_2 (fun j => b (S j) - b j) s x0); intros.
cut_to H3; trivial.
* eapply (is_lim_seq_ext _ _ x0 _ H3).
* intros.
destruct (lt_dec 0 n).
-- specialize (hb1 (n-1)%nat).
replace (S (n-1)) with (n) in hb1 by lia.
lra.
-- assert (n = 0%nat) by lia.
rewrite H4.
rewrite hb0.
rewrite Rminus_0_r.
left; apply hb1.
* intros.
induction n.
-- simpl.
specialize (hb1 0%nat).
lra.
-- rewrite sum_f_R0_peel.
eapply Rlt_le_trans.
++ apply IHn.
++ assert (b (S (S n)) - b (S n) >= 0).
** specialize (hb1 n); lra.
** lra.
* apply (is_lim_seq_ext _ _ _ bser).
apply is_lim_seq_minus with (l1 := p_infty) (l2 := b (0%nat)).
-- now apply is_lim_seq_incr_1 in hb2.
-- apply is_lim_seq_const.
-- red; simpl.
now red; simpl.
+ red; simpl.
red; simpl.
now rewrite Rplus_opp_r.
- unfold s.
intros.
now rewrite sum_n_Reals.
Unshelve.
intros.
simpl.
specialize (bser n).
rewrite <- bser.
rewrite hb0.
rewrite Rminus_0_r.
f_equal.
apply sum_f_R0_ext.
intros.
now rewrite Rmult_comm.
Qed.
Lemma sum_n_zeroval (f : nat -> R) (n:nat) :
f 0%nat = 0 ->
sum_n_m f 0%nat n = sum_n_m f 1%nat n.
Proof.
intros.
induction n.
- rewrite sum_n_n.
rewrite H.
rewrite sum_n_m_zero; try lia.
reflexivity.
- rewrite sum_n_Sm; try lia.
rewrite sum_n_Sm; try lia.
unfold plus; simpl.
now rewrite IHn.
Qed.
Lemma ash_6_1_3_strong1 {b x : nat -> R} (hb1 : forall n, 0 < b n <= b (S n)) (hb2 : is_lim_seq b p_infty)
(hx : ex_series x):
is_lim_seq (fun n => (sum_n_m (fun j => b j * x j) 1 n)/(b n)) 0.
Proof.
pose (bb := fun n => if (lt_dec 0 n) then (b n) else 0).
generalize (@ash_6_1_3 bb x); intros.
cut_to H; trivial.
- apply is_lim_seq_ext with (v := fun n => sum_n_m (fun j => b j * x j) 1 (S n) / (b (S n))) in H.
+ apply is_lim_seq_incr_1.
apply H.
+ intros.
rewrite <- sum_n_Reals.
unfold sum_n.
replace (bb (S n)) with (b (S n)).
* f_equal.
rewrite sum_n_zeroval.
-- rewrite sum_n_m_ext_loc with (b0 := (fun j : nat => b j * x j)); [easy | ].
intros.
unfold bb.
match_destr.
lia.
-- unfold bb.
simpl.
lra.
* unfold bb.
match_destr.
lia.
- unfold bb.
now simpl.
- unfold bb.
apply is_lim_seq_incr_1.
apply is_lim_seq_ext with (u := (fun n => b (S n))).
+ intros.
match_destr.
lia.
+ now apply is_lim_seq_incr_1 in hb2.
Qed.
Lemma ash_6_1_3_strong {b x : nat -> R} (hb1 : forall n, 0 < b n <= b (S n)) (hb2 : is_lim_seq b p_infty)
(hx : ex_series x):
is_lim_seq (fun n => (sum_n (fun j => b j * x j) n)/(b n)) 0.
Proof.
apply is_lim_seq_incr_1.
apply is_lim_seq_ext with (u := fun n => ((b 0%nat)*(x 0%nat) + sum_n_m (fun j : nat => b j * x j) 1 (S n))/(b (S n))).
- intros.
f_equal.
- apply is_lim_seq_ext with (u := fun n => (b 0%nat)*(x 0%nat)/(b (S n)) + (sum_n_m (fun j : nat => b j * x j) 1 (S n))/(b (S n))).
+ intros.
field.
apply Rgt_not_eq.
apply (hb1 (S n)).
+ apply is_lim_seq_plus with (l1 := 0) (l2 := 0).
* unfold Rdiv.
replace (Rbar.Finite 0) with (Rbar_mult (Rmult (b 0%nat) (x 0%nat)) 0).
-- apply is_lim_seq_scal_l.
replace (Rbar.Finite 0) with (Rbar_inv p_infty).
++ apply is_lim_seq_inv.
** now apply is_lim_seq_incr_1 in hb2.
** discriminate.
++ now simpl.
-- now rewrite Rbar_mult_0_r.
* generalize (ash_6_1_3_strong1 hb1 hb2 hx); intros.
now apply is_lim_seq_incr_1 in H.
* red; simpl.
f_equal.
now rewrite Rplus_0_r.
Qed.
Context {Ts:Type} {dom: SigmaAlgebra Ts}{Prts: ProbSpace dom}.
Fixpoint filtration_history (n : nat) (X : nat -> Ts -> R)
{frf : forall n, FiniteRangeFunction (X n)}
{rv : forall n, RandomVariable dom borel_sa (X n)}
: list dec_sa_event :=
match n with
| 0%nat => [dsa_Ω]
| S k => refine_dec_sa_partitions (induced_sigma_generators (frf k)) (filtration_history k X)
end.
Lemma rvmult_zero (f : Ts -> R) :
rv_eq (rvmult f (const 0)) (const 0).
Proof.
intro x.
unfold rvmult, const.
lra.
Qed.
Lemma part_list_history (n : nat) (X : nat -> Ts -> R)
{frf : forall n, FiniteRangeFunction (X n)}
{rv : forall n, RandomVariable dom borel_sa (X n)} :
is_partition_list (map dsa_event (filtration_history n X)).
Proof.
induction n.
- simpl.
unfold is_partition_list.
split.
+ apply FOP_cons.
* apply Forall_nil.
* apply FOP_nil.
+ apply list_union_singleton.
- simpl.
apply is_partition_refine.
+ apply induced_gen_ispart.
+ apply IHn.
Qed.
Lemma part_meas_induced (f : Ts -> R)
{frf : FiniteRangeFunction f}
{rv : RandomVariable dom borel_sa f} :
partition_measurable f (map dsa_event (induced_sigma_generators frf)).
Proof.
unfold partition_measurable, induced_sigma_generators.
intros.
rewrite in_map_iff in H0.
destruct H0 as [? [? ?]].
rewrite in_map_iff in H1.
destruct H1 as [? [? ?]].
rewrite <- H1 in H0; simpl in H0.
destruct frf.
exists x0.
rewrite H0.
easy.
Qed.
Global Instance partition_measurable_perm (f : Ts -> R)
{frf : FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
Proper (@Permutation _ ==> iff) (partition_measurable f).
Proof.
cut (Proper (Permutation (A:=event dom) ==> impl) (partition_measurable f)).
{
unfold Proper, respectful, impl; intros HH x y perm.
split; intros.
- eauto.
- symmetry in perm.
eauto.
}
unfold partition_measurable.
unfold Proper, respectful, impl; intros x y perm HH isp e ein.
rewrite <- perm in isp.
rewrite <- perm in ein.
now apply HH.
Qed.
Instance partition_measurable_event_equiv (f : Ts -> R)
{frf : FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
Proper (Forall2 event_equiv ==> iff) (partition_measurable f).
Proof.
cut (Proper (Forall2 event_equiv ==> impl) (partition_measurable f)).
{
unfold Proper, respectful, impl; intros HH x y perm.
split; intros.
- eauto.
- symmetry in perm.
eauto.
}
unfold partition_measurable, impl.
intros x y F2 HH isp p inp.
rewrite <- F2 in isp.
destruct (Forall2_In_r F2 inp) as [p' [??]].
destruct (HH isp p') as [c csub]; trivial.
exists c.
now rewrite <- H0.
Qed.
Lemma part_meas_refine_commute
(f : Ts -> R)
(l1 l2 : list dec_sa_event)
{frf : FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
partition_measurable f (map dsa_event
(refine_dec_sa_partitions l1 l2)) <->
partition_measurable f (map dsa_event
(refine_dec_sa_partitions l2 l1)).
Proof.
destruct (refine_dec_sa_partitions_symm l1 l2) as [l' [perm F2]].
transitivity (partition_measurable f (map dsa_event l')).
- apply partition_measurable_perm.
now apply Permutation_map.
- apply partition_measurable_event_equiv.
apply Forall2_map_f.
apply F2.
Qed.
Lemma part_meas_refine_l (f : Ts -> R)
(l1 l2 : list dec_sa_event)
{frf : FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
(is_partition_list (map dsa_event l1)) ->
(is_partition_list (map dsa_event l2)) ->
(partition_measurable f (map dsa_event l1)) ->
partition_measurable f (map dsa_event
(refine_dec_sa_partitions l1 l2)).
Proof.
intros ispartl1 ispartl2; intros.
unfold partition_measurable, refine_dec_sa_partitions.
intros.
rewrite in_map_iff in H1.
destruct H1 as [? [? ?]].
rewrite flat_map_concat_map in H2.
rewrite concat_In in H2.
destruct H2 as [? [? ?]].
rewrite in_map_iff in H2.
destruct H2 as [? [? ?]].
unfold partition_measurable in H.
destruct frf.
rewrite <- H2 in H3.
cut_to H; trivial.
specialize (H (dsa_event x1)).
cut_to H.
- destruct H as [? ?].
exists x2.
unfold refine_dec_sa_event in H3.
rewrite in_map_iff in H3.
destruct H3 as [? [? ?]].
rewrite <- H1.
transitivity (dsa_event x1); trivial.
rewrite <- H3.
simpl.
apply Event.event_inter_sub_l.
- now apply in_map.
Qed.
Lemma part_meas_refine (f : Ts -> R)
(l1 l2 : list dec_sa_event)
{frf : FiniteRangeFunction f}
{rvf : RandomVariable dom borel_sa f} :
(is_partition_list (map dsa_event l1)) ->
(is_partition_list (map dsa_event l2)) ->
(partition_measurable f (map dsa_event l1)) \/
(partition_measurable f (map dsa_event l2)) ->
partition_measurable f (map dsa_event
(refine_dec_sa_partitions l1 l2)).
Proof.
intros.
destruct H1.
- now apply part_meas_refine_l.
- rewrite part_meas_refine_commute.
now apply part_meas_refine_l.
Qed.
Lemma part_meas_hist (j k : nat) (X : nat -> Ts -> R)
{frf : forall n, FiniteRangeFunction (X n)}
{rv : forall n, RandomVariable dom borel_sa (X n)} :
partition_measurable (X j) (map dsa_event (filtration_history ((S j) + k)%nat X)).
Proof.
induction k.
- replace (S j + 0)%nat with (S j) by lia.
simpl.
apply part_meas_refine.
+ apply induced_gen_ispart.
+ apply part_list_history.
+ left.
apply part_meas_induced.
- replace (S j + S k)%nat with (S (S j + k))%nat by lia.
simpl.
apply part_meas_refine.
+ apply induced_gen_ispart.
+ apply is_partition_refine.
* apply induced_gen_ispart.
* apply part_list_history.
+ right.
apply IHk.
Qed.
Instance filtration_sa_le_rv {Td:Type} {cod : SigmaAlgebra Td}
{F : nat -> SigmaAlgebra Ts} (X : nat -> Ts -> Td)
(isfilt: IsFiltration F)
{rv : forall (n:nat), RandomVariable (F n) cod (X n)}
(n : nat) (j:nat) (jlt: (j <= n)%nat) :
RandomVariable (F n) cod (X j).
Proof.
eapply (RandomVariable_proper_le (F j))
; try reflexivity; trivial.
unfold filtration_history_sa.
apply is_filtration_le; trivial.
Qed.
Existing Instance isfe_l2_prod.
Existing Instance isfe_sqr_seq.
Lemma expec_cross_zero_filter (X : nat -> Ts -> R)
{F : nat -> SigmaAlgebra Ts}
(isfilt : IsFiltration F)
(filt_sub : forall n, sa_sub (F n) dom)
{adapt : IsAdapted borel_sa X F}
{rv : forall (n:nat), RandomVariable dom borel_sa (X n)}
{frf2 : forall (k:nat), IsFiniteExpectation Prts (rvsqr (X k))}
(HC : forall n,
almostR2 Prts eq
(ConditionalExpectation Prts (filt_sub n) (X (S n)))
(const 0)) :
forall (j k : nat),
(j < k)%nat ->
FiniteExpectation Prts (rvmult (X j) (X k)) = 0.
Proof.
intros j k jltk.
destruct k; try lia.
eapply FiniteCondexp_factor_out_zero_swapped with (sub := filt_sub k).
- apply filtration_sa_le_rv; trivial.
lia.
- specialize (HC k).
erewrite (FiniteCondexp_eq _ ) in HC.
apply (almost_f_equal _ real) in HC.
apply HC.
Unshelve.
now apply IsFiniteExpectation_rvsqr_lower.
Qed.
Lemma expec_cross_zero_sum_shift_filter (X : nat -> Ts -> R) (m:nat)
{F : nat -> SigmaAlgebra Ts}
(isfilt: IsFiltration F)
(filt_sub : forall n, sa_sub (F n) dom)
{adapt : IsAdapted borel_sa X F}
{rv : forall (n:nat), RandomVariable dom borel_sa (X n)}
{frf2 : forall (k:nat), IsFiniteExpectation Prts (rvsqr (X k))}
(HC : forall n,
almostR2 Prts eq
(ConditionalExpectation Prts (filt_sub n) (X (S n)))
(const 0)) :
forall (j k : nat),
(j < k)%nat ->
FiniteExpectation Prts (rvsum (fun n => rvmult (X (n+m)%nat) (X (k+m)%nat)) j) = 0.
Proof.
intros.
rewrite <- sum_expectation.
rewrite sum_n_ext_loc with (b := fun _ => 0).
- rewrite sum_n_const.
lra.
- intros.
apply expec_cross_zero_filter with (filt_sub := filt_sub) (rv := rv); trivial.
lia.
Qed.
Lemma expec_cross_zero_sum2_shift_filter (X : nat -> Ts -> R) (m : nat)
{F : nat -> SigmaAlgebra Ts}
(isfilt: IsFiltration F)
(filt_sub : forall n, sa_sub (F n) dom)
{adapt : IsAdapted borel_sa X F}
{rv : forall (n:nat), RandomVariable dom borel_sa (X n)}
{isfe2 : forall (k:nat), IsFiniteExpectation Prts (rvsqr (X k))}
{isfe_mult_sum: forall (k j:nat),
IsFiniteExpectation Prts (rvmult (rvsum (fun n : nat => X (n + m)%nat) j)
(X (k + m)%nat))}
(HC : forall n,
almostR2 Prts eq
(ConditionalExpectation Prts (filt_sub n) (X (S n)))
(const 0)) :
forall (j k : nat),
(j < k)%nat ->
FiniteExpectation Prts (rvmult (rvsum (fun n => X (n + m)%nat) j) (X (k+m)%nat)) = 0.
Proof.
intros.
generalize (expec_cross_zero_sum_shift_filter X m _ filt_sub HC j k H); intros.
rewrite <- H0.
apply FiniteExpectation_ext.
symmetry.
rewrite <- rvsum_distr_r.
intros ?.
unfold rvsum.
apply sum_n_ext.
intros.
now rewrite rvmult_comm.
Qed.
(* Few properties about cutoff sequences. Move to RealAdd. *)
Fixpoint cutoff_eps (n : nat) (eps : R) (X : nat -> R) :=
match n with
| 0%nat => X 0%nat
| S k => if (Rlt_dec (Rmax_list_map (seq 0 (S k)) (fun n => Rabs(X n))) eps) then X (S k)
else (cutoff_eps k eps X)
end.
Lemma cutoff_eps_lt_eps eps n (X : nat -> R) :
(forall k, (k <= n)%nat -> Rabs (X k) < eps) -> (cutoff_eps n eps X = X n).
Proof.
intros H.
induction n.
+ now simpl.
+ simpl.
match_destr.
assert (H1 : Rmax_list_map (seq 0 (S n)) (fun n => Rabs(X n)) < eps).
{
unfold Rmax_list_map.
rewrite Rmax_list_lt_iff; try (apply map_not_nil; apply seq_not_nil; lia).
intros.
rewrite in_map_iff in H0.
destruct H0 as [x0 [Hx0 Hx1]].
subst; auto. apply H.
rewrite in_seq in Hx1. destruct Hx1.
intuition.
}
exfalso; firstorder.
Qed.
Lemma cutoff_eps_ge_eps eps (X : nat -> R) :
(forall k:nat, eps <= Rabs(X k)) -> (forall n, cutoff_eps n eps X = X 0%nat).
Proof.
intros H n.
simpl.
induction n.
++ now simpl in H.
++ simpl. match_destr.
assert (Rabs(X n) <= Rmax_list_map (0%nat :: seq 1 n) (fun n => Rabs(X n))).
{
unfold Rmax_list_map.
apply Rmax_spec.
rewrite in_map_iff.
exists n; split; trivial.
replace (0%nat :: seq 1 (n)) with (seq 0%nat (S n)) by (now simpl).
rewrite in_seq; lia.
}
specialize (H n).
lra.
Qed.
Lemma ne_le_succ {k n : nat} (hk1 : k <> S n) (hk2 : (k <= S n)%nat) : (k <= n)%nat.
Proof.
lia.
Qed.
Lemma cutoff_ge_eps_exists (n : nat) (eps : R) ( X : nat -> R ):
(eps <= Rabs(cutoff_eps n eps X)) -> exists k, (k <= n)%nat /\ eps <= Rabs(X k).
Proof.
intros Hn.
induction n.
-- simpl in Hn. exists 0%nat.
split; trivial.
-- simpl in Hn.
match_destr_in Hn.
++ exists (S n). split; trivial; lra.
++ apply Rnot_lt_ge in n0.
specialize (IHn Hn).
destruct IHn as [k Hk].
exists k. destruct Hk. split; trivial.
etransitivity; eauto; lia.
Qed.
Lemma cutoff_ge_eps_exists_contrapose (n : nat) (eps : R) (X : nat -> R):
(Rabs(cutoff_eps n eps X) < eps) -> (forall k, (k <= n)%nat -> Rabs(X k) < eps).
Proof.
intros Heps.
induction n.
+ simpl in Heps. intros.
assert (k = 0%nat) by lia; subst; trivial.
+ simpl in Heps.
match_destr_in Heps.
++ intros. destruct (k == S n).
-- now rewrite e.
-- apply IHn; try(apply ne_le_succ; eauto).
unfold Rmax_list_map in r.
replace (0%nat :: seq 1 n) with (seq 0%nat (S n)) in r by (now simpl).
rewrite Rmax_list_lt_iff in r; try (apply map_not_nil; apply seq_not_nil; lia).
rewrite cutoff_eps_lt_eps; intros; try (apply r; rewrite in_map_iff).
** exists n; split; trivial. rewrite in_seq; lia.
** exists k0; split; trivial. rewrite in_seq; lia.
++ intros. specialize (IHn Heps).
apply Rnot_lt_ge in n0.
replace (0%nat :: seq 1 n) with (seq 0%nat (S n)) in n0 by (now simpl).
unfold Rmax_list_map in n0.
assert ((0 < S n)%nat) by lia.
apply Rge_le in n0.
rewrite (Rmax_list_map_seq_ge eps (fun n => Rabs (X n)) H0) in n0.
destruct n0 as [k1 [Hk1 Heps1]].
assert (k1 <= n)%nat by lia.
specialize (IHn k1 H1).
exfalso; lra.
Qed.
Lemma cutoff_ge_eps_exists_iff (n : nat) (eps : R) (X : nat -> R):
(eps <= Rabs(cutoff_eps n eps X)) <-> exists k, (k <= n)%nat /\ eps <= Rabs(X k).
Proof.
split.
+ apply cutoff_ge_eps_exists.
+ intro H. apply ROrderedType.ROrder.not_gt_le.
revert H. apply ssrbool.contraPnot.
intro H. generalize (cutoff_ge_eps_exists_contrapose n eps X H); intros.
apply Classical_Pred_Type.all_not_not_ex.
intros k. specialize (H0 k).
apply Classical_Prop.or_not_and.
apply Classical_Prop.imply_to_or; intros.
specialize (H0 H1). apply Rgt_not_le; trivial.
Qed.
Lemma cutoff_ge_eps_Rmax_list_iff (n : nat) (eps : R) (X : nat -> R):
(eps <= Rabs(cutoff_eps n eps X)) <-> eps <= Rmax_list_map (seq 0 (S n)) (fun n => Rabs (X n)).
Proof.
assert (Hn : (0 < S n)%nat) by lia.
rewrite (Rmax_list_map_seq_ge eps (fun n => Rabs (X n)) Hn).
rewrite cutoff_ge_eps_exists_iff.
split; intros; destruct H as [x [Hx1 Hx2]]; exists x; split; trivial; lia.
Qed.
Definition cutoff_eps_rv (n : nat) (eps : R) (X : nat -> Ts -> R) :=
fun omega => cutoff_eps n eps (fun k => X k omega).
Lemma rvmaxlist_ge (X : nat -> Ts -> R): forall n omega, X n omega <= rvmaxlist X n omega.
Proof.
intros.
unfold rvmaxlist.
apply Rmax_spec.
rewrite in_map_iff.
exists n; split; trivial.
rewrite in_seq; lia.
Qed.
Lemma cutoff_eps_rv_lt_eps eps (X : nat -> Ts -> R) : forall omega,
(forall k, Rabs(X k omega) < eps) -> (forall n, cutoff_eps_rv n eps X omega = X n omega).
Proof.
intros omega H n.
unfold cutoff_eps_rv.
now apply cutoff_eps_lt_eps.
Qed.
Lemma cutoff_eps_rv_ge_eps eps (X : nat -> Ts -> R) : forall omega,
(forall k:nat, eps <= Rabs(X k omega)) -> (forall n, cutoff_eps_rv n eps X omega = X 0%nat omega).
Proof.
intros omega H n.
unfold cutoff_eps_rv.
now apply cutoff_eps_ge_eps.
Qed.
Lemma cutoff_ge_eps_rv_rvmaxlist_iff (n : nat) (eps : R) (X : nat -> Ts -> R): forall omega,
eps <= Rabs(cutoff_eps_rv n eps X omega) <->
eps <= rvmaxlist (fun k => fun omega => Rabs (X k omega)) n omega.
Proof.
intros omega.
unfold rvmaxlist, cutoff_eps_rv.
now rewrite cutoff_ge_eps_Rmax_list_iff.
Qed.
Global Instance rv_cutoff_eps_rv (n : nat) (eps : R) (X : nat -> Ts -> R)
{rv: forall k, (k <= n)%nat -> RandomVariable dom borel_sa (X k)} :
RandomVariable dom borel_sa (cutoff_eps_rv n eps X).
Proof.
unfold cutoff_eps_rv.
apply measurable_rv.
assert (mrv : forall k, (k <= n)%nat -> RealMeasurable dom (X k)).
{
intros.
apply rv_measurable.
apply rv; lia.
}
unfold RealMeasurable in *.
intros.
induction n.
- simpl; apply mrv; lia.
- simpl.
assert (pre_event_equiv
(fun omega : Ts =>
(if Rlt_dec (Rmax_list_map (0%nat :: seq 1 n)
(fun k : nat => Rabs (X k omega))) eps
then X (S n) omega
else cutoff_eps n eps (fun k : nat => X k omega)) <= r)
(pre_event_union
(pre_event_inter
(fun omega => Rmax_list_map (0%nat :: seq 1 n) (fun k : nat => Rabs (X k omega)) < eps)
(fun omega => X (S n) omega <= r))
(pre_event_inter
(pre_event_complement
(fun omega => Rmax_list_map (0%nat :: seq 1 n) (fun k : nat => Rabs (X k omega)) < eps))
(fun omega => cutoff_eps n eps (fun k : nat => X k omega) <= r)))).
{
intro x; unfold pre_event_union, pre_event_inter, pre_event_complement.
match_destr; lra.
}
rewrite H.
apply sa_union.
+ apply sa_inter.
* apply sa_le_lt.
apply max_list_measurable.
intros.
apply Rabs_measurable.
unfold RealMeasurable.
apply mrv; lia.
* apply mrv; lia.
+ apply sa_inter.
* apply sa_complement.
apply sa_le_lt.
apply max_list_measurable.
intros.
apply Rabs_measurable.
unfold RealMeasurable.
apply mrv; lia.
* apply IHn.
-- intros.
apply rv; lia.
-- intros.
apply mrv; lia.
Qed.
Global Instance nnf_cutoff_eps_rv (n : nat) (eps : R) (X : nat -> Ts -> R)
{nnf: forall n, NonnegativeFunction (X n)} :
NonnegativeFunction (cutoff_eps_rv n eps X).
Proof.
unfold cutoff_eps_rv.
induction n.
- now simpl.
- simpl.
intro x.
specialize (IHn x).
simpl in IHn.
match_destr.
apply nnf.
Qed.
Lemma cutoff_eps_values (n : nat) (eps : R) (X : nat -> Ts -> R) :
forall (x:Ts),
exists (k : nat),
(k <= n)%nat /\
cutoff_eps_rv n eps X x = X k x.
Proof.
intros.
unfold cutoff_eps_rv.
induction n.
- exists (0%nat); simpl.
now split; try lia.
- simpl.
match_destr.
+ exists (S n).
now split; try lia.
+ destruct IHn as [k [? ?]].