src/HOL/Probability/Binary_Product_Measure.thy
changeset 59426 6fca83e88417
parent 59353 f0707dc3d9aa
child 59489 fd5d23cc0e97
equal deleted inserted replaced
59425:c5e79df8cc21 59426:6fca83e88417
   728     using fin_Pair apply simp
   728     using fin_Pair apply simp
   729     using X_subset apply (auto intro!: arg_cong[where f=card])
   729     using X_subset apply (auto intro!: arg_cong[where f=card])
   730     done
   730     done
   731 qed
   731 qed
   732 
   732 
       
   733 
       
   734 lemma emeasure_prod_count_space:
       
   735   assumes A: "A \<in> sets (count_space UNIV \<Otimes>\<^sub>M M)" (is "A \<in> sets (?A \<Otimes>\<^sub>M ?B)")
       
   736   shows "emeasure (?A \<Otimes>\<^sub>M ?B) A = (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. indicator A (x, y) \<partial>?B \<partial>?A)"
       
   737   by (rule emeasure_measure_of[OF pair_measure_def])
       
   738      (auto simp: countably_additive_def positive_def suminf_indicator nn_integral_nonneg A
       
   739                  nn_integral_suminf[symmetric] dest: sets.sets_into_space)
       
   740 
       
   741 lemma emeasure_prod_count_space_single[simp]: "emeasure (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) {x} = 1"
       
   742 proof -
       
   743   have [simp]: "\<And>a b x y. indicator {(a, b)} (x, y) = (indicator {a} x * indicator {b} y::ereal)"
       
   744     by (auto split: split_indicator)
       
   745   show ?thesis
       
   746     by (cases x)
       
   747        (auto simp: emeasure_prod_count_space nn_integral_cmult sets_Pair nn_integral_max_0 one_ereal_def[symmetric])
       
   748 qed
       
   749 
       
   750 lemma emeasure_count_space_prod_eq:
       
   751   fixes A :: "('a \<times> 'b) set"
       
   752   assumes A: "A \<in> sets (count_space UNIV \<Otimes>\<^sub>M count_space UNIV)" (is "A \<in> sets (?A \<Otimes>\<^sub>M ?B)")
       
   753   shows "emeasure (?A \<Otimes>\<^sub>M ?B) A = emeasure (count_space UNIV) A"
       
   754 proof -
       
   755   { fix A :: "('a \<times> 'b) set" assume "countable A"
       
   756     then have "emeasure (?A \<Otimes>\<^sub>M ?B) (\<Union>a\<in>A. {a}) = (\<integral>\<^sup>+a. emeasure (?A \<Otimes>\<^sub>M ?B) {a} \<partial>count_space A)"
       
   757       by (intro emeasure_UN_countable) (auto simp: sets_Pair disjoint_family_on_def)
       
   758     also have "\<dots> = (\<integral>\<^sup>+a. indicator A a \<partial>count_space UNIV)"
       
   759       by (subst nn_integral_count_space_indicator) auto
       
   760     finally have "emeasure (?A \<Otimes>\<^sub>M ?B) A = emeasure (count_space UNIV) A"
       
   761       by simp }
       
   762   note * = this
       
   763 
       
   764   show ?thesis
       
   765   proof cases
       
   766     assume "finite A" then show ?thesis
       
   767       by (intro * countable_finite)
       
   768   next
       
   769     assume "infinite A"
       
   770     then obtain C where "countable C" and "infinite C" and "C \<subseteq> A"
       
   771       by (auto dest: infinite_countable_subset')
       
   772     with A have "emeasure (?A \<Otimes>\<^sub>M ?B) C \<le> emeasure (?A \<Otimes>\<^sub>M ?B) A"
       
   773       by (intro emeasure_mono) auto
       
   774     also have "emeasure (?A \<Otimes>\<^sub>M ?B) C = emeasure (count_space UNIV) C"
       
   775       using `countable C` by (rule *)
       
   776     finally show ?thesis
       
   777       using `infinite C` `infinite A` by simp
       
   778   qed
       
   779 qed
       
   780 
       
   781 lemma nn_intergal_count_space_prod_eq':
       
   782   assumes [simp]: "\<And>x. 0 \<le> f x"
       
   783   shows "nn_integral (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = nn_integral (count_space UNIV) f"
       
   784     (is "nn_integral ?P f = _")
       
   785 proof cases
       
   786   assume cntbl: "countable {x. f x \<noteq> 0}"
       
   787   have [simp]: "\<And>x. ereal (real (card ({x} \<inter> {x. f x \<noteq> 0}))) = indicator {x. f x \<noteq> 0} x"
       
   788     by (auto split: split_indicator)
       
   789   have [measurable]: "\<And>y. (\<lambda>x. indicator {y} x) \<in> borel_measurable ?P"
       
   790     by (rule measurable_discrete_difference[of "\<lambda>x. 0" _ borel "{y}" "\<lambda>x. indicator {y} x" for y])
       
   791        (auto intro: sets_Pair)
       
   792 
       
   793   have "(\<integral>\<^sup>+x. f x \<partial>?P) = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x * indicator {x} x' \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
       
   794     by (auto simp add: nn_integral_cmult nn_integral_indicator' intro!: nn_integral_cong split: split_indicator)
       
   795   also have "\<dots> = (\<integral>\<^sup>+x. \<integral>\<^sup>+x'. f x' * indicator {x'} x \<partial>count_space {x. f x \<noteq> 0} \<partial>?P)"
       
   796     by (auto intro!: nn_integral_cong split: split_indicator)
       
   797   also have "\<dots> = (\<integral>\<^sup>+x'. \<integral>\<^sup>+x. f x' * indicator {x'} x \<partial>?P \<partial>count_space {x. f x \<noteq> 0})"
       
   798     by (intro nn_integral_count_space_nn_integral cntbl) auto
       
   799   also have "\<dots> = (\<integral>\<^sup>+x'. f x' \<partial>count_space {x. f x \<noteq> 0})"
       
   800     by (intro nn_integral_cong) (auto simp: nn_integral_cmult sets_Pair)
       
   801   finally show ?thesis
       
   802     by (auto simp add: nn_integral_count_space_indicator intro!: nn_integral_cong split: split_indicator)
       
   803 next
       
   804   { fix x assume "f x \<noteq> 0"
       
   805     with `0 \<le> f x` have "(\<exists>r. 0 < r \<and> f x = ereal r) \<or> f x = \<infinity>"
       
   806       by (cases "f x") (auto simp: less_le)
       
   807     then have "\<exists>n. ereal (1 / real (Suc n)) \<le> f x"
       
   808       by (auto elim!: nat_approx_posE intro!: less_imp_le) }
       
   809   note * = this
       
   810 
       
   811   assume cntbl: "uncountable {x. f x \<noteq> 0}"
       
   812   also have "{x. f x \<noteq> 0} = (\<Union>n. {x. 1/Suc n \<le> f x})"
       
   813     using * by auto
       
   814   finally obtain n where "infinite {x. 1/Suc n \<le> f x}"
       
   815     by (meson countableI_type countable_UN uncountable_infinite)
       
   816   then obtain C where C: "C \<subseteq> {x. 1/Suc n \<le> f x}" and "countable C" "infinite C"
       
   817     by (metis infinite_countable_subset')
       
   818 
       
   819   have [measurable]: "C \<in> sets ?P"
       
   820     using sets.countable[OF _ `countable C`, of ?P] by (auto simp: sets_Pair)
       
   821 
       
   822   have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>?P) \<le> nn_integral ?P f"
       
   823     using C by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
       
   824   moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>?P) = \<infinity>"
       
   825     using `infinite C` by (simp add: nn_integral_cmult emeasure_count_space_prod_eq)
       
   826   moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>count_space UNIV) \<le> nn_integral (count_space UNIV) f"
       
   827     using C by (intro nn_integral_mono) (auto split: split_indicator simp: zero_ereal_def[symmetric])
       
   828   moreover have "(\<integral>\<^sup>+x. ereal (1/Suc n) * indicator C x \<partial>count_space UNIV) = \<infinity>"
       
   829     using `infinite C` by (simp add: nn_integral_cmult)
       
   830   ultimately show ?thesis
       
   831     by simp
       
   832 qed
       
   833 
       
   834 lemma nn_intergal_count_space_prod_eq:
       
   835   "nn_integral (count_space UNIV \<Otimes>\<^sub>M count_space UNIV) f = nn_integral (count_space UNIV) f"
       
   836   by (subst (1 2) nn_integral_max_0[symmetric]) (auto intro!: nn_intergal_count_space_prod_eq')
       
   837 
       
   838 
   733 lemma pair_measure_density:
   839 lemma pair_measure_density:
   734   assumes f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x"
   840   assumes f: "f \<in> borel_measurable M1" "AE x in M1. 0 \<le> f x"
   735   assumes g: "g \<in> borel_measurable M2" "AE x in M2. 0 \<le> g x"
   841   assumes g: "g \<in> borel_measurable M2" "AE x in M2. 0 \<le> g x"
   736   assumes "sigma_finite_measure M2" "sigma_finite_measure (density M2 g)"
   842   assumes "sigma_finite_measure M2" "sigma_finite_measure (density M2 g)"
   737   shows "density M1 f \<Otimes>\<^sub>M density M2 g = density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x,y). f x * g y)" (is "?L = ?R")
   843   shows "density M1 f \<Otimes>\<^sub>M density M2 g = density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x,y). f x * g y)" (is "?L = ?R")