src/HOL/Probability/ex/Koepf_Duermuth_Countermeasure.thy
changeset 60515 484559628038
parent 58876 1888e3cb8048
child 61169 4de9ff3ea29a
equal deleted inserted replaced
60514:78a82c37b4b2 60515:484559628038
   237 
   237 
   238 lemma t_eq_imp_bij_func:
   238 lemma t_eq_imp_bij_func:
   239   assumes "t xs = t ys"
   239   assumes "t xs = t ys"
   240   shows "\<exists>f. bij_betw f {..<length xs} {..<length ys} \<and> (\<forall>i<length xs. xs ! i = ys ! (f i))"
   240   shows "\<exists>f. bij_betw f {..<length xs} {..<length ys} \<and> (\<forall>i<length xs. xs ! i = ys ! (f i))"
   241 proof -
   241 proof -
   242   have "count (multiset_of xs) = count (multiset_of ys)"
   242   have "count (mset xs) = count (mset ys)"
   243     using assms by (simp add: fun_eq_iff count_multiset_of t_def)
   243     using assms by (simp add: fun_eq_iff count_mset t_def)
   244   then have "xs <~~> ys" unfolding multiset_of_eq_perm count_inject .
   244   then have "xs <~~> ys" unfolding mset_eq_perm count_inject .
   245   then show ?thesis by (rule permutation_Ex_bij)
   245   then show ?thesis by (rule permutation_Ex_bij)
   246 qed
   246 qed
   247 
   247 
   248 lemma \<P>_k: assumes "k \<in> keys" shows "\<P>(fst) {k} = K k"
   248 lemma \<P>_k: assumes "k \<in> keys" shows "\<P>(fst) {k} = K k"
   249 proof -
   249 proof -