Debian Codegraph @

reals/stdlib/CMTbase.v

raw
1 (*
2 Copyright © 2020 Vincent Semeria
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
6 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
8 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 *)
10
11
12
13 (*
14 This is an implementation of Errett Bishop and Henry Cheng's article,
15 "Constructive Measure Theory". By its many applications and concrete
16 nature, measure theory and probability theory are expected to be
17 constructive. Indeed they are, and this formalization shows exactly how.
18
19 All measure theories (Riemann, Lebesgue, Daniell and here constructive)
20 follow the same pattern :
21 1) Observe that the rectangles of Rn [a1,b1] \times ... \times [an,bn]
22 have an obvious measure, which is the product (b1-a1)...(bn-an).
23 2) Define a notion of limit, to measure more complicated domains
24 by rectangle approximations.
25
26 For example this is how Archimedes computed the length of a circle
27 2000 years ago. Nowadays the classical measure theory is that of
28 Lebesgue, and its limit notion is the sigma-algebra generated by
29 the rectangles, aka the Borel sets of Rn. This classically defines
30 a gigantic set of measurable parts, but it is not constructive,
31 because there is no way to effectively compute which rectangles
32 approximate an arbitrary Borel set. It is therefore not surprising
33 that the associated tool, Caratheodory's extension theorem,
34 extends measures from rectangles to Borel sets in a non-constructive
35 manner: by using infimums of arbitrary bounded subsets of R.
36
37 Bishop and Cheng's measure theory is the constructive expression
38 of Daniell's measure theory. Instead of starting with rectangles
39 as subsets of Rn, this theory considers elementary real-valued
40 functions, for example piecewise-constant functions. Those two
41 concepts are almost the same, because the graph of a
42 piecewise-constant function is a finite union of rectangles.
43 But by starting with functions, we get a very simple notion of limit
44 between a function f and a sequence of elementary functions fn:
45 f(x) = lim fn(x), for all x's such as the real sequence fn(x) converges.
46 This resolves the objection above, because the approximating sequence fn
47 of rectangles is now the very definition of an integrable function f.
48 This restricts the theory to constructively integrable functions,
49 which is precisely what we want.
50
51 In the constructive definition, fn is not required to converge at every x.
52 This allows to integrate more functions f, but takes the risk of badly
53 approximating their integrals, by ignoring what f does outside
54 of the domain of convergence of fn. To make sure that the sequence fn
55 converges on a subset with full measure, we require that the integrals
56 of the absolute values of fn converge. Roughly speaking, if the |fn|
57 converged to positive infinity on a subset with positive measure,
58 it would contradict the finite integral limit. This condition also
59 makes the integrals of fn converge, which defines the integral of f.
60
61 Another characteristic of constructive real functions is worth stressing:
62 all total constructive functions R -> R are continuous. So a
63 constructive function R -> R must either be undefined at a point of
64 discontinuity x, or be defined on a topological subspace of R,
65 such as the disconnection of x by taking [x, +\infty[ to be open.
66 In the last 2 cases we will declare the function to be partially
67 defined on R, see PartialFunction below.
68 *)
69
70 Require Import QArith.
71 Require Import ConstructiveReals.
72 Require Import ConstructiveAbs.
73 Require Import ConstructiveMinMax.
74 Require Import ConstructiveSum.
75 Require Import ConstructiveLimits.
76 Require Import ConstructivePartialFunctions.
77
78 Local Open Scope ConstructiveReals.
79
80
81 (* A Riesz space is a vector space with a lattice structure
82 compatible with the vectorial structure. An important example
83 for measure theory is when vectors are real-valued functions,
84 which allows to define an integral as a linear and
85 non-decreasing functional. *)
86 Structure FunctionRieszSpace :=
87 {
88 (* A superset of the domains. Typically, X will be R or R^n,
89 and the functions will be defined almost-everywhere on X.
90 Bishop generalizes to a setoid, to be able to consider
91 functions on quotient spaces ; we do not do it for now,
92 because most of the time the domain is plain R^n.*)
93 X : Set;
94
95 RealT : ConstructiveReals;
96
97 (* We use Set instead of Prop, to destruct the witness in the integral
98 function later. In the example of piecewise-linear functions, the
99 Prop would be "there exists a finite list of angular points";
100 here the type is a sig with this finite list, and a proof that
101 the function is linear between these points. *)
102 L : @PartialFunction RealT X -> Type;
103
104 (* The integration spaces are usually provably extensional,
105 so we avoid using the functional extensionality axiom. *)
106 Lext : forall f g : PartialFunction X,
107 PartialFunExtEq f g -> L f -> L g;
108
109 LplusStable : forall f g : PartialFunction X,
110 L f -> L g -> L (Xplus f g);
111
112 LabsStable : forall (f : PartialFunction X),
113 L f -> L (Xabs f);
114
115 LminOneStable : forall (f : PartialFunction X),
116 L f -> L (XminConst f 1);
117
118 LscaleStable : forall (a : CRcarrier RealT) (f : PartialFunction X),
119 L f -> L (Xscale a f);
120 }.
121
122 (* LminOneStable seems redundant, because the minimum can be built from plus,
123 minus and abs. However the constant function one is not L most of the time :
124 its integral is infinite when the domain X is R or R^n. *)
125
126 Lemma LminusStable
127 : forall {Elem : FunctionRieszSpace}
128 (f g : PartialFunction (X Elem))
129 (fL : L Elem f)
130 (gL : L Elem g),
131 L Elem (Xminus f g).
132 Proof.
133 intros. unfold Xminus. apply LplusStable. assumption.
134 apply LscaleStable. assumption.
135 Defined.
136
137 Lemma LposPartStable
138 : forall {Elem : FunctionRieszSpace}
139 (f : PartialFunction (X Elem))
140 (fL : L Elem f),
141 L Elem (XposPart f).
142 Proof.
143 intros. unfold XposPart. apply LscaleStable. apply LplusStable.
144 assumption. apply LabsStable. assumption.
145 Defined.
146
147 Lemma LnegPartStable
148 : forall {Elem : FunctionRieszSpace}
149 (f : PartialFunction (X Elem))
150 (fL : L Elem f),
151 L Elem (XnegPart f).
152 Proof.
153 intros. unfold XnegPart. apply LscaleStable. apply LminusStable.
154 apply LabsStable. assumption. assumption.
155 Defined.
156
157 Lemma LminStable
158 : forall {Elem : FunctionRieszSpace}
159 (f g : PartialFunction (X Elem))
160 (fL : L Elem f)
161 (gL : L Elem g),
162 L Elem (Xmin f g).
163 Proof.
164 intros.
165 apply LminusStable. assumption. apply LnegPartStable.
166 apply LminusStable. assumption. assumption.
167 Qed.
168
169 Lemma LmaxStable
170 : forall {Elem : FunctionRieszSpace}
171 (f g : PartialFunction (X Elem))
172 (fL : L Elem f)
173 (gL : L Elem g),
174 L Elem (Xmax f g).
175 Proof.
176 intros.
177 apply LplusStable. assumption. apply LposPartStable.
178 apply LminusStable. assumption. assumption.
179 Qed.
180
181 Lemma LsumStable
182 : forall {Elem : FunctionRieszSpace}
183 (fn : nat -> PartialFunction (X Elem))
184 (fnL : forall n:nat, L Elem (fn n)),
185 forall n:nat, L Elem (Xsum fn n).
186 Proof.
187 induction n. simpl. apply fnL. simpl.
188 apply (LplusStable Elem). exact IHn. apply fnL.
189 Defined.
190
191 Lemma LminConstStable
192 : forall {E : FunctionRieszSpace}
193 (a : CRcarrier (RealT E)) (f : PartialFunction (X E)),
194 0 < a
195 -> L E f
196 -> L E (XminConst f a).
197 Proof.
198 intros.
199 apply (Lext _ _ _ (XminMultPosDistribOne f a H)).
200 apply LscaleStable. apply LminOneStable. apply LscaleStable. assumption.
201 Defined.
202
203 (* Include the zero case *)
204 Lemma LminIntStable
205 : forall {E : FunctionRieszSpace}
206 (n : nat) (f : PartialFunction (X E)),
207 L E f
208 -> L E (XminConst f (INR n)).
209 Proof.
210 intros E n f H. destruct n.
211 - apply (Lext _ (Xscale (-(1)) (XnegPart f))).
212 2: apply LscaleStable, LnegPartStable, H.
213 split. split.
214 + intros x xd. destruct f; apply xd.
215 + intros x xd. destruct f; split; apply xd.
216 + intros. rewrite applyXscale, applyXminConst.
217 simpl in xD, xG.
218 rewrite (DomainProp (XnegPart f) x _ (xG, xG)).
219 rewrite (applyXnegPartMin f x xG), <- CRopp_mult_distr_l.
220 rewrite CRmult_1_l, CRopp_involutive, CRmin_sym.
221 apply CRmin_morph. reflexivity. reflexivity.
222 - apply LminConstStable.
223 apply CR_of_Q_lt. reflexivity. exact H.
224 Qed.
225
226 Lemma invSuccRealPositive : forall {R : ConstructiveReals} (n : nat),
227 0 < CR_of_Q R (1# Pos.of_nat (S n)).
228 Proof.
229 intros R n. apply CR_of_Q_lt. reflexivity.
230 Qed.
231
232 Definition ElemIntegralContinuous
233 {E : FunctionRieszSpace}
234 (I : forall f : PartialFunction (X E), (L E) f -> CRcarrier (RealT E))
235 : Type
236 := forall (f : PartialFunction (X E))
237 (fn : nat -> PartialFunction (X E))
238 (fL : (L E) f)
239 (fnL : forall n:nat, (L E) (fn n)),
240 (forall n:nat, nonNegFunc (fn n))
241 -> series_cv_lim_lt (fun n => I (fn n) (fnL n))
242 (I f fL)
243 -> { x : CommonPointFunSeq _ f fn
244 & series_cv_lim_lt (fun n => partialApply (fn n) _ (cpxFn _ _ _ x n))
245 (partialApply f _ (cpxF _ _ _ x)) }.
246
247 Record IntegrationSpace :=
248 {
249 ElemFunc : FunctionRieszSpace;
250
251 (* The integrals of the elementary functions.
252 The argument L f is in sort Set, but lemma IExtensional
253 below proves that I does not use it to produce different
254 values. *)
255 I : forall f : PartialFunction (X ElemFunc),
256 (L ElemFunc) f -> CRcarrier (RealT ElemFunc);
257
258 Iadditive : forall (f g : PartialFunction (X ElemFunc))
259 (fL : L ElemFunc f)
260 (gL : L ElemFunc g),
261 I (Xplus f g) (LplusStable ElemFunc f g fL gL)
262 == I f fL + I g gL;
263
264 Ihomogeneous : forall (a : CRcarrier (RealT ElemFunc))
265 (f : PartialFunction (X ElemFunc))
266 (fL : L ElemFunc f),
267 I (Xscale a f) (LscaleStable ElemFunc a f fL)
268 == a * (I f fL);
269
270 Ione : PartialFunction (X ElemFunc);
271 IoneL : L ElemFunc Ione;
272 IoneInt : I Ione IoneL == 1;
273
274 (*
275 Now the usual majoration of integrals :
276 (forall x, f(x) <= g(x)) -> I f <= I g.
277 See lemma INonDecreasing below for the detailed formulation.
278 Because x is in the intersection of the domains of f and g,
279 it implies that L-functions are defined almost everywhere,
280 ie the abscissas outside any of their domains don't affect integrals.
281
282 Moreover we require the existential contrapositive, which is
283 constructively stronger :
284 I g < I f -> { x | g(x) < f(x) }.
285
286 Finally we want the integral to be sigma-linear (the countable
287 limit of Iadditive and Ihomogeneous), so we take g to be a
288 countable sum of nonnegative functions fn. This gives an
289 non-decreasing sequence of functions, as in the monotone
290 convergence theorem (that we will prove later).
291
292 The function f is actually optional. If the integrals of fn
293 converge towards a limit l, we can take f = (l+1) * Ione.
294 This means that the convergence on the integrals of fn
295 proves that the pointwise limit of fn has a non-empty domain
296 (which will later be proved to have full measure in X ElemFunc).
297 *)
298 Icontinuous : ElemIntegralContinuous I;
299
300 Ilimit : forall (f : PartialFunction (X ElemFunc)) (fL : L ElemFunc f),
301 prod (CR_cv _ (fun n => I (XminConst f (INR n))
302 (LminIntStable n f fL))
303 (I f fL))
304 (CR_cv _ (fun n => I (XminConst (Xabs f) (CR_of_Q _ (1# Pos.of_nat (S n))))
305 (LminConstStable (CR_of_Q _ (1# Pos.of_nat (S n))) (Xabs f)
306 (invSuccRealPositive n)
307 (LabsStable ElemFunc f fL)))
308 0)
309 }.
310
311 (* Shortcut for the integral of the absolute value,
312 will be used a lot. *)
313 Definition Iabs {IS : IntegrationSpace}
314 (f : PartialFunction (X (ElemFunc IS)))
315 (fL : L (ElemFunc IS) f)
316 := I IS (Xabs f) (LabsStable _ f fL).
317
318 Lemma Iminus : forall {IS : IntegrationSpace}
319 (f g : PartialFunction (X (ElemFunc IS)))
320 (fL : L (ElemFunc IS) f)
321 (gL : L (ElemFunc IS) g),
322 I IS (Xminus f g) (LminusStable f g fL gL)
323 == I IS f fL - I IS g gL.
324 Proof.
325 intros. unfold Xminus. unfold LminusStable.
326 rewrite Iadditive. apply CRplus_morph. reflexivity.
327 rewrite Ihomogeneous. rewrite <- CRopp_mult_distr_l, CRmult_1_l. reflexivity.
328 Qed.
329
330 Lemma IadditiveIterate : forall {IS : IntegrationSpace}
331 (fn : nat -> PartialFunction (X (ElemFunc IS)))
332 (fnL : forall n:nat, L (ElemFunc IS) (fn n))
333 (N : nat),
334 I IS (Xsum fn N) (LsumStable fn fnL N)
335 == CRsum (fun n : nat => I IS (fn n) (fnL n)) N.
336 Proof.
337 induction N.
338 - reflexivity.
339 - simpl. rewrite Iadditive. rewrite IHN. reflexivity.
340 Qed.
341
342 Definition Izero (IS : IntegrationSpace)
343 := Xscale 0 (Ione IS).
344
345 Lemma Izero_is_L : forall (IS : IntegrationSpace),
346 L (ElemFunc IS) (Izero IS).
347 Proof.
348 intros IS. unfold Izero. apply LscaleStable. apply IoneL.
349 Defined.
350
351 Lemma Izero_nonNeg : forall (IS : IntegrationSpace),
352 nonNegFunc (Izero IS).
353 Proof.
354 intros IS x xdf. unfold Izero.
355 rewrite applyXscale, CRmult_0_l. apply CRle_refl.
356 Qed.
357
358 Lemma Izero_is_zero : forall (IS : IntegrationSpace),
359 I IS (Izero IS) (Izero_is_L IS) == 0.
360 Proof.
361 intros. unfold Izero. unfold Izero_is_L. rewrite Ihomogeneous.
362 rewrite CRmult_0_l. reflexivity.
363 Qed.
364
365 Lemma applyIzero : forall (IS : IntegrationSpace)
366 (x : X (ElemFunc IS))
367 (xD : Domain (Izero IS) x),
368 partialApply (Izero IS) x xD == 0.
369 Proof.
370 intros. unfold Izero. rewrite applyXscale, CRmult_0_l.
371 reflexivity.
372 Qed.
373
374 (* This usual property of integrals also proves that the domains of
375 L-functions are full sets.
376 The majoration f <= g is defined on the intersection of the domains
377 of f and g, and it is enough to imply that I f <= I g.
378 It proves that the difference between the domains of g and f is a
379 null set : g can have arbitrary large negative values on it
380 without breaking the integral majoration. *)
381 Lemma INonDecreasing : forall {IS : IntegrationSpace}
382 (f g : PartialFunction (X (ElemFunc IS)))
383 (fL : L (ElemFunc IS) f)
384 (gL : L (ElemFunc IS) g),
385 (forall (x : X (ElemFunc IS)) (xF : Domain f x) (y : Domain g x),
386 partialApply f x xF <= partialApply g x y)
387 -> I IS f fL <= I IS g gL.
388 Proof.
389 intros. intro abs.
390 destruct (Icontinuous IS (Xminus f g)
391 (fun n:nat => Izero IS)
392 (LminusStable f g fL gL)
393 (fun n:nat => Izero_is_L IS)
394 (fun n:nat => Izero_nonNeg IS))
395 as [[x xdminus xdfn] [l [H1 H0]]].
396 - exists 0. split.
397 + intros n. exists O. intros.
398 rewrite CRabs_right.
399 rewrite sum_eq_R0. unfold CRminus.
400 rewrite CRplus_opp_r.
401 apply CR_of_Q_le. discriminate.
402 intro k. apply Izero_is_zero. unfold CRminus.
403 rewrite CRopp_0, CRplus_0_r.
404 rewrite sum_eq_R0. apply CRle_refl.
405 intro k. apply Izero_is_zero.
406 + unfold Xminus. unfold LminusStable. rewrite Iadditive. rewrite Ihomogeneous.
407 rewrite <- (CRopp_mult_distr_l 1). rewrite CRmult_1_l.
408 rewrite <- (CRplus_opp_r (I IS g gL)).
409 apply CRplus_lt_compat_r. exact abs.
410 - unfold cpxF in H0. destruct xdminus.
411 rewrite (applyXminus f g) in H0. simpl in H0.
412 assert (series_cv (fun n : nat => partialApply (Izero IS) x (xdfn n)) 0).
413 { apply (CR_cv_eq _ (fun n => 0)). 2: apply CR_cv_const.
414 intro n. rewrite sum_eq_R0. reflexivity.
415 intro k. apply applyIzero. }
416 assert (l == 0).
417 { apply (series_cv_unique (fun n : nat => partialApply (Izero IS) x (xdfn n))).
418 apply H1. apply H2. }
419 rewrite H3 in H0. clear H1 H2 H3 l.
420 rewrite <- (CRplus_opp_r (partialApply g x d0)) in H0.
421 apply CRplus_lt_reg_r in H0.
422 exact (H x _ _ H0).
423 Qed.
424
425 (* Again, the extensionality is simplified because f and g are defined
426 almost everywhere. This lemma is rigorously a statement about the
427 intersection of the domains of f and g.
428 In particular, the lemma shows that I does not depend on the L arguments. *)
429 Lemma IExtensional : forall {IS : IntegrationSpace}
430 (f g : PartialFunction (X (ElemFunc IS)))
431 (fL : L (ElemFunc IS) f)
432 (gL : L (ElemFunc IS) g),
433 (forall (x : X (ElemFunc IS)) (xF : Domain f x) (y : Domain g x),
434 partialApply f x xF == partialApply g x y)
435 -> I IS f fL == I IS g gL.
436 Proof.
437 split.
438 + apply INonDecreasing. intros. rewrite (H x y xF). apply CRle_refl.
439 + apply INonDecreasing. intros. rewrite (H x xF y). apply CRle_refl.
440 Qed.
441
442 (* When we have an integration space, we only need to
443 check stabilities to create smaller spaces. *)
444 Definition SubIntegrationSpace
445 (IS : IntegrationSpace)
446 (Lsub : PartialFunction (X (ElemFunc IS)) -> Set)
447 : (forall f:PartialFunction (X (ElemFunc IS)), Lsub f -> L _ f)
448 -> (forall f g : PartialFunction (X (ElemFunc IS)),
449 PartialFunExtEq f g -> Lsub f -> Lsub g)
450 -> Lsub (Ione IS)
451 -> (forall f g : PartialFunction (X (ElemFunc IS)),
452 (Lsub f -> Lsub g -> Lsub (Xplus f g)))
453 -> (forall f : PartialFunction (X (ElemFunc IS)),
454 Lsub f -> Lsub (Xabs f))
455 -> (forall f : PartialFunction (X (ElemFunc IS)),
456 Lsub f -> Lsub (XminConst f 1))
457 -> (forall (a:CRcarrier (RealT (ElemFunc IS)))
458 (f : PartialFunction (X (ElemFunc IS))),
459 Lsub f -> Lsub (Xscale a f))
460 -> IntegrationSpace.
461 Proof.
462 intros.
463 pose (Build_FunctionRieszSpace
464 (X (ElemFunc IS)) (RealT (ElemFunc IS)) Lsub X1 X2 X3 X4 X5) as ElemSub.
465 pose (fun f fLsub => I _ f (X0 f fLsub)) as Isub.
466 assert (forall (f g : PartialFunction (X (ElemFunc IS)))
467 (fL : Lsub f)
468 (gL : Lsub g),
469 Isub (Xplus f g) (LplusStable ElemSub f g fL gL)
470 == Isub f fL + Isub g gL).
471 { intros. unfold Isub.
472 apply (CReq_trans _ (I IS (Xplus f g)
473 (LplusStable (ElemFunc IS) f g (X0 f fL) (X0 g gL)))).
474 2: apply Iadditive. apply IExtensional. intros.
475 destruct f,g,xF,y; simpl.
476 apply CRplus_morph. apply DomainProp. apply DomainProp0. }
477 assert (forall (a : CRcarrier (RealT (ElemFunc IS)))
478 (f : PartialFunction (X (ElemFunc IS)))
479 (fL : Lsub f),
480 Isub (Xscale a f) (LscaleStable ElemSub a f fL)
481 == a * (Isub f fL)).
482 { intros. unfold Isub.
483 apply (CReq_trans _ (I IS (Xscale a f)
484 (LscaleStable (ElemFunc IS) a f (X0 f fL)))).
485 2: apply Ihomogeneous. apply IExtensional. intros.
486 destruct f; simpl. apply CRmult_morph. reflexivity. apply DomainProp. }
487 apply (Build_IntegrationSpace
488 ElemSub Isub H0 H1 (Ione IS) H).
489 - unfold Isub. transitivity (CR_of_Q (RealT (ElemFunc IS)) 1).
490 rewrite <- (IoneInt IS).
491 apply IExtensional. intros.
492 destruct (Ione IS); simpl. apply DomainProp. reflexivity.
493 - intros f fn fL fnL. intros. simpl in fL, fnL.
494 apply (Icontinuous IS f fn (X0 f fL)
495 (fun n => X0 (fn n) (fnL n)) H2 H3).
496 - intros. pose proof (Ilimit IS f (X0 f fL)).
497 split.
498 apply (CR_cv_eq _ (fun n : nat =>
499 I IS (XminConst f (INR n))
500 (@LminIntStable (ElemFunc IS) n f (X0 f fL)))).
501 2: apply H2. intro n. apply IExtensional. intros.
502 apply DomainProp.
503 apply (CR_cv_eq _ (fun n : nat =>
504 I IS
505 (XminConst (Xabs f) (CR_of_Q _ (1# Pos.of_nat (S n))))
506 (@LminConstStable (ElemFunc IS) (CR_of_Q _ (1# Pos.of_nat (S n)))
507 (Xabs f) (invSuccRealPositive n)
508 (LabsStable (ElemFunc IS) f (X0 f fL))))).
509 2: apply H2. intro n. apply IExtensional. intros.
510 apply DomainProp.
511 Defined.
512
513 Lemma IabsHomogeneous : forall {IS : IntegrationSpace}
514 (a : CRcarrier (RealT (ElemFunc IS)))
515 (f : PartialFunction (X (ElemFunc IS)))
516 (fL : L (ElemFunc IS) f),
517 Iabs (Xscale a f) (LscaleStable (ElemFunc IS) a f fL)
518 == (CRabs _ a) * Iabs f fL.
519 Proof.
520 intros. unfold Iabs. rewrite <- Ihomogeneous.
521 apply IExtensional. intros. destruct f; simpl.
522 rewrite CRabs_mult. apply CRmult_morph. reflexivity.
523 rewrite (DomainProp x xF y). reflexivity.
524 Qed.
525
526 Lemma integralPositive : forall (IS : IntegrationSpace)
527 (f : PartialFunction (X (ElemFunc IS)))
528 (fL : L (ElemFunc IS) f),
529 nonNegFunc f
530 -> 0 <= I IS f fL.
531 Proof.
532 intros. apply (CRle_trans 0 (I IS (Izero IS) (Izero_is_L IS))).
533 unfold Izero. unfold Izero_is_L. rewrite Ihomogeneous. rewrite CRmult_0_l.
534 apply CRle_refl. apply INonDecreasing. intros. rewrite applyIzero.
535 apply H.
536 Qed.
537
538 (* The usual triangular inequality of integrals : the absolute value of an integral
539 is lower than the integral of the absolute value. *)
540 Lemma integralAbsMaj : forall {IS : IntegrationSpace}
541 (f : PartialFunction (X (ElemFunc IS)))
542 (fL : L (ElemFunc IS) f),
543 CRabs _ (I IS f fL) <= Iabs f fL.
544 Proof.
545 (* Because integral is increasing and I f <= I |f| and -I f <= I |f| *)
546 intros. apply CRabs_le. split.
547 + unfold Iabs. rewrite <- (CRmult_1_l (I IS (Xabs f) (LabsStable (ElemFunc IS) f fL))).
548 rewrite (CRopp_mult_distr_l 1). rewrite <- Ihomogeneous.
549 apply INonDecreasing. intros. rewrite applyXscale.
550 rewrite <- (CRopp_mult_distr_l 1). rewrite CRmult_1_l.
551 destruct f; simpl.
552 rewrite <- (CRopp_involutive (partialApply x y)).
553 rewrite (DomainProp x xF y). rewrite <- CRabs_opp.
554 apply CRopp_ge_le_contravar. apply CRle_abs.
555 + apply INonDecreasing. intros. destruct f; simpl.
556 rewrite (DomainProp x xF y). apply CRle_abs.
557 Qed.
558
559 Lemma IAbsSumMaj : forall {IS : IntegrationSpace}
560 (fn : nat -> PartialFunction (X (ElemFunc IS)))
561 (fnL : forall n:nat, L (ElemFunc IS) (fn n))
562 (n : nat),
563 Iabs (Xsum fn n) (LsumStable fn fnL n)
564 <= CRsum (fun n0 : nat => Iabs (fn n0) (fnL n0)) n.
565 Proof.
566 induction n.
567 - simpl. apply CRle_refl.
568 - simpl. apply (CRle_trans _
569 (I IS
570 (Xplus (Xabs (Xsum fn n))
571 (Xabs (fn (S n))))
572 (LplusStable (ElemFunc IS)
573 (Xabs (Xsum fn n))
574 (Xabs (fn (S n)))
575 (LabsStable (ElemFunc IS)
576 (Xsum fn n)
577 (LsumStable fn fnL n))
578 (LabsStable (ElemFunc IS) (fn (S n)) (fnL (S n)))))).
579 + clear IHn. apply INonDecreasing. intros.
580 destruct (fn (S n)), (Xsum fn n), xF, y ; simpl.
581 apply (CRle_trans _ _ _ (CRabs_triang _ _)). apply CRplus_le_compat.
582 rewrite (DomainProp0 x d d1). apply CRle_refl.
583 rewrite (DomainProp x d0 d2). apply CRle_refl.
584 + rewrite Iadditive. apply CRplus_le_compat. apply IHn.
585 apply CRle_refl.
586 Qed.