175 by (rule nn_integral_subalgebra2, auto simp add: assms) |
175 by (rule nn_integral_subalgebra2, auto simp add: assms) |
176 also have "... < \<infinity>" using integrable_iff_bounded assms by auto |
176 also have "... < \<infinity>" using integrable_iff_bounded assms by auto |
177 finally show "(\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>(restr_to_subalg M F)) < \<infinity>" by simp |
177 finally show "(\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>(restr_to_subalg M F)) < \<infinity>" by simp |
178 qed |
178 qed |
179 |
179 |
180 subsection {*Nonnegative conditional expectation*} |
180 subsection \<open>Nonnegative conditional expectation\<close> |
181 |
181 |
182 text {* The conditional expectation of a function $f$, on a measure space $M$, with respect to a |
182 text \<open>The conditional expectation of a function $f$, on a measure space $M$, with respect to a |
183 sub sigma algebra $F$, should be a function $g$ which is $F$-measurable whose integral on any |
183 sub sigma algebra $F$, should be a function $g$ which is $F$-measurable whose integral on any |
184 $F$-set coincides with the integral of $f$. |
184 $F$-set coincides with the integral of $f$. |
185 Such a function is uniquely defined almost everywhere. |
185 Such a function is uniquely defined almost everywhere. |
186 The most direct construction is to use the measure $f dM$, restrict it to the sigma-algebra $F$, |
186 The most direct construction is to use the measure $f dM$, restrict it to the sigma-algebra $F$, |
187 and apply the Radon-Nikodym theorem to write it as $g dM_{|F}$ for some $F$-measurable function $g$. |
187 and apply the Radon-Nikodym theorem to write it as $g dM_{|F}$ for some $F$-measurable function $g$. |
205 shows borel_measurable_nn_cond_exp [measurable]: "nn_cond_exp M F f \<in> borel_measurable F" |
205 shows borel_measurable_nn_cond_exp [measurable]: "nn_cond_exp M F f \<in> borel_measurable F" |
206 and borel_measurable_nn_cond_exp2 [measurable]: "nn_cond_exp M F f \<in> borel_measurable M" |
206 and borel_measurable_nn_cond_exp2 [measurable]: "nn_cond_exp M F f \<in> borel_measurable M" |
207 by (simp_all add: nn_cond_exp_def) |
207 by (simp_all add: nn_cond_exp_def) |
208 (metis borel_measurable_RN_deriv borel_measurable_subalgebra sets_restr_to_subalg space_restr_to_subalg subalgebra_def) |
208 (metis borel_measurable_RN_deriv borel_measurable_subalgebra sets_restr_to_subalg space_restr_to_subalg subalgebra_def) |
209 |
209 |
210 text {* The good setting for conditional expectations is the situation where the subalgebra $F$ |
210 text \<open>The good setting for conditional expectations is the situation where the subalgebra $F$ |
211 gives rise to a sigma-finite measure space. To see what goes wrong if it is not sigma-finite, |
211 gives rise to a sigma-finite measure space. To see what goes wrong if it is not sigma-finite, |
212 think of $\mathbb{R}$ with the trivial sigma-algebra $\{\emptyset, \mathbb{R}\}$. In this case, |
212 think of $\mathbb{R}$ with the trivial sigma-algebra $\{\emptyset, \mathbb{R}\}$. In this case, |
213 conditional expectations have to be constant functions, so they have integral $0$ or $\infty$. |
213 conditional expectations have to be constant functions, so they have integral $0$ or $\infty$. |
214 This means that a positive integrable function can have no meaningful conditional expectation.*} |
214 This means that a positive integrable function can have no meaningful conditional expectation.\<close> |
215 |
215 |
216 locale sigma_finite_subalgebra = |
216 locale sigma_finite_subalgebra = |
217 fixes M F::"'a measure" |
217 fixes M F::"'a measure" |
218 assumes subalg: "subalgebra M F" |
218 assumes subalg: "subalgebra M F" |
219 and sigma_fin_subalg: "sigma_finite_measure (restr_to_subalg M F)" |
219 and sigma_fin_subalg: "sigma_finite_measure (restr_to_subalg M F)" |
228 obtain A where Ap: "countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union>A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)" |
228 obtain A where Ap: "countable A \<and> A \<subseteq> sets (restr_to_subalg M F) \<and> \<Union>A = space (restr_to_subalg M F) \<and> (\<forall>a\<in>A. emeasure (restr_to_subalg M F) a \<noteq> \<infinity>)" |
229 using sigma_finite_measure.sigma_finite_countable[OF sigma_fin_subalg] by fastforce |
229 using sigma_finite_measure.sigma_finite_countable[OF sigma_fin_subalg] by fastforce |
230 have "A \<subseteq> sets F" using Ap sets_restr_to_subalg[OF subalg] by fastforce |
230 have "A \<subseteq> sets F" using Ap sets_restr_to_subalg[OF subalg] by fastforce |
231 then have "A \<subseteq> sets M" using subalg subalgebra_def by force |
231 then have "A \<subseteq> sets M" using subalg subalgebra_def by force |
232 moreover have "\<Union>A = space M" using Ap space_restr_to_subalg by simp |
232 moreover have "\<Union>A = space M" using Ap space_restr_to_subalg by simp |
233 moreover have "\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>" by (metis subsetD emeasure_restr_to_subalg[OF subalg] `A \<subseteq> sets F` Ap) |
233 moreover have "\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>" by (metis subsetD emeasure_restr_to_subalg[OF subalg] \<open>A \<subseteq> sets F\<close> Ap) |
234 ultimately show "\<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union>A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)" using Ap by auto |
234 ultimately show "\<exists>A. countable A \<and> A \<subseteq> sets M \<and> \<Union>A = space M \<and> (\<forall>a\<in>A. emeasure M a \<noteq> \<infinity>)" using Ap by auto |
235 qed |
235 qed |
236 |
236 |
237 sublocale sigma_finite_subalgebra \<subseteq> sigma_finite_measure |
237 sublocale sigma_finite_subalgebra \<subseteq> sigma_finite_measure |
238 using sigma_finite_subalgebra_is_sigma_finite sigma_finite_subalgebra_axioms by blast |
238 using sigma_finite_subalgebra_is_sigma_finite sigma_finite_subalgebra_axioms by blast |
239 |
239 |
240 text {* Conditional expectations are very often used in probability spaces. This is a special case |
240 text \<open>Conditional expectations are very often used in probability spaces. This is a special case |
241 of the previous one, as we prove now. *} |
241 of the previous one, as we prove now.\<close> |
242 |
242 |
243 locale finite_measure_subalgebra = finite_measure + |
243 locale finite_measure_subalgebra = finite_measure + |
244 fixes F::"'a measure" |
244 fixes F::"'a measure" |
245 assumes subalg: "subalgebra M F" |
245 assumes subalg: "subalgebra M F" |
246 |
246 |
369 shows "AE x in M. nn_cond_exp M F f x + nn_cond_exp M F g x = nn_cond_exp M F (\<lambda>x. f x + g x) x" |
369 shows "AE x in M. nn_cond_exp M F f x + nn_cond_exp M F g x = nn_cond_exp M F (\<lambda>x. f x + g x) x" |
370 proof (rule nn_cond_exp_charact) |
370 proof (rule nn_cond_exp_charact) |
371 fix A assume [measurable]: "A \<in> sets F" |
371 fix A assume [measurable]: "A \<in> sets F" |
372 then have "A \<in> sets M" by (meson subalg subalgebra_def subsetD) |
372 then have "A \<in> sets M" by (meson subalg subalgebra_def subsetD) |
373 have "\<integral>\<^sup>+x\<in>A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\<partial>M = (\<integral>\<^sup>+x\<in>A. nn_cond_exp M F f x \<partial>M) + (\<integral>\<^sup>+x\<in>A. nn_cond_exp M F g x \<partial>M)" |
373 have "\<integral>\<^sup>+x\<in>A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\<partial>M = (\<integral>\<^sup>+x\<in>A. nn_cond_exp M F f x \<partial>M) + (\<integral>\<^sup>+x\<in>A. nn_cond_exp M F g x \<partial>M)" |
374 by (rule nn_set_integral_add) (auto simp add: assms `A \<in> sets M`) |
374 by (rule nn_set_integral_add) (auto simp add: assms \<open>A \<in> sets M\<close>) |
375 also have "... = (\<integral>\<^sup>+x. indicator A x * nn_cond_exp M F f x \<partial>M) + (\<integral>\<^sup>+x. indicator A x * nn_cond_exp M F g x \<partial>M)" |
375 also have "... = (\<integral>\<^sup>+x. indicator A x * nn_cond_exp M F f x \<partial>M) + (\<integral>\<^sup>+x. indicator A x * nn_cond_exp M F g x \<partial>M)" |
376 by (metis (no_types, lifting) mult.commute nn_integral_cong) |
376 by (metis (no_types, lifting) mult.commute nn_integral_cong) |
377 also have "... = (\<integral>\<^sup>+x. indicator A x * f x \<partial>M) + (\<integral>\<^sup>+x. indicator A x * g x \<partial>M)" |
377 also have "... = (\<integral>\<^sup>+x. indicator A x * f x \<partial>M) + (\<integral>\<^sup>+x. indicator A x * g x \<partial>M)" |
378 by (simp add: nn_cond_exp_intg) |
378 by (simp add: nn_cond_exp_intg) |
379 also have "... = (\<integral>\<^sup>+x\<in>A. f x \<partial>M) + (\<integral>\<^sup>+x\<in>A. g x \<partial>M)" |
379 also have "... = (\<integral>\<^sup>+x\<in>A. f x \<partial>M) + (\<integral>\<^sup>+x\<in>A. g x \<partial>M)" |
380 by (metis (no_types, lifting) mult.commute nn_integral_cong) |
380 by (metis (no_types, lifting) mult.commute nn_integral_cong) |
381 also have "... = \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M" |
381 also have "... = \<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M" |
382 by (rule nn_set_integral_add[symmetric]) (auto simp add: assms `A \<in> sets M`) |
382 by (rule nn_set_integral_add[symmetric]) (auto simp add: assms \<open>A \<in> sets M\<close>) |
383 finally show "\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = \<integral>\<^sup>+x\<in>A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\<partial>M" |
383 finally show "\<integral>\<^sup>+x\<in>A. (f x + g x)\<partial>M = \<integral>\<^sup>+x\<in>A. (nn_cond_exp M F f x + nn_cond_exp M F g x)\<partial>M" |
384 by simp |
384 by simp |
385 qed (auto simp add: assms) |
385 qed (auto simp add: assms) |
386 |
386 |
387 lemma nn_cond_exp_cong: |
387 lemma nn_cond_exp_cong: |
448 finally show "set_nn_integral M A (nn_cond_exp M G f) = set_nn_integral M A (nn_cond_exp M F f)". |
448 finally show "set_nn_integral M A (nn_cond_exp M G f) = set_nn_integral M A (nn_cond_exp M F f)". |
449 qed |
449 qed |
450 |
450 |
451 end |
451 end |
452 |
452 |
453 subsection {*Real conditional expectation*} |
453 subsection \<open>Real conditional expectation\<close> |
454 |
454 |
455 text {*Once conditional expectations of positive functions are defined, the definition for real-valued functions |
455 text \<open>Once conditional expectations of positive functions are defined, the definition for real-valued functions |
456 follows readily, by taking the difference of positive and negative parts. |
456 follows readily, by taking the difference of positive and negative parts. |
457 One could also define a conditional expectation of vector-space valued functions, as in |
457 One could also define a conditional expectation of vector-space valued functions, as in |
458 \verb+Bochner_Integral+, but since the real-valued case is the most important, and quicker to formalize, I |
458 \verb+Bochner_Integral+, but since the real-valued case is the most important, and quicker to formalize, I |
459 concentrate on it. (It is also essential for the case of the most general Pettis integral.) |
459 concentrate on it. (It is also essential for the case of the most general Pettis integral.) |
460 *} |
460 \<close> |
461 |
461 |
462 definition real_cond_exp :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a \<Rightarrow> real)" where |
462 definition real_cond_exp :: "'a measure \<Rightarrow> 'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> ('a \<Rightarrow> real)" where |
463 "real_cond_exp M F f = |
463 "real_cond_exp M F f = |
464 (\<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))" |
464 (\<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))" |
465 |
465 |
787 assumes [measurable]:"f \<in> borel_measurable F" "g \<in> borel_measurable M" "integrable M (\<lambda>x. f x * g x)" |
787 assumes [measurable]:"f \<in> borel_measurable F" "g \<in> borel_measurable M" "integrable M (\<lambda>x. f x * g x)" |
788 shows "AE x in M. real_cond_exp M F (\<lambda>x. f x * g x) x = f x * real_cond_exp M F g x" |
788 shows "AE x in M. real_cond_exp M F (\<lambda>x. f x * g x) x = f x * real_cond_exp M F g x" |
789 proof (rule real_cond_exp_charact) |
789 proof (rule real_cond_exp_charact) |
790 fix A assume "A \<in> sets F" |
790 fix A assume "A \<in> sets F" |
791 then have [measurable]: "(\<lambda>x. f x * indicator A x) \<in> borel_measurable F" by measurable |
791 then have [measurable]: "(\<lambda>x. f x * indicator A x) \<in> borel_measurable F" by measurable |
792 have [measurable]: "A \<in> sets M" using subalg by (meson `A \<in> sets F` subalgebra_def subsetD) |
792 have [measurable]: "A \<in> sets M" using subalg by (meson \<open>A \<in> sets F\<close> subalgebra_def subsetD) |
793 have "\<integral>x\<in>A. (f x * g x) \<partial>M = \<integral>x. (f x * indicator A x) * g x \<partial>M" |
793 have "\<integral>x\<in>A. (f x * g x) \<partial>M = \<integral>x. (f x * indicator A x) * g x \<partial>M" |
794 by (simp add: mult.commute mult.left_commute) |
794 by (simp add: mult.commute mult.left_commute) |
795 also have "... = \<integral>x. (f x * indicator A x) * real_cond_exp M F g x \<partial>M" |
795 also have "... = \<integral>x. (f x * indicator A x) * real_cond_exp M F g x \<partial>M" |
796 apply (rule real_cond_exp_intg(2)[symmetric], auto simp add: assms) |
796 apply (rule real_cond_exp_intg(2)[symmetric], auto simp add: assms) |
797 using integrable_mult_indicator[OF `A \<in> sets M` assms(3)] by (simp add: mult.commute mult.left_commute) |
797 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(3)] by (simp add: mult.commute mult.left_commute) |
798 also have "... = \<integral>x\<in>A. (f x * real_cond_exp M F g x)\<partial>M" |
798 also have "... = \<integral>x\<in>A. (f x * real_cond_exp M F g x)\<partial>M" |
799 by (simp add: mult.commute mult.left_commute) |
799 by (simp add: mult.commute mult.left_commute) |
800 finally show "\<integral>x\<in>A. (f x * g x) \<partial>M = \<integral>x\<in>A. (f x * real_cond_exp M F g x)\<partial>M" by simp |
800 finally show "\<integral>x\<in>A. (f x * g x) \<partial>M = \<integral>x\<in>A. (f x * real_cond_exp M F g x)\<partial>M" by simp |
801 qed (auto simp add: real_cond_exp_intg(1) assms) |
801 qed (auto simp add: real_cond_exp_intg(1) assms) |
802 |
802 |
810 by auto |
810 by auto |
811 |
811 |
812 fix A assume [measurable]: "A \<in> sets F" |
812 fix A assume [measurable]: "A \<in> sets F" |
813 then have "A \<in> sets M" by (meson subalg subalgebra_def subsetD) |
813 then have "A \<in> sets M" by (meson subalg subalgebra_def subsetD) |
814 have intAf: "integrable M (\<lambda>x. indicator A x * f x)" |
814 have intAf: "integrable M (\<lambda>x. indicator A x * f x)" |
815 using integrable_mult_indicator[OF `A \<in> sets M` assms(1)] by auto |
815 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(1)] by auto |
816 have intAg: "integrable M (\<lambda>x. indicator A x * g x)" |
816 have intAg: "integrable M (\<lambda>x. indicator A x * g x)" |
817 using integrable_mult_indicator[OF `A \<in> sets M` assms(2)] by auto |
817 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(2)] by auto |
818 |
818 |
819 have "\<integral>x\<in>A. (real_cond_exp M F f x + real_cond_exp M F g x)\<partial>M = (\<integral>x\<in>A. real_cond_exp M F f x \<partial>M) + (\<integral>x\<in>A. real_cond_exp M F g x \<partial>M)" |
819 have "\<integral>x\<in>A. (real_cond_exp M F f x + real_cond_exp M F g x)\<partial>M = (\<integral>x\<in>A. real_cond_exp M F f x \<partial>M) + (\<integral>x\<in>A. real_cond_exp M F g x \<partial>M)" |
820 apply (rule set_integral_add, auto simp add: assms) |
820 apply (rule set_integral_add, auto simp add: assms) |
821 using integrable_mult_indicator[OF `A \<in> sets M` real_cond_exp_int(1)[OF assms(1)]] |
821 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(1)]] |
822 integrable_mult_indicator[OF `A \<in> sets M` real_cond_exp_int(1)[OF assms(2)]] by simp_all |
822 integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(2)]] by simp_all |
823 also have "... = (\<integral>x. indicator A x * real_cond_exp M F f x \<partial>M) + (\<integral>x. indicator A x * real_cond_exp M F g x \<partial>M)" |
823 also have "... = (\<integral>x. indicator A x * real_cond_exp M F f x \<partial>M) + (\<integral>x. indicator A x * real_cond_exp M F g x \<partial>M)" |
824 by auto |
824 by auto |
825 also have "... = (\<integral>x. indicator A x * f x \<partial>M) + (\<integral>x. indicator A x * g x \<partial>M)" |
825 also have "... = (\<integral>x. indicator A x * f x \<partial>M) + (\<integral>x. indicator A x * g x \<partial>M)" |
826 using real_cond_exp_intg(2) assms `A \<in> sets F` intAf intAg by auto |
826 using real_cond_exp_intg(2) assms \<open>A \<in> sets F\<close> intAf intAg by auto |
827 also have "... = (\<integral>x\<in>A. f x \<partial>M) + (\<integral>x\<in>A. g x \<partial>M)" |
827 also have "... = (\<integral>x\<in>A. f x \<partial>M) + (\<integral>x\<in>A. g x \<partial>M)" |
828 by auto |
828 by auto |
829 also have "... = \<integral>x\<in>A. (f x + g x)\<partial>M" |
829 also have "... = \<integral>x\<in>A. (f x + g x)\<partial>M" |
830 by (rule set_integral_add(2)[symmetric]) (auto simp add: assms `A \<in> sets M` intAf intAg) |
830 by (rule set_integral_add(2)[symmetric]) (auto simp add: assms \<open>A \<in> sets M\<close> intAf intAg) |
831 finally show "\<integral>x\<in>A. (f x + g x)\<partial>M = \<integral>x\<in>A. (real_cond_exp M F f x + real_cond_exp M F g x)\<partial>M" |
831 finally show "\<integral>x\<in>A. (f x + g x)\<partial>M = \<integral>x\<in>A. (real_cond_exp M F f x + real_cond_exp M F g x)\<partial>M" |
832 by simp |
832 by simp |
833 qed (auto simp add: assms) |
833 qed (auto simp add: assms) |
834 |
834 |
835 lemma real_cond_exp_cong: |
835 lemma real_cond_exp_cong: |
922 proof (rule ccontr) |
922 proof (rule ccontr) |
923 assume "\<not>(emeasure M X) = 0" |
923 assume "\<not>(emeasure M X) = 0" |
924 have "emeasure (restr_to_subalg M F) X = emeasure M X" |
924 have "emeasure (restr_to_subalg M F) X = emeasure M X" |
925 by (simp add: emeasure_restr_to_subalg subalg) |
925 by (simp add: emeasure_restr_to_subalg subalg) |
926 then have "emeasure (restr_to_subalg M F) X > 0" |
926 then have "emeasure (restr_to_subalg M F) X > 0" |
927 using `\<not>(emeasure M X) = 0` gr_zeroI by auto |
927 using \<open>\<not>(emeasure M X) = 0\<close> gr_zeroI by auto |
928 then obtain A where "A \<in> sets (restr_to_subalg M F)" "A \<subseteq> X" "emeasure (restr_to_subalg M F) A > 0" "emeasure (restr_to_subalg M F) A < \<infinity>" |
928 then obtain A where "A \<in> sets (restr_to_subalg M F)" "A \<subseteq> X" "emeasure (restr_to_subalg M F) A > 0" "emeasure (restr_to_subalg M F) A < \<infinity>" |
929 using sigma_fin_subalg by (metis emeasure_notin_sets ennreal_0 infinity_ennreal_def le_less_linear neq_top_trans |
929 using sigma_fin_subalg by (metis emeasure_notin_sets ennreal_0 infinity_ennreal_def le_less_linear neq_top_trans |
930 not_gr_zero order_refl sigma_finite_measure.approx_PInf_emeasure_with_finite) |
930 not_gr_zero order_refl sigma_finite_measure.approx_PInf_emeasure_with_finite) |
931 then have [measurable]: "A \<in> sets F" using subalg sets_restr_to_subalg by blast |
931 then have [measurable]: "A \<in> sets F" using subalg sets_restr_to_subalg by blast |
932 then have [measurable]: "A \<in> sets M" using sets_restr_to_subalg subalg subalgebra_def by blast |
932 then have [measurable]: "A \<in> sets M" using sets_restr_to_subalg subalg subalgebra_def by blast |
933 have Ic: "set_integrable M A (\<lambda>x. c)" |
933 have Ic: "set_integrable M A (\<lambda>x. c)" |
934 using \<open>emeasure (restr_to_subalg M F) A < \<infinity>\<close> emeasure_restr_to_subalg subalg by fastforce |
934 using \<open>emeasure (restr_to_subalg M F) A < \<infinity>\<close> emeasure_restr_to_subalg subalg by fastforce |
935 have If: "set_integrable M A f" |
935 have If: "set_integrable M A f" |
936 by (rule integrable_mult_indicator, auto simp add: `integrable M f`) |
936 by (rule integrable_mult_indicator, auto simp add: \<open>integrable M f\<close>) |
937 have *: "(\<integral>x\<in>A. c \<partial>M) = (\<integral>x\<in>A. f x \<partial>M)" |
937 have *: "(\<integral>x\<in>A. c \<partial>M) = (\<integral>x\<in>A. f x \<partial>M)" |
938 proof (rule antisym) |
938 proof (rule antisym) |
939 show "(\<integral>x\<in>A. c \<partial>M) \<le> (\<integral>x\<in>A. f x \<partial>M)" |
939 show "(\<integral>x\<in>A. c \<partial>M) \<le> (\<integral>x\<in>A. f x \<partial>M)" |
940 apply (rule set_integral_mono_AE) using Ic If assms(2) by auto |
940 apply (rule set_integral_mono_AE) using Ic If assms(2) by auto |
941 have "(\<integral>x\<in>A. f x \<partial>M) = (\<integral>x\<in>A. real_cond_exp M F f x \<partial>M)" |
941 have "(\<integral>x\<in>A. f x \<partial>M) = (\<integral>x\<in>A. real_cond_exp M F f x \<partial>M)" |
942 by (rule real_cond_exp_intA, auto simp add: `integrable M f`) |
942 by (rule real_cond_exp_intA, auto simp add: \<open>integrable M f\<close>) |
943 also have "... \<le> (\<integral>x\<in>A. c \<partial>M)" |
943 also have "... \<le> (\<integral>x\<in>A. c \<partial>M)" |
944 apply (rule set_integral_mono) |
944 apply (rule set_integral_mono) |
945 apply (rule integrable_mult_indicator, simp, simp add: real_cond_exp_int(1)[OF `integrable M f`]) |
945 apply (rule integrable_mult_indicator, simp, simp add: real_cond_exp_int(1)[OF \<open>integrable M f\<close>]) |
946 using Ic X_def \<open>A \<subseteq> X\<close> by auto |
946 using Ic X_def \<open>A \<subseteq> X\<close> by auto |
947 finally show "(\<integral>x\<in>A. f x \<partial>M) \<le> (\<integral>x\<in>A. c \<partial>M)" by simp |
947 finally show "(\<integral>x\<in>A. f x \<partial>M) \<le> (\<integral>x\<in>A. c \<partial>M)" by simp |
948 qed |
948 qed |
949 have "AE x in M. indicator A x * c = indicator A x * f x" |
949 have "AE x in M. indicator A x * c = indicator A x * f x" |
950 apply (rule integral_ineq_eq_0_then_AE) using Ic If * apply auto |
950 apply (rule integral_ineq_eq_0_then_AE) using Ic If * apply auto |
951 using assms(2) unfolding indicator_def by auto |
951 using assms(2) unfolding indicator_def by auto |
952 then have "AE x\<in>A in M. c = f x" by auto |
952 then have "AE x\<in>A in M. c = f x" by auto |
953 then have "AE x\<in>A in M. False" using assms(2) by auto |
953 then have "AE x\<in>A in M. False" using assms(2) by auto |
954 have "A \<in> null_sets M" unfolding ae_filter_def by (meson AE_iff_null_sets \<open>A \<in> sets M\<close> \<open>AE x\<in>A in M. False\<close>) |
954 have "A \<in> null_sets M" unfolding ae_filter_def by (meson AE_iff_null_sets \<open>A \<in> sets M\<close> \<open>AE x\<in>A in M. False\<close>) |
955 then show False using `emeasure (restr_to_subalg M F) A > 0` |
955 then show False using \<open>emeasure (restr_to_subalg M F) A > 0\<close> |
956 by (simp add: emeasure_restr_to_subalg null_setsD1 subalg) |
956 by (simp add: emeasure_restr_to_subalg null_setsD1 subalg) |
957 qed |
957 qed |
958 then show ?thesis using AE_iff_null_sets[OF `X \<in> sets M`] unfolding X_def by auto |
958 then show ?thesis using AE_iff_null_sets[OF \<open>X \<in> sets M\<close>] unfolding X_def by auto |
959 qed |
959 qed |
960 |
960 |
961 lemma real_cond_exp_less_c: |
961 lemma real_cond_exp_less_c: |
962 assumes [measurable]: "integrable M f" |
962 assumes [measurable]: "integrable M f" |
963 and "AE x in M. f x < c" |
963 and "AE x in M. f x < c" |
964 shows "AE x in M. real_cond_exp M F f x < c" |
964 shows "AE x in M. real_cond_exp M F f x < c" |
965 proof - |
965 proof - |
966 have "AE x in M. real_cond_exp M F f x = -real_cond_exp M F (\<lambda>x. -f x) x" |
966 have "AE x in M. real_cond_exp M F f x = -real_cond_exp M F (\<lambda>x. -f x) x" |
967 using real_cond_exp_cmult[OF `integrable M f`, of "-1"] by auto |
967 using real_cond_exp_cmult[OF \<open>integrable M f\<close>, of "-1"] by auto |
968 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. -f x) x > -c" |
968 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. -f x) x > -c" |
969 apply (rule real_cond_exp_gr_c) using assms by auto |
969 apply (rule real_cond_exp_gr_c) using assms by auto |
970 ultimately show ?thesis by auto |
970 ultimately show ?thesis by auto |
971 qed |
971 qed |
972 |
972 |
1036 shows "AE x in M. real_cond_exp M F (\<lambda>x. \<Sum>i\<in>I. f i x) x = (\<Sum>i\<in>I. real_cond_exp M F (f i) x)" |
1036 shows "AE x in M. real_cond_exp M F (\<lambda>x. \<Sum>i\<in>I. f i x) x = (\<Sum>i\<in>I. real_cond_exp M F (f i) x)" |
1037 proof (rule real_cond_exp_charact) |
1037 proof (rule real_cond_exp_charact) |
1038 fix A assume [measurable]: "A \<in> sets F" |
1038 fix A assume [measurable]: "A \<in> sets F" |
1039 then have A_meas [measurable]: "A \<in> sets M" by (meson set_mp subalg subalgebra_def) |
1039 then have A_meas [measurable]: "A \<in> sets M" by (meson set_mp subalg subalgebra_def) |
1040 have *: "integrable M (\<lambda>x. indicator A x * f i x)" for i |
1040 have *: "integrable M (\<lambda>x. indicator A x * f i x)" for i |
1041 using integrable_mult_indicator[OF `A \<in> sets M` assms(1)] by auto |
1041 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> assms(1)] by auto |
1042 have **: "integrable M (\<lambda>x. indicator A x * real_cond_exp M F (f i) x)" for i |
1042 have **: "integrable M (\<lambda>x. indicator A x * real_cond_exp M F (f i) x)" for i |
1043 using integrable_mult_indicator[OF `A \<in> sets M` real_cond_exp_int(1)[OF assms(1)]] by auto |
1043 using integrable_mult_indicator[OF \<open>A \<in> sets M\<close> real_cond_exp_int(1)[OF assms(1)]] by auto |
1044 have inti: "(\<integral>x. indicator A x * f i x \<partial>M) = (\<integral>x. indicator A x * real_cond_exp M F (f i) x \<partial>M)" for i |
1044 have inti: "(\<integral>x. indicator A x * f i x \<partial>M) = (\<integral>x. indicator A x * real_cond_exp M F (f i) x \<partial>M)" for i |
1045 by (rule real_cond_exp_intg(2)[symmetric], auto simp add: *) |
1045 by (rule real_cond_exp_intg(2)[symmetric], auto simp add: *) |
1046 |
1046 |
1047 have "(\<integral>x\<in>A. (\<Sum>i\<in>I. f i x)\<partial>M) = (\<integral>x. (\<Sum>i\<in>I. indicator A x * f i x)\<partial>M)" |
1047 have "(\<integral>x\<in>A. (\<Sum>i\<in>I. f i x)\<partial>M) = (\<integral>x. (\<Sum>i\<in>I. indicator A x * f i x)\<partial>M)" |
1048 by (simp add: sum_distrib_left) |
1048 by (simp add: sum_distrib_left) |
1073 have [measurable]: "I \<in> sets borel" using I by auto |
1073 have [measurable]: "I \<in> sets borel" using I by auto |
1074 define phi where "phi = (\<lambda>x. Inf ((\<lambda>t. (q x - q t) / (x - t)) ` ({x<..} \<inter> I)))" |
1074 define phi where "phi = (\<lambda>x. Inf ((\<lambda>t. (q x - q t) / (x - t)) ` ({x<..} \<inter> I)))" |
1075 have **: "q (X x) \<ge> 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)" |
1075 have **: "q (X x) \<ge> 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)" |
1076 if "X x \<in> I" "real_cond_exp M F X x \<in> I" for x |
1076 if "X x \<in> I" "real_cond_exp M F X x \<in> I" for x |
1077 unfolding phi_def apply (rule convex_le_Inf_differential) |
1077 unfolding phi_def apply (rule convex_le_Inf_differential) |
1078 using `convex_on I q` that `interior I = I` by auto |
1078 using \<open>convex_on I q\<close> that \<open>interior I = I\<close> by auto |
1079 text {*It is not clear that the function $\phi$ is measurable. We replace it by a version which |
1079 text \<open>It is not clear that the function $\phi$ is measurable. We replace it by a version which |
1080 is better behaved.*} |
1080 is better behaved.\<close> |
1081 define psi where "psi = (\<lambda>x. phi x * indicator I x)" |
1081 define psi where "psi = (\<lambda>x. phi x * indicator I x)" |
1082 have A: "psi y = phi y" if "y \<in> I" for y unfolding psi_def indicator_def using that by auto |
1082 have A: "psi y = phi y" if "y \<in> I" for y unfolding psi_def indicator_def using that by auto |
1083 have *: "q (X x) \<ge> q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x)" |
1083 have *: "q (X x) \<ge> q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x)" |
1084 if "X x \<in> I" "real_cond_exp M F X x \<in> I" for x |
1084 if "X x \<in> I" "real_cond_exp M F X x \<in> I" for x |
1085 unfolding A[OF `real_cond_exp M F X x \<in> I`] using ** that by auto |
1085 unfolding A[OF \<open>real_cond_exp M F X x \<in> I\<close>] using ** that by auto |
1086 |
1086 |
1087 note I |
1087 note I |
1088 moreover have "AE x in M. real_cond_exp M F X x > a" if "I \<subseteq> {a <..}" for a |
1088 moreover have "AE x in M. real_cond_exp M F X x > a" if "I \<subseteq> {a <..}" for a |
1089 apply (rule real_cond_exp_gr_c) using X that by auto |
1089 apply (rule real_cond_exp_gr_c) using X that by auto |
1090 moreover have "AE x in M. real_cond_exp M F X x < b" if "I \<subseteq> {..<b}" for b |
1090 moreover have "AE x in M. real_cond_exp M F X x < b" if "I \<subseteq> {..<b}" for b |
1092 ultimately show "AE x in M. real_cond_exp M F X x \<in> I" |
1092 ultimately show "AE x in M. real_cond_exp M F X x \<in> I" |
1093 by (elim disjE) (auto simp: subset_eq) |
1093 by (elim disjE) (auto simp: subset_eq) |
1094 then have main_ineq: "AE x in M. q (X x) \<ge> q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x)" |
1094 then have main_ineq: "AE x in M. q (X x) \<ge> q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x)" |
1095 using * X(2) by auto |
1095 using * X(2) by auto |
1096 |
1096 |
1097 text {*Then, one wants to take the conditional expectation of this inequality. On the left, one gets |
1097 text \<open>Then, one wants to take the conditional expectation of this inequality. On the left, one gets |
1098 the conditional expectation of $q \circ X$. On the right, the last term vanishes, and one |
1098 the conditional expectation of $q \circ X$. On the right, the last term vanishes, and one |
1099 is left with $q$ of the conditional expectation, as desired. Unfortunately, this argument only |
1099 is left with $q$ of the conditional expectation, as desired. Unfortunately, this argument only |
1100 works if $\psi \cdot X$ and $q(E(X | F))$ are integrable, and there is no reason why this should be true. The |
1100 works if $\psi \cdot X$ and $q(E(X | F))$ are integrable, and there is no reason why this should be true. The |
1101 trick is to multiply by a $F$-measurable function which is small enough to make |
1101 trick is to multiply by a $F$-measurable function which is small enough to make |
1102 everything integrable.*} |
1102 everything integrable.\<close> |
1103 |
1103 |
1104 obtain f::"'a \<Rightarrow> real" where [measurable]: "f \<in> borel_measurable (restr_to_subalg M F)" |
1104 obtain f::"'a \<Rightarrow> real" where [measurable]: "f \<in> borel_measurable (restr_to_subalg M F)" |
1105 "integrable (restr_to_subalg M F) f" |
1105 "integrable (restr_to_subalg M F) f" |
1106 and f: "\<And>x. f x > 0" "\<And>x. f x \<le> 1" |
1106 and f: "\<And>x. f x > 0" "\<And>x. f x \<le> 1" |
1107 using sigma_finite_measure.obtain_positive_integrable_function[OF sigma_fin_subalg] by metis |
1107 using sigma_finite_measure.obtain_positive_integrable_function[OF sigma_fin_subalg] by metis |
1121 have "AE x in M. g x * q (X x) \<ge> g x * (q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x))" |
1121 have "AE x in M. g x * q (X x) \<ge> g x * (q (real_cond_exp M F X x) + psi (real_cond_exp M F X x) * (X x - real_cond_exp M F X x))" |
1122 using main_ineq g by (auto simp add: divide_simps) |
1122 using main_ineq g by (auto simp add: divide_simps) |
1123 then have main_G: "AE x in M. g x * q (X x) \<ge> g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)" |
1123 then have main_G: "AE x in M. g x * q (X x) \<ge> g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)" |
1124 unfolding G_def by (auto simp add: algebra_simps) |
1124 unfolding G_def by (auto simp add: algebra_simps) |
1125 |
1125 |
1126 text {*To proceed, we need to know that $\psi$ is measurable.*} |
1126 text \<open>To proceed, we need to know that $\psi$ is measurable.\<close> |
1127 have phi_mono: "phi x \<le> phi y" if "x \<le> y" "x \<in> I" "y \<in> I" for x y |
1127 have phi_mono: "phi x \<le> phi y" if "x \<le> y" "x \<in> I" "y \<in> I" for x y |
1128 proof (cases "x < y") |
1128 proof (cases "x < y") |
1129 case True |
1129 case True |
1130 have "q x + phi x * (y-x) \<le> q y" |
1130 have "q x + phi x * (y-x) \<le> q y" |
1131 unfolding phi_def apply (rule convex_le_Inf_differential) using `convex_on I q` that `interior I = I` by auto |
1131 unfolding phi_def apply (rule convex_le_Inf_differential) using \<open>convex_on I q\<close> that \<open>interior I = I\<close> by auto |
1132 then have "phi x \<le> (q x - q y) / (x - y)" |
1132 then have "phi x \<le> (q x - q y) / (x - y)" |
1133 using that `x < y` by (auto simp add: divide_simps algebra_simps) |
1133 using that \<open>x < y\<close> by (auto simp add: divide_simps algebra_simps) |
1134 moreover have "(q x - q y)/(x - y) \<le> phi y" |
1134 moreover have "(q x - q y)/(x - y) \<le> phi y" |
1135 unfolding phi_def proof (rule cInf_greatest, auto) |
1135 unfolding phi_def proof (rule cInf_greatest, auto) |
1136 fix t assume "t \<in> I" "y < t" |
1136 fix t assume "t \<in> I" "y < t" |
1137 have "(q x - q y) / (x - y) \<le> (q x - q t) / (x - t)" |
1137 have "(q x - q y) / (x - y) \<le> (q x - q t) / (x - t)" |
1138 apply (rule convex_on_diff[OF q(2)]) using `y < t` `x < y` `t \<in> I` `x \<in> I` by auto |
1138 apply (rule convex_on_diff[OF q(2)]) using \<open>y < t\<close> \<open>x < y\<close> \<open>t \<in> I\<close> \<open>x \<in> I\<close> by auto |
1139 also have "... \<le> (q y - q t) / (y - t)" |
1139 also have "... \<le> (q y - q t) / (y - t)" |
1140 apply (rule convex_on_diff[OF q(2)]) using `y < t` `x < y` `t \<in> I` `x \<in> I` by auto |
1140 apply (rule convex_on_diff[OF q(2)]) using \<open>y < t\<close> \<open>x < y\<close> \<open>t \<in> I\<close> \<open>x \<in> I\<close> by auto |
1141 finally show "(q x - q y) / (x - y) \<le> (q y - q t) / (y - t)" by simp |
1141 finally show "(q x - q y) / (x - y) \<le> (q y - q t) / (y - t)" by simp |
1142 next |
1142 next |
1143 obtain e where "0 < e" "ball y e \<subseteq> I" using `open I` `y \<in> I` openE by blast |
1143 obtain e where "0 < e" "ball y e \<subseteq> I" using \<open>open I\<close> \<open>y \<in> I\<close> openE by blast |
1144 then have "y + e/2 \<in> {y<..} \<inter> I" by (auto simp: dist_real_def) |
1144 then have "y + e/2 \<in> {y<..} \<inter> I" by (auto simp: dist_real_def) |
1145 then show "{y<..} \<inter> I = {} \<Longrightarrow> False" by auto |
1145 then show "{y<..} \<inter> I = {} \<Longrightarrow> False" by auto |
1146 qed |
1146 qed |
1147 ultimately show "phi x \<le> phi y" by auto |
1147 ultimately show "phi x \<le> phi y" by auto |
1148 next |
1148 next |
1149 case False |
1149 case False |
1150 then have "x = y" using `x \<le> y` by auto |
1150 then have "x = y" using \<open>x \<le> y\<close> by auto |
1151 then show ?thesis by auto |
1151 then show ?thesis by auto |
1152 qed |
1152 qed |
1153 have [measurable]: "psi \<in> borel_measurable borel" |
1153 have [measurable]: "psi \<in> borel_measurable borel" |
1154 by (rule borel_measurable_piecewise_mono[of "{I, -I}"]) |
1154 by (rule borel_measurable_piecewise_mono[of "{I, -I}"]) |
1155 (auto simp add: psi_def indicator_def phi_mono intro: mono_onI) |
1155 (auto simp add: psi_def indicator_def phi_mono intro: mono_onI) |
1159 "real_cond_exp M F X \<in> borel_measurable F" |
1159 "real_cond_exp M F X \<in> borel_measurable F" |
1160 "g \<in> borel_measurable F" "g \<in> borel_measurable M" |
1160 "g \<in> borel_measurable F" "g \<in> borel_measurable M" |
1161 "G \<in> borel_measurable F" "G \<in> borel_measurable M" |
1161 "G \<in> borel_measurable F" "G \<in> borel_measurable M" |
1162 using X measurable_from_subalg[OF subalg] unfolding G_def g_def by auto |
1162 using X measurable_from_subalg[OF subalg] unfolding G_def g_def by auto |
1163 have int1: "integrable (restr_to_subalg M F) (\<lambda>x. g x * q (real_cond_exp M F X x))" |
1163 have int1: "integrable (restr_to_subalg M F) (\<lambda>x. g x * q (real_cond_exp M F X x))" |
1164 apply (rule Bochner_Integration.integrable_bound[of _ f], auto simp add: subalg `integrable (restr_to_subalg M F) f`) |
1164 apply (rule Bochner_Integration.integrable_bound[of _ f], auto simp add: subalg \<open>integrable (restr_to_subalg M F) f\<close>) |
1165 unfolding g_def by (auto simp add: divide_simps abs_mult algebra_simps) |
1165 unfolding g_def by (auto simp add: divide_simps abs_mult algebra_simps) |
1166 have int2: "integrable M (\<lambda>x. G x * (X x - real_cond_exp M F X x))" |
1166 have int2: "integrable M (\<lambda>x. G x * (X x - real_cond_exp M F X x))" |
1167 apply (rule Bochner_Integration.integrable_bound[of _ "\<lambda>x. \<bar>X x\<bar> + \<bar>real_cond_exp M F X x\<bar>"]) |
1167 apply (rule Bochner_Integration.integrable_bound[of _ "\<lambda>x. \<bar>X x\<bar> + \<bar>real_cond_exp M F X x\<bar>"]) |
1168 apply (auto intro!: Bochner_Integration.integrable_add integrable_abs real_cond_exp_int `integrable M X` AE_I2) |
1168 apply (auto intro!: Bochner_Integration.integrable_add integrable_abs real_cond_exp_int \<open>integrable M X\<close> AE_I2) |
1169 using G unfolding abs_mult by (meson abs_ge_zero abs_triangle_ineq4 dual_order.trans mult_left_le_one_le) |
1169 using G unfolding abs_mult by (meson abs_ge_zero abs_triangle_ineq4 dual_order.trans mult_left_le_one_le) |
1170 have int3: "integrable M (\<lambda>x. g x * q (X x))" |
1170 have int3: "integrable M (\<lambda>x. g x * q (X x))" |
1171 apply (rule Bochner_Integration.integrable_bound[of _ "\<lambda>x. q(X x)"], auto simp add: q(1) abs_mult) |
1171 apply (rule Bochner_Integration.integrable_bound[of _ "\<lambda>x. q(X x)"], auto simp add: q(1) abs_mult) |
1172 using g by (simp add: less_imp_le mult_left_le_one_le) |
1172 using g by (simp add: less_imp_le mult_left_le_one_le) |
1173 |
1173 |
1174 text {*Taking the conditional expectation of the main convexity inequality \verb+main_G+, we get |
1174 text \<open>Taking the conditional expectation of the main convexity inequality \verb+main_G+, we get |
1175 the following.*} |
1175 the following.\<close> |
1176 have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (X x)) x \<ge> real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)) x" |
1176 have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (X x)) x \<ge> real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)) x" |
1177 apply (rule real_cond_exp_mono[OF main_G]) |
1177 apply (rule real_cond_exp_mono[OF main_G]) |
1178 apply (rule Bochner_Integration.integrable_add[OF integrable_from_subalg[OF subalg int1]]) |
1178 apply (rule Bochner_Integration.integrable_add[OF integrable_from_subalg[OF subalg int1]]) |
1179 using int2 int3 by auto |
1179 using int2 int3 by auto |
1180 text {*This reduces to the desired inequality thanks to the properties of conditional expectation, |
1180 text \<open>This reduces to the desired inequality thanks to the properties of conditional expectation, |
1181 i.e., the conditional expectation of an $F$-measurable function is this function, and one can |
1181 i.e., the conditional expectation of an $F$-measurable function is this function, and one can |
1182 multiply an $F$-measurable function outside of conditional expectations. |
1182 multiply an $F$-measurable function outside of conditional expectations. |
1183 Since all these equalities only hold almost everywhere, we formulate them separately, |
1183 Since all these equalities only hold almost everywhere, we formulate them separately, |
1184 and then combine all of them to simplify the above equation, again almost everywhere.*} |
1184 and then combine all of them to simplify the above equation, again almost everywhere.\<close> |
1185 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (X x)) x = g x * real_cond_exp M F (\<lambda>x. q (X x)) x" |
1185 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (X x)) x = g x * real_cond_exp M F (\<lambda>x. q (X x)) x" |
1186 by (rule real_cond_exp_mult, auto simp add: int3) |
1186 by (rule real_cond_exp_mult, auto simp add: int3) |
1187 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)) x |
1187 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x) + G x * (X x - real_cond_exp M F X x)) x |
1188 = real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x)) x + real_cond_exp M F (\<lambda>x. G x * (X x - real_cond_exp M F X x)) x" |
1188 = real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x)) x + real_cond_exp M F (\<lambda>x. G x * (X x - real_cond_exp M F X x)) x" |
1189 by (rule real_cond_exp_add, auto simp add: integrable_from_subalg[OF subalg int1] int2) |
1189 by (rule real_cond_exp_add, auto simp add: integrable_from_subalg[OF subalg int1] int2) |
1190 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x)) x = g x * q (real_cond_exp M F X x)" |
1190 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. g x * q (real_cond_exp M F X x)) x = g x * q (real_cond_exp M F X x)" |
1191 by (rule real_cond_exp_F_meas, auto simp add: integrable_from_subalg[OF subalg int1]) |
1191 by (rule real_cond_exp_F_meas, auto simp add: integrable_from_subalg[OF subalg int1]) |
1192 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. G x * (X x - real_cond_exp M F X x)) x = G x * real_cond_exp M F (\<lambda>x. (X x - real_cond_exp M F X x)) x" |
1192 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. G x * (X x - real_cond_exp M F X x)) x = G x * real_cond_exp M F (\<lambda>x. (X x - real_cond_exp M F X x)) x" |
1193 by (rule real_cond_exp_mult, auto simp add: int2) |
1193 by (rule real_cond_exp_mult, auto simp add: int2) |
1194 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. (X x - real_cond_exp M F X x)) x = real_cond_exp M F X x - real_cond_exp M F (\<lambda>x. real_cond_exp M F X x) x" |
1194 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. (X x - real_cond_exp M F X x)) x = real_cond_exp M F X x - real_cond_exp M F (\<lambda>x. real_cond_exp M F X x) x" |
1195 by (rule real_cond_exp_diff, auto intro!: real_cond_exp_int `integrable M X`) |
1195 by (rule real_cond_exp_diff, auto intro!: real_cond_exp_int \<open>integrable M X\<close>) |
1196 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. real_cond_exp M F X x) x = real_cond_exp M F X x " |
1196 moreover have "AE x in M. real_cond_exp M F (\<lambda>x. real_cond_exp M F X x) x = real_cond_exp M F X x " |
1197 by (rule real_cond_exp_F_meas, auto intro!: real_cond_exp_int `integrable M X`) |
1197 by (rule real_cond_exp_F_meas, auto intro!: real_cond_exp_int \<open>integrable M X\<close>) |
1198 ultimately have "AE x in M. g x * real_cond_exp M F (\<lambda>x. q (X x)) x \<ge> g x * q (real_cond_exp M F X x)" |
1198 ultimately have "AE x in M. g x * real_cond_exp M F (\<lambda>x. q (X x)) x \<ge> g x * q (real_cond_exp M F X x)" |
1199 by auto |
1199 by auto |
1200 then show "AE x in M. real_cond_exp M F (\<lambda>x. q (X x)) x \<ge> q (real_cond_exp M F X x)" |
1200 then show "AE x in M. real_cond_exp M F (\<lambda>x. q (X x)) x \<ge> q (real_cond_exp M F X x)" |
1201 using g(1) by (auto simp add: divide_simps) |
1201 using g(1) by (auto simp add: divide_simps) |
1202 qed |
1202 qed |
1203 |
1203 |
1204 text {*Jensen's inequality does not imply that $q(E(X|F))$ is integrable, as it only proves an upper |
1204 text \<open>Jensen's inequality does not imply that $q(E(X|F))$ is integrable, as it only proves an upper |
1205 bound for it. Indeed, this is not true in general, as the following counterexample shows: |
1205 bound for it. Indeed, this is not true in general, as the following counterexample shows: |
1206 |
1206 |
1207 on $[1,\infty)$ with Lebesgue measure, let $F$ be the sigma-algebra generated by the intervals $[n, n+1)$ |
1207 on $[1,\infty)$ with Lebesgue measure, let $F$ be the sigma-algebra generated by the intervals $[n, n+1)$ |
1208 for integer $n$. Let $q(x) = - \sqrt{x}$ for $x\geq 0$. Define $X$ which is equal to $1/n$ over |
1208 for integer $n$. Let $q(x) = - \sqrt{x}$ for $x\geq 0$. Define $X$ which is equal to $1/n$ over |
1209 $[n, n+1/n)$ and $2^{-n}$ on $[n+1/n, n+1)$. Then $X$ is integrable as $\sum 1/n^2 < \infty$, and |
1209 $[n, n+1/n)$ and $2^{-n}$ on $[n+1/n, n+1)$. Then $X$ is integrable as $\sum 1/n^2 < \infty$, and |
1240 next |
1240 next |
1241 case 2 |
1241 case 2 |
1242 interpret finite_measure M using 2 by (auto intro!: finite_measureI) |
1242 interpret finite_measure M using 2 by (auto intro!: finite_measureI) |
1243 |
1243 |
1244 have "I \<noteq> {}" |
1244 have "I \<noteq> {}" |
1245 using `AE x in M. X x \<in> I` 2 eventually_mono integral_less_AE_space by fastforce |
1245 using \<open>AE x in M. X x \<in> I\<close> 2 eventually_mono integral_less_AE_space by fastforce |
1246 then obtain z where "z \<in> I" by auto |
1246 then obtain z where "z \<in> I" by auto |
1247 |
1247 |
1248 define A where "A = Inf ((\<lambda>t. (q z - q t) / (z - t)) ` ({z<..} \<inter> I))" |
1248 define A where "A = Inf ((\<lambda>t. (q z - q t) / (z - t)) ` ({z<..} \<inter> I))" |
1249 have "q y \<ge> q z + A * (y - z)" if "y \<in> I" for y unfolding A_def apply (rule convex_le_Inf_differential) |
1249 have "q y \<ge> q z + A * (y - z)" if "y \<in> I" for y unfolding A_def apply (rule convex_le_Inf_differential) |
1250 using `z \<in> I` `y \<in> I` `interior I = I` q(2) by auto |
1250 using \<open>z \<in> I\<close> \<open>y \<in> I\<close> \<open>interior I = I\<close> q(2) by auto |
1251 then have "AE x in M. q (real_cond_exp M F X x) \<ge> q z + A * (real_cond_exp M F X x - z)" |
1251 then have "AE x in M. q (real_cond_exp M F X x) \<ge> q z + A * (real_cond_exp M F X x - z)" |
1252 using real_cond_exp_jensens_inequality(1)[OF X I q] by auto |
1252 using real_cond_exp_jensens_inequality(1)[OF X I q] by auto |
1253 moreover have "AE x in M. q (real_cond_exp M F X x) \<le> real_cond_exp M F (\<lambda>x. q (X x)) x" |
1253 moreover have "AE x in M. q (real_cond_exp M F X x) \<le> real_cond_exp M F (\<lambda>x. q (X x)) x" |
1254 using real_cond_exp_jensens_inequality(2)[OF X I q] by auto |
1254 using real_cond_exp_jensens_inequality(2)[OF X I q] by auto |
1255 moreover have "\<bar>a\<bar> \<le> \<bar>b\<bar> + \<bar>c\<bar>" if "b \<le> a \<and> a \<le> c" for a b c::real |
1255 moreover have "\<bar>a\<bar> \<le> \<bar>b\<bar> + \<bar>c\<bar>" if "b \<le> a \<and> a \<le> c" for a b c::real |
1269 proof (rule ccontr) |
1269 proof (rule ccontr) |
1270 assume *: "\<not>(q(0) = 0)" |
1270 assume *: "\<not>(q(0) = 0)" |
1271 define e where "e = \<bar>q(0)\<bar> / 2" |
1271 define e where "e = \<bar>q(0)\<bar> / 2" |
1272 then have "e > 0" using * by auto |
1272 then have "e > 0" using * by auto |
1273 have "continuous (at 0) q" |
1273 have "continuous (at 0) q" |
1274 using q(2) `0 \<in> I` `open I` \<open>interior I = I\<close> continuous_on_interior convex_on_continuous by blast |
1274 using q(2) \<open>0 \<in> I\<close> \<open>open I\<close> \<open>interior I = I\<close> continuous_on_interior convex_on_continuous by blast |
1275 then obtain d where d: "d > 0" "\<And>y. \<bar>y - 0\<bar> < d \<Longrightarrow> \<bar>q y - q 0\<bar> < e" using `e > 0` |
1275 then obtain d where d: "d > 0" "\<And>y. \<bar>y - 0\<bar> < d \<Longrightarrow> \<bar>q y - q 0\<bar> < e" using \<open>e > 0\<close> |
1276 by (metis continuous_at_real_range real_norm_def) |
1276 by (metis continuous_at_real_range real_norm_def) |
1277 then have *: "\<bar>q(y)\<bar> > e" if "\<bar>y\<bar> < d" for y |
1277 then have *: "\<bar>q(y)\<bar> > e" if "\<bar>y\<bar> < d" for y |
1278 proof - |
1278 proof - |
1279 have "\<bar>q 0\<bar> \<le> \<bar>q 0 - q y\<bar> + \<bar>q y\<bar>" by auto |
1279 have "\<bar>q 0\<bar> \<le> \<bar>q 0 - q y\<bar> + \<bar>q y\<bar>" by auto |
1280 also have "... < e + \<bar>q y\<bar>" using d(2) that by force |
1280 also have "... < e + \<bar>q y\<bar>" using d(2) that by force |
1281 finally have "\<bar>q y\<bar> > \<bar>q 0\<bar> - e" by auto |
1281 finally have "\<bar>q y\<bar> > \<bar>q 0\<bar> - e" by auto |
1282 then show ?thesis unfolding e_def by simp |
1282 then show ?thesis unfolding e_def by simp |
1283 qed |
1283 qed |
1284 have "emeasure M {x \<in> space M. \<bar>X x\<bar> < d} \<le> emeasure M ({x \<in> space M. 1 \<le> ennreal(1/e) * \<bar>q(X x)\<bar>} \<inter> space M)" |
1284 have "emeasure M {x \<in> space M. \<bar>X x\<bar> < d} \<le> emeasure M ({x \<in> space M. 1 \<le> ennreal(1/e) * \<bar>q(X x)\<bar>} \<inter> space M)" |
1285 by (rule emeasure_mono, auto simp add: * `e>0` less_imp_le ennreal_mult''[symmetric]) |
1285 by (rule emeasure_mono, auto simp add: * \<open>e>0\<close> less_imp_le ennreal_mult''[symmetric]) |
1286 also have "... \<le> (1/e) * (\<integral>\<^sup>+x. ennreal(\<bar>q(X x)\<bar>) * indicator (space M) x \<partial>M)" |
1286 also have "... \<le> (1/e) * (\<integral>\<^sup>+x. ennreal(\<bar>q(X x)\<bar>) * indicator (space M) x \<partial>M)" |
1287 by (rule nn_integral_Markov_inequality, auto) |
1287 by (rule nn_integral_Markov_inequality, auto) |
1288 also have "... = (1/e) * (\<integral>\<^sup>+x. ennreal(\<bar>q(X x)\<bar>) \<partial>M)" by auto |
1288 also have "... = (1/e) * (\<integral>\<^sup>+x. ennreal(\<bar>q(X x)\<bar>) \<partial>M)" by auto |
1289 also have "... = (1/e) * ennreal(\<integral>x. \<bar>q(X x)\<bar> \<partial>M)" |
1289 also have "... = (1/e) * ennreal(\<integral>x. \<bar>q(X x)\<bar> \<partial>M)" |
1290 using nn_integral_eq_integral[OF integrable_abs[OF q(1)]] by auto |
1290 using nn_integral_eq_integral[OF integrable_abs[OF q(1)]] by auto |
1291 also have "... < \<infinity>" |
1291 also have "... < \<infinity>" |
1292 by (simp add: ennreal_mult_less_top) |
1292 by (simp add: ennreal_mult_less_top) |
1293 finally have A: "emeasure M {x \<in> space M. \<bar>X x\<bar> < d} < \<infinity>" by simp |
1293 finally have A: "emeasure M {x \<in> space M. \<bar>X x\<bar> < d} < \<infinity>" by simp |
1294 |
1294 |
1295 have "{x \<in> space M. \<bar>X x\<bar> \<ge> d} = {x \<in> space M. 1 \<le> ennreal(1/d) * \<bar>X x\<bar>} \<inter> space M" |
1295 have "{x \<in> space M. \<bar>X x\<bar> \<ge> d} = {x \<in> space M. 1 \<le> ennreal(1/d) * \<bar>X x\<bar>} \<inter> space M" |
1296 by (auto simp add: `d>0` ennreal_mult''[symmetric]) |
1296 by (auto simp add: \<open>d>0\<close> ennreal_mult''[symmetric]) |
1297 then have "emeasure M {x \<in> space M. \<bar>X x\<bar> \<ge> d} = emeasure M ({x \<in> space M. 1 \<le> ennreal(1/d) * \<bar>X x\<bar>} \<inter> space M)" |
1297 then have "emeasure M {x \<in> space M. \<bar>X x\<bar> \<ge> d} = emeasure M ({x \<in> space M. 1 \<le> ennreal(1/d) * \<bar>X x\<bar>} \<inter> space M)" |
1298 by auto |
1298 by auto |
1299 also have "... \<le> (1/d) * (\<integral>\<^sup>+x. ennreal(\<bar>X x\<bar>) * indicator (space M) x \<partial>M)" |
1299 also have "... \<le> (1/d) * (\<integral>\<^sup>+x. ennreal(\<bar>X x\<bar>) * indicator (space M) x \<partial>M)" |
1300 by (rule nn_integral_Markov_inequality, auto) |
1300 by (rule nn_integral_Markov_inequality, auto) |
1301 also have "... = (1/d) * (\<integral>\<^sup>+x. ennreal(\<bar>X x\<bar>) \<partial>M)" by auto |
1301 also have "... = (1/d) * (\<integral>\<^sup>+x. ennreal(\<bar>X x\<bar>) \<partial>M)" by auto |
1309 then have "emeasure M (space M) = emeasure M ({x \<in> space M. \<bar>X x\<bar> < d} \<union> {x \<in> space M. \<bar>X x\<bar> \<ge> d})" |
1309 then have "emeasure M (space M) = emeasure M ({x \<in> space M. \<bar>X x\<bar> < d} \<union> {x \<in> space M. \<bar>X x\<bar> \<ge> d})" |
1310 by simp |
1310 by simp |
1311 also have "... \<le> emeasure M {x \<in> space M. \<bar>X x\<bar> < d} + emeasure M {x \<in> space M. \<bar>X x\<bar> \<ge> d}" |
1311 also have "... \<le> emeasure M {x \<in> space M. \<bar>X x\<bar> < d} + emeasure M {x \<in> space M. \<bar>X x\<bar> \<ge> d}" |
1312 by (auto intro!: emeasure_subadditive) |
1312 by (auto intro!: emeasure_subadditive) |
1313 also have "... < \<infinity>" using A B by auto |
1313 also have "... < \<infinity>" using A B by auto |
1314 finally show False using `emeasure M (space M) = \<infinity>` by auto |
1314 finally show False using \<open>emeasure M (space M) = \<infinity>\<close> by auto |
1315 qed |
1315 qed |
1316 |
1316 |
1317 define A where "A = Inf ((\<lambda>t. (q 0 - q t) / (0 - t)) ` ({0<..} \<inter> I))" |
1317 define A where "A = Inf ((\<lambda>t. (q 0 - q t) / (0 - t)) ` ({0<..} \<inter> I))" |
1318 have "q y \<ge> q 0 + A * (y - 0)" if "y \<in> I" for y unfolding A_def apply (rule convex_le_Inf_differential) |
1318 have "q y \<ge> q 0 + A * (y - 0)" if "y \<in> I" for y unfolding A_def apply (rule convex_le_Inf_differential) |
1319 using `0 \<in> I` `y \<in> I` `interior I = I` q(2) by auto |
1319 using \<open>0 \<in> I\<close> \<open>y \<in> I\<close> \<open>interior I = I\<close> q(2) by auto |
1320 then have "q y \<ge> A * y" if "y \<in> I" for y using `q 0 = 0` that by auto |
1320 then have "q y \<ge> A * y" if "y \<in> I" for y using \<open>q 0 = 0\<close> that by auto |
1321 then have "AE x in M. q (real_cond_exp M F X x) \<ge> A * real_cond_exp M F X x" |
1321 then have "AE x in M. q (real_cond_exp M F X x) \<ge> A * real_cond_exp M F X x" |
1322 using real_cond_exp_jensens_inequality(1)[OF X I q] by auto |
1322 using real_cond_exp_jensens_inequality(1)[OF X I q] by auto |
1323 moreover have "AE x in M. q (real_cond_exp M F X x) \<le> real_cond_exp M F (\<lambda>x. q (X x)) x" |
1323 moreover have "AE x in M. q (real_cond_exp M F X x) \<le> real_cond_exp M F (\<lambda>x. q (X x)) x" |
1324 using real_cond_exp_jensens_inequality(2)[OF X I q] by auto |
1324 using real_cond_exp_jensens_inequality(2)[OF X I q] by auto |
1325 moreover have "\<bar>a\<bar> \<le> \<bar>b\<bar> + \<bar>c\<bar>" if "b \<le> a \<and> a \<le> c" for a b c::real |
1325 moreover have "\<bar>a\<bar> \<le> \<bar>b\<bar> + \<bar>c\<bar>" if "b \<le> a \<and> a \<le> c" for a b c::real |