# HG changeset patch # User hoelzl # Date 1460711740 -7200 # Node ID 2e874d9aca436a2a30e9639587bff8141ca08a14 # Parent 38906f0e4633a23ac2d0ad3ce9eb7601a642ed19 fix HOL-Probability-ex diff -r 38906f0e4633 -r 2e874d9aca43 src/HOL/Probability/ex/Dining_Cryptographers.thy --- a/src/HOL/Probability/ex/Dining_Cryptographers.thy Thu Apr 14 15:55:00 2016 +0200 +++ b/src/HOL/Probability/ex/Dining_Cryptographers.thy Fri Apr 15 11:15:40 2016 +0200 @@ -429,7 +429,7 @@ using \0 < n\ by (simp add: card_inversion card_dc_crypto finite_dc_crypto subset_eq space_uniform_count_measure measure_uniform_count_measure) - qed + qed simp show "simple_distributed (uniform_count_measure dc_crypto) payer (\x. 1 / real n)" proof (rule simple_distributedI) @@ -445,7 +445,7 @@ then show "1 / real n = prob (payer -` {z} \ space (uniform_count_measure dc_crypto))" using finite_dc_crypto by (subst measure_uniform_count_measure) (auto simp add: card_dc_crypto space_uniform_count_measure) - qed + qed simp show "simple_distributed (uniform_count_measure dc_crypto) (\x. (inversion x, payer x)) (\x. 2 / (real n *2^n))" proof (rule simple_distributedI) @@ -467,7 +467,7 @@ then show "2 / (real n * 2 ^ n) = prob ((\x. (inversion x, payer x)) -` {x} \ space (uniform_count_measure dc_crypto))" using \i < n\ ys by (simp add: measure_uniform_count_measure card_payer_and_inversion finite_dc_crypto subset_eq card_dc_crypto) - qed + qed simp show "\x\space (uniform_count_measure dc_crypto). 2 / (real n * 2 ^ n) = 2 / 2 ^ n * (1 / real n) " by simp diff -r 38906f0e4633 -r 2e874d9aca43 src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy --- a/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy Thu Apr 14 15:55:00 2016 +0200 +++ b/src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy Fri Apr 15 11:15:40 2016 +0200 @@ -109,8 +109,9 @@ lemma measure_point_measure: "finite \ \ A \ \ \ (\x. x \ \ \ 0 \ p x) \ - measure (point_measure \ (\x. ereal (p x))) A = (\i\A. p i)" - unfolding measure_def by (subst emeasure_point_measure_finite) auto + measure (point_measure \ (\x. ennreal (p x))) A = (\i\A. p i)" + unfolding measure_def + by (subst emeasure_point_measure_finite) (auto simp: subset_eq setsum_nonneg) locale finite_information = fixes \ :: "'a set" @@ -289,7 +290,7 @@ by (simp add: simple_function_def) lemma entropy_commute: "\(\x. (X x, Y x)) = \(\x. (Y x, X x))" - apply (subst (1 2) entropy_simple_distributed[OF simple_distributedI[OF simple_function_finite refl]]) + apply (subst (1 2) entropy_simple_distributed[OF simple_distributedI[OF simple_function_finite _ refl]]) unfolding space_point_measure proof - have eq: "(\x. (X x, Y x)) ` msgs = (\(x, y). (y, x)) ` (\x. (Y x, X x)) ` msgs" @@ -300,7 +301,7 @@ apply (subst setsum.reindex) apply (auto simp: vimage_def inj_on_def intro!: setsum.cong arg_cong[where f="\x. prob x * log b (prob x)"]) done -qed +qed simp_all lemma (in -) measure_eq_0I: "A = {} \ measure M A = 0" by simp @@ -308,8 +309,8 @@ "\(X | Y) = -(\y\Y`msgs. (\

(Y) {y}) * (\x\X`msgs. (\

(X ; Y) {(x,y)}) / (\

(Y) {y}) * log b ((\

(X ; Y) {(x,y)}) / (\

(Y) {y}))))" apply (subst conditional_entropy_eq[OF - simple_distributedI[OF simple_function_finite refl] - simple_distributedI[OF simple_function_finite refl]]) + simple_distributedI[OF simple_function_finite _ refl] + simple_distributedI[OF simple_function_finite _ refl]]) unfolding space_point_measure proof - have "- (\(x, y)\(\x. (X x, Y x)) ` msgs. (\

(X ; Y) {(x, y)}) * log b ((\

(X ; Y) {(x, y)}) / (\

(Y) {y}))) = @@ -325,7 +326,7 @@ by (auto simp add: setsum_right_distrib vimage_def intro!: setsum.cong prob_conj_imp1) finally show "- (\(x, y)\(\x. (X x, Y x)) ` msgs. (\

(X ; Y) {(x, y)}) * log b ((\

(X ; Y) {(x, y)}) / (\

(Y) {y}))) = -(\y\Y`msgs. (\

(Y) {y}) * (\x\X`msgs. (\

(X ; Y) {(x,y)}) / (\

(Y) {y}) * log b ((\

(X ; Y) {(x,y)}) / (\

(Y) {y}))))" . -qed +qed simp_all lemma ce_OB_eq_ce_t: "\(fst ; OB) = \(fst ; t\OB)" proof - @@ -371,7 +372,7 @@ unfolding disjoint_family_on_def by auto have "\

(t\OB ; fst) {(t obs, k)} = (\obs'\?S obs. \

(OB ; fst) {(obs', k)})" unfolding comp_def - using finite_measure_finite_Union[OF _ df] + using finite_measure_finite_Union[OF _ _ df] by (auto simp add: * intro!: setsum_nonneg) also have "(\obs'\?S obs. \

(OB ; fst) {(obs', k)}) = real (card (?S obs)) * \

(OB ; fst) {(obs, k)}" by (simp add: t_eq_imp[OF \k \ keys\ \K k \ 0\ obs]) @@ -391,7 +392,7 @@ have "\

(fst | t\OB) {(k, t obs)} = \

(t\OB | fst) {(t obs, k)} * \

(fst) {k} / \

(t\OB) {t obs}" using finite_measure_mono[of "{x. fst x = k \ t (OB x) = t obs} \ msgs" "{x. fst x = k} \ msgs"] using measure_nonneg[of \ "{x. fst x = k \ t (OB x) = t obs} \ msgs"] - by (auto simp add: vimage_def conj_commute subset_eq) + by (auto simp add: vimage_def conj_commute subset_eq simp del: measure_nonneg) also have "(\

(t\OB) {t obs}) = (\k'\keys. (\

(t\OB|fst) {(t obs, k')}) * (\

(fst) {k'}))" using finite_measure_mono[of "{x. t (OB x) = t obs \ fst x = k} \ msgs" "{x. fst x = k} \ msgs"] using measure_nonneg[of \ "{x. fst x = k \ t (OB x) = t obs} \ msgs"] @@ -431,7 +432,7 @@ unfolding disjoint_family_on_def by auto have "\

(t\OB) {t (OB x)} = (\obs\?S (OB x). \

(OB) {obs})" unfolding comp_def - using finite_measure_finite_Union[OF _ df] + using finite_measure_finite_Union[OF _ _ df] by (force simp add: * intro!: setsum_nonneg) } note P_t_sum_P_O = this @@ -468,7 +469,7 @@ also have "\ \ \(t\OB)" using conditional_entropy_nonneg[of "t\OB" fst] by simp also have "\ \ log b (real (card ((t\OB)`msgs)))" - using entropy_le_card[of "t\OB", OF simple_distributedI[OF simple_function_finite refl]] by simp + using entropy_le_card[of "t\OB", OF simple_distributedI[OF simple_function_finite _ refl]] by simp also have "\ \ log b (real (n + 1)^card observations)" using card_T_bound not_empty by (auto intro!: log_le simp: card_gt_0_iff of_nat_power [symmetric] simp del: of_nat_power of_nat_Suc)