Definition msur_0
(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(Empty_set _)(sigalg_P1 U F F' F'' F''')=0%R.(*-----------------------------------------------------------------------------
Countable additivity.  C is the countable collection, g is again the injective
proof-irrelevant serial number mapping, and us is a list of the measures of the
sets in the collection (sprinkled with zeroes throughout).
-------------------------------------------------------------------------------
One note that might be interesting is that even though the hypotheses about
'us' 'force' the measure function u to be compatible when dealing with sets
that are actually in C (as opposed to sets in the sigma-algebra F which are not
known for sure if they are in C), one cannot generally prove (I think) that the
measure function u is compatible from the hypotheses given here.  This was kind
of a stumbling block and why I eventually had to add the 'msur_3' axiom below.
-----------------------------------------------------------------------------*)
Definition msur_1
(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''':
sigalg_2 _ F)(u:forall A,F A->R):=
forall C:Ensemble(Ensemble U),
forall C1:Included _ C F,
forall C2:forall c cc,C c->C cc->c<>cc->Disjoint _ c cc,
forall g:forall c,C c->nat,
forall g1:forall c c' c'',g c c'=g c c'',
forall g2:forall c cc c' cc',g c c'=g cc cc'->c=cc,
forall us:nat->R,
(forall c c',us(g c c')=u c(C1 _ c'))->
(forall n:nat,(forall c c',n<>g c c')->us n=0%R)->
forall l,infinit_sum us l->l
=u(unoin _ C)(F''' C C1(cntabl_P1 _ _ g g1 g2)).(*-----------------------------------------------------------------------------
probability spaces have measure 1
-----------------------------------------------------------------------------*)
Definition msur_2
(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 (Full_set U) (sigalg_P3 U F F' F'' F''')=1%R.Definition msur_3
(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''':
sigalg_2 _ F)(u:forall A,F A->R):=
forall A A' A'',u A A'=u A A''.Definition simple_0(U:Type)(n:nat)(v:nat->R)(w:nat->Ensemble U)
:=forall i j:nat,i<>j->Disjoint _(w i)(w j).Definition simple_1(U:Type)(n:nat)(v:nat->R)(w:nat->Ensemble U)
:=forall x:U,exists i:nat,i<n/\w i x.(*-----------------------------------------------------------------------------
the list of range values for a simple function doesnt HAVE to be injective, but
i thought itd be nice
-----------------------------------------------------------------------------*)
Definition simple_2(U:Type)(n:nat)(v:nat->R)(w:nat->Ensemble U)
:=forall i j:nat,v i=v j->i=j.Definition simple_3(U:Type)(n:nat)(v:nat->R)(w:nat->Ensemble U)
:=forall i:nat,(v i>=0)%R.(*-----------------------------------------------------------------------------
constructive 'get_index_of'-type function
-----------------------------------------------------------------------------*)
Definition simple_P0
(U:Type)(n:nat)(v:nat->R)(w:nat->Ensemble U):simple_0 _ n v w->simple_1 _ n v w
->simple_2 _ n v w->simple_3 _ n v w->
forall x:U,{i:nat|i<n/\w i x/\forall i',w i' x->i'=i}.

(* Specifications: *)
Lemma simple_P1: forall(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''': sigalg_2 _ F)(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), msurable _ _ F' F'' F''' (fun x:U=>v(proj1_sig(simple_P0 _ n v w S0 S1 S2 S3 x) ))->forall i:nat,F(w i).
Lemma simple_P4: forall(U:Type)(A:Ensemble U), simple_0 _ 2(fun i:nat=>INR i)(fun i:nat=>if eq_nat_dec i 0 then Complement _ A else if eq_nat_dec i 1 then A else Empty_set _).
Lemma simple_P5: forall(U:Type)(A:Ensemble U), simple_1 _ 2(fun i:nat=>INR i)(fun i:nat=>if eq_nat_dec i 0 then Complement _ A else if eq_nat_dec i 1 then A else Empty_set _).
Lemma simple_P6: forall(U:Type)(A:Ensemble U), simple_2 _ 2(fun i:nat=>INR i)(fun i:nat=>if eq_nat_dec i 0 then Complement _ A else if eq_nat_dec i 1 then A else Empty_set _).
Lemma simple_P7: forall(U:Type)(A:Ensemble U), simple_3 _ 2(fun i:nat=>INR i)(fun i:nat=>if eq_nat_dec i 0 then Complement _ A else if eq_nat_dec i 1 then A else Empty_set _).
Lemma simple_P8: forall(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''': sigalg_2 _ F), forall A:Ensemble U,F A-> let n:=2 in let v:=fun i:nat=>INR i in let w:=fun i:nat=>if eq_nat_dec i 0 then Complement _ A else if eq_nat_dec i 1 then A else Empty_set _ in msurable _ _ F' F'' F''' (fun x:U=>v(proj1_sig(simple_P0 _ n v w (simple_P4 _ _)(simple_P5 _ _)(simple_P6 _ _)(simple_P7 _ _) x))).
Lemma simple_P9: (forall(U:Type)(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), forall c:R,0<c->simple_0 _ n (fun i:nat=>v i*c)w)%R.
Lemma simple_P10: (forall(U:Type)(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), forall c:R,0<c->simple_1 _ n (fun i:nat=>v i*c)w)%R.
Lemma simple_P11: (forall(U:Type)(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), forall c:R,0<c->simple_2 _ n (fun i:nat=>v i*c)w)%R.
Lemma simple_P12: (forall(U:Type)(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), forall c:R,0<c->simple_3 _ n (fun i:nat=>v i*c) w)%R.
Lemma simple_P13: (forall(U:Type)(F:Ensemble(Ensemble U))(F':sigalg_0 _ F)(F'':sigalg_1 _ F)(F''' :sigalg_2 _ F)(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) ))), forall c:R,forall c':0<c,msurable _ _ F' F'' F''' (fun x:U=>(fun i:nat=>v i*c)( proj1_sig(simple_P0 _ n (fun i:nat=>v i*c) w (simple_P9 _ n v w S0 S1 S2 S3 c c')(simple_P10 _ n v w S0 S1 S2 S3 c c')(simple_P11 _ n v w S0 S1 S2 S3 c c')( simple_P12 _ n v w S0 S1 S2 S3 c c') x))))%R.