-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjacobi_iteration_bound.v
7248 lines (7075 loc) · 294 KB
/
jacobi_iteration_bound.v
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
From vcfloat Require Import RAux FPStdLib.
From mathcomp Require Import all_ssreflect ssralg ssrnat all_algebra seq matrix .
From mathcomp Require Import Rstruct.
Require Import fma_is_finite dotprod_model.
Require Import floatlib jacob_list_fun_model.
Require Import fma_real_func_model fma_floating_point_model.
Require Import inf_norm_properties common.
Require Import norm_compat.
Require Import Coq.Lists.List. Import ListNotations.
Set Bullet Behavior "Strict Subproofs".
Require Import lemmas.
Require Import fma_dot_acc fma_matrix_vec_mult.
From Flocq Require Import Binary.
Require Import finite_lemmas_additional.
Require Import fma_jacobi_forward_error.
Require Import float_acc_lems.
Require Import vec_sum_inf_norm_rel.
Require Import fma_dot_mat_model.
Require Import jacobi_preconditions.
Require Import bound_on_x.
Require Import diag_invertibility.
Section WITH_NANS.
Context {NANS: FPCore.Nans}.
Lemma matrix_vec_norm_A1_diag_mult_A {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
(vec_inf_norm (A1_diag (FT2R_mat A)) *
matrix_inf_norm
(A2_J_real (FT2R_mat A)) <=
(vec_inf_norm (FT2R_mat (A1_inv_J A)) +
default_abs t) / (1 - default_rel t) *
matrix_inf_norm (FT2R_mat (A2_J A)))%Re.
Proof.
apply Rmult_le_compat.
+ apply /RleP. apply vec_norm_pd.
+ apply /RleP. apply matrix_norm_pd.
+ by apply vec_norm_A1_rel .
+ apply matrix_norm_A2_rel.
Qed.
(** relation between the non-computable and computable rho **)
Lemma rho_def_le_alt {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
(rho_def A b <= rho_def_alt A b)%Re.
Proof.
unfold rho_def, rho_def_alt.
apply Rplus_le_compat.
+ apply Rplus_le_compat.
- apply Rmult_le_compat_l.
* repeat apply Rplus_le_le_0_compat; last by apply default_rel_ge_0.
repeat apply Rmult_le_pos.
++ apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos;last by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
* by apply matrix_vec_norm_A1_diag_mult_A.
- apply Rmult_le_compat_l.
* repeat apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos.
++ apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos;last by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ apply default_abs_ge_0.
* apply matrix_norm_A2_rel.
+ by apply matrix_vec_norm_A1_diag_mult_A.
Qed.
Lemma rho_1_implies_rho_2 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1):
let rho_hat := rho_def_alt A b in
(rho_hat < 1)%Re ->
(((vec_inf_norm (FT2R_mat (A1_inv_J A)) + default_abs t) / (1 - default_rel t)) *
matrix_inf_norm
(FT2R_mat (A2_J A)) < 1)%Re.
Proof.
intros. eapply Rle_lt_trans; last by apply H.
unfold rho_hat,rho_def_alt.
match goal with |-context[(_ <= ?a + ?c + ?b)%Re]=>
replace (a + c + b)%Re with ((a + b) + c)%Re by nra
end.
assert (((vec_inf_norm (FT2R_mat (A1_inv_J A)) +
default_abs t) /(1 - default_rel t) *
matrix_inf_norm (FT2R_mat (A2_J A)))%Re =
(((vec_inf_norm (FT2R_mat (A1_inv_J A)) +
default_abs t) /(1 - default_rel t) *
matrix_inf_norm (FT2R_mat (A2_J A))) + 0)%Re) by nra.
rewrite [in X in (X <= _)%Re]H0.
apply Rplus_le_compat.
+ assert (forall a b:R, (a * b + b = (1 + a)* b)%Re).
{ intros. nra. } rewrite H1.
assert (((vec_inf_norm (FT2R_mat (A1_inv_J A)) +
default_abs t) /(1 - default_rel t) *
matrix_inf_norm (FT2R_mat (A2_J A)))%Re =
(1 * ((vec_inf_norm (FT2R_mat (A1_inv_J A)) +
default_abs t) /(1 - default_rel t) *
matrix_inf_norm (FT2R_mat (A2_J A))))%Re).
{ nra. } rewrite [in X in (X <= _)%Re]H2.
apply Rmult_le_compat_r.
- repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le. apply Rinv_0_lt_compat. apply Rlt_Rminus.
apply default_rel_ub_strict.
apply /RleP. apply matrix_norm_pd.
- assert ((0 <= (((1 + g t n.+1) *
(1 + default_rel t) *
g t n.+1 +
default_rel t * (1 + g t n.+1) +
g t n.+1) * (1 + default_rel t) +
default_rel t))%Re).
{ apply Rplus_le_le_0_compat; last by apply default_rel_ge_0.
apply Rmult_le_pos.
+ apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
- repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
apply g_pos.
- apply Rmult_le_pos. apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
+ apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
} nra.
+ repeat apply Rmult_le_pos; last by (apply /RleP; apply matrix_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_abs_ge_0.
apply Rplus_le_le_0_compat; try by apply g_pos.
apply Rplus_le_le_0_compat.
- repeat apply Rmult_le_pos; last by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
Qed.
(** relation between the non-computable and computable d_mag **)
Lemma d_mag_def_le_alt {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j))
(Hsd: strict_diagonal_dominance A):
let rho_hat := rho_def_alt A b in
(rho_hat < 1)%Re ->
(d_mag_def A b <= d_mag_def_alt A b)%Re.
Proof.
intros ? Hrho.
unfold d_mag_def, d_mag_def_alt.
apply Rplus_le_compat.
+ apply Rplus_le_compat.
- apply Rplus_le_compat_r. apply Rplus_le_compat.
* apply Rmult_le_compat_l.
++ apply Rplus_le_le_0_compat; try apply default_rel_ge_0.
apply Rmult_le_pos. apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
++ apply Rmult_le_compat_r. apply /RleP. apply vec_norm_pd.
apply Rplus_le_compat_r. apply Rmult_le_compat_r.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
by apply vec_norm_A1_rel.
* apply Rmult_le_compat_l.
++ repeat apply Rmult_le_pos; try nra; try apply bpow_ge_0; try apply pos_INR.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
++ apply Rplus_le_compat_r. apply Rmult_le_compat_r.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
by apply vec_norm_A1_rel.
- apply Rmult_le_compat_r. apply /RleP. apply vec_norm_pd.
apply Rplus_le_compat_r. apply Rmult_le_compat_r.
apply default_rel_ge_0. by apply vec_norm_A1_rel.
+ apply Rmult_le_compat.
- apply Rplus_le_le_0_compat.
* apply Rmult_le_pos.
++ apply Rplus_le_le_0_compat; try apply default_rel_ge_0.
apply Rmult_le_pos; last by
(apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0).
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
apply g_pos.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ apply Rmult_le_pos. apply /RleP. apply vec_norm_pd.
apply /RleP. apply matrix_norm_pd.
* apply Rmult_le_pos; last by (apply /RleP; apply matrix_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_abs_ge_0.
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
++ repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
apply g_pos.
++ apply Rmult_le_pos.
apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
- apply /RleP. apply vec_norm_pd.
- apply Rplus_le_compat.
* apply Rmult_le_compat_l.
++ apply Rplus_le_le_0_compat; last by apply default_rel_ge_0.
apply Rmult_le_pos; last by
(apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0).
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
apply g_pos.
apply Rmult_le_pos.
apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ by apply matrix_vec_norm_A1_diag_mult_A.
* apply Rmult_le_compat; try (apply /RleP; apply matrix_norm_pd);
try apply matrix_norm_A2_rel; try nra.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_abs_ge_0.
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
apply g_pos.
apply Rmult_le_pos.
apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
- apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b .
by apply diagonal_dominance_implies_invertibility.
Qed.
Lemma d_mag_def_alt_ge_0 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1):
(rho_def_alt A b < 1)%Re ->
(0 <= d_mag_def_alt A b)%Re.
Proof.
intro Hrho.
unfold d_mag_def_alt.
repeat apply Rplus_le_le_0_compat.
+ repeat try apply Rmult_le_pos; try repeat apply Rplus_le_le_0_compat.
- apply Rmult_le_pos; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
- apply default_rel_ge_0.
- repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le. apply Rinv_0_lt_compat. apply Rlt_Rminus.
apply default_rel_ub_strict.
apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
- apply default_abs_ge_0.
- apply /RleP. apply vec_norm_pd.
+ repeat try apply Rmult_le_pos.
- apply Rplus_le_le_0_compat. nra. apply g_pos.
- apply pos_INR.
- nra.
- apply bpow_ge_0.
- apply Rplus_le_le_0_compat. nra. apply g_pos.
- apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
- apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by (apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0).
repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le. apply Rinv_0_lt_compat. apply Rlt_Rminus.
apply default_rel_ub_strict.
+ apply g1_pos.
+ apply Rmult_le_pos; last by (apply /RleP; try apply vec_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_rel_ge_0.
repeat apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le. apply Rinv_0_lt_compat. apply Rlt_Rminus.
apply default_rel_ub_strict.
+ repeat apply Rmult_le_pos; try by (apply /RleP; try apply vec_norm_pd).
repeat apply Rplus_le_le_0_compat.
- repeat apply Rmult_le_pos.
* repeat apply Rplus_le_le_0_compat; last by apply default_rel_ge_0.
repeat apply Rmult_le_pos.
++ apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos;last by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
* apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
* apply Rlt_le. apply Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
* apply /RleP. apply matrix_norm_pd.
- repeat apply Rmult_le_pos; last by (apply /RleP; apply matrix_norm_pd).
repeat apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
repeat apply Rmult_le_pos; last by apply bpow_ge_0.
* apply Rplus_le_le_0_compat;last by apply g_pos.
apply Rplus_le_le_0_compat.
++ repeat apply Rmult_le_pos;last by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
++ apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat. nra. apply g_pos.
* nra.
- apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
- apply Rlt_le. apply Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
- apply Rlt_le. apply Rinv_0_lt_compat.
apply Rlt_Rminus. by apply rho_1_implies_rho_2 with b.
Qed.
Lemma d_mag_alt_gt_0 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1):
(rho_def_alt A b < 1)%Re ->
(0 < d_mag_def_alt A b)%Re .
Proof.
intro Hrho.
unfold d_mag_def_alt.
apply Rplus_lt_le_0_compat.
+ apply Rplus_lt_le_0_compat.
- apply Rplus_lt_le_0_compat.
* apply Rplus_le_lt_0_compat.
++ repeat apply Rmult_le_pos; last by (apply /RleP; apply vec_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_rel_ge_0.
apply Rmult_le_pos; try by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by
(apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0).
apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
++ repeat apply Rmult_lt_0_compat; try nra; try apply bpow_gt_0.
apply Rplus_lt_le_0_compat; try by nra; try by apply g_pos.
apply g_pos.
apply lt_0_INR. lia.
apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
apply Rplus_lt_le_0_compat; try nra; try apply default_rel_ge_0.
apply Rplus_le_lt_0_compat; last by apply default_abs_gt_0.
apply Rmult_le_pos.
apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
* apply g1_pos.
- repeat apply Rmult_le_pos; last by (apply /RleP; apply vec_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_rel_ge_0.
apply Rmult_le_pos.
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
+ repeat apply Rmult_le_pos.
- apply Rplus_le_le_0_compat.
* apply Rmult_le_pos.
++ apply Rplus_le_le_0_compat; try by apply default_rel_ge_0.
apply Rmult_le_pos; last by
(apply Rplus_le_le_0_compat; try nra; try by apply default_rel_ge_0).
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos; try by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
++ apply Rmult_le_pos; last by (apply /RleP; apply matrix_norm_pd).
apply Rmult_le_pos.
-- apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
-- apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
* apply Rmult_le_pos; last by (apply /RleP; apply matrix_norm_pd).
apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply Rmult_le_pos; last by apply default_abs_ge_0.
apply Rplus_le_le_0_compat; last by apply g_pos.
apply Rplus_le_le_0_compat.
-- repeat apply Rmult_le_pos; try by apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
-- apply Rmult_le_pos; first by apply default_rel_ge_0.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
- apply Rplus_le_le_0_compat; last by apply default_abs_ge_0.
apply /RleP. apply vec_norm_pd.
- apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply default_rel_ub_strict.
- apply /RleP. apply vec_norm_pd.
- apply Rlt_le. apply Rinv_0_lt_compat.
apply Rlt_Rminus.
apply rho_1_implies_rho_2 with b. apply Hrho.
Qed.
(** Use: lower case gamma **)
(** relation between non-computable and computable defn of e_o in reals **)
Lemma f_error0_bnd {t: FPStdLib.type} {n:nat} (A : 'M[ftype t]_n.+1)
(b : 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j))
(Hsd: strict_diagonal_dominance A):
let x0 := \col_(j < n.+1) (Zconst t 0) in
let A_real := FT2R_mat A in
let b_real := FT2R_mat b in
let x:= mulmx (A_real^-1) b_real in
let A1_inv_real := FT2R_mat (A1_inv_J A) in
let A2_real := FT2R_mat (A2_J A) in
let R_def := (((vec_inf_norm (FT2R_mat (A1_inv_J A)) + default_abs t) / (1 - default_rel t)) *
matrix_inf_norm (A2_real))%Re in
(R_def < 1)%Re ->
(@f_error _ _ _ 0 b x0 x A <=
vec_inf_norm (FT2R_mat x0) +
(((vec_inf_norm (FT2R_mat (A1_inv_J A)) + default_abs t) / (1 - default_rel t))
* vec_inf_norm (b_real)) / (1 - R_def))%Re.
Proof.
intros.
unfold f_error.
eapply Rle_trans. apply /RleP. apply triang_ineq .
rewrite -vec_inf_norm_opp.
assert (X_m_jacobi 0 x0 b A = x0).
{ by simpl. } rewrite H0. rewrite -RplusE.
apply Rplus_le_compat_l.
apply x_bound_exists; try by [].
by apply diagonal_dominance_implies_invertibility.
Qed.
(** Replace Gamma with tau_squared **)
(** g g1 rho d_mag : what do they mean intuitively **)
Lemma d_mag_rel_1 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j))
(Hsd: strict_diagonal_dominance A):
let rho_hat := rho_def_alt A b in
(rho_hat < 1)%Re ->
(2 * d_mag_def A b *
/ (1 - rho_def A b) <=
2 * d_mag_def_alt A b *
/ (1 - rho_def_alt A b))%Re.
Proof.
intros ? Hrho.
apply Rmult_le_compat.
apply Rmult_le_pos. nra. apply d_mag_ge_0.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
apply rho_def_le_alt; try by []. apply Hrho.
apply Rmult_le_compat_l. nra. by apply d_mag_def_le_alt.
assert ((rho_def A b = rho_def_alt A b)%Re \/
(rho_def A b < rho_def_alt A b)%Re).
{ pose proof (@rho_def_le_alt t n A b Hinv Ha). nra. }
destruct H.
rewrite H; nra.
apply Rlt_le. apply Rinv_lt_contravar .
apply Rmult_lt_0_compat.
apply Rlt_Rminus. apply Hrho.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
apply Rplus_le_lt_compat. nra.
by apply Ropp_lt_contravar.
Qed.
Lemma d_mag_rel_2 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j))
(Hsd: strict_diagonal_dominance A):
let rho_hat := rho_def_alt A b in
(rho_hat < 1)%Re ->
(1 / (1 - rho_def A b) *
d_mag_def A b <=
1 / (1 - rho_def_alt A b) *
d_mag_def_alt A b)%Re.
Proof.
intros ? Hrho.
apply Rmult_le_compat.
apply Rlt_le.
replace (1 / (1 - rho_def A b))%Re with
(/ (1 - rho_def A b))%Re by nra.
apply Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
apply d_mag_ge_0.
assert ((rho_def A b = rho_def_alt A b)%Re \/
(rho_def A b < rho_def_alt A b)%Re).
{ pose proof (@rho_def_le_alt t n A b Hinv Ha). nra. }
destruct H.
rewrite H; nra.
apply Rlt_le.
replace (1 / (1 - rho_def A b))%Re with
(/ (1 - rho_def A b))%Re by nra.
replace (1 / (1 - rho_def_alt A b))%Re with
(/ (1 - rho_def_alt A b))%Re by nra.
apply Rinv_lt_contravar .
apply Rmult_lt_0_compat.
apply Rlt_Rminus. apply Hrho.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
apply Rplus_le_lt_compat. nra.
by apply Ropp_lt_contravar.
by apply d_mag_def_le_alt.
Qed.
Lemma input_bound_compute_implies_math {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j))
(Hsd : strict_diagonal_dominance A):
let rho_hat := rho_def_alt A b in
(rho_hat < 1)%Re ->
(0 < f_error 0 b (\col__ Zconst t 0)
((FT2R_mat A)^-1 *m FT2R_mat b) A -
d_mag_def A b *
/ (1 - rho_def A b))%Re ->
input_bound_Rcompute A (\col__ Zconst t 0) b ->
input_bound A (\col__ Zconst t 0) b .
Proof.
intros ? Hrho He0 ? .
repeat split.
+ intros. unfold input_bound_Rcompute in H.
destruct H as [bnd1 _ ].
specialize (bnd1 i).
eapply Rle_lt_trans; last by apply bnd1.
apply Rmult_le_compat_l. apply Rabs_pos.
apply Rplus_le_compat.
- rewrite !Rmult_1_l. apply Rplus_le_compat.
* apply Rmult_le_compat.
apply Rplus_le_le_0_compat. nra. by apply rho_ge_0.
apply Rlt_le. apply He0.
apply Rplus_le_compat_l. by apply rho_def_le_alt.
apply Rplus_le_compat.
apply f_error0_bnd; try by [].
by apply rho_1_implies_rho_2 with b.
apply Ropp_le_contravar.
apply Rmult_le_pos. apply d_mag_ge_0.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
* by apply d_mag_rel_1.
- apply Rmult_le_compat_l. nra.
apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b.
by apply diagonal_dominance_implies_invertibility.
+ destruct H as [_[bnd2 _]].
eapply Rle_lt_trans; last by apply bnd2.
apply Rplus_le_compat.
- apply Rplus_le_compat.
apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b.
by apply diagonal_dominance_implies_invertibility.
rewrite !Rmult_1_l.
apply f_error0_bnd ; try by []. by apply rho_1_implies_rho_2 with b.
- by apply d_mag_rel_2 .
+ intros. unfold input_bound_Rcompute in H.
destruct H as [_ [_ [bnd3 _]]]. apply bnd3.
+ intros. unfold input_bound_Rcompute in H.
destruct H as [_[_[_[bnd4 _]]]].
eapply Rle_lt_trans; last by apply bnd4.
apply Rplus_le_compat_r. apply Rplus_le_compat_l.
apply Rmult_le_compat_l.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rmult_le_compat_r.
- apply /RleP. apply big_ge_0_ex_abstract.
intros. apply /RleP. apply Rabs_pos.
- apply Rplus_le_compat.
* apply Rplus_le_compat.
apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b.
by apply diagonal_dominance_implies_invertibility.
rewrite !Rmult_1_l.
apply f_error0_bnd ; try by []. by apply rho_1_implies_rho_2 with b.
* by apply d_mag_rel_2 .
+ intros. unfold input_bound_Rcompute in H.
destruct H as [_[_[_[_[bnd5 _]]]]].
eapply Rle_lt_trans; last by apply bnd5.
apply Rmult_le_compat_l. apply Rabs_pos.
apply Rplus_le_compat_r.
apply Rplus_le_compat_l.
apply Rmult_le_compat_l.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rmult_le_compat_r.
- apply /RleP. apply big_ge_0_ex_abstract.
intros. apply /RleP. apply Rabs_pos.
- apply Rplus_le_compat.
* apply Rplus_le_compat.
apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b.
by apply diagonal_dominance_implies_invertibility.
rewrite !Rmult_1_l.
apply f_error0_bnd; try by []. by apply rho_1_implies_rho_2 with b.
* by apply d_mag_rel_2 .
+ intros. unfold input_bound_Rcompute in H.
destruct H as [_[_[_[_[_ bnd6]]]]].
eapply Rle_lt_trans; last by apply bnd6.
rewrite !Rmult_1_l.
apply Rplus_le_compat.
- apply Rplus_le_compat.
* apply Rmult_le_compat.
apply Rplus_le_le_0_compat. nra. by apply rho_ge_0.
apply Rlt_le. apply He0.
apply Rplus_le_compat_l. by apply rho_def_le_alt.
apply Rplus_le_compat.
apply f_error0_bnd; try by []. by apply rho_1_implies_rho_2 with b.
apply Ropp_le_contravar.
apply Rmult_le_pos. apply d_mag_ge_0.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
* by apply d_mag_rel_1.
- apply Rmult_le_compat_l. nra.
apply x_bound_exists; try by []. by apply rho_1_implies_rho_2 with b.
by apply diagonal_dominance_implies_invertibility.
Qed.
Lemma ln_rho_rel {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
(0 < rho_def_alt A b)%Re ->
(rho_def_alt A b < 1)%Re ->
(0 < rho_def A b)%Re ->
(/ ln (1 / rho_def A b) <=
/ ln (1 / rho_def_alt A b))%Re.
Proof.
intros.
pose proof (@rho_def_le_alt t n A b Hinv Ha).
assert (rho_def A b = rho_def_alt A b \/
(rho_def A b < rho_def_alt A b)%Re) by nra.
destruct H3. rewrite H3. nra.
apply Rlt_le.
apply Rinv_lt_contravar.
+ apply Rmult_lt_0_compat.
- rewrite -ln_1. apply ln_increasing. nra.
replace (1 / rho_def_alt A b)%Re with (/ rho_def_alt A b)%Re by nra.
replace 1%Re with (/1)%Re by nra.
apply Rinv_lt_contravar.
rewrite Rmult_1_r. apply H. apply H0.
- rewrite -ln_1. apply ln_increasing. nra.
replace (1 / rho_def A b)%Re with (/ rho_def A b)%Re by nra.
replace 1%Re with (/1)%Re by nra.
apply Rinv_lt_contravar.
rewrite Rmult_1_r. apply H1.
apply Rlt_trans with (rho_def_alt A b).
apply H3.
apply H0.
+ apply ln_increasing.
replace (1 / rho_def_alt A b)%Re with (/ rho_def_alt A b)%Re by nra.
apply Rinv_0_lt_compat. apply H.
replace (1 / rho_def_alt A b)%Re with (/ rho_def_alt A b)%Re by nra.
replace (1 / rho_def A b)%Re with (/ rho_def A b)%Re by nra.
apply Rinv_lt_contravar.
by apply Rmult_lt_0_compat.
apply H3.
Qed.
Lemma ln_rho_inv_ge_0 {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
( rho_def_alt A b < 1)%Re ->
(0 < rho_def A b)%Re ->
(0 <= / ln (1 / rho_def A b))%Re.
Proof.
intros. apply Rlt_le. apply Rinv_0_lt_compat.
rewrite -ln_1. apply ln_increasing.
nra.
replace (1 / rho_def A b)%Re with (/ rho_def A b)%Re by nra.
replace 1%Re with (/1)%Re by nra.
apply Rinv_lt_contravar.
+ by rewrite Rmult_1_r.
+ apply Rle_lt_trans with (rho_def_alt A b).
by apply rho_def_le_alt.
apply H.
Qed.
Lemma ln_incr (x y:R):
(0 < x)%Re -> (x <= y)%Re -> (ln x <= ln y)%Re.
Proof.
intros.
assert (x = y \/ (x < y)%Re) by nra.
destruct H1.
+ rewrite H1. nra.
+ apply Rlt_le. by apply ln_increasing.
Qed.
Lemma vec_norm_strong_not_0 {n:nat} (v: 'cV[R]_n.+1):
(forall i, v i ord0 <> 0%Re) ->
(0 < vec_inf_norm v)%Re.
Proof.
intros.
unfold vec_inf_norm.
apply Rlt_le_trans with
[seq Rabs (v i 0) | i <- enum 'I_n.+1]`_0.
+ rewrite seq_equiv. rewrite nth_mkseq; last by [].
specialize (H (@inord n 0)). by apply Rabs_pos_lt.
+ apply bigmax_ler_0head.
{ apply /mapP. exists ord0. apply mem_enum.
rewrite (@nth_map _ ord0). f_equal. f_equal.
rewrite (@nth_ord_enum n.+1 ord0 0). auto.
by rewrite size_enum_ord. }
intros. move /mapP in H0. destruct H0 as [x0 ? ?]. rewrite H1.
apply /RleP. apply Rabs_pos.
Qed.
Lemma tau_sqr_rel{t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1) (accuracy: ftype t)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
let A_real := FT2R_mat A in
let b_real := FT2R_mat b in
let rho := rho_def A b in
let d_mag := d_mag_def A b in
( rho_def_alt A b < 1)%Re ->
(FT2R (BMULT accuracy accuracy) >
g1 t n.+1 (n.+1 - 1)%coq_nat +
INR n.+1 * (1 + g t n.+1) *
(g1 t n.+1 (n.+1 - 1)%coq_nat +
2 * (1 + g t n.+1) * (1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
d_mag * / (1 - rho))²)%Re ->
(0 <
(sqrt
((FT2R
(BMULT accuracy accuracy) -
g1 t n.+1 (n.+1 - 1)%coq_nat) /
INR n.+1 / (1 + g t n.+1)) -
g1 t n.+1 (n.+1 - 1)%coq_nat) /
(1 + g t n.+1) /
vec_inf_norm (FT2R_mat (A1_J A)) /
(1 + default_rel t) -
2 * d_mag_def A b /
(1 - rho_def A b))%Re.
Proof.
intros. apply Rlt_Rminus. repeat apply Rdiv_lt_right.
+ apply Rplus_lt_le_0_compat; try nra; try apply default_rel_ge_0.
+ apply vec_norm_strong_not_0 . intros. rewrite !mxE.
assert (Hneq: forall i, (FT2R (A i i) <> 0%Re)).
{ intros. by apply BDIV_FT2R_sep_zero. } apply Hneq.
+ apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
+ apply Rcomplements.Rlt_minus_r.
apply Rsqr_incrst_0.
- rewrite Rsqr_sqrt .
* repeat apply Rdiv_lt_right.
apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
apply lt_0_INR. lia.
apply Rcomplements.Rlt_minus_r.
apply Rgt_lt. unfold rho, d_mag in H0.
assert (((2 * d_mag_def A b /
(1 - rho_def A b) *
(1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
(1 + g t n.+1) +
g1 t n.+1 (n.+1 - 1)%coq_nat)² *
(1 + g t n.+1) * INR n.+1 +
g1 t n.+1 (n.+1 - 1)%coq_nat)%Re =
((2 * d_mag_def A b * /
(1 - rho_def A b) *
(1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
(1 + g t n.+1) +
g1 t n.+1 (n.+1 - 1)%coq_nat)² *
(1 + g t n.+1) * INR n.+1 +
g1 t n.+1 (n.+1 - 1)%coq_nat)%Re) by nra.
rewrite H1. clear H1.
eapply Rgt_ge_trans. apply H0. apply Rle_ge.
unfold Rsqr. nra.
* repeat apply Rmult_le_pos.
++ apply Rlt_le. apply Rlt_Rminus.
eapply Rle_lt_trans; last by apply H0.
assert (g1 t n.+1 (n.+1 - 1)%coq_nat =
(g1 t n.+1 (n.+1 - 1)%coq_nat + 0)%Re) by nra.
rewrite [in X in (X <= _)%Re]H1. apply Rplus_le_compat_l.
apply Rmult_le_pos.
-- apply Rmult_le_pos. apply pos_INR.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
-- apply Rle_0_sqr .
++ apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR. lia.
++ apply Rlt_le, Rinv_0_lt_compat.
apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
- apply Rplus_le_le_0_compat; last by apply g1_pos.
repeat apply Rmult_le_pos; try nra; try apply bpow_ge_0; try apply d_mag_ge_0.
* apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus.
apply Rle_lt_trans with (rho_def_alt A b).
by apply rho_def_le_alt.
apply H.
* apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
* apply /RleP. apply vec_norm_pd.
* apply Rplus_le_le_0_compat; try nra; try apply g_pos.
- apply sqrt_pos.
Qed.
Lemma tau_sqr_rel_Rcompute {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1) (accuracy: ftype t)
(Hinv: forall i, finite (BDIV (Zconst t 1) (A i i)))
(Ha : forall i j, finite (A i j)):
let A_real := FT2R_mat A in
let b_real := FT2R_mat b in
let rho := rho_def A b in
let d_mag := d_mag_def A b in
( rho_def_alt A b < 1)%Re ->
(FT2R (BMULT accuracy accuracy) >
g1 t n.+1 (n.+1 - 1)%coq_nat +
INR n.+1 * (1 + g t n.+1) *
(g1 t n.+1 (n.+1 - 1)%coq_nat +
2 * (1 + g t n.+1) *
(1 + default_rel t) *
vec_inf_norm
(FT2R_mat (A1_J A)) *
d_mag_def_alt A b *
/ (1 - rho_def_alt A b))²)%Re ->
(0 <
(sqrt
((FT2R
(BMULT accuracy accuracy) -
g1 t n.+1 (n.+1 - 1)%coq_nat) /
INR n.+1 / (1 + g t n.+1)) -
g1 t n.+1 (n.+1 - 1)%coq_nat) /
(1 + g t n.+1) /
vec_inf_norm (FT2R_mat (A1_J A)) /
(1 + default_rel t) -
2 * d_mag_def_alt A b /
(1 - rho_def_alt A b))%Re.
Proof.
intros. apply Rlt_Rminus. repeat apply Rdiv_lt_right.
+ apply Rplus_lt_le_0_compat; try nra; try apply default_rel_ge_0.
+ apply vec_norm_strong_not_0 . intros. rewrite !mxE.
assert (Hneq: forall i, (FT2R (A i i) <> 0%Re)).
{ intros. by apply BDIV_FT2R_sep_zero. } apply Hneq.
+ apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
+ apply Rcomplements.Rlt_minus_r.
apply Rsqr_incrst_0.
- rewrite Rsqr_sqrt .
* repeat apply Rdiv_lt_right.
apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
apply lt_0_INR. lia.
apply Rcomplements.Rlt_minus_r.
apply Rgt_lt.
assert (((2 * d_mag_def_alt A b /
(1 - rho_def_alt A b) *
(1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
(1 + g t n.+1) +
g1 t n.+1 (n.+1 - 1)%coq_nat)² *
(1 + g t n.+1) * INR n.+1 +
g1 t n.+1 (n.+1 - 1)%coq_nat)%Re =
((2 * d_mag_def_alt A b * /
(1 - rho_def_alt A b) *
(1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
(1 + g t n.+1) +
g1 t n.+1 (n.+1 - 1)%coq_nat)² *
(1 + g t n.+1) * INR n.+1 +
g1 t n.+1 (n.+1 - 1)%coq_nat)%Re) by nra.
rewrite H1. clear H1.
eapply Rgt_ge_trans. apply H0. apply Rle_ge.
unfold Rsqr. nra.
* repeat apply Rmult_le_pos.
++ apply Rlt_le. apply Rlt_Rminus.
eapply Rle_lt_trans; last by apply H0.
assert (g1 t n.+1 (n.+1 - 1)%coq_nat =
(g1 t n.+1 (n.+1 - 1)%coq_nat + 0)%Re) by nra.
rewrite [in X in (X <= _)%Re]H1. apply Rplus_le_compat_l.
apply Rmult_le_pos.
-- apply Rmult_le_pos. apply pos_INR.
apply Rplus_le_le_0_compat; try nra; try apply g_pos.
-- apply Rle_0_sqr .
++ apply Rlt_le, Rinv_0_lt_compat. apply lt_0_INR. lia.
++ apply Rlt_le, Rinv_0_lt_compat.
apply Rplus_lt_le_0_compat; try nra; try apply g_pos.
- apply Rplus_le_le_0_compat; last by apply g1_pos.
repeat apply Rmult_le_pos; try nra; try apply bpow_ge_0; try apply d_mag_ge_0.
* apply d_mag_def_alt_ge_0. apply H.
* apply Rlt_le, Rinv_0_lt_compat. apply Rlt_Rminus. apply H.
* apply Rplus_le_le_0_compat; try nra; try apply default_rel_ge_0.
* apply /RleP. apply vec_norm_pd.
* apply Rplus_le_le_0_compat; try nra; try apply g_pos.
- apply sqrt_pos.
Qed.
Lemma sub0l_vec:
forall (n:nat) (v: 'cV[R]_n.+1),
0 - v = - v.
Proof.
intros. apply matrixP. unfold eqrel.
intros. rewrite !mxE.
rewrite -RminusE -!RoppE.
rewrite Rminus_0_l. nra.
Qed.
(** Refactoring definitions to make them readable and beautiful **)
Lemma jacobi_precond_compute_implies_math {t: FPStdLib.type} {n:nat}
(A: 'M[ftype t]_n.+1) (b: 'cV[ftype t]_n.+1) (accuracy: ftype t) (k: nat)
(Hrho_gt_0: (0 < rho_def A b)%Re)
(Hx_lb: (d_mag_def_alt A b / (1 - rho_def_alt A b) <
vec_inf_norm (x_fix ((FT2R_mat A)^-1 *m (FT2R_mat b))
(FT2R_mat b) (FT2R_mat A)))%Re)
(Hsd : strict_diagonal_dominance A):
jacobi_preconditions_Rcompute A b accuracy k ->
jacobi_preconditions_math A b accuracy k.
Proof.
intros.
unfold jacobi_preconditions_Rcompute in H.
destruct H as [Hfa [Hrho [Hdom [Hfdiv [HG1 [Hfacc [Hk [He0 [HfA2 [Hfb [size_cons Hinp]]]]]]]]]]].
unfold jacobi_preconditions_math.
(*assert (Hrho_Re: (0 < rho_def A b)%Re).
{ apply rho_gt_0. apply Hrho. }
*)
assert (HG_re: (FT2R (BMULT accuracy accuracy) >
g1 t n.+1 (n.+1 - 1)%coq_nat +
INR n.+1 * (1 + g t n.+1) *
(g1 t n.+1 (n.+1 - 1)%coq_nat +
2 * (1 + g t n.+1) *
(1 + default_rel t) *
vec_inf_norm (FT2R_mat (A1_J A)) *
d_mag_def A b * / (1 - rho_def A b))²)%Re).
{ apply Rgt_lt.
destruct HG1 as [HG1 _].
eapply Rle_lt_trans; try apply HG1.
apply Rplus_le_compat_l. apply Rmult_le_compat_l.
- apply Rmult_le_pos. apply pos_INR.
apply Rplus_le_le_0_compat. nra. apply g_pos.
- apply Rsqr_incr_1.
* apply Rplus_le_compat_l.
apply Rmult_le_compat.
++ repeat apply Rmult_le_pos. nra.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
apply /RleP. apply vec_norm_pd.
apply d_mag_ge_0.
++ apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
++ apply Rmult_le_compat_l.
repeat apply Rmult_le_pos. nra.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
apply /RleP. apply vec_norm_pd.
apply d_mag_def_le_alt. intros. apply Hfdiv.
intros. apply Hfa. apply Hsd. apply Hrho.
++ assert ((rho_def A b = rho_def_alt A b)%Re \/
(rho_def A b < rho_def_alt A b)%Re).
{ pose proof (@rho_def_le_alt t n A b Hfdiv Hfa). nra. }
destruct H.
rewrite H; nra.
apply Rlt_le. apply Rinv_lt_contravar .
apply Rmult_lt_0_compat.
apply Rlt_Rminus. apply Hrho.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
apply Rplus_le_lt_compat. nra.
by apply Ropp_lt_contravar.
* apply Rplus_le_le_0_compat. apply g1_pos.
repeat apply Rmult_le_pos. nra.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
apply /RleP. apply vec_norm_pd.
apply d_mag_ge_0.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. eapply Rle_lt_trans.
by apply rho_def_le_alt. apply Hrho.
* apply Rplus_le_le_0_compat. apply g1_pos.
repeat apply Rmult_le_pos. nra.
apply Rplus_le_le_0_compat. nra. apply g_pos.
apply Rplus_le_le_0_compat. nra. apply default_rel_ge_0.
apply /RleP. apply vec_norm_pd.
apply d_mag_def_alt_ge_0. apply Hrho.
apply Rlt_le, Rinv_0_lt_compat.
apply Rlt_Rminus. apply Hrho.
}