# HG changeset patch # User hoelzl # Date 1349863946 -7200 # Node ID 3c10763f5cb42ed41ff7f0ebea71702314671f8a # Parent d8de705b48d4ca476f40239a056c56549255efb2 show and use distributed_swap and distributed_jointI diff -r d8de705b48d4 -r 3c10763f5cb4 src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Wed Oct 10 12:12:25 2012 +0200 +++ b/src/HOL/Probability/Information.thy Wed Oct 10 12:12:26 2012 +0200 @@ -566,14 +566,13 @@ entropy_Pow ("\'(_')") where "\(X) \ entropy b (count_space (X`space M)) X" -lemma (in information_space) entropy_distr: +lemma (in information_space) fixes X :: "'a \ 'b" assumes X: "distributed M MX X f" - shows "entropy b MX X = - (\x. f x * log b (f x) \MX)" - unfolding entropy_def KL_divergence_def entropy_density_def comp_def -proof (subst integral_cong_AE) + shows entropy_distr: "entropy b MX X = - (\x. f x * log b (f x) \MX)" (is ?eq) +proof - note D = distributed_measurable[OF X] distributed_borel_measurable[OF X] distributed_AE[OF X] - interpret X: prob_space "distr M MX X" + interpret X: prob_space "distr M MX X" using D(1) by (rule prob_space_distr) have sf: "sigma_finite_measure (distr M MX X)" by default @@ -582,7 +581,8 @@ by (intro RN_deriv_unique_sigma_finite) (auto intro: divide_nonneg_nonneg measure_nonneg simp: distributed_distr_eq_density[symmetric, OF X] sf) - show "AE x in distr M MX X. log b (real (RN_deriv MX (distr M MX X) x)) = + + have ae_eq: "AE x in distr M MX X. log b (real (RN_deriv MX (distr M MX X) x)) = log b (f x)" unfolding distributed_distr_eq_density[OF X] apply (subst AE_density) @@ -591,12 +591,20 @@ apply (subst (asm) eq_commute) apply auto done - show "- (\ x. log b (f x) \distr M MX X) = - (\ x. f x * log b (f x) \MX)" + + have int_eq: "- (\ x. log b (f x) \distr M MX X) = - (\ x. f x * log b (f x) \MX)" unfolding distributed_distr_eq_density[OF X] using D by (subst integral_density) (auto simp: borel_measurable_ereal_iff) -qed + + show ?eq + unfolding entropy_def KL_divergence_def entropy_density_def comp_def + apply (subst integral_cong_AE) + apply (rule ae_eq) + apply (rule int_eq) + done +qed lemma (in prob_space) distributed_imp_emeasure_nonzero: assumes X: "distributed M MX X Px" @@ -896,7 +904,7 @@ using Pz by (intro TP.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'' dest: distributed_real_AE distributed_real_measurable) have aeX3: "AE y in T \\<^isub>M P. (\\<^isup>+ x. ereal (Pxz (x, snd y)) \S) = ereal (Pz (snd y))" - using Pz distributed_marginal_eq_joint[OF P S Px Pz Pxz] + using Pz distributed_marginal_eq_joint2[OF P S Pz Pxz] apply (intro TP.AE_pair_measure) apply (auto simp: comp_def measurable_split_conv intro!: measurable_snd'' borel_measurable_ereal_eq borel_measurable_ereal @@ -1110,7 +1118,7 @@ conditional_entropy_Pow ("\'(_ | _')") where "\(X | Y) \ conditional_entropy b (count_space (X`space M)) (count_space (Y`space M)) X Y" -lemma (in information_space) conditional_entropy_generic_eq: +lemma (in information_space) fixes Px :: "'b \ real" and Py :: "'c \ real" assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" assumes Px: "distributed M S X Px" @@ -1118,14 +1126,15 @@ assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" assumes I1: "integrable (S \\<^isub>M T) (\x. Pxy x * log b (Pxy x))" assumes I2: "integrable (S \\<^isub>M T) (\x. Pxy x * log b (Py (snd x)))" - shows "conditional_entropy b S T X Y = - (\(x, y). Pxy (x, y) * log b (Pxy (x, y) / Py y) \(S \\<^isub>M T))" + shows conditional_entropy_generic_eq: "conditional_entropy b S T X Y = - (\(x, y). Pxy (x, y) * log b (Pxy (x, y) / Py y) \(S \\<^isub>M T))" (is ?eq) proof - interpret S: sigma_finite_measure S by fact interpret T: sigma_finite_measure T by fact interpret ST: pair_sigma_finite S T .. have ST: "sigma_finite_measure (S \\<^isub>M T)" .. - interpret Pxy: prob_space "density (S \\<^isub>M T) Pxy" + let ?P = "density (S \\<^isub>M T) Pxy" + interpret Pxy: prob_space ?P unfolding Pxy[THEN distributed_distr_eq_density, symmetric] using Pxy[THEN distributed_measurable] by (rule prob_space_distr) @@ -1140,23 +1149,23 @@ by (subst distributed_transform_integral[OF Pxy Py, where T=snd]) (auto intro!: integral_cong) finally have e_eq: "entropy b T Y = - (\(x,y). Pxy (x,y) * log b (Py y) \(S \\<^isub>M T))" . - have "AE x in S \\<^isub>M T. Px (fst x) = 0 \ Pxy x = 0" + have ae1: "AE x in S \\<^isub>M T. Px (fst x) = 0 \ Pxy x = 0" by (intro subdensity_real[of fst, OF _ Pxy Px]) (auto intro: measurable_Pair) - moreover have "AE x in S \\<^isub>M T. Py (snd x) = 0 \ Pxy x = 0" + moreover have ae2: "AE x in S \\<^isub>M T. Py (snd x) = 0 \ Pxy x = 0" by (intro subdensity_real[of snd, OF _ Pxy Py]) (auto intro: measurable_Pair) - moreover have "AE x in S \\<^isub>M T. 0 \ Px (fst x)" + moreover have ae3: "AE x in S \\<^isub>M T. 0 \ Px (fst x)" using Px by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_fst'' dest: distributed_real_AE distributed_real_measurable) - moreover have "AE x in S \\<^isub>M T. 0 \ Py (snd x)" + moreover have ae4: "AE x in S \\<^isub>M T. 0 \ Py (snd x)" using Py by (intro ST.AE_pair_measure) (auto simp: comp_def intro!: measurable_snd'' dest: distributed_real_AE distributed_real_measurable) - moreover note Pxy[THEN distributed_real_AE] + moreover note ae5 = Pxy[THEN distributed_real_AE] ultimately have pos: "AE x in S \\<^isub>M T. 0 \ Pxy x \ 0 \ Px (fst x) \ 0 \ Py (snd x) \ (Pxy x = 0 \ (Pxy x \ 0 \ 0 < Pxy x \ 0 < Px (fst x) \ 0 < Py (snd x)))" by eventually_elim auto - from pos have "AE x in S \\<^isub>M T. + from pos have ae: "AE x in S \\<^isub>M T. Pxy x * log b (Pxy x) - Pxy x * log b (Py (snd x)) = Pxy x * log b (Pxy x / Py (snd x))" by eventually_elim (auto simp: log_simps mult_pos_pos field_simps b_gt_1) - with I1 I2 show ?thesis + with I1 I2 show ?eq unfolding conditional_entropy_def apply (subst e_eq) apply (subst entropy_distr[OF Pxy]) diff -r d8de705b48d4 -r 3c10763f5cb4 src/HOL/Probability/Probability_Measure.thy --- a/src/HOL/Probability/Probability_Measure.thy Wed Oct 10 12:12:25 2012 +0200 +++ b/src/HOL/Probability/Probability_Measure.thy Wed Oct 10 12:12:26 2012 +0200 @@ -506,6 +506,16 @@ shows "AE x in P. g (T x) = 0 \ f x = 0" using subdensity[OF T, of M X "\x. ereal (f x)" Y "\x. ereal (g x)"] assms by auto +lemma distributed_emeasure: + "distributed M N X f \ A \ sets N \ emeasure M (X -` A \ space M) = (\\<^isup>+x. f x * indicator A x \N)" + by (auto simp: distributed_measurable distributed_AE distributed_borel_measurable + distributed_distr_eq_density[symmetric] emeasure_density[symmetric] emeasure_distr) + +lemma distributed_positive_integral: + "distributed M N X f \ g \ borel_measurable N \ (\\<^isup>+x. f x * g x \N) = (\\<^isup>+x. g (X x) \M)" + by (auto simp: distributed_measurable distributed_AE distributed_borel_measurable + distributed_distr_eq_density[symmetric] positive_integral_density[symmetric] positive_integral_distr) + lemma distributed_integral: "distributed M N X f \ g \ borel_measurable N \ (\x. f x * g x \N) = (\x. g (X x) \M)" by (auto simp: distributed_real_measurable distributed_real_AE distributed_measurable @@ -526,54 +536,116 @@ finally show ?thesis . qed -lemma distributed_marginal_eq_joint: - assumes T: "sigma_finite_measure T" - assumes S: "sigma_finite_measure S" +lemma (in prob_space) distributed_unique: assumes Px: "distributed M S X Px" - assumes Py: "distributed M T Y Py" - assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" - shows "AE y in T. Py y = (\\<^isup>+x. Pxy (x, y) \S)" -proof (rule sigma_finite_measure.density_unique[OF T]) - interpret ST: pair_sigma_finite S T using S T unfolding pair_sigma_finite_def by simp - show "Py \ borel_measurable T" "AE y in T. 0 \ Py y" - "(\x. \\<^isup>+ xa. Pxy (xa, x) \S) \ borel_measurable T" "AE y in T. 0 \ \\<^isup>+ x. Pxy (x, y) \S" - using Pxy[THEN distributed_borel_measurable] - by (auto intro!: Py[THEN distributed_borel_measurable] Py[THEN distributed_AE] - ST.positive_integral_snd_measurable' positive_integral_positive) + assumes Py: "distributed M S X Py" + shows "AE x in S. Px x = Py x" +proof - + interpret X: prob_space "distr M S X" + using distributed_measurable[OF Px] by (rule prob_space_distr) + have "sigma_finite_measure (distr M S X)" .. + with sigma_finite_density_unique[of Px S Py ] Px Py + show ?thesis + by (auto simp: distributed_def) +qed + +lemma (in prob_space) distributed_jointI: + assumes "sigma_finite_measure S" "sigma_finite_measure T" + assumes X[simp]: "X \ measurable M S" and Y[simp]: "Y \ measurable M T" + assumes f[simp]: "f \ borel_measurable (S \\<^isub>M T)" "AE x in S \\<^isub>M T. 0 \ f x" + assumes eq: "\A B. A \ sets S \ B \ sets T \ + emeasure M {x \ space M. X x \ A \ Y x \ B} = (\\<^isup>+x. (\\<^isup>+y. f (x, y) * indicator B y \T) * indicator A x \S)" + shows "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) f" + unfolding distributed_def +proof safe + interpret S: sigma_finite_measure S by fact + interpret T: sigma_finite_measure T by fact + interpret ST: pair_sigma_finite S T by default - show "density T Py = density T (\x. \\<^isup>+ xa. Pxy (xa, x) \S)" - proof (rule measure_eqI) - fix A assume A: "A \ sets (density T Py)" - have *: "\x y. x \ space S \ indicator (space S \ A) (x, y) = indicator A y" - by (auto simp: indicator_def) - have "emeasure (density T Py) A = emeasure (distr M T Y) A" - unfolding Py[THEN distributed_distr_eq_density] .. - also have "\ = emeasure (distr M (S \\<^isub>M T) (\x. (X x, Y x))) (space S \ A)" - using A Px Py Pxy - by (subst (1 2) emeasure_distr) - (auto dest: measurable_space distributed_measurable intro!: arg_cong[where f="emeasure M"]) - also have "\ = emeasure (density (S \\<^isub>M T) Pxy) (space S \ A)" - unfolding Pxy[THEN distributed_distr_eq_density] .. - also have "\ = (\\<^isup>+ x. Pxy x * indicator (space S \ A) x \(S \\<^isub>M T))" - using A Pxy by (simp add: emeasure_density distributed_borel_measurable) - also have "\ = (\\<^isup>+y. \\<^isup>+x. Pxy (x, y) * indicator (space S \ A) (x, y) \S \T)" - using A Pxy - by (subst ST.positive_integral_snd_measurable) (simp_all add: emeasure_density distributed_borel_measurable) - also have "\ = (\\<^isup>+y. (\\<^isup>+x. Pxy (x, y) \S) * indicator A y \T)" - using measurable_comp[OF measurable_Pair1[OF measurable_ident] distributed_borel_measurable[OF Pxy]] - using distributed_borel_measurable[OF Pxy] distributed_AE[OF Pxy, THEN ST.AE_pair] - by (subst (asm) ST.AE_commute) (auto intro!: positive_integral_cong_AE positive_integral_multc cong: positive_integral_cong simp: * comp_def) - also have "\ = emeasure (density T (\x. \\<^isup>+ xa. Pxy (xa, x) \S)) A" - using A by (intro emeasure_density[symmetric]) (auto intro!: ST.positive_integral_snd_measurable' Pxy[THEN distributed_borel_measurable]) - finally show "emeasure (density T Py) A = emeasure (density T (\x. \\<^isup>+ xa. Pxy (xa, x) \S)) A" . - qed simp + from ST.sigma_finite_up_in_pair_measure_generator guess F :: "nat \ ('b \ 'c) set" .. note F = this + let ?E = "{a \ b |a b. a \ sets S \ b \ sets T}" + let ?P = "S \\<^isub>M T" + show "distr M ?P (\x. (X x, Y x)) = density ?P f" (is "?L = ?R") + proof (rule measure_eqI_generator_eq[OF Int_stable_pair_measure_generator[of S T]]) + show "?E \ Pow (space ?P)" + using space_closed[of S] space_closed[of T] by (auto simp: space_pair_measure) + show "sets ?L = sigma_sets (space ?P) ?E" + by (simp add: sets_pair_measure space_pair_measure) + then show "sets ?R = sigma_sets (space ?P) ?E" + by simp + next + interpret L: prob_space ?L + by (rule prob_space_distr) (auto intro!: measurable_Pair) + show "range F \ ?E" "(\i. F i) = space ?P" "\i. emeasure ?L (F i) \ \" + using F by (auto simp: space_pair_measure) + next + fix E assume "E \ ?E" + then obtain A B where E[simp]: "E = A \ B" and A[simp]: "A \ sets S" and B[simp]: "B \ sets T" by auto + have "emeasure ?L E = emeasure M {x \ space M. X x \ A \ Y x \ B}" + by (auto intro!: arg_cong[where f="emeasure M"] simp add: emeasure_distr measurable_Pair) + also have "\ = (\\<^isup>+x. (\\<^isup>+y. (f (x, y) * indicator B y) * indicator A x \T) \S)" + by (auto simp add: eq measurable_Pair measurable_compose[OF _ f(1)] positive_integral_multc + intro!: positive_integral_cong) + also have "\ = emeasure ?R E" + by (auto simp add: emeasure_density ST.positive_integral_fst_measurable(2)[symmetric] + intro!: positive_integral_cong split: split_indicator) + finally show "emeasure ?L E = emeasure ?R E" . + qed +qed (auto intro!: measurable_Pair) + +lemma (in prob_space) distributed_swap: + assumes "sigma_finite_measure S" "sigma_finite_measure T" + assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" + shows "distributed M (T \\<^isub>M S) (\x. (Y x, X x)) (\(x, y). Pxy (y, x))" +proof - + interpret S: sigma_finite_measure S by fact + interpret T: sigma_finite_measure T by fact + interpret ST: pair_sigma_finite S T by default + interpret TS: pair_sigma_finite T S by default + + note measurable_Pxy = measurable_compose[OF _ distributed_borel_measurable[OF Pxy]] + show ?thesis + apply (subst TS.distr_pair_swap) + unfolding distributed_def + proof safe + let ?D = "distr (S \\<^isub>M T) (T \\<^isub>M S) (\(x, y). (y, x))" + show 1: "(\(x, y). Pxy (y, x)) \ borel_measurable ?D" + by (auto simp: measurable_split_conv intro!: measurable_Pair measurable_Pxy) + with Pxy + show "AE x in distr (S \\<^isub>M T) (T \\<^isub>M S) (\(x, y). (y, x)). 0 \ (case x of (x, y) \ Pxy (y, x))" + by (subst AE_distr_iff) + (auto dest!: distributed_AE + simp: measurable_split_conv split_beta + intro!: measurable_Pair borel_measurable_ereal_le) + show 2: "random_variable (distr (S \\<^isub>M T) (T \\<^isub>M S) (\(x, y). (y, x))) (\x. (Y x, X x))" + using measurable_compose[OF distributed_measurable[OF Pxy] measurable_fst] + using measurable_compose[OF distributed_measurable[OF Pxy] measurable_snd] + by (auto intro!: measurable_Pair) + { fix A assume A: "A \ sets (T \\<^isub>M S)" + let ?B = "(\(x, y). (y, x)) -` A \ space (S \\<^isub>M T)" + from sets_into_space[OF A] + have "emeasure M ((\x. (Y x, X x)) -` A \ space M) = + emeasure M ((\x. (X x, Y x)) -` ?B \ space M)" + by (auto intro!: arg_cong2[where f=emeasure] simp: space_pair_measure) + also have "\ = (\\<^isup>+ x. Pxy x * indicator ?B x \(S \\<^isub>M T))" + using Pxy A by (intro distributed_emeasure measurable_sets) (auto simp: measurable_split_conv measurable_Pair) + finally have "emeasure M ((\x. (Y x, X x)) -` A \ space M) = + (\\<^isup>+ x. Pxy x * indicator A (snd x, fst x) \(S \\<^isub>M T))" + by (auto intro!: positive_integral_cong split: split_indicator) } + note * = this + show "distr M ?D (\x. (Y x, X x)) = density ?D (\(x, y). Pxy (y, x))" + apply (intro measure_eqI) + apply (simp_all add: emeasure_distr[OF 2] emeasure_density[OF 1]) + apply (subst positive_integral_distr) + apply (auto intro!: measurable_pair measurable_Pxy * simp: comp_def split_beta) + done + qed qed lemma (in prob_space) distr_marginal1: - fixes Pxy :: "('b \ 'c) \ real" assumes "sigma_finite_measure S" "sigma_finite_measure T" assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" - defines "Px \ \x. real (\\<^isup>+z. Pxy (x, z) \T)" + defines "Px \ \x. (\\<^isup>+z. Pxy (x, z) \T)" shows "distributed M S X Px" unfolding distributed_def proof safe @@ -588,18 +660,15 @@ from XY have Y: "Y \ measurable M T" unfolding measurable_pair_iff by (simp add: comp_def) - from Pxy show borel: "(\x. ereal (Px x)) \ borel_measurable S" - by (auto intro!: ST.positive_integral_fst_measurable borel_measurable_real_of_ereal dest!: distributed_real_measurable simp: Px_def) + from Pxy show borel: "Px \ borel_measurable S" + by (auto intro!: ST.positive_integral_fst_measurable dest!: distributed_borel_measurable simp: Px_def) interpret Pxy: prob_space "distr M (S \\<^isub>M T) (\x. (X x, Y x))" using XY by (rule prob_space_distr) - have "(\\<^isup>+ x. max 0 (ereal (- Pxy x)) \(S \\<^isub>M T)) = (\\<^isup>+ x. 0 \(S \\<^isub>M T))" + have "(\\<^isup>+ x. max 0 (- Pxy x) \(S \\<^isub>M T)) = (\\<^isup>+ x. 0 \(S \\<^isub>M T))" using Pxy - by (intro positive_integral_cong_AE) (auto simp: max_def dest: distributed_real_measurable distributed_real_AE) - then have Pxy_integrable: "integrable (S \\<^isub>M T) Pxy" - using Pxy Pxy.emeasure_space_1 - by (simp add: integrable_def emeasure_density positive_integral_max_0 distributed_def borel_measurable_ereal_iff cong: positive_integral_cong) - + by (intro positive_integral_cong_AE) (auto simp: max_def dest: distributed_borel_measurable distributed_AE) + show "distr M S X = density S Px" proof (rule measure_eqI) fix A assume A: "A \ sets (distr M S X)" @@ -608,31 +677,52 @@ intro!: arg_cong[where f="emeasure M"] dest: measurable_space) also have "\ = emeasure (density (S \\<^isub>M T) Pxy) (A \ space T)" using Pxy by (simp add: distributed_def) - also have "\ = \\<^isup>+ x. \\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \ space T) (x, y) \T \S" + also have "\ = \\<^isup>+ x. \\<^isup>+ y. Pxy (x, y) * indicator (A \ space T) (x, y) \T \S" using A borel Pxy by (simp add: emeasure_density ST.positive_integral_fst_measurable(2)[symmetric] distributed_def) - also have "\ = \\<^isup>+ x. ereal (Px x) * indicator A x \S" + also have "\ = \\<^isup>+ x. Px x * indicator A x \S" apply (rule positive_integral_cong_AE) - using Pxy[THEN distributed_real_AE, THEN ST.AE_pair] ST.integrable_fst_measurable(1)[OF Pxy_integrable] AE_space + using Pxy[THEN distributed_AE, THEN ST.AE_pair] AE_space proof eventually_elim - fix x assume "x \ space S" "AE y in T. 0 \ Pxy (x, y)" and i: "integrable T (\y. Pxy (x, y))" + fix x assume "x \ space S" "AE y in T. 0 \ Pxy (x, y)" moreover have eq: "\y. y \ space T \ indicator (A \ space T) (x, y) = indicator A x" by (auto simp: indicator_def) - ultimately have "(\\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \ space T) (x, y) \T) = - (\\<^isup>+ y. ereal (Pxy (x, y)) \T) * indicator A x" - using Pxy[THEN distributed_real_measurable] by (simp add: eq positive_integral_multc measurable_Pair2 cong: positive_integral_cong) - also have "(\\<^isup>+ y. ereal (Pxy (x, y)) \T) = Px x" - using i by (simp add: Px_def ereal_real integrable_def positive_integral_positive) - finally show "(\\<^isup>+ y. ereal (Pxy (x, y)) * indicator (A \ space T) (x, y) \T) = ereal (Px x) * indicator A x" . + ultimately have "(\\<^isup>+ y. Pxy (x, y) * indicator (A \ space T) (x, y) \T) = (\\<^isup>+ y. Pxy (x, y) \T) * indicator A x" + using Pxy[THEN distributed_borel_measurable] by (simp add: eq positive_integral_multc measurable_Pair2 cong: positive_integral_cong) + also have "(\\<^isup>+ y. Pxy (x, y) \T) = Px x" + by (simp add: Px_def ereal_real positive_integral_positive) + finally show "(\\<^isup>+ y. Pxy (x, y) * indicator (A \ space T) (x, y) \T) = Px x * indicator A x" . qed finally show "emeasure (distr M S X) A = emeasure (density S Px) A" using A borel Pxy by (simp add: emeasure_density) qed simp - show "AE x in S. 0 \ ereal (Px x)" + show "AE x in S. 0 \ Px x" by (simp add: Px_def positive_integral_positive real_of_ereal_pos) qed +lemma (in prob_space) distr_marginal2: + assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T" + assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" + shows "distributed M T Y (\y. (\\<^isup>+x. Pxy (x, y) \S))" + using distr_marginal1[OF T S distributed_swap[OF S T]] Pxy by simp + +lemma (in prob_space) distributed_marginal_eq_joint1: + assumes T: "sigma_finite_measure T" + assumes S: "sigma_finite_measure S" + assumes Px: "distributed M S X Px" + assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" + shows "AE x in S. Px x = (\\<^isup>+y. Pxy (x, y) \T)" + using Px distr_marginal1[OF S T Pxy] by (rule distributed_unique) + +lemma (in prob_space) distributed_marginal_eq_joint2: + assumes T: "sigma_finite_measure T" + assumes S: "sigma_finite_measure S" + assumes Py: "distributed M T Y Py" + assumes Pxy: "distributed M (S \\<^isub>M T) (\x. (X x, Y x)) Pxy" + shows "AE y in T. Py y = (\\<^isup>+x. Pxy (x, y) \S)" + using Py distr_marginal2[OF S T Pxy] by (rule distributed_unique) + definition "simple_distributed M X f \ distributed M (count_space (X`space M)) X (\x. ereal (f x)) \ finite (X`space M)" @@ -795,19 +885,21 @@ note Px = simple_distributedI[OF Px refl] have *: "\f A. setsum (\x. max 0 (ereal (f x))) A = ereal (setsum (\x. max 0 (f x)) A)" by (simp add: setsum_ereal[symmetric] zero_ereal_def) - from distributed_marginal_eq_joint[OF sigma_finite_measure_count_space_finite sigma_finite_measure_count_space_finite - simple_distributed[OF Px] simple_distributed[OF Py] simple_distributed_joint[OF Pxy], + from distributed_marginal_eq_joint2[OF + sigma_finite_measure_count_space_finite + sigma_finite_measure_count_space_finite + simple_distributed[OF Py] simple_distributed_joint[OF Pxy], OF Py[THEN simple_distributed_finite] Px[THEN simple_distributed_finite]] - y Px[THEN simple_distributed_finite] Py[THEN simple_distributed_finite] + y + Px[THEN simple_distributed_finite] + Py[THEN simple_distributed_finite] Pxy[THEN simple_distributed, THEN distributed_real_AE] show ?thesis unfolding AE_count_space - apply (elim ballE[where x=y]) apply (auto simp add: positive_integral_count_space_finite * intro!: setsum_cong split: split_max) done qed - lemma prob_space_uniform_measure: assumes A: "emeasure M A \ 0" "emeasure M A \ \" shows "prob_space (uniform_measure M A)"