# HG changeset patch # User hoelzl # Date 1384280936 -3600 # Node ID 3b8e33d1a39a45744a362571b50516734b01b6ec # Parent dbb8ecfe13377168064d76390d6083022c30993e measure of a countable union diff -r dbb8ecfe1337 -r 3b8e33d1a39a src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Tue Nov 12 19:28:56 2013 +0100 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Tue Nov 12 19:28:56 2013 +0100 @@ -2521,6 +2521,61 @@ "f \ borel_measurable (count_space A)" by simp +lemma lessThan_eq_empty_iff: "{..< n::nat} = {} \ n = 0" + by auto + +lemma emeasure_UN_countable: + assumes sets: "\i. i \ I \ X i \ sets M" and I: "countable I" + assumes disj: "disjoint_family_on X I" + shows "emeasure M (UNION I X) = (\\<^sup>+i. emeasure M (X i) \count_space I)" +proof cases + assume "finite I" with sets disj show ?thesis + by (subst setsum_emeasure[symmetric]) + (auto intro!: setsum_cong simp add: max_def subset_eq positive_integral_count_space_finite emeasure_nonneg) +next + assume f: "\ finite I" + then have [intro]: "I \ {}" by auto + from from_nat_into_inj_infinite[OF I f] from_nat_into[OF this] disj + have disj2: "disjoint_family (\i. X (from_nat_into I i))" + unfolding disjoint_family_on_def by metis + + from f have "bij_betw (from_nat_into I) UNIV I" + using bij_betw_from_nat_into[OF I] by simp + then have "(\i\I. X i) = (\i. (X \ from_nat_into I) i)" + unfolding SUP_def image_compose by (simp add: bij_betw_def) + then have "emeasure M (UNION I X) = emeasure M (\i. X (from_nat_into I i))" + by simp + also have "\ = (\i. emeasure M (X (from_nat_into I i)))" + by (intro suminf_emeasure[symmetric] disj disj2) (auto intro!: sets from_nat_into[OF `I \ {}`]) + also have "\ = (\n. \\<^sup>+i. emeasure M (X i) * indicator {from_nat_into I n} i \count_space I)" + proof (intro arg_cong[where f=suminf] ext) + fix i + have eq: "{a \ I. 0 < emeasure M (X a) * indicator {from_nat_into I i} a} + = (if 0 < emeasure M (X (from_nat_into I i)) then {from_nat_into I i} else {})" + using ereal_0_less_1 + by (auto simp: ereal_zero_less_0_iff indicator_def from_nat_into `I \ {}` simp del: ereal_0_less_1) + have "(\\<^sup>+ ia. emeasure M (X ia) * indicator {from_nat_into I i} ia \count_space I) = + (if 0 < emeasure M (X (from_nat_into I i)) then emeasure M (X (from_nat_into I i)) else 0)" + by (subst positive_integral_count_space) (simp_all add: eq) + also have "\ = emeasure M (X (from_nat_into I i))" + by (simp add: less_le emeasure_nonneg) + finally show "emeasure M (X (from_nat_into I i)) = + \\<^sup>+ ia. emeasure M (X ia) * indicator {from_nat_into I i} ia \count_space I" .. + qed + also have "\ = (\\<^sup>+i. emeasure M (X i) \count_space I)" + apply (subst positive_integral_suminf[symmetric]) + apply (auto simp: emeasure_nonneg intro!: positive_integral_cong) + proof - + fix x assume "x \ I" + then have "(\i. emeasure M (X x) * indicator {from_nat_into I i} x) = (\i\{to_nat_on I x}. emeasure M (X x) * indicator {from_nat_into I i} x)" + by (intro suminf_finite) (auto simp: indicator_def I f) + also have "\ = emeasure M (X x)" + by (simp add: I f `x\I`) + finally show "(\i. emeasure M (X x) * indicator {from_nat_into I i} x) = emeasure M (X x)" . + qed + finally show ?thesis . +qed + section {* Measures with Restricted Space *} lemma positive_integral_restrict_space: diff -r dbb8ecfe1337 -r 3b8e33d1a39a src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Tue Nov 12 19:28:56 2013 +0100 +++ b/src/HOL/Probability/Probability_Measure.thy Tue Nov 12 19:28:56 2013 +0100 @@ -268,6 +268,31 @@ by (intro finite_measure_UNION) auto qed +lemma (in prob_space) prob_EX_countable: + assumes sets: "\i. i \ I \ {x\space M. P i x} \ sets M" and I: "countable I" + assumes disj: "AE x in M. \i\I. \j\I. P i x \ P j x \ i = j" + shows "\

(x in M. \i\I. P i x) = (\\<^sup>+i. \

(x in M. P i x) \count_space I)" +proof - + let ?N= "\x. \!i\I. P i x" + have "ereal (\

(x in M. \i\I. P i x)) = \

(x in M. (\i\I. P i x \ ?N x))" + unfolding ereal.inject + proof (rule prob_eq_AE) + show "AE x in M. (\i\I. P i x) = (\i\I. P i x \ ?N x)" + using disj by eventually_elim blast + qed (auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets)+ + also have "\

(x in M. (\i\I. P i x \ ?N x)) = emeasure M (\i\I. {x\space M. P i x \ ?N x})" + unfolding emeasure_eq_measure by (auto intro!: arg_cong[where f=prob]) + also have "\ = (\\<^sup>+i. emeasure M {x\space M. P i x \ ?N x} \count_space I)" + by (rule emeasure_UN_countable) + (auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets + simp: disjoint_family_on_def) + also have "\ = (\\<^sup>+i. \

(x in M. P i x) \count_space I)" + unfolding emeasure_eq_measure using disj + by (intro positive_integral_cong ereal.inject[THEN iffD2] prob_eq_AE) + (auto intro!: sets.sets_Collect_countable_Ex' sets.sets_Collect_conj sets.sets_Collect_countable_Ex1' I sets)+ + finally show ?thesis . +qed + lemma (in prob_space) cond_prob_eq_AE: assumes P: "AE x in M. Q x \ P x \ P' x" "{x\space M. P x} \ events" "{x\space M. P' x} \ events" assumes Q: "AE x in M. Q x \ Q' x" "{x\space M. Q x} \ events" "{x\space M. Q' x} \ events" diff -r dbb8ecfe1337 -r 3b8e33d1a39a src/HOL/Probability/Sigma_Algebra.thy --- a/src/HOL/Probability/Sigma_Algebra.thy Tue Nov 12 19:28:56 2013 +0100 +++ b/src/HOL/Probability/Sigma_Algebra.thy Tue Nov 12 19:28:56 2013 +0100 @@ -397,7 +397,7 @@ qed lemma (in sigma_algebra) sets_Collect_countable_Ex': - assumes "\i. {x\\. P i x} \ M" + assumes "\i. i \ I \ {x\\. P i x} \ M" assumes "countable I" shows "{x\\. \i\I. P i x} \ M" proof - @@ -406,6 +406,27 @@ by (auto intro!: countable_UN') qed +lemma (in sigma_algebra) sets_Collect_countable_All': + assumes "\i. i \ I \ {x\\. P i x} \ M" + assumes "countable I" + shows "{x\\. \i\I. P i x} \ M" +proof - + have "{x\\. \i\I. P i x} = (\i\I. {x\\. P i x}) \ \" by auto + with assms show ?thesis + by (cases "I = {}") (auto intro!: countable_INT') +qed + +lemma (in sigma_algebra) sets_Collect_countable_Ex1': + assumes "\i. i \ I \ {x\\. P i x} \ M" + assumes "countable I" + shows "{x\\. \!i\I. P i x} \ M" +proof - + have "{x\\. \!i\I. P i x} = {x\\. \i\I. P i x \ (\j\I. P j x \ i = j)}" + by auto + with assms show ?thesis + by (auto intro!: sets_Collect_countable_All' sets_Collect_countable_Ex' sets_Collect_conj sets_Collect_imp sets_Collect_const) +qed + lemmas (in sigma_algebra) sets_Collect = sets_Collect_imp sets_Collect_disj sets_Collect_conj sets_Collect_neg sets_Collect_const sets_Collect_countable_All sets_Collect_countable_Ex sets_Collect_countable_All @@ -1544,6 +1565,19 @@ shows "(\x. f (g x)) \ measurable M N" using measurable_compose[OF g f] . +lemma measurable_count_space_eq_countable: + assumes "countable A" + shows "f \ measurable M (count_space A) \ (f \ space M \ A \ (\a\A. f -` {a} \ space M \ sets M))" +proof - + { fix X assume "X \ A" "f \ space M \ A" + with `countable A` have "f -` X \ space M = (\a\X. f -` {a} \ space M)" "countable X" + by (auto dest: countable_subset) + moreover assume "\a\A. f -` {a} \ space M \ sets M" + ultimately have "f -` X \ space M \ sets M" + using `X \ A` by (auto intro!: sets.countable_UN' simp del: UN_simps) } + then show ?thesis + unfolding measurable_def by auto +qed subsection {* Extend measure *} @@ -1608,7 +1642,7 @@ subsection {* Sigma algebra generated by function preimages *} definition - "vimage_algebra M S f = sigma S ((\A. f -` A \ S) ` sets M)" + "vimage_algebra M S X = sigma S ((\A. X -` A \ S) ` sets M)" lemma sigma_algebra_preimages: fixes f :: "'x \ 'a"