(**)
intros. red. intros D D'. set(I:=simple_P0 _ n(fun i:nat=>v i*c)%R w(simple_P9
_ _ _ _ S0 S1 S2 S3 c c')(simple_P10 _ _ _ _ S0 S1 S2 S3 c c')(simple_P11 _ _ _
_ S0 S1 S2 S3 c c')(simple_P12 _ _ _ _ S0 S1 S2 S3 c c')). unfold preimg.
assert(H:forall i:nat,{D(v i*c)%R}+{~D(v i*c)%R}). intro. apply
chicli_pottier_simpson. apply classic. set(W:=fun i=>if H i then w i else
Empty_set _). set(C:=fun z=>exists i:nat,z=W i). cut(unoin _ C=fun x=>D(v(
proj1_sig(I x))*c)%R). intro H1. rewrite<-H1. apply F'''. red. intros z H2. red
in H2;red in H2;unfold W in H2. elim H2. intros i H3. red. rewrite H3. elim(H i
). intro. apply(simple_P1 _ _ _ _ _ _ _ _ _ _ _ _ M i). intro. apply(sigalg_P1
_ _ F' F'' F'''). red. exists W. intros z H2. red in H2. elim H2. intros i H3.
exists i. auto.
(**)
apply(Extensionality_Ensembles U). split. red. intros x H1. red. red in H1;red
in H1;unfold C in H1. elim H1. intros z H2. elim H2. intros H3 H4. elim H3.
intros i H5. unfold W in H5. rewrite H5 in H4. elim(H i). intro H6. assert(H7:~
~D(v i*c)%R). auto. rewrite(if_l _ _ _(H i)(w i)(Empty_set _)H7)in H4. elim(
proj2_sig(I x)). intros H8 H9. elim H9. intros H10 H11. rewrite<-(H11 i H4).
auto. intro H6. rewrite(if_r _ _ _(H i)(w i)(Empty_set _)H6)in H4. intuition.
(**)
red. intros x H1. red. red. red in H1. exists(w(proj1_sig(I x))). unfold C.
split. exists(proj1_sig(I x)). unfold W. elim(proj2_sig(I x)). intros H2 H3.
assert(H4:~~D(v(proj1_sig(I x))*c)%R). auto. exact(sym_eq(if_l _ _ _(H(
proj1_sig(I x)))(w(proj1_sig(I x)))(Empty_set _)H4)). elim(proj2_sig(I x)).
intuition. Qed.
Definition lebint_s
(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''':
sigalg_2 _ F)(u:forall A,F A->R)(u':msur_0 _ _ F' F'' F''' u)(u'':msur_1 _ _ F'
F'' F''' u)(u''':msur_2 _ _ F' F'' F''' u)(u'''':msur_3 _ _ F' F'' F''' u)(n:
nat)(v:nat->R)(w:nat->Ensemble U)(S0:simple_0 _ n v w)(S1:simple_1 _ n v w)(S2:
simple_2 _ n v w)(S3:simple_3 _ n v w)(M:msurable _ _ F' F'' F'''(fun x:U=>v(
proj1_sig(simple_P0 _ n v w S0 S1 S2 S3 x))))(E:Ensemble U)(E':F E)
:=sum_f_R0 (fun i:nat=>((v i)*(u(Intersection _(w i)E)(sigalg_P2 _ _ F' F''
F'''(w i)E(simple_P1 _ _ F' F'' F''' n v w S0 S1 S2 S3 M i)E')))%R) n.
Definition lebint
(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''':
sigalg_2 _ F)(u:forall A,F A->R)(u':msur_0 _ _ F' F'' F''' u)(u'':msur_1 _ _ F'
F'' F''' u)(u''':msur_2 _ _ F' F'' F''' u)(u'''':msur_3 _ _ F' F'' F''' u)(f:U
->R)(f':forall x:U,(f x>=0)%R)(M:msurable _ _ F' F'' F''' f)(E:Ensemble U)(E':F
E)
:=let B:=fun l=>forall n,forall v,forall w,forall S0,forall S1,forall S2,forall
S3,forall M',(forall x:U,(0<=(fun y:U=>v(proj1_sig(simple_P0 _ n v w S0 S1 S2
S3 y)))x<=f x)%R)->(lebint_s _ _ _ _ _ u u' u'' u''' u'''' n v w S0 S1 S2 S3 M'
E E'<=l)%R in fun L=>B L/\forall L',B L'->(L'<=L)%R.

(*----------------------------------------------------------------------------- A simple function that is less than or equal to a general function g everywhere, has its Lebesgue integral less than or equal to the Lebesgue integral of the general function g.  This fact is true for nonsimple functions too, but we just prove only what we need for the final theorem. -----------------------------------------------------------------------------*)
Lemma lebint_P0:
(forall(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F'''
:sigalg_2 _ F)(u:forall A,F A->R)(u':msur_0 _ _ F' F'' F''' u)(u'':msur_1 _ _
F' F'' F''' u)(u''':msur_2 _ _ F' F'' F''' u)(u'''':msur_3 _ _ F' F'' F''' u)(n
:nat)(v:nat->R)(w:nat->Ensemble U)(S0:simple_0 _ n v w)(S1:simple_1 _ n v w)(S2
:simple_2 _ n v w)(S3:simple_3 _ n v w)(M:msurable _ _ F' F'' F'''(fun x:U=>v(
proj1_sig(simple_P0 _ n v w S0 S1 S2 S3 x))))(g:U->R)(g':forall x:U,g x>=0)(g''
:msurable _ _ F' F'' F''' g)(E:Ensemble U)(E':F E),
(forall y:U,(fun x:U=>v(proj1_sig(simple_P0 _ n v w S0 S1 S2 S3 x)))y<=g y)->
forall L,lebint _ _ _ _ _ u u' u'' u''' u'''' g g' g'' E E' L->lebint_s _ _ F'
F'' F''' u u' u'' u''' u'''' n v w S0 S1 S2 S3 M E E'<=L)%R.