521 lemma set_measurable_continuous_on_ivl: |
522 lemma set_measurable_continuous_on_ivl: |
522 assumes "continuous_on {a..b} (f :: real \<Rightarrow> real)" |
523 assumes "continuous_on {a..b} (f :: real \<Rightarrow> real)" |
523 shows "set_borel_measurable borel {a..b} f" |
524 shows "set_borel_measurable borel {a..b} f" |
524 by (rule set_borel_measurable_continuous[OF _ assms]) simp |
525 by (rule set_borel_measurable_continuous[OF _ assms]) simp |
525 |
526 |
|
527 |
|
528 text{* This notation is from Sébastien Gouëzel: His use is not directly in line with the |
|
529 notations in this file, they are more in line with sum, and more readable he thinks. *} |
|
530 |
|
531 abbreviation "set_nn_integral M A f \<equiv> nn_integral M (\<lambda>x. f x * indicator A x)" |
|
532 |
|
533 syntax |
|
534 "_set_nn_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal" |
|
535 ("(\<integral>\<^sup>+((_)\<in>(_)./ _)/\<partial>_)" [0,60,110,61] 60) |
|
536 |
|
537 "_set_lebesgue_integral" :: "pttrn => 'a set => 'a measure => ereal => ereal" |
|
538 ("(\<integral>((_)\<in>(_)./ _)/\<partial>_)" [0,60,110,61] 60) |
|
539 |
|
540 translations |
|
541 "\<integral>\<^sup>+x \<in> A. f \<partial>M" == "CONST set_nn_integral M A (\<lambda>x. f)" |
|
542 "\<integral>x \<in> A. f \<partial>M" == "CONST set_lebesgue_integral M A (\<lambda>x. f)" |
|
543 |
|
544 lemma nn_integral_disjoint_pair: |
|
545 assumes [measurable]: "f \<in> borel_measurable M" |
|
546 "B \<in> sets M" "C \<in> sets M" |
|
547 "B \<inter> C = {}" |
|
548 shows "(\<integral>\<^sup>+x \<in> B \<union> C. f x \<partial>M) = (\<integral>\<^sup>+x \<in> B. f x \<partial>M) + (\<integral>\<^sup>+x \<in> C. f x \<partial>M)" |
|
549 proof - |
|
550 have mes: "\<And>D. D \<in> sets M \<Longrightarrow> (\<lambda>x. f x * indicator D x) \<in> borel_measurable M" by simp |
|
551 have pos: "\<And>D. AE x in M. f x * indicator D x \<ge> 0" using assms(2) by auto |
|
552 have "\<And>x. f x * indicator (B \<union> C) x = f x * indicator B x + f x * indicator C x" using assms(4) |
|
553 by (auto split: split_indicator) |
|
554 then have "(\<integral>\<^sup>+x. f x * indicator (B \<union> C) x \<partial>M) = (\<integral>\<^sup>+x. f x * indicator B x + f x * indicator C x \<partial>M)" |
|
555 by simp |
|
556 also have "... = (\<integral>\<^sup>+x. f x * indicator B x \<partial>M) + (\<integral>\<^sup>+x. f x * indicator C x \<partial>M)" |
|
557 by (rule nn_integral_add) (auto simp add: assms mes pos) |
|
558 finally show ?thesis by simp |
|
559 qed |
|
560 |
|
561 lemma nn_integral_disjoint_pair_countspace: |
|
562 assumes "B \<inter> C = {}" |
|
563 shows "(\<integral>\<^sup>+x \<in> B \<union> C. f x \<partial>count_space UNIV) = (\<integral>\<^sup>+x \<in> B. f x \<partial>count_space UNIV) + (\<integral>\<^sup>+x \<in> C. f x \<partial>count_space UNIV)" |
|
564 by (rule nn_integral_disjoint_pair) (simp_all add: assms) |
|
565 |
|
566 lemma nn_integral_null_delta: |
|
567 assumes "A \<in> sets M" "B \<in> sets M" |
|
568 "(A - B) \<union> (B - A) \<in> null_sets M" |
|
569 shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+x \<in> B. f x \<partial>M)" |
|
570 proof (rule nn_integral_cong_AE, auto simp add: indicator_def) |
|
571 have *: "AE a in M. a \<notin> (A - B) \<union> (B - A)" |
|
572 using assms(3) AE_not_in by blast |
|
573 then show "AE a in M. a \<notin> A \<longrightarrow> a \<in> B \<longrightarrow> f a = 0" |
|
574 by auto |
|
575 show "AE x\<in>A in M. x \<notin> B \<longrightarrow> f x = 0" |
|
576 using * by auto |
|
577 qed |
|
578 |
|
579 lemma nn_integral_disjoint_family: |
|
580 assumes [measurable]: "f \<in> borel_measurable M" "\<And>(n::nat). B n \<in> sets M" |
|
581 and "disjoint_family B" |
|
582 shows "(\<integral>\<^sup>+x \<in> (\<Union>n. B n). f x \<partial>M) = (\<Sum>n. (\<integral>\<^sup>+x \<in> B n. f x \<partial>M))" |
|
583 proof - |
|
584 have "(\<integral>\<^sup>+ x. (\<Sum>n. f x * indicator (B n) x) \<partial>M) = (\<Sum>n. (\<integral>\<^sup>+ x. f x * indicator (B n) x \<partial>M))" |
|
585 by (rule nn_integral_suminf) simp |
|
586 moreover have "(\<Sum>n. f x * indicator (B n) x) = f x * indicator (\<Union>n. B n) x" for x |
|
587 proof (cases) |
|
588 assume "x \<in> (\<Union>n. B n)" |
|
589 then obtain n where "x \<in> B n" by blast |
|
590 have a: "finite {n}" by simp |
|
591 have "\<And>i. i \<noteq> n \<Longrightarrow> x \<notin> B i" using `x \<in> B n` assms(3) disjoint_family_on_def |
|
592 by (metis IntI UNIV_I empty_iff) |
|
593 then have "\<And>i. i \<notin> {n} \<Longrightarrow> indicator (B i) x = (0::ennreal)" using indicator_def by simp |
|
594 then have b: "\<And>i. i \<notin> {n} \<Longrightarrow> f x * indicator (B i) x = (0::ennreal)" by simp |
|
595 |
|
596 define h where "h = (\<lambda>i. f x * indicator (B i) x)" |
|
597 then have "\<And>i. i \<notin> {n} \<Longrightarrow> h i = 0" using b by simp |
|
598 then have "(\<Sum>i. h i) = (\<Sum>i\<in>{n}. h i)" |
|
599 by (metis sums_unique[OF sums_finite[OF a]]) |
|
600 then have "(\<Sum>i. h i) = h n" by simp |
|
601 then have "(\<Sum>n. f x * indicator (B n) x) = f x * indicator (B n) x" using h_def by simp |
|
602 then have "(\<Sum>n. f x * indicator (B n) x) = f x" using `x \<in> B n` indicator_def by simp |
|
603 then show ?thesis using `x \<in> (\<Union>n. B n)` by auto |
|
604 next |
|
605 assume "x \<notin> (\<Union>n. B n)" |
|
606 then have "\<And>n. f x * indicator (B n) x = 0" by simp |
|
607 have "(\<Sum>n. f x * indicator (B n) x) = 0" |
|
608 by (simp add: `\<And>n. f x * indicator (B n) x = 0`) |
|
609 then show ?thesis using `x \<notin> (\<Union>n. B n)` by auto |
|
610 qed |
|
611 ultimately show ?thesis by simp |
|
612 qed |
|
613 |
|
614 lemma nn_set_integral_add: |
|
615 assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
|
616 "A \<in> sets M" |
|
617 shows "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x \<in> A. f x \<partial>M) + (\<integral>\<^sup>+x \<in> A. g x \<partial>M)" |
|
618 proof - |
|
619 have "(\<integral>\<^sup>+x \<in> A. (f x + g x) \<partial>M) = (\<integral>\<^sup>+x. (f x * indicator A x + g x * indicator A x) \<partial>M)" |
|
620 by (auto simp add: indicator_def intro!: nn_integral_cong) |
|
621 also have "... = (\<integral>\<^sup>+x. f x * indicator A x \<partial>M) + (\<integral>\<^sup>+x. g x * indicator A x \<partial>M)" |
|
622 apply (rule nn_integral_add) using assms(1) assms(2) by auto |
|
623 finally show ?thesis by simp |
|
624 qed |
|
625 |
|
626 lemma nn_set_integral_cong: |
|
627 assumes "AE x in M. f x = g x" |
|
628 shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+x \<in> A. g x \<partial>M)" |
|
629 apply (rule nn_integral_cong_AE) using assms(1) by auto |
|
630 |
|
631 lemma nn_set_integral_set_mono: |
|
632 "A \<subseteq> B \<Longrightarrow> (\<integral>\<^sup>+ x \<in> A. f x \<partial>M) \<le> (\<integral>\<^sup>+ x \<in> B. f x \<partial>M)" |
|
633 by (auto intro!: nn_integral_mono split: split_indicator) |
|
634 |
|
635 lemma nn_set_integral_mono: |
|
636 assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M" |
|
637 "A \<in> sets M" |
|
638 and "AE x\<in>A in M. f x \<le> g x" |
|
639 shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) \<le> (\<integral>\<^sup>+x \<in> A. g x \<partial>M)" |
|
640 by (auto intro!: nn_integral_mono_AE split: split_indicator simp: assms) |
|
641 |
|
642 lemma nn_set_integral_space [simp]: |
|
643 shows "(\<integral>\<^sup>+ x \<in> space M. f x \<partial>M) = (\<integral>\<^sup>+x. f x \<partial>M)" |
|
644 by (metis (mono_tags, lifting) indicator_simps(1) mult.right_neutral nn_integral_cong) |
|
645 |
|
646 lemma nn_integral_count_compose_inj: |
|
647 assumes "inj_on g A" |
|
648 shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)" |
|
649 proof - |
|
650 have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+x. f (g x) \<partial>count_space A)" |
|
651 by (auto simp add: nn_integral_count_space_indicator[symmetric]) |
|
652 also have "... = (\<integral>\<^sup>+y. f y \<partial>count_space (g`A))" |
|
653 by (simp add: assms nn_integral_bij_count_space inj_on_imp_bij_betw) |
|
654 also have "... = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)" |
|
655 by (auto simp add: nn_integral_count_space_indicator[symmetric]) |
|
656 finally show ?thesis by simp |
|
657 qed |
|
658 |
|
659 lemma nn_integral_count_compose_bij: |
|
660 assumes "bij_betw g A B" |
|
661 shows "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> B. f y \<partial>count_space UNIV)" |
|
662 proof - |
|
663 have "inj_on g A" using assms bij_betw_def by auto |
|
664 then have "(\<integral>\<^sup>+x \<in> A. f (g x) \<partial>count_space UNIV) = (\<integral>\<^sup>+y \<in> g`A. f y \<partial>count_space UNIV)" |
|
665 by (rule nn_integral_count_compose_inj) |
|
666 then show ?thesis using assms by (simp add: bij_betw_def) |
|
667 qed |
|
668 |
|
669 lemma set_integral_null_delta: |
|
670 fixes f::"_ \<Rightarrow> _ :: {banach, second_countable_topology}" |
|
671 assumes [measurable]: "integrable M f" "A \<in> sets M" "B \<in> sets M" |
|
672 and "(A - B) \<union> (B - A) \<in> null_sets M" |
|
673 shows "(\<integral>x \<in> A. f x \<partial>M) = (\<integral>x \<in> B. f x \<partial>M)" |
|
674 proof (rule set_integral_cong_set, auto) |
|
675 have *: "AE a in M. a \<notin> (A - B) \<union> (B - A)" |
|
676 using assms(4) AE_not_in by blast |
|
677 then show "AE x in M. (x \<in> B) = (x \<in> A)" |
|
678 by auto |
|
679 qed |
|
680 |
|
681 lemma set_integral_space: |
|
682 assumes "integrable M f" |
|
683 shows "(\<integral>x \<in> space M. f x \<partial>M) = (\<integral>x. f x \<partial>M)" |
|
684 by (metis (mono_tags, lifting) indicator_simps(1) Bochner_Integration.integral_cong real_vector.scale_one) |
|
685 |
|
686 lemma null_if_pos_func_has_zero_nn_int: |
|
687 fixes f::"'a \<Rightarrow> ennreal" |
|
688 assumes [measurable]: "f \<in> borel_measurable M" "A \<in> sets M" |
|
689 and "AE x\<in>A in M. f x > 0" "(\<integral>\<^sup>+x\<in>A. f x \<partial>M) = 0" |
|
690 shows "A \<in> null_sets M" |
|
691 proof - |
|
692 have "AE x in M. f x * indicator A x = 0" |
|
693 by (subst nn_integral_0_iff_AE[symmetric], auto simp add: assms(4)) |
|
694 then have "AE x\<in>A in M. False" using assms(3) by auto |
|
695 then show "A \<in> null_sets M" using assms(2) by (simp add: AE_iff_null_sets) |
|
696 qed |
|
697 |
|
698 lemma null_if_pos_func_has_zero_int: |
|
699 assumes [measurable]: "integrable M f" "A \<in> sets M" |
|
700 and "AE x\<in>A in M. f x > 0" "(\<integral>x\<in>A. f x \<partial>M) = (0::real)" |
|
701 shows "A \<in> null_sets M" |
|
702 proof - |
|
703 have "AE x in M. indicator A x * f x = 0" |
|
704 apply (subst integral_nonneg_eq_0_iff_AE[symmetric]) |
|
705 using assms integrable_mult_indicator[OF `A \<in> sets M` assms(1)] by auto |
|
706 then have "AE x\<in>A in M. f x = 0" by auto |
|
707 then have "AE x\<in>A in M. False" using assms(3) by auto |
|
708 then show "A \<in> null_sets M" using assms(2) by (simp add: AE_iff_null_sets) |
|
709 qed |
|
710 |
|
711 text{*The next lemma is a variant of \<open>density_unique\<close>. Note that it uses the notation |
|
712 for nonnegative set integrals introduced earlier.*} |
|
713 |
|
714 lemma (in sigma_finite_measure) density_unique2: |
|
715 assumes [measurable]: "f \<in> borel_measurable M" "f' \<in> borel_measurable M" |
|
716 assumes density_eq: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>\<^sup>+ x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+ x \<in> A. f' x \<partial>M)" |
|
717 shows "AE x in M. f x = f' x" |
|
718 proof (rule density_unique) |
|
719 show "density M f = density M f'" |
|
720 by (intro measure_eqI) (auto simp: emeasure_density intro!: density_eq) |
|
721 qed (auto simp add: assms) |
|
722 |
|
723 |
|
724 text {* The next lemma implies the same statement for Banach-space valued functions |
|
725 using Hahn-Banach theorem and linear forms. Since they are not yet easily available, I |
|
726 only formulate it for real-valued functions.*} |
|
727 |
|
728 lemma density_unique_real: |
|
729 fixes f f'::"_ \<Rightarrow> real" |
|
730 assumes [measurable]: "integrable M f" "integrable M f'" |
|
731 assumes density_eq: "\<And>A. A \<in> sets M \<Longrightarrow> (\<integral>x \<in> A. f x \<partial>M) = (\<integral>x \<in> A. f' x \<partial>M)" |
|
732 shows "AE x in M. f x = f' x" |
|
733 proof - |
|
734 define A where "A = {x \<in> space M. f x < f' x}" |
|
735 then have [measurable]: "A \<in> sets M" by simp |
|
736 have "(\<integral>x \<in> A. (f' x - f x) \<partial>M) = (\<integral>x \<in> A. f' x \<partial>M) - (\<integral>x \<in> A. f x \<partial>M)" |
|
737 using `A \<in> sets M` assms(1) assms(2) integrable_mult_indicator by blast |
|
738 then have "(\<integral>x \<in> A. (f' x - f x) \<partial>M) = 0" using assms(3) by simp |
|
739 then have "A \<in> null_sets M" |
|
740 using A_def null_if_pos_func_has_zero_int[where ?f = "\<lambda>x. f' x - f x" and ?A = A] assms by auto |
|
741 then have "AE x in M. x \<notin> A" by (simp add: AE_not_in) |
|
742 then have *: "AE x in M. f' x \<le> f x" unfolding A_def by auto |
|
743 |
|
744 |
|
745 define B where "B = {x \<in> space M. f' x < f x}" |
|
746 then have [measurable]: "B \<in> sets M" by simp |
|
747 have "(\<integral>x \<in> B. (f x - f' x) \<partial>M) = (\<integral>x \<in> B. f x \<partial>M) - (\<integral>x \<in> B. f' x \<partial>M)" |
|
748 using `B \<in> sets M` assms(1) assms(2) integrable_mult_indicator by blast |
|
749 then have "(\<integral>x \<in> B. (f x - f' x) \<partial>M) = 0" using assms(3) by simp |
|
750 then have "B \<in> null_sets M" |
|
751 using B_def null_if_pos_func_has_zero_int[where ?f = "\<lambda>x. f x - f' x" and ?A = B] assms by auto |
|
752 then have "AE x in M. x \<notin> B" by (simp add: AE_not_in) |
|
753 then have "AE x in M. f' x \<ge> f x" unfolding B_def by auto |
|
754 |
|
755 then show ?thesis using * by auto |
|
756 qed |
|
757 |
526 end |
758 end |
527 |
|