author eberlm Thu, 31 Aug 2017 17:48:20 +0200 changeset 66568 52b5cf533fd6 parent 66567 dd47c9843598 child 66578 6a034c6c423f child 66704 7551bd9ff5c7
Connecting PMFs to infinite sums
```--- a/src/HOL/Analysis/Infinite_Set_Sum.thy	Thu Aug 31 14:32:23 2017 +0200
+++ b/src/HOL/Analysis/Infinite_Set_Sum.thy	Thu Aug 31 17:48:20 2017 +0200
@@ -350,6 +350,25 @@
shows   "(\<lambda>x. f x * c) abs_summable_on A"
using assms unfolding abs_summable_on_def by (intro Bochner_Integration.integrable_mult_left)

+lemma abs_summable_on_prod_PiE:
+  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c :: {real_normed_field,banach,second_countable_topology}"
+  assumes finite: "finite A" and countable: "\<And>x. x \<in> A \<Longrightarrow> countable (B x)"
+  assumes summable: "\<And>x. x \<in> A \<Longrightarrow> f x abs_summable_on B x"
+  shows   "(\<lambda>g. \<Prod>x\<in>A. f x (g x)) abs_summable_on PiE A B"
+proof -
+  define B' where "B' = (\<lambda>x. if x \<in> A then B x else {})"
+  from assms have [simp]: "countable (B' x)" for x
+    by (auto simp: B'_def)
+  then interpret product_sigma_finite "count_space \<circ> B'"
+    unfolding o_def by (intro product_sigma_finite.intro sigma_finite_measure_count_space_countable)
+  from assms have "integrable (PiM A (count_space \<circ> B')) (\<lambda>g. \<Prod>x\<in>A. f x (g x))"
+    by (intro product_integrable_prod) (auto simp: abs_summable_on_def B'_def)
+  also have "PiM A (count_space \<circ> B') = count_space (PiE A B')"
+    unfolding o_def using finite by (intro count_space_PiM_finite) simp_all
+  also have "PiE A B' = PiE A B" by (intro PiE_cong) (simp_all add: B'_def)
+  finally show ?thesis by (simp add: abs_summable_on_def)
+qed
+

lemma not_summable_infsetsum_eq:
@@ -366,6 +385,18 @@
by (subst integral_restrict_space [symmetric])
(auto simp: restrict_count_space_subset infsetsum_def)

+lemma nn_integral_conv_infsetsum:
+  assumes "f abs_summable_on A" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
+  shows   "nn_integral (count_space A) f = ennreal (infsetsum f A)"
+  using assms unfolding infsetsum_def abs_summable_on_def
+  by (subst nn_integral_eq_integral) auto
+
+lemma infsetsum_conv_nn_integral:
+  assumes "nn_integral (count_space A) f \<noteq> \<infinity>" "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0"
+  shows   "infsetsum f A = enn2real (nn_integral (count_space A) f)"
+  unfolding infsetsum_def using assms
+  by (subst integral_eq_nn_integral) auto
+
lemma infsetsum_cong [cong]:
"(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> A = B \<Longrightarrow> infsetsum f A = infsetsum g B"
unfolding infsetsum_def by (intro Bochner_Integration.integral_cong) auto```
```--- a/src/HOL/Probability/Probability_Mass_Function.thy	Thu Aug 31 14:32:23 2017 +0200
+++ b/src/HOL/Probability/Probability_Mass_Function.thy	Thu Aug 31 17:48:20 2017 +0200
@@ -529,6 +529,25 @@
shows "integral\<^sup>L (map_pmf g p) f = integral\<^sup>L p (\<lambda>x. f (g x))"

+lemma pmf_abs_summable [intro]: "pmf p abs_summable_on A"
+  by (rule abs_summable_on_subset[OF _ subset_UNIV])
+     (auto simp:  abs_summable_on_def integrable_iff_bounded nn_integral_pmf)
+
+lemma measure_pmf_conv_infsetsum: "measure (measure_pmf p) A = infsetsum (pmf p) A"
+  unfolding infsetsum_def by (simp add: integral_eq_nn_integral nn_integral_pmf measure_def)
+
+lemma infsetsum_pmf_eq_1:
+  assumes "set_pmf p \<subseteq> A"
+  shows   "infsetsum (pmf p) A = 1"
+proof -
+  have "infsetsum (pmf p) A = lebesgue_integral (count_space UNIV) (pmf p)"
+    using assms unfolding infsetsum_altdef
+    by (intro Bochner_Integration.integral_cong) (auto simp: indicator_def set_pmf_eq)
+  also have "\<dots> = 1"
+    by (subst integral_eq_nn_integral) (auto simp: nn_integral_pmf)
+  finally show ?thesis .
+qed
+
lemma map_return_pmf [simp]: "map_pmf f (return_pmf x) = return_pmf (f x)"

@@ -2079,6 +2098,20 @@
"measure (measure_pmf p) (A \<inter> set_pmf p) = measure (measure_pmf p) A"
using emeasure_Int_set_pmf[of p A] by (simp add: Sigma_Algebra.measure_def)

+lemma measure_prob_cong_0:
+  assumes "\<And>x. x \<in> A - B \<Longrightarrow> pmf p x = 0"
+  assumes "\<And>x. x \<in> B - A \<Longrightarrow> pmf p x = 0"
+  shows   "measure (measure_pmf p) A = measure (measure_pmf p) B"
+proof -
+  have "measure_pmf.prob p A = measure_pmf.prob p (A \<inter> set_pmf p)"