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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
|
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
(*i $Id: RiemannInt_SF.v 9245 2006-10-17 12:53:34Z notin $ i*)
Require Import Rbase.
Require Import Rfunctions.
Require Import Ranalysis.
Require Import Classical_Prop.
Open Local Scope R_scope.
Set Implicit Arguments.
(*****************************************************)
(** * Each bounded subset of N has a maximal element *)
(*****************************************************)
Definition Nbound (I:nat -> Prop) : Prop :=
exists n : nat, (forall i:nat, I i -> (i <= n)%nat).
Lemma IZN_var : forall z:Z, (0 <= z)%Z -> {n : nat | z = Z_of_nat n}.
Proof.
intros; apply Z_of_nat_complete_inf; assumption.
Qed.
Lemma Nzorn :
forall I:nat -> Prop,
(exists n : nat, I n) ->
Nbound I -> sigT (fun n:nat => I n /\ (forall i:nat, I i -> (i <= n)%nat)).
Proof.
intros I H H0; set (E := fun x:R => exists i : nat, I i /\ INR i = x);
assert (H1 : bound E).
unfold Nbound in H0; elim H0; intros N H1; unfold bound in |- *;
exists (INR N); unfold is_upper_bound in |- *; intros;
unfold E in H2; elim H2; intros; elim H3; intros;
rewrite <- H5; apply le_INR; apply H1; assumption.
assert (H2 : exists x : R, E x).
elim H; intros; exists (INR x); unfold E in |- *; exists x; split;
[ assumption | reflexivity ].
assert (H3 := completeness E H1 H2); elim H3; intros; unfold is_lub in p;
elim p; clear p; intros; unfold is_upper_bound in H4, H5;
assert (H6 : 0 <= x).
elim H2; intros; unfold E in H6; elim H6; intros; elim H7; intros;
apply Rle_trans with x0;
[ rewrite <- H9; change (INR 0 <= INR x1) in |- *; apply le_INR;
apply le_O_n
| apply H4; assumption ].
assert (H7 := archimed x); elim H7; clear H7; intros;
assert (H9 : x <= IZR (up x) - 1).
apply H5; intros; assert (H10 := H4 _ H9); unfold E in H9; elim H9; intros;
elim H11; intros; rewrite <- H13; apply Rplus_le_reg_l with 1;
replace (1 + (IZR (up x) - 1)) with (IZR (up x));
[ idtac | ring ]; replace (1 + INR x1) with (INR (S x1));
[ idtac | rewrite S_INR; ring ].
assert (H14 : (0 <= up x)%Z).
apply le_IZR; apply Rle_trans with x; [ apply H6 | left; assumption ].
assert (H15 := IZN _ H14); elim H15; clear H15; intros; rewrite H15;
rewrite <- INR_IZR_INZ; apply le_INR; apply lt_le_S;
apply INR_lt; rewrite H13; apply Rle_lt_trans with x;
[ assumption | rewrite INR_IZR_INZ; rewrite <- H15; assumption ].
assert (H10 : x = IZR (up x) - 1).
apply Rle_antisym;
[ assumption
| apply Rplus_le_reg_l with (- x + 1);
replace (- x + 1 + (IZR (up x) - 1)) with (IZR (up x) - x);
[ idtac | ring ]; replace (- x + 1 + x) with 1;
[ assumption | ring ] ].
assert (H11 : (0 <= up x)%Z).
apply le_IZR; apply Rle_trans with x; [ apply H6 | left; assumption ].
assert (H12 := IZN_var H11); elim H12; clear H12; intros; assert (H13 : E x).
elim (classic (E x)); intro; try assumption.
cut (forall y:R, E y -> y <= x - 1).
intro; assert (H14 := H5 _ H13); cut (x - 1 < x).
intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H14 H15)).
apply Rminus_lt; replace (x - 1 - x) with (-1); [ idtac | ring ];
rewrite <- Ropp_0; apply Ropp_lt_gt_contravar; apply Rlt_0_1.
intros; assert (H14 := H4 _ H13); elim H14; intro; unfold E in H13; elim H13;
intros; elim H16; intros; apply Rplus_le_reg_l with 1.
replace (1 + (x - 1)) with x; [ idtac | ring ]; rewrite <- H18;
replace (1 + INR x1) with (INR (S x1)); [ idtac | rewrite S_INR; ring ].
cut (x = INR (pred x0)).
intro; rewrite H19; apply le_INR; apply lt_le_S; apply INR_lt; rewrite H18;
rewrite <- H19; assumption.
rewrite H10; rewrite p; rewrite <- INR_IZR_INZ; replace 1 with (INR 1);
[ idtac | reflexivity ]; rewrite <- minus_INR.
replace (x0 - 1)%nat with (pred x0);
[ reflexivity
| case x0; [ reflexivity | intro; simpl in |- *; apply minus_n_O ] ].
induction x0 as [| x0 Hrecx0];
[ rewrite p in H7; rewrite <- INR_IZR_INZ in H7; simpl in H7;
elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H6 H7))
| apply le_n_S; apply le_O_n ].
rewrite H15 in H13; elim H12; assumption.
split with (pred x0); unfold E in H13; elim H13; intros; elim H12; intros;
rewrite H10 in H15; rewrite p in H15; rewrite <- INR_IZR_INZ in H15;
assert (H16 : INR x0 = INR x1 + 1).
rewrite H15; ring.
rewrite <- S_INR in H16; assert (H17 := INR_eq _ _ H16); rewrite H17;
simpl in |- *; split.
assumption.
intros; apply INR_le; rewrite H15; rewrite <- H15; elim H12; intros;
rewrite H20; apply H4; unfold E in |- *; exists i;
split; [ assumption | reflexivity ].
Qed.
(*******************************************)
(** * Step functions *)
(*******************************************)
Definition open_interval (a b x:R) : Prop := a < x < b.
Definition co_interval (a b x:R) : Prop := a <= x < b.
Definition adapted_couple (f:R -> R) (a b:R) (l lf:Rlist) : Prop :=
ordered_Rlist l /\
pos_Rl l 0 = Rmin a b /\
pos_Rl l (pred (Rlength l)) = Rmax a b /\
Rlength l = S (Rlength lf) /\
(forall i:nat,
(i < pred (Rlength l))%nat ->
constant_D_eq f (open_interval (pos_Rl l i) (pos_Rl l (S i)))
(pos_Rl lf i)).
Definition adapted_couple_opt (f:R -> R) (a b:R) (l lf:Rlist) :=
adapted_couple f a b l lf /\
(forall i:nat,
(i < pred (Rlength lf))%nat ->
pos_Rl lf i <> pos_Rl lf (S i) \/ f (pos_Rl l (S i)) <> pos_Rl lf i) /\
(forall i:nat, (i < pred (Rlength l))%nat -> pos_Rl l i <> pos_Rl l (S i)).
Definition is_subdivision (f:R -> R) (a b:R) (l:Rlist) : Type :=
sigT (fun l0:Rlist => adapted_couple f a b l l0).
Definition IsStepFun (f:R -> R) (a b:R) : Type :=
sigT (fun l:Rlist => is_subdivision f a b l).
(** ** Class of step functions *)
Record StepFun (a b:R) : Type := mkStepFun
{fe :> R -> R; pre : IsStepFun fe a b}.
Definition subdivision (a b:R) (f:StepFun a b) : Rlist := projT1 (pre f).
Definition subdivision_val (a b:R) (f:StepFun a b) : Rlist :=
match projT2 (pre f) with
| existT a b => a
end.
Boxed Fixpoint Int_SF (l k:Rlist) {struct l} : R :=
match l with
| nil => 0
| cons a l' =>
match k with
| nil => 0
| cons x nil => 0
| cons x (cons y k') => a * (y - x) + Int_SF l' (cons y k')
end
end.
(** ** Integral of step functions *)
Definition RiemannInt_SF (a b:R) (f:StepFun a b) : R :=
match Rle_dec a b with
| left _ => Int_SF (subdivision_val f) (subdivision f)
| right _ => - Int_SF (subdivision_val f) (subdivision f)
end.
(************************************)
(** ** Properties of step functions *)
(************************************)
Lemma StepFun_P1 :
forall (a b:R) (f:StepFun a b),
adapted_couple f a b (subdivision f) (subdivision_val f).
Proof.
intros a b f; unfold subdivision_val in |- *; case (projT2 (pre f)); intros;
apply a0.
Qed.
Lemma StepFun_P2 :
forall (a b:R) (f:R -> R) (l lf:Rlist),
adapted_couple f a b l lf -> adapted_couple f b a l lf.
Proof.
unfold adapted_couple in |- *; intros; decompose [and] H; clear H;
repeat split; try assumption.
rewrite H2; unfold Rmin in |- *; case (Rle_dec a b); intro;
case (Rle_dec b a); intro; try reflexivity.
apply Rle_antisym; assumption.
apply Rle_antisym; auto with real.
rewrite H1; unfold Rmax in |- *; case (Rle_dec a b); intro;
case (Rle_dec b a); intro; try reflexivity.
apply Rle_antisym; assumption.
apply Rle_antisym; auto with real.
Qed.
Lemma StepFun_P3 :
forall a b c:R,
a <= b ->
adapted_couple (fct_cte c) a b (cons a (cons b nil)) (cons c nil).
Proof.
intros; unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H0; inversion H0;
[ simpl in |- *; assumption | elim (le_Sn_O _ H2) ].
simpl in |- *; unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
simpl in |- *; unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
unfold constant_D_eq, open_interval in |- *; intros; simpl in H0;
inversion H0; [ reflexivity | elim (le_Sn_O _ H3) ].
Qed.
Lemma StepFun_P4 : forall a b c:R, IsStepFun (fct_cte c) a b.
Proof.
intros; unfold IsStepFun in |- *; case (Rle_dec a b); intro.
apply existT with (cons a (cons b nil)); unfold is_subdivision in |- *;
apply existT with (cons c nil); apply (StepFun_P3 c r).
apply existT with (cons b (cons a nil)); unfold is_subdivision in |- *;
apply existT with (cons c nil); apply StepFun_P2;
apply StepFun_P3; auto with real.
Qed.
Lemma StepFun_P5 :
forall (a b:R) (f:R -> R) (l:Rlist),
is_subdivision f a b l -> is_subdivision f b a l.
Proof.
destruct 1 as (x,(H0,(H1,(H2,(H3,H4))))); exists x;
repeat split; try assumption.
rewrite H1; apply Rmin_comm.
rewrite H2; apply Rmax_comm.
Qed.
Lemma StepFun_P6 :
forall (f:R -> R) (a b:R), IsStepFun f a b -> IsStepFun f b a.
Proof.
unfold IsStepFun in |- *; intros; elim X; intros; apply existT with x;
apply StepFun_P5; assumption.
Qed.
Lemma StepFun_P7 :
forall (a b r1 r2 r3:R) (f:R -> R) (l lf:Rlist),
a <= b ->
adapted_couple f a b (cons r1 (cons r2 l)) (cons r3 lf) ->
adapted_couple f r2 b (cons r2 l) lf.
Proof.
unfold adapted_couple in |- *; intros; decompose [and] H0; clear H0;
assert (H5 : Rmax a b = b).
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
assert (H7 : r2 <= b).
rewrite H5 in H2; rewrite <- H2; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ].
repeat split.
apply RList_P4 with r1; assumption.
rewrite H5 in H2; unfold Rmin in |- *; case (Rle_dec r2 b); intro;
[ reflexivity | elim n; assumption ].
unfold Rmax in |- *; case (Rle_dec r2 b); intro;
[ rewrite H5 in H2; rewrite <- H2; reflexivity | elim n; assumption ].
simpl in H4; simpl in |- *; apply INR_eq; apply Rplus_eq_reg_l with 1;
do 2 rewrite (Rplus_comm 1); do 2 rewrite <- S_INR;
rewrite H4; reflexivity.
intros; unfold constant_D_eq, open_interval in |- *; intros;
unfold constant_D_eq, open_interval in H6;
assert (H9 : (S i < pred (Rlength (cons r1 (cons r2 l))))%nat).
simpl in |- *; simpl in H0; apply lt_n_S; assumption.
assert (H10 := H6 _ H9); apply H10; assumption.
Qed.
Lemma StepFun_P8 :
forall (f:R -> R) (l1 lf1:Rlist) (a b:R),
adapted_couple f a b l1 lf1 -> a = b -> Int_SF lf1 l1 = 0.
Proof.
simple induction l1.
intros; induction lf1 as [| r lf1 Hreclf1]; reflexivity.
simple induction r0.
intros; induction lf1 as [| r1 lf1 Hreclf1].
reflexivity.
unfold adapted_couple in H0; decompose [and] H0; clear H0; simpl in H5;
discriminate.
intros; induction lf1 as [| r3 lf1 Hreclf1].
reflexivity.
simpl in |- *; cut (r = r1).
intro; rewrite H3; rewrite (H0 lf1 r b).
ring.
rewrite H3; apply StepFun_P7 with a r r3; [ right; assumption | assumption ].
clear H H0 Hreclf1 r0; unfold adapted_couple in H1; decompose [and] H1;
intros; simpl in H4; rewrite H4; unfold Rmin in |- *;
case (Rle_dec a b); intro; [ assumption | reflexivity ].
unfold adapted_couple in H1; decompose [and] H1; intros; apply Rle_antisym.
apply (H3 0%nat); simpl in |- *; apply lt_O_Sn.
simpl in H5; rewrite H2 in H5; rewrite H5; replace (Rmin b b) with (Rmax a b);
[ rewrite <- H4; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ]
| unfold Rmin, Rmax in |- *; case (Rle_dec b b); case (Rle_dec a b); intros;
try assumption || reflexivity ].
Qed.
Lemma StepFun_P9 :
forall (a b:R) (f:R -> R) (l lf:Rlist),
adapted_couple f a b l lf -> a <> b -> (2 <= Rlength l)%nat.
Proof.
intros; unfold adapted_couple in H; decompose [and] H; clear H;
induction l as [| r l Hrecl];
[ simpl in H4; discriminate
| induction l as [| r0 l Hrecl0];
[ simpl in H3; simpl in H2; generalize H3; generalize H2;
unfold Rmin, Rmax in |- *; case (Rle_dec a b);
intros; elim H0; rewrite <- H5; rewrite <- H7;
reflexivity
| simpl in |- *; do 2 apply le_n_S; apply le_O_n ] ].
Qed.
Lemma StepFun_P10 :
forall (f:R -> R) (l lf:Rlist) (a b:R),
a <= b ->
adapted_couple f a b l lf ->
exists l' : Rlist,
(exists lf' : Rlist, adapted_couple_opt f a b l' lf').
Proof.
simple induction l.
intros; unfold adapted_couple in H0; decompose [and] H0; simpl in H4;
discriminate.
intros; case (Req_dec a b); intro.
exists (cons a nil); exists nil; unfold adapted_couple_opt in |- *;
unfold adapted_couple in |- *; unfold ordered_Rlist in |- *;
repeat split; try (intros; simpl in H3; elim (lt_n_O _ H3)).
simpl in |- *; rewrite <- H2; unfold Rmin in |- *; case (Rle_dec a a); intro;
reflexivity.
simpl in |- *; rewrite <- H2; unfold Rmax in |- *; case (Rle_dec a a); intro;
reflexivity.
elim (RList_P20 _ (StepFun_P9 H1 H2)); intros t1 [t2 [t3 H3]];
induction lf as [| r1 lf Hreclf].
unfold adapted_couple in H1; decompose [and] H1; rewrite H3 in H7;
simpl in H7; discriminate.
clear Hreclf; assert (H4 : adapted_couple f t2 b r0 lf).
rewrite H3 in H1; assert (H4 := RList_P21 _ _ H3); simpl in H4; rewrite H4;
eapply StepFun_P7; [ apply H0 | apply H1 ].
cut (t2 <= b).
intro; assert (H6 := H _ _ _ H5 H4); case (Req_dec t1 t2); intro Hyp_eq.
replace a with t2.
apply H6.
rewrite <- Hyp_eq; rewrite H3 in H1; unfold adapted_couple in H1;
decompose [and] H1; clear H1; simpl in H9; rewrite H9;
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
elim H6; clear H6; intros l' [lf' H6]; case (Req_dec t2 b); intro.
exists (cons a (cons b nil)); exists (cons r1 nil);
unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *;
repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H8; inversion H8;
[ simpl in |- *; assumption | elim (le_Sn_O _ H10) ].
simpl in |- *; unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
simpl in |- *; unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
intros; simpl in H8; inversion H8.
unfold constant_D_eq, open_interval in |- *; intros; simpl in |- *;
simpl in H9; rewrite H3 in H1; unfold adapted_couple in H1;
decompose [and] H1; apply (H16 0%nat).
simpl in |- *; apply lt_O_Sn.
unfold open_interval in |- *; simpl in |- *; rewrite H7; simpl in H13;
rewrite H13; unfold Rmin in |- *; case (Rle_dec a b);
intro; [ assumption | elim n; assumption ].
elim (le_Sn_O _ H10).
intros; simpl in H8; elim (lt_n_O _ H8).
intros; simpl in H8; inversion H8;
[ simpl in |- *; assumption | elim (le_Sn_O _ H10) ].
assert (Hyp_min : Rmin t2 b = t2).
unfold Rmin in |- *; case (Rle_dec t2 b); intro;
[ reflexivity | elim n; assumption ].
unfold adapted_couple in H6; elim H6; clear H6; intros;
elim (RList_P20 _ (StepFun_P9 H6 H7)); intros s1 [s2 [s3 H9]];
induction lf' as [| r2 lf' Hreclf'].
unfold adapted_couple in H6; decompose [and] H6; rewrite H9 in H13;
simpl in H13; discriminate.
clear Hreclf'; case (Req_dec r1 r2); intro.
case (Req_dec (f t2) r1); intro.
exists (cons t1 (cons s2 s3)); exists (cons r1 lf'); rewrite H3 in H1;
rewrite H9 in H6; unfold adapted_couple in H6, H1;
decompose [and] H1; decompose [and] H6; clear H1 H6;
unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *;
repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H1;
induction i as [| i Hreci].
simpl in |- *; apply Rle_trans with s1.
replace s1 with t2.
apply (H12 0%nat).
simpl in |- *; apply lt_O_Sn.
simpl in H19; rewrite H19; symmetry in |- *; apply Hyp_min.
apply (H16 0%nat); simpl in |- *; apply lt_O_Sn.
change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)) in |- *;
apply (H16 (S i)); simpl in |- *; assumption.
simpl in |- *; simpl in H14; rewrite H14; reflexivity.
simpl in |- *; simpl in H18; rewrite H18; unfold Rmax in |- *;
case (Rle_dec a b); case (Rle_dec t2 b); intros; reflexivity || elim n;
assumption.
simpl in |- *; simpl in H20; apply H20.
intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; simpl in H6; case (total_order_T x t2); intro.
elim s; intro.
apply (H17 0%nat);
[ simpl in |- *; apply lt_O_Sn
| unfold open_interval in |- *; simpl in |- *; elim H6; intros; split;
assumption ].
rewrite b0; assumption.
rewrite H10; apply (H22 0%nat);
[ simpl in |- *; apply lt_O_Sn
| unfold open_interval in |- *; simpl in |- *; replace s1 with t2;
[ elim H6; intros; split; assumption
| simpl in H19; rewrite H19; rewrite Hyp_min; reflexivity ] ].
simpl in |- *; simpl in H6; apply (H22 (S i));
[ simpl in |- *; assumption
| unfold open_interval in |- *; simpl in |- *; apply H6 ].
intros; simpl in H1; rewrite H10;
change
(pos_Rl (cons r2 lf') i <> pos_Rl (cons r2 lf') (S i) \/
f (pos_Rl (cons s1 (cons s2 s3)) (S i)) <> pos_Rl (cons r2 lf') i)
in |- *; rewrite <- H9; elim H8; intros; apply H6;
simpl in |- *; apply H1.
intros; induction i as [| i Hreci].
simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym.
apply (H12 0%nat); simpl in |- *; apply lt_O_Sn.
rewrite <- Hyp_min; rewrite H6; simpl in H19; rewrite <- H19;
apply (H16 0%nat); simpl in |- *; apply lt_O_Sn.
elim H8; intros; rewrite H9 in H21; apply (H21 (S i)); simpl in |- *;
simpl in H1; apply H1.
exists (cons t1 l'); exists (cons r1 (cons r2 lf')); rewrite H9 in H6;
rewrite H3 in H1; unfold adapted_couple in H1, H6;
decompose [and] H6; decompose [and] H1; clear H6 H1;
unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *;
repeat split.
rewrite H9; unfold ordered_Rlist in |- *; intros; simpl in H1;
induction i as [| i Hreci].
simpl in |- *; replace s1 with t2.
apply (H16 0%nat); simpl in |- *; apply lt_O_Sn.
simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity.
change
(pos_Rl (cons s1 (cons s2 s3)) i <= pos_Rl (cons s1 (cons s2 s3)) (S i))
in |- *; apply (H12 i); simpl in |- *; apply lt_S_n;
assumption.
simpl in |- *; simpl in H19; apply H19.
rewrite H9; simpl in |- *; simpl in H13; rewrite H13; unfold Rmax in |- *;
case (Rle_dec t2 b); case (Rle_dec a b); intros; reflexivity || elim n;
assumption.
rewrite H9; simpl in |- *; simpl in H15; rewrite H15; reflexivity.
intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; rewrite H9 in H6; simpl in H6; apply (H22 0%nat).
simpl in |- *; apply lt_O_Sn.
unfold open_interval in |- *; simpl in |- *.
replace t2 with s1.
assumption.
simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity.
change (f x = pos_Rl (cons r2 lf') i) in |- *; clear Hreci; apply (H17 i).
simpl in |- *; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1.
rewrite H9 in H6; unfold open_interval in |- *; apply H6.
intros; simpl in H1; induction i as [| i Hreci].
simpl in |- *; rewrite H9; right; simpl in |- *; replace s1 with t2.
assumption.
simpl in H14; rewrite H14; rewrite Hyp_min; reflexivity.
elim H8; intros; apply (H6 i).
simpl in |- *; apply lt_S_n; apply H1.
intros; rewrite H9; induction i as [| i Hreci].
simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym.
apply (H16 0%nat); simpl in |- *; apply lt_O_Sn.
rewrite <- Hyp_min; rewrite H6; simpl in H14; rewrite <- H14; right;
reflexivity.
elim H8; intros; rewrite <- H9; apply (H21 i); rewrite H9; rewrite H9 in H1;
simpl in |- *; simpl in H1; apply lt_S_n; apply H1.
exists (cons t1 l'); exists (cons r1 (cons r2 lf')); rewrite H9 in H6;
rewrite H3 in H1; unfold adapted_couple in H1, H6;
decompose [and] H6; decompose [and] H1; clear H6 H1;
unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *;
repeat split.
rewrite H9; unfold ordered_Rlist in |- *; intros; simpl in H1;
induction i as [| i Hreci].
simpl in |- *; replace s1 with t2.
apply (H15 0%nat); simpl in |- *; apply lt_O_Sn.
simpl in H13; rewrite H13; rewrite Hyp_min; reflexivity.
change
(pos_Rl (cons s1 (cons s2 s3)) i <= pos_Rl (cons s1 (cons s2 s3)) (S i))
in |- *; apply (H11 i); simpl in |- *; apply lt_S_n;
assumption.
simpl in |- *; simpl in H18; apply H18.
rewrite H9; simpl in |- *; simpl in H12; rewrite H12; unfold Rmax in |- *;
case (Rle_dec t2 b); case (Rle_dec a b); intros; reflexivity || elim n;
assumption.
rewrite H9; simpl in |- *; simpl in H14; rewrite H14; reflexivity.
intros; simpl in H1; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; rewrite H9 in H6; simpl in H6; apply (H21 0%nat).
simpl in |- *; apply lt_O_Sn.
unfold open_interval in |- *; simpl in |- *; replace t2 with s1.
assumption.
simpl in H13; rewrite H13; rewrite Hyp_min; reflexivity.
change (f x = pos_Rl (cons r2 lf') i) in |- *; clear Hreci; apply (H16 i).
simpl in |- *; rewrite H9 in H1; simpl in H1; apply lt_S_n; apply H1.
rewrite H9 in H6; unfold open_interval in |- *; apply H6.
intros; simpl in H1; induction i as [| i Hreci].
simpl in |- *; left; assumption.
elim H8; intros; apply (H6 i).
simpl in |- *; apply lt_S_n; apply H1.
intros; rewrite H9; induction i as [| i Hreci].
simpl in |- *; red in |- *; intro; elim Hyp_eq; apply Rle_antisym.
apply (H15 0%nat); simpl in |- *; apply lt_O_Sn.
rewrite <- Hyp_min; rewrite H6; simpl in H13; rewrite <- H13; right;
reflexivity.
elim H8; intros; rewrite <- H9; apply (H20 i); rewrite H9; rewrite H9 in H1;
simpl in |- *; simpl in H1; apply lt_S_n; apply H1.
rewrite H3 in H1; clear H4; unfold adapted_couple in H1; decompose [and] H1;
clear H1; clear H H7 H9; cut (Rmax a b = b);
[ intro; rewrite H in H5; rewrite <- H5; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ]
| unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ] ].
Qed.
Lemma StepFun_P11 :
forall (a b r r1 r3 s1 s2 r4:R) (r2 lf1 s3 lf2:Rlist)
(f:R -> R),
a < b ->
adapted_couple f a b (cons r (cons r1 r2)) (cons r3 lf1) ->
adapted_couple_opt f a b (cons s1 (cons s2 s3)) (cons r4 lf2) -> r1 <= s2.
Proof.
intros; unfold adapted_couple_opt in H1; elim H1; clear H1; intros;
unfold adapted_couple in H0, H1; decompose [and] H0;
decompose [and] H1; clear H0 H1; assert (H12 : r = s1).
simpl in H10; simpl in H5; rewrite H10; rewrite H5; reflexivity.
assert (H14 := H3 0%nat (lt_O_Sn _)); simpl in H14; elim H14; intro.
assert (H15 := H7 0%nat (lt_O_Sn _)); simpl in H15; elim H15; intro.
rewrite <- H12 in H1; case (Rle_dec r1 s2); intro; try assumption.
assert (H16 : s2 < r1); auto with real.
induction s3 as [| r0 s3 Hrecs3].
simpl in H9; rewrite H9 in H16; cut (r1 <= Rmax a b).
intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H17 H16)).
rewrite <- H4; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ].
clear Hrecs3; induction lf2 as [| r5 lf2 Hreclf2].
simpl in H11; discriminate.
clear Hreclf2; assert (H17 : r3 = r4).
set (x := (r + s2) / 2); assert (H17 := H8 0%nat (lt_O_Sn _));
assert (H18 := H13 0%nat (lt_O_Sn _));
unfold constant_D_eq, open_interval in H17, H18; simpl in H17;
simpl in H18; rewrite <- (H17 x).
rewrite <- (H18 x).
reflexivity.
rewrite <- H12; unfold x in |- *; split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite (Rplus_comm r); rewrite double;
apply Rplus_lt_compat_l; assumption
| discrR ] ].
unfold x in |- *; split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rlt_trans with s2;
[ apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2));
rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite (Rplus_comm r); rewrite double;
apply Rplus_lt_compat_l; assumption
| discrR ] ]
| assumption ].
assert (H18 : f s2 = r3).
apply (H8 0%nat);
[ simpl in |- *; apply lt_O_Sn
| unfold open_interval in |- *; simpl in |- *; split; assumption ].
assert (H19 : r3 = r5).
assert (H19 := H7 1%nat); simpl in H19;
assert (H20 := H19 (lt_n_S _ _ (lt_O_Sn _))); elim H20;
intro.
set (x := (s2 + Rmin r1 r0) / 2); assert (H22 := H8 0%nat);
assert (H23 := H13 1%nat); simpl in H22; simpl in H23;
rewrite <- (H22 (lt_O_Sn _) x).
rewrite <- (H23 (lt_n_S _ _ (lt_O_Sn _)) x).
reflexivity.
unfold open_interval in |- *; simpl in |- *; unfold x in |- *; split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l;
unfold Rmin in |- *; case (Rle_dec r1 r0); intro;
assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
apply Rlt_le_trans with (r0 + Rmin r1 r0);
[ do 2 rewrite <- (Rplus_comm (Rmin r1 r0)); apply Rplus_lt_compat_l;
assumption
| apply Rplus_le_compat_l; apply Rmin_r ]
| discrR ] ].
unfold open_interval in |- *; simpl in |- *; unfold x in |- *; split.
apply Rlt_trans with s2;
[ assumption
| apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2));
rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l;
unfold Rmin in |- *; case (Rle_dec r1 r0);
intro; assumption
| discrR ] ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
apply Rlt_le_trans with (r1 + Rmin r1 r0);
[ do 2 rewrite <- (Rplus_comm (Rmin r1 r0)); apply Rplus_lt_compat_l;
assumption
| apply Rplus_le_compat_l; apply Rmin_l ]
| discrR ] ].
elim H2; clear H2; intros; assert (H23 := H22 1%nat); simpl in H23;
assert (H24 := H23 (lt_n_S _ _ (lt_O_Sn _))); elim H24;
assumption.
elim H2; intros; assert (H22 := H20 0%nat); simpl in H22;
assert (H23 := H22 (lt_O_Sn _)); elim H23; intro;
[ elim H24; rewrite <- H17; rewrite <- H19; reflexivity
| elim H24; rewrite <- H17; assumption ].
elim H2; clear H2; intros; assert (H17 := H16 0%nat); simpl in H17;
elim (H17 (lt_O_Sn _)); assumption.
rewrite <- H0; rewrite H12; apply (H7 0%nat); simpl in |- *; apply lt_O_Sn.
Qed.
Lemma StepFun_P12 :
forall (a b:R) (f:R -> R) (l lf:Rlist),
adapted_couple_opt f a b l lf -> adapted_couple_opt f b a l lf.
Proof.
unfold adapted_couple_opt in |- *; unfold adapted_couple in |- *; intros;
decompose [and] H; clear H; repeat split; try assumption.
rewrite H0; unfold Rmin in |- *; case (Rle_dec a b); intro;
case (Rle_dec b a); intro; try reflexivity.
apply Rle_antisym; assumption.
apply Rle_antisym; auto with real.
rewrite H3; unfold Rmax in |- *; case (Rle_dec a b); intro;
case (Rle_dec b a); intro; try reflexivity.
apply Rle_antisym; assumption.
apply Rle_antisym; auto with real.
Qed.
Lemma StepFun_P13 :
forall (a b r r1 r3 s1 s2 r4:R) (r2 lf1 s3 lf2:Rlist)
(f:R -> R),
a <> b ->
adapted_couple f a b (cons r (cons r1 r2)) (cons r3 lf1) ->
adapted_couple_opt f a b (cons s1 (cons s2 s3)) (cons r4 lf2) -> r1 <= s2.
Proof.
intros; case (total_order_T a b); intro.
elim s; intro.
eapply StepFun_P11; [ apply a0 | apply H0 | apply H1 ].
elim H; assumption.
eapply StepFun_P11;
[ apply r0 | apply StepFun_P2; apply H0 | apply StepFun_P12; apply H1 ].
Qed.
Lemma StepFun_P14 :
forall (f:R -> R) (l1 l2 lf1 lf2:Rlist) (a b:R),
a <= b ->
adapted_couple f a b l1 lf1 ->
adapted_couple_opt f a b l2 lf2 -> Int_SF lf1 l1 = Int_SF lf2 l2.
Proof.
simple induction l1.
intros l2 lf1 lf2 a b Hyp H H0; unfold adapted_couple in H; decompose [and] H;
clear H H0 H2 H3 H1 H6; simpl in H4; discriminate.
simple induction r0.
intros; case (Req_dec a b); intro.
unfold adapted_couple_opt in H2; elim H2; intros; rewrite (StepFun_P8 H4 H3);
rewrite (StepFun_P8 H1 H3); reflexivity.
assert (H4 := StepFun_P9 H1 H3); simpl in H4;
elim (le_Sn_O _ (le_S_n _ _ H4)).
intros; clear H; unfold adapted_couple_opt in H3; elim H3; clear H3; intros;
case (Req_dec a b); intro.
rewrite (StepFun_P8 H2 H4); rewrite (StepFun_P8 H H4); reflexivity.
assert (Hyp_min : Rmin a b = a).
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
assert (Hyp_max : Rmax a b = b).
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
elim (RList_P20 _ (StepFun_P9 H H4)); intros s1 [s2 [s3 H5]]; rewrite H5 in H;
rewrite H5; induction lf1 as [| r3 lf1 Hreclf1].
unfold adapted_couple in H2; decompose [and] H2;
clear H H2 H4 H5 H3 H6 H8 H7 H11; simpl in H9; discriminate.
clear Hreclf1; induction lf2 as [| r4 lf2 Hreclf2].
unfold adapted_couple in H; decompose [and] H;
clear H H2 H4 H5 H3 H6 H8 H7 H11; simpl in H9; discriminate.
clear Hreclf2; assert (H6 : r = s1).
unfold adapted_couple in H, H2; decompose [and] H; decompose [and] H2;
clear H H2; simpl in H13; simpl in H8; rewrite H13;
rewrite H8; reflexivity.
assert (H7 : r3 = r4 \/ r = r1).
case (Req_dec r r1); intro.
right; assumption.
left; cut (r1 <= s2).
intro; unfold adapted_couple in H2, H; decompose [and] H; decompose [and] H2;
clear H H2; set (x := (r + r1) / 2); assert (H18 := H14 0%nat);
assert (H20 := H19 0%nat); unfold constant_D_eq, open_interval in H18, H20;
simpl in H18; simpl in H20; rewrite <- (H18 (lt_O_Sn _) x).
rewrite <- (H20 (lt_O_Sn _) x).
reflexivity.
assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21; intro;
[ idtac | elim H7; assumption ]; unfold x in |- *;
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double;
apply Rplus_lt_compat_l; apply H
| discrR ] ].
rewrite <- H6; assert (H21 := H13 0%nat (lt_O_Sn _)); simpl in H21; elim H21;
intro; [ idtac | elim H7; assumption ]; unfold x in |- *;
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; apply H
| discrR ] ].
apply Rlt_le_trans with r1;
[ apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2));
rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite <- (Rplus_comm r1); rewrite double;
apply Rplus_lt_compat_l; apply H
| discrR ] ]
| assumption ].
eapply StepFun_P13.
apply H4.
apply H2.
unfold adapted_couple_opt in |- *; split.
apply H.
rewrite H5 in H3; apply H3.
assert (H8 : r1 <= s2).
eapply StepFun_P13.
apply H4.
apply H2.
unfold adapted_couple_opt in |- *; split.
apply H.
rewrite H5 in H3; apply H3.
elim H7; intro.
simpl in |- *; elim H8; intro.
replace (r4 * (s2 - s1)) with (r3 * (r1 - r) + r3 * (s2 - r1));
[ idtac | rewrite H9; rewrite H6; ring ].
rewrite Rplus_assoc; apply Rplus_eq_compat_l;
change
(Int_SF lf1 (cons r1 r2) = Int_SF (cons r3 lf2) (cons r1 (cons s2 s3)))
in |- *; apply H0 with r1 b.
unfold adapted_couple in H2; decompose [and] H2; clear H2;
replace b with (Rmax a b).
rewrite <- H12; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ].
eapply StepFun_P7.
apply H1.
apply H2.
unfold adapted_couple_opt in |- *; split.
apply StepFun_P7 with a a r3.
apply H1.
unfold adapted_couple in H2, H; decompose [and] H2; decompose [and] H;
clear H H2; assert (H20 : r = a).
simpl in H13; rewrite H13; apply Hyp_min.
unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci].
simpl in |- *; rewrite <- H20; apply (H11 0%nat).
simpl in |- *; apply lt_O_Sn.
induction i as [| i Hreci0].
simpl in |- *; assumption.
change (pos_Rl (cons s2 s3) i <= pos_Rl (cons s2 s3) (S i)) in |- *;
apply (H15 (S i)); simpl in |- *; apply lt_S_n; assumption.
simpl in |- *; symmetry in |- *; apply Hyp_min.
rewrite <- H17; reflexivity.
simpl in H19; simpl in |- *; rewrite H19; reflexivity.
intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; apply (H16 0%nat).
simpl in |- *; apply lt_O_Sn.
simpl in H2; rewrite <- H20 in H2; unfold open_interval in |- *;
simpl in |- *; apply H2.
clear Hreci; induction i as [| i Hreci].
simpl in |- *; simpl in H2; rewrite H9; apply (H21 0%nat).
simpl in |- *; apply lt_O_Sn.
unfold open_interval in |- *; simpl in |- *; elim H2; intros; split.
apply Rle_lt_trans with r1; try assumption; rewrite <- H6; apply (H11 0%nat);
simpl in |- *; apply lt_O_Sn.
assumption.
clear Hreci; simpl in |- *; apply (H21 (S i)).
simpl in |- *; apply lt_S_n; assumption.
unfold open_interval in |- *; apply H2.
elim H3; clear H3; intros; split.
rewrite H9;
change
(forall i:nat,
(i < pred (Rlength (cons r4 lf2)))%nat ->
pos_Rl (cons r4 lf2) i <> pos_Rl (cons r4 lf2) (S i) \/
f (pos_Rl (cons s1 (cons s2 s3)) (S i)) <> pos_Rl (cons r4 lf2) i)
in |- *; rewrite <- H5; apply H3.
rewrite H5 in H11; intros; simpl in H12; induction i as [| i Hreci].
simpl in |- *; red in |- *; intro; rewrite H13 in H10;
elim (Rlt_irrefl _ H10).
clear Hreci; apply (H11 (S i)); simpl in |- *; apply H12.
rewrite H9; rewrite H10; rewrite H6; apply Rplus_eq_compat_l; rewrite <- H10;
apply H0 with r1 b.
unfold adapted_couple in H2; decompose [and] H2; clear H2;
replace b with (Rmax a b).
rewrite <- H12; apply RList_P7;
[ assumption | simpl in |- *; right; left; reflexivity ].
eapply StepFun_P7.
apply H1.
apply H2.
unfold adapted_couple_opt in |- *; split.
apply StepFun_P7 with a a r3.
apply H1.
unfold adapted_couple in H2, H; decompose [and] H2; decompose [and] H;
clear H H2; assert (H20 : r = a).
simpl in H13; rewrite H13; apply Hyp_min.
unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci].
simpl in |- *; rewrite <- H20; apply (H11 0%nat); simpl in |- *;
apply lt_O_Sn.
rewrite H10; apply (H15 (S i)); simpl in |- *; assumption.
simpl in |- *; symmetry in |- *; apply Hyp_min.
rewrite <- H17; rewrite H10; reflexivity.
simpl in H19; simpl in |- *; apply H19.
intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; apply (H16 0%nat).
simpl in |- *; apply lt_O_Sn.
simpl in H2; rewrite <- H20 in H2; unfold open_interval in |- *;
simpl in |- *; apply H2.
clear Hreci; simpl in |- *; apply (H21 (S i)).
simpl in |- *; assumption.
rewrite <- H10; unfold open_interval in |- *; apply H2.
elim H3; clear H3; intros; split.
rewrite H5 in H3; intros; apply (H3 (S i)).
simpl in |- *; replace (Rlength lf2) with (S (pred (Rlength lf2))).
apply lt_n_S; apply H12.
symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *;
intro; rewrite <- H13 in H12; elim (lt_n_O _ H12).
intros; simpl in H12; rewrite H10; rewrite H5 in H11; apply (H11 (S i));
simpl in |- *; apply lt_n_S; apply H12.
simpl in |- *; rewrite H9; unfold Rminus in |- *; rewrite Rplus_opp_r;
rewrite Rmult_0_r; rewrite Rplus_0_l;
change
(Int_SF lf1 (cons r1 r2) = Int_SF (cons r4 lf2) (cons s1 (cons s2 s3)))
in |- *; eapply H0.
apply H1.
2: rewrite H5 in H3; unfold adapted_couple_opt in |- *; split; assumption.
assert (H10 : r = a).
unfold adapted_couple in H2; decompose [and] H2; clear H2; simpl in H12;
rewrite H12; apply Hyp_min.
rewrite <- H9; rewrite H10; apply StepFun_P7 with a r r3;
[ apply H1
| pattern a at 2 in |- *; rewrite <- H10; pattern r at 2 in |- *; rewrite H9;
apply H2 ].
Qed.
Lemma StepFun_P15 :
forall (f:R -> R) (l1 l2 lf1 lf2:Rlist) (a b:R),
adapted_couple f a b l1 lf1 ->
adapted_couple_opt f a b l2 lf2 -> Int_SF lf1 l1 = Int_SF lf2 l2.
Proof.
intros; case (Rle_dec a b); intro;
[ apply (StepFun_P14 r H H0)
| assert (H1 : b <= a);
[ auto with real
| eapply StepFun_P14;
[ apply H1 | apply StepFun_P2; apply H | apply StepFun_P12; apply H0 ] ] ].
Qed.
Lemma StepFun_P16 :
forall (f:R -> R) (l lf:Rlist) (a b:R),
adapted_couple f a b l lf ->
exists l' : Rlist,
(exists lf' : Rlist, adapted_couple_opt f a b l' lf').
Proof.
intros; case (Rle_dec a b); intro;
[ apply (StepFun_P10 r H)
| assert (H1 : b <= a);
[ auto with real
| assert (H2 := StepFun_P10 H1 (StepFun_P2 H)); elim H2;
intros l' [lf' H3]; exists l'; exists lf'; apply StepFun_P12;
assumption ] ].
Qed.
Lemma StepFun_P17 :
forall (f:R -> R) (l1 l2 lf1 lf2:Rlist) (a b:R),
adapted_couple f a b l1 lf1 ->
adapted_couple f a b l2 lf2 -> Int_SF lf1 l1 = Int_SF lf2 l2.
Proof.
intros; elim (StepFun_P16 H); intros l' [lf' H1]; rewrite (StepFun_P15 H H1);
rewrite (StepFun_P15 H0 H1); reflexivity.
Qed.
Lemma StepFun_P18 :
forall a b c:R, RiemannInt_SF (mkStepFun (StepFun_P4 a b c)) = c * (b - a).
Proof.
intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro.
replace
(Int_SF (subdivision_val (mkStepFun (StepFun_P4 a b c)))
(subdivision (mkStepFun (StepFun_P4 a b c)))) with
(Int_SF (cons c nil) (cons a (cons b nil)));
[ simpl in |- *; ring
| apply StepFun_P17 with (fct_cte c) a b;
[ apply StepFun_P3; assumption
| apply (StepFun_P1 (mkStepFun (StepFun_P4 a b c))) ] ].
replace
(Int_SF (subdivision_val (mkStepFun (StepFun_P4 a b c)))
(subdivision (mkStepFun (StepFun_P4 a b c)))) with
(Int_SF (cons c nil) (cons b (cons a nil)));
[ simpl in |- *; ring
| apply StepFun_P17 with (fct_cte c) a b;
[ apply StepFun_P2; apply StepFun_P3; auto with real
| apply (StepFun_P1 (mkStepFun (StepFun_P4 a b c))) ] ].
Qed.
Lemma StepFun_P19 :
forall (l1:Rlist) (f g:R -> R) (l:R),
Int_SF (FF l1 (fun x:R => f x + l * g x)) l1 =
Int_SF (FF l1 f) l1 + l * Int_SF (FF l1 g) l1.
Proof.
intros; induction l1 as [| r l1 Hrecl1];
[ simpl in |- *; ring
| induction l1 as [| r0 l1 Hrecl0]; simpl in |- *;
[ ring | simpl in Hrecl1; rewrite Hrecl1; ring ] ].
Qed.
Lemma StepFun_P20 :
forall (l:Rlist) (f:R -> R),
(0 < Rlength l)%nat -> Rlength l = S (Rlength (FF l f)).
Proof.
intros l f H; induction l;
[ elim (lt_irrefl _ H)
| simpl in |- *; rewrite RList_P18; rewrite RList_P14; reflexivity ].
Qed.
Lemma StepFun_P21 :
forall (a b:R) (f:R -> R) (l:Rlist),
is_subdivision f a b l -> adapted_couple f a b l (FF l f).
Proof.
intros; unfold adapted_couple in |- *; unfold is_subdivision in X;
unfold adapted_couple in X; elim X; clear X; intros;
decompose [and] p; clear p; repeat split; try assumption.
apply StepFun_P20; rewrite H2; apply lt_O_Sn.
intros; assert (H5 := H4 _ H3); unfold constant_D_eq, open_interval in H5;
unfold constant_D_eq, open_interval in |- *; intros;
induction l as [| r l Hrecl].
discriminate.
unfold FF in |- *; rewrite RList_P12.
simpl in |- *;
change (f x0 = f (pos_Rl (mid_Rlist (cons r l) r) (S i))) in |- *;
rewrite RList_P13; try assumption; rewrite (H5 x0 H6);
rewrite H5.
reflexivity.
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; elim H6;
intros; apply Rlt_trans with x0; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
rewrite (Rplus_comm (pos_Rl (cons r l) i));
apply Rplus_lt_compat_l; elim H6; intros; apply Rlt_trans with x0;
assumption
| discrR ] ].
rewrite RList_P14; simpl in H3; apply H3.
Qed.
Lemma StepFun_P22 :
forall (a b:R) (f g:R -> R) (lf lg:Rlist),
a <= b ->
is_subdivision f a b lf ->
is_subdivision g a b lg -> is_subdivision f a b (cons_ORlist lf lg).
Proof.
unfold is_subdivision in |- *; intros a b f g lf lg Hyp X X0; elim X; elim X0;
clear X X0; intros lg0 p lf0 p0; assert (Hyp_min : Rmin a b = a).
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
assert (Hyp_max : Rmax a b = b).
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
apply existT with (FF (cons_ORlist lf lg) f); unfold adapted_couple in p, p0;
decompose [and] p; decompose [and] p0; clear p p0;
rewrite Hyp_min in H6; rewrite Hyp_min in H1; rewrite Hyp_max in H0;
rewrite Hyp_max in H5; unfold adapted_couple in |- *;
repeat split.
apply RList_P2; assumption.
rewrite Hyp_min; symmetry in |- *; apply Rle_antisym.
induction lf as [| r lf Hreclf].
simpl in |- *; right; symmetry in |- *; assumption.
assert
(H10 :
In (pos_Rl (cons_ORlist (cons r lf) lg) 0) (cons_ORlist (cons r lf) lg)).
elim
(RList_P3 (cons_ORlist (cons r lf) lg)
(pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros _ H10;
apply H10; exists 0%nat; split;
[ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_O_Sn ].
elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) 0));
intros H12 _; assert (H13 := H12 H10); elim H13; intro.
elim (RList_P3 (cons r lf) (pos_Rl (cons_ORlist (cons r lf) lg) 0));
intros H11 _; assert (H14 := H11 H8); elim H14; intros;
elim H15; clear H15; intros; rewrite H15; rewrite <- H6;
elim (RList_P6 (cons r lf)); intros; apply H17;
[ assumption | apply le_O_n | assumption ].
elim (RList_P3 lg (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros H11 _;
assert (H14 := H11 H8); elim H14; intros; elim H15;
clear H15; intros; rewrite H15; rewrite <- H1; elim (RList_P6 lg);
intros; apply H17; [ assumption | apply le_O_n | assumption ].
induction lf as [| r lf Hreclf].
simpl in |- *; right; assumption.
assert (H8 : In a (cons_ORlist (cons r lf) lg)).
elim (RList_P9 (cons r lf) lg a); intros; apply H10; left;
elim (RList_P3 (cons r lf) a); intros; apply H12;
exists 0%nat; split;
[ symmetry in |- *; assumption | simpl in |- *; apply lt_O_Sn ].
apply RList_P5; [ apply RList_P2; assumption | assumption ].
rewrite Hyp_max; apply Rle_antisym.
induction lf as [| r lf Hreclf].
simpl in |- *; right; assumption.
assert
(H8 :
In
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg))))
(cons_ORlist (cons r lf) lg)).
elim
(RList_P3 (cons_ORlist (cons r lf) lg)
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros _ H10; apply H10;
exists (pred (Rlength (cons_ORlist (cons r lf) lg)));
split; [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_n_Sn ].
elim
(RList_P9 (cons r lf) lg
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H10 _.
assert (H11 := H10 H8); elim H11; intro.
elim
(RList_P3 (cons r lf)
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H13 _; assert (H14 := H13 H12); elim H14; intros;
elim H15; clear H15; intros; rewrite H15; rewrite <- H5;
elim (RList_P6 (cons r lf)); intros; apply H17;
[ assumption
| simpl in |- *; simpl in H14; apply lt_n_Sm_le; assumption
| simpl in |- *; apply lt_n_Sn ].
elim
(RList_P3 lg
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H13 _; assert (H14 := H13 H12); elim H14; intros;
elim H15; clear H15; intros.
rewrite H15; assert (H17 : Rlength lg = S (pred (Rlength lg))).
apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro;
rewrite <- H17 in H16; elim (lt_n_O _ H16).
rewrite <- H0; elim (RList_P6 lg); intros; apply H18;
[ assumption
| rewrite H17 in H16; apply lt_n_Sm_le; assumption
| apply lt_pred_n_n; rewrite H17; apply lt_O_Sn ].
induction lf as [| r lf Hreclf].
simpl in |- *; right; symmetry in |- *; assumption.
assert (H8 : In b (cons_ORlist (cons r lf) lg)).
elim (RList_P9 (cons r lf) lg b); intros; apply H10; left;
elim (RList_P3 (cons r lf) b); intros; apply H12;
exists (pred (Rlength (cons r lf))); split;
[ symmetry in |- *; assumption | simpl in |- *; apply lt_n_Sn ].
apply RList_P7; [ apply RList_P2; assumption | assumption ].
apply StepFun_P20; rewrite RList_P11; rewrite H2; rewrite H7; simpl in |- *;
apply lt_O_Sn.
intros; unfold constant_D_eq, open_interval in |- *; intros;
cut
(exists l : R,
constant_D_eq f
(open_interval (pos_Rl (cons_ORlist lf lg) i)
(pos_Rl (cons_ORlist lf lg) (S i))) l).
intros; elim H11; clear H11; intros; assert (H12 := H11);
assert
(Hyp_cons :
exists r : R, (exists r0 : Rlist, cons_ORlist lf lg = cons r r0)).
apply RList_P19; red in |- *; intro; rewrite H13 in H8; elim (lt_n_O _ H8).
elim Hyp_cons; clear Hyp_cons; intros r [r0 Hyp_cons]; rewrite Hyp_cons;
unfold FF in |- *; rewrite RList_P12.
change (f x = f (pos_Rl (mid_Rlist (cons r r0) r) (S i))) in |- *;
rewrite <- Hyp_cons; rewrite RList_P13.
assert (H13 := RList_P2 _ _ H _ H8); elim H13; intro.
unfold constant_D_eq, open_interval in H11, H12; rewrite (H11 x H10);
assert
(H15 :
pos_Rl (cons_ORlist lf lg) i <
(pos_Rl (cons_ORlist lf lg) i + pos_Rl (cons_ORlist lf lg) (S i)) / 2 <
pos_Rl (cons_ORlist lf lg) (S i)).
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
rewrite (Rplus_comm (pos_Rl (cons_ORlist lf lg) i));
apply Rplus_lt_compat_l; assumption
| discrR ] ].
rewrite (H11 _ H15); reflexivity.
elim H10; intros; rewrite H14 in H15;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H16 H15)).
apply H8.
rewrite RList_P14; rewrite Hyp_cons in H8; simpl in H8; apply H8.
assert (H11 : a < b).
apply Rle_lt_trans with (pos_Rl (cons_ORlist lf lg) i).
rewrite <- H6; rewrite <- (RList_P15 lf lg).
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11.
apply RList_P2; assumption.
apply le_O_n.
apply lt_trans with (pred (Rlength (cons_ORlist lf lg)));
[ assumption
| apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro;
rewrite <- H13 in H8; elim (lt_n_O _ H8) ].
assumption.
assumption.
rewrite H1; assumption.
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)).
elim H10; intros; apply Rlt_trans with x; assumption.
rewrite <- H5; rewrite <- (RList_P16 lf lg); try assumption.
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11.
apply RList_P2; assumption.
apply lt_n_Sm_le; apply lt_n_S; assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H8;
elim (lt_n_O _ H8).
rewrite H0; assumption.
set
(I :=
fun j:nat =>
pos_Rl lf j <= pos_Rl (cons_ORlist lf lg) i /\ (j < Rlength lf)%nat);
assert (H12 : Nbound I).
unfold Nbound in |- *; exists (Rlength lf); intros; unfold I in H12; elim H12;
intros; apply lt_le_weak; assumption.
assert (H13 : exists n : nat, I n).
exists 0%nat; unfold I in |- *; split.
apply Rle_trans with (pos_Rl (cons_ORlist lf lg) 0).
right; symmetry in |- *.
apply RList_P15; try assumption; rewrite H1; assumption.
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H13.
apply RList_P2; assumption.
apply le_O_n.
apply lt_trans with (pred (Rlength (cons_ORlist lf lg))).
assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H15 in H8;
elim (lt_n_O _ H8).
apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H5;
rewrite <- H6 in H11; rewrite <- H5 in H11; elim (Rlt_irrefl _ H11).
assert (H14 := Nzorn H13 H12); elim H14; clear H14; intros x0 H14;
exists (pos_Rl lf0 x0); unfold constant_D_eq, open_interval in |- *;
intros; assert (H16 := H9 x0); assert (H17 : (x0 < pred (Rlength lf))%nat).
elim H14; clear H14; intros; unfold I in H14; elim H14; clear H14; intros;
apply lt_S_n; replace (S (pred (Rlength lf))) with (Rlength lf).
inversion H18.
2: apply lt_n_S; assumption.
cut (x0 = pred (Rlength lf)).
intro; rewrite H19 in H14; rewrite H5 in H14;
cut (pos_Rl (cons_ORlist lf lg) i < b).
intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H14 H21)).
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)).
elim H10; intros; apply Rlt_trans with x; assumption.
rewrite <- H5;
apply Rle_trans with
(pos_Rl (cons_ORlist lf lg) (pred (Rlength (cons_ORlist lf lg)))).
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H21.
apply RList_P2; assumption.
apply lt_n_Sm_le; apply lt_n_S; assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H23 in H8;
elim (lt_n_O _ H8).
right; apply RList_P16; try assumption; rewrite H0; assumption.
rewrite <- H20; reflexivity.
apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro;
rewrite <- H19 in H18; elim (lt_n_O _ H18).
assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18;
rewrite (H18 x1).
reflexivity.
elim H15; clear H15; intros; elim H14; clear H14; intros; unfold I in H14;
elim H14; clear H14; intros; split.
apply Rle_lt_trans with (pos_Rl (cons_ORlist lf lg) i); assumption.
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)); try assumption.
assert (H22 : (S x0 < Rlength lf)%nat).
replace (Rlength lf) with (S (pred (Rlength lf)));
[ apply lt_n_S; assumption
| symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *;
intro; rewrite <- H22 in H21; elim (lt_n_O _ H21) ].
elim (Rle_dec (pos_Rl lf (S x0)) (pos_Rl (cons_ORlist lf lg) i)); intro.
assert (H23 : (S x0 <= x0)%nat).
apply H20; unfold I in |- *; split; assumption.
elim (le_Sn_n _ H23).
assert (H23 : pos_Rl (cons_ORlist lf lg) i < pos_Rl lf (S x0)).
auto with real.
clear b0; apply RList_P17; try assumption.
apply RList_P2; assumption.
elim (RList_P9 lf lg (pos_Rl lf (S x0))); intros; apply H25; left;
elim (RList_P3 lf (pos_Rl lf (S x0))); intros; apply H27;
exists (S x0); split; [ reflexivity | apply H22 ].
Qed.
Lemma StepFun_P23 :
forall (a b:R) (f g:R -> R) (lf lg:Rlist),
is_subdivision f a b lf ->
is_subdivision g a b lg -> is_subdivision f a b (cons_ORlist lf lg).
Proof.
intros; case (Rle_dec a b); intro;
[ apply StepFun_P22 with g; assumption
| apply StepFun_P5; apply StepFun_P22 with g;
[ auto with real
| apply StepFun_P5; assumption
| apply StepFun_P5; assumption ] ].
Qed.
Lemma StepFun_P24 :
forall (a b:R) (f g:R -> R) (lf lg:Rlist),
a <= b ->
is_subdivision f a b lf ->
is_subdivision g a b lg -> is_subdivision g a b (cons_ORlist lf lg).
Proof.
unfold is_subdivision in |- *; intros a b f g lf lg Hyp X X0; elim X; elim X0;
clear X X0; intros lg0 p lf0 p0; assert (Hyp_min : Rmin a b = a).
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
assert (Hyp_max : Rmax a b = b).
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
apply existT with (FF (cons_ORlist lf lg) g); unfold adapted_couple in p, p0;
decompose [and] p; decompose [and] p0; clear p p0;
rewrite Hyp_min in H1; rewrite Hyp_min in H6; rewrite Hyp_max in H0;
rewrite Hyp_max in H5; unfold adapted_couple in |- *;
repeat split.
apply RList_P2; assumption.
rewrite Hyp_min; symmetry in |- *; apply Rle_antisym.
induction lf as [| r lf Hreclf].
simpl in |- *; right; symmetry in |- *; assumption.
assert
(H10 :
In (pos_Rl (cons_ORlist (cons r lf) lg) 0) (cons_ORlist (cons r lf) lg)).
elim
(RList_P3 (cons_ORlist (cons r lf) lg)
(pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros _ H10;
apply H10; exists 0%nat; split;
[ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_O_Sn ].
elim (RList_P9 (cons r lf) lg (pos_Rl (cons_ORlist (cons r lf) lg) 0));
intros H12 _; assert (H13 := H12 H10); elim H13; intro.
elim (RList_P3 (cons r lf) (pos_Rl (cons_ORlist (cons r lf) lg) 0));
intros H11 _; assert (H14 := H11 H8); elim H14; intros;
elim H15; clear H15; intros; rewrite H15; rewrite <- H6;
elim (RList_P6 (cons r lf)); intros; apply H17;
[ assumption | apply le_O_n | assumption ].
elim (RList_P3 lg (pos_Rl (cons_ORlist (cons r lf) lg) 0)); intros H11 _;
assert (H14 := H11 H8); elim H14; intros; elim H15;
clear H15; intros; rewrite H15; rewrite <- H1; elim (RList_P6 lg);
intros; apply H17; [ assumption | apply le_O_n | assumption ].
induction lf as [| r lf Hreclf].
simpl in |- *; right; assumption.
assert (H8 : In a (cons_ORlist (cons r lf) lg)).
elim (RList_P9 (cons r lf) lg a); intros; apply H10; left;
elim (RList_P3 (cons r lf) a); intros; apply H12;
exists 0%nat; split;
[ symmetry in |- *; assumption | simpl in |- *; apply lt_O_Sn ].
apply RList_P5; [ apply RList_P2; assumption | assumption ].
rewrite Hyp_max; apply Rle_antisym.
induction lf as [| r lf Hreclf].
simpl in |- *; right; assumption.
assert
(H8 :
In
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg))))
(cons_ORlist (cons r lf) lg)).
elim
(RList_P3 (cons_ORlist (cons r lf) lg)
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros _ H10; apply H10;
exists (pred (Rlength (cons_ORlist (cons r lf) lg)));
split; [ reflexivity | rewrite RList_P11; simpl in |- *; apply lt_n_Sn ].
elim
(RList_P9 (cons r lf) lg
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H10 _; assert (H11 := H10 H8); elim H11; intro.
elim
(RList_P3 (cons r lf)
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H13 _; assert (H14 := H13 H12); elim H14; intros;
elim H15; clear H15; intros; rewrite H15; rewrite <- H5;
elim (RList_P6 (cons r lf)); intros; apply H17;
[ assumption
| simpl in |- *; simpl in H14; apply lt_n_Sm_le; assumption
| simpl in |- *; apply lt_n_Sn ].
elim
(RList_P3 lg
(pos_Rl (cons_ORlist (cons r lf) lg)
(pred (Rlength (cons_ORlist (cons r lf) lg)))));
intros H13 _; assert (H14 := H13 H12); elim H14; intros;
elim H15; clear H15; intros; rewrite H15;
assert (H17 : Rlength lg = S (pred (Rlength lg))).
apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro;
rewrite <- H17 in H16; elim (lt_n_O _ H16).
rewrite <- H0; elim (RList_P6 lg); intros; apply H18;
[ assumption
| rewrite H17 in H16; apply lt_n_Sm_le; assumption
| apply lt_pred_n_n; rewrite H17; apply lt_O_Sn ].
induction lf as [| r lf Hreclf].
simpl in |- *; right; symmetry in |- *; assumption.
assert (H8 : In b (cons_ORlist (cons r lf) lg)).
elim (RList_P9 (cons r lf) lg b); intros; apply H10; left;
elim (RList_P3 (cons r lf) b); intros; apply H12;
exists (pred (Rlength (cons r lf))); split;
[ symmetry in |- *; assumption | simpl in |- *; apply lt_n_Sn ].
apply RList_P7; [ apply RList_P2; assumption | assumption ].
apply StepFun_P20; rewrite RList_P11; rewrite H7; rewrite H2; simpl in |- *;
apply lt_O_Sn.
unfold constant_D_eq, open_interval in |- *; intros;
cut
(exists l : R,
constant_D_eq g
(open_interval (pos_Rl (cons_ORlist lf lg) i)
(pos_Rl (cons_ORlist lf lg) (S i))) l).
intros; elim H11; clear H11; intros; assert (H12 := H11);
assert
(Hyp_cons :
exists r : R, (exists r0 : Rlist, cons_ORlist lf lg = cons r r0)).
apply RList_P19; red in |- *; intro; rewrite H13 in H8; elim (lt_n_O _ H8).
elim Hyp_cons; clear Hyp_cons; intros r [r0 Hyp_cons]; rewrite Hyp_cons;
unfold FF in |- *; rewrite RList_P12.
change (g x = g (pos_Rl (mid_Rlist (cons r r0) r) (S i))) in |- *;
rewrite <- Hyp_cons; rewrite RList_P13.
assert (H13 := RList_P2 _ _ H _ H8); elim H13; intro.
unfold constant_D_eq, open_interval in H11, H12; rewrite (H11 x H10);
assert
(H15 :
pos_Rl (cons_ORlist lf lg) i <
(pos_Rl (cons_ORlist lf lg) i + pos_Rl (cons_ORlist lf lg) (S i)) / 2 <
pos_Rl (cons_ORlist lf lg) (S i)).
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
rewrite (Rplus_comm (pos_Rl (cons_ORlist lf lg) i));
apply Rplus_lt_compat_l; assumption
| discrR ] ].
rewrite (H11 _ H15); reflexivity.
elim H10; intros; rewrite H14 in H15;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H16 H15)).
apply H8.
rewrite RList_P14; rewrite Hyp_cons in H8; simpl in H8; apply H8.
assert (H11 : a < b).
apply Rle_lt_trans with (pos_Rl (cons_ORlist lf lg) i).
rewrite <- H6; rewrite <- (RList_P15 lf lg); try assumption.
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11.
apply RList_P2; assumption.
apply le_O_n.
apply lt_trans with (pred (Rlength (cons_ORlist lf lg)));
[ assumption
| apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro;
rewrite <- H13 in H8; elim (lt_n_O _ H8) ].
rewrite H1; assumption.
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)).
elim H10; intros; apply Rlt_trans with x; assumption.
rewrite <- H5; rewrite <- (RList_P16 lf lg); try assumption.
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H11.
apply RList_P2; assumption.
apply lt_n_Sm_le; apply lt_n_S; assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H8;
elim (lt_n_O _ H8).
rewrite H0; assumption.
set
(I :=
fun j:nat =>
pos_Rl lg j <= pos_Rl (cons_ORlist lf lg) i /\ (j < Rlength lg)%nat);
assert (H12 : Nbound I).
unfold Nbound in |- *; exists (Rlength lg); intros; unfold I in H12; elim H12;
intros; apply lt_le_weak; assumption.
assert (H13 : exists n : nat, I n).
exists 0%nat; unfold I in |- *; split.
apply Rle_trans with (pos_Rl (cons_ORlist lf lg) 0).
right; symmetry in |- *; rewrite H1; rewrite <- H6; apply RList_P15;
try assumption; rewrite H1; assumption.
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H13;
[ apply RList_P2; assumption
| apply le_O_n
| apply lt_trans with (pred (Rlength (cons_ORlist lf lg)));
[ assumption
| apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro;
rewrite <- H15 in H8; elim (lt_n_O _ H8) ] ].
apply neq_O_lt; red in |- *; intro; rewrite <- H13 in H0;
rewrite <- H1 in H11; rewrite <- H0 in H11; elim (Rlt_irrefl _ H11).
assert (H14 := Nzorn H13 H12); elim H14; clear H14; intros x0 H14;
exists (pos_Rl lg0 x0); unfold constant_D_eq, open_interval in |- *;
intros; assert (H16 := H4 x0); assert (H17 : (x0 < pred (Rlength lg))%nat).
elim H14; clear H14; intros; unfold I in H14; elim H14; clear H14; intros;
apply lt_S_n; replace (S (pred (Rlength lg))) with (Rlength lg).
inversion H18.
2: apply lt_n_S; assumption.
cut (x0 = pred (Rlength lg)).
intro; rewrite H19 in H14; rewrite H0 in H14;
cut (pos_Rl (cons_ORlist lf lg) i < b).
intro; elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H14 H21)).
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)).
elim H10; intros; apply Rlt_trans with x; assumption.
rewrite <- H0;
apply Rle_trans with
(pos_Rl (cons_ORlist lf lg) (pred (Rlength (cons_ORlist lf lg)))).
elim (RList_P6 (cons_ORlist lf lg)); intros; apply H21.
apply RList_P2; assumption.
apply lt_n_Sm_le; apply lt_n_S; assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H23 in H8;
elim (lt_n_O _ H8).
right; rewrite H0; rewrite <- H5; apply RList_P16; try assumption.
rewrite H0; assumption.
rewrite <- H20; reflexivity.
apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro;
rewrite <- H19 in H18; elim (lt_n_O _ H18).
assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18;
rewrite (H18 x1).
reflexivity.
elim H15; clear H15; intros; elim H14; clear H14; intros; unfold I in H14;
elim H14; clear H14; intros; split.
apply Rle_lt_trans with (pos_Rl (cons_ORlist lf lg) i); assumption.
apply Rlt_le_trans with (pos_Rl (cons_ORlist lf lg) (S i)); try assumption.
assert (H22 : (S x0 < Rlength lg)%nat).
replace (Rlength lg) with (S (pred (Rlength lg))).
apply lt_n_S; assumption.
symmetry in |- *; apply S_pred with 0%nat; apply neq_O_lt; red in |- *;
intro; rewrite <- H22 in H21; elim (lt_n_O _ H21).
elim (Rle_dec (pos_Rl lg (S x0)) (pos_Rl (cons_ORlist lf lg) i)); intro.
assert (H23 : (S x0 <= x0)%nat);
[ apply H20; unfold I in |- *; split; assumption | elim (le_Sn_n _ H23) ].
assert (H23 : pos_Rl (cons_ORlist lf lg) i < pos_Rl lg (S x0)).
auto with real.
clear b0; apply RList_P17; try assumption;
[ apply RList_P2; assumption
| elim (RList_P9 lf lg (pos_Rl lg (S x0))); intros; apply H25; right;
elim (RList_P3 lg (pos_Rl lg (S x0))); intros;
apply H27; exists (S x0); split; [ reflexivity | apply H22 ] ].
Qed.
Lemma StepFun_P25 :
forall (a b:R) (f g:R -> R) (lf lg:Rlist),
is_subdivision f a b lf ->
is_subdivision g a b lg -> is_subdivision g a b (cons_ORlist lf lg).
Proof.
intros a b f g lf lg H H0; case (Rle_dec a b); intro;
[ apply StepFun_P24 with f; assumption
| apply StepFun_P5; apply StepFun_P24 with f;
[ auto with real
| apply StepFun_P5; assumption
| apply StepFun_P5; assumption ] ].
Qed.
Lemma StepFun_P26 :
forall (a b l:R) (f g:R -> R) (l1:Rlist),
is_subdivision f a b l1 ->
is_subdivision g a b l1 ->
is_subdivision (fun x:R => f x + l * g x) a b l1.
Proof.
intros a b l f g l1 (x0,(H0,(H1,(H2,(H3,H4)))))
(x,(_,(_,(_,(_,H9))))).
exists (FF l1 (fun x:R => f x + l * g x)); repeat split; try assumption.
apply StepFun_P20; rewrite H3; auto with arith.
intros i H8 x1 H10; unfold open_interval in H10, H9, H4;
rewrite (H9 _ H8 _ H10); rewrite (H4 _ H8 _ H10);
assert (H11 : l1 <> nil).
red in |- *; intro H11; rewrite H11 in H8; elim (lt_n_O _ H8).
destruct (RList_P19 _ H11) as (r,(r0,H12));
rewrite H12; unfold FF in |- *;
change
(pos_Rl x0 i + l * pos_Rl x i =
pos_Rl
(app_Rlist (mid_Rlist (cons r r0) r) (fun x2:R => f x2 + l * g x2))
(S i)) in |- *; rewrite RList_P12.
rewrite RList_P13.
rewrite <- H12; rewrite (H9 _ H8); try rewrite (H4 _ H8);
reflexivity ||
(elim H10; clear H10; intros; split;
[ apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2));
rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l;
apply Rlt_trans with x1; assumption
| discrR ] ]
| apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2));
rewrite <- Rmult_assoc; rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double;
rewrite (Rplus_comm (pos_Rl l1 i)); apply Rplus_lt_compat_l;
apply Rlt_trans with x1; assumption
| discrR ] ] ]).
rewrite <- H12; assumption.
rewrite RList_P14; simpl in |- *; rewrite H12 in H8; simpl in H8;
apply lt_n_S; apply H8.
Qed.
Lemma StepFun_P27 :
forall (a b l:R) (f g:R -> R) (lf lg:Rlist),
is_subdivision f a b lf ->
is_subdivision g a b lg ->
is_subdivision (fun x:R => f x + l * g x) a b (cons_ORlist lf lg).
Proof.
intros a b l f g lf lg H H0; apply StepFun_P26;
[ apply StepFun_P23 with g; assumption
| apply StepFun_P25 with f; assumption ].
Qed.
(** The set of step functions on [a,b] is a vectorial space *)
Lemma StepFun_P28 :
forall (a b l:R) (f g:StepFun a b), IsStepFun (fun x:R => f x + l * g x) a b.
Proof.
intros a b l f g; unfold IsStepFun in |- *; assert (H := pre f);
assert (H0 := pre g); unfold IsStepFun in H, H0; elim H;
elim H0; intros; apply existT with (cons_ORlist x0 x);
apply StepFun_P27; assumption.
Qed.
Lemma StepFun_P29 :
forall (a b:R) (f:StepFun a b), is_subdivision f a b (subdivision f).
Proof.
intros a b f; unfold is_subdivision in |- *;
apply existT with (subdivision_val f); apply StepFun_P1.
Qed.
Lemma StepFun_P30 :
forall (a b l:R) (f g:StepFun a b),
RiemannInt_SF (mkStepFun (StepFun_P28 l f g)) =
RiemannInt_SF f + l * RiemannInt_SF g.
Proof.
intros a b l f g; unfold RiemannInt_SF in |- *; case (Rle_dec a b);
(intro;
replace
(Int_SF (subdivision_val (mkStepFun (StepFun_P28 l f g)))
(subdivision (mkStepFun (StepFun_P28 l f g)))) with
(Int_SF
(FF (cons_ORlist (subdivision f) (subdivision g))
(fun x:R => f x + l * g x))
(cons_ORlist (subdivision f) (subdivision g)));
[ rewrite StepFun_P19;
replace
(Int_SF (FF (cons_ORlist (subdivision f) (subdivision g)) f)
(cons_ORlist (subdivision f) (subdivision g))) with
(Int_SF (subdivision_val f) (subdivision f));
[ replace
(Int_SF (FF (cons_ORlist (subdivision f) (subdivision g)) g)
(cons_ORlist (subdivision f) (subdivision g))) with
(Int_SF (subdivision_val g) (subdivision g));
[ ring
| apply StepFun_P17 with (fe g) a b;
[ apply StepFun_P1
| apply StepFun_P21; apply StepFun_P25 with (fe f);
apply StepFun_P29 ] ]
| apply StepFun_P17 with (fe f) a b;
[ apply StepFun_P1
| apply StepFun_P21; apply StepFun_P23 with (fe g);
apply StepFun_P29 ] ]
| apply StepFun_P17 with (fun x:R => f x + l * g x) a b;
[ apply StepFun_P21; apply StepFun_P27; apply StepFun_P29
| apply (StepFun_P1 (mkStepFun (StepFun_P28 l f g))) ] ]).
Qed.
Lemma StepFun_P31 :
forall (a b:R) (f:R -> R) (l lf:Rlist),
adapted_couple f a b l lf ->
adapted_couple (fun x:R => Rabs (f x)) a b l (app_Rlist lf Rabs).
Proof.
unfold adapted_couple in |- *; intros; decompose [and] H; clear H;
repeat split; try assumption.
symmetry in |- *; rewrite H3; rewrite RList_P18; reflexivity.
intros; unfold constant_D_eq, open_interval in |- *;
unfold constant_D_eq, open_interval in H5; intros;
rewrite (H5 _ H _ H4); rewrite RList_P12;
[ reflexivity | rewrite H3 in H; simpl in H; apply H ].
Qed.
Lemma StepFun_P32 :
forall (a b:R) (f:StepFun a b), IsStepFun (fun x:R => Rabs (f x)) a b.
Proof.
intros a b f; unfold IsStepFun in |- *; apply existT with (subdivision f);
unfold is_subdivision in |- *;
apply existT with (app_Rlist (subdivision_val f) Rabs);
apply StepFun_P31; apply StepFun_P1.
Qed.
Lemma StepFun_P33 :
forall l2 l1:Rlist,
ordered_Rlist l1 -> Rabs (Int_SF l2 l1) <= Int_SF (app_Rlist l2 Rabs) l1.
Proof.
simple induction l2; intros.
simpl in |- *; rewrite Rabs_R0; right; reflexivity.
simpl in |- *; induction l1 as [| r1 l1 Hrecl1].
rewrite Rabs_R0; right; reflexivity.
induction l1 as [| r2 l1 Hrecl0].
rewrite Rabs_R0; right; reflexivity.
apply Rle_trans with (Rabs (r * (r2 - r1)) + Rabs (Int_SF r0 (cons r2 l1))).
apply Rabs_triang.
rewrite Rabs_mult; rewrite (Rabs_right (r2 - r1));
[ apply Rplus_le_compat_l; apply H; apply RList_P4 with r1; assumption
| apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl in |- *;
apply lt_O_Sn ].
Qed.
Lemma StepFun_P34 :
forall (a b:R) (f:StepFun a b),
a <= b ->
Rabs (RiemannInt_SF f) <= RiemannInt_SF (mkStepFun (StepFun_P32 f)).
Proof.
intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro.
replace
(Int_SF (subdivision_val (mkStepFun (StepFun_P32 f)))
(subdivision (mkStepFun (StepFun_P32 f)))) with
(Int_SF (app_Rlist (subdivision_val f) Rabs) (subdivision f)).
apply StepFun_P33; assert (H0 := StepFun_P29 f); unfold is_subdivision in H0;
elim H0; intros; unfold adapted_couple in p; decompose [and] p;
assumption.
apply StepFun_P17 with (fun x:R => Rabs (f x)) a b;
[ apply StepFun_P31; apply StepFun_P1
| apply (StepFun_P1 (mkStepFun (StepFun_P32 f))) ].
elim n; assumption.
Qed.
Lemma StepFun_P35 :
forall (l:Rlist) (a b:R) (f g:R -> R),
ordered_Rlist l ->
pos_Rl l 0 = a ->
pos_Rl l (pred (Rlength l)) = b ->
(forall x:R, a < x < b -> f x <= g x) ->
Int_SF (FF l f) l <= Int_SF (FF l g) l.
Proof.
simple induction l; intros.
right; reflexivity.
simpl in |- *; induction r0 as [| r0 r1 Hrecr0].
right; reflexivity.
simpl in |- *; apply Rplus_le_compat.
case (Req_dec r r0); intro.
rewrite H4; right; ring.
do 2 rewrite <- (Rmult_comm (r0 - r)); apply Rmult_le_compat_l.
apply Rge_le; apply Rge_minus; apply Rle_ge; apply (H0 0%nat); simpl in |- *;
apply lt_O_Sn.
apply H3; split.
apply Rmult_lt_reg_l with 2.
prove_sup0.
unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym.
assert (H5 : r = a).
apply H1.
rewrite H5; rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l.
assert (H6 := H0 0%nat (lt_O_Sn _)).
simpl in H6.
elim H6; intro.
rewrite H5 in H7; apply H7.
elim H4; assumption.
discrR.
apply Rmult_lt_reg_l with 2.
prove_sup0.
unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym.
rewrite Rmult_1_l; rewrite double; assert (H5 : r0 <= b).
replace b with
(pos_Rl (cons r (cons r0 r1)) (pred (Rlength (cons r (cons r0 r1))))).
replace r0 with (pos_Rl (cons r (cons r0 r1)) 1).
elim (RList_P6 (cons r (cons r0 r1))); intros; apply H5.
assumption.
simpl in |- *; apply le_n_S.
apply le_O_n.
simpl in |- *; apply lt_n_Sn.
reflexivity.
apply Rle_lt_trans with (r + b).
apply Rplus_le_compat_l; assumption.
rewrite (Rplus_comm r); apply Rplus_lt_compat_l.
apply Rlt_le_trans with r0.
assert (H6 := H0 0%nat (lt_O_Sn _)).
simpl in H6.
elim H6; intro.
apply H7.
elim H4; assumption.
assumption.
discrR.
simpl in H; apply H with r0 b.
apply RList_P4 with r; assumption.
reflexivity.
rewrite <- H2; reflexivity.
intros; apply H3; elim H4; intros; split; try assumption.
apply Rle_lt_trans with r0; try assumption.
rewrite <- H1.
simpl in |- *; apply (H0 0%nat); simpl in |- *; apply lt_O_Sn.
Qed.
Lemma StepFun_P36 :
forall (a b:R) (f g:StepFun a b) (l:Rlist),
a <= b ->
is_subdivision f a b l ->
is_subdivision g a b l ->
(forall x:R, a < x < b -> f x <= g x) ->
RiemannInt_SF f <= RiemannInt_SF g.
Proof.
intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro.
replace (Int_SF (subdivision_val f) (subdivision f)) with (Int_SF (FF l f) l).
replace (Int_SF (subdivision_val g) (subdivision g)) with (Int_SF (FF l g) l).
unfold is_subdivision in X; elim X; clear X; intros;
unfold adapted_couple in p; decompose [and] p; clear p;
assert (H5 : Rmin a b = a);
[ unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ]
| assert (H7 : Rmax a b = b);
[ unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ]
| rewrite H5 in H3; rewrite H7 in H2; eapply StepFun_P35 with a b;
assumption ] ].
apply StepFun_P17 with (fe g) a b;
[ apply StepFun_P21; assumption | apply StepFun_P1 ].
apply StepFun_P17 with (fe f) a b;
[ apply StepFun_P21; assumption | apply StepFun_P1 ].
elim n; assumption.
Qed.
Lemma StepFun_P37 :
forall (a b:R) (f g:StepFun a b),
a <= b ->
(forall x:R, a < x < b -> f x <= g x) ->
RiemannInt_SF f <= RiemannInt_SF g.
Proof.
intros; eapply StepFun_P36; try assumption.
eapply StepFun_P25; apply StepFun_P29.
eapply StepFun_P23; apply StepFun_P29.
Qed.
Lemma StepFun_P38 :
forall (l:Rlist) (a b:R) (f:R -> R),
ordered_Rlist l ->
pos_Rl l 0 = a ->
pos_Rl l (pred (Rlength l)) = b ->
sigT
(fun g:StepFun a b =>
g b = f b /\
(forall i:nat,
(i < pred (Rlength l))%nat ->
constant_D_eq g (co_interval (pos_Rl l i) (pos_Rl l (S i)))
(f (pos_Rl l i)))).
Proof.
intros l a b f; generalize a; clear a; induction l.
intros a H H0 H1; simpl in H0; simpl in H1;
exists (mkStepFun (StepFun_P4 a b (f b))); split.
reflexivity.
intros; elim (lt_n_O _ H2).
intros; destruct l as [| r1 l].
simpl in H1; simpl in H0; exists (mkStepFun (StepFun_P4 a b (f b))); split.
reflexivity.
intros i H2; elim (lt_n_O _ H2).
intros; assert (H2 : ordered_Rlist (cons r1 l)).
apply RList_P4 with r; assumption.
assert (H3 : pos_Rl (cons r1 l) 0 = r1).
reflexivity.
assert (H4 : pos_Rl (cons r1 l) (pred (Rlength (cons r1 l))) = b).
rewrite <- H1; reflexivity.
elim (IHl r1 H2 H3 H4); intros g [H5 H6].
set
(g' :=
fun x:R => match Rle_dec r1 x with
| left _ => g x
| right _ => f a
end).
assert (H7 : r1 <= b).
rewrite <- H4; apply RList_P7; [ assumption | left; reflexivity ].
assert (H8 : IsStepFun g' a b).
unfold IsStepFun in |- *; assert (H8 := pre g); unfold IsStepFun in H8;
elim H8; intros lg H9; unfold is_subdivision in H9;
elim H9; clear H9; intros lg2 H9; split with (cons a lg);
unfold is_subdivision in |- *; split with (cons (f a) lg2);
unfold adapted_couple in H9; decompose [and] H9; clear H9;
unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H9;
induction i as [| i Hreci].
simpl in |- *; rewrite H12; replace (Rmin r1 b) with r1.
simpl in H0; rewrite <- H0; apply (H 0%nat); simpl in |- *; apply lt_O_Sn.
unfold Rmin in |- *; case (Rle_dec r1 b); intro;
[ reflexivity | elim n; assumption ].
apply (H10 i); apply lt_S_n.
replace (S (pred (Rlength lg))) with (Rlength lg).
apply H9.
apply S_pred with 0%nat; apply neq_O_lt; intro; rewrite <- H14 in H9;
elim (lt_n_O _ H9).
simpl in |- *; assert (H14 : a <= b).
rewrite <- H1; simpl in H0; rewrite <- H0; apply RList_P7;
[ assumption | left; reflexivity ].
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
assert (H14 : a <= b).
rewrite <- H1; simpl in H0; rewrite <- H0; apply RList_P7;
[ assumption | left; reflexivity ].
replace (Rmax a b) with (Rmax r1 b).
rewrite <- H11; induction lg as [| r0 lg Hreclg].
simpl in H13; discriminate.
reflexivity.
unfold Rmax in |- *; case (Rle_dec a b); case (Rle_dec r1 b); intros;
reflexivity || elim n; assumption.
simpl in |- *; rewrite H13; reflexivity.
intros; simpl in H9; induction i as [| i Hreci].
unfold constant_D_eq, open_interval in |- *; simpl in |- *; intros;
assert (H16 : Rmin r1 b = r1).
unfold Rmin in |- *; case (Rle_dec r1 b); intro;
[ reflexivity | elim n; assumption ].
rewrite H16 in H12; rewrite H12 in H14; elim H14; clear H14; intros _ H14;
unfold g' in |- *; case (Rle_dec r1 x); intro r3.
elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r3 H14)).
reflexivity.
change
(constant_D_eq g' (open_interval (pos_Rl lg i) (pos_Rl lg (S i)))
(pos_Rl lg2 i)) in |- *; clear Hreci; assert (H16 := H15 i);
assert (H17 : (i < pred (Rlength lg))%nat).
apply lt_S_n.
replace (S (pred (Rlength lg))) with (Rlength lg).
assumption.
apply S_pred with 0%nat; apply neq_O_lt; red in |- *; intro;
rewrite <- H14 in H9; elim (lt_n_O _ H9).
assert (H18 := H16 H17); unfold constant_D_eq, open_interval in H18;
unfold constant_D_eq, open_interval in |- *; intros;
assert (H19 := H18 _ H14); rewrite <- H19; unfold g' in |- *;
case (Rle_dec r1 x); intro.
reflexivity.
elim n; replace r1 with (Rmin r1 b).
rewrite <- H12; elim H14; clear H14; intros H14 _; left;
apply Rle_lt_trans with (pos_Rl lg i); try assumption.
apply RList_P5.
assumption.
elim (RList_P3 lg (pos_Rl lg i)); intros; apply H21; exists i; split.
reflexivity.
apply lt_trans with (pred (Rlength lg)); try assumption.
apply lt_pred_n_n; apply neq_O_lt; red in |- *; intro; rewrite <- H22 in H17;
elim (lt_n_O _ H17).
unfold Rmin in |- *; case (Rle_dec r1 b); intro;
[ reflexivity | elim n0; assumption ].
exists (mkStepFun H8); split.
simpl in |- *; unfold g' in |- *; case (Rle_dec r1 b); intro.
assumption.
elim n; assumption.
intros; simpl in H9; induction i as [| i Hreci].
unfold constant_D_eq, co_interval in |- *; simpl in |- *; intros; simpl in H0;
rewrite H0; elim H10; clear H10; intros; unfold g' in |- *;
case (Rle_dec r1 x); intro r3.
elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ r3 H11)).
reflexivity.
clear Hreci;
change
(constant_D_eq (mkStepFun H8)
(co_interval (pos_Rl (cons r1 l) i) (pos_Rl (cons r1 l) (S i)))
(f (pos_Rl (cons r1 l) i))) in |- *; assert (H10 := H6 i);
assert (H11 : (i < pred (Rlength (cons r1 l)))%nat).
simpl in |- *; apply lt_S_n; assumption.
assert (H12 := H10 H11); unfold constant_D_eq, co_interval in H12;
unfold constant_D_eq, co_interval in |- *; intros;
rewrite <- (H12 _ H13); simpl in |- *; unfold g' in |- *;
case (Rle_dec r1 x); intro.
reflexivity.
elim n; elim H13; clear H13; intros;
apply Rle_trans with (pos_Rl (cons r1 l) i); try assumption;
change (pos_Rl (cons r1 l) 0 <= pos_Rl (cons r1 l) i) in |- *;
elim (RList_P6 (cons r1 l)); intros; apply H15;
[ assumption
| apply le_O_n
| simpl in |- *; apply lt_trans with (Rlength l);
[ apply lt_S_n; assumption | apply lt_n_Sn ] ].
Qed.
Lemma StepFun_P39 :
forall (a b:R) (f:StepFun a b),
RiemannInt_SF f = - RiemannInt_SF (mkStepFun (StepFun_P6 (pre f))).
Proof.
intros; unfold RiemannInt_SF in |- *; case (Rle_dec a b); case (Rle_dec b a);
intros.
assert (H : adapted_couple f a b (subdivision f) (subdivision_val f));
[ apply StepFun_P1
| assert
(H0 :
adapted_couple (mkStepFun (StepFun_P6 (pre f))) b a
(subdivision (mkStepFun (StepFun_P6 (pre f))))
(subdivision_val (mkStepFun (StepFun_P6 (pre f)))));
[ apply StepFun_P1
| assert (H1 : a = b);
[ apply Rle_antisym; assumption
| rewrite (StepFun_P8 H H1); assert (H2 : b = a);
[ symmetry in |- *; apply H1 | rewrite (StepFun_P8 H0 H2); ring ] ] ] ].
rewrite Ropp_involutive; eapply StepFun_P17;
[ apply StepFun_P1
| apply StepFun_P2; set (H := StepFun_P6 (pre f)); unfold IsStepFun in H;
elim H; intros; unfold is_subdivision in |- *;
elim p; intros; apply p0 ].
apply Ropp_eq_compat; eapply StepFun_P17;
[ apply StepFun_P1
| apply StepFun_P2; set (H := StepFun_P6 (pre f)); unfold IsStepFun in H;
elim H; intros; unfold is_subdivision in |- *;
elim p; intros; apply p0 ].
assert (H : a < b);
[ auto with real
| assert (H0 : b < a);
[ auto with real | elim (Rlt_irrefl _ (Rlt_trans _ _ _ H H0)) ] ].
Qed.
Lemma StepFun_P40 :
forall (f:R -> R) (a b c:R) (l1 l2 lf1 lf2:Rlist),
a < b ->
b < c ->
adapted_couple f a b l1 lf1 ->
adapted_couple f b c l2 lf2 ->
adapted_couple f a c (cons_Rlist l1 l2) (FF (cons_Rlist l1 l2) f).
Proof.
intros f a b c l1 l2 lf1 lf2 H H0 H1 H2; unfold adapted_couple in H1, H2;
unfold adapted_couple in |- *; decompose [and] H1;
decompose [and] H2; clear H1 H2; repeat split.
apply RList_P25; try assumption.
rewrite H10; rewrite H4; unfold Rmin, Rmax in |- *; case (Rle_dec a b);
case (Rle_dec b c); intros;
(right; reflexivity) || (elim n; left; assumption).
rewrite RList_P22.
rewrite H5; unfold Rmin, Rmax in |- *; case (Rle_dec a b); case (Rle_dec a c);
intros;
[ reflexivity
| elim n; apply Rle_trans with b; left; assumption
| elim n; left; assumption
| elim n0; left; assumption ].
red in |- *; intro; rewrite H1 in H6; discriminate.
rewrite RList_P24.
rewrite H9; unfold Rmin, Rmax in |- *; case (Rle_dec b c); case (Rle_dec a c);
intros;
[ reflexivity
| elim n; apply Rle_trans with b; left; assumption
| elim n; left; assumption
| elim n0; left; assumption ].
red in |- *; intro; rewrite H1 in H11; discriminate.
apply StepFun_P20.
rewrite RList_P23; apply neq_O_lt; red in |- *; intro.
assert (H2 : (Rlength l1 + Rlength l2)%nat = 0%nat).
symmetry in |- *; apply H1.
elim (plus_is_O _ _ H2); intros; rewrite H12 in H6; discriminate.
unfold constant_D_eq, open_interval in |- *; intros;
elim (le_or_lt (S (S i)) (Rlength l1)); intro.
assert (H14 : pos_Rl (cons_Rlist l1 l2) i = pos_Rl l1 i).
apply RList_P26; apply lt_S_n; apply le_lt_n_Sm; apply le_S_n;
apply le_trans with (Rlength l1); [ assumption | apply le_n_Sn ].
assert (H15 : pos_Rl (cons_Rlist l1 l2) (S i) = pos_Rl l1 (S i)).
apply RList_P26; apply lt_S_n; apply le_lt_n_Sm; assumption.
rewrite H14 in H2; rewrite H15 in H2; assert (H16 : (2 <= Rlength l1)%nat).
apply le_trans with (S (S i));
[ repeat apply le_n_S; apply le_O_n | assumption ].
elim (RList_P20 _ H16); intros r1 [r2 [r3 H17]]; rewrite H17;
change
(f x = pos_Rl (app_Rlist (mid_Rlist (cons_Rlist (cons r2 r3) l2) r1) f) i)
in |- *; rewrite RList_P12.
induction i as [| i Hreci].
simpl in |- *; assert (H18 := H8 0%nat);
unfold constant_D_eq, open_interval in H18;
assert (H19 : (0 < pred (Rlength l1))%nat).
rewrite H17; simpl in |- *; apply lt_O_Sn.
assert (H20 := H18 H19); repeat rewrite H20.
reflexivity.
assert (H21 : r1 <= r2).
rewrite H17 in H3; apply (H3 0%nat).
simpl in |- *; apply lt_O_Sn.
elim H21; intro.
split.
rewrite H17; simpl in |- *; apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
rewrite H17; simpl in |- *; apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite (Rplus_comm r1); rewrite double;
apply Rplus_lt_compat_l; assumption
| discrR ] ].
elim H2; intros; rewrite H17 in H23; rewrite H17 in H24; simpl in H24;
simpl in H23; rewrite H22 in H23;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H23 H24)).
assumption.
clear Hreci; rewrite RList_P13.
rewrite H17 in H14; rewrite H17 in H15;
change
(pos_Rl (cons_Rlist (cons r2 r3) l2) i =
pos_Rl (cons r1 (cons r2 r3)) (S i)) in H14; rewrite H14;
change
(pos_Rl (cons_Rlist (cons r2 r3) l2) (S i) =
pos_Rl (cons r1 (cons r2 r3)) (S (S i))) in H15;
rewrite H15; assert (H18 := H8 (S i));
unfold constant_D_eq, open_interval in H18;
assert (H19 : (S i < pred (Rlength l1))%nat).
apply lt_pred; apply lt_S_n; apply le_lt_n_Sm; assumption.
assert (H20 := H18 H19); repeat rewrite H20.
reflexivity.
rewrite <- H17; assert (H21 : pos_Rl l1 (S i) <= pos_Rl l1 (S (S i))).
apply (H3 (S i)); apply lt_pred; apply lt_S_n; apply le_lt_n_Sm; assumption.
elim H21; intro.
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite (Rplus_comm (pos_Rl l1 (S i)));
rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
elim H2; intros; rewrite H22 in H23;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H23 H24)).
assumption.
simpl in |- *; rewrite H17 in H1; simpl in H1; apply lt_S_n; assumption.
rewrite RList_P14; rewrite H17 in H1; simpl in H1; apply H1.
inversion H12.
assert (H16 : pos_Rl (cons_Rlist l1 l2) (S i) = b).
rewrite RList_P29.
rewrite H15; rewrite <- minus_n_n; rewrite H10; unfold Rmin in |- *;
case (Rle_dec b c); intro; [ reflexivity | elim n; left; assumption ].
rewrite H15; apply le_n.
induction l1 as [| r l1 Hrecl1].
simpl in H15; discriminate.
clear Hrecl1; simpl in H1; simpl in |- *; apply lt_n_S; assumption.
assert (H17 : pos_Rl (cons_Rlist l1 l2) i = b).
rewrite RList_P26.
replace i with (pred (Rlength l1));
[ rewrite H4; unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; left; assumption ]
| rewrite H15; reflexivity ].
rewrite H15; apply lt_n_Sn.
rewrite H16 in H2; rewrite H17 in H2; elim H2; intros;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H14 H18)).
assert (H16 : pos_Rl (cons_Rlist l1 l2) i = pos_Rl l2 (i - Rlength l1)).
apply RList_P29.
apply le_S_n; assumption.
apply lt_le_trans with (pred (Rlength (cons_Rlist l1 l2)));
[ assumption | apply le_pred_n ].
assert
(H17 : pos_Rl (cons_Rlist l1 l2) (S i) = pos_Rl l2 (S (i - Rlength l1))).
replace (S (i - Rlength l1)) with (S i - Rlength l1)%nat.
apply RList_P29.
apply le_S_n; apply le_trans with (S i); [ assumption | apply le_n_Sn ].
induction l1 as [| r l1 Hrecl1].
simpl in H6; discriminate.
clear Hrecl1; simpl in H1; simpl in |- *; apply lt_n_S; assumption.
symmetry in |- *; apply minus_Sn_m; apply le_S_n; assumption.
assert (H18 : (2 <= Rlength l1)%nat).
clear f c l2 lf2 H0 H3 H8 H7 H10 H9 H11 H13 i H1 x H2 H12 m H14 H15 H16 H17;
induction l1 as [| r l1 Hrecl1].
discriminate.
clear Hrecl1; induction l1 as [| r0 l1 Hrecl1].
simpl in H5; simpl in H4; assert (H0 : Rmin a b < Rmax a b).
unfold Rmin, Rmax in |- *; case (Rle_dec a b); intro;
[ assumption | elim n; left; assumption ].
rewrite <- H5 in H0; rewrite <- H4 in H0; elim (Rlt_irrefl _ H0).
clear Hrecl1; simpl in |- *; repeat apply le_n_S; apply le_O_n.
elim (RList_P20 _ H18); intros r1 [r2 [r3 H19]]; rewrite H19;
change
(f x = pos_Rl (app_Rlist (mid_Rlist (cons_Rlist (cons r2 r3) l2) r1) f) i)
in |- *; rewrite RList_P12.
induction i as [| i Hreci].
assert (H20 := le_S_n _ _ H15); assert (H21 := le_trans _ _ _ H18 H20);
elim (le_Sn_O _ H21).
clear Hreci; rewrite RList_P13.
rewrite H19 in H16; rewrite H19 in H17;
change
(pos_Rl (cons_Rlist (cons r2 r3) l2) i =
pos_Rl l2 (S i - Rlength (cons r1 (cons r2 r3))))
in H16; rewrite H16;
change
(pos_Rl (cons_Rlist (cons r2 r3) l2) (S i) =
pos_Rl l2 (S (S i - Rlength (cons r1 (cons r2 r3)))))
in H17; rewrite H17; assert (H20 := H13 (S i - Rlength l1)%nat);
unfold constant_D_eq, open_interval in H20;
assert (H21 : (S i - Rlength l1 < pred (Rlength l2))%nat).
apply lt_pred; rewrite minus_Sn_m.
apply plus_lt_reg_l with (Rlength l1); rewrite <- le_plus_minus.
rewrite H19 in H1; simpl in H1; rewrite H19; simpl in |- *;
rewrite RList_P23 in H1; apply lt_n_S; assumption.
apply le_trans with (S i); [ apply le_S_n; assumption | apply le_n_Sn ].
apply le_S_n; assumption.
assert (H22 := H20 H21); repeat rewrite H22.
reflexivity.
rewrite <- H19;
assert
(H23 : pos_Rl l2 (S i - Rlength l1) <= pos_Rl l2 (S (S i - Rlength l1))).
apply H7; apply lt_pred.
rewrite minus_Sn_m.
apply plus_lt_reg_l with (Rlength l1); rewrite <- le_plus_minus.
rewrite H19 in H1; simpl in H1; rewrite H19; simpl in |- *;
rewrite RList_P23 in H1; apply lt_n_S; assumption.
apply le_trans with (S i); [ apply le_S_n; assumption | apply le_n_Sn ].
apply le_S_n; assumption.
elim H23; intro.
split.
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
apply Rmult_lt_reg_l with 2;
[ prove_sup0
| unfold Rdiv in |- *; rewrite <- (Rmult_comm (/ 2)); rewrite <- Rmult_assoc;
rewrite <- Rinv_r_sym;
[ rewrite Rmult_1_l; rewrite (Rplus_comm (pos_Rl l2 (S i - Rlength l1)));
rewrite double; apply Rplus_lt_compat_l; assumption
| discrR ] ].
rewrite <- H19 in H16; rewrite <- H19 in H17; elim H2; intros;
rewrite H19 in H25; rewrite H19 in H26; simpl in H25;
simpl in H16; rewrite H16 in H25; simpl in H26; simpl in H17;
rewrite H17 in H26; simpl in H24; rewrite H24 in H25;
elim (Rlt_irrefl _ (Rlt_trans _ _ _ H25 H26)).
assert (H23 : pos_Rl (cons_Rlist l1 l2) (S i) = pos_Rl l2 (S i - Rlength l1)).
rewrite H19; simpl in |- *; simpl in H16; apply H16.
assert
(H24 :
pos_Rl (cons_Rlist l1 l2) (S (S i)) = pos_Rl l2 (S (S i - Rlength l1))).
rewrite H19; simpl in |- *; simpl in H17; apply H17.
rewrite <- H23; rewrite <- H24; assumption.
simpl in |- *; rewrite H19 in H1; simpl in H1; apply lt_S_n; assumption.
rewrite RList_P14; rewrite H19 in H1; simpl in H1; simpl in |- *; apply H1.
Qed.
Lemma StepFun_P41 :
forall (f:R -> R) (a b c:R),
a <= b -> b <= c -> IsStepFun f a b -> IsStepFun f b c -> IsStepFun f a c.
Proof.
intros f a b c H H0 (l1,(lf1,H1)) (l2,(lf2,H2));
destruct (total_order_T a b) as [[Hltab|Hab]|Hgtab].
destruct (total_order_T b c) as [[Hltbc|Hbc]|Hgtbc].
exists (cons_Rlist l1 l2); exists (FF (cons_Rlist l1 l2) f);
apply StepFun_P40 with b lf1 lf2; assumption.
exists l1; exists lf1; rewrite Hbc in H1; assumption.
elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H0 Hgtbc)).
exists l2; exists lf2; rewrite <- Hab in H2; assumption.
elim (Rlt_irrefl _ (Rle_lt_trans _ _ _ H Hgtab)).
Qed.
Lemma StepFun_P42 :
forall (l1 l2:Rlist) (f:R -> R),
pos_Rl l1 (pred (Rlength l1)) = pos_Rl l2 0 ->
Int_SF (FF (cons_Rlist l1 l2) f) (cons_Rlist l1 l2) =
Int_SF (FF l1 f) l1 + Int_SF (FF l2 f) l2.
Proof.
intros l1 l2 f; induction l1 as [| r l1 IHl1]; intros H;
[ simpl in |- *; ring
| destruct l1 as [| r0 r1];
[ simpl in H; simpl in |- *; destruct l2 as [| r0 r1];
[ simpl in |- *; ring | simpl in |- *; simpl in H; rewrite H; ring ]
| simpl in |- *; rewrite Rplus_assoc; apply Rplus_eq_compat_l; apply IHl1;
rewrite <- H; reflexivity ] ].
Qed.
Lemma StepFun_P43 :
forall (f:R -> R) (a b c:R) (pr1:IsStepFun f a b)
(pr2:IsStepFun f b c) (pr3:IsStepFun f a c),
RiemannInt_SF (mkStepFun pr1) + RiemannInt_SF (mkStepFun pr2) =
RiemannInt_SF (mkStepFun pr3).
Proof.
intros f; intros;
assert
(H1 :
sigT (fun l:Rlist => sigT (fun l0:Rlist => adapted_couple f a b l l0))).
apply pr1.
assert
(H2 :
sigT (fun l:Rlist => sigT (fun l0:Rlist => adapted_couple f b c l l0))).
apply pr2.
assert
(H3 :
sigT (fun l:Rlist => sigT (fun l0:Rlist => adapted_couple f a c l l0))).
apply pr3.
elim H1; clear H1; intros l1 [lf1 H1]; elim H2; clear H2; intros l2 [lf2 H2];
elim H3; clear H3; intros l3 [lf3 H3].
replace (RiemannInt_SF (mkStepFun pr1)) with
match Rle_dec a b with
| left _ => Int_SF lf1 l1
| right _ => - Int_SF lf1 l1
end.
replace (RiemannInt_SF (mkStepFun pr2)) with
match Rle_dec b c with
| left _ => Int_SF lf2 l2
| right _ => - Int_SF lf2 l2
end.
replace (RiemannInt_SF (mkStepFun pr3)) with
match Rle_dec a c with
| left _ => Int_SF lf3 l3
| right _ => - Int_SF lf3 l3
end.
case (Rle_dec a b); case (Rle_dec b c); case (Rle_dec a c); intros.
elim r1; intro.
elim r0; intro.
replace (Int_SF lf3 l3) with
(Int_SF (FF (cons_Rlist l1 l2) f) (cons_Rlist l1 l2)).
replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1).
replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2).
symmetry in |- *; apply StepFun_P42.
unfold adapted_couple in H1, H2; decompose [and] H1; decompose [and] H2;
clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *;
case (Rle_dec a b); case (Rle_dec b c); intros; reflexivity || elim n;
assumption.
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2;
assumption
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1
| assumption ].
eapply StepFun_P17; [ apply (StepFun_P40 H H0 H1 H2) | apply H3 ].
replace (Int_SF lf2 l2) with 0.
rewrite Rplus_0_r; eapply StepFun_P17;
[ apply H1 | rewrite <- H0 in H3; apply H3 ].
symmetry in |- *; eapply StepFun_P8; [ apply H2 | assumption ].
replace (Int_SF lf1 l1) with 0.
rewrite Rplus_0_l; eapply StepFun_P17;
[ apply H2 | rewrite H in H3; apply H3 ].
symmetry in |- *; eapply StepFun_P8; [ apply H1 | assumption ].
elim n; apply Rle_trans with b; assumption.
apply Rplus_eq_reg_l with (Int_SF lf2 l2);
replace (Int_SF lf2 l2 + (Int_SF lf1 l1 + - Int_SF lf2 l2)) with
(Int_SF lf1 l1); [ idtac | ring ].
assert (H : c < b).
auto with real.
elim r; intro.
rewrite Rplus_comm;
replace (Int_SF lf1 l1) with
(Int_SF (FF (cons_Rlist l3 l2) f) (cons_Rlist l3 l2)).
replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3).
replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2).
apply StepFun_P42.
unfold adapted_couple in H2, H3; decompose [and] H2; decompose [and] H3;
clear H3 H2; rewrite H10; rewrite H6; unfold Rmax, Rmin in |- *;
case (Rle_dec a c); case (Rle_dec b c); intros;
[ elim n; assumption
| reflexivity
| elim n0; assumption
| elim n1; assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3
| assumption ].
eapply StepFun_P17;
[ apply (StepFun_P40 H0 H H3 (StepFun_P2 H2)) | apply H1 ].
replace (Int_SF lf3 l3) with 0.
rewrite Rplus_0_r; eapply StepFun_P17;
[ apply H1 | apply StepFun_P2; rewrite <- H0 in H2; apply H2 ].
symmetry in |- *; eapply StepFun_P8; [ apply H3 | assumption ].
replace (Int_SF lf2 l2) with (Int_SF lf3 l3 + Int_SF lf1 l1).
ring.
elim r; intro.
replace (Int_SF lf2 l2) with
(Int_SF (FF (cons_Rlist l3 l1) f) (cons_Rlist l3 l1)).
replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3).
replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1).
symmetry in |- *; apply StepFun_P42.
unfold adapted_couple in H1, H3; decompose [and] H1; decompose [and] H3;
clear H3 H1; rewrite H9; rewrite H5; unfold Rmax, Rmin in |- *;
case (Rle_dec a c); case (Rle_dec a b); intros;
[ elim n; assumption
| elim n1; assumption
| reflexivity
| elim n1; assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3
| assumption ].
eapply StepFun_P17.
assert (H0 : c < a).
auto with real.
apply (StepFun_P40 H0 H (StepFun_P2 H3) H1).
apply StepFun_P2; apply H2.
replace (Int_SF lf1 l1) with 0.
rewrite Rplus_0_r; eapply StepFun_P17;
[ apply H3 | rewrite <- H in H2; apply H2 ].
symmetry in |- *; eapply StepFun_P8; [ apply H1 | assumption ].
assert (H : b < a).
auto with real.
replace (Int_SF lf2 l2) with (Int_SF lf3 l3 + Int_SF lf1 l1).
ring.
rewrite Rplus_comm; elim r; intro.
replace (Int_SF lf2 l2) with
(Int_SF (FF (cons_Rlist l1 l3) f) (cons_Rlist l1 l3)).
replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3).
replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1).
symmetry in |- *; apply StepFun_P42.
unfold adapted_couple in H1, H3; decompose [and] H1; decompose [and] H3;
clear H3 H1; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *;
case (Rle_dec a c); case (Rle_dec a b); intros;
[ elim n; assumption
| reflexivity
| elim n0; assumption
| elim n1; assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3
| assumption ].
eapply StepFun_P17.
apply (StepFun_P40 H H0 (StepFun_P2 H1) H3).
apply H2.
replace (Int_SF lf3 l3) with 0.
rewrite Rplus_0_r; eapply StepFun_P17;
[ apply H1 | rewrite <- H0 in H2; apply StepFun_P2; apply H2 ].
symmetry in |- *; eapply StepFun_P8; [ apply H3 | assumption ].
assert (H : c < a).
auto with real.
replace (Int_SF lf1 l1) with (Int_SF lf2 l2 + Int_SF lf3 l3).
ring.
elim r; intro.
replace (Int_SF lf1 l1) with
(Int_SF (FF (cons_Rlist l2 l3) f) (cons_Rlist l2 l3)).
replace (Int_SF lf3 l3) with (Int_SF (FF l3 f) l3).
replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2).
symmetry in |- *; apply StepFun_P42.
unfold adapted_couple in H2, H3; decompose [and] H2; decompose [and] H3;
clear H3 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *;
case (Rle_dec a c); case (Rle_dec b c); intros;
[ elim n; assumption
| elim n1; assumption
| reflexivity
| elim n1; assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf3; apply H3
| assumption ].
eapply StepFun_P17.
apply (StepFun_P40 H0 H H2 (StepFun_P2 H3)).
apply StepFun_P2; apply H1.
replace (Int_SF lf2 l2) with 0.
rewrite Rplus_0_l; eapply StepFun_P17;
[ apply H3 | rewrite H0 in H1; apply H1 ].
symmetry in |- *; eapply StepFun_P8; [ apply H2 | assumption ].
elim n; apply Rle_trans with a; try assumption.
auto with real.
assert (H : c < b).
auto with real.
assert (H0 : b < a).
auto with real.
replace (Int_SF lf3 l3) with (Int_SF lf2 l2 + Int_SF lf1 l1).
ring.
replace (Int_SF lf3 l3) with
(Int_SF (FF (cons_Rlist l2 l1) f) (cons_Rlist l2 l1)).
replace (Int_SF lf1 l1) with (Int_SF (FF l1 f) l1).
replace (Int_SF lf2 l2) with (Int_SF (FF l2 f) l2).
symmetry in |- *; apply StepFun_P42.
unfold adapted_couple in H2, H1; decompose [and] H2; decompose [and] H1;
clear H1 H2; rewrite H11; rewrite H5; unfold Rmax, Rmin in |- *;
case (Rle_dec a b); case (Rle_dec b c); intros;
[ elim n1; assumption
| elim n1; assumption
| elim n0; assumption
| reflexivity ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf2; apply H2
| assumption ].
eapply StepFun_P17;
[ apply StepFun_P21; unfold is_subdivision in |- *; split with lf1; apply H1
| assumption ].
eapply StepFun_P17.
apply (StepFun_P40 H H0 (StepFun_P2 H2) (StepFun_P2 H1)).
apply StepFun_P2; apply H3.
unfold RiemannInt_SF in |- *; case (Rle_dec a c); intro.
eapply StepFun_P17.
apply H3.
change
(adapted_couple (mkStepFun pr3) a c (subdivision (mkStepFun pr3))
(subdivision_val (mkStepFun pr3))) in |- *; apply StepFun_P1.
apply Ropp_eq_compat; eapply StepFun_P17.
apply H3.
change
(adapted_couple (mkStepFun pr3) a c (subdivision (mkStepFun pr3))
(subdivision_val (mkStepFun pr3))) in |- *; apply StepFun_P1.
unfold RiemannInt_SF in |- *; case (Rle_dec b c); intro.
eapply StepFun_P17.
apply H2.
change
(adapted_couple (mkStepFun pr2) b c (subdivision (mkStepFun pr2))
(subdivision_val (mkStepFun pr2))) in |- *; apply StepFun_P1.
apply Ropp_eq_compat; eapply StepFun_P17.
apply H2.
change
(adapted_couple (mkStepFun pr2) b c (subdivision (mkStepFun pr2))
(subdivision_val (mkStepFun pr2))) in |- *; apply StepFun_P1.
unfold RiemannInt_SF in |- *; case (Rle_dec a b); intro.
eapply StepFun_P17.
apply H1.
change
(adapted_couple (mkStepFun pr1) a b (subdivision (mkStepFun pr1))
(subdivision_val (mkStepFun pr1))) in |- *; apply StepFun_P1.
apply Ropp_eq_compat; eapply StepFun_P17.
apply H1.
change
(adapted_couple (mkStepFun pr1) a b (subdivision (mkStepFun pr1))
(subdivision_val (mkStepFun pr1))) in |- *; apply StepFun_P1.
Qed.
Lemma StepFun_P44 :
forall (f:R -> R) (a b c:R),
IsStepFun f a b -> a <= c <= b -> IsStepFun f a c.
Proof.
intros f; intros; assert (H0 : a <= b).
elim H; intros; apply Rle_trans with c; assumption.
elim H; clear H; intros; unfold IsStepFun in X; unfold is_subdivision in X;
elim X; clear X; intros l1 [lf1 H2];
cut
(forall (l1 lf1:Rlist) (a b c:R) (f:R -> R),
adapted_couple f a b l1 lf1 ->
a <= c <= b ->
sigT (fun l:Rlist => sigT (fun l0:Rlist => adapted_couple f a c l l0))).
intro X; unfold IsStepFun in |- *; unfold is_subdivision in |- *; eapply X.
apply H2.
split; assumption.
clear f a b c H0 H H1 H2 l1 lf1; simple induction l1.
intros; unfold adapted_couple in H; decompose [and] H; clear H; simpl in H4;
discriminate.
simple induction r0.
intros X lf1 a b c f H H0; assert (H1 : a = b).
unfold adapted_couple in H; decompose [and] H; clear H; simpl in H3;
simpl in H2; assert (H7 : a <= b).
elim H0; intros; apply Rle_trans with c; assumption.
replace a with (Rmin a b).
pattern b at 2 in |- *; replace b with (Rmax a b).
rewrite <- H2; rewrite H3; reflexivity.
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
split with (cons r nil); split with lf1; assert (H2 : c = b).
rewrite H1 in H0; elim H0; intros; apply Rle_antisym; assumption.
rewrite H2; assumption.
intros r1 r2 _ X0 lf1 a b c f H H0; induction lf1 as [| r3 lf1 Hreclf1].
unfold adapted_couple in H; decompose [and] H; clear H; simpl in H4;
discriminate.
clear Hreclf1; assert (H1 : {c <= r1} + {r1 < c}).
case (Rle_dec c r1); intro; [ left; assumption | right; auto with real ].
elim H1; intro.
split with (cons r (cons c nil)); split with (cons r3 nil);
unfold adapted_couple in H; decompose [and] H; clear H;
assert (H6 : r = a).
simpl in H4; rewrite H4; unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity
| elim n; elim H0; intros; apply Rle_trans with c; assumption ].
elim H0; clear H0; intros; unfold adapted_couple in |- *; repeat split.
rewrite H6; unfold ordered_Rlist in |- *; intros; simpl in H8; inversion H8;
[ simpl in |- *; assumption | elim (le_Sn_O _ H10) ].
simpl in |- *; unfold Rmin in |- *; case (Rle_dec a c); intro;
[ assumption | elim n; assumption ].
simpl in |- *; unfold Rmax in |- *; case (Rle_dec a c); intro;
[ reflexivity | elim n; assumption ].
unfold constant_D_eq, open_interval in |- *; intros; simpl in H8;
inversion H8.
simpl in |- *; assert (H10 := H7 0%nat);
assert (H12 : (0 < pred (Rlength (cons r (cons r1 r2))))%nat).
simpl in |- *; apply lt_O_Sn.
apply (H10 H12); unfold open_interval in |- *; simpl in |- *;
rewrite H11 in H9; simpl in H9; elim H9; clear H9;
intros; split; try assumption.
apply Rlt_le_trans with c; assumption.
elim (le_Sn_O _ H11).
cut (adapted_couple f r1 b (cons r1 r2) lf1).
cut (r1 <= c <= b).
intros.
elim (X0 _ _ _ _ _ H3 H2); intros l1' [lf1' H4]; split with (cons r l1');
split with (cons r3 lf1'); unfold adapted_couple in H, H4;
decompose [and] H; decompose [and] H4; clear H H4 X0;
assert (H14 : a <= b).
elim H0; intros; apply Rle_trans with c; assumption.
assert (H16 : r = a).
simpl in H7; rewrite H7; unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
induction l1' as [| r4 l1' Hrecl1'].
simpl in H13; discriminate.
clear Hrecl1'; unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci].
simpl in |- *; replace r4 with r1.
apply (H5 0%nat).
simpl in |- *; apply lt_O_Sn.
simpl in H12; rewrite H12; unfold Rmin in |- *; case (Rle_dec r1 c); intro;
[ reflexivity | elim n; left; assumption ].
apply (H9 i); simpl in |- *; apply lt_S_n; assumption.
simpl in |- *; unfold Rmin in |- *; case (Rle_dec a c); intro;
[ assumption | elim n; elim H0; intros; assumption ].
replace (Rmax a c) with (Rmax r1 c).
rewrite <- H11; reflexivity.
unfold Rmax in |- *; case (Rle_dec r1 c); case (Rle_dec a c); intros;
[ reflexivity
| elim n; elim H0; intros; assumption
| elim n; left; assumption
| elim n0; left; assumption ].
simpl in |- *; simpl in H13; rewrite H13; reflexivity.
intros; simpl in H; unfold constant_D_eq, open_interval in |- *; intros;
induction i as [| i Hreci].
simpl in |- *; assert (H17 := H10 0%nat);
assert (H18 : (0 < pred (Rlength (cons r (cons r1 r2))))%nat).
simpl in |- *; apply lt_O_Sn.
apply (H17 H18); unfold open_interval in |- *; simpl in |- *; simpl in H4;
elim H4; clear H4; intros; split; try assumption;
replace r1 with r4.
assumption.
simpl in H12; rewrite H12; unfold Rmin in |- *; case (Rle_dec r1 c); intro;
[ reflexivity | elim n; left; assumption ].
clear Hreci; simpl in |- *; apply H15.
simpl in |- *; apply lt_S_n; assumption.
unfold open_interval in |- *; apply H4.
split.
left; assumption.
elim H0; intros; assumption.
eapply StepFun_P7;
[ elim H0; intros; apply Rle_trans with c; [ apply H2 | apply H3 ]
| apply H ].
Qed.
Lemma StepFun_P45 :
forall (f:R -> R) (a b c:R),
IsStepFun f a b -> a <= c <= b -> IsStepFun f c b.
Proof.
intros f; intros; assert (H0 : a <= b).
elim H; intros; apply Rle_trans with c; assumption.
elim H; clear H; intros; unfold IsStepFun in X; unfold is_subdivision in X;
elim X; clear X; intros l1 [lf1 H2];
cut
(forall (l1 lf1:Rlist) (a b c:R) (f:R -> R),
adapted_couple f a b l1 lf1 ->
a <= c <= b ->
sigT (fun l:Rlist => sigT (fun l0:Rlist => adapted_couple f c b l l0))).
intro X; unfold IsStepFun in |- *; unfold is_subdivision in |- *; eapply X;
[ apply H2 | split; assumption ].
clear f a b c H0 H H1 H2 l1 lf1; simple induction l1.
intros; unfold adapted_couple in H; decompose [and] H; clear H; simpl in H4;
discriminate.
simple induction r0.
intros X lf1 a b c f H H0; assert (H1 : a = b).
unfold adapted_couple in H; decompose [and] H; clear H; simpl in H3;
simpl in H2; assert (H7 : a <= b).
elim H0; intros; apply Rle_trans with c; assumption.
replace a with (Rmin a b).
pattern b at 2 in |- *; replace b with (Rmax a b).
rewrite <- H2; rewrite H3; reflexivity.
unfold Rmax in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
unfold Rmin in |- *; case (Rle_dec a b); intro;
[ reflexivity | elim n; assumption ].
split with (cons r nil); split with lf1; assert (H2 : c = b).
rewrite H1 in H0; elim H0; intros; apply Rle_antisym; assumption.
rewrite <- H2 in H1; rewrite <- H1; assumption.
intros r1 r2 _ X0 lf1 a b c f H H0; induction lf1 as [| r3 lf1 Hreclf1].
unfold adapted_couple in H; decompose [and] H; clear H; simpl in H4;
discriminate.
clear Hreclf1; assert (H1 : {c <= r1} + {r1 < c}).
case (Rle_dec c r1); intro; [ left; assumption | right; auto with real ].
elim H1; intro.
split with (cons c (cons r1 r2)); split with (cons r3 lf1);
unfold adapted_couple in H; decompose [and] H; clear H;
unfold adapted_couple in |- *; repeat split.
unfold ordered_Rlist in |- *; intros; simpl in H; induction i as [| i Hreci].
simpl in |- *; assumption.
clear Hreci; apply (H2 (S i)); simpl in |- *; assumption.
simpl in |- *; unfold Rmin in |- *; case (Rle_dec c b); intro;
[ reflexivity | elim n; elim H0; intros; assumption ].
replace (Rmax c b) with (Rmax a b).
rewrite <- H3; reflexivity.
unfold Rmax in |- *; case (Rle_dec a b); case (Rle_dec c b); intros;
[ reflexivity
| elim n; elim H0; intros; assumption
| elim n; elim H0; intros; apply Rle_trans with c; assumption
| elim n0; elim H0; intros; apply Rle_trans with c; assumption ].
simpl in |- *; simpl in H5; apply H5.
intros; simpl in H; induction i as [| i Hreci].
unfold constant_D_eq, open_interval in |- *; intros; simpl in |- *;
apply (H7 0%nat).
simpl in |- *; apply lt_O_Sn.
unfold open_interval in |- *; simpl in |- *; simpl in H6; elim H6; clear H6;
intros; split; try assumption; apply Rle_lt_trans with c;
try assumption; replace r with a.
elim H0; intros; assumption.
simpl in H4; rewrite H4; unfold Rmin in |- *; case (Rle_dec a b); intros;
[ reflexivity
| elim n; elim H0; intros; apply Rle_trans with c; assumption ].
clear Hreci; apply (H7 (S i)); simpl in |- *; assumption.
cut (adapted_couple f r1 b (cons r1 r2) lf1).
cut (r1 <= c <= b).
intros; elim (X0 _ _ _ _ _ H3 H2); intros l1' [lf1' H4]; split with l1';
split with lf1'; assumption.
split; [ left; assumption | elim H0; intros; assumption ].
eapply StepFun_P7;
[ elim H0; intros; apply Rle_trans with c; [ apply H2 | apply H3 ]
| apply H ].
Qed.
Lemma StepFun_P46 :
forall (f:R -> R) (a b c:R),
IsStepFun f a b -> IsStepFun f b c -> IsStepFun f a c.
Proof.
intros f; intros; case (Rle_dec a b); case (Rle_dec b c); intros.
apply StepFun_P41 with b; assumption.
case (Rle_dec a c); intro.
apply StepFun_P44 with b; try assumption.
split; [ assumption | auto with real ].
apply StepFun_P6; apply StepFun_P44 with b.
apply StepFun_P6; assumption.
split; auto with real.
case (Rle_dec a c); intro.
apply StepFun_P45 with b; try assumption.
split; auto with real.
apply StepFun_P6; apply StepFun_P45 with b.
apply StepFun_P6; assumption.
split; [ assumption | auto with real ].
apply StepFun_P6; apply StepFun_P41 with b;
auto with real || apply StepFun_P6; assumption.
Qed.
|