266 by auto |
257 by auto |
267 with `x \<in> space M` show "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M \<in> sets M" |
258 with `x \<in> space M` show "(\<lambda>x. (f x, g x)) -` {(f x, g x)} \<inter> space M \<in> sets M" |
268 using assms unfolding simple_function_def by auto |
259 using assms unfolding simple_function_def by auto |
269 qed |
260 qed |
270 |
261 |
271 lemma (in sigma_algebra) simple_function_compose1: |
262 lemma simple_function_compose1: |
272 assumes "simple_function M f" |
263 assumes "simple_function M f" |
273 shows "simple_function M (\<lambda>x. g (f x))" |
264 shows "simple_function M (\<lambda>x. g (f x))" |
274 using simple_function_compose[OF assms, of g] |
265 using simple_function_compose[OF assms, of g] |
275 by (simp add: comp_def) |
266 by (simp add: comp_def) |
276 |
267 |
277 lemma (in sigma_algebra) simple_function_compose2: |
268 lemma simple_function_compose2: |
278 assumes "simple_function M f" and "simple_function M g" |
269 assumes "simple_function M f" and "simple_function M g" |
279 shows "simple_function M (\<lambda>x. h (f x) (g x))" |
270 shows "simple_function M (\<lambda>x. h (f x) (g x))" |
280 proof - |
271 proof - |
281 have "simple_function M ((\<lambda>(x, y). h x y) \<circ> (\<lambda>x. (f x, g x)))" |
272 have "simple_function M ((\<lambda>(x, y). h x y) \<circ> (\<lambda>x. (f x, g x)))" |
282 using assms by auto |
273 using assms by auto |
283 thus ?thesis by (simp_all add: comp_def) |
274 thus ?thesis by (simp_all add: comp_def) |
284 qed |
275 qed |
285 |
276 |
286 lemmas (in sigma_algebra) simple_function_add[intro, simp] = simple_function_compose2[where h="op +"] |
277 lemmas simple_function_add[intro, simp] = simple_function_compose2[where h="op +"] |
287 and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"] |
278 and simple_function_diff[intro, simp] = simple_function_compose2[where h="op -"] |
288 and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"] |
279 and simple_function_uminus[intro, simp] = simple_function_compose[where g="uminus"] |
289 and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"] |
280 and simple_function_mult[intro, simp] = simple_function_compose2[where h="op *"] |
290 and simple_function_div[intro, simp] = simple_function_compose2[where h="op /"] |
281 and simple_function_div[intro, simp] = simple_function_compose2[where h="op /"] |
291 and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"] |
282 and simple_function_inverse[intro, simp] = simple_function_compose[where g="inverse"] |
292 and simple_function_max[intro, simp] = simple_function_compose2[where h=max] |
283 and simple_function_max[intro, simp] = simple_function_compose2[where h=max] |
293 |
284 |
294 lemma (in sigma_algebra) simple_function_setsum[intro, simp]: |
285 lemma simple_function_setsum[intro, simp]: |
295 assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)" |
286 assumes "\<And>i. i \<in> P \<Longrightarrow> simple_function M (f i)" |
296 shows "simple_function M (\<lambda>x. \<Sum>i\<in>P. f i x)" |
287 shows "simple_function M (\<lambda>x. \<Sum>i\<in>P. f i x)" |
297 proof cases |
288 proof cases |
298 assume "finite P" from this assms show ?thesis by induct auto |
289 assume "finite P" from this assms show ?thesis by induct auto |
299 qed auto |
290 qed auto |
300 |
291 |
301 lemma (in sigma_algebra) |
292 lemma |
302 fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f" |
293 fixes f g :: "'a \<Rightarrow> real" assumes sf: "simple_function M f" |
303 shows simple_function_ereal[intro, simp]: "simple_function M (\<lambda>x. ereal (f x))" |
294 shows simple_function_ereal[intro, simp]: "simple_function M (\<lambda>x. ereal (f x))" |
304 by (auto intro!: simple_function_compose1[OF sf]) |
295 by (auto intro!: simple_function_compose1[OF sf]) |
305 |
296 |
306 lemma (in sigma_algebra) |
297 lemma |
307 fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f" |
298 fixes f g :: "'a \<Rightarrow> nat" assumes sf: "simple_function M f" |
308 shows simple_function_real_of_nat[intro, simp]: "simple_function M (\<lambda>x. real (f x))" |
299 shows simple_function_real_of_nat[intro, simp]: "simple_function M (\<lambda>x. real (f x))" |
309 by (auto intro!: simple_function_compose1[OF sf]) |
300 by (auto intro!: simple_function_compose1[OF sf]) |
310 |
301 |
311 lemma (in sigma_algebra) borel_measurable_implies_simple_function_sequence: |
302 lemma borel_measurable_implies_simple_function_sequence: |
312 fixes u :: "'a \<Rightarrow> ereal" |
303 fixes u :: "'a \<Rightarrow> ereal" |
313 assumes u: "u \<in> borel_measurable M" |
304 assumes u: "u \<in> borel_measurable M" |
314 shows "\<exists>f. incseq f \<and> (\<forall>i. \<infinity> \<notin> range (f i) \<and> simple_function M (f i)) \<and> |
305 shows "\<exists>f. incseq f \<and> (\<forall>i. \<infinity> \<notin> range (f i) \<and> simple_function M (f i)) \<and> |
315 (\<forall>x. (SUP i. f i x) = max 0 (u x)) \<and> (\<forall>i x. 0 \<le> f i x)" |
306 (\<forall>x. (SUP i. f i x) = max 0 (u x)) \<and> (\<forall>i x. 0 \<le> f i x)" |
316 proof - |
307 proof - |
667 simple_function_partition[OF f g] |
606 simple_function_partition[OF f g] |
668 simple_function_partition[OF g f] |
607 simple_function_partition[OF g f] |
669 proof (safe intro!: setsum_mono) |
608 proof (safe intro!: setsum_mono) |
670 fix x assume "x \<in> space M" |
609 fix x assume "x \<in> space M" |
671 then have *: "f ` ?S x = {f x}" "g ` ?S x = {g x}" by auto |
610 then have *: "f ` ?S x = {f x}" "g ` ?S x = {g x}" by auto |
672 show "the_elem (f`?S x) * \<mu> (?S x) \<le> the_elem (g`?S x) * \<mu> (?S x)" |
611 show "the_elem (f`?S x) * (emeasure M) (?S x) \<le> the_elem (g`?S x) * (emeasure M) (?S x)" |
673 proof (cases "f x \<le> g x") |
612 proof (cases "f x \<le> g x") |
674 case True then show ?thesis |
613 case True then show ?thesis |
675 using * assms(1,2)[THEN simple_functionD(2)] |
614 using * assms(1,2)[THEN simple_functionD(2)] |
676 by (auto intro!: ereal_mult_right_mono) |
615 by (auto intro!: ereal_mult_right_mono) |
677 next |
616 next |
678 case False |
617 case False |
679 obtain N where N: "{x\<in>space M. \<not> f x \<le> g x} \<subseteq> N" "N \<in> sets M" "\<mu> N = 0" |
618 obtain N where N: "{x\<in>space M. \<not> f x \<le> g x} \<subseteq> N" "N \<in> sets M" "(emeasure M) N = 0" |
680 using mono by (auto elim!: AE_E) |
619 using mono by (auto elim!: AE_E) |
681 have "?S x \<subseteq> N" using N `x \<in> space M` False by auto |
620 have "?S x \<subseteq> N" using N `x \<in> space M` False by auto |
682 moreover have "?S x \<in> sets M" using assms |
621 moreover have "?S x \<in> sets M" using assms |
683 by (rule_tac Int) (auto intro!: simple_functionD) |
622 by (rule_tac Int) (auto intro!: simple_functionD) |
684 ultimately have "\<mu> (?S x) \<le> \<mu> N" |
623 ultimately have "(emeasure M) (?S x) \<le> (emeasure M) N" |
685 using `N \<in> sets M` by (auto intro!: measure_mono) |
624 using `N \<in> sets M` by (auto intro!: emeasure_mono) |
686 moreover have "0 \<le> \<mu> (?S x)" |
625 moreover have "0 \<le> (emeasure M) (?S x)" |
687 using assms(1,2)[THEN simple_functionD(2)] by auto |
626 using assms(1,2)[THEN simple_functionD(2)] by auto |
688 ultimately have "\<mu> (?S x) = 0" using `\<mu> N = 0` by auto |
627 ultimately have "(emeasure M) (?S x) = 0" using `(emeasure M) N = 0` by auto |
689 then show ?thesis by simp |
628 then show ?thesis by simp |
690 qed |
629 qed |
691 qed |
630 qed |
692 qed |
631 qed |
693 |
632 |
694 lemma (in measure_space) simple_integral_mono: |
633 lemma simple_integral_mono: |
695 assumes "simple_function M f" and "simple_function M g" |
634 assumes "simple_function M f" and "simple_function M g" |
696 and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x" |
635 and mono: "\<And> x. x \<in> space M \<Longrightarrow> f x \<le> g x" |
697 shows "integral\<^isup>S M f \<le> integral\<^isup>S M g" |
636 shows "integral\<^isup>S M f \<le> integral\<^isup>S M g" |
698 using assms by (intro simple_integral_mono_AE) auto |
637 using assms by (intro simple_integral_mono_AE) auto |
699 |
638 |
700 lemma (in measure_space) simple_integral_cong_AE: |
639 lemma simple_integral_cong_AE: |
701 assumes "simple_function M f" and "simple_function M g" |
640 assumes "simple_function M f" and "simple_function M g" |
702 and "AE x. f x = g x" |
641 and "AE x in M. f x = g x" |
703 shows "integral\<^isup>S M f = integral\<^isup>S M g" |
642 shows "integral\<^isup>S M f = integral\<^isup>S M g" |
704 using assms by (auto simp: eq_iff intro!: simple_integral_mono_AE) |
643 using assms by (auto simp: eq_iff intro!: simple_integral_mono_AE) |
705 |
644 |
706 lemma (in measure_space) simple_integral_cong': |
645 lemma simple_integral_cong': |
707 assumes sf: "simple_function M f" "simple_function M g" |
646 assumes sf: "simple_function M f" "simple_function M g" |
708 and mea: "\<mu> {x\<in>space M. f x \<noteq> g x} = 0" |
647 and mea: "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0" |
709 shows "integral\<^isup>S M f = integral\<^isup>S M g" |
648 shows "integral\<^isup>S M f = integral\<^isup>S M g" |
710 proof (intro simple_integral_cong_AE sf AE_I) |
649 proof (intro simple_integral_cong_AE sf AE_I) |
711 show "\<mu> {x\<in>space M. f x \<noteq> g x} = 0" by fact |
650 show "(emeasure M) {x\<in>space M. f x \<noteq> g x} = 0" by fact |
712 show "{x \<in> space M. f x \<noteq> g x} \<in> sets M" |
651 show "{x \<in> space M. f x \<noteq> g x} \<in> sets M" |
713 using sf[THEN borel_measurable_simple_function] by auto |
652 using sf[THEN borel_measurable_simple_function] by auto |
714 qed simp |
653 qed simp |
715 |
654 |
716 lemma (in measure_space) simple_integral_indicator: |
655 lemma simple_integral_indicator: |
717 assumes "A \<in> sets M" |
656 assumes "A \<in> sets M" |
718 assumes "simple_function M f" |
657 assumes "simple_function M f" |
719 shows "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = |
658 shows "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = |
720 (\<Sum>x \<in> f ` space M. x * \<mu> (f -` {x} \<inter> space M \<inter> A))" |
659 (\<Sum>x \<in> f ` space M. x * (emeasure M) (f -` {x} \<inter> space M \<inter> A))" |
721 proof cases |
660 proof cases |
722 assume "A = space M" |
661 assume "A = space M" |
723 moreover hence "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = integral\<^isup>S M f" |
662 moreover hence "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = integral\<^isup>S M f" |
724 by (auto intro!: simple_integral_cong) |
663 by (auto intro!: simple_integral_cong) |
725 moreover have "\<And>X. X \<inter> space M \<inter> space M = X \<inter> space M" by auto |
664 moreover have "\<And>X. X \<inter> space M \<inter> space M = X \<inter> space M" by auto |
735 using sets_into_space[OF assms(1)] by (auto intro!: image_eqI[of _ _ y]) |
674 using sets_into_space[OF assms(1)] by (auto intro!: image_eqI[of _ _ y]) |
736 next |
675 next |
737 show "0 \<in> ?I ` space M" using x by (auto intro!: image_eqI[of _ _ x]) |
676 show "0 \<in> ?I ` space M" using x by (auto intro!: image_eqI[of _ _ x]) |
738 qed |
677 qed |
739 have *: "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = |
678 have *: "(\<integral>\<^isup>Sx. f x * indicator A x \<partial>M) = |
740 (\<Sum>x \<in> f ` space M \<union> {0}. x * \<mu> (f -` {x} \<inter> space M \<inter> A))" |
679 (\<Sum>x \<in> f ` space M \<union> {0}. x * (emeasure M) (f -` {x} \<inter> space M \<inter> A))" |
741 unfolding simple_integral_def I |
680 unfolding simple_integral_def I |
742 proof (rule setsum_mono_zero_cong_left) |
681 proof (rule setsum_mono_zero_cong_left) |
743 show "finite (f ` space M \<union> {0})" |
682 show "finite (f ` space M \<union> {0})" |
744 using assms(2) unfolding simple_function_def by auto |
683 using assms(2) unfolding simple_function_def by auto |
745 show "f ` A \<union> {0} \<subseteq> f`space M \<union> {0}" |
684 show "f ` A \<union> {0} \<subseteq> f`space M \<union> {0}" |
746 using sets_into_space[OF assms(1)] by auto |
685 using sets_into_space[OF assms(1)] by auto |
747 have "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}" |
686 have "\<And>x. f x \<notin> f ` A \<Longrightarrow> f -` {f x} \<inter> space M \<inter> A = {}" |
748 by (auto simp: image_iff) |
687 by (auto simp: image_iff) |
749 thus "\<forall>i\<in>f ` space M \<union> {0} - (f ` A \<union> {0}). |
688 thus "\<forall>i\<in>f ` space M \<union> {0} - (f ` A \<union> {0}). |
750 i * \<mu> (f -` {i} \<inter> space M \<inter> A) = 0" by auto |
689 i * (emeasure M) (f -` {i} \<inter> space M \<inter> A) = 0" by auto |
751 next |
690 next |
752 fix x assume "x \<in> f`A \<union> {0}" |
691 fix x assume "x \<in> f`A \<union> {0}" |
753 hence "x \<noteq> 0 \<Longrightarrow> ?I -` {x} \<inter> space M = f -` {x} \<inter> space M \<inter> A" |
692 hence "x \<noteq> 0 \<Longrightarrow> ?I -` {x} \<inter> space M = f -` {x} \<inter> space M \<inter> A" |
754 by (auto simp: indicator_def split: split_if_asm) |
693 by (auto simp: indicator_def split: split_if_asm) |
755 thus "x * \<mu> (?I -` {x} \<inter> space M) = |
694 thus "x * (emeasure M) (?I -` {x} \<inter> space M) = |
756 x * \<mu> (f -` {x} \<inter> space M \<inter> A)" by (cases "x = 0") simp_all |
695 x * (emeasure M) (f -` {x} \<inter> space M \<inter> A)" by (cases "x = 0") simp_all |
757 qed |
696 qed |
758 show ?thesis unfolding * |
697 show ?thesis unfolding * |
759 using assms(2) unfolding simple_function_def |
698 using assms(2) unfolding simple_function_def |
760 by (auto intro!: setsum_mono_zero_cong_right) |
699 by (auto intro!: setsum_mono_zero_cong_right) |
761 qed |
700 qed |
762 |
701 |
763 lemma (in measure_space) simple_integral_indicator_only[simp]: |
702 lemma simple_integral_indicator_only[simp]: |
764 assumes "A \<in> sets M" |
703 assumes "A \<in> sets M" |
765 shows "integral\<^isup>S M (indicator A) = \<mu> A" |
704 shows "integral\<^isup>S M (indicator A) = emeasure M A" |
766 proof cases |
705 proof cases |
767 assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto |
706 assume "space M = {}" hence "A = {}" using sets_into_space[OF assms] by auto |
768 thus ?thesis unfolding simple_integral_def using `space M = {}` by auto |
707 thus ?thesis unfolding simple_integral_def using `space M = {}` by auto |
769 next |
708 next |
770 assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::ereal}" by auto |
709 assume "space M \<noteq> {}" hence "(\<lambda>x. 1) ` space M = {1::ereal}" by auto |
771 thus ?thesis |
710 thus ?thesis |
772 using simple_integral_indicator[OF assms simple_function_const[of 1]] |
711 using simple_integral_indicator[OF assms simple_function_const[of _ 1]] |
773 using sets_into_space[OF assms] |
712 using sets_into_space[OF assms] |
774 by (auto intro!: arg_cong[where f="\<mu>"]) |
713 by (auto intro!: arg_cong[where f="(emeasure M)"]) |
775 qed |
714 qed |
776 |
715 |
777 lemma (in measure_space) simple_integral_null_set: |
716 lemma simple_integral_null_set: |
778 assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets" |
717 assumes "simple_function M u" "\<And>x. 0 \<le> u x" and "N \<in> null_sets M" |
779 shows "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = 0" |
718 shows "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = 0" |
780 proof - |
719 proof - |
781 have "AE x. indicator N x = (0 :: ereal)" |
720 have "AE x in M. indicator N x = (0 :: ereal)" |
782 using `N \<in> null_sets` by (auto simp: indicator_def intro!: AE_I[of _ N]) |
721 using `N \<in> null_sets M` by (auto simp: indicator_def intro!: AE_I[of _ _ N]) |
783 then have "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^isup>Sx. 0 \<partial>M)" |
722 then have "(\<integral>\<^isup>Sx. u x * indicator N x \<partial>M) = (\<integral>\<^isup>Sx. 0 \<partial>M)" |
784 using assms apply (intro simple_integral_cong_AE) by auto |
723 using assms apply (intro simple_integral_cong_AE) by auto |
785 then show ?thesis by simp |
724 then show ?thesis by simp |
786 qed |
725 qed |
787 |
726 |
788 lemma (in measure_space) simple_integral_cong_AE_mult_indicator: |
727 lemma simple_integral_cong_AE_mult_indicator: |
789 assumes sf: "simple_function M f" and eq: "AE x. x \<in> S" and "S \<in> sets M" |
728 assumes sf: "simple_function M f" and eq: "AE x in M. x \<in> S" and "S \<in> sets M" |
790 shows "integral\<^isup>S M f = (\<integral>\<^isup>Sx. f x * indicator S x \<partial>M)" |
729 shows "integral\<^isup>S M f = (\<integral>\<^isup>Sx. f x * indicator S x \<partial>M)" |
791 using assms by (intro simple_integral_cong_AE) auto |
730 using assms by (intro simple_integral_cong_AE) auto |
792 |
731 |
793 lemma (in measure_space) simple_integral_restricted: |
732 lemma simple_integral_distr: |
794 assumes "A \<in> sets M" |
733 assumes T: "T \<in> measurable M M'" |
795 assumes sf: "simple_function M (\<lambda>x. f x * indicator A x)" |
734 and f: "simple_function M' f" |
796 shows "integral\<^isup>S (restricted_space A) f = (\<integral>\<^isup>Sx. f x * indicator A x \<partial>M)" |
735 shows "integral\<^isup>S (distr M M' T) f = (\<integral>\<^isup>S x. f (T x) \<partial>M)" |
797 (is "_ = integral\<^isup>S M ?f") |
|
798 unfolding simple_integral_def |
736 unfolding simple_integral_def |
799 proof (simp, safe intro!: setsum_mono_zero_cong_left) |
737 proof (intro setsum_mono_zero_cong_right ballI) |
800 from sf show "finite (?f ` space M)" |
738 show "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space (distr M M' T)" |
801 unfolding simple_function_def by auto |
739 using T unfolding measurable_def by auto |
|
740 show "finite (f ` space (distr M M' T))" |
|
741 using f unfolding simple_function_def by auto |
802 next |
742 next |
803 fix x assume "x \<in> A" |
743 fix i assume "i \<in> f ` space (distr M M' T) - (\<lambda>x. f (T x)) ` space M" |
804 then show "f x \<in> ?f ` space M" |
744 then have "T -` (f -` {i} \<inter> space (distr M M' T)) \<inter> space M = {}" by (auto simp: image_iff) |
805 using sets_into_space `A \<in> sets M` by (auto intro!: image_eqI[of _ _ x]) |
745 with f[THEN simple_functionD(2), of "{i}"] |
|
746 show "i * emeasure (distr M M' T) (f -` {i} \<inter> space (distr M M' T)) = 0" |
|
747 using T by (simp add: emeasure_distr) |
806 next |
748 next |
807 fix x assume "x \<in> space M" "?f x \<notin> f`A" |
749 fix i assume "i \<in> (\<lambda>x. f (T x)) ` space M" |
808 then have "x \<notin> A" by (auto simp: image_iff) |
750 then have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M" |
809 then show "?f x * \<mu> (?f -` {?f x} \<inter> space M) = 0" by simp |
751 using T unfolding measurable_def by auto |
810 next |
752 with f[THEN simple_functionD(2), of "{i}"] T |
811 fix x assume "x \<in> A" |
753 show "i * emeasure (distr M M' T) (f -` {i} \<inter> space (distr M M' T)) = |
812 then have "f x \<noteq> 0 \<Longrightarrow> |
754 i * (emeasure M) ((\<lambda>x. f (T x)) -` {i} \<inter> space M)" |
813 f -` {f x} \<inter> A = ?f -` {f x} \<inter> space M" |
755 by (auto simp add: emeasure_distr) |
814 using `A \<in> sets M` sets_into_space |
756 qed |
815 by (auto simp: indicator_def split: split_if_asm) |
757 |
816 then show "f x * \<mu> (f -` {f x} \<inter> A) = |
758 lemma simple_integral_cmult_indicator: |
817 f x * \<mu> (?f -` {f x} \<inter> space M)" |
|
818 unfolding ereal_mult_cancel_left by auto |
|
819 qed |
|
820 |
|
821 lemma (in measure_space) simple_integral_subalgebra: |
|
822 assumes N: "measure_space N" and [simp]: "space N = space M" "measure N = measure M" |
|
823 shows "integral\<^isup>S N = integral\<^isup>S M" |
|
824 unfolding simple_integral_def [abs_def] by simp |
|
825 |
|
826 lemma (in measure_space) simple_integral_vimage: |
|
827 assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'" |
|
828 and f: "simple_function M' f" |
|
829 shows "integral\<^isup>S M' f = (\<integral>\<^isup>S x. f (T x) \<partial>M)" |
|
830 proof - |
|
831 interpret T: measure_space M' by (rule measure_space_vimage[OF T]) |
|
832 show "integral\<^isup>S M' f = (\<integral>\<^isup>S x. f (T x) \<partial>M)" |
|
833 unfolding simple_integral_def |
|
834 proof (intro setsum_mono_zero_cong_right ballI) |
|
835 show "(\<lambda>x. f (T x)) ` space M \<subseteq> f ` space M'" |
|
836 using T unfolding measurable_def measure_preserving_def by auto |
|
837 show "finite (f ` space M')" |
|
838 using f unfolding simple_function_def by auto |
|
839 next |
|
840 fix i assume "i \<in> f ` space M' - (\<lambda>x. f (T x)) ` space M" |
|
841 then have "T -` (f -` {i} \<inter> space M') \<inter> space M = {}" by (auto simp: image_iff) |
|
842 with f[THEN T.simple_functionD(2), THEN measure_preservingD[OF T(2)], of "{i}"] |
|
843 show "i * T.\<mu> (f -` {i} \<inter> space M') = 0" by simp |
|
844 next |
|
845 fix i assume "i \<in> (\<lambda>x. f (T x)) ` space M" |
|
846 then have "T -` (f -` {i} \<inter> space M') \<inter> space M = (\<lambda>x. f (T x)) -` {i} \<inter> space M" |
|
847 using T unfolding measurable_def measure_preserving_def by auto |
|
848 with f[THEN T.simple_functionD(2), THEN measure_preservingD[OF T(2)], of "{i}"] |
|
849 show "i * T.\<mu> (f -` {i} \<inter> space M') = i * \<mu> ((\<lambda>x. f (T x)) -` {i} \<inter> space M)" |
|
850 by auto |
|
851 qed |
|
852 qed |
|
853 |
|
854 lemma (in measure_space) simple_integral_cmult_indicator: |
|
855 assumes A: "A \<in> sets M" |
759 assumes A: "A \<in> sets M" |
856 shows "(\<integral>\<^isup>Sx. c * indicator A x \<partial>M) = c * \<mu> A" |
760 shows "(\<integral>\<^isup>Sx. c * indicator A x \<partial>M) = c * (emeasure M) A" |
857 using simple_integral_mult[OF simple_function_indicator[OF A]] |
761 using simple_integral_mult[OF simple_function_indicator[OF A]] |
858 unfolding simple_integral_indicator_only[OF A] by simp |
762 unfolding simple_integral_indicator_only[OF A] by simp |
859 |
763 |
860 lemma (in measure_space) simple_integral_positive: |
764 lemma simple_integral_positive: |
861 assumes f: "simple_function M f" and ae: "AE x. 0 \<le> f x" |
765 assumes f: "simple_function M f" and ae: "AE x in M. 0 \<le> f x" |
862 shows "0 \<le> integral\<^isup>S M f" |
766 shows "0 \<le> integral\<^isup>S M f" |
863 proof - |
767 proof - |
864 have "integral\<^isup>S M (\<lambda>x. 0) \<le> integral\<^isup>S M f" |
768 have "integral\<^isup>S M (\<lambda>x. 0) \<le> integral\<^isup>S M f" |
865 using simple_integral_mono_AE[OF _ f ae] by auto |
769 using simple_integral_mono_AE[OF _ f ae] by auto |
866 then show ?thesis by simp |
770 then show ?thesis by simp |
867 qed |
771 qed |
868 |
772 |
869 section "Continuous positive integration" |
773 section "Continuous positive integration" |
870 |
774 |
871 definition positive_integral_def: |
775 definition positive_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> ereal" ("integral\<^isup>P") where |
872 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f}. integral\<^isup>S M g)" |
776 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f}. integral\<^isup>S M g)" |
873 |
777 |
874 syntax |
778 syntax |
875 "_positive_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> ereal" ("\<integral>\<^isup>+ _. _ \<partial>_" [60,61] 110) |
779 "_positive_integral" :: "pttrn \<Rightarrow> ereal \<Rightarrow> 'a measure \<Rightarrow> ereal" ("\<integral>\<^isup>+ _. _ \<partial>_" [60,61] 110) |
876 |
780 |
877 translations |
781 translations |
878 "\<integral>\<^isup>+ x. f \<partial>M" == "CONST integral\<^isup>P M (%x. f)" |
782 "\<integral>\<^isup>+ x. f \<partial>M" == "CONST positive_integral M (%x. f)" |
879 |
783 |
880 lemma (in measure_space) positive_integral_cong_measure: |
784 lemma positive_integral_positive: |
881 assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M" |
|
882 shows "integral\<^isup>P N f = integral\<^isup>P M f" |
|
883 unfolding positive_integral_def |
|
884 unfolding simple_function_cong_algebra[OF assms(2,3), symmetric] |
|
885 using AE_cong_measure[OF assms] |
|
886 using simple_integral_cong_measure[OF assms] |
|
887 by (auto intro!: SUP_cong) |
|
888 |
|
889 lemma (in measure_space) positive_integral_positive: |
|
890 "0 \<le> integral\<^isup>P M f" |
785 "0 \<le> integral\<^isup>P M f" |
891 by (auto intro!: SUP_upper2[of "\<lambda>x. 0"] simp: positive_integral_def le_fun_def) |
786 by (auto intro!: SUP_upper2[of "\<lambda>x. 0"] simp: positive_integral_def le_fun_def) |
892 |
787 |
893 lemma (in measure_space) positive_integral_def_finite: |
788 lemma positive_integral_not_MInfty[simp]: "integral\<^isup>P M f \<noteq> -\<infinity>" |
|
789 using positive_integral_positive[of M f] by auto |
|
790 |
|
791 lemma positive_integral_def_finite: |
894 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f \<and> range g \<subseteq> {0 ..< \<infinity>}}. integral\<^isup>S M g)" |
792 "integral\<^isup>P M f = (SUP g : {g. simple_function M g \<and> g \<le> max 0 \<circ> f \<and> range g \<subseteq> {0 ..< \<infinity>}}. integral\<^isup>S M g)" |
895 (is "_ = SUPR ?A ?f") |
793 (is "_ = SUPR ?A ?f") |
896 unfolding positive_integral_def |
794 unfolding positive_integral_def |
897 proof (safe intro!: antisym SUP_least) |
795 proof (safe intro!: antisym SUP_least) |
898 fix g assume g: "simple_function M g" "g \<le> max 0 \<circ> f" |
796 fix g assume g: "simple_function M g" "g \<le> max 0 \<circ> f" |
899 let ?G = "{x \<in> space M. \<not> g x \<noteq> \<infinity>}" |
797 let ?G = "{x \<in> space M. \<not> g x \<noteq> \<infinity>}" |
900 note gM = g(1)[THEN borel_measurable_simple_function] |
798 note gM = g(1)[THEN borel_measurable_simple_function] |
901 have \<mu>G_pos: "0 \<le> \<mu> ?G" using gM by auto |
799 have \<mu>G_pos: "0 \<le> (emeasure M) ?G" using gM by auto |
902 let ?g = "\<lambda>y x. if g x = \<infinity> then y else max 0 (g x)" |
800 let ?g = "\<lambda>y x. if g x = \<infinity> then y else max 0 (g x)" |
903 from g gM have g_in_A: "\<And>y. 0 \<le> y \<Longrightarrow> y \<noteq> \<infinity> \<Longrightarrow> ?g y \<in> ?A" |
801 from g gM have g_in_A: "\<And>y. 0 \<le> y \<Longrightarrow> y \<noteq> \<infinity> \<Longrightarrow> ?g y \<in> ?A" |
904 apply (safe intro!: simple_function_max simple_function_If) |
802 apply (safe intro!: simple_function_max simple_function_If) |
905 apply (force simp: max_def le_fun_def split: split_if_asm)+ |
803 apply (force simp: max_def le_fun_def split: split_if_asm)+ |
906 done |
804 done |
907 show "integral\<^isup>S M g \<le> SUPR ?A ?f" |
805 show "integral\<^isup>S M g \<le> SUPR ?A ?f" |
908 proof cases |
806 proof cases |
909 have g0: "?g 0 \<in> ?A" by (intro g_in_A) auto |
807 have g0: "?g 0 \<in> ?A" by (intro g_in_A) auto |
910 assume "\<mu> ?G = 0" |
808 assume "(emeasure M) ?G = 0" |
911 with gM have "AE x. x \<notin> ?G" by (simp add: AE_iff_null_set) |
809 with gM have "AE x in M. x \<notin> ?G" |
|
810 by (auto simp add: AE_iff_null intro!: null_setsI) |
912 with gM g show ?thesis |
811 with gM g show ?thesis |
913 by (intro SUP_upper2[OF g0] simple_integral_mono_AE) |
812 by (intro SUP_upper2[OF g0] simple_integral_mono_AE) |
914 (auto simp: max_def intro!: simple_function_If) |
813 (auto simp: max_def intro!: simple_function_If) |
915 next |
814 next |
916 assume \<mu>G: "\<mu> ?G \<noteq> 0" |
815 assume \<mu>G: "(emeasure M) ?G \<noteq> 0" |
917 have "SUPR ?A (integral\<^isup>S M) = \<infinity>" |
816 have "SUPR ?A (integral\<^isup>S M) = \<infinity>" |
918 proof (intro SUP_PInfty) |
817 proof (intro SUP_PInfty) |
919 fix n :: nat |
818 fix n :: nat |
920 let ?y = "ereal (real n) / (if \<mu> ?G = \<infinity> then 1 else \<mu> ?G)" |
819 let ?y = "ereal (real n) / (if (emeasure M) ?G = \<infinity> then 1 else (emeasure M) ?G)" |
921 have "0 \<le> ?y" "?y \<noteq> \<infinity>" using \<mu>G \<mu>G_pos by (auto simp: ereal_divide_eq) |
820 have "0 \<le> ?y" "?y \<noteq> \<infinity>" using \<mu>G \<mu>G_pos by (auto simp: ereal_divide_eq) |
922 then have "?g ?y \<in> ?A" by (rule g_in_A) |
821 then have "?g ?y \<in> ?A" by (rule g_in_A) |
923 have "real n \<le> ?y * \<mu> ?G" |
822 have "real n \<le> ?y * (emeasure M) ?G" |
924 using \<mu>G \<mu>G_pos by (cases "\<mu> ?G") (auto simp: field_simps) |
823 using \<mu>G \<mu>G_pos by (cases "(emeasure M) ?G") (auto simp: field_simps) |
925 also have "\<dots> = (\<integral>\<^isup>Sx. ?y * indicator ?G x \<partial>M)" |
824 also have "\<dots> = (\<integral>\<^isup>Sx. ?y * indicator ?G x \<partial>M)" |
926 using `0 \<le> ?y` `?g ?y \<in> ?A` gM |
825 using `0 \<le> ?y` `?g ?y \<in> ?A` gM |
927 by (subst simple_integral_cmult_indicator) auto |
826 by (subst simple_integral_cmult_indicator) auto |
928 also have "\<dots> \<le> integral\<^isup>S M (?g ?y)" using `?g ?y \<in> ?A` gM |
827 also have "\<dots> \<le> integral\<^isup>S M (?g ?y)" using `?g ?y \<in> ?A` gM |
929 by (intro simple_integral_mono) auto |
828 by (intro simple_integral_mono) auto |
1266 apply (subst SUPR_ereal_cmult[symmetric, OF pos(1) `0 \<le> a`]) |
1144 apply (subst SUPR_ereal_cmult[symmetric, OF pos(1) `0 \<le> a`]) |
1267 apply (subst SUPR_ereal_add[symmetric, OF inc not_MInf]) . |
1145 apply (subst SUPR_ereal_add[symmetric, OF inc not_MInf]) . |
1268 then show ?thesis by (simp add: positive_integral_max_0) |
1146 then show ?thesis by (simp add: positive_integral_max_0) |
1269 qed |
1147 qed |
1270 |
1148 |
1271 lemma (in measure_space) positive_integral_cmult: |
1149 lemma positive_integral_cmult: |
1272 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c" |
1150 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "0 \<le> c" |
1273 shows "(\<integral>\<^isup>+ x. c * f x \<partial>M) = c * integral\<^isup>P M f" |
1151 shows "(\<integral>\<^isup>+ x. c * f x \<partial>M) = c * integral\<^isup>P M f" |
1274 proof - |
1152 proof - |
1275 have [simp]: "\<And>x. c * max 0 (f x) = max 0 (c * f x)" using `0 \<le> c` |
1153 have [simp]: "\<And>x. c * max 0 (f x) = max 0 (c * f x)" using `0 \<le> c` |
1276 by (auto split: split_max simp: ereal_zero_le_0_iff) |
1154 by (auto split: split_max simp: ereal_zero_le_0_iff) |
1277 have "(\<integral>\<^isup>+ x. c * f x \<partial>M) = (\<integral>\<^isup>+ x. c * max 0 (f x) \<partial>M)" |
1155 have "(\<integral>\<^isup>+ x. c * f x \<partial>M) = (\<integral>\<^isup>+ x. c * max 0 (f x) \<partial>M)" |
1278 by (simp add: positive_integral_max_0) |
1156 by (simp add: positive_integral_max_0) |
1279 then show ?thesis |
1157 then show ?thesis |
1280 using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" "\<lambda>x. 0"] f |
1158 using positive_integral_linear[OF _ _ `0 \<le> c`, of "\<lambda>x. max 0 (f x)" _ "\<lambda>x. 0"] f |
1281 by (auto simp: positive_integral_max_0) |
1159 by (auto simp: positive_integral_max_0) |
1282 qed |
1160 qed |
1283 |
1161 |
1284 lemma (in measure_space) positive_integral_multc: |
1162 lemma positive_integral_multc: |
1285 assumes "f \<in> borel_measurable M" "AE x. 0 \<le> f x" "0 \<le> c" |
1163 assumes "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" "0 \<le> c" |
1286 shows "(\<integral>\<^isup>+ x. f x * c \<partial>M) = integral\<^isup>P M f * c" |
1164 shows "(\<integral>\<^isup>+ x. f x * c \<partial>M) = integral\<^isup>P M f * c" |
1287 unfolding mult_commute[of _ c] positive_integral_cmult[OF assms] by simp |
1165 unfolding mult_commute[of _ c] positive_integral_cmult[OF assms] by simp |
1288 |
1166 |
1289 lemma (in measure_space) positive_integral_indicator[simp]: |
1167 lemma positive_integral_indicator[simp]: |
1290 "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. indicator A x\<partial>M) = \<mu> A" |
1168 "A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. indicator A x\<partial>M) = (emeasure M) A" |
1291 by (subst positive_integral_eq_simple_integral) |
1169 by (subst positive_integral_eq_simple_integral) |
1292 (auto simp: simple_function_indicator simple_integral_indicator) |
1170 (auto simp: simple_function_indicator simple_integral_indicator) |
1293 |
1171 |
1294 lemma (in measure_space) positive_integral_cmult_indicator: |
1172 lemma positive_integral_cmult_indicator: |
1295 "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * \<mu> A" |
1173 "0 \<le> c \<Longrightarrow> A \<in> sets M \<Longrightarrow> (\<integral>\<^isup>+ x. c * indicator A x \<partial>M) = c * (emeasure M) A" |
1296 by (subst positive_integral_eq_simple_integral) |
1174 by (subst positive_integral_eq_simple_integral) |
1297 (auto simp: simple_function_indicator simple_integral_indicator) |
1175 (auto simp: simple_function_indicator simple_integral_indicator) |
1298 |
1176 |
1299 lemma (in measure_space) positive_integral_add: |
1177 lemma positive_integral_add: |
1300 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" |
1178 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
1301 and g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x" |
1179 and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
1302 shows "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = integral\<^isup>P M f + integral\<^isup>P M g" |
1180 shows "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = integral\<^isup>P M f + integral\<^isup>P M g" |
1303 proof - |
1181 proof - |
1304 have ae: "AE x. max 0 (f x) + max 0 (g x) = max 0 (f x + g x)" |
1182 have ae: "AE x in M. max 0 (f x) + max 0 (g x) = max 0 (f x + g x)" |
1305 using assms by (auto split: split_max simp: ereal_add_nonneg_nonneg) |
1183 using assms by (auto split: split_max simp: ereal_add_nonneg_nonneg) |
1306 have "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = (\<integral>\<^isup>+ x. max 0 (f x + g x) \<partial>M)" |
1184 have "(\<integral>\<^isup>+ x. f x + g x \<partial>M) = (\<integral>\<^isup>+ x. max 0 (f x + g x) \<partial>M)" |
1307 by (simp add: positive_integral_max_0) |
1185 by (simp add: positive_integral_max_0) |
1308 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) + max 0 (g x) \<partial>M)" |
1186 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) + max 0 (g x) \<partial>M)" |
1309 unfolding ae[THEN positive_integral_cong_AE] .. |
1187 unfolding ae[THEN positive_integral_cong_AE] .. |
1310 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) \<partial>M) + (\<integral>\<^isup>+ x. max 0 (g x) \<partial>M)" |
1188 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) \<partial>M) + (\<integral>\<^isup>+ x. max 0 (g x) \<partial>M)" |
1311 using positive_integral_linear[of "\<lambda>x. max 0 (f x)" 1 "\<lambda>x. max 0 (g x)"] f g |
1189 using positive_integral_linear[of "\<lambda>x. max 0 (f x)" _ 1 "\<lambda>x. max 0 (g x)"] f g |
1312 by auto |
1190 by auto |
1313 finally show ?thesis |
1191 finally show ?thesis |
1314 by (simp add: positive_integral_max_0) |
1192 by (simp add: positive_integral_max_0) |
1315 qed |
1193 qed |
1316 |
1194 |
1317 lemma (in measure_space) positive_integral_setsum: |
1195 lemma positive_integral_setsum: |
1318 assumes "\<And>i. i\<in>P \<Longrightarrow> f i \<in> borel_measurable M" "\<And>i. i\<in>P \<Longrightarrow> AE x. 0 \<le> f i x" |
1196 assumes "\<And>i. i\<in>P \<Longrightarrow> f i \<in> borel_measurable M" "\<And>i. i\<in>P \<Longrightarrow> AE x in M. 0 \<le> f i x" |
1319 shows "(\<integral>\<^isup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^isup>P M (f i))" |
1197 shows "(\<integral>\<^isup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^isup>P M (f i))" |
1320 proof cases |
1198 proof cases |
1321 assume f: "finite P" |
1199 assume f: "finite P" |
1322 from assms have "AE x. \<forall>i\<in>P. 0 \<le> f i x" unfolding AE_finite_all[OF f] by auto |
1200 from assms have "AE x in M. \<forall>i\<in>P. 0 \<le> f i x" unfolding AE_finite_all[OF f] by auto |
1323 from f this assms(1) show ?thesis |
1201 from f this assms(1) show ?thesis |
1324 proof induct |
1202 proof induct |
1325 case (insert i P) |
1203 case (insert i P) |
1326 then have "f i \<in> borel_measurable M" "AE x. 0 \<le> f i x" |
1204 then have "f i \<in> borel_measurable M" "AE x in M. 0 \<le> f i x" |
1327 "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x. 0 \<le> (\<Sum>i\<in>P. f i x)" |
1205 "(\<lambda>x. \<Sum>i\<in>P. f i x) \<in> borel_measurable M" "AE x in M. 0 \<le> (\<Sum>i\<in>P. f i x)" |
1328 by (auto intro!: borel_measurable_ereal_setsum setsum_nonneg) |
1206 by (auto intro!: borel_measurable_ereal_setsum setsum_nonneg) |
1329 from positive_integral_add[OF this] |
1207 from positive_integral_add[OF this] |
1330 show ?case using insert by auto |
1208 show ?case using insert by auto |
1331 qed simp |
1209 qed simp |
1332 qed simp |
1210 qed simp |
1333 |
1211 |
1334 lemma (in measure_space) positive_integral_Markov_inequality: |
1212 lemma positive_integral_Markov_inequality: |
1335 assumes u: "u \<in> borel_measurable M" "AE x. 0 \<le> u x" and "A \<in> sets M" and c: "0 \<le> c" "c \<noteq> \<infinity>" |
1213 assumes u: "u \<in> borel_measurable M" "AE x in M. 0 \<le> u x" and "A \<in> sets M" and c: "0 \<le> c" "c \<noteq> \<infinity>" |
1336 shows "\<mu> ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)" |
1214 shows "(emeasure M) ({x\<in>space M. 1 \<le> c * u x} \<inter> A) \<le> c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)" |
1337 (is "\<mu> ?A \<le> _ * ?PI") |
1215 (is "(emeasure M) ?A \<le> _ * ?PI") |
1338 proof - |
1216 proof - |
1339 have "?A \<in> sets M" |
1217 have "?A \<in> sets M" |
1340 using `A \<in> sets M` u by auto |
1218 using `A \<in> sets M` u by auto |
1341 hence "\<mu> ?A = (\<integral>\<^isup>+ x. indicator ?A x \<partial>M)" |
1219 hence "(emeasure M) ?A = (\<integral>\<^isup>+ x. indicator ?A x \<partial>M)" |
1342 using positive_integral_indicator by simp |
1220 using positive_integral_indicator by simp |
1343 also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x) \<partial>M)" using u c |
1221 also have "\<dots> \<le> (\<integral>\<^isup>+ x. c * (u x * indicator A x) \<partial>M)" using u c |
1344 by (auto intro!: positive_integral_mono_AE |
1222 by (auto intro!: positive_integral_mono_AE |
1345 simp: indicator_def ereal_zero_le_0_iff) |
1223 simp: indicator_def ereal_zero_le_0_iff) |
1346 also have "\<dots> = c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)" |
1224 also have "\<dots> = c * (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)" |
1347 using assms |
1225 using assms |
1348 by (auto intro!: positive_integral_cmult borel_measurable_indicator simp: ereal_zero_le_0_iff) |
1226 by (auto intro!: positive_integral_cmult borel_measurable_indicator simp: ereal_zero_le_0_iff) |
1349 finally show ?thesis . |
1227 finally show ?thesis . |
1350 qed |
1228 qed |
1351 |
1229 |
1352 lemma (in measure_space) positive_integral_noteq_infinite: |
1230 lemma positive_integral_noteq_infinite: |
1353 assumes g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x" |
1231 assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
1354 and "integral\<^isup>P M g \<noteq> \<infinity>" |
1232 and "integral\<^isup>P M g \<noteq> \<infinity>" |
1355 shows "AE x. g x \<noteq> \<infinity>" |
1233 shows "AE x in M. g x \<noteq> \<infinity>" |
1356 proof (rule ccontr) |
1234 proof (rule ccontr) |
1357 assume c: "\<not> (AE x. g x \<noteq> \<infinity>)" |
1235 assume c: "\<not> (AE x in M. g x \<noteq> \<infinity>)" |
1358 have "\<mu> {x\<in>space M. g x = \<infinity>} \<noteq> 0" |
1236 have "(emeasure M) {x\<in>space M. g x = \<infinity>} \<noteq> 0" |
1359 using c g by (simp add: AE_iff_null_set) |
1237 using c g by (auto simp add: AE_iff_null) |
1360 moreover have "0 \<le> \<mu> {x\<in>space M. g x = \<infinity>}" using g by (auto intro: measurable_sets) |
1238 moreover have "0 \<le> (emeasure M) {x\<in>space M. g x = \<infinity>}" using g by (auto intro: measurable_sets) |
1361 ultimately have "0 < \<mu> {x\<in>space M. g x = \<infinity>}" by auto |
1239 ultimately have "0 < (emeasure M) {x\<in>space M. g x = \<infinity>}" by auto |
1362 then have "\<infinity> = \<infinity> * \<mu> {x\<in>space M. g x = \<infinity>}" by auto |
1240 then have "\<infinity> = \<infinity> * (emeasure M) {x\<in>space M. g x = \<infinity>}" by auto |
1363 also have "\<dots> \<le> (\<integral>\<^isup>+x. \<infinity> * indicator {x\<in>space M. g x = \<infinity>} x \<partial>M)" |
1241 also have "\<dots> \<le> (\<integral>\<^isup>+x. \<infinity> * indicator {x\<in>space M. g x = \<infinity>} x \<partial>M)" |
1364 using g by (subst positive_integral_cmult_indicator) auto |
1242 using g by (subst positive_integral_cmult_indicator) auto |
1365 also have "\<dots> \<le> integral\<^isup>P M g" |
1243 also have "\<dots> \<le> integral\<^isup>P M g" |
1366 using assms by (auto intro!: positive_integral_mono_AE simp: indicator_def) |
1244 using assms by (auto intro!: positive_integral_mono_AE simp: indicator_def) |
1367 finally show False using `integral\<^isup>P M g \<noteq> \<infinity>` by auto |
1245 finally show False using `integral\<^isup>P M g \<noteq> \<infinity>` by auto |
1368 qed |
1246 qed |
1369 |
1247 |
1370 lemma (in measure_space) positive_integral_diff: |
1248 lemma positive_integral_diff: |
1371 assumes f: "f \<in> borel_measurable M" |
1249 assumes f: "f \<in> borel_measurable M" |
1372 and g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x" |
1250 and g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
1373 and fin: "integral\<^isup>P M g \<noteq> \<infinity>" |
1251 and fin: "integral\<^isup>P M g \<noteq> \<infinity>" |
1374 and mono: "AE x. g x \<le> f x" |
1252 and mono: "AE x in M. g x \<le> f x" |
1375 shows "(\<integral>\<^isup>+ x. f x - g x \<partial>M) = integral\<^isup>P M f - integral\<^isup>P M g" |
1253 shows "(\<integral>\<^isup>+ x. f x - g x \<partial>M) = integral\<^isup>P M f - integral\<^isup>P M g" |
1376 proof - |
1254 proof - |
1377 have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x. 0 \<le> f x - g x" |
1255 have diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M" "AE x in M. 0 \<le> f x - g x" |
1378 using assms by (auto intro: ereal_diff_positive) |
1256 using assms by (auto intro: ereal_diff_positive) |
1379 have pos_f: "AE x. 0 \<le> f x" using mono g by auto |
1257 have pos_f: "AE x in M. 0 \<le> f x" using mono g by auto |
1380 { fix a b :: ereal assume "0 \<le> a" "a \<noteq> \<infinity>" "0 \<le> b" "a \<le> b" then have "b - a + a = b" |
1258 { fix a b :: ereal assume "0 \<le> a" "a \<noteq> \<infinity>" "0 \<le> b" "a \<le> b" then have "b - a + a = b" |
1381 by (cases rule: ereal2_cases[of a b]) auto } |
1259 by (cases rule: ereal2_cases[of a b]) auto } |
1382 note * = this |
1260 note * = this |
1383 then have "AE x. f x = f x - g x + g x" |
1261 then have "AE x in M. f x = f x - g x + g x" |
1384 using mono positive_integral_noteq_infinite[OF g fin] assms by auto |
1262 using mono positive_integral_noteq_infinite[OF g fin] assms by auto |
1385 then have **: "integral\<^isup>P M f = (\<integral>\<^isup>+x. f x - g x \<partial>M) + integral\<^isup>P M g" |
1263 then have **: "integral\<^isup>P M f = (\<integral>\<^isup>+x. f x - g x \<partial>M) + integral\<^isup>P M g" |
1386 unfolding positive_integral_add[OF diff g, symmetric] |
1264 unfolding positive_integral_add[OF diff g, symmetric] |
1387 by (rule positive_integral_cong_AE) |
1265 by (rule positive_integral_cong_AE) |
1388 show ?thesis unfolding ** |
1266 show ?thesis unfolding ** |
1389 using fin positive_integral_positive[of g] |
1267 using fin positive_integral_positive[of M g] |
1390 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. f x - g x \<partial>M" "integral\<^isup>P M g"]) auto |
1268 by (cases rule: ereal2_cases[of "\<integral>\<^isup>+ x. f x - g x \<partial>M" "integral\<^isup>P M g"]) auto |
1391 qed |
1269 qed |
1392 |
1270 |
1393 lemma (in measure_space) positive_integral_suminf: |
1271 lemma positive_integral_suminf: |
1394 assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x. 0 \<le> f i x" |
1272 assumes f: "\<And>i. f i \<in> borel_measurable M" "\<And>i. AE x in M. 0 \<le> f i x" |
1395 shows "(\<integral>\<^isup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^isup>P M (f i))" |
1273 shows "(\<integral>\<^isup>+ x. (\<Sum>i. f i x) \<partial>M) = (\<Sum>i. integral\<^isup>P M (f i))" |
1396 proof - |
1274 proof - |
1397 have all_pos: "AE x. \<forall>i. 0 \<le> f i x" |
1275 have all_pos: "AE x in M. \<forall>i. 0 \<le> f i x" |
1398 using assms by (auto simp: AE_all_countable) |
1276 using assms by (auto simp: AE_all_countable) |
1399 have "(\<Sum>i. integral\<^isup>P M (f i)) = (SUP n. \<Sum>i<n. integral\<^isup>P M (f i))" |
1277 have "(\<Sum>i. integral\<^isup>P M (f i)) = (SUP n. \<Sum>i<n. integral\<^isup>P M (f i))" |
1400 using positive_integral_positive by (rule suminf_ereal_eq_SUPR) |
1278 using positive_integral_positive by (rule suminf_ereal_eq_SUPR) |
1401 also have "\<dots> = (SUP n. \<integral>\<^isup>+x. (\<Sum>i<n. f i x) \<partial>M)" |
1279 also have "\<dots> = (SUP n. \<integral>\<^isup>+x. (\<Sum>i<n. f i x) \<partial>M)" |
1402 unfolding positive_integral_setsum[OF f] .. |
1280 unfolding positive_integral_setsum[OF f] .. |
1424 unfolding liminf_SUPR_INFI |
1302 unfolding liminf_SUPR_INFI |
1425 by (auto intro!: SUP_mono exI INF_greatest positive_integral_mono INF_lower) |
1303 by (auto intro!: SUP_mono exI INF_greatest positive_integral_mono INF_lower) |
1426 finally show ?thesis . |
1304 finally show ?thesis . |
1427 qed |
1305 qed |
1428 |
1306 |
1429 lemma (in measure_space) measure_space_density: |
1307 lemma positive_integral_null_set: |
1430 assumes u: "u \<in> borel_measurable M" "AE x. 0 \<le> u x" |
1308 assumes "N \<in> null_sets M" shows "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = 0" |
1431 and M'[simp]: "M' = (M\<lparr>measure := \<lambda>A. (\<integral>\<^isup>+ x. u x * indicator A x \<partial>M)\<rparr>)" |
|
1432 shows "measure_space M'" |
|
1433 proof - |
|
1434 interpret M': sigma_algebra M' by (intro sigma_algebra_cong) auto |
|
1435 show ?thesis |
|
1436 proof |
|
1437 have pos: "\<And>A. AE x. 0 \<le> u x * indicator A x" |
|
1438 using u by (auto simp: ereal_zero_le_0_iff) |
|
1439 then show "positive M' (measure M')" unfolding M' |
|
1440 using u(1) by (auto simp: positive_def intro!: positive_integral_positive) |
|
1441 show "countably_additive M' (measure M')" |
|
1442 proof (intro countably_additiveI) |
|
1443 fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M'" |
|
1444 then have *: "\<And>i. (\<lambda>x. u x * indicator (A i) x) \<in> borel_measurable M" |
|
1445 using u by (auto intro: borel_measurable_indicator) |
|
1446 assume disj: "disjoint_family A" |
|
1447 have "(\<Sum>n. measure M' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. u x * indicator (A n) x) \<partial>M)" |
|
1448 unfolding M' using u(1) * |
|
1449 by (simp add: positive_integral_suminf[OF _ pos, symmetric]) |
|
1450 also have "\<dots> = (\<integral>\<^isup>+ x. u x * (\<Sum>n. indicator (A n) x) \<partial>M)" using u |
|
1451 by (intro positive_integral_cong_AE) |
|
1452 (elim AE_mp, auto intro!: AE_I2 suminf_cmult_ereal) |
|
1453 also have "\<dots> = (\<integral>\<^isup>+ x. u x * indicator (\<Union>n. A n) x \<partial>M)" |
|
1454 unfolding suminf_indicator[OF disj] .. |
|
1455 finally show "(\<Sum>n. measure M' (A n)) = measure M' (\<Union>x. A x)" |
|
1456 unfolding M' by simp |
|
1457 qed |
|
1458 qed |
|
1459 qed |
|
1460 |
|
1461 lemma (in measure_space) positive_integral_null_set: |
|
1462 assumes "N \<in> null_sets" shows "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = 0" |
|
1463 proof - |
1309 proof - |
1464 have "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^isup>+ x. 0 \<partial>M)" |
1310 have "(\<integral>\<^isup>+ x. u x * indicator N x \<partial>M) = (\<integral>\<^isup>+ x. 0 \<partial>M)" |
1465 proof (intro positive_integral_cong_AE AE_I) |
1311 proof (intro positive_integral_cong_AE AE_I) |
1466 show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N" |
1312 show "{x \<in> space M. u x * indicator N x \<noteq> 0} \<subseteq> N" |
1467 by (auto simp: indicator_def) |
1313 by (auto simp: indicator_def) |
1468 show "\<mu> N = 0" "N \<in> sets M" |
1314 show "(emeasure M) N = 0" "N \<in> sets M" |
1469 using assms by auto |
1315 using assms by auto |
1470 qed |
1316 qed |
1471 then show ?thesis by simp |
1317 then show ?thesis by simp |
1472 qed |
1318 qed |
1473 |
1319 |
1474 lemma (in measure_space) positive_integral_translated_density: |
1320 lemma positive_integral_0_iff: |
1475 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" |
1321 assumes u: "u \<in> borel_measurable M" and pos: "AE x in M. 0 \<le> u x" |
1476 assumes g: "g \<in> borel_measurable M" "AE x. 0 \<le> g x" |
1322 shows "integral\<^isup>P M u = 0 \<longleftrightarrow> emeasure M {x\<in>space M. u x \<noteq> 0} = 0" |
1477 and M': "M' = (M\<lparr> measure := \<lambda>A. (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)\<rparr>)" |
1323 (is "_ \<longleftrightarrow> (emeasure M) ?A = 0") |
1478 shows "integral\<^isup>P M' g = (\<integral>\<^isup>+ x. f x * g x \<partial>M)" |
|
1479 proof - |
|
1480 from measure_space_density[OF f M'] |
|
1481 interpret T: measure_space M' . |
|
1482 have borel[simp]: |
|
1483 "borel_measurable M' = borel_measurable M" |
|
1484 "simple_function M' = simple_function M" |
|
1485 unfolding measurable_def simple_function_def [abs_def] by (auto simp: M') |
|
1486 from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess G . note G = this |
|
1487 note G' = borel_measurable_simple_function[OF this(1)] simple_functionD[OF G(1)] |
|
1488 note G'(2)[simp] |
|
1489 { fix P have "AE x. P x \<Longrightarrow> AE x in M'. P x" |
|
1490 using positive_integral_null_set[of _ f] |
|
1491 unfolding T.almost_everywhere_def almost_everywhere_def |
|
1492 by (auto simp: M') } |
|
1493 note ac = this |
|
1494 from G(4) g(2) have G_M': "AE x in M'. (SUP i. G i x) = g x" |
|
1495 by (auto intro!: ac split: split_max) |
|
1496 { fix i |
|
1497 let ?I = "\<lambda>y x. indicator (G i -` {y} \<inter> space M) x" |
|
1498 { fix x assume *: "x \<in> space M" "0 \<le> f x" "0 \<le> g x" |
|
1499 then have [simp]: "G i ` space M \<inter> {y. G i x = y \<and> x \<in> space M} = {G i x}" by auto |
|
1500 from * G' G have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * (\<Sum>y\<in>G i`space M. (y * ?I y x))" |
|
1501 by (subst setsum_ereal_right_distrib) (auto simp: ac_simps) |
|
1502 also have "\<dots> = f x * G i x" |
|
1503 by (simp add: indicator_def if_distrib setsum_cases) |
|
1504 finally have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * G i x" . } |
|
1505 note to_singleton = this |
|
1506 have "integral\<^isup>P M' (G i) = integral\<^isup>S M' (G i)" |
|
1507 using G T.positive_integral_eq_simple_integral by simp |
|
1508 also have "\<dots> = (\<Sum>y\<in>G i`space M. y * (\<integral>\<^isup>+x. f x * ?I y x \<partial>M))" |
|
1509 unfolding simple_integral_def M' by simp |
|
1510 also have "\<dots> = (\<Sum>y\<in>G i`space M. (\<integral>\<^isup>+x. y * (f x * ?I y x) \<partial>M))" |
|
1511 using f G' G by (auto intro!: setsum_cong positive_integral_cmult[symmetric]) |
|
1512 also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) \<partial>M)" |
|
1513 using f G' G by (auto intro!: positive_integral_setsum[symmetric]) |
|
1514 finally have "integral\<^isup>P M' (G i) = (\<integral>\<^isup>+x. f x * G i x \<partial>M)" |
|
1515 using f g G' to_singleton by (auto intro!: positive_integral_cong_AE) } |
|
1516 note [simp] = this |
|
1517 have "integral\<^isup>P M' g = (SUP i. integral\<^isup>P M' (G i))" using G'(1) G_M'(1) G |
|
1518 using T.positive_integral_monotone_convergence_SUP[symmetric, OF `incseq G`] |
|
1519 by (simp cong: T.positive_integral_cong_AE) |
|
1520 also have "\<dots> = (SUP i. (\<integral>\<^isup>+x. f x * G i x \<partial>M))" by simp |
|
1521 also have "\<dots> = (\<integral>\<^isup>+x. (SUP i. f x * G i x) \<partial>M)" |
|
1522 using f G' G(2)[THEN incseq_SucD] G |
|
1523 by (intro positive_integral_monotone_convergence_SUP_AE[symmetric]) |
|
1524 (auto simp: ereal_mult_left_mono le_fun_def ereal_zero_le_0_iff) |
|
1525 also have "\<dots> = (\<integral>\<^isup>+x. f x * g x \<partial>M)" using f G' G g |
|
1526 by (intro positive_integral_cong_AE) |
|
1527 (auto simp add: SUPR_ereal_cmult split: split_max) |
|
1528 finally show "integral\<^isup>P M' g = (\<integral>\<^isup>+x. f x * g x \<partial>M)" . |
|
1529 qed |
|
1530 |
|
1531 lemma (in measure_space) positive_integral_0_iff: |
|
1532 assumes u: "u \<in> borel_measurable M" and pos: "AE x. 0 \<le> u x" |
|
1533 shows "integral\<^isup>P M u = 0 \<longleftrightarrow> \<mu> {x\<in>space M. u x \<noteq> 0} = 0" |
|
1534 (is "_ \<longleftrightarrow> \<mu> ?A = 0") |
|
1535 proof - |
1324 proof - |
1536 have u_eq: "(\<integral>\<^isup>+ x. u x * indicator ?A x \<partial>M) = integral\<^isup>P M u" |
1325 have u_eq: "(\<integral>\<^isup>+ x. u x * indicator ?A x \<partial>M) = integral\<^isup>P M u" |
1537 by (auto intro!: positive_integral_cong simp: indicator_def) |
1326 by (auto intro!: positive_integral_cong simp: indicator_def) |
1538 show ?thesis |
1327 show ?thesis |
1539 proof |
1328 proof |
1540 assume "\<mu> ?A = 0" |
1329 assume "(emeasure M) ?A = 0" |
1541 with positive_integral_null_set[of ?A u] u |
1330 with positive_integral_null_set[of ?A M u] u |
1542 show "integral\<^isup>P M u = 0" by (simp add: u_eq) |
1331 show "integral\<^isup>P M u = 0" by (simp add: u_eq null_sets_def) |
1543 next |
1332 next |
1544 { fix r :: ereal and n :: nat assume gt_1: "1 \<le> real n * r" |
1333 { fix r :: ereal and n :: nat assume gt_1: "1 \<le> real n * r" |
1545 then have "0 < real n * r" by (cases r) (auto split: split_if_asm simp: one_ereal_def) |
1334 then have "0 < real n * r" by (cases r) (auto split: split_if_asm simp: one_ereal_def) |
1546 then have "0 \<le> r" by (auto simp add: ereal_zero_less_0_iff) } |
1335 then have "0 \<le> r" by (auto simp add: ereal_zero_less_0_iff) } |
1547 note gt_1 = this |
1336 note gt_1 = this |
1548 assume *: "integral\<^isup>P M u = 0" |
1337 assume *: "integral\<^isup>P M u = 0" |
1549 let ?M = "\<lambda>n. {x \<in> space M. 1 \<le> real (n::nat) * u x}" |
1338 let ?M = "\<lambda>n. {x \<in> space M. 1 \<le> real (n::nat) * u x}" |
1550 have "0 = (SUP n. \<mu> (?M n \<inter> ?A))" |
1339 have "0 = (SUP n. (emeasure M) (?M n \<inter> ?A))" |
1551 proof - |
1340 proof - |
1552 { fix n :: nat |
1341 { fix n :: nat |
1553 from positive_integral_Markov_inequality[OF u pos, of ?A "ereal (real n)"] |
1342 from positive_integral_Markov_inequality[OF u pos, of ?A "ereal (real n)"] |
1554 have "\<mu> (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp |
1343 have "(emeasure M) (?M n \<inter> ?A) \<le> 0" unfolding u_eq * using u by simp |
1555 moreover have "0 \<le> \<mu> (?M n \<inter> ?A)" using u by auto |
1344 moreover have "0 \<le> (emeasure M) (?M n \<inter> ?A)" using u by auto |
1556 ultimately have "\<mu> (?M n \<inter> ?A) = 0" by auto } |
1345 ultimately have "(emeasure M) (?M n \<inter> ?A) = 0" by auto } |
1557 thus ?thesis by simp |
1346 thus ?thesis by simp |
1558 qed |
1347 qed |
1559 also have "\<dots> = \<mu> (\<Union>n. ?M n \<inter> ?A)" |
1348 also have "\<dots> = (emeasure M) (\<Union>n. ?M n \<inter> ?A)" |
1560 proof (safe intro!: continuity_from_below) |
1349 proof (safe intro!: SUP_emeasure_incseq) |
1561 fix n show "?M n \<inter> ?A \<in> sets M" |
1350 fix n show "?M n \<inter> ?A \<in> sets M" |
1562 using u by (auto intro!: Int) |
1351 using u by (auto intro!: Int) |
1563 next |
1352 next |
1564 show "incseq (\<lambda>n. {x \<in> space M. 1 \<le> real n * u x} \<inter> {x \<in> space M. u x \<noteq> 0})" |
1353 show "incseq (\<lambda>n. {x \<in> space M. 1 \<le> real n * u x} \<inter> {x \<in> space M. u x \<noteq> 0})" |
1565 proof (safe intro!: incseq_SucI) |
1354 proof (safe intro!: incseq_SucI) |
1568 also from gt_1[OF this] have "real n * u x \<le> real (Suc n) * u x" |
1357 also from gt_1[OF this] have "real n * u x \<le> real (Suc n) * u x" |
1569 using `0 \<le> u x` by (auto intro!: ereal_mult_right_mono) |
1358 using `0 \<le> u x` by (auto intro!: ereal_mult_right_mono) |
1570 finally show "1 \<le> real (Suc n) * u x" by auto |
1359 finally show "1 \<le> real (Suc n) * u x" by auto |
1571 qed |
1360 qed |
1572 qed |
1361 qed |
1573 also have "\<dots> = \<mu> {x\<in>space M. 0 < u x}" |
1362 also have "\<dots> = (emeasure M) {x\<in>space M. 0 < u x}" |
1574 proof (safe intro!: arg_cong[where f="\<mu>"] dest!: gt_1) |
1363 proof (safe intro!: arg_cong[where f="(emeasure M)"] dest!: gt_1) |
1575 fix x assume "0 < u x" and [simp, intro]: "x \<in> space M" |
1364 fix x assume "0 < u x" and [simp, intro]: "x \<in> space M" |
1576 show "x \<in> (\<Union>n. ?M n \<inter> ?A)" |
1365 show "x \<in> (\<Union>n. ?M n \<inter> ?A)" |
1577 proof (cases "u x") |
1366 proof (cases "u x") |
1578 case (real r) with `0 < u x` have "0 < r" by auto |
1367 case (real r) with `0 < u x` have "0 < r" by auto |
1579 obtain j :: nat where "1 / r \<le> real j" using real_arch_simple .. |
1368 obtain j :: nat where "1 / r \<le> real j" using real_arch_simple .. |
1580 hence "1 / r * r \<le> real j * r" unfolding mult_le_cancel_right using `0 < r` by auto |
1369 hence "1 / r * r \<le> real j * r" unfolding mult_le_cancel_right using `0 < r` by auto |
1581 hence "1 \<le> real j * r" using real `0 < r` by auto |
1370 hence "1 \<le> real j * r" using real `0 < r` by auto |
1582 thus ?thesis using `0 < r` real by (auto simp: one_ereal_def) |
1371 thus ?thesis using `0 < r` real by (auto simp: one_ereal_def) |
1583 qed (insert `0 < u x`, auto) |
1372 qed (insert `0 < u x`, auto) |
1584 qed auto |
1373 qed auto |
1585 finally have "\<mu> {x\<in>space M. 0 < u x} = 0" by simp |
1374 finally have "(emeasure M) {x\<in>space M. 0 < u x} = 0" by simp |
1586 moreover |
1375 moreover |
1587 from pos have "AE x. \<not> (u x < 0)" by auto |
1376 from pos have "AE x in M. \<not> (u x < 0)" by auto |
1588 then have "\<mu> {x\<in>space M. u x < 0} = 0" |
1377 then have "(emeasure M) {x\<in>space M. u x < 0} = 0" |
1589 using AE_iff_null_set u by auto |
1378 using AE_iff_null[of M] u by auto |
1590 moreover have "\<mu> {x\<in>space M. u x \<noteq> 0} = \<mu> {x\<in>space M. u x < 0} + \<mu> {x\<in>space M. 0 < u x}" |
1379 moreover have "(emeasure M) {x\<in>space M. u x \<noteq> 0} = (emeasure M) {x\<in>space M. u x < 0} + (emeasure M) {x\<in>space M. 0 < u x}" |
1591 using u by (subst measure_additive) (auto intro!: arg_cong[where f=\<mu>]) |
1380 using u by (subst plus_emeasure) (auto intro!: arg_cong[where f="emeasure M"]) |
1592 ultimately show "\<mu> ?A = 0" by simp |
1381 ultimately show "(emeasure M) ?A = 0" by simp |
1593 qed |
1382 qed |
1594 qed |
1383 qed |
1595 |
1384 |
1596 lemma (in measure_space) positive_integral_0_iff_AE: |
1385 lemma positive_integral_0_iff_AE: |
1597 assumes u: "u \<in> borel_measurable M" |
1386 assumes u: "u \<in> borel_measurable M" |
1598 shows "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x. u x \<le> 0)" |
1387 shows "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x in M. u x \<le> 0)" |
1599 proof - |
1388 proof - |
1600 have sets: "{x\<in>space M. max 0 (u x) \<noteq> 0} \<in> sets M" |
1389 have sets: "{x\<in>space M. max 0 (u x) \<noteq> 0} \<in> sets M" |
1601 using u by auto |
1390 using u by auto |
1602 from positive_integral_0_iff[of "\<lambda>x. max 0 (u x)"] |
1391 from positive_integral_0_iff[of "\<lambda>x. max 0 (u x)"] |
1603 have "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x. max 0 (u x) = 0)" |
1392 have "integral\<^isup>P M u = 0 \<longleftrightarrow> (AE x in M. max 0 (u x) = 0)" |
1604 unfolding positive_integral_max_0 |
1393 unfolding positive_integral_max_0 |
1605 using AE_iff_null_set[OF sets] u by auto |
1394 using AE_iff_null[OF sets] u by auto |
1606 also have "\<dots> \<longleftrightarrow> (AE x. u x \<le> 0)" by (auto split: split_max) |
1395 also have "\<dots> \<longleftrightarrow> (AE x in M. u x \<le> 0)" by (auto split: split_max) |
1607 finally show ?thesis . |
1396 finally show ?thesis . |
1608 qed |
1397 qed |
1609 |
1398 |
1610 lemma (in measure_space) positive_integral_const_If: |
1399 lemma positive_integral_const_If: |
1611 "(\<integral>\<^isup>+x. a \<partial>M) = (if 0 \<le> a then a * \<mu> (space M) else 0)" |
1400 "(\<integral>\<^isup>+x. a \<partial>M) = (if 0 \<le> a then a * (emeasure M) (space M) else 0)" |
1612 by (auto intro!: positive_integral_0_iff_AE[THEN iffD2]) |
1401 by (auto intro!: positive_integral_0_iff_AE[THEN iffD2]) |
1613 |
1402 |
1614 lemma (in measure_space) positive_integral_restricted: |
1403 lemma positive_integral_subalgebra: |
1615 assumes A: "A \<in> sets M" |
|
1616 shows "integral\<^isup>P (restricted_space A) f = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)" |
|
1617 (is "integral\<^isup>P ?R f = integral\<^isup>P M ?f") |
|
1618 proof - |
|
1619 interpret R: measure_space ?R |
|
1620 by (rule restricted_measure_space) fact |
|
1621 let ?I = "\<lambda>g x. g x * indicator A x :: ereal" |
|
1622 show ?thesis |
|
1623 unfolding positive_integral_def |
|
1624 unfolding simple_function_restricted[OF A] |
|
1625 unfolding AE_restricted[OF A] |
|
1626 proof (safe intro!: SUPR_eq) |
|
1627 fix g assume g: "simple_function M (?I g)" and le: "g \<le> max 0 \<circ> f" |
|
1628 show "\<exists>j\<in>{g. simple_function M g \<and> g \<le> max 0 \<circ> ?I f}. |
|
1629 integral\<^isup>S (restricted_space A) g \<le> integral\<^isup>S M j" |
|
1630 proof (safe intro!: bexI[of _ "?I g"]) |
|
1631 show "integral\<^isup>S (restricted_space A) g \<le> integral\<^isup>S M (?I g)" |
|
1632 using g A by (simp add: simple_integral_restricted) |
|
1633 show "?I g \<le> max 0 \<circ> ?I f" |
|
1634 using le by (auto simp: le_fun_def max_def indicator_def split: split_if_asm) |
|
1635 qed fact |
|
1636 next |
|
1637 fix g assume g: "simple_function M g" and le: "g \<le> max 0 \<circ> ?I f" |
|
1638 show "\<exists>i\<in>{g. simple_function M (?I g) \<and> g \<le> max 0 \<circ> f}. |
|
1639 integral\<^isup>S M g \<le> integral\<^isup>S (restricted_space A) i" |
|
1640 proof (safe intro!: bexI[of _ "?I g"]) |
|
1641 show "?I g \<le> max 0 \<circ> f" |
|
1642 using le by (auto simp: le_fun_def max_def indicator_def split: split_if_asm) |
|
1643 from le have "\<And>x. g x \<le> ?I (?I g) x" |
|
1644 by (auto simp: le_fun_def max_def indicator_def split: split_if_asm) |
|
1645 then show "integral\<^isup>S M g \<le> integral\<^isup>S (restricted_space A) (?I g)" |
|
1646 using A g by (auto intro!: simple_integral_mono simp: simple_integral_restricted) |
|
1647 show "simple_function M (?I (?I g))" using g A by auto |
|
1648 qed |
|
1649 qed |
|
1650 qed |
|
1651 |
|
1652 lemma (in measure_space) positive_integral_subalgebra: |
|
1653 assumes f: "f \<in> borel_measurable N" "AE x in N. 0 \<le> f x" |
1404 assumes f: "f \<in> borel_measurable N" "AE x in N. 0 \<le> f x" |
1654 and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> measure N A = \<mu> A" |
1405 and N: "sets N \<subseteq> sets M" "space N = space M" "\<And>A. A \<in> sets N \<Longrightarrow> emeasure N A = emeasure M A" |
1655 and sa: "sigma_algebra N" |
|
1656 shows "integral\<^isup>P N f = integral\<^isup>P M f" |
1406 shows "integral\<^isup>P N f = integral\<^isup>P M f" |
1657 proof - |
1407 proof - |
1658 interpret N: measure_space N using measure_space_subalgebra[OF sa N] . |
1408 from borel_measurable_implies_simple_function_sequence'[OF f(1)] guess fs . note fs = this |
1659 from N.borel_measurable_implies_simple_function_sequence'[OF f(1)] guess fs . note fs = this |
|
1660 note sf = simple_function_subalgebra[OF fs(1) N(1,2)] |
1409 note sf = simple_function_subalgebra[OF fs(1) N(1,2)] |
1661 from N.positive_integral_monotone_convergence_simple[OF fs(2,5,1), symmetric] |
1410 from positive_integral_monotone_convergence_simple[OF fs(2,5,1), symmetric] |
1662 have "integral\<^isup>P N f = (SUP i. \<Sum>x\<in>fs i ` space M. x * N.\<mu> (fs i -` {x} \<inter> space M))" |
1411 have "integral\<^isup>P N f = (SUP i. \<Sum>x\<in>fs i ` space M. x * emeasure N (fs i -` {x} \<inter> space M))" |
1663 unfolding fs(4) positive_integral_max_0 |
1412 unfolding fs(4) positive_integral_max_0 |
1664 unfolding simple_integral_def `space N = space M` by simp |
1413 unfolding simple_integral_def `space N = space M` by simp |
1665 also have "\<dots> = (SUP i. \<Sum>x\<in>fs i ` space M. x * \<mu> (fs i -` {x} \<inter> space M))" |
1414 also have "\<dots> = (SUP i. \<Sum>x\<in>fs i ` space M. x * (emeasure M) (fs i -` {x} \<inter> space M))" |
1666 using N N.simple_functionD(2)[OF fs(1)] unfolding `space N = space M` by auto |
1415 using N simple_functionD(2)[OF fs(1)] unfolding `space N = space M` by auto |
1667 also have "\<dots> = integral\<^isup>P M f" |
1416 also have "\<dots> = integral\<^isup>P M f" |
1668 using positive_integral_monotone_convergence_simple[OF fs(2,5) sf, symmetric] |
1417 using positive_integral_monotone_convergence_simple[OF fs(2,5) sf, symmetric] |
1669 unfolding fs(4) positive_integral_max_0 |
1418 unfolding fs(4) positive_integral_max_0 |
1670 unfolding simple_integral_def `space N = space M` by simp |
1419 unfolding simple_integral_def `space N = space M` by simp |
1671 finally show ?thesis . |
1420 finally show ?thesis . |
1672 qed |
1421 qed |
1673 |
1422 |
1674 section "Lebesgue Integral" |
1423 section "Lebesgue Integral" |
1675 |
1424 |
1676 definition integrable where |
1425 definition integrable :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> bool" where |
1677 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1426 "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> |
1678 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1427 (\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity> \<and> (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1679 |
1428 |
1680 lemma integrableD[dest]: |
1429 lemma integrableD[dest]: |
1681 assumes "integrable M f" |
1430 assumes "integrable M f" |
1682 shows "f \<in> borel_measurable M" "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1431 shows "f \<in> borel_measurable M" "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) \<noteq> \<infinity>" "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) \<noteq> \<infinity>" |
1683 using assms unfolding integrable_def by auto |
1432 using assms unfolding integrable_def by auto |
1684 |
1433 |
1685 definition lebesgue_integral_def: |
1434 definition lebesgue_integral :: "'a measure \<Rightarrow> ('a \<Rightarrow> real) \<Rightarrow> real" ("integral\<^isup>L") where |
1686 "integral\<^isup>L M f = real ((\<integral>\<^isup>+ x. ereal (f x) \<partial>M)) - real ((\<integral>\<^isup>+ x. ereal (- f x) \<partial>M))" |
1435 "integral\<^isup>L M f = real ((\<integral>\<^isup>+ x. ereal (f x) \<partial>M)) - real ((\<integral>\<^isup>+ x. ereal (- f x) \<partial>M))" |
1687 |
1436 |
1688 syntax |
1437 syntax |
1689 "_lebesgue_integral" :: "pttrn \<Rightarrow> real \<Rightarrow> ('a, 'b) measure_space_scheme \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110) |
1438 "_lebesgue_integral" :: "pttrn \<Rightarrow> real \<Rightarrow> 'a measure \<Rightarrow> real" ("\<integral> _. _ \<partial>_" [60,61] 110) |
1690 |
1439 |
1691 translations |
1440 translations |
1692 "\<integral> x. f \<partial>M" == "CONST integral\<^isup>L M (%x. f)" |
1441 "\<integral> x. f \<partial>M" == "CONST lebesgue_integral M (%x. f)" |
1693 |
1442 |
1694 lemma (in measure_space) integrableE: |
1443 lemma integrableE: |
1695 assumes "integrable M f" |
1444 assumes "integrable M f" |
1696 obtains r q where |
1445 obtains r q where |
1697 "(\<integral>\<^isup>+x. ereal (f x)\<partial>M) = ereal r" |
1446 "(\<integral>\<^isup>+x. ereal (f x)\<partial>M) = ereal r" |
1698 "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M) = ereal q" |
1447 "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M) = ereal q" |
1699 "f \<in> borel_measurable M" "integral\<^isup>L M f = r - q" |
1448 "f \<in> borel_measurable M" "integral\<^isup>L M f = r - q" |
1700 using assms unfolding integrable_def lebesgue_integral_def |
1449 using assms unfolding integrable_def lebesgue_integral_def |
1701 using positive_integral_positive[of "\<lambda>x. ereal (f x)"] |
1450 using positive_integral_positive[of M "\<lambda>x. ereal (f x)"] |
1702 using positive_integral_positive[of "\<lambda>x. ereal (-f x)"] |
1451 using positive_integral_positive[of M "\<lambda>x. ereal (-f x)"] |
1703 by (cases rule: ereal2_cases[of "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M)" "(\<integral>\<^isup>+x. ereal (f x)\<partial>M)"]) auto |
1452 by (cases rule: ereal2_cases[of "(\<integral>\<^isup>+x. ereal (-f x)\<partial>M)" "(\<integral>\<^isup>+x. ereal (f x)\<partial>M)"]) auto |
1704 |
1453 |
1705 lemma (in measure_space) integral_cong: |
1454 lemma integral_cong: |
1706 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x" |
1455 assumes "\<And>x. x \<in> space M \<Longrightarrow> f x = g x" |
1707 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1456 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1708 using assms by (simp cong: positive_integral_cong add: lebesgue_integral_def) |
1457 using assms by (simp cong: positive_integral_cong add: lebesgue_integral_def) |
1709 |
1458 |
1710 lemma (in measure_space) integral_cong_measure: |
1459 lemma integral_cong_AE: |
1711 assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M" |
1460 assumes cong: "AE x in M. f x = g x" |
1712 shows "integral\<^isup>L N f = integral\<^isup>L M f" |
|
1713 by (simp add: positive_integral_cong_measure[OF assms] lebesgue_integral_def) |
|
1714 |
|
1715 lemma (in measure_space) integrable_cong_measure: |
|
1716 assumes "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = \<mu> A" "sets N = sets M" "space N = space M" |
|
1717 shows "integrable N f \<longleftrightarrow> integrable M f" |
|
1718 using assms |
|
1719 by (simp add: positive_integral_cong_measure[OF assms] integrable_def measurable_def) |
|
1720 |
|
1721 lemma (in measure_space) integral_cong_AE: |
|
1722 assumes cong: "AE x. f x = g x" |
|
1723 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1461 shows "integral\<^isup>L M f = integral\<^isup>L M g" |
1724 proof - |
1462 proof - |
1725 have *: "AE x. ereal (f x) = ereal (g x)" |
1463 have *: "AE x in M. ereal (f x) = ereal (g x)" |
1726 "AE x. ereal (- f x) = ereal (- g x)" using cong by auto |
1464 "AE x in M. ereal (- f x) = ereal (- g x)" using cong by auto |
1727 show ?thesis |
1465 show ?thesis |
1728 unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def .. |
1466 unfolding *[THEN positive_integral_cong_AE] lebesgue_integral_def .. |
1729 qed |
1467 qed |
1730 |
1468 |
1731 lemma (in measure_space) integrable_cong_AE: |
1469 lemma integrable_cong_AE: |
1732 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
1470 assumes borel: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
1733 assumes "AE x. f x = g x" |
1471 assumes "AE x in M. f x = g x" |
1734 shows "integrable M f = integrable M g" |
1472 shows "integrable M f = integrable M g" |
1735 proof - |
1473 proof - |
1736 have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (g x) \<partial>M)" |
1474 have "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (g x) \<partial>M)" |
1737 "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (- g x) \<partial>M)" |
1475 "(\<integral>\<^isup>+ x. ereal (- f x) \<partial>M) = (\<integral>\<^isup>+ x. ereal (- g x) \<partial>M)" |
1738 using assms by (auto intro!: positive_integral_cong_AE) |
1476 using assms by (auto intro!: positive_integral_cong_AE) |
1739 with assms show ?thesis |
1477 with assms show ?thesis |
1740 by (auto simp: integrable_def) |
1478 by (auto simp: integrable_def) |
1741 qed |
1479 qed |
1742 |
1480 |
1743 lemma (in measure_space) integrable_cong: |
1481 lemma integrable_cong: |
1744 "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable M g" |
1482 "(\<And>x. x \<in> space M \<Longrightarrow> f x = g x) \<Longrightarrow> integrable M f \<longleftrightarrow> integrable M g" |
1745 by (simp cong: positive_integral_cong measurable_cong add: integrable_def) |
1483 by (simp cong: positive_integral_cong measurable_cong add: integrable_def) |
1746 |
1484 |
1747 lemma (in measure_space) integral_eq_positive_integral: |
1485 lemma positive_integral_eq_integral: |
|
1486 assumes f: "integrable M f" |
|
1487 assumes nonneg: "AE x in M. 0 \<le> f x" |
|
1488 shows "(\<integral>\<^isup>+ x. ereal (f x) \<partial>M) = integral\<^isup>L M f" |
|
1489 proof - |
|
1490 have "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M) = (\<integral>\<^isup>+ x. 0 \<partial>M)" |
|
1491 using nonneg by (intro positive_integral_cong_AE) (auto split: split_max) |
|
1492 with f positive_integral_positive show ?thesis |
|
1493 by (cases "\<integral>\<^isup>+ x. ereal (f x) \<partial>M") |
|
1494 (auto simp add: lebesgue_integral_def positive_integral_max_0 integrable_def) |
|
1495 qed |
|
1496 |
|
1497 lemma integral_eq_positive_integral: |
1748 assumes f: "\<And>x. 0 \<le> f x" |
1498 assumes f: "\<And>x. 0 \<le> f x" |
1749 shows "integral\<^isup>L M f = real (\<integral>\<^isup>+ x. ereal (f x) \<partial>M)" |
1499 shows "integral\<^isup>L M f = real (\<integral>\<^isup>+ x. ereal (f x) \<partial>M)" |
1750 proof - |
1500 proof - |
1751 { fix x have "max 0 (ereal (- f x)) = 0" using f[of x] by (simp split: split_max) } |
1501 { fix x have "max 0 (ereal (- f x)) = 0" using f[of x] by (simp split: split_max) } |
1752 then have "0 = (\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M)" by simp |
1502 then have "0 = (\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M)" by simp |
1753 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M)" unfolding positive_integral_max_0 .. |
1503 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (- f x) \<partial>M)" unfolding positive_integral_max_0 .. |
1754 finally show ?thesis |
1504 finally show ?thesis |
1755 unfolding lebesgue_integral_def by simp |
1505 unfolding lebesgue_integral_def by simp |
1756 qed |
1506 qed |
1757 |
1507 |
1758 lemma (in measure_space) integral_vimage: |
1508 lemma integral_minus[intro, simp]: |
1759 assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'" |
|
1760 assumes f: "f \<in> borel_measurable M'" |
|
1761 shows "integral\<^isup>L M' f = (\<integral>x. f (T x) \<partial>M)" |
|
1762 proof - |
|
1763 interpret T: measure_space M' by (rule measure_space_vimage[OF T]) |
|
1764 from measurable_comp[OF measure_preservingD2[OF T(2)], of f borel] |
|
1765 have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'" |
|
1766 and "(\<lambda>x. f (T x)) \<in> borel_measurable M" |
|
1767 using f by (auto simp: comp_def) |
|
1768 then show ?thesis |
|
1769 using f unfolding lebesgue_integral_def integrable_def |
|
1770 by (auto simp: borel[THEN positive_integral_vimage[OF T]]) |
|
1771 qed |
|
1772 |
|
1773 lemma (in measure_space) integrable_vimage: |
|
1774 assumes T: "sigma_algebra M'" "T \<in> measure_preserving M M'" |
|
1775 assumes f: "integrable M' f" |
|
1776 shows "integrable M (\<lambda>x. f (T x))" |
|
1777 proof - |
|
1778 interpret T: measure_space M' by (rule measure_space_vimage[OF T]) |
|
1779 from measurable_comp[OF measure_preservingD2[OF T(2)], of f borel] |
|
1780 have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'" |
|
1781 and "(\<lambda>x. f (T x)) \<in> borel_measurable M" |
|
1782 using f by (auto simp: comp_def) |
|
1783 then show ?thesis |
|
1784 using f unfolding lebesgue_integral_def integrable_def |
|
1785 by (auto simp: borel[THEN positive_integral_vimage[OF T]]) |
|
1786 qed |
|
1787 |
|
1788 lemma (in measure_space) integral_translated_density: |
|
1789 assumes f: "f \<in> borel_measurable M" "AE x. 0 \<le> f x" |
|
1790 and g: "g \<in> borel_measurable M" |
|
1791 and N: "space N = space M" "sets N = sets M" |
|
1792 and density: "\<And>A. A \<in> sets M \<Longrightarrow> measure N A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)" |
|
1793 (is "\<And>A. _ \<Longrightarrow> _ = ?d A") |
|
1794 shows "integral\<^isup>L N g = (\<integral> x. f x * g x \<partial>M)" (is ?integral) |
|
1795 and "integrable N g = integrable M (\<lambda>x. f x * g x)" (is ?integrable) |
|
1796 proof - |
|
1797 from f have ms: "measure_space (M\<lparr>measure := ?d\<rparr>)" |
|
1798 by (intro measure_space_density[where u="\<lambda>x. ereal (f x)"]) auto |
|
1799 |
|
1800 from ms density N have "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
|
1801 unfolding positive_integral_max_0 |
|
1802 by (intro measure_space.positive_integral_cong_measure) auto |
|
1803 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (g x)) \<partial>M)" |
|
1804 using f g by (intro positive_integral_translated_density) auto |
|
1805 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (f x * g x)) \<partial>M)" |
|
1806 using f by (intro positive_integral_cong_AE) |
|
1807 (auto simp: ereal_max_0 zero_le_mult_iff split: split_max) |
|
1808 finally have pos: "(\<integral>\<^isup>+ x. g x \<partial>N) = (\<integral>\<^isup>+ x. f x * g x \<partial>M)" |
|
1809 by (simp add: positive_integral_max_0) |
|
1810 |
|
1811 from ms density N have "(\<integral>\<^isup>+ x. - (g x) \<partial>N) = (\<integral>\<^isup>+ x. max 0 (ereal (- g x)) \<partial>M\<lparr>measure := ?d\<rparr>)" |
|
1812 unfolding positive_integral_max_0 |
|
1813 by (intro measure_space.positive_integral_cong_measure) auto |
|
1814 also have "\<dots> = (\<integral>\<^isup>+ x. ereal (f x) * max 0 (ereal (- g x)) \<partial>M)" |
|
1815 using f g by (intro positive_integral_translated_density) auto |
|
1816 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (ereal (- f x * g x)) \<partial>M)" |
|
1817 using f by (intro positive_integral_cong_AE) |
|
1818 (auto simp: ereal_max_0 mult_le_0_iff split: split_max) |
|
1819 finally have neg: "(\<integral>\<^isup>+ x. - g x \<partial>N) = (\<integral>\<^isup>+ x. - (f x * g x) \<partial>M)" |
|
1820 by (simp add: positive_integral_max_0) |
|
1821 |
|
1822 have g_N: "g \<in> borel_measurable N" |
|
1823 using g N unfolding measurable_def by simp |
|
1824 |
|
1825 show ?integral ?integrable |
|
1826 unfolding lebesgue_integral_def integrable_def |
|
1827 using pos neg f g g_N by auto |
|
1828 qed |
|
1829 |
|
1830 lemma (in measure_space) integral_minus[intro, simp]: |
|
1831 assumes "integrable M f" |
1509 assumes "integrable M f" |
1832 shows "integrable M (\<lambda>x. - f x)" "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f" |
1510 shows "integrable M (\<lambda>x. - f x)" "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f" |
1833 using assms by (auto simp: integrable_def lebesgue_integral_def) |
1511 using assms by (auto simp: integrable_def lebesgue_integral_def) |
1834 |
1512 |
1835 lemma (in measure_space) integral_minus_iff[simp]: |
1513 lemma integral_minus_iff[simp]: |
1836 "integrable M (\<lambda>x. - f x) \<longleftrightarrow> integrable M f" |
1514 "integrable M (\<lambda>x. - f x) \<longleftrightarrow> integrable M f" |
1837 proof |
1515 proof |
1838 assume "integrable M (\<lambda>x. - f x)" |
1516 assume "integrable M (\<lambda>x. - f x)" |
1839 then have "integrable M (\<lambda>x. - (- f x))" |
1517 then have "integrable M (\<lambda>x. - (- f x))" |
1840 by (rule integral_minus) |
1518 by (rule integral_minus) |
1841 then show "integrable M f" by simp |
1519 then show "integrable M f" by simp |
1842 qed (rule integral_minus) |
1520 qed (rule integral_minus) |
1843 |
1521 |
1844 lemma (in measure_space) integral_of_positive_diff: |
1522 lemma integral_of_positive_diff: |
1845 assumes integrable: "integrable M u" "integrable M v" |
1523 assumes integrable: "integrable M u" "integrable M v" |
1846 and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x" |
1524 and f_def: "\<And>x. f x = u x - v x" and pos: "\<And>x. 0 \<le> u x" "\<And>x. 0 \<le> v x" |
1847 shows "integrable M f" and "integral\<^isup>L M f = integral\<^isup>L M u - integral\<^isup>L M v" |
1525 shows "integrable M f" and "integral\<^isup>L M f = integral\<^isup>L M u - integral\<^isup>L M v" |
1848 proof - |
1526 proof - |
1849 let ?f = "\<lambda>x. max 0 (ereal (f x))" |
1527 let ?f = "\<lambda>x. max 0 (ereal (f x))" |
1850 let ?mf = "\<lambda>x. max 0 (ereal (- f x))" |
1528 let ?mf = "\<lambda>x. max 0 (ereal (- f x))" |
1851 let ?u = "\<lambda>x. max 0 (ereal (u x))" |
1529 let ?u = "\<lambda>x. max 0 (ereal (u x))" |
1852 let ?v = "\<lambda>x. max 0 (ereal (v x))" |
1530 let ?v = "\<lambda>x. max 0 (ereal (v x))" |
1853 |
1531 |
1854 from borel_measurable_diff[of u v] integrable |
1532 from borel_measurable_diff[of u M v] integrable |
1855 have f_borel: "?f \<in> borel_measurable M" and |
1533 have f_borel: "?f \<in> borel_measurable M" and |
1856 mf_borel: "?mf \<in> borel_measurable M" and |
1534 mf_borel: "?mf \<in> borel_measurable M" and |
1857 v_borel: "?v \<in> borel_measurable M" and |
1535 v_borel: "?v \<in> borel_measurable M" and |
1858 u_borel: "?u \<in> borel_measurable M" and |
1536 u_borel: "?u \<in> borel_measurable M" and |
1859 "f \<in> borel_measurable M" |
1537 "f \<in> borel_measurable M" |
1940 by (simp add: integral_zero) |
1618 by (simp add: integral_zero) |
1941 next |
1619 next |
1942 assume "a \<le> 0" hence "0 \<le> - a" by auto |
1620 assume "a \<le> 0" hence "0 \<le> - a" by auto |
1943 have *: "\<And>t. - a * t + 0 = (-a) * t" by simp |
1621 have *: "\<And>t. - a * t + 0 = (-a) * t" by simp |
1944 show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`] |
1622 show ?thesis using integral_linear[OF assms integral_zero(1) `0 \<le> - a`] |
1945 integral_minus(1)[of "\<lambda>t. - a * f t"] |
1623 integral_minus(1)[of M "\<lambda>t. - a * f t"] |
1946 unfolding * integral_zero by simp |
1624 unfolding * integral_zero by simp |
1947 qed |
1625 qed |
1948 thus ?P ?I by auto |
1626 thus ?P ?I by auto |
1949 qed |
1627 qed |
1950 |
1628 |
1951 lemma (in measure_space) integral_multc: |
1629 lemma lebesgue_integral_cmult_nonneg: |
|
1630 assumes f: "f \<in> borel_measurable M" and "0 \<le> c" |
|
1631 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
|
1632 proof - |
|
1633 { have "c * real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (f x)))) = |
|
1634 real (ereal c * integral\<^isup>P M (\<lambda>x. max 0 (ereal (f x))))" |
|
1635 by simp |
|
1636 also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. ereal c * max 0 (ereal (f x))))" |
|
1637 using f `0 \<le> c` by (subst positive_integral_cmult) auto |
|
1638 also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (c * f x))))" |
|
1639 using `0 \<le> c` by (auto intro!: arg_cong[where f=real] positive_integral_cong simp: max_def zero_le_mult_iff) |
|
1640 finally have "real (integral\<^isup>P M (\<lambda>x. ereal (c * f x))) = c * real (integral\<^isup>P M (\<lambda>x. ereal (f x)))" |
|
1641 by (simp add: positive_integral_max_0) } |
|
1642 moreover |
|
1643 { have "c * real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (- f x)))) = |
|
1644 real (ereal c * integral\<^isup>P M (\<lambda>x. max 0 (ereal (- f x))))" |
|
1645 by simp |
|
1646 also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. ereal c * max 0 (ereal (- f x))))" |
|
1647 using f `0 \<le> c` by (subst positive_integral_cmult) auto |
|
1648 also have "\<dots> = real (integral\<^isup>P M (\<lambda>x. max 0 (ereal (- c * f x))))" |
|
1649 using `0 \<le> c` by (auto intro!: arg_cong[where f=real] positive_integral_cong simp: max_def mult_le_0_iff) |
|
1650 finally have "real (integral\<^isup>P M (\<lambda>x. ereal (- c * f x))) = c * real (integral\<^isup>P M (\<lambda>x. ereal (- f x)))" |
|
1651 by (simp add: positive_integral_max_0) } |
|
1652 ultimately show ?thesis |
|
1653 by (simp add: lebesgue_integral_def field_simps) |
|
1654 qed |
|
1655 |
|
1656 lemma lebesgue_integral_uminus: |
|
1657 "(\<integral>x. - f x \<partial>M) = - integral\<^isup>L M f" |
|
1658 unfolding lebesgue_integral_def by simp |
|
1659 |
|
1660 lemma lebesgue_integral_cmult: |
|
1661 assumes f: "f \<in> borel_measurable M" |
|
1662 shows "(\<integral>x. c * f x \<partial>M) = c * integral\<^isup>L M f" |
|
1663 proof (cases rule: linorder_le_cases) |
|
1664 assume "0 \<le> c" with f show ?thesis by (rule lebesgue_integral_cmult_nonneg) |
|
1665 next |
|
1666 assume "c \<le> 0" |
|
1667 with lebesgue_integral_cmult_nonneg[OF f, of "-c"] |
|
1668 show ?thesis |
|
1669 by (simp add: lebesgue_integral_def) |
|
1670 qed |
|
1671 |
|
1672 lemma integral_multc: |
1952 assumes "integrable M f" |
1673 assumes "integrable M f" |
1953 shows "(\<integral> x. f x * c \<partial>M) = integral\<^isup>L M f * c" |
1674 shows "(\<integral> x. f x * c \<partial>M) = integral\<^isup>L M f * c" |
1954 unfolding mult_commute[of _ c] integral_cmult[OF assms] .. |
1675 unfolding mult_commute[of _ c] integral_cmult[OF assms] .. |
1955 |
1676 |
1956 lemma (in measure_space) integral_mono_AE: |
1677 lemma integral_mono_AE: |
1957 assumes fg: "integrable M f" "integrable M g" |
1678 assumes fg: "integrable M f" "integrable M g" |
1958 and mono: "AE t. f t \<le> g t" |
1679 and mono: "AE t in M. f t \<le> g t" |
1959 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g" |
1680 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g" |
1960 proof - |
1681 proof - |
1961 have "AE x. ereal (f x) \<le> ereal (g x)" |
1682 have "AE x in M. ereal (f x) \<le> ereal (g x)" |
1962 using mono by auto |
1683 using mono by auto |
1963 moreover have "AE x. ereal (- g x) \<le> ereal (- f x)" |
1684 moreover have "AE x in M. ereal (- g x) \<le> ereal (- f x)" |
1964 using mono by auto |
1685 using mono by auto |
1965 ultimately show ?thesis using fg |
1686 ultimately show ?thesis using fg |
1966 by (auto intro!: add_mono positive_integral_mono_AE real_of_ereal_positive_mono |
1687 by (auto intro!: add_mono positive_integral_mono_AE real_of_ereal_positive_mono |
1967 simp: positive_integral_positive lebesgue_integral_def diff_minus) |
1688 simp: positive_integral_positive lebesgue_integral_def diff_minus) |
1968 qed |
1689 qed |
1969 |
1690 |
1970 lemma (in measure_space) integral_mono: |
1691 lemma integral_mono: |
1971 assumes "integrable M f" "integrable M g" "\<And>t. t \<in> space M \<Longrightarrow> f t \<le> g t" |
1692 assumes "integrable M f" "integrable M g" "\<And>t. t \<in> space M \<Longrightarrow> f t \<le> g t" |
1972 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g" |
1693 shows "integral\<^isup>L M f \<le> integral\<^isup>L M g" |
1973 using assms by (auto intro: integral_mono_AE) |
1694 using assms by (auto intro: integral_mono_AE) |
1974 |
1695 |
1975 lemma (in measure_space) integral_diff[simp, intro]: |
1696 lemma integral_diff[simp, intro]: |
1976 assumes f: "integrable M f" and g: "integrable M g" |
1697 assumes f: "integrable M f" and g: "integrable M g" |
1977 shows "integrable M (\<lambda>t. f t - g t)" |
1698 shows "integrable M (\<lambda>t. f t - g t)" |
1978 and "(\<integral> t. f t - g t \<partial>M) = integral\<^isup>L M f - integral\<^isup>L M g" |
1699 and "(\<integral> t. f t - g t \<partial>M) = integral\<^isup>L M f - integral\<^isup>L M g" |
1979 using integral_add[OF f integral_minus(1)[OF g]] |
1700 using integral_add[OF f integral_minus(1)[OF g]] |
1980 unfolding diff_minus integral_minus(2)[OF g] |
1701 unfolding diff_minus integral_minus(2)[OF g] |
1981 by auto |
1702 by auto |
1982 |
1703 |
1983 lemma (in measure_space) integral_indicator[simp, intro]: |
1704 lemma integral_indicator[simp, intro]: |
1984 assumes "A \<in> sets M" and "\<mu> A \<noteq> \<infinity>" |
1705 assumes "A \<in> sets M" and "(emeasure M) A \<noteq> \<infinity>" |
1985 shows "integral\<^isup>L M (indicator A) = real (\<mu> A)" (is ?int) |
1706 shows "integral\<^isup>L M (indicator A) = real ((emeasure M) A)" (is ?int) |
1986 and "integrable M (indicator A)" (is ?able) |
1707 and "integrable M (indicator A)" (is ?able) |
1987 proof - |
1708 proof - |
1988 from `A \<in> sets M` have *: |
1709 from `A \<in> sets M` have *: |
1989 "\<And>x. ereal (indicator A x) = indicator A x" |
1710 "\<And>x. ereal (indicator A x) = indicator A x" |
1990 "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0" |
1711 "(\<integral>\<^isup>+x. ereal (- indicator A x) \<partial>M) = 0" |
2199 using diff(1) f by (rule integral_add(1)) |
1929 using diff(1) f by (rule integral_add(1)) |
2200 with diff(2) f show "integrable M u" "integral\<^isup>L M u = x" |
1930 with diff(2) f show "integrable M u" "integral\<^isup>L M u = x" |
2201 by (auto simp: integral_diff) |
1931 by (auto simp: integral_diff) |
2202 qed |
1932 qed |
2203 |
1933 |
2204 lemma (in measure_space) integral_0_iff: |
1934 lemma integral_0_iff: |
2205 assumes "integrable M f" |
1935 assumes "integrable M f" |
2206 shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> \<mu> {x\<in>space M. f x \<noteq> 0} = 0" |
1936 shows "(\<integral>x. \<bar>f x\<bar> \<partial>M) = 0 \<longleftrightarrow> (emeasure M) {x\<in>space M. f x \<noteq> 0} = 0" |
2207 proof - |
1937 proof - |
2208 have *: "(\<integral>\<^isup>+x. ereal (- \<bar>f x\<bar>) \<partial>M) = 0" |
1938 have *: "(\<integral>\<^isup>+x. ereal (- \<bar>f x\<bar>) \<partial>M) = 0" |
2209 using assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
1939 using assms by (auto simp: positive_integral_0_iff_AE integrable_def) |
2210 have "integrable M (\<lambda>x. \<bar>f x\<bar>)" using assms by (rule integrable_abs) |
1940 have "integrable M (\<lambda>x. \<bar>f x\<bar>)" using assms by (rule integrable_abs) |
2211 hence "(\<lambda>x. ereal (\<bar>f x\<bar>)) \<in> borel_measurable M" |
1941 hence "(\<lambda>x. ereal (\<bar>f x\<bar>)) \<in> borel_measurable M" |
2212 "(\<integral>\<^isup>+ x. ereal \<bar>f x\<bar> \<partial>M) \<noteq> \<infinity>" unfolding integrable_def by auto |
1942 "(\<integral>\<^isup>+ x. ereal \<bar>f x\<bar> \<partial>M) \<noteq> \<infinity>" unfolding integrable_def by auto |
2213 from positive_integral_0_iff[OF this(1)] this(2) |
1943 from positive_integral_0_iff[OF this(1)] this(2) |
2214 show ?thesis unfolding lebesgue_integral_def * |
1944 show ?thesis unfolding lebesgue_integral_def * |
2215 using positive_integral_positive[of "\<lambda>x. ereal \<bar>f x\<bar>"] |
1945 using positive_integral_positive[of M "\<lambda>x. ereal \<bar>f x\<bar>"] |
2216 by (auto simp add: real_of_ereal_eq_0) |
1946 by (auto simp add: real_of_ereal_eq_0) |
2217 qed |
1947 qed |
2218 |
1948 |
2219 lemma (in measure_space) positive_integral_PInf: |
1949 lemma positive_integral_PInf: |
2220 assumes f: "f \<in> borel_measurable M" |
1950 assumes f: "f \<in> borel_measurable M" |
2221 and not_Inf: "integral\<^isup>P M f \<noteq> \<infinity>" |
1951 and not_Inf: "integral\<^isup>P M f \<noteq> \<infinity>" |
2222 shows "\<mu> (f -` {\<infinity>} \<inter> space M) = 0" |
1952 shows "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0" |
2223 proof - |
1953 proof - |
2224 have "\<infinity> * \<mu> (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^isup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)" |
1954 have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) = (\<integral>\<^isup>+ x. \<infinity> * indicator (f -` {\<infinity>} \<inter> space M) x \<partial>M)" |
2225 using f by (subst positive_integral_cmult_indicator) (auto simp: measurable_sets) |
1955 using f by (subst positive_integral_cmult_indicator) (auto simp: measurable_sets) |
2226 also have "\<dots> \<le> integral\<^isup>P M (\<lambda>x. max 0 (f x))" |
1956 also have "\<dots> \<le> integral\<^isup>P M (\<lambda>x. max 0 (f x))" |
2227 by (auto intro!: positive_integral_mono simp: indicator_def max_def) |
1957 by (auto intro!: positive_integral_mono simp: indicator_def max_def) |
2228 finally have "\<infinity> * \<mu> (f -` {\<infinity>} \<inter> space M) \<le> integral\<^isup>P M f" |
1958 finally have "\<infinity> * (emeasure M) (f -` {\<infinity>} \<inter> space M) \<le> integral\<^isup>P M f" |
2229 by (simp add: positive_integral_max_0) |
1959 by (simp add: positive_integral_max_0) |
2230 moreover have "0 \<le> \<mu> (f -` {\<infinity>} \<inter> space M)" |
1960 moreover have "0 \<le> (emeasure M) (f -` {\<infinity>} \<inter> space M)" |
2231 using f by (simp add: measurable_sets) |
1961 by (rule emeasure_nonneg) |
2232 ultimately show ?thesis |
1962 ultimately show ?thesis |
2233 using assms by (auto split: split_if_asm) |
1963 using assms by (auto split: split_if_asm) |
2234 qed |
1964 qed |
2235 |
1965 |
2236 lemma (in measure_space) positive_integral_PInf_AE: |
1966 lemma positive_integral_PInf_AE: |
2237 assumes "f \<in> borel_measurable M" "integral\<^isup>P M f \<noteq> \<infinity>" shows "AE x. f x \<noteq> \<infinity>" |
1967 assumes "f \<in> borel_measurable M" "integral\<^isup>P M f \<noteq> \<infinity>" shows "AE x in M. f x \<noteq> \<infinity>" |
2238 proof (rule AE_I) |
1968 proof (rule AE_I) |
2239 show "\<mu> (f -` {\<infinity>} \<inter> space M) = 0" |
1969 show "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0" |
2240 by (rule positive_integral_PInf[OF assms]) |
1970 by (rule positive_integral_PInf[OF assms]) |
2241 show "f -` {\<infinity>} \<inter> space M \<in> sets M" |
1971 show "f -` {\<infinity>} \<inter> space M \<in> sets M" |
2242 using assms by (auto intro: borel_measurable_vimage) |
1972 using assms by (auto intro: borel_measurable_vimage) |
2243 qed auto |
1973 qed auto |
2244 |
1974 |
2245 lemma (in measure_space) simple_integral_PInf: |
1975 lemma simple_integral_PInf: |
2246 assumes "simple_function M f" "\<And>x. 0 \<le> f x" |
1976 assumes "simple_function M f" "\<And>x. 0 \<le> f x" |
2247 and "integral\<^isup>S M f \<noteq> \<infinity>" |
1977 and "integral\<^isup>S M f \<noteq> \<infinity>" |
2248 shows "\<mu> (f -` {\<infinity>} \<inter> space M) = 0" |
1978 shows "(emeasure M) (f -` {\<infinity>} \<inter> space M) = 0" |
2249 proof (rule positive_integral_PInf) |
1979 proof (rule positive_integral_PInf) |
2250 show "f \<in> borel_measurable M" using assms by (auto intro: borel_measurable_simple_function) |
1980 show "f \<in> borel_measurable M" using assms by (auto intro: borel_measurable_simple_function) |
2251 show "integral\<^isup>P M f \<noteq> \<infinity>" |
1981 show "integral\<^isup>P M f \<noteq> \<infinity>" |
2252 using assms by (simp add: positive_integral_eq_simple_integral) |
1982 using assms by (simp add: positive_integral_eq_simple_integral) |
2253 qed |
1983 qed |
2254 |
1984 |
2255 lemma (in measure_space) integral_real: |
1985 lemma integral_real: |
2256 "AE x. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))" |
1986 "AE x in M. \<bar>f x\<bar> \<noteq> \<infinity> \<Longrightarrow> (\<integral>x. real (f x) \<partial>M) = real (integral\<^isup>P M f) - real (integral\<^isup>P M (\<lambda>x. - f x))" |
2257 using assms unfolding lebesgue_integral_def |
1987 using assms unfolding lebesgue_integral_def |
2258 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real) |
1988 by (subst (1 2) positive_integral_cong_AE) (auto simp add: ereal_real) |
2259 |
1989 |
2260 lemma (in finite_measure) lebesgue_integral_const[simp]: |
1990 lemma (in finite_measure) lebesgue_integral_const[simp]: |
2261 shows "integrable M (\<lambda>x. a)" |
1991 shows "integrable M (\<lambda>x. a)" |
2262 and "(\<integral>x. a \<partial>M) = a * \<mu>' (space M)" |
1992 and "(\<integral>x. a \<partial>M) = a * (measure M) (space M)" |
2263 proof - |
1993 proof - |
2264 { fix a :: real assume "0 \<le> a" |
1994 { fix a :: real assume "0 \<le> a" |
2265 then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * \<mu> (space M)" |
1995 then have "(\<integral>\<^isup>+ x. ereal a \<partial>M) = ereal a * (emeasure M) (space M)" |
2266 by (subst positive_integral_const) auto |
1996 by (subst positive_integral_const) auto |
2267 moreover |
1997 moreover |
2268 from `0 \<le> a` have "(\<integral>\<^isup>+ x. ereal (-a) \<partial>M) = 0" |
1998 from `0 \<le> a` have "(\<integral>\<^isup>+ x. ereal (-a) \<partial>M) = 0" |
2269 by (subst positive_integral_0_iff_AE) auto |
1999 by (subst positive_integral_0_iff_AE) auto |
2270 ultimately have "integrable M (\<lambda>x. a)" by (auto simp: integrable_def) } |
2000 ultimately have "integrable M (\<lambda>x. a)" by (auto simp: integrable_def) } |
2568 |
2299 |
2569 from integral_sums(1)[OF 1 2, unfolded int_abs_F, OF _ abs_summable] |
2300 from integral_sums(1)[OF 1 2, unfolded int_abs_F, OF _ abs_summable] |
2570 show "integrable M f" unfolding int_f by simp |
2301 show "integrable M f" unfolding int_f by simp |
2571 qed |
2302 qed |
2572 |
2303 |
2573 section "Lebesgue integration on finite space" |
2304 section {* Distributions *} |
2574 |
2305 |
2575 lemma (in measure_space) integral_on_finite: |
2306 lemma simple_function_distr[simp]: |
2576 assumes f: "f \<in> borel_measurable M" and finite: "finite (f`space M)" |
2307 "simple_function (distr M M' T) f \<longleftrightarrow> simple_function M' (\<lambda>x. f x)" |
2577 and fin: "\<And>x. x \<noteq> 0 \<Longrightarrow> \<mu> (f -` {x} \<inter> space M) \<noteq> \<infinity>" |
2308 unfolding simple_function_def by simp |
2578 shows "integrable M f" |
2309 |
2579 and "(\<integral>x. f x \<partial>M) = |
2310 lemma positive_integral_distr: |
2580 (\<Sum> r \<in> f`space M. r * real (\<mu> (f -` {r} \<inter> space M)))" (is "?integral") |
2311 assumes T: "T \<in> measurable M M'" |
2581 proof - |
2312 and f: "f \<in> borel_measurable M'" |
2582 let ?A = "\<lambda>r. f -` {r} \<inter> space M" |
2313 shows "integral\<^isup>P (distr M M' T) f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)" |
2583 let ?S = "\<lambda>x. \<Sum>r\<in>f`space M. r * indicator (?A r) x" |
2314 proof - |
2584 |
2315 from borel_measurable_implies_simple_function_sequence'[OF f] |
|
2316 guess f' . note f' = this |
|
2317 then have f_distr: "\<And>i. simple_function (distr M M' T) (f' i)" |
|
2318 by simp |
|
2319 let ?f = "\<lambda>i x. f' i (T x)" |
|
2320 have inc: "incseq ?f" using f' by (force simp: le_fun_def incseq_def) |
|
2321 have sup: "\<And>x. (SUP i. ?f i x) = max 0 (f (T x))" |
|
2322 using f'(4) . |
|
2323 have sf: "\<And>i. simple_function M (\<lambda>x. f' i (T x))" |
|
2324 using simple_function_comp[OF T(1) f'(1)] . |
|
2325 show "integral\<^isup>P (distr M M' T) f = (\<integral>\<^isup>+ x. f (T x) \<partial>M)" |
|
2326 using |
|
2327 positive_integral_monotone_convergence_simple[OF f'(2,5) f_distr] |
|
2328 positive_integral_monotone_convergence_simple[OF inc f'(5) sf] |
|
2329 by (simp add: positive_integral_max_0 simple_integral_distr[OF T f'(1)] f') |
|
2330 qed |
|
2331 |
|
2332 lemma integral_distr: |
|
2333 assumes T: "T \<in> measurable M M'" |
|
2334 assumes f: "f \<in> borel_measurable M'" |
|
2335 shows "integral\<^isup>L (distr M M' T) f = (\<integral>x. f (T x) \<partial>M)" |
|
2336 proof - |
|
2337 from measurable_comp[OF T, of f borel] |
|
2338 have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'" |
|
2339 and "(\<lambda>x. f (T x)) \<in> borel_measurable M" |
|
2340 using f by (auto simp: comp_def) |
|
2341 then show ?thesis |
|
2342 using f unfolding lebesgue_integral_def integrable_def |
|
2343 by (auto simp: borel[THEN positive_integral_distr[OF T]]) |
|
2344 qed |
|
2345 |
|
2346 lemma integrable_distr: |
|
2347 assumes T: "T \<in> measurable M M'" and f: "integrable (distr M M' T) f" |
|
2348 shows "integrable M (\<lambda>x. f (T x))" |
|
2349 proof - |
|
2350 from measurable_comp[OF T, of f borel] |
|
2351 have borel: "(\<lambda>x. ereal (f x)) \<in> borel_measurable M'" "(\<lambda>x. ereal (- f x)) \<in> borel_measurable M'" |
|
2352 and "(\<lambda>x. f (T x)) \<in> borel_measurable M" |
|
2353 using f by (auto simp: comp_def) |
|
2354 then show ?thesis |
|
2355 using f unfolding lebesgue_integral_def integrable_def |
|
2356 using borel[THEN positive_integral_distr[OF T]] |
|
2357 by (auto simp: borel[THEN positive_integral_distr[OF T]]) |
|
2358 qed |
|
2359 |
|
2360 section {* Lebesgue integration on @{const count_space} *} |
|
2361 |
|
2362 lemma simple_function_count_space[simp]: |
|
2363 "simple_function (count_space A) f \<longleftrightarrow> finite (f ` A)" |
|
2364 unfolding simple_function_def by simp |
|
2365 |
|
2366 lemma positive_integral_count_space: |
|
2367 assumes A: "finite {a\<in>A. 0 < f a}" |
|
2368 shows "integral\<^isup>P (count_space A) f = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)" |
|
2369 proof - |
|
2370 have *: "(\<integral>\<^isup>+x. max 0 (f x) \<partial>count_space A) = |
|
2371 (\<integral>\<^isup>+ x. (\<Sum>a|a\<in>A \<and> 0 < f a. f a * indicator {a} x) \<partial>count_space A)" |
|
2372 by (auto intro!: positive_integral_cong |
|
2373 simp add: indicator_def if_distrib setsum_cases[OF A] max_def le_less) |
|
2374 also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. \<integral>\<^isup>+ x. f a * indicator {a} x \<partial>count_space A)" |
|
2375 by (subst positive_integral_setsum) |
|
2376 (simp_all add: AE_count_space ereal_zero_le_0_iff less_imp_le) |
|
2377 also have "\<dots> = (\<Sum>a|a\<in>A \<and> 0 < f a. f a)" |
|
2378 by (auto intro!: setsum_cong simp: positive_integral_cmult_indicator one_ereal_def[symmetric]) |
|
2379 finally show ?thesis by (simp add: positive_integral_max_0) |
|
2380 qed |
|
2381 |
|
2382 lemma integrable_count_space: |
|
2383 "finite X \<Longrightarrow> integrable (count_space X) f" |
|
2384 by (auto simp: positive_integral_count_space integrable_def) |
|
2385 |
|
2386 lemma positive_integral_count_space_finite: |
|
2387 "finite A \<Longrightarrow> (\<integral>\<^isup>+x. f x \<partial>count_space A) = (\<Sum>a\<in>A. max 0 (f a))" |
|
2388 by (subst positive_integral_max_0[symmetric]) |
|
2389 (auto intro!: setsum_mono_zero_left simp: positive_integral_count_space less_le) |
|
2390 |
|
2391 lemma lebesgue_integral_count_space_finite: |
|
2392 "finite A \<Longrightarrow> (\<integral>x. f x \<partial>count_space A) = (\<Sum>a\<in>A. f a)" |
|
2393 apply (auto intro!: setsum_mono_zero_left |
|
2394 simp: positive_integral_count_space_finite lebesgue_integral_def) |
|
2395 apply (subst (1 2) setsum_real_of_ereal[symmetric]) |
|
2396 apply (auto simp: max_def setsum_subtractf[symmetric] intro!: setsum_cong) |
|
2397 done |
|
2398 |
|
2399 section {* Measure spaces with an associated density *} |
|
2400 |
|
2401 definition density :: "'a measure \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> 'a measure" where |
|
2402 "density M f = measure_of (space M) (sets M) (\<lambda>A. \<integral>\<^isup>+ x. f x * indicator A x \<partial>M)" |
|
2403 |
|
2404 lemma |
|
2405 shows sets_density[simp]: "sets (density M f) = sets M" |
|
2406 and space_density[simp]: "space (density M f) = space M" |
|
2407 by (auto simp: density_def) |
|
2408 |
|
2409 lemma |
|
2410 shows measurable_density_eq1[simp]: "g \<in> measurable (density Mg f) Mg' \<longleftrightarrow> g \<in> measurable Mg Mg'" |
|
2411 and measurable_density_eq2[simp]: "h \<in> measurable Mh (density Mh' f) \<longleftrightarrow> h \<in> measurable Mh Mh'" |
|
2412 and simple_function_density_eq[simp]: "simple_function (density Mu f) u \<longleftrightarrow> simple_function Mu u" |
|
2413 unfolding measurable_def simple_function_def by simp_all |
|
2414 |
|
2415 lemma density_cong: "f \<in> borel_measurable M \<Longrightarrow> f' \<in> borel_measurable M \<Longrightarrow> |
|
2416 (AE x in M. f x = f' x) \<Longrightarrow> density M f = density M f'" |
|
2417 unfolding density_def by (auto intro!: measure_of_eq positive_integral_cong_AE space_closed) |
|
2418 |
|
2419 lemma density_max_0: "density M f = density M (\<lambda>x. max 0 (f x))" |
|
2420 proof - |
|
2421 have "\<And>x A. max 0 (f x) * indicator A x = max 0 (f x * indicator A x)" |
|
2422 by (auto simp: indicator_def) |
|
2423 then show ?thesis |
|
2424 unfolding density_def by (simp add: positive_integral_max_0) |
|
2425 qed |
|
2426 |
|
2427 lemma density_ereal_max_0: "density M (\<lambda>x. ereal (f x)) = density M (\<lambda>x. ereal (max 0 (f x)))" |
|
2428 by (subst density_max_0) (auto intro!: arg_cong[where f="density M"] split: split_max) |
|
2429 |
|
2430 lemma emeasure_density: |
|
2431 assumes f: "f \<in> borel_measurable M" and A: "A \<in> sets M" |
|
2432 shows "emeasure (density M f) A = (\<integral>\<^isup>+ x. f x * indicator A x \<partial>M)" |
|
2433 (is "_ = ?\<mu> A") |
|
2434 unfolding density_def |
|
2435 proof (rule emeasure_measure_of_sigma) |
|
2436 show "sigma_algebra (space M) (sets M)" .. |
|
2437 show "positive (sets M) ?\<mu>" |
|
2438 using f by (auto simp: positive_def intro!: positive_integral_positive) |
|
2439 have \<mu>_eq: "?\<mu> = (\<lambda>A. \<integral>\<^isup>+ x. max 0 (f x) * indicator A x \<partial>M)" (is "?\<mu> = ?\<mu>'") |
|
2440 apply (subst positive_integral_max_0[symmetric]) |
|
2441 apply (intro ext positive_integral_cong_AE AE_I2) |
|
2442 apply (auto simp: indicator_def) |
|
2443 done |
|
2444 show "countably_additive (sets M) ?\<mu>" |
|
2445 unfolding \<mu>_eq |
|
2446 proof (intro countably_additiveI) |
|
2447 fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> sets M" |
|
2448 then have *: "\<And>i. (\<lambda>x. max 0 (f x) * indicator (A i) x) \<in> borel_measurable M" |
|
2449 using f by (auto intro!: borel_measurable_ereal_times) |
|
2450 assume disj: "disjoint_family A" |
|
2451 have "(\<Sum>n. ?\<mu>' (A n)) = (\<integral>\<^isup>+ x. (\<Sum>n. max 0 (f x) * indicator (A n) x) \<partial>M)" |
|
2452 using f * by (simp add: positive_integral_suminf) |
|
2453 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * (\<Sum>n. indicator (A n) x) \<partial>M)" using f |
|
2454 by (auto intro!: suminf_cmult_ereal positive_integral_cong_AE) |
|
2455 also have "\<dots> = (\<integral>\<^isup>+ x. max 0 (f x) * indicator (\<Union>n. A n) x \<partial>M)" |
|
2456 unfolding suminf_indicator[OF disj] .. |
|
2457 finally show "(\<Sum>n. ?\<mu>' (A n)) = ?\<mu>' (\<Union>x. A x)" by simp |
|
2458 qed |
|
2459 qed fact |
|
2460 |
|
2461 lemma null_sets_density_iff: |
|
2462 assumes f: "f \<in> borel_measurable M" |
|
2463 shows "A \<in> null_sets (density M f) \<longleftrightarrow> A \<in> sets M \<and> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" |
|
2464 proof - |
|
2465 { assume "A \<in> sets M" |
|
2466 have eq: "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = (\<integral>\<^isup>+x. max 0 (f x) * indicator A x \<partial>M)" |
|
2467 apply (subst positive_integral_max_0[symmetric]) |
|
2468 apply (intro positive_integral_cong) |
|
2469 apply (auto simp: indicator_def) |
|
2470 done |
|
2471 have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> |
|
2472 emeasure M {x \<in> space M. max 0 (f x) * indicator A x \<noteq> 0} = 0" |
|
2473 unfolding eq |
|
2474 using f `A \<in> sets M` |
|
2475 by (intro positive_integral_0_iff) auto |
|
2476 also have "\<dots> \<longleftrightarrow> (AE x in M. max 0 (f x) * indicator A x = 0)" |
|
2477 using f `A \<in> sets M` |
|
2478 by (intro AE_iff_measurable[OF _ refl, symmetric]) |
|
2479 (auto intro!: sets_Collect borel_measurable_ereal_eq) |
|
2480 also have "(AE x in M. max 0 (f x) * indicator A x = 0) \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" |
|
2481 by (auto simp add: indicator_def max_def split: split_if_asm) |
|
2482 finally have "(\<integral>\<^isup>+x. f x * indicator A x \<partial>M) = 0 \<longleftrightarrow> (AE x in M. x \<in> A \<longrightarrow> f x \<le> 0)" . } |
|
2483 with f show ?thesis |
|
2484 by (simp add: null_sets_def emeasure_density cong: conj_cong) |
|
2485 qed |
|
2486 |
|
2487 lemma AE_density: |
|
2488 assumes f: "f \<in> borel_measurable M" |
|
2489 shows "(AE x in density M f. P x) \<longleftrightarrow> (AE x in M. 0 < f x \<longrightarrow> P x)" |
|
2490 proof |
|
2491 assume "AE x in density M f. P x" |
|
2492 with f obtain N where "{x \<in> space M. \<not> P x} \<subseteq> N" "N \<in> sets M" and ae: "AE x in M. x \<in> N \<longrightarrow> f x \<le> 0" |
|
2493 by (auto simp: eventually_ae_filter null_sets_density_iff) |
|
2494 then have "AE x in M. x \<notin> N \<longrightarrow> P x" by auto |
|
2495 with ae show "AE x in M. 0 < f x \<longrightarrow> P x" |
|
2496 by (rule eventually_elim2) auto |
|
2497 next |
|
2498 fix N assume ae: "AE x in M. 0 < f x \<longrightarrow> P x" |
|
2499 then obtain N where "{x \<in> space M. \<not> (0 < f x \<longrightarrow> P x)} \<subseteq> N" "N \<in> null_sets M" |
|
2500 by (auto simp: eventually_ae_filter) |
|
2501 then have *: "{x \<in> space (density M f). \<not> P x} \<subseteq> N \<union> {x\<in>space M. \<not> 0 < f x}" |
|
2502 "N \<union> {x\<in>space M. \<not> 0 < f x} \<in> sets M" and ae2: "AE x in M. x \<notin> N" |
|
2503 using f by (auto simp: subset_eq intro!: sets_Collect_neg AE_not_in) |
|
2504 show "AE x in density M f. P x" |
|
2505 using ae2 |
|
2506 unfolding eventually_ae_filter[of _ "density M f"] Bex_def null_sets_density_iff[OF f] |
|
2507 by (intro exI[of _ "N \<union> {x\<in>space M. \<not> 0 < f x}"] conjI *) |
|
2508 (auto elim: eventually_elim2) |
|
2509 qed |
|
2510 |
|
2511 lemma positive_integral_density: |
|
2512 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
|
2513 assumes g': "g' \<in> borel_measurable M" |
|
2514 shows "integral\<^isup>P (density M f) g' = (\<integral>\<^isup>+ x. f x * g' x \<partial>M)" |
|
2515 proof - |
|
2516 def g \<equiv> "\<lambda>x. max 0 (g' x)" |
|
2517 then have g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
|
2518 using g' by auto |
|
2519 from borel_measurable_implies_simple_function_sequence'[OF g(1)] guess G . note G = this |
|
2520 note G' = borel_measurable_simple_function[OF this(1)] simple_functionD[OF G(1)] |
|
2521 note G'(2)[simp] |
|
2522 { fix P have "AE x in M. P x \<Longrightarrow> AE x in M. P x" |
|
2523 using positive_integral_null_set[of _ _ f] |
|
2524 by (auto simp: eventually_ae_filter ) } |
|
2525 note ac = this |
|
2526 with G(4) f g have G_M': "AE x in density M f. (SUP i. G i x) = g x" |
|
2527 by (auto simp add: AE_density[OF f(1)] max_def) |
|
2528 { fix i |
|
2529 let ?I = "\<lambda>y x. indicator (G i -` {y} \<inter> space M) x" |
|
2530 { fix x assume *: "x \<in> space M" "0 \<le> f x" "0 \<le> g x" |
|
2531 then have [simp]: "G i ` space M \<inter> {y. G i x = y \<and> x \<in> space M} = {G i x}" by auto |
|
2532 from * G' G have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * (\<Sum>y\<in>G i`space M. (y * ?I y x))" |
|
2533 by (subst setsum_ereal_right_distrib) (auto simp: ac_simps) |
|
2534 also have "\<dots> = f x * G i x" |
|
2535 by (simp add: indicator_def if_distrib setsum_cases) |
|
2536 finally have "(\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) = f x * G i x" . } |
|
2537 note to_singleton = this |
|
2538 have "integral\<^isup>P (density M f) (G i) = integral\<^isup>S (density M f) (G i)" |
|
2539 using G by (intro positive_integral_eq_simple_integral) simp_all |
|
2540 also have "\<dots> = (\<Sum>y\<in>G i`space M. y * (\<integral>\<^isup>+x. f x * ?I y x \<partial>M))" |
|
2541 using f G(1) |
|
2542 by (auto intro!: setsum_cong arg_cong2[where f="op *"] emeasure_density |
|
2543 simp: simple_function_def simple_integral_def) |
|
2544 also have "\<dots> = (\<Sum>y\<in>G i`space M. (\<integral>\<^isup>+x. y * (f x * ?I y x) \<partial>M))" |
|
2545 using f G' G by (auto intro!: setsum_cong positive_integral_cmult[symmetric]) |
|
2546 also have "\<dots> = (\<integral>\<^isup>+x. (\<Sum>y\<in>G i`space M. y * (f x * ?I y x)) \<partial>M)" |
|
2547 using f G' G by (auto intro!: positive_integral_setsum[symmetric]) |
|
2548 finally have "integral\<^isup>P (density M f) (G i) = (\<integral>\<^isup>+x. f x * G i x \<partial>M)" |
|
2549 using f g G' to_singleton by (auto intro!: positive_integral_cong_AE) } |
|
2550 note [simp] = this |
|
2551 have "integral\<^isup>P (density M f) g = (SUP i. integral\<^isup>P (density M f) (G i))" using G'(1) G_M'(1) G |
|
2552 using positive_integral_monotone_convergence_SUP[symmetric, OF `incseq G`, of "density M f"] |
|
2553 by (simp cong: positive_integral_cong_AE) |
|
2554 also have "\<dots> = (SUP i. (\<integral>\<^isup>+x. f x * G i x \<partial>M))" by simp |
|
2555 also have "\<dots> = (\<integral>\<^isup>+x. (SUP i. f x * G i x) \<partial>M)" |
|
2556 using f G' G(2)[THEN incseq_SucD] G |
|
2557 by (intro positive_integral_monotone_convergence_SUP_AE[symmetric]) |
|
2558 (auto simp: ereal_mult_left_mono le_fun_def ereal_zero_le_0_iff) |
|
2559 also have "\<dots> = (\<integral>\<^isup>+x. f x * g x \<partial>M)" using f G' G g |
|
2560 by (intro positive_integral_cong_AE) |
|
2561 (auto simp add: SUPR_ereal_cmult split: split_max) |
|
2562 also have "\<dots> = (\<integral>\<^isup>+x. f x * g' x \<partial>M)" |
|
2563 using f(2) |
|
2564 by (subst (2) positive_integral_max_0[symmetric]) |
|
2565 (auto simp: g_def max_def ereal_zero_le_0_iff intro!: positive_integral_cong_AE) |
|
2566 finally show "integral\<^isup>P (density M f) g' = (\<integral>\<^isup>+x. f x * g' x \<partial>M)" |
|
2567 unfolding g_def positive_integral_max_0 . |
|
2568 qed |
|
2569 |
|
2570 lemma integral_density: |
|
2571 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
|
2572 and g: "g \<in> borel_measurable M" |
|
2573 shows "integral\<^isup>L (density M f) g = (\<integral> x. f x * g x \<partial>M)" |
|
2574 and "integrable (density M f) g \<longleftrightarrow> integrable M (\<lambda>x. f x * g x)" |
|
2575 unfolding lebesgue_integral_def integrable_def using f g |
|
2576 by (auto simp: positive_integral_density) |
|
2577 |
|
2578 lemma emeasure_restricted: |
|
2579 assumes S: "S \<in> sets M" and X: "X \<in> sets M" |
|
2580 shows "emeasure (density M (indicator S)) X = emeasure M (S \<inter> X)" |
|
2581 proof - |
|
2582 have "emeasure (density M (indicator S)) X = (\<integral>\<^isup>+x. indicator S x * indicator X x \<partial>M)" |
|
2583 using S X by (simp add: emeasure_density) |
|
2584 also have "\<dots> = (\<integral>\<^isup>+x. indicator (S \<inter> X) x \<partial>M)" |
|
2585 by (auto intro!: positive_integral_cong simp: indicator_def) |
|
2586 also have "\<dots> = emeasure M (S \<inter> X)" |
|
2587 using S X by (simp add: Int) |
|
2588 finally show ?thesis . |
|
2589 qed |
|
2590 |
|
2591 lemma measure_restricted: |
|
2592 "S \<in> sets M \<Longrightarrow> X \<in> sets M \<Longrightarrow> measure (density M (indicator S)) X = measure M (S \<inter> X)" |
|
2593 by (simp add: emeasure_restricted measure_def) |
|
2594 |
|
2595 lemma (in finite_measure) finite_measure_restricted: |
|
2596 "S \<in> sets M \<Longrightarrow> finite_measure (density M (indicator S))" |
|
2597 by default (simp add: emeasure_restricted) |
|
2598 |
|
2599 lemma emeasure_density_const: |
|
2600 "A \<in> sets M \<Longrightarrow> 0 \<le> c \<Longrightarrow> emeasure (density M (\<lambda>_. c)) A = c * emeasure M A" |
|
2601 by (auto simp: positive_integral_cmult_indicator emeasure_density) |
|
2602 |
|
2603 lemma measure_density_const: |
|
2604 "A \<in> sets M \<Longrightarrow> 0 < c \<Longrightarrow> c \<noteq> \<infinity> \<Longrightarrow> measure (density M (\<lambda>_. c)) A = real c * measure M A" |
|
2605 by (auto simp: emeasure_density_const measure_def) |
|
2606 |
|
2607 lemma density_density_eq: |
|
2608 "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> AE x in M. 0 \<le> f x \<Longrightarrow> |
|
2609 density (density M f) g = density M (\<lambda>x. f x * g x)" |
|
2610 by (auto intro!: measure_eqI simp: emeasure_density positive_integral_density ac_simps) |
|
2611 |
|
2612 lemma distr_density_distr: |
|
2613 assumes T: "T \<in> measurable M M'" and T': "T' \<in> measurable M' M" |
|
2614 and inv: "\<forall>x\<in>space M. T' (T x) = x" |
|
2615 assumes f: "f \<in> borel_measurable M'" |
|
2616 shows "distr (density (distr M M' T) f) M T' = density M (f \<circ> T)" (is "?R = ?L") |
|
2617 proof (rule measure_eqI) |
|
2618 fix A assume A: "A \<in> sets ?R" |
2585 { fix x assume "x \<in> space M" |
2619 { fix x assume "x \<in> space M" |
2586 have "f x = (\<Sum>r\<in>f`space M. if x \<in> ?A r then r else 0)" |
2620 with sets_into_space[OF A] |
2587 using finite `x \<in> space M` by (simp add: setsum_cases) |
2621 have "indicator (T' -` A \<inter> space M') (T x) = (indicator A x :: ereal)" |
2588 also have "\<dots> = ?S x" |
2622 using T inv by (auto simp: indicator_def measurable_space) } |
2589 by (auto intro!: setsum_cong) |
2623 with A T T' f show "emeasure ?R A = emeasure ?L A" |
2590 finally have "f x = ?S x" . } |
2624 by (simp add: measurable_comp emeasure_density emeasure_distr |
2591 note f_eq = this |
2625 positive_integral_distr measurable_sets cong: positive_integral_cong) |
2592 |
2626 qed simp |
2593 have f_eq_S: "integrable M f \<longleftrightarrow> integrable M ?S" "integral\<^isup>L M f = integral\<^isup>L M ?S" |
2627 |
2594 by (auto intro!: integrable_cong integral_cong simp only: f_eq) |
2628 lemma density_density_divide: |
2595 |
2629 fixes f g :: "'a \<Rightarrow> real" |
2596 show "integrable M f" ?integral using fin f f_eq_S |
2630 assumes f: "f \<in> borel_measurable M" "AE x in M. 0 \<le> f x" |
2597 by (simp_all add: integral_cmul_indicator borel_measurable_vimage) |
2631 assumes g: "g \<in> borel_measurable M" "AE x in M. 0 \<le> g x" |
2598 qed |
2632 assumes ac: "AE x in M. f x = 0 \<longrightarrow> g x = 0" |
2599 |
2633 shows "density (density M f) (\<lambda>x. g x / f x) = density M g" |
2600 lemma (in finite_measure_space) simple_function_finite[simp, intro]: "simple_function M f" |
2634 proof - |
2601 unfolding simple_function_def using finite_space by auto |
2635 have "density M g = density M (\<lambda>x. f x * (g x / f x))" |
2602 |
2636 using f g ac by (auto intro!: density_cong measurable_If) |
2603 lemma (in finite_measure_space) borel_measurable_finite[intro, simp]: "f \<in> borel_measurable M" |
2637 then show ?thesis |
2604 by (auto intro: borel_measurable_simple_function) |
2638 using f g by (subst density_density_eq) auto |
2605 |
2639 qed |
2606 lemma (in finite_measure_space) positive_integral_finite_eq_setsum: |
2640 |
2607 assumes pos: "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x" |
2641 section {* Point measure *} |
2608 shows "integral\<^isup>P M f = (\<Sum>x \<in> space M. f x * \<mu> {x})" |
2642 |
2609 proof - |
2643 definition point_measure :: "'a set \<Rightarrow> ('a \<Rightarrow> ereal) \<Rightarrow> 'a measure" where |
2610 have *: "integral\<^isup>P M f = (\<integral>\<^isup>+ x. (\<Sum>y\<in>space M. f y * indicator {y} x) \<partial>M)" |
2644 "point_measure A f = density (count_space A) f" |
2611 by (auto intro!: positive_integral_cong simp add: indicator_def if_distrib setsum_cases[OF finite_space]) |
2645 |
2612 show ?thesis unfolding * using borel_measurable_finite[of f] pos |
2646 lemma |
2613 by (simp add: positive_integral_setsum positive_integral_cmult_indicator) |
2647 shows space_point_measure: "space (point_measure A f) = A" |
2614 qed |
2648 and sets_point_measure: "sets (point_measure A f) = Pow A" |
2615 |
2649 by (auto simp: point_measure_def) |
2616 lemma (in finite_measure_space) integral_finite_singleton: |
2650 |
2617 shows "integrable M f" |
2651 lemma measurable_point_measure_eq1[simp]: |
2618 and "integral\<^isup>L M f = (\<Sum>x \<in> space M. f x * real (\<mu> {x}))" (is ?I) |
2652 "g \<in> measurable (point_measure A f) M \<longleftrightarrow> g \<in> A \<rightarrow> space M" |
2619 proof - |
2653 unfolding point_measure_def by simp |
2620 have *: |
2654 |
2621 "(\<integral>\<^isup>+ x. max 0 (ereal (f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (f x)) * \<mu> {x})" |
2655 lemma measurable_point_measure_eq2_finite[simp]: |
2622 "(\<integral>\<^isup>+ x. max 0 (ereal (- f x)) \<partial>M) = (\<Sum>x \<in> space M. max 0 (ereal (- f x)) * \<mu> {x})" |
2656 "finite A \<Longrightarrow> |
2623 by (simp_all add: positive_integral_finite_eq_setsum) |
2657 g \<in> measurable M (point_measure A f) \<longleftrightarrow> |
2624 then show "integrable M f" using finite_space finite_measure |
2658 (g \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. g -` {a} \<inter> space M \<in> sets M))" |
2625 by (simp add: setsum_Pinfty integrable_def positive_integral_max_0 |
2659 unfolding point_measure_def by simp |
2626 split: split_max) |
2660 |
2627 show ?I using finite_measure * |
2661 lemma simple_function_point_measure[simp]: |
2628 apply (simp add: positive_integral_max_0 lebesgue_integral_def) |
2662 "simple_function (point_measure A f) g \<longleftrightarrow> finite (g ` A)" |
2629 apply (subst (1 2) setsum_real_of_ereal[symmetric]) |
2663 by (simp add: point_measure_def) |
2630 apply (simp_all split: split_max add: setsum_subtractf[symmetric]) |
2664 |
2631 apply (intro setsum_cong[OF refl]) |
2665 lemma emeasure_point_measure: |
2632 apply (simp split: split_max) |
2666 assumes A: "finite {a\<in>X. 0 < f a}" "X \<subseteq> A" |
2633 done |
2667 shows "emeasure (point_measure A f) X = (\<Sum>a|a\<in>X \<and> 0 < f a. f a)" |
2634 qed |
2668 proof - |
|
2669 have "{a. (a \<in> X \<longrightarrow> a \<in> A \<and> 0 < f a) \<and> a \<in> X} = {a\<in>X. 0 < f a}" |
|
2670 using `X \<subseteq> A` by auto |
|
2671 with A show ?thesis |
|
2672 by (simp add: emeasure_density positive_integral_count_space ereal_zero_le_0_iff |
|
2673 point_measure_def indicator_def) |
|
2674 qed |
|
2675 |
|
2676 lemma emeasure_point_measure_finite: |
|
2677 "finite A \<Longrightarrow> (\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (point_measure A f) X = (\<Sum>a|a\<in>X. f a)" |
|
2678 by (subst emeasure_point_measure) (auto dest: finite_subset intro!: setsum_mono_zero_left simp: less_le) |
|
2679 |
|
2680 lemma null_sets_point_measure_iff: |
|
2681 "X \<in> null_sets (point_measure A f) \<longleftrightarrow> X \<subseteq> A \<and> (\<forall>x\<in>X. f x \<le> 0)" |
|
2682 by (auto simp: AE_count_space null_sets_density_iff point_measure_def) |
|
2683 |
|
2684 lemma AE_point_measure: |
|
2685 "(AE x in point_measure A f. P x) \<longleftrightarrow> (\<forall>x\<in>A. 0 < f x \<longrightarrow> P x)" |
|
2686 unfolding point_measure_def |
|
2687 by (subst AE_density) (auto simp: AE_density AE_count_space point_measure_def) |
|
2688 |
|
2689 lemma positive_integral_point_measure: |
|
2690 "finite {a\<in>A. 0 < f a \<and> 0 < g a} \<Longrightarrow> |
|
2691 integral\<^isup>P (point_measure A f) g = (\<Sum>a|a\<in>A \<and> 0 < f a \<and> 0 < g a. f a * g a)" |
|
2692 unfolding point_measure_def |
|
2693 apply (subst density_max_0) |
|
2694 apply (subst positive_integral_density) |
|
2695 apply (simp_all add: AE_count_space positive_integral_density) |
|
2696 apply (subst positive_integral_count_space ) |
|
2697 apply (auto intro!: setsum_cong simp: max_def ereal_zero_less_0_iff) |
|
2698 apply (rule finite_subset) |
|
2699 prefer 2 |
|
2700 apply assumption |
|
2701 apply auto |
|
2702 done |
|
2703 |
|
2704 lemma positive_integral_point_measure_finite: |
|
2705 "finite A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a) \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> g a) \<Longrightarrow> |
|
2706 integral\<^isup>P (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)" |
|
2707 by (subst positive_integral_point_measure) (auto intro!: setsum_mono_zero_left simp: less_le) |
|
2708 |
|
2709 lemma lebesgue_integral_point_measure_finite: |
|
2710 "finite A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a) \<Longrightarrow> integral\<^isup>L (point_measure A f) g = (\<Sum>a\<in>A. f a * g a)" |
|
2711 by (simp add: lebesgue_integral_count_space_finite AE_count_space integral_density point_measure_def) |
|
2712 |
|
2713 lemma integrable_point_measure_finite: |
|
2714 "finite A \<Longrightarrow> integrable (point_measure A (\<lambda>x. ereal (f x))) g" |
|
2715 unfolding point_measure_def |
|
2716 apply (subst density_ereal_max_0) |
|
2717 apply (subst integral_density) |
|
2718 apply (auto simp: AE_count_space integrable_count_space) |
|
2719 done |
|
2720 |
|
2721 section {* Uniform measure *} |
|
2722 |
|
2723 definition "uniform_measure M A = density M (\<lambda>x. indicator A x / emeasure M A)" |
|
2724 |
|
2725 lemma |
|
2726 shows sets_uniform_measure[simp]: "sets (uniform_measure M A) = sets M" |
|
2727 and space_uniform_measure[simp]: "space (uniform_measure M A) = space M" |
|
2728 by (auto simp: uniform_measure_def) |
|
2729 |
|
2730 lemma emeasure_uniform_measure[simp]: |
|
2731 assumes A: "A \<in> sets M" and B: "B \<in> sets M" |
|
2732 shows "emeasure (uniform_measure M A) B = emeasure M (A \<inter> B) / emeasure M A" |
|
2733 proof - |
|
2734 from A B have "emeasure (uniform_measure M A) B = (\<integral>\<^isup>+x. (1 / emeasure M A) * indicator (A \<inter> B) x \<partial>M)" |
|
2735 by (auto simp add: uniform_measure_def emeasure_density split: split_indicator |
|
2736 intro!: positive_integral_cong) |
|
2737 also have "\<dots> = emeasure M (A \<inter> B) / emeasure M A" |
|
2738 using A B |
|
2739 by (subst positive_integral_cmult_indicator) (simp_all add: Int emeasure_nonneg) |
|
2740 finally show ?thesis . |
|
2741 qed |
|
2742 |
|
2743 lemma emeasure_neq_0_sets: "emeasure M A \<noteq> 0 \<Longrightarrow> A \<in> sets M" |
|
2744 using emeasure_notin_sets[of A M] by blast |
|
2745 |
|
2746 lemma measure_uniform_measure[simp]: |
|
2747 assumes A: "emeasure M A \<noteq> 0" "emeasure M A \<noteq> \<infinity>" and B: "B \<in> sets M" |
|
2748 shows "measure (uniform_measure M A) B = measure M (A \<inter> B) / measure M A" |
|
2749 using emeasure_uniform_measure[OF emeasure_neq_0_sets[OF A(1)] B] A |
|
2750 by (cases "emeasure M A" "emeasure M (A \<inter> B)" rule: ereal2_cases) (simp_all add: measure_def) |
|
2751 |
|
2752 section {* Uniform count measure *} |
|
2753 |
|
2754 definition "uniform_count_measure A = point_measure A (\<lambda>x. 1 / card A)" |
|
2755 |
|
2756 lemma |
|
2757 shows space_uniform_count_measure: "space (uniform_count_measure A) = A" |
|
2758 and sets_uniform_count_measure: "sets (uniform_count_measure A) = Pow A" |
|
2759 unfolding uniform_count_measure_def by (auto simp: space_point_measure sets_point_measure) |
|
2760 |
|
2761 lemma emeasure_uniform_count_measure: |
|
2762 "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> emeasure (uniform_count_measure A) X = card X / card A" |
|
2763 by (simp add: real_eq_of_nat emeasure_point_measure_finite uniform_count_measure_def) |
|
2764 |
|
2765 lemma measure_uniform_count_measure: |
|
2766 "finite A \<Longrightarrow> X \<subseteq> A \<Longrightarrow> measure (uniform_count_measure A) X = card X / card A" |
|
2767 by (simp add: real_eq_of_nat emeasure_point_measure_finite uniform_count_measure_def measure_def) |
2635 |
2768 |
2636 end |
2769 end |