# HG changeset patch # User hoelzl # Date 1295945145 -3600 # Node ID 621fa31e1dbd2d5e8cd14629dca6fce0de5cc6b3 # Parent 1eef159301dfa389f04526cd8a3926a009d558c5# Parent baf1964bc4681a1641a960aac664f3a9b3622699 merged diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Information.thy Tue Jan 25 09:45:45 2011 +0100 @@ -180,30 +180,6 @@ by (simp add: cong \.integral_cong_measure[OF cong(2)]) qed -lemma (in sigma_finite_measure) KL_divergence_vimage: - assumes f: "bij_betw f S (space M)" - assumes \: "measure_space M \" "absolutely_continuous \" - shows "KL_divergence b (vimage_algebra S f) (\A. \ (f ` A)) (\A. \ (f ` A)) = KL_divergence b M \ \" - (is "KL_divergence b ?M ?\ ?\ = _") -proof - - interpret \: measure_space M \ by fact - interpret v: measure_space ?M ?\ - using f by (rule \.measure_space_isomorphic) - - let ?RN = "sigma_finite_measure.RN_deriv ?M ?\ ?\" - from RN_deriv_vimage[OF f[THEN bij_inv_the_inv_into] \] - have *: "\.almost_everywhere (\x. ?RN (the_inv_into S f x) = RN_deriv \ x)" - by (rule absolutely_continuous_AE[OF \]) - - show ?thesis - unfolding KL_divergence_def \.integral_vimage_inv[OF f] - apply (rule \.integral_cong_AE) - apply (rule \.AE_mp[OF *]) - apply (rule \.AE_cong) - apply simp - done -qed - lemma (in finite_measure_space) KL_divergence_eq_finite: assumes v: "finite_measure_space M \" assumes ac: "absolutely_continuous \" @@ -259,50 +235,6 @@ \ space = X`space M, sets = Pow (X`space M) \ \ space = Y`space M, sets = Pow (Y`space M) \ X Y" -lemma (in information_space) mutual_information_commute_generic: - assumes X: "random_variable S X" and Y: "random_variable T Y" - assumes ac: "measure_space.absolutely_continuous (sigma (pair_algebra S T)) - (pair_sigma_finite.pair_measure S (distribution X) T (distribution Y)) (joint_distribution X Y)" - shows "mutual_information b S T X Y = mutual_information b T S Y X" -proof - - interpret P: prob_space "sigma (pair_algebra S T)" "joint_distribution X Y" - using random_variable_pairI[OF X Y] by (rule distribution_prob_space) - interpret Q: prob_space "sigma (pair_algebra T S)" "joint_distribution Y X" - using random_variable_pairI[OF Y X] by (rule distribution_prob_space) - interpret X: prob_space S "distribution X" using X by (rule distribution_prob_space) - interpret Y: prob_space T "distribution Y" using Y by (rule distribution_prob_space) - interpret ST: pair_sigma_finite S "distribution X" T "distribution Y" by default - interpret TS: pair_sigma_finite T "distribution Y" S "distribution X" by default - - have ST: "measure_space (sigma (pair_algebra S T)) (joint_distribution X Y)" by default - have TS: "measure_space (sigma (pair_algebra T S)) (joint_distribution Y X)" by default - - have bij_ST: "bij_betw (\(x, y). (y, x)) (space (sigma (pair_algebra S T))) (space (sigma (pair_algebra T S)))" - by (auto intro!: inj_onI simp: space_pair_algebra bij_betw_def) - have bij_TS: "bij_betw (\(x, y). (y, x)) (space (sigma (pair_algebra T S))) (space (sigma (pair_algebra S T)))" - by (auto intro!: inj_onI simp: space_pair_algebra bij_betw_def) - - { fix A - have "joint_distribution X Y ((\(x, y). (y, x)) ` A) = joint_distribution Y X A" - unfolding distribution_def by (auto intro!: arg_cong[where f=\]) } - note jd_commute = this - - { fix A assume A: "A \ sets (sigma (pair_algebra T S))" - have *: "\x y. indicator ((\(x, y). (y, x)) ` A) (x, y) = (indicator A (y, x) :: pextreal)" - unfolding indicator_def by auto - have "ST.pair_measure ((\(x, y). (y, x)) ` A) = TS.pair_measure A" - unfolding ST.pair_measure_def TS.pair_measure_def - using A by (auto simp add: TS.Fubini[symmetric] *) } - note pair_measure_commute = this - - show ?thesis - unfolding mutual_information_def - unfolding ST.KL_divergence_vimage[OF bij_TS ST ac, symmetric] - unfolding space_sigma space_pair_algebra jd_commute - unfolding ST.pair_sigma_algebra_swap[symmetric] - by (simp cong: TS.KL_divergence_cong[OF TS] add: pair_measure_commute) -qed - lemma (in prob_space) finite_variables_absolutely_continuous: assumes X: "finite_random_variable S X" and Y: "finite_random_variable T Y" shows "measure_space.absolutely_continuous (sigma (pair_algebra S T)) @@ -330,16 +262,6 @@ qed qed -lemma (in information_space) mutual_information_commute: - assumes X: "finite_random_variable S X" and Y: "finite_random_variable T Y" - shows "mutual_information b S T X Y = mutual_information b T S Y X" - by (intro finite_random_variableD X Y mutual_information_commute_generic finite_variables_absolutely_continuous) - -lemma (in information_space) mutual_information_commute_simple: - assumes X: "simple_function X" and Y: "simple_function Y" - shows "\(X;Y) = \(Y;X)" - by (intro X Y simple_function_imp_finite_random_variable mutual_information_commute) - lemma (in information_space) assumes MX: "finite_random_variable MX X" assumes MY: "finite_random_variable MY Y" @@ -371,6 +293,18 @@ unfolding mutual_information_def . qed +lemma (in information_space) mutual_information_commute: + assumes X: "finite_random_variable S X" and Y: "finite_random_variable T Y" + shows "mutual_information b S T X Y = mutual_information b T S Y X" + unfolding mutual_information_generic_eq[OF X Y] mutual_information_generic_eq[OF Y X] + unfolding joint_distribution_commute_singleton[of X Y] + by (auto simp add: ac_simps intro!: setsum_reindex_cong[OF swap_inj_on]) + +lemma (in information_space) mutual_information_commute_simple: + assumes X: "simple_function X" and Y: "simple_function Y" + shows "\(X;Y) = \(Y;X)" + by (intro X Y simple_function_imp_finite_random_variable mutual_information_commute) + lemma (in information_space) mutual_information_eq: assumes "simple_function X" "simple_function Y" shows "\(X;Y) = (\ (x,y) \ X ` space M \ Y ` space M. diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Tue Jan 25 09:45:45 2011 +0100 @@ -471,20 +471,26 @@ unfolding sigma_algebra.simple_function_def[OF N_subalgebra(3)] by auto -lemma (in sigma_algebra) simple_function_vimage: - fixes g :: "'a \ pextreal" and f :: "'d \ 'a" - assumes g: "simple_function g" and f: "f \ S \ space M" - shows "sigma_algebra.simple_function (vimage_algebra S f) (\x. g (f x))" -proof - - have subset: "(\x. g (f x)) ` S \ g ` space M" - using f by auto - interpret V: sigma_algebra "vimage_algebra S f" - using f by (rule sigma_algebra_vimage) - show ?thesis using g - unfolding simple_function_eq_borel_measurable - unfolding V.simple_function_eq_borel_measurable - using measurable_vimage[OF _ f, of g borel] - using finite_subset[OF subset] by auto +lemma (in measure_space) simple_function_vimage: + assumes T: "sigma_algebra M'" "T \ measurable M M'" + and f: "sigma_algebra.simple_function M' f" + shows "simple_function (\x. f (T x))" +proof (intro simple_function_def[THEN iffD2] conjI ballI) + interpret T: sigma_algebra M' by fact + have "(\x. f (T x)) ` space M \ f ` space M'" + using T unfolding measurable_def by auto + then show "finite ((\x. f (T x)) ` space M)" + using f unfolding T.simple_function_def by (auto intro: finite_subset) + fix i assume i: "i \ (\x. f (T x)) ` space M" + then have "i \ f ` space M'" + using T unfolding measurable_def by auto + then have "f -` {i} \ space M' \ sets M'" + using f unfolding T.simple_function_def by auto + then have "T -` (f -` {i} \ space M') \ space M \ sets M" + using T unfolding measurable_def by auto + also have "T -` (f -` {i} \ space M') \ space M = (\x. f (T x)) -` {i} \ space M" + using T unfolding measurable_def by auto + finally show "(\x. f (T x)) -` {i} \ space M \ sets M" . qed section "Simple integral" @@ -816,28 +822,30 @@ unfolding measure_space.simple_integral_def_raw[OF N] by simp lemma (in measure_space) simple_integral_vimage: - fixes g :: "'a \ pextreal" and f :: "'d \ 'a" - assumes f: "bij_betw f S (space M)" - shows "simple_integral g = - measure_space.simple_integral (vimage_algebra S f) (\A. \ (f ` A)) (\x. g (f x))" - (is "_ = measure_space.simple_integral ?T ?\ _") + assumes T: "sigma_algebra M'" "T \ measurable M M'" + and f: "sigma_algebra.simple_function M' f" + shows "measure_space.simple_integral M' (\A. \ (T -` A \ space M)) f = (\\<^isup>S x. f (T x))" + (is "measure_space.simple_integral M' ?nu f = _") proof - - from f interpret T: measure_space ?T ?\ by (rule measure_space_isomorphic) - have surj: "f`S = space M" - using f unfolding bij_betw_def by simp - have *: "(\x. g (f x)) ` S = g ` f ` S" by auto - have **: "f`S = space M" using f unfolding bij_betw_def by auto - { fix x assume "x \ space M" - have "(f ` ((\x. g (f x)) -` {g x} \ S)) = - (f ` (f -` (g -` {g x}) \ S))" by auto - also have "f -` (g -` {g x}) \ S = f -` (g -` {g x} \ space M) \ S" - using f unfolding bij_betw_def by auto - also have "(f ` (f -` (g -` {g x} \ space M) \ S)) = g -` {g x} \ space M" - using ** by (intro image_vimage_inter_eq) auto - finally have "(f ` ((\x. g (f x)) -` {g x} \ S)) = g -` {g x} \ space M" by auto } - then show ?thesis using assms - unfolding simple_integral_def T.simple_integral_def bij_betw_def - by (auto simp add: * intro!: setsum_cong) + interpret T: measure_space M' ?nu using T by (rule measure_space_vimage) auto + show "T.simple_integral f = (\\<^isup>S x. f (T x))" + unfolding simple_integral_def T.simple_integral_def + proof (intro setsum_mono_zero_cong_right ballI) + show "(\x. f (T x)) ` space M \ f ` space M'" + using T unfolding measurable_def by auto + show "finite (f ` space M')" + using f unfolding T.simple_function_def by auto + next + fix i assume "i \ f ` space M' - (\x. f (T x)) ` space M" + then have "T -` (f -` {i} \ space M') \ space M = {}" by (auto simp: image_iff) + then show "i * \ (T -` (f -` {i} \ space M') \ space M) = 0" by simp + next + fix i assume "i \ (\x. f (T x)) ` space M" + then have "T -` (f -` {i} \ space M') \ space M = (\x. f (T x)) -` {i} \ space M" + using T unfolding measurable_def by auto + then show "i * \ (T -` (f -` {i} \ space M') \ space M) = i * \ ((\x. f (T x)) -` {i} \ space M)" + by auto + qed qed section "Continuous posititve integration" @@ -1016,71 +1024,6 @@ shows "f ` A = g ` B" using assms by blast -lemma (in measure_space) positive_integral_vimage: - fixes g :: "'a \ pextreal" and f :: "'d \ 'a" - assumes f: "bij_betw f S (space M)" - shows "positive_integral g = - measure_space.positive_integral (vimage_algebra S f) (\A. \ (f ` A)) (\x. g (f x))" - (is "_ = measure_space.positive_integral ?T ?\ _") -proof - - from f interpret T: measure_space ?T ?\ by (rule measure_space_isomorphic) - have f_fun: "f \ S \ space M" using assms unfolding bij_betw_def by auto - from assms have inv: "bij_betw (the_inv_into S f) (space M) S" - by (rule bij_betw_the_inv_into) - then have inv_fun: "the_inv_into S f \ space M \ S" unfolding bij_betw_def by auto - have surj: "f`S = space M" - using f unfolding bij_betw_def by simp - have inj: "inj_on f S" - using f unfolding bij_betw_def by simp - have inv_f: "\x. x \ space M \ f (the_inv_into S f x) = x" - using f_the_inv_into_f[of f S] f unfolding bij_betw_def by auto - from simple_integral_vimage[OF assms, symmetric] - have *: "simple_integral = T.simple_integral \ (\g. g \ f)" by (simp add: comp_def) - show ?thesis - unfolding positive_integral_alt1 T.positive_integral_alt1 SUPR_def * image_compose - proof (safe intro!: arg_cong[where f=Sup] image_set_cong, simp_all add: comp_def) - fix g' :: "'a \ pextreal" assume "simple_function g'" "\x\space M. g' x \ g x \ g' x \ \" - then show "\h. T.simple_function h \ (\x\S. h x \ g (f x) \ h x \ \) \ - T.simple_integral (\x. g' (f x)) = T.simple_integral h" - using f unfolding bij_betw_def - by (auto intro!: exI[of _ "\x. g' (f x)"] - simp add: le_fun_def simple_function_vimage[OF _ f_fun]) - next - fix g' :: "'d \ pextreal" assume g': "T.simple_function g'" "\x\S. g' x \ g (f x) \ g' x \ \" - let ?g = "\x. g' (the_inv_into S f x)" - show "\h. simple_function h \ (\x\space M. h x \ g x \ h x \ \) \ - T.simple_integral g' = T.simple_integral (\x. h (f x))" - proof (intro exI[of _ ?g] conjI ballI) - { fix x assume x: "x \ space M" - then have "the_inv_into S f x \ S" using inv_fun by auto - with g' have "g' (the_inv_into S f x) \ g (f (the_inv_into S f x)) \ g' (the_inv_into S f x) \ \" - by auto - then show "g' (the_inv_into S f x) \ g x" "g' (the_inv_into S f x) \ \" - using f_the_inv_into_f[of f S x] x f unfolding bij_betw_def by auto } - note vimage_vimage_inv[OF f inv_f inv_fun, simp] - from T.simple_function_vimage[OF g'(1), unfolded space_vimage_algebra, OF inv_fun] - show "simple_function (\x. g' (the_inv_into S f x))" - unfolding simple_function_def by (simp add: simple_function_def) - show "T.simple_integral g' = T.simple_integral (\x. ?g (f x))" - using the_inv_into_f_f[OF inj] by (auto intro!: T.simple_integral_cong) - qed - qed -qed - -lemma (in measure_space) positive_integral_vimage_inv: - fixes g :: "'d \ pextreal" and f :: "'d \ 'a" - assumes f: "bij_inv S (space M) f h" - shows "measure_space.positive_integral (vimage_algebra S f) (\A. \ (f ` A)) g = - (\\<^isup>+x. g (h x))" -proof - - interpret v: measure_space "vimage_algebra S f" "\A. \ (f ` A)" - using f by (rule measure_space_isomorphic[OF bij_inv_bij_betw(1)]) - show ?thesis - unfolding positive_integral_vimage[OF f[THEN bij_inv_bij_betw(1)], of "\x. g (h x)"] - using f[unfolded bij_inv_def] - by (auto intro!: v.positive_integral_cong) -qed - lemma (in measure_space) positive_integral_SUP_approx: assumes "f \ s" and f: "\i. f i \ borel_measurable M" @@ -1245,6 +1188,23 @@ using positive_integral_isoton[OF `f \ u` e(1)[THEN borel_measurable_simple_function]] unfolding positive_integral_eq_simple_integral[OF e] . +lemma (in measure_space) positive_integral_vimage: + assumes T: "sigma_algebra M'" "T \ measurable M M'" and f: "f \ borel_measurable M'" + shows "measure_space.positive_integral M' (\A. \ (T -` A \ space M)) f = (\\<^isup>+ x. f (T x))" + (is "measure_space.positive_integral M' ?nu f = _") +proof - + interpret T: measure_space M' ?nu using T by (rule measure_space_vimage) auto + obtain f' where f': "f' \ f" "\i. T.simple_function (f' i)" + using T.borel_measurable_implies_simple_function_sequence[OF f] by blast + then have f: "(\i x. f' i (T x)) \ (\x. f (T x))" "\i. simple_function (\x. f' i (T x))" + using simple_function_vimage[OF T] unfolding isoton_fun_expand by auto + show "T.positive_integral f = (\\<^isup>+ x. f (T x))" + using positive_integral_isoton_simple[OF f] + using T.positive_integral_isoton_simple[OF f'] + unfolding simple_integral_vimage[OF T f'(2)] isoton_def + by simp +qed + lemma (in measure_space) positive_integral_linear: assumes f: "f \ borel_measurable M" and g: "g \ borel_measurable M" @@ -1614,21 +1574,21 @@ thus ?thesis by (simp del: Real_eq_0 add: integral_def) qed -lemma (in measure_space) integral_vimage_inv: - assumes f: "bij_betw f S (space M)" - shows "measure_space.integral (vimage_algebra S f) (\A. \ (f ` A)) (\x. g x) = (\x. g (the_inv_into S f x))" +lemma (in measure_space) integral_vimage: + assumes T: "sigma_algebra M'" "T \ measurable M M'" + assumes f: "measure_space.integrable M' (\A. \ (T -` A \ space M)) f" + shows "integrable (\x. f (T x))" (is ?P) + and "measure_space.integral M' (\A. \ (T -` A \ space M)) f = (\x. f (T x))" (is ?I) proof - - interpret v: measure_space "vimage_algebra S f" "\A. \ (f ` A)" - using f by (rule measure_space_isomorphic) - have "\x. x \ space (vimage_algebra S f) \ the_inv_into S f (f x) = x" - using f[unfolded bij_betw_def] by (simp add: the_inv_into_f_f) - then have *: "v.positive_integral (\x. Real (g (the_inv_into S f (f x)))) = v.positive_integral (\x. Real (g x))" - "v.positive_integral (\x. Real (- g (the_inv_into S f (f x)))) = v.positive_integral (\x. Real (- g x))" - by (auto intro!: v.positive_integral_cong) - show ?thesis - unfolding integral_def v.integral_def - unfolding positive_integral_vimage[OF f] - by (simp add: *) + interpret T: measure_space M' "\A. \ (T -` A \ space M)" + using T by (rule measure_space_vimage) auto + from measurable_comp[OF T(2), of f borel] + have borel: "(\x. Real (f x)) \ borel_measurable M'" "(\x. Real (- f x)) \ borel_measurable M'" + and "(\x. f (T x)) \ borel_measurable M" + using f unfolding T.integrable_def by (auto simp: comp_def) + then show ?P ?I + using f unfolding T.integral_def integral_def T.integrable_def integrable_def + unfolding borel[THEN positive_integral_vimage[OF T]] by auto qed lemma (in measure_space) integral_minus[intro, simp]: diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Lebesgue_Measure.thy --- a/src/HOL/Probability/Lebesgue_Measure.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Lebesgue_Measure.thy Tue Jan 25 09:45:45 2011 +0100 @@ -45,6 +45,8 @@ definition lebesgue :: "'a::ordered_euclidean_space algebra" where "lebesgue = \ space = UNIV, sets = {A. \n. (indicator A :: 'a \ real) integrable_on cube n} \" +definition "lmeasure A = (SUP n. Real (integral (cube n) (indicator A)))" + lemma space_lebesgue[simp]: "space lebesgue = UNIV" unfolding lebesgue_def by simp @@ -104,8 +106,6 @@ qed (auto intro: LIMSEQ_indicator_UN simp: cube_def) qed simp -definition "lmeasure A = (SUP n. Real (integral (cube n) (indicator A)))" - interpretation lebesgue: measure_space lebesgue lmeasure proof have *: "indicator {} = (\x. 0 :: real)" by (simp add: fun_eq_iff) @@ -736,6 +736,21 @@ show "p2e \ ?P \ ?U" "e2p \ ?U \ ?P" by (auto simp: e2p_def) qed auto +declare restrict_extensional[intro] + +lemma e2p_extensional[intro]:"e2p (y::'a::ordered_euclidean_space) \ extensional {.. extensional {.. e2p ` A" then guess y unfolding image_iff .. note y=this + show "x \ p2e -` A \ extensional {.. p2e -` A \ extensional {.. e2p ` A" unfolding image_iff apply(rule_tac x="p2e x" in bexI) apply(subst e2p_p2e) by auto +qed + interpretation borel_product: product_sigma_finite "\x. borel::real algebra" "\x. lmeasure" by default @@ -767,6 +782,14 @@ then show "e2p -` A \ space ?E \ sets ?E" by simp qed +lemma measurable_e2p: + "e2p \ measurable (borel::'a algebra) + (sigma (product_algebra (\x. borel :: real algebra) {.. Pow (space F)" "sets ?E \ Pow (space ?E)" unfolding F_def - by (intro product_algebra_sets_into_space) auto - show "p2e \ measurable F ?E" - "e2p \ measurable ?E F" - unfolding F_def using measurable_p2e_on_generator measurable_e2p_on_generator by auto -qed - -lemma product_borel_eq_vimage: - "sigma (product_algebra (\x. borel) {.. 'a::ordered_euclidean_space)" - unfolding borel_vimage_algebra_eq[simplified] - unfolding borel_eq_lessThan - apply(subst sigma_product_algebra_sigma_eq[where S="\i. \n. lessThan (real n)"]) - unfolding lessThan_iff -proof- fix i assume i:"in. {.. space \space = UNIV, sets = range lessThan\" - by(auto intro!:real_arch_lt isotoneI) -qed auto +lemma measurable_p2e: + "p2e \ measurable (sigma (product_algebra (\x. borel :: real algebra) {.. extensional {.. extensional {.. e2p ` A" then guess y unfolding image_iff .. note y=this - show "x \ p2e -` A \ extensional {.. p2e -` A \ extensional {.. e2p ` A" unfolding image_iff apply(rule_tac x="p2e x" in bexI) apply(subst e2p_p2e) by auto -qed - lemma lmeasure_measure_eq_borel_prod: fixes A :: "('a::ordered_euclidean_space) set" assumes "A \ sets borel" shows "lmeasure A = borel_product.product_measure {.. real) set)" proof (rule measure_unique_Int_stable[where X=A and A=cube]) - interpret fprod: finite_product_sigma_finite "\x. borel" "\x. lmeasure" "{..x. borel :: real algebra" "\x. lmeasure" "{.. space = UNIV :: 'a set, sets = range (\(a,b). {a..b}) \" (is "Int_stable ?E" ) using Int_stable_cuboids' . show "borel = sigma ?E" using borel_eq_atLeastAtMost . @@ -906,64 +879,19 @@ show "measure_space borel lmeasure" by default show "measure_space borel (\a::'a set. finite_product_sigma_finite.measure (\x. borel) (\x. lmeasure) {.. 'a set" assume A:"range A \ sets borel" "disjoint_family A" - "(\i. A i) \ sets borel" - note fprod.ca[unfolded countably_additive_def,rule_format] - note ca = this[of "\ n. e2p ` (A n)"] - show "(\\<^isub>\n. finite_product_sigma_finite.measure - (\x. borel) (\x. lmeasure) {..x. borel) - (\x. lmeasure) {..i. A i))" unfolding image_UN - proof(rule ca) show "range (\n. e2p ` A n) \ sets - (sigma (product_algebra (\x. borel) {..n. e2p ` A n)" apply(rule inj_on_disjoint_family_on) - using bij_inv_p2e_e2p[THEN bij_inv_bij_betw(2)] using A(2) unfolding bij_betw_def by auto - show "(\n. e2p ` A n) \ sets (sigma (product_algebra (\x. borel) {.. (\n. e2p ` A n)" hence "p2e x \ (\i. A i)" by auto - moreover have "x \ extensional {.. p2e -` (\i. A i) \ extensional {.. p2e -` (\i. A i) \ extensional {.. (\i. A i)" by auto - hence "\n. x \ e2p ` A n" apply safe apply(rule_tac x=i in exI) - unfolding image_iff apply(rule_tac x="p2e x" in bexI) - apply(subst e2p_p2e) using x by auto - thus "x \ (\n. e2p ` A n)" by auto - qed - qed - qed auto + proof (rule fprod.measure_space_vimage) + show "sigma_algebra borel" by default + show "(p2e :: (nat \ real) \ 'a) \ measurable fprod.P borel" by (rule measurable_p2e) + fix A :: "'a set" assume "A \ sets borel" + show "fprod.measure (e2p ` A) = fprod.measure (p2e -` A \ space fprod.P)" + by (simp add: e2p_image_vimage) + qed qed -lemma e2p_p2e'[simp]: fixes x::"'a::ordered_euclidean_space" - assumes "A \ extensional {..'a::ordered_euclidean_space) = UNIV" - apply safe defer unfolding image_iff apply(rule_tac x="\i. x $$ i" in bexI) - unfolding p2e_def by auto - -lemma p2e_inv_extensional:"(A::'a::ordered_euclidean_space set) - = p2e ` (p2e -` A \ extensional {..A" - let ?y = "\i. if ixa\Chi -` A \ extensional {..A` by(auto simp: *) -qed +lemma range_e2p:"range (e2p::'a::ordered_euclidean_space \ _) = extensional {.. pextreal" @@ -972,22 +900,27 @@ borel_product.product_positive_integral {.. p2e)" proof- def U \ "extensional {.. real) set" interpret fprod: finite_product_sigma_finite "\x. borel" "\x. lmeasure" "{.. 'a) - = sigma (product_algebra (\x. borel) {..A. lmeasure (p2e ` A)"]) - unfolding U_def[symmetric] *[THEN sym] o_def - proof- fix A assume A:"A \ sets (sigma_algebra.vimage_algebra borel U (p2e ::_ \ 'a))" - hence *:"A \ extensional {.. sets borel" - by (simp add: p2e_inv_extensional[of B, symmetric]) - from lmeasure_measure_eq_borel_prod[OF this] show "lmeasure (p2e ` A::'a set) = - finite_product_sigma_finite.measure (\x. borel) (\x. lmeasure) {.. _" "(\x. f (p2e x))", unfolded p2e_e2p]) + show "(e2p :: 'a \ _) \ measurable borel fprod.P" by (rule measurable_e2p) + show "sigma_algebra fprod.P" by default + from measurable_comp[OF measurable_p2e f] + show "(\x. f (p2e x)) \ borel_measurable fprod.P" by (simp add: comp_def) + let "?L A" = "lmeasure ((e2p::'a \ (nat \ real)) -` A \ space borel)" + show "measure_space.positive_integral fprod.P ?L (\x. f (p2e x)) = + fprod.positive_integral (f \ p2e)" + unfolding comp_def + proof (rule fprod.positive_integral_cong_measure) + fix A :: "(nat \ real) set" assume "A \ sets fprod.P" + then have A: "(e2p::'a \ (nat \ real)) -` A \ space borel \ sets borel" + by (rule measurable_sets[OF measurable_e2p]) + have [simp]: "A \ extensional {.. sets fprod.P`[THEN fprod.sets_into_space] by auto + show "?L A = fprod.measure A" + unfolding lmeasure_measure_eq_borel_prod[OF A] + by (simp add: range_e2p) + qed + qed qed lemma borel_fubini: diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Measure.thy --- a/src/HOL/Probability/Measure.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Measure.thy Tue Jan 25 09:45:45 2011 +0100 @@ -525,6 +525,15 @@ qed qed +lemma True +proof + fix x a b :: nat + have "\x a b :: int. x dvd a \ x dvd (a + b) \ x dvd b" + by (metis dvd_mult_div_cancel zadd_commute zdvd_reduce) + then have "x dvd a \ x dvd (a + b) \ x dvd b" + unfolding zdvd_int[of x] zadd_int[symmetric] . +qed + lemma measure_unique_Int_stable: fixes M E :: "'a algebra" and A :: "nat \ 'a set" assumes "Int_stable E" "M = sigma E" @@ -608,45 +617,6 @@ ultimately show ?thesis by (simp add: isoton_def) qed -section "Isomorphisms between measure spaces" - -lemma (in measure_space) measure_space_isomorphic: - fixes f :: "'c \ 'a" - assumes "bij_betw f S (space M)" - shows "measure_space (vimage_algebra S f) (\A. \ (f ` A))" - (is "measure_space ?T ?\") -proof - - have "f \ S \ space M" using assms unfolding bij_betw_def by auto - then interpret T: sigma_algebra ?T by (rule sigma_algebra_vimage) - show ?thesis - proof - show "\ (f`{}) = 0" by simp - show "countably_additive ?T (\A. \ (f ` A))" - proof (unfold countably_additive_def, intro allI impI) - fix A :: "nat \ 'c set" assume "range A \ sets ?T" "disjoint_family A" - then have "\i. \F'. F' \ sets M \ A i = f -` F' \ S" - by (auto simp: image_iff image_subset_iff Bex_def vimage_algebra_def) - from choice[OF this] obtain F where F: "\i. F i \ sets M" and A: "\i. A i = f -` F i \ S" by auto - then have [simp]: "\i. f ` (A i) = F i" - using sets_into_space assms - by (force intro!: image_vimage_inter_eq[where T="space M"] simp: bij_betw_def) - have "disjoint_family F" - proof (intro disjoint_family_on_bisimulation[OF `disjoint_family A`]) - fix n m assume "A n \ A m = {}" - then have "f -` (F n \ F m) \ S = {}" unfolding A by auto - moreover - have "F n \ sets M" "F m \ sets M" using F by auto - then have "f`S = space M" "F n \ F m \ space M" - using sets_into_space assms by (auto simp: bij_betw_def) - note image_vimage_inter_eq[OF this, symmetric] - ultimately show "F n \ F m = {}" by simp - qed - with F show "(\\<^isub>\ i. \ (f ` A i)) = \ (f ` (\i. A i))" - by (auto simp add: image_UN intro!: measure_countably_additive) - qed - qed -qed - section "@{text \}-null sets" abbreviation (in measure_space) "null_sets \ {N\sets M. \ N = 0}" @@ -803,23 +773,17 @@ lemma (in measure_space) AE_conjI: assumes AE_P: "AE x. P x" and AE_Q: "AE x. Q x" shows "AE x. P x \ Q x" -proof - - from AE_P obtain A where P: "{x\space M. \ P x} \ A" - and A: "A \ sets M" "\ A = 0" - by (auto elim!: AE_E) - - from AE_Q obtain B where Q: "{x\space M. \ Q x} \ B" - and B: "B \ sets M" "\ B = 0" - by (auto elim!: AE_E) + apply (rule AE_mp[OF AE_P]) + apply (rule AE_mp[OF AE_Q]) + by simp - show ?thesis - proof (intro AE_I) - show "A \ B \ sets M" "\ (A \ B) = 0" using A B - using measure_subadditive[of A B] by auto - show "{x\space M. \ (P x \ Q x)} \ A \ B" - using P Q by auto - qed -qed +lemma (in measure_space) AE_conj_iff[simp]: + shows "(AE x. P x \ Q x) \ (AE x. P x) \ (AE x. Q x)" +proof (intro conjI iffI AE_conjI) + assume *: "AE x. P x \ Q x" + from * show "AE x. P x" by (rule AE_mp) auto + from * show "AE x. Q x" by (rule AE_mp) auto +qed auto lemma (in measure_space) AE_E2: assumes "AE x. P x" "{x\space M. P x} \ sets M" @@ -845,14 +809,6 @@ by (rule AE_mp[OF AE_space]) auto qed -lemma (in measure_space) AE_conj_iff[simp]: - shows "(AE x. P x \ Q x) \ (AE x. P x) \ (AE x. Q x)" -proof (intro conjI iffI AE_conjI) - assume *: "AE x. P x \ Q x" - from * show "AE x. P x" by (rule AE_mp) auto - from * show "AE x. Q x" by (rule AE_mp) auto -qed auto - lemma (in measure_space) all_AE_countable: "(\i::'i::countable. AE x. P i x) \ (AE x. \i. P i x)" proof @@ -893,27 +849,28 @@ lemma (in measure_space) measure_space_vimage: fixes M' :: "'b algebra" - assumes "f \ measurable M M'" - and "sigma_algebra M'" - shows "measure_space M' (\A. \ (f -` A \ space M))" (is "measure_space M' ?T") + assumes T: "sigma_algebra M'" "T \ measurable M M'" + and \: "\A. A \ sets M' \ \ A = \ (T -` A \ space M)" + shows "measure_space M' \" proof - interpret M': sigma_algebra M' by fact - show ?thesis proof - show "?T {} = 0" by simp + show "\ {} = 0" using \[of "{}"] by simp - show "countably_additive M' ?T" - proof (unfold countably_additive_def, safe) + show "countably_additive M' \" + proof (intro countably_additive_def[THEN iffD2] allI impI) fix A :: "nat \ 'b set" assume "range A \ sets M'" "disjoint_family A" - hence *: "\i. f -` (A i) \ space M \ sets M" - using `f \ measurable M M'` by (auto simp: measurable_def) - moreover have "(\i. f -` A i \ space M) \ sets M" + then have A: "\i. A i \ sets M'" "(\i. A i) \ sets M'" by auto + then have *: "range (\i. T -` (A i) \ space M) \ sets M" + using `T \ measurable M M'` by (auto simp: measurable_def) + moreover have "(\i. T -` A i \ space M) \ sets M" using * by blast - moreover have **: "disjoint_family (\i. f -` A i \ space M)" + moreover have **: "disjoint_family (\i. T -` A i \ space M)" using `disjoint_family A` by (auto simp: disjoint_family_on_def) - ultimately show "(\\<^isub>\ i. ?T (A i)) = ?T (\i. A i)" - using measure_countably_additive[OF _ **] by (auto simp: comp_def vimage_UN) + ultimately show "(\\<^isub>\ i. \ (A i)) = \ (\i. A i)" + using measure_countably_additive[OF _ **] A + by (auto simp: comp_def vimage_UN \) qed qed qed @@ -1020,29 +977,6 @@ qed force+ qed -lemma (in sigma_finite_measure) sigma_finite_measure_isomorphic: - assumes f: "bij_betw f S (space M)" - shows "sigma_finite_measure (vimage_algebra S f) (\A. \ (f ` A))" -proof - - interpret M: measure_space "vimage_algebra S f" "\A. \ (f ` A)" - using f by (rule measure_space_isomorphic) - show ?thesis - proof default - from sigma_finite guess A::"nat \ 'a set" .. note A = this - show "\A::nat\'b set. range A \ sets (vimage_algebra S f) \ (\i. A i) = space (vimage_algebra S f) \ (\i. \ (f ` A i) \ \)" - proof (intro exI conjI) - show "(\i::nat. f -` A i \ S) = space (vimage_algebra S f)" - using A f[THEN bij_betw_imp_funcset] by (auto simp: vimage_UN[symmetric]) - show "range (\i. f -` A i \ S) \ sets (vimage_algebra S f)" - using A by (auto simp: vimage_algebra_def) - have "\i. f ` (f -` A i \ S) = A i" - using f A sets_into_space - by (intro image_vimage_inter_eq) (auto simp: bij_betw_def) - then show "\i. \ (f ` (f -` A i \ S)) \ \" using A by simp - qed - qed -qed - section "Real measure values" lemma (in measure_space) real_measure_Union: diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Probability_Space.thy --- a/src/HOL/Probability/Probability_Space.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Probability_Space.thy Tue Jan 25 09:45:45 2011 +0100 @@ -195,8 +195,8 @@ assumes "random_variable S X" shows "prob_space S (distribution X)" proof - - interpret S: measure_space S "distribution X" - using measure_space_vimage[of X S] assms unfolding distribution_def by simp + interpret S: measure_space S "distribution X" unfolding distribution_def + using assms by (intro measure_space_vimage) auto show ?thesis proof have "X -` space S \ space M = space M" diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Product_Measure.thy --- a/src/HOL/Probability/Product_Measure.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Product_Measure.thy Tue Jan 25 09:45:45 2011 +0100 @@ -523,22 +523,6 @@ unfolding * by (rule measurable_comp) qed -lemma (in pair_sigma_algebra) pair_sigma_algebra_swap: - "sigma (pair_algebra M2 M1) = (vimage_algebra (space M2 \ space M1) (\(x, y). (y, x)))" - unfolding vimage_algebra_def - apply (simp add: sets_sigma) - apply (subst sigma_sets_vimage[symmetric]) - apply (fastsimp simp: pair_algebra_def) - using M1.sets_into_space M2.sets_into_space apply (fastsimp simp: pair_algebra_def) -proof - - have "(\X. (\(x, y). (y, x)) -` X \ space M2 \ space M1) ` sets E - = sets (pair_algebra M2 M1)" (is "?S = _") - by (rule pair_algebra_swap) - then show "sigma (pair_algebra M2 M1) = \space = space M2 \ space M1, - sets = sigma_sets (space M2 \ space M1) ?S\" - by (simp add: pair_algebra_def sigma_def) -qed - definition (in pair_sigma_finite) "pair_measure A = M1.positive_integral (\x. M2.positive_integral (\y. indicator A (x, y)))" @@ -644,6 +628,17 @@ qed qed +lemma (in pair_sigma_algebra) sets_swap: + assumes "A \ sets P" + shows "(\(x, y). (y, x)) -` A \ space (sigma (pair_algebra M2 M1)) \ sets (sigma (pair_algebra M2 M1))" + (is "_ -` A \ space ?Q \ sets ?Q") +proof - + have *: "(\(x, y). (y, x)) -` A \ space ?Q = (\(x, y). (y, x)) ` A" + using `A \ sets P` sets_into_space by (auto simp: space_pair_algebra) + show ?thesis + unfolding * using assms by (rule sets_pair_sigma_algebra_swap) +qed + lemma (in pair_sigma_finite) pair_measure_alt2: assumes "A \ sets P" shows "pair_measure A = M2.positive_integral (\y. \1 ((\x. (x, y)) -` A))" @@ -656,29 +651,20 @@ show "range F \ sets E" "F \ space E" "\i. pair_measure (F i) \ \" using F by auto show "measure_space P pair_measure" by default - next + interpret Q: pair_sigma_finite M2 \2 M1 \1 by default + have P: "sigma_algebra P" by default show "measure_space P ?\" - proof - show "?\ {} = 0" by auto - show "countably_additive P ?\" - unfolding countably_additive_def - proof (intro allI impI) - fix F :: "nat \ ('a \ 'b) set" - assume F: "range F \ sets P" "disjoint_family F" - from F have *: "\i. F i \ sets P" "(\i. F i) \ sets P" by auto - moreover from F have "\i. (\y. \1 ((\x. (x, y)) -` F i)) \ borel_measurable M2" - by (intro measure_cut_measurable_snd) auto - moreover have "\y. disjoint_family (\i. (\x. (x, y)) -` F i)" - by (intro disjoint_family_on_bisimulation[OF F(2)]) auto - moreover have "\y. y \ space M2 \ range (\i. (\x. (x, y)) -` F i) \ sets M1" - using F by (auto intro!: measurable_cut_snd) - ultimately show "(\\<^isub>\n. ?\ (F n)) = ?\ (\i. F i)" - by (simp add: vimage_UN M2.positive_integral_psuminf[symmetric] - M1.measure_countably_additive - cong: M2.positive_integral_cong) - qed + apply (rule Q.measure_space_vimage[OF P]) + apply (rule Q.pair_sigma_algebra_swap_measurable) + proof - + fix A assume "A \ sets P" + from sets_swap[OF this] + show "M2.positive_integral (\y. \1 ((\x. (x, y)) -` A)) = + Q.pair_measure ((\(x, y). (y, x)) -` A \ space Q.P)" + using sets_into_space[OF `A \ sets P`] + by (auto simp add: Q.pair_measure_alt space_pair_algebra + intro!: M2.positive_integral_cong arg_cong[where f=\1]) qed - next fix X assume "X \ sets E" then obtain A B where X: "X = A \ B" and AB: "A \ sets M1" "B \ sets M2" unfolding pair_algebra_def by auto @@ -802,31 +788,40 @@ unfolding F_SUPR by simp qed +lemma (in pair_sigma_finite) positive_integral_product_swap: + assumes f: "f \ borel_measurable P" + shows "measure_space.positive_integral + (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) (\x. f (case x of (x,y)\(y,x))) = + positive_integral f" +proof - + interpret Q: pair_sigma_finite M2 \2 M1 \1 by default + have P: "sigma_algebra P" by default + show ?thesis + unfolding Q.positive_integral_vimage[OF P Q.pair_sigma_algebra_swap_measurable f, symmetric] + proof (rule positive_integral_cong_measure) + fix A + assume A: "A \ sets P" + from Q.pair_sigma_algebra_swap_measurable[THEN measurable_sets, OF this] this sets_into_space[OF this] + show "Q.pair_measure ((\(x, y). (y, x)) -` A \ space Q.P) = pair_measure A" + by (auto intro!: M1.positive_integral_cong arg_cong[where f=\2] + simp: pair_measure_alt Q.pair_measure_alt2 space_pair_algebra) + qed +qed + lemma (in pair_sigma_finite) positive_integral_snd_measurable: assumes f: "f \ borel_measurable P" shows "M2.positive_integral (\y. M1.positive_integral (\x. f (x, y))) = positive_integral f" proof - interpret Q: pair_sigma_finite M2 \2 M1 \1 by default - have s: "\x y. (case (x, y) of (x, y) \ f (y, x)) = f (y, x)" by simp - have t: "(\x. f (case x of (x, y) \ (y, x))) = (\(x, y). f (y, x))" by (auto simp: fun_eq_iff) - have bij: "bij_betw (\(x, y). (y, x)) (space M2 \ space M1) (space P)" - by (auto intro!: inj_onI simp: space_pair_algebra bij_betw_def) note pair_sigma_algebra_measurable[OF f] from Q.positive_integral_fst_measurable[OF this] have "M2.positive_integral (\y. M1.positive_integral (\x. f (x, y))) = Q.positive_integral (\(x, y). f (y, x))" by simp - also have "\ = positive_integral f" - unfolding positive_integral_vimage[OF bij, of f] t - unfolding pair_sigma_algebra_swap[symmetric] - proof (rule Q.positive_integral_cong_measure[symmetric]) - fix A assume "A \ sets Q.P" - from this Q.sets_pair_sigma_algebra_swap[OF this] - show "pair_measure ((\(x, y). (y, x)) ` A) = Q.pair_measure A" - by (auto intro!: M1.positive_integral_cong arg_cong[where f=\2] - simp: pair_measure_alt Q.pair_measure_alt2) - qed + also have "Q.positive_integral (\(x, y). f (y, x)) = positive_integral f" + unfolding positive_integral_product_swap[OF f, symmetric] + by (auto intro!: Q.positive_integral_cong) finally show ?thesis . qed @@ -863,28 +858,6 @@ qed qed -lemma (in pair_sigma_finite) positive_integral_product_swap: - "measure_space.positive_integral - (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) f = - positive_integral (\(x,y). f (y,x))" -proof - - interpret Q: pair_sigma_finite M2 \2 M1 \1 by default - have t: "(\y. case case y of (y, x) \ (x, y) of (x, y) \ f (y, x)) = f" - by (auto simp: fun_eq_iff) - have bij: "bij_betw (\(x, y). (y, x)) (space M2 \ space M1) (space P)" - by (auto intro!: inj_onI simp: space_pair_algebra bij_betw_def) - show ?thesis - unfolding positive_integral_vimage[OF bij, of "\(y,x). f (x,y)"] - unfolding pair_sigma_algebra_swap[symmetric] t - proof (rule Q.positive_integral_cong_measure[symmetric]) - fix A assume "A \ sets Q.P" - from this Q.sets_pair_sigma_algebra_swap[OF this] - show "pair_measure ((\(x, y). (y, x)) ` A) = Q.pair_measure A" - by (auto intro!: M1.positive_integral_cong arg_cong[where f=\2] - simp: pair_measure_alt Q.pair_measure_alt2) - qed -qed - lemma (in pair_sigma_algebra) measurable_product_swap: "f \ measurable (sigma (pair_algebra M2 M1)) M \ (\(x,y). f (y,x)) \ measurable P M" proof - @@ -895,27 +868,42 @@ qed lemma (in pair_sigma_finite) integrable_product_swap: - "measure_space.integrable - (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) f \ - integrable (\(x,y). f (y,x))" + assumes "integrable f" + shows "measure_space.integrable + (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) (\(x,y). f (y,x))" proof - interpret Q: pair_sigma_finite M2 \2 M1 \1 by default - show ?thesis - unfolding Q.integrable_def integrable_def - unfolding positive_integral_product_swap - unfolding measurable_product_swap - by (simp add: case_prod_distrib) + have *: "(\(x,y). f (y,x)) = (\x. f (case x of (x,y)\(y,x)))" by (auto simp: fun_eq_iff) + show ?thesis unfolding * + using assms unfolding Q.integrable_def integrable_def + apply (subst (1 2) positive_integral_product_swap) + using `integrable f` unfolding integrable_def + by (auto simp: *[symmetric] Q.measurable_product_swap[symmetric]) +qed + +lemma (in pair_sigma_finite) integrable_product_swap_iff: + "measure_space.integrable + (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) (\(x,y). f (y,x)) \ + integrable f" +proof - + interpret Q: pair_sigma_finite M2 \2 M1 \1 by default + from Q.integrable_product_swap[of "\(x,y). f (y,x)"] integrable_product_swap[of f] + show ?thesis by auto qed lemma (in pair_sigma_finite) integral_product_swap: - "measure_space.integral - (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) f = - integral (\(x,y). f (y,x))" + assumes "integrable f" + shows "measure_space.integral + (sigma (pair_algebra M2 M1)) (pair_sigma_finite.pair_measure M2 \2 M1 \1) (\(x,y). f (y,x)) = + integral f" proof - interpret Q: pair_sigma_finite M2 \2 M1 \1 by default + have *: "(\(x,y). f (y,x)) = (\x. f (case x of (x,y)\(y,x)))" by (auto simp: fun_eq_iff) show ?thesis - unfolding integral_def Q.integral_def positive_integral_product_swap - by (simp add: case_prod_distrib) + unfolding integral_def Q.integral_def * + apply (subst (1 2) positive_integral_product_swap) + using `integrable f` unfolding integrable_def + by (auto simp: *[symmetric] Q.measurable_product_swap[symmetric]) qed lemma (in pair_sigma_finite) integrable_fst_measurable: @@ -988,10 +976,10 @@ proof - interpret Q: pair_sigma_finite M2 \2 M1 \1 by default have Q_int: "Q.integrable (\(x, y). f (y, x))" - using f unfolding integrable_product_swap by simp + using f unfolding integrable_product_swap_iff . show ?INT using Q.integrable_fst_measurable(2)[OF Q_int] - unfolding integral_product_swap by simp + using integral_product_swap[OF f] by simp show ?AE using Q.integrable_fst_measurable(1)[OF Q_int] by simp @@ -1355,18 +1343,6 @@ pair_algebra_sets_into_space product_algebra_sets_into_space) auto -lemma (in product_sigma_algebra) product_product_vimage_algebra: - assumes [simp]: "I \ J = {}" - shows "sigma_algebra.vimage_algebra - (sigma (pair_algebra (sigma (product_algebra M I)) (sigma (product_algebra M J)))) - (space (sigma (product_algebra M (I \ J)))) (\x. ((\i\I. x i), (\i\J. x i))) = - sigma (product_algebra M (I \ J))" - unfolding sigma_pair_algebra_sigma_eq using sets_into_space - by (intro vimage_algebra_sigma[OF bij_inv_restrict_merge] - pair_algebra_sets_into_space product_algebra_sets_into_space - measurable_merge_on_generating measurable_restrict_on_generating) - auto - lemma (in product_sigma_algebra) pair_product_product_vimage_algebra: assumes [simp]: "I \ J = {}" shows "sigma_algebra.vimage_algebra (sigma (product_algebra M (I \ J))) @@ -1378,24 +1354,6 @@ measurable_merge_on_generating measurable_restrict_on_generating) auto -lemma (in product_sigma_algebra) pair_product_singleton_vimage_algebra: - assumes [simp]: "i \ I" - shows "sigma_algebra.vimage_algebra (sigma (pair_algebra (sigma (product_algebra M I)) (M i))) - (space (sigma (product_algebra M (insert i I)))) (\x. (restrict x I, x i)) = - (sigma (product_algebra M (insert i I)))" - unfolding sigma_pair_algebra_product_singleton using sets_into_space - by (intro vimage_algebra_sigma[OF bij_inv_restrict_insert] - pair_algebra_sets_into_space product_algebra_sets_into_space - measurable_merge_singleton_on_generating measurable_restrict_singleton_on_generating) - auto - -lemma (in product_sigma_algebra) singleton_vimage_algebra: - "sigma_algebra.vimage_algebra (sigma (product_algebra M {i})) (space (M i)) (\x. \j\{i}. x) = M i" - using sets_into_space - by (intro vimage_algebra_sigma[of "M i", unfolded M.sigma_eq, OF bij_inv_singleton[symmetric]] - product_algebra_sets_into_space measurable_singleton_on_generator measurable_component_on_generator) - auto - lemma (in product_sigma_algebra) measurable_restrict_iff: assumes IJ[simp]: "I \ J = {}" shows "f \ measurable (sigma (pair_algebra @@ -1430,6 +1388,13 @@ then show "?f \ measurable ?P M'" by (simp add: comp_def) qed +lemma (in product_sigma_algebra) singleton_vimage_algebra: + "sigma_algebra.vimage_algebra (sigma (product_algebra M {i})) (space (M i)) (\x. \j\{i}. x) = M i" + using sets_into_space + by (intro vimage_algebra_sigma[of "M i", unfolded M.sigma_eq, OF bij_inv_singleton[symmetric]] + product_algebra_sets_into_space measurable_singleton_on_generator measurable_component_on_generator) + auto + lemma (in product_sigma_algebra) measurable_component_singleton: "(\x. f (x i)) \ measurable (sigma (product_algebra M {i})) M' \ f \ measurable (M i) M'" @@ -1479,6 +1444,55 @@ using sets_into_space unfolding measurable_component_singleton[symmetric] by (auto intro!: measurable_cong arg_cong[where f=f] simp: fun_eq_iff extensional_def) + +lemma (in pair_sigma_algebra) measurable_pair_split: + assumes "sigma_algebra M1'" "sigma_algebra M2'" + assumes f: "f \ measurable M1 M1'" and g: "g \ measurable M2 M2'" + shows "(\(x, y). (f x, g y)) \ measurable P (sigma (pair_algebra M1' M2'))" +proof (rule measurable_sigma) + interpret M1': sigma_algebra M1' by fact + interpret M2': sigma_algebra M2' by fact + interpret Q: pair_sigma_algebra M1' M2' by default + show "sets Q.E \ Pow (space Q.E)" + using M1'.sets_into_space M2'.sets_into_space by (auto simp: pair_algebra_def) + show "(\(x, y). (f x, g y)) \ space P \ space Q.E" + using f g unfolding measurable_def pair_algebra_def by auto + fix A assume "A \ sets Q.E" + then obtain X Y where A: "A = X \ Y" "X \ sets M1'" "Y \ sets M2'" + unfolding pair_algebra_def by auto + then have *: "(\(x, y). (f x, g y)) -` A \ space P = + (f -` X \ space M1) \ (g -` Y \ space M2)" + by (auto simp: pair_algebra_def) + then show "(\(x, y). (f x, g y)) -` A \ space P \ sets P" + using f g A unfolding measurable_def * + by (auto intro!: pair_algebraI in_sigma) +qed + +lemma (in product_sigma_algebra) measurable_add_dim: + assumes "i \ I" "finite I" + shows "(\(f, y). f(i := y)) \ measurable (sigma (pair_algebra (sigma (product_algebra M I)) (M i))) + (sigma (product_algebra M (insert i I)))" +proof (subst measurable_cong) + interpret I: finite_product_sigma_algebra M I by default fact + interpret i: finite_product_sigma_algebra M "{i}" by default auto + interpret Ii: pair_sigma_algebra I.P "M i" by default + interpret Ii': pair_sigma_algebra I.P i.P by default + have disj: "I \ {i} = {}" using `i \ I` by auto + have "(\(x, y). (id x, \_\{i}. y)) \ measurable Ii.P Ii'.P" + proof (intro Ii.measurable_pair_split I.measurable_ident) + show "(\y. \_\{i}. y) \ measurable (M i) i.P" + apply (rule measurable_singleton[THEN iffD1]) + using i.measurable_ident unfolding id_def . + qed default + from measurable_comp[OF this measurable_merge[OF disj]] + show "(\(x, y). merge I x {i} y) \ (\(x, y). (id x, \_\{i}. y)) + \ measurable (sigma (pair_algebra I.P (M i))) (sigma (product_algebra M (insert i I)))" + (is "?f \ _") by simp + fix x assume "x \ space Ii.P" + with assms show "(\(f, y). f(i := y)) x = ?f x" + by (cases x) (simp add: merge_def fun_eq_iff pair_algebra_def extensional_def) +qed + locale product_sigma_finite = fixes M :: "'i \ 'a algebra" and \ :: "'i \ 'a set \ pextreal" assumes sigma_finite_measures: "\i. sigma_finite_measure (M i) (\ i)" @@ -1549,29 +1563,24 @@ interpret I: sigma_finite_measure P \ by fact interpret P: pair_sigma_finite P \ "M i" "\ i" .. - let ?h = "\x. (restrict x I, x i)" - let ?\ = "\A. P.pair_measure (?h ` A)" + let ?h = "(\(f, y). f(i := y))" + let ?\ = "\A. P.pair_measure (?h -` A \ space P.P)" + have I': "sigma_algebra I'.P" by default interpret I': measure_space "sigma (product_algebra M (insert i I))" ?\ - apply (subst pair_product_singleton_vimage_algebra[OF `i \ I`, symmetric]) - apply (intro P.measure_space_isomorphic bij_inv_bij_betw) - unfolding sigma_pair_algebra_product_singleton - by (rule bij_inv_restrict_insert[OF `i \ I`]) + apply (rule P.measure_space_vimage[OF I']) + apply (rule measurable_add_dim[OF `i \ I` `finite I`]) + by simp show ?case proof (intro exI[of _ ?\] conjI ballI) { fix A assume A: "A \ (\ i\insert i I. sets (M i))" - moreover then have "A \ (\ i\I. sets (M i))" by auto - moreover have "(\x. (restrict x I, x i)) ` Pi\<^isub>E (insert i I) A = Pi\<^isub>E I A \ A i" - using `i \ I` - apply auto - apply (rule_tac x="a(i:=b)" in image_eqI) - apply (auto simp: extensional_def fun_eq_iff) - done - ultimately show "?\ (Pi\<^isub>E (insert i I) A) = (\i\insert i I. \ i (A i))" - apply simp + then have *: "?h -` Pi\<^isub>E (insert i I) A \ space P.P = Pi\<^isub>E I A \ A i" + using `i \ I` M.sets_into_space by (auto simp: pair_algebra_def) blast + show "?\ (Pi\<^isub>E (insert i I) A) = (\i\insert i I. \ i (A i))" + unfolding * using A apply (subst P.pair_measure_times) - apply fastsimp - apply fastsimp - using `i \ I` `finite I` prod[of A] by (auto simp: ac_simps) } + using A apply fastsimp + using A apply fastsimp + using `i \ I` `finite I` prod[of A] A by (auto simp: ac_simps) } note product = this show "sigma_finite_measure I'.P ?\" proof @@ -1671,7 +1680,7 @@ shows "pair_sigma_finite.pair_measure (sigma (product_algebra M I)) (product_measure I) (sigma (product_algebra M J)) (product_measure J) - ((\x. ((\i\I. x i), (\i\J. x i))) ` A) = + ((\(x,y). merge I x J y) -` A \ space (sigma (pair_algebra (sigma (product_algebra M I)) (sigma (product_algebra M J))))) = product_measure (I \ J) A" proof - interpret I: finite_product_sigma_finite M \ I by default fact @@ -1679,51 +1688,52 @@ have "finite (I \ J)" using fin by auto interpret IJ: finite_product_sigma_finite M \ "I \ J" by default fact interpret P: pair_sigma_finite I.P I.measure J.P J.measure by default - let ?f = "\x. ((\i\I. x i), (\i\J. x i))" - from IJ.sigma_finite_pairs obtain F where - F: "\i. i\ I \ J \ range (F i) \ sets (M i)" - "(\k. \\<^isub>E i\I \ J. F i k) \ space IJ.G" - "\k. \i\I\J. \ i (F i k) \ \" - by auto - let ?F = "\k. \\<^isub>E i\I \ J. F i k" - have split_f_image[simp]: "\F. ?f ` (Pi\<^isub>E (I \ J) F) = (Pi\<^isub>E I F) \ (Pi\<^isub>E J F)" - apply auto apply (rule_tac x="merge I a J b" in image_eqI) - by (auto dest: extensional_restrict) - show "P.pair_measure (?f ` A) = IJ.measure A" + let ?g = "\(x,y). merge I x J y" + let "?X S" = "?g -` S \ space P.P" + from IJ.sigma_finite_pairs obtain F where + F: "\i. i\ I \ J \ range (F i) \ sets (M i)" + "(\k. \\<^isub>E i\I \ J. F i k) \ space IJ.G" + "\k. \i\I\J. \ i (F i k) \ \" + by auto + let ?F = "\k. \\<^isub>E i\I \ J. F i k" + show "P.pair_measure (?X A) = IJ.measure A" proof (rule measure_unique_Int_stable[OF _ _ _ _ _ _ _ _ A]) - show "Int_stable IJ.G" by (simp add: PiE_Int Int_stable_def product_algebra_def) auto - show "range ?F \ sets IJ.G" using F by (simp add: image_subset_iff product_algebra_def) - show "?F \ space IJ.G " using F(2) by simp - show "measure_space IJ.P (\A. P.pair_measure (?f ` A))" - apply (subst product_product_vimage_algebra[OF IJ, symmetric]) - apply (intro P.measure_space_isomorphic bij_inv_bij_betw) - unfolding sigma_pair_algebra_sigma_eq - by (rule bij_inv_restrict_merge[OF `I \ J = {}`]) - show "measure_space IJ.P IJ.measure" by fact - next - fix A assume "A \ sets IJ.G" - then obtain F where A[simp]: "A = Pi\<^isub>E (I \ J) F" "F \ (\ i\I \ J. sets (M i))" - by (auto simp: product_algebra_def) - then have F: "\i. i \ I \ F i \ sets (M i)" "\i. i \ J \ F i \ sets (M i)" - by auto - have "P.pair_measure (?f ` A) = (\i\I. \ i (F i)) * (\i\J. \ i (F i))" - using `finite J` `finite I` F - by (simp add: P.pair_measure_times I.measure_times J.measure_times) - also have "\ = (\i\I \ J. \ i (F i))" - using `finite J` `finite I` `I \ J = {}` by (simp add: setprod_Un_one) - also have "\ = IJ.measure A" - using `finite J` `finite I` F unfolding A - by (intro IJ.measure_times[symmetric]) auto - finally show "P.pair_measure (?f ` A) = IJ.measure A" . - next - fix k - have "\i. i \ I \ J \ F i k \ sets (M i)" using F by auto - then have "P.pair_measure (?f ` ?F k) = (\i\I. \ i (F i k)) * (\i\J. \ i (F i k))" - by (simp add: P.pair_measure_times I.measure_times J.measure_times) - then show "P.pair_measure (?f ` ?F k) \ \" - using `finite I` F by (simp add: setprod_\) - qed simp - qed + show "Int_stable IJ.G" by (simp add: PiE_Int Int_stable_def product_algebra_def) auto + show "range ?F \ sets IJ.G" using F by (simp add: image_subset_iff product_algebra_def) + show "?F \ space IJ.G " using F(2) by simp + have "sigma_algebra IJ.P" by default + then show "measure_space IJ.P (\A. P.pair_measure (?X A))" + apply (rule P.measure_space_vimage) + apply (rule measurable_merge[OF `I \ J = {}`]) + by simp + show "measure_space IJ.P IJ.measure" by fact + next + fix A assume "A \ sets IJ.G" + then obtain F where A[simp]: "A = Pi\<^isub>E (I \ J) F" + and F: "\i. i \ I \ J \ F i \ sets (M i)" + by (auto simp: product_algebra_def) + then have "?X A = (Pi\<^isub>E I F \ Pi\<^isub>E J F)" + using sets_into_space by (auto simp: space_pair_algebra) blast+ + then have "P.pair_measure (?X A) = (\i\I. \ i (F i)) * (\i\J. \ i (F i))" + using `finite J` `finite I` F + by (simp add: P.pair_measure_times I.measure_times J.measure_times) + also have "\ = (\i\I \ J. \ i (F i))" + using `finite J` `finite I` `I \ J = {}` by (simp add: setprod_Un_one) + also have "\ = IJ.measure A" + using `finite J` `finite I` F unfolding A + by (intro IJ.measure_times[symmetric]) auto + finally show "P.pair_measure (?X A) = IJ.measure A" . + next + fix k + have k: "\i. i \ I \ J \ F i k \ sets (M i)" using F by auto + then have "?X (?F k) = (\\<^isub>E i\I. F i k) \ (\\<^isub>E i\J. F i k)" + using sets_into_space by (auto simp: space_pair_algebra) blast+ + with k have "P.pair_measure (?X (?F k)) = (\i\I. \ i (F i k)) * (\i\J. \ i (F i k))" + by (simp add: P.pair_measure_times I.measure_times J.measure_times) + then show "P.pair_measure (?X (?F k)) \ \" + using `finite I` F by (simp add: setprod_\) + qed simp +qed lemma (in product_sigma_finite) product_positive_integral_fold: assumes IJ[simp]: "I \ J = {}" and fin: "finite I" "finite J" @@ -1736,23 +1746,18 @@ have "finite (I \ J)" using fin by auto interpret IJ: finite_product_sigma_finite M \ "I \ J" by default fact interpret P: pair_sigma_finite I.P I.measure J.P J.measure by default - let ?f = "\x. ((\i\I. x i), (\i\J. x i))" have P_borel: "(\x. f (case x of (x, y) \ merge I x J y)) \ borel_measurable P.P" unfolding case_prod_distrib measurable_merge_iff[OF IJ, symmetric] using f . - have bij: "bij_betw ?f (space IJ.P) (space P.P)" - unfolding sigma_pair_algebra_sigma_eq - by (intro bij_inv_bij_betw) (rule bij_inv_restrict_merge[OF IJ]) - have "IJ.positive_integral f = IJ.positive_integral (\x. f (restrict x (I \ J)))" - by (auto intro!: IJ.positive_integral_cong arg_cong[where f=f] dest!: extensional_restrict) - also have "\ = I.positive_integral (\x. J.positive_integral (\y. f (merge I x J y)))" + show ?thesis unfolding P.positive_integral_fst_measurable[OF P_borel, simplified] - unfolding P.positive_integral_vimage[OF bij] - unfolding product_product_vimage_algebra[OF IJ] - apply simp - apply (rule IJ.positive_integral_cong_measure[symmetric]) - apply (rule measure_fold) - using assms by auto - finally show ?thesis . + apply (subst IJ.positive_integral_cong_measure[symmetric]) + apply (rule measure_fold[OF IJ fin]) + apply assumption + proof (rule P.positive_integral_vimage) + show "sigma_algebra IJ.P" by default + show "(\(x, y). merge I x J y) \ measurable P.P IJ.P" by (rule measurable_merge[OF IJ]) + show "f \ borel_measurable IJ.P" using f . + qed qed lemma (in product_sigma_finite) product_positive_integral_singleton: @@ -1760,31 +1765,18 @@ shows "product_positive_integral {i} (\x. f (x i)) = M.positive_integral i f" proof - interpret I: finite_product_sigma_finite M \ "{i}" by default simp - have bij: "bij_betw (\x. \j\{i}. x) (space (M i)) (space I.P)" - by (auto intro!: bij_betwI ext simp: extensional_def) - have *: "(\x. (\x. \j\{i}. x) -` Pi\<^isub>E {i} x \ space (M i)) ` (\ i\{i}. sets (M i)) = sets (M i)" - proof (subst image_cong, rule refl) - fix x assume "x \ (\ i\{i}. sets (M i))" - then show "(\x. \j\{i}. x) -` Pi\<^isub>E {i} x \ space (M i) = x i" - using sets_into_space by auto - qed auto - have vimage: "I.vimage_algebra (space (M i)) (\x. \j\{i}. x) = M i" - unfolding I.vimage_algebra_def - unfolding product_sigma_algebra_def sets_sigma - apply (subst sigma_sets_vimage[symmetric]) - apply (simp_all add: image_image sigma_sets_eq product_algebra_def * del: vimage_Int) - using sets_into_space by blast + have T: "(\x. x i) \ measurable (sigma (product_algebra M {i})) (M i)" + using measurable_component_singleton[of "\x. x" i] + measurable_ident[unfolded id_def] by auto show "I.positive_integral (\x. f (x i)) = M.positive_integral i f" - unfolding I.positive_integral_vimage[OF bij] - unfolding vimage - apply (subst positive_integral_cong_measure) - proof - - fix A assume A: "A \ sets (M i)" - have "(\x. \j\{i}. x) ` A = (\\<^isub>E i\{i}. A)" - by (auto intro!: image_eqI ext[where 'b='a] simp: extensional_def) - with A show "product_measure {i} ((\x. \j\{i}. x) ` A) = \ i A" - using I.measure_times[of "\i. A"] by simp - qed simp + unfolding I.positive_integral_vimage[OF sigma_algebras T f, symmetric] + proof (rule positive_integral_cong_measure) + fix A let ?P = "(\x. x i) -` A \ space (sigma (product_algebra M {i}))" + assume A: "A \ sets (M i)" + then have *: "?P = {i} \\<^isub>E A" using sets_into_space by auto + show "product_measure {i} ?P = \ i A" unfolding * + using A I.measure_times[of "\_. A"] by auto + qed qed lemma (in product_sigma_finite) product_positive_integral_insert: diff -r 1eef159301df -r 621fa31e1dbd src/HOL/Probability/Radon_Nikodym.thy --- a/src/HOL/Probability/Radon_Nikodym.thy Fri Jan 21 10:43:09 2011 +0100 +++ b/src/HOL/Probability/Radon_Nikodym.thy Tue Jan 25 09:45:45 2011 +0100 @@ -1104,38 +1104,6 @@ unfolding eq[OF A, symmetric] RN_deriv(2)[OF \ A, symmetric] .. qed -lemma (in sigma_finite_measure) RN_deriv_vimage: - fixes f :: "'b \ 'a" - assumes f: "bij_inv S (space M) f g" - assumes \: "measure_space M \" "absolutely_continuous \" - shows "AE x. - sigma_finite_measure.RN_deriv (vimage_algebra S f) (\A. \ (f ` A)) (\A. \ (f ` A)) (g x) = RN_deriv \ x" -proof (rule RN_deriv_unique[OF \]) - interpret sf: sigma_finite_measure "vimage_algebra S f" "\A. \ (f ` A)" - using f by (rule sigma_finite_measure_isomorphic[OF bij_inv_bij_betw(1)]) - interpret \: measure_space M \ using \(1) . - have \': "measure_space (vimage_algebra S f) (\A. \ (f ` A))" - using f by (rule \.measure_space_isomorphic[OF bij_inv_bij_betw(1)]) - { fix A assume "A \ sets M" then have "f ` (f -` A \ S) = A" - using sets_into_space f[THEN bij_inv_bij_betw(1), unfolded bij_betw_def] - by (intro image_vimage_inter_eq[where T="space M"]) auto } - note A_f = this - then have ac: "sf.absolutely_continuous (\A. \ (f ` A))" - using \(2) by (auto simp: sf.absolutely_continuous_def absolutely_continuous_def) - show "(\x. sf.RN_deriv (\A. \ (f ` A)) (g x)) \ borel_measurable M" - using sf.RN_deriv(1)[OF \' ac] - unfolding measurable_vimage_iff_inv[OF f] comp_def . - fix A assume "A \ sets M" - then have *: "\x. x \ space M \ indicator (f -` A \ S) (g x) = (indicator A x :: pextreal)" - using f by (auto simp: bij_inv_def indicator_def) - have "\ (f ` (f -` A \ S)) = sf.positive_integral (\x. sf.RN_deriv (\A. \ (f ` A)) x * indicator (f -` A \ S) x)" - using `A \ sets M` by (force intro!: sf.RN_deriv(2)[OF \' ac]) - also have "\ = (\\<^isup>+x. sf.RN_deriv (\A. \ (f ` A)) (g x) * indicator A x)" - unfolding positive_integral_vimage_inv[OF f] - by (simp add: * cong: positive_integral_cong) - finally show "\ A = (\\<^isup>+x. sf.RN_deriv (\A. \ (f ` A)) (g x) * indicator A x)" - unfolding A_f[OF `A \ sets M`] . -qed lemma (in sigma_finite_measure) RN_deriv_finite: assumes sfm: "sigma_finite_measure M \" and ac: "absolutely_continuous \"