# HG changeset patch # User hoelzl # Date 1349863938 -7200 # Node ID 199d1d5bb17e65344fde047d1fd136ad8d7dc560 # Parent 970964690b3d795ef239e115398126b3761c8261 tuned product measurability diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Binary_Product_Measure.thy --- a/src/HOL/Probability/Binary_Product_Measure.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Binary_Product_Measure.thy Wed Oct 10 12:12:18 2012 +0200 @@ -43,6 +43,10 @@ unfolding pair_measure_def using space_closed[of A] space_closed[of B] by (intro sets_measure_of) auto +lemma sets_pair_measure_cong[cong]: + "sets M1 = sets M1' \ sets M2 = sets M2' \ sets (M1 \\<^isub>M M2) = sets (M1' \\<^isub>M M2')" + unfolding sets_pair_measure by (simp cong: sets_eq_imp_space_eq) + lemma pair_measureI[intro, simp]: "x \ sets A \ y \ sets B \ x \ y \ sets (A \\<^isub>M B)" by (auto simp: sets_pair_measure) @@ -54,21 +58,30 @@ unfolding pair_measure_def using 1 2 by (intro measurable_measure_of) (auto dest: sets_into_space) +lemma measurable_Pair: + assumes f: "f \ measurable M M1" and g: "g \ measurable M M2" + shows "(\x. (f x, g x)) \ measurable M (M1 \\<^isub>M M2)" +proof (rule measurable_pair_measureI) + show "(\x. (f x, g x)) \ space M \ space M1 \ space M2" + using f g by (auto simp: measurable_def) + fix A B assume *: "A \ sets M1" "B \ sets M2" + have "(\x. (f x, g x)) -` (A \ B) \ space M = (f -` A \ space M) \ (g -` B \ space M)" + by auto + also have "\ \ sets M" + by (rule Int) (auto intro!: measurable_sets * f g) + finally show "(\x. (f x, g x)) -` (A \ B) \ space M \ sets M" . +qed + +lemma measurable_pair: + assumes "(fst \ f) \ measurable M M1" "(snd \ f) \ measurable M M2" + shows "f \ measurable M (M1 \\<^isub>M M2)" + using measurable_Pair[OF assms] by simp + lemma measurable_fst[intro!, simp]: "fst \ measurable (M1 \\<^isub>M M2) M1" - unfolding measurable_def -proof safe - fix A assume A: "A \ sets M1" - from this[THEN sets_into_space] have "fst -` A \ space M1 \ space M2 = A \ space M2" by auto - with A show "fst -` A \ space (M1 \\<^isub>M M2) \ sets (M1 \\<^isub>M M2)" by (simp add: space_pair_measure) -qed (simp add: space_pair_measure) + by (auto simp: fst_vimage_eq_Times space_pair_measure sets_into_space times_Int_times measurable_def) lemma measurable_snd[intro!, simp]: "snd \ measurable (M1 \\<^isub>M M2) M2" - unfolding measurable_def -proof safe - fix A assume A: "A \ sets M2" - from this[THEN sets_into_space] have "snd -` A \ space M1 \ space M2 = space M1 \ A" by auto - with A show "snd -` A \ space (M1 \\<^isub>M M2) \ sets (M1 \\<^isub>M M2)" by (simp add: space_pair_measure) -qed (simp add: space_pair_measure) + by (auto simp: snd_vimage_eq_Times space_pair_measure sets_into_space times_Int_times measurable_def) lemma measurable_fst': "f \ measurable M (N \\<^isub>M P) \ (\x. fst (f x)) \ measurable M N" using measurable_comp[OF _ measurable_fst] by (auto simp: comp_def) @@ -84,55 +97,29 @@ lemma measurable_pair_iff: "f \ measurable M (M1 \\<^isub>M M2) \ (fst \ f) \ measurable M M1 \ (snd \ f) \ measurable M M2" -proof safe - assume f: "(fst \ f) \ measurable M M1" and s: "(snd \ f) \ measurable M M2" - show "f \ measurable M (M1 \\<^isub>M M2)" - proof (rule measurable_pair_measureI) - show "f \ space M \ space M1 \ space M2" - using f s by (auto simp: mem_Times_iff measurable_def comp_def) - fix A B assume "A \ sets M1" "B \ sets M2" - moreover have "(fst \ f) -` A \ space M \ sets M" "(snd \ f) -` B \ space M \ sets M" - using f `A \ sets M1` s `B \ sets M2` by (auto simp: measurable_sets) - moreover have "f -` (A \ B) \ space M = ((fst \ f) -` A \ space M) \ ((snd \ f) -` B \ space M)" - by (auto simp: vimage_Times) - ultimately show "f -` (A \ B) \ space M \ sets M" by auto - qed -qed auto + using measurable_pair[of f M M1 M2] by auto -lemma measurable_pair: - "(fst \ f) \ measurable M M1 \ (snd \ f) \ measurable M M2 \ f \ measurable M (M1 \\<^isub>M M2)" - unfolding measurable_pair_iff by simp +lemma measurable_split_conv: + "(\(x, y). f x y) \ measurable A B \ (\x. f (fst x) (snd x)) \ measurable A B" + by (intro arg_cong2[where f="op \"]) auto lemma measurable_pair_swap': "(\(x,y). (y, x)) \ measurable (M1 \\<^isub>M M2) (M2 \\<^isub>M M1)" -proof (rule measurable_pair_measureI) - fix A B assume "A \ sets M2" "B \ sets M1" - moreover then have "(\(x, y). (y, x)) -` (A \ B) \ space (M1 \\<^isub>M M2) = B \ A" - by (auto dest: sets_into_space simp: space_pair_measure) - ultimately show "(\(x, y). (y, x)) -` (A \ B) \ space (M1 \\<^isub>M M2) \ sets (M1 \\<^isub>M M2)" - by auto -qed (auto simp add: space_pair_measure) + by (auto intro!: measurable_Pair simp: measurable_split_conv) lemma measurable_pair_swap: assumes f: "f \ measurable (M1 \\<^isub>M M2) M" shows "(\(x,y). f (y, x)) \ measurable (M2 \\<^isub>M M1) M" -proof - - have "(\x. f (case x of (x, y) \ (y, x))) = (\(x, y). f (y, x))" by auto - then show ?thesis - using measurable_comp[OF measurable_pair_swap' f] by (simp add: comp_def) -qed + using measurable_comp[OF measurable_Pair f] by (auto simp: measurable_split_conv comp_def) lemma measurable_pair_swap_iff: "f \ measurable (M2 \\<^isub>M M1) M \ (\(x,y). f (y,x)) \ measurable (M1 \\<^isub>M M2) M" using measurable_pair_swap[of "\(x,y). f (y, x)"] by (auto intro!: measurable_pair_swap) +lemma measurable_ident[intro, simp]: "(\x. x) \ measurable M M" + unfolding measurable_def by auto + lemma measurable_Pair1': "x \ space M1 \ Pair x \ measurable M2 (M1 \\<^isub>M M2)" -proof (rule measurable_pair_measureI) - fix A B assume "A \ sets M1" "B \ sets M2" - moreover then have "Pair x -` (A \ B) \ space M2 = (if x \ A then B else {})" - by (auto dest: sets_into_space simp: space_pair_measure) - ultimately show "Pair x -` (A \ B) \ space M2 \ sets M2" - by auto -qed (auto simp add: space_pair_measure) + by (auto intro!: measurable_Pair) lemma sets_Pair1: assumes A: "A \ sets (M1 \\<^isub>M M2)" shows "Pair x -` A \ sets M2" proof - @@ -144,8 +131,7 @@ qed lemma measurable_Pair2': "y \ space M2 \ (\x. (x, y)) \ measurable M1 (M1 \\<^isub>M M2)" - using measurable_comp[OF measurable_Pair1' measurable_pair_swap', of y M2 M1] - by (simp add: comp_def) + by (auto intro!: measurable_Pair) lemma sets_Pair2: assumes A: "A \ sets (M1 \\<^isub>M M2)" shows "(\x. (x, y)) -` A \ sets M1" proof - @@ -172,46 +158,131 @@ unfolding Int_stable_def by safe (auto simp add: times_Int_times) -lemma finite_measure_cut_measurable: - assumes "sigma_finite_measure M1" "finite_measure M2" - assumes "Q \ sets (M1 \\<^isub>M M2)" - shows "(\x. emeasure M2 (Pair x -` Q)) \ borel_measurable M1" +lemma (in finite_measure) finite_measure_cut_measurable: + assumes "Q \ sets (N \\<^isub>M M)" + shows "(\x. emeasure M (Pair x -` Q)) \ borel_measurable N" (is "?s Q \ _") proof - - interpret M1: sigma_finite_measure M1 by fact - interpret M2: finite_measure M2 by fact - let ?\ = "space M1 \ space M2" and ?D = "{A\sets (M1 \\<^isub>M M2). ?s A \ borel_measurable M1}" + let ?\ = "space N \ space M" and ?D = "{A\sets (N \\<^isub>M M). ?s A \ borel_measurable N}" note space_pair_measure[simp] interpret dynkin_system ?\ ?D proof (intro dynkin_systemI) fix A assume "A \ ?D" then show "A \ ?\" - using sets_into_space[of A "M1 \\<^isub>M M2"] by simp + using sets_into_space[of A "N \\<^isub>M M"] by simp next from top show "?\ \ ?D" by (auto simp add: if_distrib intro!: measurable_If) next fix A assume "A \ ?D" - with sets_into_space have "\x. emeasure M2 (Pair x -` (?\ - A)) = - (if x \ space M1 then emeasure M2 (space M2) - ?s A x else 0)" + with sets_into_space have "\x. emeasure M (Pair x -` (?\ - A)) = + (if x \ space N then emeasure M (space M) - ?s A x else 0)" by (auto intro!: emeasure_compl simp: vimage_Diff sets_Pair1) with `A \ ?D` top show "?\ - A \ ?D" by (auto intro!: measurable_If) next - fix F :: "nat \ ('a\'b) set" assume "disjoint_family F" "range F \ ?D" - moreover then have "\x. emeasure M2 (\i. Pair x -` F i) = (\i. ?s (F i) x)" + fix F :: "nat \ ('b\'a) set" assume "disjoint_family F" "range F \ ?D" + moreover then have "\x. emeasure M (\i. Pair x -` F i) = (\i. ?s (F i) x)" by (intro suminf_emeasure[symmetric]) (auto simp: disjoint_family_on_def sets_Pair1) ultimately show "(\i. F i) \ ?D" by (auto simp: vimage_UN intro!: borel_measurable_psuminf) qed - let ?G = "{a \ b | a b. a \ sets M1 \ b \ sets M2}" + let ?G = "{a \ b | a b. a \ sets N \ b \ sets M}" have "sigma_sets ?\ ?G = ?D" proof (rule dynkin_lemma) show "?G \ ?D" by (auto simp: if_distrib Int_def[symmetric] intro!: measurable_If) qed (auto simp: sets_pair_measure Int_stable_pair_measure_generator) - with `Q \ sets (M1 \\<^isub>M M2)` have "Q \ ?D" + with `Q \ sets (N \\<^isub>M M)` have "Q \ ?D" by (simp add: sets_pair_measure[symmetric]) - then show "?s Q \ borel_measurable M1" by simp + then show "?s Q \ borel_measurable N" by simp +qed + +lemma (in sigma_finite_measure) measurable_emeasure_Pair: + assumes Q: "Q \ sets (N \\<^isub>M M)" shows "(\x. emeasure M (Pair x -` Q)) \ borel_measurable N" (is "?s Q \ _") +proof - + from sigma_finite_disjoint guess F . note F = this + then have F_sets: "\i. F i \ sets M" by auto + let ?C = "\x i. F i \ Pair x -` Q" + { fix i + have [simp]: "space N \ F i \ space N \ space M = space N \ F i" + using F sets_into_space by auto + let ?R = "density M (indicator (F i))" + have "finite_measure ?R" + using F by (intro finite_measureI) (auto simp: emeasure_restricted subset_eq) + then have "(\x. emeasure ?R (Pair x -` (space N \ space ?R \ Q))) \ borel_measurable N" + by (rule finite_measure.finite_measure_cut_measurable) (auto intro: Q) + moreover have "\x. emeasure ?R (Pair x -` (space N \ space ?R \ Q)) + = emeasure M (F i \ Pair x -` (space N \ space ?R \ Q))" + using Q F_sets by (intro emeasure_restricted) (auto intro: sets_Pair1) + moreover have "\x. F i \ Pair x -` (space N \ space ?R \ Q) = ?C x i" + using sets_into_space[OF Q] by (auto simp: space_pair_measure) + ultimately have "(\x. emeasure M (?C x i)) \ borel_measurable N" + by simp } + moreover + { fix x + have "(\i. emeasure M (?C x i)) = emeasure M (\i. ?C x i)" + proof (intro suminf_emeasure) + show "range (?C x) \ sets M" + using F `Q \ sets (N \\<^isub>M M)` by (auto intro!: sets_Pair1) + have "disjoint_family F" using F by auto + show "disjoint_family (?C x)" + by (rule disjoint_family_on_bisimulation[OF `disjoint_family F`]) auto + qed + also have "(\i. ?C x i) = Pair x -` Q" + using F sets_into_space[OF `Q \ sets (N \\<^isub>M M)`] + by (auto simp: space_pair_measure) + finally have "emeasure M (Pair x -` Q) = (\i. emeasure M (?C x i))" + by simp } + ultimately show ?thesis using `Q \ sets (N \\<^isub>M M)` F_sets + by auto +qed + +lemma (in sigma_finite_measure) emeasure_pair_measure: + assumes "X \ sets (N \\<^isub>M M)" + shows "emeasure (N \\<^isub>M M) X = (\\<^isup>+ x. \\<^isup>+ y. indicator X (x, y) \M \N)" (is "_ = ?\ X") +proof (rule emeasure_measure_of[OF pair_measure_def]) + show "positive (sets (N \\<^isub>M M)) ?\" + by (auto simp: positive_def positive_integral_positive) + have eq[simp]: "\A x y. indicator A (x, y) = indicator (Pair x -` A) y" + by (auto simp: indicator_def) + show "countably_additive (sets (N \\<^isub>M M)) ?\" + proof (rule countably_additiveI) + fix F :: "nat \ ('b \ 'a) set" assume F: "range F \ sets (N \\<^isub>M M)" "disjoint_family F" + from F have *: "\i. F i \ sets (N \\<^isub>M M)" "(\i. F i) \ sets (N \\<^isub>M M)" by auto + moreover from F have "\i. (\x. emeasure M (Pair x -` F i)) \ borel_measurable N" + by (intro measurable_emeasure_Pair) auto + moreover have "\x. disjoint_family (\i. Pair x -` F i)" + by (intro disjoint_family_on_bisimulation[OF F(2)]) auto + moreover have "\x. range (\i. Pair x -` F i) \ sets M" + using F by (auto simp: sets_Pair1) + ultimately show "(\n. ?\ (F n)) = ?\ (\i. F i)" + by (auto simp add: vimage_UN positive_integral_suminf[symmetric] suminf_emeasure subset_eq emeasure_nonneg sets_Pair1 + intro!: positive_integral_cong positive_integral_indicator[symmetric]) + qed + show "{a \ b |a b. a \ sets N \ b \ sets M} \ Pow (space N \ space M)" + using space_closed[of N] space_closed[of M] by auto +qed fact + +lemma (in sigma_finite_measure) emeasure_pair_measure_alt: + assumes X: "X \ sets (N \\<^isub>M M)" + shows "emeasure (N \\<^isub>M M) X = (\\<^isup>+x. emeasure M (Pair x -` X) \N)" +proof - + have [simp]: "\x y. indicator X (x, y) = indicator (Pair x -` X) y" + by (auto simp: indicator_def) + show ?thesis + using X by (auto intro!: positive_integral_cong simp: emeasure_pair_measure sets_Pair1) +qed + +lemma (in sigma_finite_measure) emeasure_pair_measure_Times: + assumes A: "A \ sets N" and B: "B \ sets M" + shows "emeasure (N \\<^isub>M M) (A \ B) = emeasure N A * emeasure M B" +proof - + have "emeasure (N \\<^isub>M M) (A \ B) = (\\<^isup>+x. emeasure M B * indicator A x \N)" + using A B by (auto intro!: positive_integral_cong simp: emeasure_pair_measure_alt) + also have "\ = emeasure M B * emeasure N A" + using A by (simp add: emeasure_nonneg positive_integral_cmult_indicator) + finally show ?thesis + by (simp add: ac_simps) qed subsection {* Binary products of $\sigma$-finite emeasure spaces *} @@ -219,114 +290,21 @@ locale pair_sigma_finite = M1: sigma_finite_measure M1 + M2: sigma_finite_measure M2 for M1 :: "'a measure" and M2 :: "'b measure" -lemma sets_pair_measure_cong[cong]: - "sets M1 = sets M1' \ sets M2 = sets M2' \ sets (M1 \\<^isub>M M2) = sets (M1' \\<^isub>M M2')" - unfolding sets_pair_measure by (simp cong: sets_eq_imp_space_eq) - lemma (in pair_sigma_finite) measurable_emeasure_Pair1: - assumes Q: "Q \ sets (M1 \\<^isub>M M2)" shows "(\x. emeasure M2 (Pair x -` Q)) \ borel_measurable M1" (is "?s Q \ _") -proof - - from M2.sigma_finite_disjoint guess F . note F = this - then have F_sets: "\i. F i \ sets M2" by auto - have M1: "sigma_finite_measure M1" .. - let ?C = "\x i. F i \ Pair x -` Q" - { fix i - have [simp]: "space M1 \ F i \ space M1 \ space M2 = space M1 \ F i" - using F sets_into_space by auto - let ?R = "density M2 (indicator (F i))" - have "(\x. emeasure ?R (Pair x -` (space M1 \ space ?R \ Q))) \ borel_measurable M1" - proof (intro finite_measure_cut_measurable[OF M1]) - show "finite_measure ?R" - using F by (intro finite_measureI) (auto simp: emeasure_restricted subset_eq) - show "(space M1 \ space ?R) \ Q \ sets (M1 \\<^isub>M ?R)" - using Q by (simp add: Int) - qed - moreover have "\x. emeasure ?R (Pair x -` (space M1 \ space ?R \ Q)) - = emeasure M2 (F i \ Pair x -` (space M1 \ space ?R \ Q))" - using Q F_sets by (intro emeasure_restricted) (auto intro: sets_Pair1) - moreover have "\x. F i \ Pair x -` (space M1 \ space ?R \ Q) = ?C x i" - using sets_into_space[OF Q] by (auto simp: space_pair_measure) - ultimately have "(\x. emeasure M2 (?C x i)) \ borel_measurable M1" - by simp } - moreover - { fix x - have "(\i. emeasure M2 (?C x i)) = emeasure M2 (\i. ?C x i)" - proof (intro suminf_emeasure) - show "range (?C x) \ sets M2" - using F `Q \ sets (M1 \\<^isub>M M2)` by (auto intro!: sets_Pair1) - have "disjoint_family F" using F by auto - show "disjoint_family (?C x)" - by (rule disjoint_family_on_bisimulation[OF `disjoint_family F`]) auto - qed - also have "(\i. ?C x i) = Pair x -` Q" - using F sets_into_space[OF `Q \ sets (M1 \\<^isub>M M2)`] - by (auto simp: space_pair_measure) - finally have "emeasure M2 (Pair x -` Q) = (\i. emeasure M2 (?C x i))" - by simp } - ultimately show ?thesis using `Q \ sets (M1 \\<^isub>M M2)` F_sets - by auto -qed + "Q \ sets (M1 \\<^isub>M M2) \ (\x. emeasure M2 (Pair x -` Q)) \ borel_measurable M1" + using M2.measurable_emeasure_Pair . lemma (in pair_sigma_finite) measurable_emeasure_Pair2: assumes Q: "Q \ sets (M1 \\<^isub>M M2)" shows "(\y. emeasure M1 ((\x. (x, y)) -` Q)) \ borel_measurable M2" proof - - interpret Q: pair_sigma_finite M2 M1 by default have "(\(x, y). (y, x)) -` Q \ space (M2 \\<^isub>M M1) \ sets (M2 \\<^isub>M M1)" using Q measurable_pair_swap' by (auto intro: measurable_sets) - note Q.measurable_emeasure_Pair1[OF this] + note M1.measurable_emeasure_Pair[OF this] moreover have "\y. Pair y -` ((\(x, y). (y, x)) -` Q \ space (M2 \\<^isub>M M1)) = (\x. (x, y)) -` Q" using Q[THEN sets_into_space] by (auto simp: space_pair_measure) ultimately show ?thesis by simp qed -lemma (in pair_sigma_finite) emeasure_pair_measure: - assumes "X \ sets (M1 \\<^isub>M M2)" - shows "emeasure (M1 \\<^isub>M M2) X = (\\<^isup>+ x. \\<^isup>+ y. indicator X (x, y) \M2 \M1)" (is "_ = ?\ X") -proof (rule emeasure_measure_of[OF pair_measure_def]) - show "positive (sets (M1 \\<^isub>M M2)) ?\" - by (auto simp: positive_def positive_integral_positive) - have eq[simp]: "\A x y. indicator A (x, y) = indicator (Pair x -` A) y" - by (auto simp: indicator_def) - show "countably_additive (sets (M1 \\<^isub>M M2)) ?\" - proof (rule countably_additiveI) - fix F :: "nat \ ('a \ 'b) set" assume F: "range F \ sets (M1 \\<^isub>M M2)" "disjoint_family F" - from F have *: "\i. F i \ sets (M1 \\<^isub>M M2)" "(\i. F i) \ sets (M1 \\<^isub>M M2)" by auto - moreover from F have "\i. (\x. emeasure M2 (Pair x -` F i)) \ borel_measurable M1" - by (intro measurable_emeasure_Pair1) auto - moreover have "\x. disjoint_family (\i. Pair x -` F i)" - by (intro disjoint_family_on_bisimulation[OF F(2)]) auto - moreover have "\x. range (\i. Pair x -` F i) \ sets M2" - using F by (auto simp: sets_Pair1) - ultimately show "(\n. ?\ (F n)) = ?\ (\i. F i)" - by (auto simp add: vimage_UN positive_integral_suminf[symmetric] suminf_emeasure subset_eq emeasure_nonneg sets_Pair1 - intro!: positive_integral_cong positive_integral_indicator[symmetric]) - qed - show "{a \ b |a b. a \ sets M1 \ b \ sets M2} \ Pow (space M1 \ space M2)" - using space_closed[of M1] space_closed[of M2] by auto -qed fact - -lemma (in pair_sigma_finite) emeasure_pair_measure_alt: - assumes X: "X \ sets (M1 \\<^isub>M M2)" - shows "emeasure (M1 \\<^isub>M M2) X = (\\<^isup>+x. emeasure M2 (Pair x -` X) \M1)" -proof - - have [simp]: "\x y. indicator X (x, y) = indicator (Pair x -` X) y" - by (auto simp: indicator_def) - show ?thesis - using X by (auto intro!: positive_integral_cong simp: emeasure_pair_measure sets_Pair1) -qed - -lemma (in pair_sigma_finite) emeasure_pair_measure_Times: - assumes A: "A \ sets M1" and B: "B \ sets M2" - shows "emeasure (M1 \\<^isub>M M2) (A \ B) = emeasure M1 A * emeasure M2 B" -proof - - have "emeasure (M1 \\<^isub>M M2) (A \ B) = (\\<^isup>+x. emeasure M2 B * indicator A x \M1)" - using A B by (auto intro!: positive_integral_cong simp: emeasure_pair_measure_alt) - also have "\ = emeasure M2 B * emeasure M1 A" - using A by (simp add: emeasure_nonneg positive_integral_cmult_indicator) - finally show ?thesis - by (simp add: ac_simps) -qed - lemma (in pair_sigma_finite) sigma_finite_up_in_pair_measure_generator: defines "E \ {A \ B | A B. A \ sets M1 \ B \ sets M2}" shows "\F::nat \ ('a \ 'b) set. range F \ E \ incseq F \ (\i. F i) = space M1 \ space M2 \ @@ -396,7 +374,6 @@ lemma (in pair_sigma_finite) distr_pair_swap: "M1 \\<^isub>M M2 = distr (M2 \\<^isub>M M1) (M1 \\<^isub>M M2) (\(x, y). (y, x))" (is "?P = ?D") proof - - interpret Q: pair_sigma_finite M2 M1 by default from sigma_finite_up_in_pair_measure_generator guess F :: "nat \ ('a \ 'b) set" .. note F = this let ?E = "{a \ b |a b. a \ sets M1 \ b \ sets M2}" show ?thesis @@ -416,7 +393,7 @@ have "(\(y, x). (x, y)) -` X \ space (M2 \\<^isub>M M1) = B \ A" using sets_into_space[OF A] sets_into_space[OF B] by (auto simp: space_pair_measure) with A B show "emeasure (M1 \\<^isub>M M2) X = emeasure ?D X" - by (simp add: emeasure_pair_measure_Times Q.emeasure_pair_measure_Times emeasure_distr + by (simp add: M2.emeasure_pair_measure_Times M1.emeasure_pair_measure_Times emeasure_distr measurable_pair_swap' ac_simps) qed qed @@ -426,13 +403,84 @@ shows "emeasure (M1 \\<^isub>M M2) A = (\\<^isup>+y. emeasure M1 ((\x. (x, y)) -` A) \M2)" (is "_ = ?\ A") proof - - interpret Q: pair_sigma_finite M2 M1 by default have [simp]: "\y. (Pair y -` ((\(x, y). (y, x)) -` A \ space (M2 \\<^isub>M M1))) = (\x. (x, y)) -` A" using sets_into_space[OF A] by (auto simp: space_pair_measure) show ?thesis using A by (subst distr_pair_swap) (simp_all del: vimage_Int add: measurable_sets[OF measurable_pair_swap'] - Q.emeasure_pair_measure_alt emeasure_distr[OF measurable_pair_swap' A]) + M1.emeasure_pair_measure_alt emeasure_distr[OF measurable_pair_swap' A]) +qed + +lemma (in pair_sigma_finite) AE_pair: + assumes "AE x in (M1 \\<^isub>M M2). Q x" + shows "AE x in M1. (AE y in M2. Q (x, y))" +proof - + obtain N where N: "N \ sets (M1 \\<^isub>M M2)" "emeasure (M1 \\<^isub>M M2) N = 0" "{x\space (M1 \\<^isub>M M2). \ Q x} \ N" + using assms unfolding eventually_ae_filter by auto + show ?thesis + proof (rule AE_I) + from N measurable_emeasure_Pair1[OF `N \ sets (M1 \\<^isub>M M2)`] + show "emeasure M1 {x\space M1. emeasure M2 (Pair x -` N) \ 0} = 0" + by (auto simp: M2.emeasure_pair_measure_alt positive_integral_0_iff emeasure_nonneg) + show "{x \ space M1. emeasure M2 (Pair x -` N) \ 0} \ sets M1" + by (intro borel_measurable_ereal_neq_const measurable_emeasure_Pair1 N) + { fix x assume "x \ space M1" "emeasure M2 (Pair x -` N) = 0" + have "AE y in M2. Q (x, y)" + proof (rule AE_I) + show "emeasure M2 (Pair x -` N) = 0" by fact + show "Pair x -` N \ sets M2" using N(1) by (rule sets_Pair1) + show "{y \ space M2. \ Q (x, y)} \ Pair x -` N" + using N `x \ space M1` unfolding space_pair_measure by auto + qed } + then show "{x \ space M1. \ (AE y in M2. Q (x, y))} \ {x \ space M1. emeasure M2 (Pair x -` N) \ 0}" + by auto + qed +qed + +lemma (in pair_sigma_finite) AE_pair_measure: + assumes "{x\space (M1 \\<^isub>M M2). P x} \ sets (M1 \\<^isub>M M2)" + assumes ae: "AE x in M1. AE y in M2. P (x, y)" + shows "AE x in M1 \\<^isub>M M2. P x" +proof (subst AE_iff_measurable[OF _ refl]) + show "{x\space (M1 \\<^isub>M M2). \ P x} \ sets (M1 \\<^isub>M M2)" + by (rule sets_Collect) fact + then have "emeasure (M1 \\<^isub>M M2) {x \ space (M1 \\<^isub>M M2). \ P x} = + (\\<^isup>+ x. \\<^isup>+ y. indicator {x \ space (M1 \\<^isub>M M2). \ P x} (x, y) \M2 \M1)" + by (simp add: M2.emeasure_pair_measure) + also have "\ = (\\<^isup>+ x. \\<^isup>+ y. 0 \M2 \M1)" + using ae + apply (safe intro!: positive_integral_cong_AE) + apply (intro AE_I2) + apply (safe intro!: positive_integral_cong_AE) + apply auto + done + finally show "emeasure (M1 \\<^isub>M M2) {x \ space (M1 \\<^isub>M M2). \ P x} = 0" by simp +qed + +lemma (in pair_sigma_finite) AE_pair_iff: + "{x\space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ sets (M1 \\<^isub>M M2) \ + (AE x in M1. AE y in M2. P x y) \ (AE x in (M1 \\<^isub>M M2). P (fst x) (snd x))" + using AE_pair[of "\x. P (fst x) (snd x)"] AE_pair_measure[of "\x. P (fst x) (snd x)"] by auto + +lemma (in pair_sigma_finite) AE_commute: + assumes P: "{x\space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ sets (M1 \\<^isub>M M2)" + shows "(AE x in M1. AE y in M2. P x y) \ (AE y in M2. AE x in M1. P x y)" +proof - + interpret Q: pair_sigma_finite M2 M1 .. + have [simp]: "\x. (fst (case x of (x, y) \ (y, x))) = snd x" "\x. (snd (case x of (x, y) \ (y, x))) = fst x" + by auto + have "{x \ space (M2 \\<^isub>M M1). P (snd x) (fst x)} = + (\(x, y). (y, x)) -` {x \ space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ space (M2 \\<^isub>M M1)" + by (auto simp: space_pair_measure) + also have "\ \ sets (M2 \\<^isub>M M1)" + by (intro sets_pair_swap P) + finally show ?thesis + apply (subst AE_pair_iff[OF P]) + apply (subst distr_pair_swap) + apply (subst AE_distr_iff[OF measurable_pair_swap' P]) + apply (subst Q.AE_pair_iff) + apply simp_all + done qed section "Fubinis theorem" @@ -494,7 +542,7 @@ positive_integral_cmult positive_integral_cong[OF eq] positive_integral_eq_simple_integral[OF f] - emeasure_pair_measure_alt[symmetric]) + M2.emeasure_pair_measure_alt[symmetric]) qed lemma (in pair_sigma_finite) positive_integral_fst_measurable: @@ -558,96 +606,6 @@ unfolding positive_integral_snd_measurable[OF assms] unfolding positive_integral_fst_measurable[OF assms] .. -lemma (in pair_sigma_finite) AE_pair: - assumes "AE x in (M1 \\<^isub>M M2). Q x" - shows "AE x in M1. (AE y in M2. Q (x, y))" -proof - - obtain N where N: "N \ sets (M1 \\<^isub>M M2)" "emeasure (M1 \\<^isub>M M2) N = 0" "{x\space (M1 \\<^isub>M M2). \ Q x} \ N" - using assms unfolding eventually_ae_filter by auto - show ?thesis - proof (rule AE_I) - from N measurable_emeasure_Pair1[OF `N \ sets (M1 \\<^isub>M M2)`] - show "emeasure M1 {x\space M1. emeasure M2 (Pair x -` N) \ 0} = 0" - by (auto simp: emeasure_pair_measure_alt positive_integral_0_iff emeasure_nonneg) - show "{x \ space M1. emeasure M2 (Pair x -` N) \ 0} \ sets M1" - by (intro borel_measurable_ereal_neq_const measurable_emeasure_Pair1 N) - { fix x assume "x \ space M1" "emeasure M2 (Pair x -` N) = 0" - have "AE y in M2. Q (x, y)" - proof (rule AE_I) - show "emeasure M2 (Pair x -` N) = 0" by fact - show "Pair x -` N \ sets M2" using N(1) by (rule sets_Pair1) - show "{y \ space M2. \ Q (x, y)} \ Pair x -` N" - using N `x \ space M1` unfolding space_pair_measure by auto - qed } - then show "{x \ space M1. \ (AE y in M2. Q (x, y))} \ {x \ space M1. emeasure M2 (Pair x -` N) \ 0}" - by auto - qed -qed - -lemma (in pair_sigma_finite) AE_pair_measure: - assumes "{x\space (M1 \\<^isub>M M2). P x} \ sets (M1 \\<^isub>M M2)" - assumes ae: "AE x in M1. AE y in M2. P (x, y)" - shows "AE x in M1 \\<^isub>M M2. P x" -proof (subst AE_iff_measurable[OF _ refl]) - show "{x\space (M1 \\<^isub>M M2). \ P x} \ sets (M1 \\<^isub>M M2)" - by (rule sets_Collect) fact - then have "emeasure (M1 \\<^isub>M M2) {x \ space (M1 \\<^isub>M M2). \ P x} = - (\\<^isup>+ x. \\<^isup>+ y. indicator {x \ space (M1 \\<^isub>M M2). \ P x} (x, y) \M2 \M1)" - by (simp add: emeasure_pair_measure) - also have "\ = (\\<^isup>+ x. \\<^isup>+ y. 0 \M2 \M1)" - using ae - apply (safe intro!: positive_integral_cong_AE) - apply (intro AE_I2) - apply (safe intro!: positive_integral_cong_AE) - apply auto - done - finally show "emeasure (M1 \\<^isub>M M2) {x \ space (M1 \\<^isub>M M2). \ P x} = 0" by simp -qed - -lemma (in pair_sigma_finite) AE_pair_iff: - "{x\space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ sets (M1 \\<^isub>M M2) \ - (AE x in M1. AE y in M2. P x y) \ (AE x in (M1 \\<^isub>M M2). P (fst x) (snd x))" - using AE_pair[of "\x. P (fst x) (snd x)"] AE_pair_measure[of "\x. P (fst x) (snd x)"] by auto - -lemma AE_distr_iff: - assumes f: "f \ measurable M N" and P: "{x \ space N. P x} \ sets N" - shows "(AE x in distr M N f. P x) \ (AE x in M. P (f x))" -proof (subst (1 2) AE_iff_measurable[OF _ refl]) - from P show "{x \ space (distr M N f). \ P x} \ sets (distr M N f)" - by (auto intro!: sets_Collect_neg) - moreover - have "f -` {x \ space N. P x} \ space M = {x \ space M. P (f x)}" - using f by (auto dest: measurable_space) - then show "{x \ space M. \ P (f x)} \ sets M" - using measurable_sets[OF f P] by (auto intro!: sets_Collect_neg) - moreover have "f -` {x\space N. \ P x} \ space M = {x \ space M. \ P (f x)}" - using f by (auto dest: measurable_space) - ultimately show "(emeasure (distr M N f) {x \ space (distr M N f). \ P x} = 0) = - (emeasure M {x \ space M. \ P (f x)} = 0)" - using f by (simp add: emeasure_distr) -qed - -lemma (in pair_sigma_finite) AE_commute: - assumes P: "{x\space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ sets (M1 \\<^isub>M M2)" - shows "(AE x in M1. AE y in M2. P x y) \ (AE y in M2. AE x in M1. P x y)" -proof - - interpret Q: pair_sigma_finite M2 M1 .. - have [simp]: "\x. (fst (case x of (x, y) \ (y, x))) = snd x" "\x. (snd (case x of (x, y) \ (y, x))) = fst x" - by auto - have "{x \ space (M2 \\<^isub>M M1). P (snd x) (fst x)} = - (\(x, y). (y, x)) -` {x \ space (M1 \\<^isub>M M2). P (fst x) (snd x)} \ space (M2 \\<^isub>M M1)" - by (auto simp: space_pair_measure) - also have "\ \ sets (M2 \\<^isub>M M1)" - by (intro sets_pair_swap P) - finally show ?thesis - apply (subst AE_pair_iff[OF P]) - apply (subst distr_pair_swap) - apply (subst AE_distr_iff[OF measurable_pair_swap' P]) - apply (subst Q.AE_pair_iff) - apply simp_all - done -qed - lemma (in pair_sigma_finite) integrable_product_swap: assumes "integrable (M1 \\<^isub>M M2) f" shows "integrable (M2 \\<^isub>M M1) (\(x,y). f (y,x))" @@ -817,7 +775,7 @@ by (intro finite_subset[OF _ B]) auto have fin_X: "finite X" using X_subset by (rule finite_subset) (auto simp: A B) show "emeasure ?P X = emeasure ?C X" - apply (subst P.emeasure_pair_measure_alt[OF X]) + apply (subst B.emeasure_pair_measure_alt[OF X]) apply (subst emeasure_count_space) using X_subset apply auto [] apply (simp add: fin_Pair emeasure_count_space X_subset fin_X) @@ -861,7 +819,7 @@ by simp show "emeasure ?L A = emeasure ?R A" - apply (subst L.emeasure_pair_measure[OF A]) + apply (subst D2.emeasure_pair_measure[OF A]) apply (subst emeasure_density) using f_fst g_snd apply (simp add: split_beta') using A apply simp @@ -924,7 +882,7 @@ by (auto simp: measurable_pair_iff) fix A assume A: "A \ sets ?P" then have "emeasure ?P A = (\\<^isup>+x. emeasure (distr N T g) (Pair x -` A) \distr M S f)" - by (rule ST.emeasure_pair_measure_alt) + by (rule T.emeasure_pair_measure_alt) also have "\ = (\\<^isup>+x. emeasure N (g -` (Pair x -` A) \ space N) \distr M S f)" using g A by (simp add: sets_Pair1 emeasure_distr) also have "\ = (\\<^isup>+x. emeasure N (g -` (Pair (f x) -` A) \ space N) \M)" @@ -933,7 +891,7 @@ also have "\ = (\\<^isup>+x. emeasure N (Pair x -` ((\(x, y). (f x, g y)) -` A \ space (M \\<^isub>M N))) \M)" by (intro positive_integral_cong arg_cong2[where f=emeasure]) (auto simp: space_pair_measure) also have "\ = emeasure (M \\<^isub>M N) ((\(x, y). (f x, g y)) -` A \ space (M \\<^isub>M N))" - using fg by (intro MN.emeasure_pair_measure_alt[symmetric] measurable_sets[OF _ A]) + using fg by (intro N.emeasure_pair_measure_alt[symmetric] measurable_sets[OF _ A]) (auto cong: measurable_cong') also have "\ = emeasure ?D A" using fg A by (subst emeasure_distr) auto diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Finite_Product_Measure.thy --- a/src/HOL/Probability/Finite_Product_Measure.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Finite_Product_Measure.thy Wed Oct 10 12:12:18 2012 +0200 @@ -504,8 +504,7 @@ qed (insert `i \ I`, auto simp: space_PiM) lemma measurable_add_dim: - assumes "i \ I" - shows "(\(f, y). f(i := y)) \ measurable (Pi\<^isub>M I M \\<^isub>M M i) (Pi\<^isub>M (insert i I) M)" + "(\(f, y). f(i := y)) \ measurable (Pi\<^isub>M I M \\<^isub>M M i) (Pi\<^isub>M (insert i I) M)" (is "?f \ measurable ?P ?I") proof (rule measurable_PiM_single) fix j A assume j: "j \ insert i I" and A: "A \ sets (M j)" @@ -519,19 +518,18 @@ qed (auto simp: space_pair_measure space_PiM) lemma measurable_merge: - assumes "I \ J = {}" - shows "(\(x, y). merge I x J y) \ measurable (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \ J) M)" + "(\(x, y). merge I x J y) \ measurable (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M) (Pi\<^isub>M (I \ J) M)" (is "?f \ measurable ?P ?U") proof (rule measurable_PiM_single) fix i A assume A: "A \ sets (M i)" "i \ I \ J" - then have "{\ \ space ?P. prod_case (\x. merge I x J) \ i \ A} = + then have "{\ \ space ?P. prod_case (\x y. merge I x J y) \ i \ A} = (if i \ I then ((\x. x i) \ fst) -` A \ space ?P else ((\x. x i) \ snd) -` A \ space ?P)" - using `I \ J = {}` by auto + by (auto simp: merge_def) also have "\ \ sets ?P" using A by (auto intro!: measurable_sets[OF measurable_comp, OF _ measurable_component_singleton]) - finally show "{\ \ space ?P. prod_case (\x. merge I x J) \ i \ A} \ sets ?P" . -qed (insert assms, auto simp: space_pair_measure space_PiM) + finally show "{\ \ space ?P. prod_case (\x y. merge I x J y) \ i \ A} \ sets ?P" . +qed (auto simp: space_pair_measure space_PiM Pi_iff merge_def extensional_def) lemma measurable_restrict: assumes X: "\i. i \ I \ X i \ measurable N (M i)" @@ -587,12 +585,9 @@ qed qed -lemma (in product_sigma_finite) - assumes "finite I" - shows sigma_finite: "sigma_finite_measure (PiM I M)" - and emeasure_PiM: - "\A. (\i. i\I \ A i \ sets (M i)) \ emeasure (PiM I M) (Pi\<^isub>E I A) = (\i\I. emeasure (M i) (A i))" -using `finite I` proof induct +lemma (in product_sigma_finite) emeasure_PiM: + "finite I \ (\i. i\I \ A i \ sets (M i)) \ emeasure (PiM I M) (Pi\<^isub>E I A) = (\i\I. emeasure (M i) (A i))" +proof (induct I arbitrary: A rule: finite_induct) case empty let ?\ = "\A. if A = {} then 0 else (1::ereal)" have "prod_algebra {} M = {{\_. undefined}}" @@ -610,21 +605,13 @@ qed (auto simp: prod_emb_def) also have *: "(prod_emb {} M {} (\\<^isub>E i\{}. {})) = {\_. undefined}" by (auto simp: prod_emb_def) - finally have emeasure_eq: "emeasure (Pi\<^isub>M {} M) {\_. undefined} = 1" . - - interpret finite_measure "PiM {} M" - by default (simp add: space_PiM emeasure_eq) - case 1 show ?case .. - - case 2 show ?case - using emeasure_eq * by simp + finally show ?case + using * by simp next case (insert i I) interpret finite_product_sigma_finite M I by default fact have "finite (insert i I)" using `finite I` by auto interpret I': finite_product_sigma_finite M "insert i I" by default fact - interpret I: sigma_finite_measure "PiM I M" by fact - interpret P: pair_sigma_finite "PiM I M" "M i" .. let ?h = "(\(f, y). f(i := y))" let ?P = "distr (Pi\<^isub>M I M \\<^isub>M M i) (Pi\<^isub>M (insert i I) M) ?h" @@ -632,67 +619,73 @@ let ?I = "{j \ insert i I. emeasure (M j) (space (M j)) \ 1}" let ?f = "\J E j. if j \ J then emeasure (M j) (E j) else emeasure (M j) (space (M j))" - { case 2 - have "emeasure (Pi\<^isub>M (insert i I) M) (prod_emb (insert i I) M (insert i I) (Pi\<^isub>E (insert i I) A)) = - (\i\insert i I. emeasure (M i) (A i))" - proof (subst emeasure_extend_measure_Pair[OF PiM_def]) - fix J E assume "(J \ {} \ insert i I = {}) \ finite J \ J \ insert i I \ E \ (\ j\J. sets (M j))" - then have J: "J \ {}" "finite J" "J \ insert i I" and E: "\j\J. E j \ sets (M j)" by auto - let ?p = "prod_emb (insert i I) M J (Pi\<^isub>E J E)" - let ?p' = "prod_emb I M (J - {i}) (\\<^isub>E j\J-{i}. E j)" - have "?\ ?p = - emeasure (Pi\<^isub>M I M \\<^isub>M (M i)) (?h -` ?p \ space (Pi\<^isub>M I M \\<^isub>M M i))" - by (intro emeasure_distr measurable_add_dim sets_PiM_I) fact+ - also have "?h -` ?p \ space (Pi\<^isub>M I M \\<^isub>M M i) = ?p' \ (if i \ J then E i else space (M i))" - using J E[rule_format, THEN sets_into_space] - by (force simp: space_pair_measure space_PiM Pi_iff prod_emb_iff split: split_if_asm) - also have "emeasure (Pi\<^isub>M I M \\<^isub>M (M i)) (?p' \ (if i \ J then E i else space (M i))) = - emeasure (Pi\<^isub>M I M) ?p' * emeasure (M i) (if i \ J then (E i) else space (M i))" - using J E by (intro P.emeasure_pair_measure_Times sets_PiM_I) auto - also have "?p' = (\\<^isub>E j\I. if j \ J-{i} then E j else space (M j))" - using J E[rule_format, THEN sets_into_space] - by (auto simp: prod_emb_iff Pi_iff split: split_if_asm) blast+ - also have "emeasure (Pi\<^isub>M I M) (\\<^isub>E j\I. if j \ J-{i} then E j else space (M j)) = - (\ j\I. if j \ J-{i} then emeasure (M j) (E j) else emeasure (M j) (space (M j)))" - using E by (subst insert) (auto intro!: setprod_cong) - also have "(\j\I. if j \ J - {i} then emeasure (M j) (E j) else emeasure (M j) (space (M j))) * - emeasure (M i) (if i \ J then E i else space (M i)) = (\j\insert i I. ?f J E j)" - using insert by (auto simp: mult_commute intro!: arg_cong2[where f="op *"] setprod_cong) - also have "\ = (\j\J \ ?I. ?f J E j)" - using insert(1,2) J E by (intro setprod_mono_one_right) auto - finally show "?\ ?p = \" . + have "emeasure (Pi\<^isub>M (insert i I) M) (prod_emb (insert i I) M (insert i I) (Pi\<^isub>E (insert i I) A)) = + (\i\insert i I. emeasure (M i) (A i))" + proof (subst emeasure_extend_measure_Pair[OF PiM_def]) + fix J E assume "(J \ {} \ insert i I = {}) \ finite J \ J \ insert i I \ E \ (\ j\J. sets (M j))" + then have J: "J \ {}" "finite J" "J \ insert i I" and E: "\j\J. E j \ sets (M j)" by auto + let ?p = "prod_emb (insert i I) M J (Pi\<^isub>E J E)" + let ?p' = "prod_emb I M (J - {i}) (\\<^isub>E j\J-{i}. E j)" + have "?\ ?p = + emeasure (Pi\<^isub>M I M \\<^isub>M (M i)) (?h -` ?p \ space (Pi\<^isub>M I M \\<^isub>M M i))" + by (intro emeasure_distr measurable_add_dim sets_PiM_I) fact+ + also have "?h -` ?p \ space (Pi\<^isub>M I M \\<^isub>M M i) = ?p' \ (if i \ J then E i else space (M i))" + using J E[rule_format, THEN sets_into_space] + by (force simp: space_pair_measure space_PiM Pi_iff prod_emb_iff split: split_if_asm) + also have "emeasure (Pi\<^isub>M I M \\<^isub>M (M i)) (?p' \ (if i \ J then E i else space (M i))) = + emeasure (Pi\<^isub>M I M) ?p' * emeasure (M i) (if i \ J then (E i) else space (M i))" + using J E by (intro M.emeasure_pair_measure_Times sets_PiM_I) auto + also have "?p' = (\\<^isub>E j\I. if j \ J-{i} then E j else space (M j))" + using J E[rule_format, THEN sets_into_space] + by (auto simp: prod_emb_iff Pi_iff split: split_if_asm) blast+ + also have "emeasure (Pi\<^isub>M I M) (\\<^isub>E j\I. if j \ J-{i} then E j else space (M j)) = + (\ j\I. if j \ J-{i} then emeasure (M j) (E j) else emeasure (M j) (space (M j)))" + using E by (subst insert) (auto intro!: setprod_cong) + also have "(\j\I. if j \ J - {i} then emeasure (M j) (E j) else emeasure (M j) (space (M j))) * + emeasure (M i) (if i \ J then E i else space (M i)) = (\j\insert i I. ?f J E j)" + using insert by (auto simp: mult_commute intro!: arg_cong2[where f="op *"] setprod_cong) + also have "\ = (\j\J \ ?I. ?f J E j)" + using insert(1,2) J E by (intro setprod_mono_one_right) auto + finally show "?\ ?p = \" . - show "prod_emb (insert i I) M J (Pi\<^isub>E J E) \ Pow (\\<^isub>E i\insert i I. space (M i))" - using J E[rule_format, THEN sets_into_space] by (auto simp: prod_emb_iff) - next - show "positive (sets (Pi\<^isub>M (insert i I) M)) ?\" "countably_additive (sets (Pi\<^isub>M (insert i I) M)) ?\" - using emeasure_positive[of ?P] emeasure_countably_additive[of ?P] by simp_all - next - show "(insert i I \ {} \ insert i I = {}) \ finite (insert i I) \ - insert i I \ insert i I \ A \ (\ j\insert i I. sets (M j))" - using insert(1,2) 2 by auto - qed (auto intro!: setprod_cong) - with 2[THEN sets_into_space] show ?case by (subst (asm) prod_emb_PiE_same_index) auto } - note product = this + show "prod_emb (insert i I) M J (Pi\<^isub>E J E) \ Pow (\\<^isub>E i\insert i I. space (M i))" + using J E[rule_format, THEN sets_into_space] by (auto simp: prod_emb_iff) + next + show "positive (sets (Pi\<^isub>M (insert i I) M)) ?\" "countably_additive (sets (Pi\<^isub>M (insert i I) M)) ?\" + using emeasure_positive[of ?P] emeasure_countably_additive[of ?P] by simp_all + next + show "(insert i I \ {} \ insert i I = {}) \ finite (insert i I) \ + insert i I \ insert i I \ A \ (\ j\insert i I. sets (M j))" + using insert by auto + qed (auto intro!: setprod_cong) + with insert show ?case + by (subst (asm) prod_emb_PiE_same_index) (auto intro!: sets_into_space) +qed - from I'.sigma_finite_pairs guess F :: "'i \ nat \ 'a set" .. - then have F: "\j. j \ insert i I \ range (F j) \ sets (M j)" - "incseq (\k. \\<^isub>E j \ insert i I. F j k)" - "(\k. \\<^isub>E j \ insert i I. F j k) = space (Pi\<^isub>M (insert i I) M)" - "\k. \j. j \ insert i I \ emeasure (M j) (F j k) \ \" +lemma (in product_sigma_finite) sigma_finite: + assumes "finite I" + shows "sigma_finite_measure (PiM I M)" +proof - + interpret finite_product_sigma_finite M I by default fact + + from sigma_finite_pairs guess F :: "'i \ nat \ 'a set" .. + then have F: "\j. j \ I \ range (F j) \ sets (M j)" + "incseq (\k. \\<^isub>E j \ I. F j k)" + "(\k. \\<^isub>E j \ I. F j k) = space (Pi\<^isub>M I M)" + "\k. \j. j \ I \ emeasure (M j) (F j k) \ \" by blast+ - let ?F = "\k. \\<^isub>E j \ insert i I. F j k" + let ?F = "\k. \\<^isub>E j \ I. F j k" - case 1 show ?case + show ?thesis proof (unfold_locales, intro exI[of _ ?F] conjI allI) - show "range ?F \ sets (Pi\<^isub>M (insert i I) M)" using F(1) insert(1,2) by auto + show "range ?F \ sets (Pi\<^isub>M I M)" using F(1) `finite I` by auto next - from F(3) show "(\i. ?F i) = space (Pi\<^isub>M (insert i I) M)" by simp + from F(3) show "(\i. ?F i) = space (Pi\<^isub>M I M)" by simp next fix j - from F `finite I` setprod_PInf[of "insert i I", OF emeasure_nonneg, of M] - show "emeasure (\\<^isub>M i\insert i I. M i) (?F j) \ \" - by (subst product) auto + from F `finite I` setprod_PInf[of I, OF emeasure_nonneg, of M] + show "emeasure (\\<^isub>M i\I. M i) (?F j) \ \" + by (subst emeasure_PiM) auto qed qed @@ -786,7 +779,7 @@ using A by (intro emeasure_distr measurable_merge) (auto simp: sets_PiM) also have "emeasure ?B ?X = (\i\I. emeasure (M i) (F i)) * (\i\J. emeasure (M i) (F i))" using `finite J` `finite I` F X - by (simp add: P.emeasure_pair_measure_Times I.measure_times J.measure_times Pi_iff) + by (simp add: J.emeasure_pair_measure_Times I.measure_times J.measure_times Pi_iff) also have "\ = (\i\I \ J. emeasure (M i) (F i))" using `finite J` `finite I` `I \ J = {}` by (simp add: setprod_Un_one) also have "\ = emeasure ?P (Pi\<^isub>E (I \ J) F)" @@ -806,10 +799,10 @@ interpret J: finite_product_sigma_finite M J by default fact interpret P: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" by default have P_borel: "(\x. f (case x of (x, y) \ merge I x J y)) \ borel_measurable (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M)" - using measurable_comp[OF measurable_merge[OF IJ(1)] f] by (simp add: comp_def) + using measurable_comp[OF measurable_merge f] by (simp add: comp_def) show ?thesis apply (subst distr_merge[OF IJ, symmetric]) - apply (subst positive_integral_distr[OF measurable_merge f, OF IJ(1)]) + apply (subst positive_integral_distr[OF measurable_merge f]) apply (subst P.positive_integral_fst_measurable(2)[symmetric, OF P_borel]) apply simp done @@ -914,17 +907,42 @@ from f have f_borel: "f \ borel_measurable (Pi\<^isub>M (I \ J) M)" by auto have P_borel: "(\x. f (case x of (x, y) \ merge I x J y)) \ borel_measurable (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M)" - using measurable_comp[OF measurable_merge[OF IJ(1)] f_borel] by (simp add: comp_def) + using measurable_comp[OF measurable_merge f_borel] by (simp add: comp_def) have f_int: "integrable (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M) ?f" - by (rule integrable_distr[OF measurable_merge[OF IJ]]) (simp add: distr_merge[OF IJ fin] f) + by (rule integrable_distr[OF measurable_merge]) (simp add: distr_merge[OF IJ fin] f) show ?thesis apply (subst distr_merge[symmetric, OF IJ fin]) - apply (subst integral_distr[OF measurable_merge[OF IJ] f_borel]) + apply (subst integral_distr[OF measurable_merge f_borel]) apply (subst P.integrable_fst_measurable(2)[symmetric, OF f_int]) apply simp done qed +lemma (in product_sigma_finite) + assumes IJ: "I \ J = {}" "finite I" "finite J" and A: "A \ sets (Pi\<^isub>M (I \ J) M)" + shows emeasure_fold_integral: + "emeasure (Pi\<^isub>M (I \ J) M) A = (\\<^isup>+x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \ space (Pi\<^isub>M J M)) \Pi\<^isub>M I M)" (is ?I) + and emeasure_fold_measurable: + "(\x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \ space (Pi\<^isub>M J M))) \ borel_measurable (Pi\<^isub>M I M)" (is ?B) +proof - + interpret I: finite_product_sigma_finite M I by default fact + interpret J: finite_product_sigma_finite M J by default fact + interpret IJ: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" .. + have merge: "(\(x, y). merge I x J y) -` A \ space (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M) \ sets (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M)" + by (intro measurable_sets[OF _ A] measurable_merge assms) + + show ?I + apply (subst distr_merge[symmetric, OF IJ]) + apply (subst emeasure_distr[OF measurable_merge A]) + apply (subst J.emeasure_pair_measure_alt[OF merge]) + apply (auto intro!: positive_integral_cong arg_cong2[where f=emeasure] simp: space_pair_measure) + done + + show ?B + using IJ.measurable_emeasure_Pair1[OF merge] + by (simp add: vimage_compose[symmetric] comp_def space_pair_measure cong: measurable_cong) +qed + lemma (in product_sigma_finite) product_integral_insert: assumes I: "finite I" "i \ I" and f: "integrable (Pi\<^isub>M (insert i I) M) f" @@ -999,6 +1017,56 @@ by (simp add: * insert integral_multc integral_cmult[OF prod] subset_insertI) qed +lemma sets_Collect_single: + "i \ I \ A \ sets (M i) \ { x \ space (Pi\<^isub>M I M). x i \ A } \ sets (Pi\<^isub>M I M)" + unfolding sets_PiM_single + by (auto intro!: sigma_sets.Basic exI[of _ i] exI[of _ A]) (auto simp: space_PiM) + +lemma sigma_prod_algebra_sigma_eq_infinite: + fixes E :: "'i \ 'a set set" + assumes S_mono: "\i. i \ I \ incseq (S i)" + and S_union: "\i. i \ I \ (\j. S i j) = space (M i)" + and S_in_E: "\i. i \ I \ range (S i) \ E i" + assumes E_closed: "\i. i \ I \ E i \ Pow (space (M i))" + and E_generates: "\i. i \ I \ sets (M i) = sigma_sets (space (M i)) (E i)" + defines "P == {{f\\\<^isub>E i\I. space (M i). f i \ A} | i A. i \ I \ A \ E i}" + shows "sets (PiM I M) = sigma_sets (space (PiM I M)) P" +proof + let ?P = "sigma (space (Pi\<^isub>M I M)) P" + have P_closed: "P \ Pow (space (Pi\<^isub>M I M))" + using E_closed by (auto simp: space_PiM P_def Pi_iff subset_eq) + then have space_P: "space ?P = (\\<^isub>E i\I. space (M i))" + by (simp add: space_PiM) + have "sets (PiM I M) = + sigma_sets (space ?P) {{f \ \\<^isub>E i\I. space (M i). f i \ A} |i A. i \ I \ A \ sets (M i)}" + using sets_PiM_single[of I M] by (simp add: space_P) + also have "\ \ sets (sigma (space (PiM I M)) P)" + proof (safe intro!: sigma_sets_subset) + fix i A assume "i \ I" and A: "A \ sets (M i)" + then have "(\x. x i) \ measurable ?P (sigma (space (M i)) (E i))" + apply (subst measurable_iff_measure_of) + apply (simp_all add: P_closed) + using E_closed + apply (force simp: subset_eq space_PiM) + apply (force simp: subset_eq space_PiM) + apply (auto simp: P_def intro!: sigma_sets.Basic exI[of _ i]) + apply (rule_tac x=Aa in exI) + apply (auto simp: space_PiM) + done + from measurable_sets[OF this, of A] A `i \ I` E_closed + have "(\x. x i) -` A \ space ?P \ sets ?P" + by (simp add: E_generates) + also have "(\x. x i) -` A \ space ?P = {f \ \\<^isub>E i\I. space (M i). f i \ A}" + using P_closed by (auto simp: space_PiM) + finally show "\ \ sets ?P" . + qed + finally show "sets (PiM I M) \ sigma_sets (space (PiM I M)) P" + by (simp add: P_closed) + show "sigma_sets (space (PiM I M)) P \ sets (PiM I M)" + unfolding P_def space_PiM[symmetric] + by (intro sigma_sets_subset) (auto simp: E_generates sets_Collect_single) +qed + lemma sigma_prod_algebra_sigma_eq: fixes E :: "'i \ 'a set set" assumes "finite I" diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Independent_Family.thy --- a/src/HOL/Probability/Independent_Family.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Independent_Family.thy Wed Oct 10 12:12:18 2012 +0200 @@ -1035,7 +1035,7 @@ fix X assume "X \ ?E" then obtain A B where X[simp]: "X = A \ B" and A: "A \ sets M1" and B: "B \ sets M2" by auto then have "emeasure ?P X = emeasure M1 A * emeasure M2 B" - by (simp add: emeasure_pair_measure_Times) + by (simp add: M2.emeasure_pair_measure_Times) also have "\ = emeasure M (A \ B)" using A B emeasure by auto finally show "emeasure ?P X = emeasure M X" @@ -1143,7 +1143,7 @@ also have "\ = emeasure (?S \\<^isub>M ?T) (A \ B)" unfolding `?S \\<^isub>M ?T = ?J` .. also have "\ = emeasure ?S A * emeasure ?T B" - using ab by (simp add: XY.emeasure_pair_measure_Times) + using ab by (simp add: Y.emeasure_pair_measure_Times) finally show "prob ((X -` A \ space M) \ (Y -` B \ space M)) = prob (X -` A \ space M) * prob (Y -` B \ space M)" using rvs ab by (simp add: emeasure_eq_measure emeasure_distr) diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Infinite_Product_Measure.thy --- a/src/HOL/Probability/Infinite_Product_Measure.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Infinite_Product_Measure.thy Wed Oct 10 12:12:18 2012 +0200 @@ -8,31 +8,6 @@ imports Probability_Measure Caratheodory begin -lemma (in product_sigma_finite) - assumes IJ: "I \ J = {}" "finite I" "finite J" and A: "A \ sets (Pi\<^isub>M (I \ J) M)" - shows emeasure_fold_integral: - "emeasure (Pi\<^isub>M (I \ J) M) A = (\\<^isup>+x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \ space (Pi\<^isub>M J M)) \Pi\<^isub>M I M)" (is ?I) - and emeasure_fold_measurable: - "(\x. emeasure (Pi\<^isub>M J M) (merge I x J -` A \ space (Pi\<^isub>M J M))) \ borel_measurable (Pi\<^isub>M I M)" (is ?B) -proof - - interpret I: finite_product_sigma_finite M I by default fact - interpret J: finite_product_sigma_finite M J by default fact - interpret IJ: pair_sigma_finite "Pi\<^isub>M I M" "Pi\<^isub>M J M" .. - have merge: "(\(x, y). merge I x J y) -` A \ space (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M) \ sets (Pi\<^isub>M I M \\<^isub>M Pi\<^isub>M J M)" - by (intro measurable_sets[OF _ A] measurable_merge assms) - - show ?I - apply (subst distr_merge[symmetric, OF IJ]) - apply (subst emeasure_distr[OF measurable_merge[OF IJ(1)] A]) - apply (subst IJ.emeasure_pair_measure_alt[OF merge]) - apply (auto intro!: positive_integral_cong arg_cong2[where f=emeasure] simp: space_pair_measure) - done - - show ?B - using IJ.measurable_emeasure_Pair1[OF merge] - by (simp add: vimage_compose[symmetric] comp_def space_pair_measure cong: measurable_cong) -qed - lemma restrict_extensional_sub[intro]: "A \ B \ restrict f A \ extensional B" unfolding restrict_def extensional_def by auto diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Information.thy Wed Oct 10 12:12:18 2012 +0200 @@ -194,7 +194,7 @@ unfolding KL_divergence_def proof (subst integral_density) show "entropy_density b M (density M (\x. ereal (f x))) \ borel_measurable M" - using f `1 < b` + using f by (auto simp: comp_def entropy_density_def intro!: borel_measurable_log borel_measurable_RN_deriv_density) have "density M (RN_deriv M (density M f)) = density M f" using f by (intro density_RN_deriv_density) auto diff -r 970964690b3d -r 199d1d5bb17e src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Wed Oct 10 12:12:17 2012 +0200 +++ b/src/HOL/Probability/Probability_Measure.thy Wed Oct 10 12:12:18 2012 +0200 @@ -407,7 +407,7 @@ sublocale pair_prob_space \ P: prob_space "M1 \\<^isub>M M2" proof show "emeasure (M1 \\<^isub>M M2) (space (M1 \\<^isub>M M2)) = 1" - by (simp add: emeasure_pair_measure_Times M1.emeasure_space_1 M2.emeasure_space_1 space_pair_measure) + by (simp add: M2.emeasure_pair_measure_Times M1.emeasure_space_1 M2.emeasure_space_1 space_pair_measure) qed locale product_prob_space = product_sigma_finite M for M :: "'i \ 'a measure" +