Require Export Coq.Sets.Ensembles.
Require Export Coq.Classes.Equivalence.
Require Export Coq.Classes.Morphisms.
Require Export Coq.Logic.Classical.
Require Export RamifyCoq.lib.Ensembles_ext.
Definition unsig_Set {U: Type} {P: U -> Prop} (A: Ensemble {x: U | P x}): Ensemble U := fun x => exists H: P x, A (exist _ x H).
Definition sig_Set {U: Type} (Q P: Ensemble U): Ensemble {x: U | P x} := fun x => Q (proj1_sig x).
Class SigmaAlgebra (Omega: Type): Type := {
is_measurable_set: Ensemble Omega -> Prop;
is_measurable_set_proper: Proper (Same_set ==> iff) is_measurable_set;
full_measurable: is_measurable_set (Full_set _);
complement_measurable: forall P, is_measurable_set P -> is_measurable_set (Complement _ P);
countable_union_measurable: forall P: nat -> Ensemble Omega, (forall i, is_measurable_set (P i)) -> is_measurable_set (Countable_Union _ P)
}.

(* Specifications: *)
Lemma empty_measurable {Omega: Type} {sa: SigmaAlgebra Omega}: is_measurable_set (Empty_set _).
Lemma union_measurable {Omega: Type} {sa: SigmaAlgebra Omega}: forall P Q, is_measurable_set P -> is_measurable_set Q -> is_measurable_set (Union _ P Q).
Lemma intersection_measurable {Omega: Type} {sa: SigmaAlgebra Omega}: forall P Q, is_measurable_set P -> is_measurable_set Q -> is_measurable_set (Intersection _ P Q).
Definition measurable_set (Omega: Type) {sa: SigmaAlgebra Omega}: Type := {x: Ensemble Omega | is_measurable_set x}.