Record MeasurableFunction (A B: Type) {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} : Type := {
  raw_function: A -> B -> Prop;
  rf_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
  rf_complete: forall a, exists b, raw_function a b;
  rf_preserve: forall (P: measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b)
}.Record MeasurableFunction (A B: Type) {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} : Type := {
  raw_function: A -> B -> Prop;
  rf_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
  rf_complete: forall a, exists b, raw_function a b;
  rf_preserve: forall (P: measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b)
}.Record MeasurableFunction (A B: Type) {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} : Type := {
  raw_function: A -> B -> Prop;
  rf_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
  rf_complete: forall a, exists b, raw_function a b;
  rf_preserve: forall (P: measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b)
}.Record MeasurableFunction (A B: Type) {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} : Type := {
  raw_function: A -> B -> Prop;
  rf_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
  rf_complete: forall a, exists b, raw_function a b;
  rf_preserve: forall (P: measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b)
}.Record MeasurableFunction (A B: Type) {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} : Type := {
  raw_function: A -> B -> Prop;
  rf_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
  rf_complete: forall a, exists b, raw_function a b;
  rf_preserve: forall (P: measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b)
}.Definition MeasurableFunction_raw_function {A B: Type} {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} (f: MeasurableFunction A B): A -> B -> Prop := raw_function _ _ f.Definition PreImage_MSet {A B: Type} {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} (f: MeasurableFunction A B) (PB: measurable_set B): measurable_set A := exist _ _ (rf_preserve A B f PB).

(* Specifications: *)
Lemma PreImage_Countable_Union_comm: forall {A B: Type} {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} (f: MeasurableFunction A B) (PB: nat -> measurable_set B), Same_MSet (PreImage_MSet f (Countable_Union_MSet PB)) (Countable_Union_MSet (fun n => PreImage_MSet f (PB n))).
Lemma PreImage_Disjoint: forall {A B: Type} {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} (f: MeasurableFunction A B) (PB1 PB2: measurable_set B), Disjoint B PB1 PB2 -> Disjoint A (PreImage_MSet f PB1) (PreImage_MSet f PB2).
Lemma PreImage_Full: forall {A B: Type} {sA: SigmaAlgebra A} {sB: SigmaAlgebra B} (f: MeasurableFunction A B), Same_MSet (PreImage_MSet f (Full_MSet B)) (Full_MSet A).