520 |
520 |
521 definition "distributed M N X f \<longleftrightarrow> distr M N X = density N f \<and> |
521 definition "distributed M N X f \<longleftrightarrow> distr M N X = density N f \<and> |
522 f \<in> borel_measurable N \<and> (AE x in N. 0 \<le> f x) \<and> X \<in> measurable M N" |
522 f \<in> borel_measurable N \<and> (AE x in N. 0 \<le> f x) \<and> X \<in> measurable M N" |
523 |
523 |
524 lemma |
524 lemma |
525 shows distributed_distr_eq_density: "distributed M N X f \<Longrightarrow> distr M N X = density N f" |
525 assumes "distributed M N X f" |
526 and distributed_measurable: "distributed M N X f \<Longrightarrow> X \<in> measurable M N" |
526 shows distributed_distr_eq_density: "distr M N X = density N f" |
527 and distributed_borel_measurable: "distributed M N X f \<Longrightarrow> f \<in> borel_measurable N" |
527 and distributed_measurable: "X \<in> measurable M N" |
528 and distributed_AE: "distributed M N X f \<Longrightarrow> (AE x in N. 0 \<le> f x)" |
528 and distributed_borel_measurable: "f \<in> borel_measurable N" |
529 by (simp_all add: distributed_def) |
529 and distributed_AE: "(AE x in N. 0 \<le> f x)" |
|
530 using assms by (simp_all add: distributed_def) |
|
531 |
|
532 lemma |
|
533 assumes D: "distributed M N X f" |
|
534 shows distributed_measurable'[measurable_dest]: |
|
535 "g \<in> measurable L M \<Longrightarrow> (\<lambda>x. X (g x)) \<in> measurable L N" |
|
536 and distributed_borel_measurable'[measurable_dest]: |
|
537 "h \<in> measurable L N \<Longrightarrow> (\<lambda>x. f (h x)) \<in> borel_measurable L" |
|
538 using distributed_measurable[OF D] distributed_borel_measurable[OF D] |
|
539 by simp_all |
530 |
540 |
531 lemma |
541 lemma |
532 shows distributed_real_measurable: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> f \<in> borel_measurable N" |
542 shows distributed_real_measurable: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> f \<in> borel_measurable N" |
533 and distributed_real_AE: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> (AE x in N. 0 \<le> f x)" |
543 and distributed_real_AE: "distributed M N X (\<lambda>x. ereal (f x)) \<Longrightarrow> (AE x in N. 0 \<le> f x)" |
534 by (simp_all add: distributed_def borel_measurable_ereal_iff) |
544 by (simp_all add: distributed_def borel_measurable_ereal_iff) |
535 |
545 |
|
546 lemma |
|
547 assumes D: "distributed M N X (\<lambda>x. ereal (f x))" |
|
548 shows distributed_real_measurable'[measurable_dest]: |
|
549 "h \<in> measurable L N \<Longrightarrow> (\<lambda>x. f (h x)) \<in> borel_measurable L" |
|
550 using distributed_real_measurable[OF D] |
|
551 by simp_all |
|
552 |
|
553 lemma |
|
554 assumes D: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) f" |
|
555 shows joint_distributed_measurable1[measurable_dest]: |
|
556 "h1 \<in> measurable N M \<Longrightarrow> (\<lambda>x. X (h1 x)) \<in> measurable N S" |
|
557 and joint_distributed_measurable2[measurable_dest]: |
|
558 "h2 \<in> measurable N M \<Longrightarrow> (\<lambda>x. Y (h2 x)) \<in> measurable N T" |
|
559 using measurable_compose[OF distributed_measurable[OF D] measurable_fst] |
|
560 using measurable_compose[OF distributed_measurable[OF D] measurable_snd] |
|
561 by auto |
|
562 |
536 lemma distributed_count_space: |
563 lemma distributed_count_space: |
537 assumes X: "distributed M (count_space A) X P" and a: "a \<in> A" and A: "finite A" |
564 assumes X: "distributed M (count_space A) X P" and a: "a \<in> A" and A: "finite A" |
538 shows "P a = emeasure M (X -` {a} \<inter> space M)" |
565 shows "P a = emeasure M (X -` {a} \<inter> space M)" |
539 proof - |
566 proof - |
540 have "emeasure M (X -` {a} \<inter> space M) = emeasure (distr M (count_space A) X) {a}" |
567 have "emeasure M (X -` {a} \<inter> space M) = emeasure (distr M (count_space A) X) {a}" |
541 using X a A by (simp add: distributed_measurable emeasure_distr) |
568 using X a A by (simp add: emeasure_distr) |
542 also have "\<dots> = emeasure (density (count_space A) P) {a}" |
569 also have "\<dots> = emeasure (density (count_space A) P) {a}" |
543 using X by (simp add: distributed_distr_eq_density) |
570 using X by (simp add: distributed_distr_eq_density) |
544 also have "\<dots> = (\<integral>\<^isup>+x. P a * indicator {a} x \<partial>count_space A)" |
571 also have "\<dots> = (\<integral>\<^isup>+x. P a * indicator {a} x \<partial>count_space A)" |
545 using X a by (auto simp add: emeasure_density distributed_def indicator_def intro!: positive_integral_cong) |
572 using X a by (auto simp add: emeasure_density distributed_def indicator_def intro!: positive_integral_cong) |
546 also have "\<dots> = P a" |
573 also have "\<dots> = P a" |
581 shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0" |
608 shows "AE x in P. g (T x) = 0 \<longrightarrow> f x = 0" |
582 using subdensity[OF T, of M X "\<lambda>x. ereal (f x)" Y "\<lambda>x. ereal (g x)"] assms by auto |
609 using subdensity[OF T, of M X "\<lambda>x. ereal (f x)" Y "\<lambda>x. ereal (g x)"] assms by auto |
583 |
610 |
584 lemma distributed_emeasure: |
611 lemma distributed_emeasure: |
585 "distributed M N X f \<Longrightarrow> A \<in> sets N \<Longrightarrow> emeasure M (X -` A \<inter> space M) = (\<integral>\<^isup>+x. f x * indicator A x \<partial>N)" |
612 "distributed M N X f \<Longrightarrow> A \<in> sets N \<Longrightarrow> emeasure M (X -` A \<inter> space M) = (\<integral>\<^isup>+x. f x * indicator A x \<partial>N)" |
586 by (auto simp: distributed_measurable distributed_AE distributed_borel_measurable |
613 by (auto simp: distributed_AE |
587 distributed_distr_eq_density[symmetric] emeasure_density[symmetric] emeasure_distr) |
614 distributed_distr_eq_density[symmetric] emeasure_density[symmetric] emeasure_distr) |
588 |
615 |
589 lemma distributed_positive_integral: |
616 lemma distributed_positive_integral: |
590 "distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>\<^isup>+x. f x * g x \<partial>N) = (\<integral>\<^isup>+x. g (X x) \<partial>M)" |
617 "distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>\<^isup>+x. f x * g x \<partial>N) = (\<integral>\<^isup>+x. g (X x) \<partial>M)" |
591 by (auto simp: distributed_measurable distributed_AE distributed_borel_measurable |
618 by (auto simp: distributed_AE |
592 distributed_distr_eq_density[symmetric] positive_integral_density[symmetric] positive_integral_distr) |
619 distributed_distr_eq_density[symmetric] positive_integral_density[symmetric] positive_integral_distr) |
593 |
620 |
594 lemma distributed_integral: |
621 lemma distributed_integral: |
595 "distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>x. f x * g x \<partial>N) = (\<integral>x. g (X x) \<partial>M)" |
622 "distributed M N X f \<Longrightarrow> g \<in> borel_measurable N \<Longrightarrow> (\<integral>x. f x * g x \<partial>N) = (\<integral>x. g (X x) \<partial>M)" |
596 by (auto simp: distributed_real_measurable distributed_real_AE distributed_measurable |
623 by (auto simp: distributed_real_AE |
597 distributed_distr_eq_density[symmetric] integral_density[symmetric] integral_distr) |
624 distributed_distr_eq_density[symmetric] integral_density[symmetric] integral_distr) |
598 |
625 |
599 lemma distributed_transform_integral: |
626 lemma distributed_transform_integral: |
600 assumes Px: "distributed M N X Px" |
627 assumes Px: "distributed M N X Px" |
601 assumes "distributed M P Y Py" |
628 assumes "distributed M P Y Py" |
615 assumes Px: "distributed M S X Px" |
642 assumes Px: "distributed M S X Px" |
616 assumes Py: "distributed M S X Py" |
643 assumes Py: "distributed M S X Py" |
617 shows "AE x in S. Px x = Py x" |
644 shows "AE x in S. Px x = Py x" |
618 proof - |
645 proof - |
619 interpret X: prob_space "distr M S X" |
646 interpret X: prob_space "distr M S X" |
620 using distributed_measurable[OF Px] by (rule prob_space_distr) |
647 using Px by (intro prob_space_distr) simp |
621 have "sigma_finite_measure (distr M S X)" .. |
648 have "sigma_finite_measure (distr M S X)" .. |
622 with sigma_finite_density_unique[of Px S Py ] Px Py |
649 with sigma_finite_density_unique[of Px S Py ] Px Py |
623 show ?thesis |
650 show ?thesis |
624 by (auto simp: distributed_def) |
651 by (auto simp: distributed_def) |
625 qed |
652 qed |
626 |
653 |
627 lemma (in prob_space) distributed_jointI: |
654 lemma (in prob_space) distributed_jointI: |
628 assumes "sigma_finite_measure S" "sigma_finite_measure T" |
655 assumes "sigma_finite_measure S" "sigma_finite_measure T" |
629 assumes X[simp]: "X \<in> measurable M S" and Y[simp]: "Y \<in> measurable M T" |
656 assumes X[measurable]: "X \<in> measurable M S" and Y[measurable]: "Y \<in> measurable M T" |
630 assumes f[simp]: "f \<in> borel_measurable (S \<Otimes>\<^isub>M T)" "AE x in S \<Otimes>\<^isub>M T. 0 \<le> f x" |
657 assumes [measurable]: "f \<in> borel_measurable (S \<Otimes>\<^isub>M T)" and f: "AE x in S \<Otimes>\<^isub>M T. 0 \<le> f x" |
631 assumes eq: "\<And>A B. A \<in> sets S \<Longrightarrow> B \<in> sets T \<Longrightarrow> |
658 assumes eq: "\<And>A B. A \<in> sets S \<Longrightarrow> B \<in> sets T \<Longrightarrow> |
632 emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B} = (\<integral>\<^isup>+x. (\<integral>\<^isup>+y. f (x, y) * indicator B y \<partial>T) * indicator A x \<partial>S)" |
659 emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B} = (\<integral>\<^isup>+x. (\<integral>\<^isup>+y. f (x, y) * indicator B y \<partial>T) * indicator A x \<partial>S)" |
633 shows "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) f" |
660 shows "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) f" |
634 unfolding distributed_def |
661 unfolding distributed_def |
635 proof safe |
662 proof safe |
653 by (rule prob_space_distr) (auto intro!: measurable_Pair) |
680 by (rule prob_space_distr) (auto intro!: measurable_Pair) |
654 show "range F \<subseteq> ?E" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?L (F i) \<noteq> \<infinity>" |
681 show "range F \<subseteq> ?E" "(\<Union>i. F i) = space ?P" "\<And>i. emeasure ?L (F i) \<noteq> \<infinity>" |
655 using F by (auto simp: space_pair_measure) |
682 using F by (auto simp: space_pair_measure) |
656 next |
683 next |
657 fix E assume "E \<in> ?E" |
684 fix E assume "E \<in> ?E" |
658 then obtain A B where E[simp]: "E = A \<times> B" and A[simp]: "A \<in> sets S" and B[simp]: "B \<in> sets T" by auto |
685 then obtain A B where E[simp]: "E = A \<times> B" |
|
686 and A[measurable]: "A \<in> sets S" and B[measurable]: "B \<in> sets T" by auto |
659 have "emeasure ?L E = emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B}" |
687 have "emeasure ?L E = emeasure M {x \<in> space M. X x \<in> A \<and> Y x \<in> B}" |
660 by (auto intro!: arg_cong[where f="emeasure M"] simp add: emeasure_distr measurable_Pair) |
688 by (auto intro!: arg_cong[where f="emeasure M"] simp add: emeasure_distr measurable_Pair) |
661 also have "\<dots> = (\<integral>\<^isup>+x. (\<integral>\<^isup>+y. (f (x, y) * indicator B y) * indicator A x \<partial>T) \<partial>S)" |
689 also have "\<dots> = (\<integral>\<^isup>+x. (\<integral>\<^isup>+y. (f (x, y) * indicator B y) * indicator A x \<partial>T) \<partial>S)" |
662 by (auto simp add: eq measurable_Pair measurable_compose[OF _ f(1)] positive_integral_multc |
690 using f by (auto simp add: eq positive_integral_multc intro!: positive_integral_cong) |
663 intro!: positive_integral_cong) |
|
664 also have "\<dots> = emeasure ?R E" |
691 also have "\<dots> = emeasure ?R E" |
665 by (auto simp add: emeasure_density T.positive_integral_fst_measurable(2)[symmetric] |
692 by (auto simp add: emeasure_density T.positive_integral_fst_measurable(2)[symmetric] |
666 intro!: positive_integral_cong split: split_indicator) |
693 intro!: positive_integral_cong split: split_indicator) |
667 finally show "emeasure ?L E = emeasure ?R E" . |
694 finally show "emeasure ?L E = emeasure ?R E" . |
668 qed |
695 qed |
669 qed (auto intro!: measurable_Pair) |
696 qed (auto simp: f) |
670 |
697 |
671 lemma (in prob_space) distributed_swap: |
698 lemma (in prob_space) distributed_swap: |
672 assumes "sigma_finite_measure S" "sigma_finite_measure T" |
699 assumes "sigma_finite_measure S" "sigma_finite_measure T" |
673 assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
700 assumes Pxy: "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) Pxy" |
674 shows "distributed M (T \<Otimes>\<^isub>M S) (\<lambda>x. (Y x, X x)) (\<lambda>(x, y). Pxy (y, x))" |
701 shows "distributed M (T \<Otimes>\<^isub>M S) (\<lambda>x. (Y x, X x)) (\<lambda>(x, y). Pxy (y, x))" |
676 interpret S: sigma_finite_measure S by fact |
703 interpret S: sigma_finite_measure S by fact |
677 interpret T: sigma_finite_measure T by fact |
704 interpret T: sigma_finite_measure T by fact |
678 interpret ST: pair_sigma_finite S T by default |
705 interpret ST: pair_sigma_finite S T by default |
679 interpret TS: pair_sigma_finite T S by default |
706 interpret TS: pair_sigma_finite T S by default |
680 |
707 |
681 note measurable_Pxy = measurable_compose[OF _ distributed_borel_measurable[OF Pxy]] |
708 note Pxy[measurable] |
682 show ?thesis |
709 show ?thesis |
683 apply (subst TS.distr_pair_swap) |
710 apply (subst TS.distr_pair_swap) |
684 unfolding distributed_def |
711 unfolding distributed_def |
685 proof safe |
712 proof safe |
686 let ?D = "distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x))" |
713 let ?D = "distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x))" |
687 show 1: "(\<lambda>(x, y). Pxy (y, x)) \<in> borel_measurable ?D" |
714 show 1: "(\<lambda>(x, y). Pxy (y, x)) \<in> borel_measurable ?D" |
688 by (auto simp: measurable_split_conv intro!: measurable_Pair measurable_Pxy) |
715 by auto |
689 with Pxy |
716 with Pxy |
690 show "AE x in distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x)). 0 \<le> (case x of (x, y) \<Rightarrow> Pxy (y, x))" |
717 show "AE x in distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x)). 0 \<le> (case x of (x, y) \<Rightarrow> Pxy (y, x))" |
691 by (subst AE_distr_iff) |
718 by (subst AE_distr_iff) |
692 (auto dest!: distributed_AE |
719 (auto dest!: distributed_AE |
693 simp: measurable_split_conv split_beta |
720 simp: measurable_split_conv split_beta |
694 intro!: measurable_Pair borel_measurable_ereal_le) |
721 intro!: measurable_Pair borel_measurable_ereal_le) |
695 show 2: "random_variable (distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x))) (\<lambda>x. (Y x, X x))" |
722 show 2: "random_variable (distr (S \<Otimes>\<^isub>M T) (T \<Otimes>\<^isub>M S) (\<lambda>(x, y). (y, x))) (\<lambda>x. (Y x, X x))" |
696 using measurable_compose[OF distributed_measurable[OF Pxy] measurable_fst] |
723 using Pxy by auto |
697 using measurable_compose[OF distributed_measurable[OF Pxy] measurable_snd] |
|
698 by (auto intro!: measurable_Pair) |
|
699 { fix A assume A: "A \<in> sets (T \<Otimes>\<^isub>M S)" |
724 { fix A assume A: "A \<in> sets (T \<Otimes>\<^isub>M S)" |
700 let ?B = "(\<lambda>(x, y). (y, x)) -` A \<inter> space (S \<Otimes>\<^isub>M T)" |
725 let ?B = "(\<lambda>(x, y). (y, x)) -` A \<inter> space (S \<Otimes>\<^isub>M T)" |
701 from sets_into_space[OF A] |
726 from sets_into_space[OF A] |
702 have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
727 have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
703 emeasure M ((\<lambda>x. (X x, Y x)) -` ?B \<inter> space M)" |
728 emeasure M ((\<lambda>x. (X x, Y x)) -` ?B \<inter> space M)" |
704 by (auto intro!: arg_cong2[where f=emeasure] simp: space_pair_measure) |
729 by (auto intro!: arg_cong2[where f=emeasure] simp: space_pair_measure) |
705 also have "\<dots> = (\<integral>\<^isup>+ x. Pxy x * indicator ?B x \<partial>(S \<Otimes>\<^isub>M T))" |
730 also have "\<dots> = (\<integral>\<^isup>+ x. Pxy x * indicator ?B x \<partial>(S \<Otimes>\<^isub>M T))" |
706 using Pxy A by (intro distributed_emeasure measurable_sets) (auto simp: measurable_split_conv measurable_Pair) |
731 using Pxy A by (intro distributed_emeasure) auto |
707 finally have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
732 finally have "emeasure M ((\<lambda>x. (Y x, X x)) -` A \<inter> space M) = |
708 (\<integral>\<^isup>+ x. Pxy x * indicator A (snd x, fst x) \<partial>(S \<Otimes>\<^isub>M T))" |
733 (\<integral>\<^isup>+ x. Pxy x * indicator A (snd x, fst x) \<partial>(S \<Otimes>\<^isub>M T))" |
709 by (auto intro!: positive_integral_cong split: split_indicator) } |
734 by (auto intro!: positive_integral_cong split: split_indicator) } |
710 note * = this |
735 note * = this |
711 show "distr M ?D (\<lambda>x. (Y x, X x)) = density ?D (\<lambda>(x, y). Pxy (y, x))" |
736 show "distr M ?D (\<lambda>x. (Y x, X x)) = density ?D (\<lambda>(x, y). Pxy (y, x))" |
712 apply (intro measure_eqI) |
737 apply (intro measure_eqI) |
713 apply (simp_all add: emeasure_distr[OF 2] emeasure_density[OF 1]) |
738 apply (simp_all add: emeasure_distr[OF 2] emeasure_density[OF 1]) |
714 apply (subst positive_integral_distr) |
739 apply (subst positive_integral_distr) |
715 apply (auto intro!: measurable_pair measurable_Pxy * simp: comp_def split_beta) |
740 apply (auto intro!: * simp: comp_def split_beta) |
716 done |
741 done |
717 qed |
742 qed |
718 qed |
743 qed |
719 |
744 |
720 lemma (in prob_space) distr_marginal1: |
745 lemma (in prob_space) distr_marginal1: |
726 proof safe |
751 proof safe |
727 interpret S: sigma_finite_measure S by fact |
752 interpret S: sigma_finite_measure S by fact |
728 interpret T: sigma_finite_measure T by fact |
753 interpret T: sigma_finite_measure T by fact |
729 interpret ST: pair_sigma_finite S T by default |
754 interpret ST: pair_sigma_finite S T by default |
730 |
755 |
731 have XY: "(\<lambda>x. (X x, Y x)) \<in> measurable M (S \<Otimes>\<^isub>M T)" |
756 note Pxy[measurable] |
732 using Pxy by (rule distributed_measurable) |
757 show X: "X \<in> measurable M S" by simp |
733 then show X: "X \<in> measurable M S" |
758 |
734 unfolding measurable_pair_iff by (simp add: comp_def) |
759 show borel: "Px \<in> borel_measurable S" |
735 from XY have Y: "Y \<in> measurable M T" |
760 by (auto intro!: T.positive_integral_fst_measurable simp: Px_def) |
736 unfolding measurable_pair_iff by (simp add: comp_def) |
|
737 |
|
738 from Pxy show borel: "Px \<in> borel_measurable S" |
|
739 by (auto intro!: T.positive_integral_fst_measurable dest!: distributed_borel_measurable simp: Px_def) |
|
740 |
761 |
741 interpret Pxy: prob_space "distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" |
762 interpret Pxy: prob_space "distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" |
742 using XY by (rule prob_space_distr) |
763 by (intro prob_space_distr) simp |
743 have "(\<integral>\<^isup>+ x. max 0 (- Pxy x) \<partial>(S \<Otimes>\<^isub>M T)) = (\<integral>\<^isup>+ x. 0 \<partial>(S \<Otimes>\<^isub>M T))" |
764 have "(\<integral>\<^isup>+ x. max 0 (- Pxy x) \<partial>(S \<Otimes>\<^isub>M T)) = (\<integral>\<^isup>+ x. 0 \<partial>(S \<Otimes>\<^isub>M T))" |
744 using Pxy |
765 using Pxy |
745 by (intro positive_integral_cong_AE) (auto simp: max_def dest: distributed_borel_measurable distributed_AE) |
766 by (intro positive_integral_cong_AE) (auto simp: max_def dest: distributed_AE) |
746 |
767 |
747 show "distr M S X = density S Px" |
768 show "distr M S X = density S Px" |
748 proof (rule measure_eqI) |
769 proof (rule measure_eqI) |
749 fix A assume A: "A \<in> sets (distr M S X)" |
770 fix A assume A: "A \<in> sets (distr M S X)" |
750 with X Y XY have "emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)" |
771 with X measurable_space[of Y M T] |
751 by (auto simp add: emeasure_distr |
772 have "emeasure (distr M S X) A = emeasure (distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))) (A \<times> space T)" |
752 intro!: arg_cong[where f="emeasure M"] dest: measurable_space) |
773 by (auto simp add: emeasure_distr intro!: arg_cong[where f="emeasure M"]) |
753 also have "\<dots> = emeasure (density (S \<Otimes>\<^isub>M T) Pxy) (A \<times> space T)" |
774 also have "\<dots> = emeasure (density (S \<Otimes>\<^isub>M T) Pxy) (A \<times> space T)" |
754 using Pxy by (simp add: distributed_def) |
775 using Pxy by (simp add: distributed_def) |
755 also have "\<dots> = \<integral>\<^isup>+ x. \<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T \<partial>S" |
776 also have "\<dots> = \<integral>\<^isup>+ x. \<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T \<partial>S" |
756 using A borel Pxy |
777 using A borel Pxy |
757 by (simp add: emeasure_density T.positive_integral_fst_measurable(2)[symmetric] distributed_def) |
778 by (simp add: emeasure_density T.positive_integral_fst_measurable(2)[symmetric]) |
758 also have "\<dots> = \<integral>\<^isup>+ x. Px x * indicator A x \<partial>S" |
779 also have "\<dots> = \<integral>\<^isup>+ x. Px x * indicator A x \<partial>S" |
759 apply (rule positive_integral_cong_AE) |
780 apply (rule positive_integral_cong_AE) |
760 using Pxy[THEN distributed_AE, THEN ST.AE_pair] AE_space |
781 using Pxy[THEN distributed_AE, THEN ST.AE_pair] AE_space |
761 proof eventually_elim |
782 proof eventually_elim |
762 fix x assume "x \<in> space S" "AE y in T. 0 \<le> Pxy (x, y)" |
783 fix x assume "x \<in> space S" "AE y in T. 0 \<le> Pxy (x, y)" |
763 moreover have eq: "\<And>y. y \<in> space T \<Longrightarrow> indicator (A \<times> space T) (x, y) = indicator A x" |
784 moreover have eq: "\<And>y. y \<in> space T \<Longrightarrow> indicator (A \<times> space T) (x, y) = indicator A x" |
764 by (auto simp: indicator_def) |
785 by (auto simp: indicator_def) |
765 ultimately have "(\<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = (\<integral>\<^isup>+ y. Pxy (x, y) \<partial>T) * indicator A x" |
786 ultimately have "(\<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = (\<integral>\<^isup>+ y. Pxy (x, y) \<partial>T) * indicator A x" |
766 using Pxy[THEN distributed_borel_measurable] by (simp add: eq positive_integral_multc measurable_Pair2 cong: positive_integral_cong) |
787 by (simp add: eq positive_integral_multc cong: positive_integral_cong) |
767 also have "(\<integral>\<^isup>+ y. Pxy (x, y) \<partial>T) = Px x" |
788 also have "(\<integral>\<^isup>+ y. Pxy (x, y) \<partial>T) = Px x" |
768 by (simp add: Px_def ereal_real positive_integral_positive) |
789 by (simp add: Px_def ereal_real positive_integral_positive) |
769 finally show "(\<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = Px x * indicator A x" . |
790 finally show "(\<integral>\<^isup>+ y. Pxy (x, y) * indicator (A \<times> space T) (x, y) \<partial>T) = Px x * indicator A x" . |
770 qed |
791 qed |
771 finally show "emeasure (distr M S X) A = emeasure (density S Px) A" |
792 finally show "emeasure (distr M S X) A = emeasure (density S Px) A" |
798 shows "AE y in T. Py y = (\<integral>\<^isup>+x. Pxy (x, y) \<partial>S)" |
819 shows "AE y in T. Py y = (\<integral>\<^isup>+x. Pxy (x, y) \<partial>S)" |
799 using Py distr_marginal2[OF S T Pxy] by (rule distributed_unique) |
820 using Py distr_marginal2[OF S T Pxy] by (rule distributed_unique) |
800 |
821 |
801 lemma (in prob_space) distributed_joint_indep': |
822 lemma (in prob_space) distributed_joint_indep': |
802 assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" |
823 assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" |
803 assumes X: "distributed M S X Px" and Y: "distributed M T Y Py" |
824 assumes X[measurable]: "distributed M S X Px" and Y[measurable]: "distributed M T Y Py" |
804 assumes indep: "distr M S X \<Otimes>\<^isub>M distr M T Y = distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" |
825 assumes indep: "distr M S X \<Otimes>\<^isub>M distr M T Y = distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" |
805 shows "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)" |
826 shows "distributed M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)" |
806 unfolding distributed_def |
827 unfolding distributed_def |
807 proof safe |
828 proof safe |
808 interpret S: sigma_finite_measure S by fact |
829 interpret S: sigma_finite_measure S by fact |
809 interpret T: sigma_finite_measure T by fact |
830 interpret T: sigma_finite_measure T by fact |
810 interpret ST: pair_sigma_finite S T by default |
831 interpret ST: pair_sigma_finite S T by default |
811 |
832 |
812 interpret X: prob_space "density S Px" |
833 interpret X: prob_space "density S Px" |
813 unfolding distributed_distr_eq_density[OF X, symmetric] |
834 unfolding distributed_distr_eq_density[OF X, symmetric] |
814 using distributed_measurable[OF X] |
835 by (rule prob_space_distr) simp |
815 by (rule prob_space_distr) |
|
816 have sf_X: "sigma_finite_measure (density S Px)" .. |
836 have sf_X: "sigma_finite_measure (density S Px)" .. |
817 |
837 |
818 interpret Y: prob_space "density T Py" |
838 interpret Y: prob_space "density T Py" |
819 unfolding distributed_distr_eq_density[OF Y, symmetric] |
839 unfolding distributed_distr_eq_density[OF Y, symmetric] |
820 using distributed_measurable[OF Y] |
840 by (rule prob_space_distr) simp |
821 by (rule prob_space_distr) |
|
822 have sf_Y: "sigma_finite_measure (density T Py)" .. |
841 have sf_Y: "sigma_finite_measure (density T Py)" .. |
823 |
842 |
824 show "distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) = density (S \<Otimes>\<^isub>M T) (\<lambda>(x, y). Px x * Py y)" |
843 show "distr M (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x)) = density (S \<Otimes>\<^isub>M T) (\<lambda>(x, y). Px x * Py y)" |
825 unfolding indep[symmetric] distributed_distr_eq_density[OF X] distributed_distr_eq_density[OF Y] |
844 unfolding indep[symmetric] distributed_distr_eq_density[OF X] distributed_distr_eq_density[OF Y] |
826 using distributed_borel_measurable[OF X] distributed_AE[OF X] |
845 using distributed_borel_measurable[OF X] distributed_AE[OF X] |
827 using distributed_borel_measurable[OF Y] distributed_AE[OF Y] |
846 using distributed_borel_measurable[OF Y] distributed_AE[OF Y] |
828 by (rule pair_measure_density[OF _ _ _ _ S T sf_X sf_Y]) |
847 by (rule pair_measure_density[OF _ _ _ _ T sf_Y]) |
829 |
848 |
830 show "random_variable (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" |
849 show "random_variable (S \<Otimes>\<^isub>M T) (\<lambda>x. (X x, Y x))" by auto |
831 using distributed_measurable[OF X] distributed_measurable[OF Y] |
850 |
832 by (auto intro: measurable_Pair) |
851 show Pxy: "(\<lambda>(x, y). Px x * Py y) \<in> borel_measurable (S \<Otimes>\<^isub>M T)" by auto |
833 |
|
834 show Pxy: "(\<lambda>(x, y). Px x * Py y) \<in> borel_measurable (S \<Otimes>\<^isub>M T)" |
|
835 by (auto simp: split_beta' |
|
836 intro!: measurable_compose[OF _ distributed_borel_measurable[OF X]] |
|
837 measurable_compose[OF _ distributed_borel_measurable[OF Y]]) |
|
838 |
852 |
839 show "AE x in S \<Otimes>\<^isub>M T. 0 \<le> (case x of (x, y) \<Rightarrow> Px x * Py y)" |
853 show "AE x in S \<Otimes>\<^isub>M T. 0 \<le> (case x of (x, y) \<Rightarrow> Px x * Py y)" |
840 apply (intro ST.AE_pair_measure borel_measurable_ereal_le Pxy borel_measurable_const) |
854 apply (intro ST.AE_pair_measure borel_measurable_ereal_le Pxy borel_measurable_const) |
841 using distributed_AE[OF X] |
855 using distributed_AE[OF X] |
842 apply eventually_elim |
856 apply eventually_elim |