Definition measurable_set_Ensemble (Omega: measurable_subspace): measurable_set Omega -> Ensemble U := fun P => Intersection _ (@proj1_sig _ _ P) Omega.
Global Coercion measurable_set_Ensemble: measurable_set >-> Ensemble.
Definition measurable_set_Prop (Omega: measurable_subspace): measurable_set Omega -> U -> Prop := fun P => Intersection _ (@proj1_sig _ _ P) Omega.
Global Coercion measurable_set_Prop: measurable_set >-> Funclass.
Definition measurable_set_inj {Omega: measurable_subspace} (P: measurable_set Omega): @sigma_algebra.measurable_set _ (sub_sigma_algebra Omega).
destruct Omega as [Omega ?H], P as [P ?H].
unfold is_measurable_set in H0.
simpl in *.
exact (exist _ _ H0).
Defined.
Definition measurable_set_inv {Omega: measurable_subspace} (P: @sigma_algebra.measurable_set _ (sub_sigma_algebra Omega)): measurable_set Omega.
exists (unsig_Set P).
unfold is_measurable_set, sig_Set, unsig_Set.
destruct P as [P ?H]; simpl.
eapply is_measurable_set_proper; [| eassumption].
split; hnf; unfold In; intros.
+ destruct x, H0; simpl in *.
assert (p = x0) by (apply proof_irrelevance; auto); subst; auto.
+ exists (proj2_sig x).
destruct x; simpl; auto.
Defined.
Record MeasurableFunction (Omega: measurable_subspace) (B: Type) {SB: SigmaAlgebra B}: Type := {
raw_function: U -> B -> Prop;
rf_partial_functionality: forall a b1 b2, raw_function a b1 -> raw_function a b2 -> b1 = b2;
rf_complete: forall a, Omega a -> exists b, raw_function a b;
rf_sound: forall a b, raw_function a b -> Omega a;
rf_preserve: forall (P: sigma_algebra.measurable_set B), is_measurable_set (fun a => forall b, raw_function a b -> P b) Omega
}.
Definition MeasurableFunction_raw_function (Omega: measurable_subspace) (B: Type) {SB: SigmaAlgebra B} (f: MeasurableFunction Omega B): U -> B -> Prop := raw_function _ _ f.
Coercion MeasurableFunction_raw_function: MeasurableFunction >-> Funclass.
Definition MeasurableFunction_inj {Omega: measurable_subspace} {B: Type} {SB: SigmaAlgebra B} (f: MeasurableFunction Omega B): @measurable_function.MeasurableFunction _ B (sub_sigma_algebra Omega) _.
apply (measurable_function.Build_MeasurableFunction _ _ _ _ (fun a b => f (proj1_sig a) b)).
+ intros [a ?] ? ? ? ?; simpl in *.
apply (rf_partial_functionality _ _ f a b1 b2); auto.
+ intros [a ?]; simpl in *.
destruct (rf_complete _ _ f a p) as [b ?H].
exists b; auto.
+ intros; simpl.
exact (rf_preserve _ _ f P).
Defined.
Definition MeasurableFunction_inv {Omega: measurable_subspace} {B: Type} {SB: SigmaAlgebra B} (f: @measurable_function.MeasurableFunction _ B (sub_sigma_algebra Omega) _): MeasurableFunction Omega B.
apply (Build_MeasurableFunction _ _ _ (fun a b => exists a0, proj1_sig a0 = a /\ f a0 b)).
+ intros ? ? ? [[? ?] [? ?]] [[? ?] [? ?]].
simpl in *; subst.
assert (p = p0) by (apply proof_irrelevance; auto); subst.
apply (measurable_function.rf_functionality _ _ _ _ _ _ H0 H2).
+ intros ? ?.
destruct (measurable_function.rf_complete _ _ f (exist _ a H)) as [b ?H].
exists b, (exist _ a H); auto.
+ intros ? ? [[? ?] [? ?]].
simpl in *; subst; auto.
+ intros.
pose proof measurable_function.rf_preserve _ _ f P.
unfold is_measurable_set.
eapply sigma_algebra.is_measurable_set_proper; [| eassumption].
split; hnf; unfold In, sig_Set; intros.
- apply H0.
exists x; auto.
- apply H0; intros.
destruct H1 as [? [? ?]]; auto.
assert (x = x0).
Focus 1. {
destruct x as [x p], x0 as [x0 p0]; simpl in H1; subst.
f_equal.
apply proof_irrelevance; auto.
} Unfocus.
subst; auto.
Defined.

(* Specifications: *)
Lemma measurable_set_measurable_subspace: forall (Omega: measurable_subspace) (A: measurable_set Omega) x, A x -> Omega x.
Definition Compose {Omega: measurable_subspace} {B C: Type} {SB: SigmaAlgebra B} {SC: SigmaAlgebra C} (g: measurable_function.MeasurableFunction B C) (f: MeasurableFunction Omega B): MeasurableFunction Omega C := MeasurableFunction_inv (measurable_function.Compose g (MeasurableFunction_inj f)).