theory Conditional_Expectation imports Probability_Measure begin
subsection \<open>Restricting a measure to a sub-sigma-algebra\<close>
definition subalgebra::"'a measure \ 'a measure \ bool" where "subalgebra M F = ((space F = space M) \ (sets F \ sets M))"
lemma sub_measure_space: assumes i: "subalgebra M F" shows"measure_space (space M) (sets F) (emeasure M)" proof - have"sigma_algebra (space M) (sets F)" by (metis i measure_space measure_space_def subalgebra_def) moreoverhave"positive (sets F) (emeasure M)" using Sigma_Algebra.positive_def by auto moreoverhave"countably_additive (sets F) (emeasure M)" by (meson countably_additive_def emeasure_countably_additive i order_trans subalgebra_def subsetCE) ultimatelyshow ?thesis unfolding measure_space_def by simp qed
definition restr_to_subalg::"'a measure \ 'a measure \ 'a measure" where "restr_to_subalg M F = measure_of (space M) (sets F) (emeasure M)"
lemma space_restr_to_subalg: "space (restr_to_subalg M F) = space M" unfolding restr_to_subalg_def by (simp add: space_measure_of_conv)
lemma sets_restr_to_subalg [measurable_cong]: assumes"subalgebra M F" shows"sets (restr_to_subalg M F) = sets F" unfolding restr_to_subalg_def by (metis sets.sets_measure_of_eq assms subalgebra_def)
lemma emeasure_restr_to_subalg: assumes"subalgebra M F" "A \ sets F" shows"emeasure (restr_to_subalg M F) A = emeasure M A" unfolding restr_to_subalg_def by (metis assms subalgebra_def emeasure_measure_of_conv sub_measure_space sets.sigma_sets_eq)
lemma null_sets_restr_to_subalg: assumes"subalgebra M F" shows"null_sets (restr_to_subalg M F) = null_sets M \ sets F" proof have"x \ null_sets M \ sets F" if "x \ null_sets (restr_to_subalg M F)" for x by (metis that Int_iff assms emeasure_restr_to_subalg null_setsD1 null_setsD2 null_setsI
sets_restr_to_subalg subalgebra_def subsetD) thenshow"null_sets (restr_to_subalg M F) \ null_sets M \ sets F" by auto next have"x \ null_sets (restr_to_subalg M F)" if "x \ null_sets M \ sets F" for x by (metis that Int_iff assms null_setsD1 null_setsI sets_restr_to_subalg emeasure_restr_to_subalg[OF assms]) thenshow"null_sets M \ sets F \ null_sets (restr_to_subalg M F)" by auto qed
lemma AE_restr_to_subalg: assumes"subalgebra M F" "AE x in (restr_to_subalg M F). P x" shows"AE x in M. P x" proof - obtain A where A: "\x. x \ space (restr_to_subalg M F) - A \ P x" "A \ null_sets (restr_to_subalg M F)" using AE_E3[OF assms(2)] by auto thenhave"A \ null_sets M" using null_sets_restr_to_subalg[OF assms(1)] by auto moreoverhave"\x. x \ space M - A \ P x" using space_restr_to_subalg A(1) by fastforce ultimatelyshow ?thesis unfolding eventually_ae_filter by auto qed
lemma AE_restr_to_subalg2: assumes"subalgebra M F" "AE x in M. P x"and [measurable]: "P \ measurable F (count_space UNIV)" shows"AE x in (restr_to_subalg M F). P x" proof -
define U where"U = {x \ space M. \(P x)}" thenhave *: "U = {x \ space F. \(P x)}" using assms(1) by (simp add: subalgebra_def) thenhave"U \ sets F" by simp thenhave"U \ sets M" using assms(1) by (meson subalgebra_def subsetD) thenhave"U \ null_sets M" unfolding U_def using assms(2) using AE_iff_measurable by blast thenhave"U \ null_sets (restr_to_subalg M F)" using null_sets_restr_to_subalg[OF assms(1)] \U \ sets F\ by auto thenshow ?thesis using * by (metis (no_types, lifting) Collect_mono U_def eventually_ae_filter space_restr_to_subalg) qed
lemma prob_space_restr_to_subalg: assumes"subalgebra M F" "prob_space M" shows"prob_space (restr_to_subalg M F)" by (metis (no_types, lifting) assms(1) assms(2) emeasure_restr_to_subalg prob_space.emeasure_space_1 prob_spaceI
sets.top space_restr_to_subalg subalgebra_def)
lemma finite_measure_restr_to_subalg: assumes"subalgebra M F" "finite_measure M" shows"finite_measure (restr_to_subalg M F)" by (metis (no_types, lifting) assms emeasure_restr_to_subalg finite_measure.finite_emeasure_space
finite_measureI sets.top space_restr_to_subalg subalgebra_def infinity_ennreal_def)
lemma measurable_in_subalg: assumes"subalgebra M F" "f \ measurable F N" shows"f \ measurable (restr_to_subalg M F) N" by (metis measurable_cong_sets assms(2) sets_restr_to_subalg[OF assms(1)])
lemma measurable_in_subalg': assumes"subalgebra M F" "f \ measurable (restr_to_subalg M F) N" shows"f \ measurable F N" by (metis measurable_cong_sets assms(2) sets_restr_to_subalg[OF assms(1)])
lemma measurable_from_subalg: assumes"subalgebra M F" "f \ measurable F N" shows"f \ measurable M N" using assms unfolding measurable_def subalgebra_def by auto
text\<open>The following is the direct transposition of \verb+nn_integral_subalgebra+
(from\verb+Nonnegative_Lebesgue_Integration+) in the
current notations, with the removal of the useless assumption $f \geq 0$.\<close>
lemma nn_integral_subalgebra2: assumes"subalgebra M F"and [measurable]: "f \ borel_measurable F" shows"(\\<^sup>+ x. f x \(restr_to_subalg M F)) = (\\<^sup>+ x. f x \M)" proof (rule nn_integral_subalgebra) show"f \ borel_measurable (restr_to_subalg M F)" by (rule measurable_in_subalg[OF assms(1)]) simp show"sets (restr_to_subalg M F) \ sets M" by (metis sets_restr_to_subalg[OF assms(1)] assms(1) subalgebra_def) fix A assume"A \ sets (restr_to_subalg M F)" thenshow"emeasure (restr_to_subalg M F) A = emeasure M A" by (metis sets_restr_to_subalg[OF assms(1)] emeasure_restr_to_subalg[OF assms(1)]) qed (auto simp add: assms space_restr_to_subalg sets_restr_to_subalg[OF assms(1)])
text\<open>The following is the direct transposition of \verb+integral_subalgebra+
(from\verb+Bochner_Integration+) in the current notations.\<close>
lemma integral_subalgebra2: fixes f :: "'a \ 'b::{banach, second_countable_topology}" assumes"subalgebra M F"and
[measurable]: "f \ borel_measurable F" shows"(\x. f x \(restr_to_subalg M F)) = (\x. f x \M)" by (rule integral_subalgebra,
metis measurable_in_subalg[OF assms(1)] assms(2),
auto simp add: assms space_restr_to_subalg sets_restr_to_subalg emeasure_restr_to_subalg,
meson assms(1) subalgebra_def subset_eq)
lemma integrable_from_subalg: fixes f :: "'a \ 'b::{banach, second_countable_topology}" assumes"subalgebra M F" "integrable (restr_to_subalg M F) f" shows"integrable M f" proof (rule integrableI_bounded) have [measurable]: "f \ borel_measurable F" using assms by auto thenshow"f \ borel_measurable M" using assms(1) measurable_from_subalg by blast
have"(\\<^sup>+ x. ennreal (norm (f x)) \M) = (\\<^sup>+ x. ennreal (norm (f x)) \(restr_to_subalg M F))" by (rule nn_integral_subalgebra2[symmetric], auto simp add: assms) alsohave"... < \" using integrable_iff_bounded assms by auto finallyshow"(\\<^sup>+ x. ennreal (norm (f x)) \M) < \" by simp qed
lemma integrable_in_subalg: fixes f :: "'a \ 'b::{banach, second_countable_topology}" assumes [measurable]: "subalgebra M F" "f \ borel_measurable F" "integrable M f" shows"integrable (restr_to_subalg M F) f" proof (rule integrableI_bounded) show"f \ borel_measurable (restr_to_subalg M F)" using assms(2) assms(1) by auto have"(\\<^sup>+ x. ennreal (norm (f x)) \(restr_to_subalg M F)) = (\\<^sup>+ x. ennreal (norm (f x)) \M)" by (rule nn_integral_subalgebra2, auto simp add: assms) alsohave"... < \" using integrable_iff_bounded assms by auto finallyshow"(\\<^sup>+ x. ennreal (norm (f x)) \(restr_to_subalg M F)) < \" by simp qed
text\<open>The conditional expectation of a function $f$, on a measure space $M$, with respect to a
sub sigma algebra $F$, should be a function $g$ which is $F$-measurable whose integral on any
$F$-set coincides with the integral of $f$.
Such a functionis uniquely defined almost everywhere.
The most direct construction istouse the measure $f dM$, restrict it to the sigma-algebra $F$, andapply the Radon-Nikodym theoremto write it as $g dM_{|F}$ for some $F$-measurable function $g$.
Another classical construction for $L^2$ functions isdoneby orthogonal projection on $F$-measurable
functions, andthen extending by density to $L^1$. The Radon-Nikodym point of view avoids the $L^2$
machinery, and works for all positive functions.
In this paragraph, we develop the definitionand basic properties for nonnegative functions,
as the basics of the general case. As in the definition of integrals, the nonnegative caseisdone with ennreal-valued functions, without any integrability assumption. \<close>
definition nn_cond_exp :: "'a measure \ 'a measure \ ('a \ ennreal) \ ('a \ ennreal)" where "nn_cond_exp M F f =
(if f \<in> borel_measurable M \<and> subalgebra M F then RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M f) F)
else (\<lambda>_. 0))"
lemma shows borel_measurable_nn_cond_exp [measurable]: "nn_cond_exp M F f \ borel_measurable F" and borel_measurable_nn_cond_exp2 [measurable]: "nn_cond_exp M F f \ borel_measurable M" by (simp_all add: nn_cond_exp_def)
(metis borel_measurable_RN_deriv borel_measurable_subalgebra sets_restr_to_subalg space_restr_to_subalg subalgebra_def)
text\<open>The good setting for conditional expectations is the situation where the subalgebra $F$
gives rise to a sigma-finite measure space. To see what goes wrong if it is not sigma-finite,
think of $\mathbb{R}$ with the trivial sigma-algebra $\{\emptyset, \mathbb{R}\}$. In this case,
conditional expectations haveto be constant functions, so they have integral $0$ or $\infty$.
This means that a positive integrable function can have no meaningful conditional expectation.\<close>
locale sigma_finite_subalgebra = fixes M F::"'a measure" assumes subalg: "subalgebra M F" and sigma_fin_subalg: "sigma_finite_measure (restr_to_subalg M F)"
lemma sigma_finite_subalgebra_is_sigma_finite: assumes"sigma_finite_subalgebra M F" shows"sigma_finite_measure M" proof have subalg: "subalgebra M F" and sigma_fin_subalg: "sigma_finite_measure (restr_to_subalg M F)" using assms unfolding sigma_finite_subalgebra_def by auto obtain A where Ap: "countable A \ A \ sets (restr_to_subalg M F) \ \A = space (restr_to_subalg M F) \ (\a\A. emeasure (restr_to_subalg M F) a \ \)" using sigma_finite_measure.sigma_finite_countable[OF sigma_fin_subalg] by fastforce have"A \ sets F" using Ap sets_restr_to_subalg[OF subalg] by fastforce thenhave"A \ sets M" using subalg subalgebra_def by force moreoverhave"\A = space M" using Ap space_restr_to_subalg by simp moreoverhave"\a\A. emeasure M a \ \" by (metis subsetD emeasure_restr_to_subalg[OF subalg] \A \ sets F\ Ap) ultimatelyshow"\A. countable A \ A \ sets M \ \A = space M \ (\a\A. emeasure M a \ \)" using Ap by auto qed
sublocale sigma_finite_subalgebra \<subseteq> sigma_finite_measure using sigma_finite_subalgebra_is_sigma_finite sigma_finite_subalgebra_axioms by blast
text\<open>Conditional expectations are very often used in probability spaces. This is a special case
of the previous one, as we prove now.\<close>
lemma finite_measure_subalgebra_is_sigma_finite: assumes"finite_measure_subalgebra M F" shows"sigma_finite_subalgebra M F" proof - interpret finite_measure_subalgebra M F using assms by simp have"finite_measure (restr_to_subalg M F)" using finite_measure_restr_to_subalg subalg finite_emeasure_space finite_measureI unfolding infinity_ennreal_def by blast thenhave"sigma_finite_measure (restr_to_subalg M F)" unfolding finite_measure_def by simp thenshow"sigma_finite_subalgebra M F"unfolding sigma_finite_subalgebra_def using subalg by simp qed
sublocale finite_measure_subalgebra \<subseteq> sigma_finite_subalgebra proof - have"finite_measure (restr_to_subalg M F)" using finite_measure_restr_to_subalg subalg finite_emeasure_space finite_measureI unfolding infinity_ennreal_def by blast thenhave"sigma_finite_measure (restr_to_subalg M F)" unfolding finite_measure_def by simp thenshow"sigma_finite_subalgebra M F"unfolding sigma_finite_subalgebra_def using subalg by simp qed
context sigma_finite_subalgebra begin
text\<open>The next lemma is arguably the most fundamental property of conditional expectation:
when computing an expectation against an $F$-measurable function, it is equivalent to work with a function or with its $F$-conditional expectation.
This property (even for bounded test functions) characterizes conditional expectations, as the second lemma below shows. From this point on, we will only work with it, and forget completely about
the definitionusing Radon-Nikodym derivatives. \<close>
lemma nn_cond_exp_intg: assumes [measurable]: "f \ borel_measurable F" "g \ borel_measurable M" shows"(\\<^sup>+ x. f x * nn_cond_exp M F g x \M) = (\\<^sup>+ x. f x * g x \M)" proof - have [measurable]: "f \ borel_measurable M" by (meson assms subalg borel_measurable_subalgebra subalgebra_def) have ac: "absolutely_continuous (restr_to_subalg M F) (restr_to_subalg (density M g) F)" unfolding absolutely_continuous_def proof - have"null_sets (restr_to_subalg M F) = null_sets M \ sets F" by (rule null_sets_restr_to_subalg[OF subalg]) moreoverhave"null_sets M \ null_sets (density M g)" by (rule absolutely_continuousI_density[unfolded absolutely_continuous_def]) auto ultimatelyhave"null_sets (restr_to_subalg M F) \ null_sets (density M g) \ sets F" by auto moreoverhave"null_sets (density M g) \ sets F = null_sets (restr_to_subalg (density M g) F)" by (rule null_sets_restr_to_subalg[symmetric]) (metis subalg sets_density space_density subalgebra_def) ultimatelyshow"null_sets (restr_to_subalg M F) \ null_sets (restr_to_subalg (density M g) F)" by auto qed
have"(\\<^sup>+ x. f x * nn_cond_exp M F g x \M) = (\\<^sup>+ x. f x * nn_cond_exp M F g x \(restr_to_subalg M F))" by (rule nn_integral_subalgebra2[symmetric]) (simp_all add: assms subalg) alsohave"... = (\\<^sup>+ x. f x * RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x \(restr_to_subalg M F))" unfolding nn_cond_exp_def using assms subalg by simp alsohave"... = (\\<^sup>+ x. RN_deriv (restr_to_subalg M F) (restr_to_subalg (density M g) F) x * f x \(restr_to_subalg M F))" by (simp add: mult.commute) alsohave"... = (\\<^sup>+ x. f x \(restr_to_subalg (density M g) F))" proof (rule sigma_finite_measure.RN_deriv_nn_integral[symmetric]) show"sets (restr_to_subalg (density M g) F) = sets (restr_to_subalg M F)" by (metis subalg restr_to_subalg_def sets.sets_measure_of_eq space_density subalgebra_def) qed (auto simp add: assms measurable_restrict ac measurable_in_subalg subalg sigma_fin_subalg) alsohave"... = (\\<^sup>+ x. f x \(density M g))" by (metis nn_integral_subalgebra2 subalg assms(1) sets_density space_density subalgebra_def) alsohave"... = (\\<^sup>+ x. g x * f x \M)" by (rule nn_integral_density) (simp_all add: assms) alsohave"... = (\\<^sup>+ x. f x * g x \M)" by (simp add: mult.commute) finallyshow ?thesis by simp qed
lemma nn_cond_exp_charact: assumes"\A. A \ sets F \ (\\<^sup>+ x \ A. f x \M) = (\\<^sup>+ x \ A. g x \M)" and
[measurable]: "f \ borel_measurable M" "g \ borel_measurable F" shows"AE x in M. g x = nn_cond_exp M F f x" proof - let ?MF = "restr_to_subalg M F"
{ fix A assume"A \ sets ?MF" thenhave [measurable]: "A \ sets F" using sets_restr_to_subalg[OF subalg] by simp have"(\\<^sup>+ x \ A. g x \ ?MF) = (\\<^sup>+ x \ A. g x \M)" by (simp add: nn_integral_subalgebra2 subalg) alsohave"... = (\\<^sup>+ x \ A. f x \M)" using assms(1) by simp alsohave"... = (\\<^sup>+ x. indicator A x * f x \M)" by (simp add: mult.commute) alsohave"... = (\\<^sup>+ x. indicator A x * nn_cond_exp M F f x \M)" by (rule nn_cond_exp_intg[symmetric]) (auto simp add: assms) alsohave"... = (\\<^sup>+ x \ A. nn_cond_exp M F f x \M)" by (simp add: mult.commute) alsohave"... = (\\<^sup>+ x \ A. nn_cond_exp M F f x \ ?MF)" by (simp add: nn_integral_subalgebra2 subalg) finallyhave"(\\<^sup>+ x \ A. g x \ ?MF) = (\\<^sup>+ x \ A. nn_cond_exp M F f x \ ?MF)" by simp
} note * = this have"AE x in ?MF. g x = nn_cond_exp M F f x" by (rule sigma_finite_measure.density_unique2)
(auto simp add: assms subalg sigma_fin_subalg AE_restr_to_subalg2 *) thenshow ?thesis using AE_restr_to_subalg[OF subalg] by simp qed
lemma nn_cond_exp_F_meas: assumes"f \ borel_measurable F" shows"AE x in M. f x = nn_cond_exp M F f x" by (rule nn_cond_exp_charact) (auto simp add: assms measurable_from_subalg[OF subalg])
lemma nn_cond_exp_prod: assumes [measurable]: "f \ borel_measurable F" "g \ borel_measurable M" shows"AE x in M. f x * nn_cond_exp M F g x = nn_cond_exp M F (\x. f x * g x) x" proof (rule nn_cond_exp_charact) have [measurable]: "f \ borel_measurable M" by (rule measurable_from_subalg[OF subalg assms(1)]) show"(\x. f x * g x) \ borel_measurable M" by measurable
fix A assume"A \ sets F" thenhave [measurable]: "(\x. f x * indicator A x) \ borel_measurable F" by measurable have"(\\<^sup>+x\A. (f x * g x) \M) = \\<^sup>+x. (f x * indicator A x) * g x \M" by (simp add: mult.commute mult.left_commute) alsohave"... = \\<^sup>+x. (f x * indicator A x) * nn_cond_exp M F g x \M" by (rule nn_cond_exp_intg[symmetric]) (auto simp add: assms) alsohave"... = (\\<^sup>+x\A. (f x * nn_cond_exp M F g x)\M)" by (simp add: mult.commute mult.left_commute) finallyshow"(\\<^sup>+x\A. (f x * g x) \M) = (\\<^sup>+x\A. (f x * nn_cond_exp M F g x)\M)" by simp qed (auto simp add: assms)
lemma nn_cond_exp_sum: assumes [measurable]: "f \ borel_measurable M" "g \ borel_measurable M" shows"AE x in M. nn_cond_exp M F f x + nn_cond_exp M F g x = nn_cond_exp M F (\x. f x + g x) x" proof (rule nn_cond_exp_charact) fix A assume [measurable]: "A \ sets F" thenhave"A \ sets M" by (meson subalg subalgebra_def subsetD) have"(\\<^sup>+x\A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\M) = (\\<^sup>+x\A. nn_cond_exp M F f x \M) + (\\<^sup>+x\A. nn_cond_exp M F g x \M)" by (rule nn_set_integral_add) (auto simp add: assms \<open>A \<in> sets M\<close>) alsohave"... = (\\<^sup>+x. indicator A x * nn_cond_exp M F f x \M) + (\\<^sup>+x. indicator A x * nn_cond_exp M F g x \M)" by (metis (no_types, lifting) mult.commute nn_integral_cong) alsohave"... = (\\<^sup>+x. indicator A x * f x \M) + (\\<^sup>+x. indicator A x * g x \M)" by (simp add: nn_cond_exp_intg) alsohave"... = (\\<^sup>+x\A. f x \M) + (\\<^sup>+x\A. g x \M)" by (metis (no_types, lifting) mult.commute nn_integral_cong) alsohave"... = (\\<^sup>+x\A. (f x + g x)\M)" by (rule nn_set_integral_add[symmetric]) (auto simp add: assms \<open>A \<in> sets M\<close>) finallyshow"(\\<^sup>+x\A. (f x + g x)\M) = (\\<^sup>+x\A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\M)" by simp qed (auto simp add: assms)
lemma nn_cond_exp_cong: assumes"AE x in M. f x = g x" and [measurable]: "f \ borel_measurable M" "g \ borel_measurable M" shows"AE x in M. nn_cond_exp M F f x = nn_cond_exp M F g x" proof (rule nn_cond_exp_charact) fix A assume [measurable]: "A \ sets F" have"(\\<^sup>+x\A. nn_cond_exp M F f x \M) = \\<^sup>+x. indicator A x * nn_cond_exp M F f x \M" by (simp add: mult.commute) alsohave"... = \\<^sup>+x. indicator A x * f x \M" by (simp add: nn_cond_exp_intg assms) alsohave"... = (\\<^sup>+x\A. f x \M)" by (simp add: mult.commute) alsohave"... = (\\<^sup>+x\A. g x \M)" by (rule nn_set_integral_cong[OF assms(1)]) finallyshow"(\\<^sup>+x\A. g x \M) = (\\<^sup>+x\A. nn_cond_exp M F f x \M)" by simp qed (auto simp add: assms)
lemma nn_cond_exp_mono: assumes"AE x in M. f x \ g x" and [measurable]: "f \ borel_measurable M" "g \ borel_measurable M" shows"AE x in M. nn_cond_exp M F f x \ nn_cond_exp M F g x" proof -
define h where"h = (\x. g x - f x)" have [measurable]: "h \ borel_measurable M" unfolding h_def by simp have *: "AE x in M. g x = f x + h x"unfolding h_def using assms(1) by (auto simp: ennreal_ineq_diff_add) have"AE x in M. nn_cond_exp M F g x = nn_cond_exp M F (\x. f x + h x) x" by (rule nn_cond_exp_cong) (auto simp add: * assms) moreoverhave"AE x in M. nn_cond_exp M F f x + nn_cond_exp M F h x = nn_cond_exp M F (\x. f x + h x) x" by (rule nn_cond_exp_sum) (auto simp add: assms) ultimatelyhave"AE x in M. nn_cond_exp M F g x = nn_cond_exp M F f x + nn_cond_exp M F h x"by auto thenshow ?thesis by force qed
lemma nested_subalg_is_sigma_finite: assumes"subalgebra M G""subalgebra G F" shows"sigma_finite_subalgebra M G" unfolding sigma_finite_subalgebra_def proof (auto simp add: assms) have"\A. countable A \ A \ sets (restr_to_subalg M F) \ \A = space (restr_to_subalg M F) \ (\a\A. emeasure (restr_to_subalg M F) a \ \)" using sigma_fin_subalg sigma_finite_measure_def by auto thenobtain A where A:"countable A \ A \ sets (restr_to_subalg M F) \ \A = space (restr_to_subalg M F) \ (\a\A. emeasure (restr_to_subalg M F) a \ \)" by auto have"sets F \ sets M" by (meson assms order_trans subalgebra_def) thenhave"countable A \ A \ sets (restr_to_subalg M G) \ \A = space (restr_to_subalg M F) \ (\a\A. emeasure (restr_to_subalg M G) a \ \)" by (metis (no_types) A assms basic_trans_rules(31) emeasure_restr_to_subalg order_trans sets_restr_to_subalg subalgebra_def) thenshow"sigma_finite_measure (restr_to_subalg M G)" by (metis sigma_finite_measure.intro space_restr_to_subalg) qed
lemma nn_cond_exp_nested_subalg: assumes"subalgebra M G""subalgebra G F" and [measurable]: "f \ borel_measurable M" shows"AE x in M. nn_cond_exp M F f x = nn_cond_exp M F (nn_cond_exp M G f) x" proof (rule nn_cond_exp_charact, auto) interpret G: sigma_finite_subalgebra M G by (rule nested_subalg_is_sigma_finite[OF assms(1) assms(2)]) fix A assume [measurable]: "A \ sets F" thenhave [measurable]: "A \ sets G" using assms(2) by (meson subsetD subalgebra_def)
have"set_nn_integral M A (nn_cond_exp M G f) = (\\<^sup>+ x. indicator A x * nn_cond_exp M G f x\M)" by (metis (no_types) mult.commute) alsohave"... = (\\<^sup>+ x. indicator A x * f x \M)" by (rule G.nn_cond_exp_intg, auto simp add: assms) alsohave"... = (\\<^sup>+ x. indicator A x * nn_cond_exp M F f x \M)" by (rule nn_cond_exp_intg[symmetric], auto simp add: assms) alsohave"... = set_nn_integral M A (nn_cond_exp M F f)"by (metis (no_types) mult.commute) finallyshow"set_nn_integral M A (nn_cond_exp M G f) = set_nn_integral M A (nn_cond_exp M F f)". qed
text\<open>Once conditional expectations of positive functions are defined, the definition for real-valued functions
follows readily, by taking the difference of positive and negative parts.
One could also define a conditional expectation of vector-space valued functions, as in \verb+Bochner_Integral+, but since the real-valued case is the most important, and quicker to formalize, I
concentrate on it. (It isalso essential for the case of the most general Pettis integral.) \<close>
definition real_cond_exp :: "'a measure \ 'a measure \ ('a \ real) \ ('a \ real)" where "real_cond_exp M F f =
(\<lambda>x. enn2real(nn_cond_exp M F (\<lambda>x. ennreal (f x)) x) - enn2real(nn_cond_exp M F (\<lambda>x. ennreal (-f x)) x))"
lemma shows borel_measurable_cond_exp [measurable]: "real_cond_exp M F f \ borel_measurable F" and borel_measurable_cond_exp2 [measurable]: "real_cond_exp M F f \ borel_measurable M" unfolding real_cond_exp_def by auto
context sigma_finite_subalgebra begin
lemma real_cond_exp_abs: assumes [measurable]: "f \ borel_measurable M" shows"AE x in M. abs(real_cond_exp M F f x) \ nn_cond_exp M F (\x. ennreal (abs(f x))) x" proof -
define fp where"fp = (\x. ennreal (f x))"
define fm where"fm = (\x. ennreal (- f x))" have [measurable]: "fp \ borel_measurable M" "fm \ borel_measurable M" unfolding fp_def fm_def by auto have eq: "\x. ennreal \f x\ = fp x + fm x" unfolding fp_def fm_def by (simp add: abs_real_def ennreal_neg)
{ fix x assume H: "nn_cond_exp M F fp x + nn_cond_exp M F fm x = nn_cond_exp M F (\x. fp x + fm x) x" have"\real_cond_exp M F f x\ \ \enn2real(nn_cond_exp M F fp x)\ + \enn2real(nn_cond_exp M F fm x)\" unfolding real_cond_exp_def fp_def fm_def by (auto intro: abs_triangle_ineq4 simp del: enn2real_nonneg) from ennreal_leI[OF this] have"abs(real_cond_exp M F f x) \ nn_cond_exp M F fp x + nn_cond_exp M F fm x" by simp (metis add.commute ennreal_enn2real le_iff_add not_le top_unique) alsohave"... = nn_cond_exp M F (\x. fp x + fm x) x" using H by simp finallyhave"abs(real_cond_exp M F f x) \ nn_cond_exp M F (\x. fp x + fm x) x" by simp
} moreoverhave"AE x in M. nn_cond_exp M F fp x + nn_cond_exp M F fm x = nn_cond_exp M F (\x. fp x + fm x) x" by (rule nn_cond_exp_sum) (auto simp add: fp_def fm_def) ultimatelyhave"AE x in M. abs(real_cond_exp M F f x) \ nn_cond_exp M F (\x. fp x + fm x) x" by auto thenshow ?thesis using eq by simp qed
text\<open>The next lemma shows that the conditional expectation is an $F$-measurable function whose average against an $F$-measurable function $f$ coincides with the average of the original function against $f$.
It is obtained as a consequence of the same property for the positive conditional
expectation, taking the difference of the positive and the negative part. The proof is given first assuming $f \geq 0$ for simplicity, and then extended to the general case in
the subsequent lemma. The idea of the proofis essentially trivial, but the implementation is slightly tedious as one should check all the integrability properties of the different parts, and go backand forth between positive integral and signed integrals, and between real-valued
functions and ennreal-valued functions.
Once this lemmais available, we will use it to characterize the conditional expectation, and never come backto the original technical definition, as we did in the case of the
nonnegative conditional expectation. \<close>
lemma real_cond_exp_intg_fpos: assumes"integrable M (\x. f x * g x)" and f_pos[simp]: "\x. f x \ 0" and
[measurable]: "f \ borel_measurable F" "g \ borel_measurable M" shows"integrable M (\x. f x * real_cond_exp M F g x)" "(\ x. f x * real_cond_exp M F g x \M) = (\ x. f x * g x \M)" proof - have [measurable]: "f \ borel_measurable M" by (rule measurable_from_subalg[OF subalg assms(3)])
define gp where"gp = (\x. ennreal (g x))"
define gm where"gm = (\x. ennreal (- g x))" have [measurable]: "gp \ borel_measurable M" "gm \ borel_measurable M" unfolding gp_def gm_def by auto
define h where"h = (\x. ennreal(abs(g x)))" have hgpgm: "\x. h x = gp x + gm x" unfolding gp_def gm_def h_def by (simp add: abs_real_def ennreal_neg) have [measurable]: "h \ borel_measurable M" unfolding h_def by simp have pos[simp]: "\x. h x \ 0" "\x. gp x \ 0" "\x. gm x \ 0" unfolding h_def gp_def gm_def by simp_all have gp_real: "\x. enn2real(gp x) = max (g x) 0" unfolding gp_def by (simp add: max_def ennreal_neg) have gm_real: "\x. enn2real(gm x) = max (-g x) 0" unfolding gm_def by (simp add: max_def ennreal_neg)
have"(\\<^sup>+ x. norm(f x * max (g x) 0) \M) \ (\\<^sup>+ x. norm(f x * g x) \M)" by (simp add: nn_integral_mono) alsohave"... < \" using assms(1) by (simp add: integrable_iff_bounded) finallyhave"(\\<^sup>+ x. norm(f x * max (g x) 0) \M) < \" by simp thenhave int1: "integrable M (\x. f x * max (g x) 0)" by (simp add: integrableI_bounded)
have"(\\<^sup>+ x. norm(f x * max (-g x) 0) \M) \ (\\<^sup>+ x. norm(f x * g x) \M)" by (simp add: nn_integral_mono) alsohave"... < \" using assms(1) by (simp add: integrable_iff_bounded) finallyhave"(\\<^sup>+ x. norm(f x * max (-g x) 0) \M) < \" by simp thenhave int2: "integrable M (\x. f x * max (-g x) 0)" by (simp add: integrableI_bounded)
have"(\\<^sup>+x. f x * nn_cond_exp M F h x \M) = (\\<^sup>+x. f x * h x \M)" by (rule nn_cond_exp_intg) auto alsohave"\ = \\<^sup>+ x. ennreal (f x * max (g x) 0 + f x * max (- g x) 0) \M" unfolding h_def by (intro nn_integral_cong)(auto simp: ennreal_mult[symmetric] abs_mult split: split_max) alsohave"... < \" using Bochner_Integration.integrable_add[OF int1 int2, THEN integrableD(2)] by (auto simp add: less_top) finallyhave *: "(\\<^sup>+x. f x * nn_cond_exp M F h x \M) < \" by simp
have"(\\<^sup>+x. norm(f x * real_cond_exp M F g x) \M) = (\\<^sup>+x. f x * abs(real_cond_exp M F g x) \M)" by (simp add: abs_mult) alsohave"... \ (\\<^sup>+x. f x * nn_cond_exp M F h x \M)" proof (rule nn_integral_mono_AE)
{ fix x assume *: "abs(real_cond_exp M F g x) \ nn_cond_exp M F h x" have"ennreal (f x * \real_cond_exp M F g x\) = f x * ennreal(\real_cond_exp M F g x\)" by (simp add: ennreal_mult) alsohave"... \ f x * nn_cond_exp M F h x" using * by (auto intro!: mult_left_mono) finallyhave"ennreal (f x * \real_cond_exp M F g x\) \ f x * nn_cond_exp M F h x" by simp
} thenshow"AE x in M. ennreal (f x * \real_cond_exp M F g x\) \ f x * nn_cond_exp M F h x" using real_cond_exp_abs[OF assms(4)] h_def by auto qed finallyhave **: "(\\<^sup>+x. norm(f x * real_cond_exp M F g x) \M) < \" using * by auto show"integrable M (\x. f x * real_cond_exp M F g x)" using ** by (intro integrableI_bounded) auto
have"(\\<^sup>+x. f x * nn_cond_exp M F gp x \M) \ (\\<^sup>+x. f x * nn_cond_exp M F h x \M)" proof (rule nn_integral_mono_AE) have"AE x in M. nn_cond_exp M F gp x \ nn_cond_exp M F h x" by (rule nn_cond_exp_mono) (auto simp add: hgpgm) thenshow"AE x in M. f x * nn_cond_exp M F gp x \ f x * nn_cond_exp M F h x" by (auto simp: mult_left_mono) qed thenhave a: "(\\<^sup>+x. f x * nn_cond_exp M F gp x \M) < \" using * by auto have"ennreal(norm(f x * enn2real(nn_cond_exp M F gp x))) \ f x * nn_cond_exp M F gp x" for x by (auto simp add: ennreal_mult intro!: mult_left_mono)
(metis enn2real_ennreal enn2real_nonneg le_cases le_ennreal_iff) thenhave"(\\<^sup>+x. norm(f x * enn2real(nn_cond_exp M F gp x)) \M) \ (\\<^sup>+x. f x * nn_cond_exp M F gp x \M)" by (simp add: nn_integral_mono) thenhave"(\\<^sup>+x. norm(f x * enn2real(nn_cond_exp M F gp x)) \M) < \" using a by auto thenhave gp_int: "integrable M (\x. f x * enn2real(nn_cond_exp M F gp x))" by (simp add: integrableI_bounded) have gp_fin: "AE x in M. f x * nn_cond_exp M F gp x \ \" apply (rule nn_integral_PInf_AE) using a by auto
have"(\ x. f x * enn2real(nn_cond_exp M F gp x) \M) = enn2real (\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gp x) \M)" by (rule integral_eq_nn_integral) auto alsohave"... = enn2real(\\<^sup>+ x. ennreal(f x * enn2real(gp x)) \M)" proof -
{ fix x assume"f x * nn_cond_exp M F gp x \ \" thenhave"ennreal (f x * enn2real (nn_cond_exp M F gp x)) = ennreal (f x) * nn_cond_exp M F gp x" by (auto simp add: ennreal_mult ennreal_mult_eq_top_iff less_top intro!: ennreal_mult_left_cong)
} thenhave"AE x in M. ennreal (f x * enn2real (nn_cond_exp M F gp x)) = ennreal (f x) * nn_cond_exp M F gp x" using gp_fin by auto thenhave"(\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gp x) \M) = (\\<^sup>+ x. f x * nn_cond_exp M F gp x \M)" by (rule nn_integral_cong_AE) alsohave"... = (\\<^sup>+ x. f x * gp x \M)" by (rule nn_cond_exp_intg) (auto simp add: gp_def) alsohave"... = (\\<^sup>+ x. ennreal(f x * enn2real(gp x)) \M)" by (rule nn_integral_cong_AE) (auto simp: ennreal_mult gp_def) finallyhave"(\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gp x) \M) = (\\<^sup>+ x. ennreal(f x * enn2real(gp x)) \M)" by simp thenshow ?thesis by simp qed alsohave"... = (\ x. f x * enn2real(gp x) \M)" by (rule integral_eq_nn_integral[symmetric]) (auto simp add: gp_def) finallyhave gp_expr: "(\ x. f x * enn2real(nn_cond_exp M F gp x) \M) = (\ x. f x * enn2real(gp x) \M)" by simp
have"(\\<^sup>+x. f x * nn_cond_exp M F gm x \M) \ (\\<^sup>+x. f x * nn_cond_exp M F h x \M)" proof (rule nn_integral_mono_AE) have"AE x in M. nn_cond_exp M F gm x \ nn_cond_exp M F h x" by (rule nn_cond_exp_mono) (auto simp add: hgpgm) thenshow"AE x in M. f x * nn_cond_exp M F gm x \ f x * nn_cond_exp M F h x" by (auto simp: mult_left_mono) qed thenhave a: "(\\<^sup>+x. f x * nn_cond_exp M F gm x \M) < \" using * by auto have"\x. ennreal(norm(f x * enn2real(nn_cond_exp M F gm x))) \ f x * nn_cond_exp M F gm x" by (auto simp add: ennreal_mult intro!: mult_left_mono)
(metis enn2real_ennreal enn2real_nonneg le_cases le_ennreal_iff) thenhave"(\\<^sup>+x. norm(f x * enn2real(nn_cond_exp M F gm x)) \M) \ (\\<^sup>+x. f x * nn_cond_exp M F gm x \M)" by (simp add: nn_integral_mono) thenhave"(\\<^sup>+x. norm(f x * enn2real(nn_cond_exp M F gm x)) \M) < \" using a by auto thenhave gm_int: "integrable M (\x. f x * enn2real(nn_cond_exp M F gm x))" by (simp add: integrableI_bounded) have gm_fin: "AE x in M. f x * nn_cond_exp M F gm x \ \" apply (rule nn_integral_PInf_AE) using a by auto
have"(\ x. f x * enn2real(nn_cond_exp M F gm x) \M) = enn2real (\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gm x) \M)" by (rule integral_eq_nn_integral) auto alsohave"... = enn2real(\\<^sup>+ x. ennreal(f x * enn2real(gm x)) \M)" proof -
{ fix x assume"f x * nn_cond_exp M F gm x \ \" thenhave"ennreal (f x * enn2real (nn_cond_exp M F gm x)) = ennreal (f x) * nn_cond_exp M F gm x" by (auto simp add: ennreal_mult ennreal_mult_eq_top_iff less_top intro!: ennreal_mult_left_cong)
} thenhave"AE x in M. ennreal (f x * enn2real (nn_cond_exp M F gm x)) = ennreal (f x) * nn_cond_exp M F gm x" using gm_fin by auto thenhave"(\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gm x) \M) = (\\<^sup>+ x. f x * nn_cond_exp M F gm x \M)" by (rule nn_integral_cong_AE) alsohave"... = (\\<^sup>+ x. f x * gm x \M)" by (rule nn_cond_exp_intg) (auto simp add: gm_def) alsohave"... = (\\<^sup>+ x. ennreal(f x * enn2real(gm x)) \M)" by (rule nn_integral_cong_AE) (auto simp: ennreal_mult gm_def) finallyhave"(\\<^sup>+ x. f x * enn2real(nn_cond_exp M F gm x) \M) = (\\<^sup>+ x. ennreal(f x * enn2real(gm x)) \M)" by simp thenshow ?thesis by simp qed alsohave"... = (\ x. f x * enn2real(gm x) \M)" by (rule integral_eq_nn_integral[symmetric]) (auto simp add: gm_def) finallyhave gm_expr: "(\ x. f x * enn2real(nn_cond_exp M F gm x) \M) = (\ x. f x * enn2real(gm x) \M)" by simp
have"(\ x. f x * real_cond_exp M F g x \M) = (\ x. f x * enn2real(nn_cond_exp M F gp x) - f x * enn2real(nn_cond_exp M F gm x) \M)" unfolding real_cond_exp_def gp_def gm_def by (simp add: right_diff_distrib) alsohave"... = (\ x. f x * enn2real(nn_cond_exp M F gp x) \M) - (\ x. f x * enn2real(nn_cond_exp M F gm x) \M)" by (rule Bochner_Integration.integral_diff) (simp_all add: gp_int gm_int) alsohave"... = (\ x. f x * enn2real(gp x) \M) - (\ x. f x * enn2real(gm x) \M)" using gp_expr gm_expr by simp alsohave"... = (\ x. f x * max (g x) 0 \M) - (\ x. f x * max (-g x) 0 \M)" using gp_real gm_real by simp alsohave"... = (\ x. f x * max (g x) 0 - f x * max (-g x) 0 \M)" by (rule Bochner_Integration.integral_diff[symmetric]) (simp_all add: int1 int2) alsohave"... = (\x. f x * g x \M)" by (metis (mono_tags, opaque_lifting) diff_0 diff_zero eq_iff max.cobounded2 max_def minus_minus neg_le_0_iff_le right_diff_distrib) finallyshow"(\ x. f x * real_cond_exp M F g x \M) = (\x. f x * g x \M)" by simp qed
lemma real_cond_exp_intg: assumes"integrable M (\x. f x * g x)" and
[measurable]: "f \ borel_measurable F" "g \ borel_measurable M" shows"integrable M (\x. f x * real_cond_exp M F g x)" "(\ x. f x * real_cond_exp M F g x \M) = (\ x. f x * g x \M)" proof - have [measurable]: "f \ borel_measurable M" by (rule measurable_from_subalg[OF subalg assms(2)])
define fp where"fp = (\x. max (f x) 0)"
define fm where"fm = (\x. max (-f x) 0)" have [measurable]: "fp \ borel_measurable M" "fm \ borel_measurable M" unfolding fp_def fm_def by simp_all have [measurable]: "fp \ borel_measurable F" "fm \ borel_measurable F" unfolding fp_def fm_def by simp_all
have"(\\<^sup>+ x. norm(fp x * g x) \M) \ (\\<^sup>+ x. norm(f x * g x) \M)" by (simp add: fp_def nn_integral_mono) alsohave"... < \" using assms(1) by (simp add: integrable_iff_bounded) finallyhave"(\\<^sup>+ x. norm(fp x * g x) \M) < \" by simp thenhave intp: "integrable M (\x. fp x * g x)" by (simp add: integrableI_bounded) moreoverhave"\x. fp x \ 0" unfolding fp_def by simp ultimatelyhave Rp: "integrable M (\x. fp x * real_cond_exp M F g x)" "(\ x. fp x * real_cond_exp M F g x \M) = (\ x. fp x * g x \M)" using real_cond_exp_intg_fpos by auto
have"(\\<^sup>+ x. norm(fm x * g x) \M) \ (\\<^sup>+ x. norm(f x * g x) \M)" by (simp add: fm_def nn_integral_mono) alsohave"... < \" using assms(1) by (simp add: integrable_iff_bounded) finallyhave"(\\<^sup>+ x. norm(fm x * g x) \M) < \" by simp thenhave intm: "integrable M (\x. fm x * g x)" by (simp add: integrableI_bounded) moreoverhave"\x. fm x \ 0" unfolding fm_def by simp ultimatelyhave Rm: "integrable M (\x. fm x * real_cond_exp M F g x)" "(\ x. fm x * real_cond_exp M F g x \M) = (\ x. fm x * g x \M)" using real_cond_exp_intg_fpos by auto
have"integrable M (\x. fp x * real_cond_exp M F g x - fm x * real_cond_exp M F g x)" using Rp(1) Rm(1) integrable_diff by simp moreoverhave *: "\x. f x * real_cond_exp M F g x = fp x * real_cond_exp M F g x - fm x * real_cond_exp M F g x" unfolding fp_def fm_def by (simp add: max_def) ultimatelyshow"integrable M (\x. f x * real_cond_exp M F g x)" by simp
have"(\ x. f x * real_cond_exp M F g x \M) = (\ x. fp x * real_cond_exp M F g x - fm x * real_cond_exp M F g x \M)" using * by simp alsohave"... = (\ x. fp x * real_cond_exp M F g x \M) - (\ x. fm x * real_cond_exp M F g x \M)" using Rp(1) Rm(1) by simp alsohave"... = (\ x. fp x * g x \M) - (\ x. fm x * g x \M)" using Rp(2) Rm(2) by simp alsohave"... = (\ x. fp x * g x - fm x * g x \M)" using intm intp by simp alsohave"... = (\ x. f x * g x \M)" unfolding fp_def fm_def by (metis (no_types, opaque_lifting) diff_0 diff_zero max.commute
max_def minus_minus mult.commute neg_le_iff_le right_diff_distrib) finallyshow"(\ x. f x * real_cond_exp M F g x \M) = (\ x. f x * g x \M)" by simp qed
lemma real_cond_exp_intA: assumes [measurable]: "integrable M f""A \ sets F" shows"(\ x \ A. f x \M) = (\x \ A. real_cond_exp M F f x \M)" proof - have"A \ sets M" by (meson assms(2) subalg subalgebra_def subsetD) have"integrable M (\x. indicator A x * f x)" using integrable_mult_indicator[OF \A \ sets M\ assms(1)] by auto thenshow ?thesis using real_cond_exp_intg(2)[where ?f = "indicator A"and ?g = f, symmetric] unfolding set_lebesgue_integral_def by auto qed
lemma real_cond_exp_int [intro]: assumes"integrable M f" shows"integrable M (real_cond_exp M F f)""(\x. real_cond_exp M F f x \M) = (\x. f x \M)" using real_cond_exp_intg[where ?f = "\x. 1" and ?g = f] assms by auto
lemma real_cond_exp_charact: assumes"\A. A \ sets F \ (\ x \ A. f x \M) = (\ x \ A. g x \M)" and [measurable]: "integrable M f""integrable M g" "g \ borel_measurable F" shows"AE x in M. real_cond_exp M F f x = g x" proof - let ?MF = "restr_to_subalg M F" have"AE x in ?MF. real_cond_exp M F f x = g x" proof (rule AE_symmetric[OF density_unique_real]) fix A assume"A \ sets ?MF" thenhave [measurable]: "A \ sets F" using sets_restr_to_subalg[OF subalg] by simp thenhave a [measurable]: "A \ sets M" by (meson subalg subalgebra_def subsetD) have"(\x \ A. g x \ ?MF) = (\x \ A. g x \M)" unfolding set_lebesgue_integral_def by (simp add: integral_subalgebra2 subalg) alsohave"... = (\x \ A. f x \M)" using assms(1) by simp alsohave"... = (\x. indicator A x * f x \M)" by (simp add: mult.commute set_lebesgue_integral_def) alsohave"... = (\x. indicator A x * real_cond_exp M F f x \M)" apply (rule real_cond_exp_intg(2)[symmetric]) using integrable_mult_indicator[OF a assms(2)] by (auto simp add: assms) alsohave"... = (\x \ A. real_cond_exp M F f x \M)" by (simp add: mult.commute set_lebesgue_integral_def) alsohave"... = (\x \ A. real_cond_exp M F f x \ ?MF)" by (simp add: integral_subalgebra2 subalg set_lebesgue_integral_def) finallyshow"(\x \ A. g x \ ?MF) = (\x \ A. real_cond_exp M F f x \ ?MF)" by simp next have"integrable M (real_cond_exp M F f)"by (rule real_cond_exp_int(1)[OF assms(2)]) thenshow"integrable ?MF (real_cond_exp M F f)"by (metis borel_measurable_cond_exp integrable_in_subalg[OF subalg]) show"integrable (restr_to_subalg M F) g"by (simp add: assms(3) integrable_in_subalg[OF subalg]) qed thenshow ?thesis using AE_restr_to_subalg[OF subalg] by auto qed
lemma real_cond_exp_F_meas [intro, simp]: assumes"integrable M f" "f \ borel_measurable F" shows"AE x in M. real_cond_exp M F f x = f x" by (rule real_cond_exp_charact, auto simp add: assms measurable_from_subalg[OF subalg])
lemma real_cond_exp_mult: assumes [measurable]:"f \ borel_measurable F" "g \ borel_measurable M" "integrable M (\x. f x * g x)" shows"AE x in M. real_cond_exp M F (\x. f x * g x) x = f x * real_cond_exp M F g x" proof (rule real_cond_exp_charact) fix A assume"A \ sets F" thenhave [measurable]: "(\x. f x * indicator A x) \ borel_measurable F" by measurable have [measurable]: "A \ sets M" using subalg by (meson \A \ sets F\ subalgebra_def subsetD) have"(\x\A. (f x * g x) \M) = \x. (f x * indicator A x) * g x \M" by (simp add: mult.commute mult.left_commute set_lebesgue_integral_def) alsohave"... = \x. (f x * indicator A x) * real_cond_exp M F g x \M" apply (rule real_cond_exp_intg(2)[symmetric], auto simp add: assms) using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(3)] by (simp add: mult.commute mult.left_commute) alsohave"... = (\x\A. (f x * real_cond_exp M F g x)\M)" by (simp add: mult.commute mult.left_commute set_lebesgue_integral_def) finallyshow"(\x\A. (f x * g x) \M) = (\x\A. (f x * real_cond_exp M F g x)\M)" by simp qed (auto simp add: real_cond_exp_intg(1) assms)
lemma real_cond_exp_add [intro]: assumes [measurable]: "integrable M f""integrable M g" shows"AE x in M. real_cond_exp M F (\x. f x + g x) x = real_cond_exp M F f x + real_cond_exp M F g x" proof (rule real_cond_exp_charact) have"integrable M (real_cond_exp M F f)""integrable M (real_cond_exp M F g)" using real_cond_exp_int(1) assms by auto thenshow"integrable M (\x. real_cond_exp M F f x + real_cond_exp M F g x)" by auto
fix A assume [measurable]: "A \ sets F" thenhave"A \ sets M" by (meson subalg subalgebra_def subsetD) have intAf: "integrable M (\x. indicator A x * f x)" using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(1)] by auto have intAg: "integrable M (\x. indicator A x * g x)" using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(2)] by auto
have"(\x\A. (real_cond_exp M F f x + real_cond_exp M F g x)\M) = (\x\A. real_cond_exp M F f x \M) + (\x\A. real_cond_exp M F g x \M)" apply (rule set_integral_add, auto simp add: assms set_integrable_def) using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(1)]]
integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(2)]] by simp_all alsohave"... = (\x. indicator A x * real_cond_exp M F f x \M) + (\x. indicator A x * real_cond_exp M F g x \M)" unfolding set_lebesgue_integral_def by auto alsohave"... = (\x. indicator A x * f x \M) + (\x. indicator A x * g x \M)" using real_cond_exp_intg(2) assms \<open>A \<in> sets F\<close> intAf intAg by auto alsohave"... = (\x\A. f x \M) + (\x\A. g x \M)" unfolding set_lebesgue_integral_def by auto alsohave"... = (\x\A. (f x + g x)\M)" by (rule set_integral_add(2)[symmetric]) (auto simp add: assms set_integrable_def \<open>A \<in> sets M\<close> intAf intAg) finallyshow"(\x\A. (f x + g x)\M) = (\x\A. (real_cond_exp M F f x + real_cond_exp M F g x)\M)" by simp qed (auto simp add: assms)
lemma real_cond_exp_cong: assumes ae: "AE x in M. f x = g x"and [measurable]: "f \ borel_measurable M" "g \ borel_measurable M" shows"AE x in M. real_cond_exp M F f x = real_cond_exp M F g x" proof - have"AE x in M. nn_cond_exp M F (\x. ennreal (f x)) x = nn_cond_exp M F (\x. ennreal (g x)) x" apply (rule nn_cond_exp_cong) using assms by auto moreoverhave"AE x in M. nn_cond_exp M F (\x. ennreal (-f x)) x = nn_cond_exp M F (\x. ennreal(-g x)) x" apply (rule nn_cond_exp_cong) using assms by auto ultimatelyshow"AE x in M. real_cond_exp M F f x = real_cond_exp M F g x" unfolding real_cond_exp_def by auto qed
lemma real_cond_exp_cmult [intro, simp]: fixes c::real assumes"integrable M f" shows"AE x in M. real_cond_exp M F (\x. c * f x) x = c * real_cond_exp M F f x" by (rule real_cond_exp_mult[where ?f = "\x. c" and ?g = f], auto simp add: assms borel_measurable_integrable)
lemma real_cond_exp_cdiv [intro, simp]: fixes c::real assumes"integrable M f" shows"AE x in M. real_cond_exp M F (\x. f x / c) x = real_cond_exp M F f x / c" using real_cond_exp_cmult[of _ "1/c", OF assms] by (auto simp add: field_split_simps)
lemma real_cond_exp_diff [intro, simp]: assumes [measurable]: "integrable M f""integrable M g" shows"AE x in M. real_cond_exp M F (\x. f x - g x) x = real_cond_exp M F f x - real_cond_exp M F g x" proof - have"AE x in M. real_cond_exp M F (\x. f x + (- g x)) x = real_cond_exp M F f x + real_cond_exp M F (\x. -g x) x" using real_cond_exp_add[where ?f = f and ?g = "\x. - g x"] assms by auto moreoverhave"AE x in M. real_cond_exp M F (\x. -g x) x = - real_cond_exp M F g x" using real_cond_exp_cmult[where ?f = g and ?c = "-1"] assms(2) by auto ultimatelyshow ?thesis by auto qed
lemma real_cond_exp_pos [intro]: assumes"AE x in M. f x \ 0" and [measurable]: "f \ borel_measurable M" shows"AE x in M. real_cond_exp M F f x \ 0" proof -
define g where"g = (\x. max (f x) 0)" have"AE x in M. f x = g x"using assms g_def by auto thenhave *: "AE x in M. real_cond_exp M F f x = real_cond_exp M F g x"using real_cond_exp_cong g_def by auto
have"\x. g x \ 0" unfolding g_def by simp thenhave"(\x. ennreal(-g x)) = (\x. 0)" by (simp add: ennreal_neg) moreoverhave"AE x in M. 0 = nn_cond_exp M F (\x. 0) x" by (rule nn_cond_exp_F_meas, auto) ultimatelyhave"AE x in M. nn_cond_exp M F (\x. ennreal(-g x)) x = 0" by simp thenhave"AE x in M. real_cond_exp M F g x = enn2real(nn_cond_exp M F (\x. ennreal (g x)) x)" unfolding real_cond_exp_def by auto thenhave"AE x in M. real_cond_exp M F g x \ 0" by auto thenshow ?thesis using * by auto qed
lemma real_cond_exp_mono: assumes"AE x in M. f x \ g x" and [measurable]: "integrable M f" "integrable M g" shows"AE x in M. real_cond_exp M F f x \ real_cond_exp M F g x" proof - have"AE x in M. real_cond_exp M F g x - real_cond_exp M F f x = real_cond_exp M F (\x. g x - f x) x" by (rule AE_symmetric[OF real_cond_exp_diff], auto simp add: assms) moreoverhave"AE x in M. real_cond_exp M F (\x. g x - f x) x \ 0" by (rule real_cond_exp_pos, auto simp add: assms(1)) ultimatelyhave"AE x in M. real_cond_exp M F g x - real_cond_exp M F f x \ 0" by auto thenshow ?thesis by auto qed
lemma (in -) measurable_P_restriction [measurable (raw)]: assumes [measurable]: "Measurable.pred M P""A \ sets M" shows"{x \ A. P x} \ sets M" proof - have"A \ space M" using sets.sets_into_space[OF assms(2)]. thenhave"{x \ A. P x} = A \ {x \ space M. P x}" by blast thenshow ?thesis by auto qed
lemma real_cond_exp_gr_c: assumes [measurable]: "integrable M f" and AE: "AE x in M. f x > c" shows"AE x in M. real_cond_exp M F f x > c" proof -
define X where"X = {x \ space M. real_cond_exp M F f x \ c}" have [measurable]: "X \ sets F" unfolding X_def apply measurable by (metis sets.top subalg subalgebra_def) thenhave [measurable]: "X \ sets M" using sets_restr_to_subalg subalg subalgebra_def by blast have"emeasure M X = 0" proof (rule ccontr) assume"\(emeasure M X) = 0" have"emeasure (restr_to_subalg M F) X = emeasure M X" by (simp add: emeasure_restr_to_subalg subalg) thenhave"emeasure (restr_to_subalg M F) X > 0" using\<open>\<not>(emeasure M X) = 0\<close> gr_zeroI by auto thenobtain A where"A \ sets (restr_to_subalg M F)" "A \ X" "emeasure (restr_to_subalg M F) A > 0" "emeasure (restr_to_subalg M F) A < \" using sigma_fin_subalg by (metis emeasure_notin_sets ennreal_0 infinity_ennreal_def le_less_linear neq_top_trans
not_gr_zero order_refl sigma_finite_measure.approx_PInf_emeasure_with_finite) thenhave [measurable]: "A \ sets F" using subalg sets_restr_to_subalg by blast thenhave [measurable]: "A \ sets M" using sets_restr_to_subalg subalg subalgebra_def by blast have Ic: "set_integrable M A (\x. c)" unfolding set_integrable_def using\<open>emeasure (restr_to_subalg M F) A < \<infinity>\<close> emeasure_restr_to_subalg subalg by fastforce haveIf: "set_integrable M A f" unfolding set_integrable_def by (rule integrable_mult_indicator, auto simp add: \<open>integrable M f\<close>) have"AE x in M. indicator A x * c = indicator A x * f x" proof (rule integral_ineq_eq_0_then_AE) have"(\x\A. c \M) = (\x\A. f x \M)" proof (rule antisym) show"(\x\A. c \M) \ (\x\A. f x \M)" apply (rule set_integral_mono_AE) using Ic If assms(2) by auto have"(\x\A. f x \M) = (\x\A. real_cond_exp M F f x \M)" by (rule real_cond_exp_intA, auto simp add: \<open>integrable M f\<close>) alsohave"... \ (\x\A. c \M)" apply (rule set_integral_mono) unfolding set_integrable_def apply (rule integrable_mult_indicator, simp, simp add: real_cond_exp_int(1)[OF \<open>integrable M f\<close>]) using Ic X_def \<open>A \<subseteq> X\<close> by (auto simp: set_integrable_def) finallyshow"(\x\A. f x \M) \ (\x\A. c \M)" by simp qed thenhave"measure M A * c = LINT x|M. indicat_real A x * f x" by (auto simp: set_lebesgue_integral_def) thenshow"LINT x|M. indicat_real A x * c = LINT x|M. indicat_real A x * f x" by auto show"AE x in M. indicat_real A x * c \ indicat_real A x * f x" using AE unfolding indicator_def by auto qed (use Ic Ifin\<open>auto simp: set_integrable_def\<close>) thenhave"AE x\A in M. c = f x" by auto thenhave"AE x\A in M. False" using assms(2) by auto have"A \ null_sets M" unfolding ae_filter_def by (meson AE_iff_null_sets \A \ sets M\ \AE x\A in M. False\) thenshow False using\<open>emeasure (restr_to_subalg M F) A > 0\<close> by (simp add: emeasure_restr_to_subalg null_setsD1 subalg) qed thenshow ?thesis using AE_iff_null_sets[OF \<open>X \<in> sets M\<close>] unfolding X_def by auto qed
lemma real_cond_exp_less_c: assumes [measurable]: "integrable M f" and"AE x in M. f x < c" shows"AE x in M. real_cond_exp M F f x < c" proof - have"AE x in M. real_cond_exp M F f x = -real_cond_exp M F (\x. -f x) x" using real_cond_exp_cmult[OF \<open>integrable M f\<close>, of "-1"] by auto moreoverhave"AE x in M. real_cond_exp M F (\x. -f x) x > -c" apply (rule real_cond_exp_gr_c) using assms by auto ultimatelyshow ?thesis by auto qed
lemma real_cond_exp_ge_c: assumes [measurable]: "integrable M f" and"AE x in M. f x \ c" shows"AE x in M. real_cond_exp M F f x \ c" proof - obtain u::"nat \ real" where u: "\n. u n < c" "u \ c" using approx_from_below_dense_linorder[of "c-1" c] by auto have *: "AE x in M. real_cond_exp M F f x > u n"for n::nat apply (rule real_cond_exp_gr_c) using assms \<open>u n < c\<close> by auto have"AE x in M. \n. real_cond_exp M F f x > u n" by (subst AE_all_countable, auto simp add: *) moreoverhave"real_cond_exp M F f x \ c" if "\n. real_cond_exp M F f x > u n" for x proof - have"real_cond_exp M F f x \ u n" for n using that less_imp_le by auto thenshow ?thesis using u(2) LIMSEQ_le_const2 by metis qed ultimatelyshow ?thesis by auto qed
lemma real_cond_exp_le_c: assumes [measurable]: "integrable M f" and"AE x in M. f x \ c" shows"AE x in M. real_cond_exp M F f x \ c" proof - have"AE x in M. real_cond_exp M F f x = -real_cond_exp M F (\x. -f x) x" using real_cond_exp_cmult[OF \<open>integrable M f\<close>, of "-1"] by auto moreoverhave"AE x in M. real_cond_exp M F (\x. -f x) x \ -c" apply (rule real_cond_exp_ge_c) using assms by auto ultimatelyshow ?thesis by auto qed
lemma real_cond_exp_mono_strict: assumes"AE x in M. f x < g x"and [measurable]: "integrable M f""integrable M g" shows"AE x in M. real_cond_exp M F f x < real_cond_exp M F g x" proof - have"AE x in M. real_cond_exp M F g x - real_cond_exp M F f x = real_cond_exp M F (\x. g x - f x) x" by (rule AE_symmetric[OF real_cond_exp_diff], auto simp add: assms) moreoverhave"AE x in M. real_cond_exp M F (\x. g x - f x) x > 0" by (rule real_cond_exp_gr_c, auto simp add: assms) ultimatelyhave"AE x in M. real_cond_exp M F g x - real_cond_exp M F f x > 0"by auto thenshow ?thesis by auto qed
lemma real_cond_exp_nested_subalg [intro, simp]: assumes"subalgebra M G""subalgebra G F" and [measurable]: "integrable M f" shows"AE x in M. real_cond_exp M F (real_cond_exp M G f) x = real_cond_exp M F f x" proof (rule real_cond_exp_charact) interpret G: sigma_finite_subalgebra M G by (rule nested_subalg_is_sigma_finite[OF assms(1) assms(2)]) show"integrable M (real_cond_exp M G f)"by (auto simp add: assms G.real_cond_exp_int(1))
fix A assume [measurable]: "A \ sets F" thenhave [measurable]: "A \ sets G" using assms(2) by (meson subsetD subalgebra_def) have"set_lebesgue_integral M A (real_cond_exp M G f) = set_lebesgue_integral M A f" by (rule G.real_cond_exp_intA[symmetric], auto simp add: assms(3)) alsohave"... = set_lebesgue_integral M A (real_cond_exp M F f)" by (rule real_cond_exp_intA, auto simp add: assms(3)) finallyshow"set_lebesgue_integral M A (real_cond_exp M G f) = set_lebesgue_integral M A (real_cond_exp M F f)"by auto qed (auto simp add: assms real_cond_exp_int(1))
lemma real_cond_exp_sum [intro, simp]: fixes f::"'b \ 'a \ real" assumes [measurable]: "\i. integrable M (f i)" shows"AE x in M. real_cond_exp M F (\x. \i\I. f i x) x = (\i\I. real_cond_exp M F (f i) x)" proof (rule real_cond_exp_charact) fix A assume [measurable]: "A \ sets F" thenhave A_meas [measurable]: "A \ sets M" by (meson subsetD subalg subalgebra_def) have *: "integrable M (\x. indicator A x * f i x)" for i using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(1)] by auto have **: "integrable M (\x. indicator A x * real_cond_exp M F (f i) x)" for i using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(1)]] by auto have inti: "(\x. indicator A x * f i x \M) = (\x. indicator A x * real_cond_exp M F (f i) x \M)" for i by (rule real_cond_exp_intg(2)[symmetric], auto simp add: *)
have"(\x\A. (\i\I. f i x)\M) = (\x. (\i\I. indicator A x * f i x)\M)" by (simp add: sum_distrib_left set_lebesgue_integral_def) alsohave"... = (\i\I. (\x. indicator A x * f i x \M))" by (rule Bochner_Integration.integral_sum, simp add: *) alsohave"... = (\i\I. (\x. indicator A x * real_cond_exp M F (f i) x \M))" using inti by auto alsohave"... = (\x. (\i\I. indicator A x * real_cond_exp M F (f i) x)\M)" by (rule Bochner_Integration.integral_sum[symmetric], simp add: **) alsohave"... = (\x\A. (\i\I. real_cond_exp M F (f i) x)\M)" by (simp add: sum_distrib_left set_lebesgue_integral_def) finallyshow"(\x\A. (\i\I. f i x)\M) = (\x\A. (\i\I. real_cond_exp M F (f i) x)\M)" by auto qed (auto simp add: assms real_cond_exp_int(1)[OF assms(1)])
text\<open>Jensen's inequality, describing the behavior of the integral under a convex function, admits
a version for the conditional expectation, as follows.\<close>
theorem real_cond_exp_jensens_inequality: fixes q :: "real \ real" assumes X: "integrable M X""AE x in M. X x \ I" assumes I: "I = {a <..< b} \ I = {a <..} \ I = {..< b} \ I = UNIV" assumes q: "integrable M (\x. q (X x))" "convex_on I q" "q \ borel_measurable borel" shows"AE x in M. real_cond_exp M F X x \ I" "AE x in M. q (real_cond_exp M F X x) \ real_cond_exp M F (\x. q (X x)) x" proof - have"open I"using I by auto thenhave"interior I = I"by (simp add: interior_eq) have [measurable]: "I \ sets borel" using I by auto
define phi where"phi = (\x. Inf ((\t. (q x - q t) / (x - t)) ` ({x<..} \ I)))" have **: "q (X x) \ q (real_cond_exp M F X x) + phi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x)" if"X x \ I" "real_cond_exp M F X x \ I" for x unfolding phi_def apply (rule convex_le_Inf_differential)
--> --------------------
--> maximum size reached
--> --------------------
¤ Dauer der Verarbeitung: 0.7 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.