src/HOL/Library/Multiset.thy
changeset 15630 cc3776f004e2
parent 15402 97204f3b4705
child 15867 5c63b6c2f4a5
equal deleted inserted replaced
15629:4066f01f1beb 15630:cc3776f004e2
   740   by (induct_tac x, auto)
   740   by (induct_tac x, auto)
   741 
   741 
   742 lemma set_of_multiset_of[simp]: "set_of(multiset_of x) = set x"
   742 lemma set_of_multiset_of[simp]: "set_of(multiset_of x) = set x"
   743  by (induct_tac x, auto) 
   743  by (induct_tac x, auto) 
   744 
   744 
   745 lemma multset_of_append[simp]: 
   745 lemma multiset_of_append[simp]: 
   746   "multiset_of (xs @ ys) = multiset_of xs + multiset_of ys"
   746   "multiset_of (xs @ ys) = multiset_of xs + multiset_of ys"
   747   by (rule_tac x=ys in spec, induct_tac xs, auto simp: union_ac) 
   747   by (rule_tac x=ys in spec, induct_tac xs, auto simp: union_ac) 
   748 
   748 
   749 lemma surj_multiset_of: "surj multiset_of"
   749 lemma surj_multiset_of: "surj multiset_of"
   750   apply (unfold surj_def, rule allI) 
   750   apply (unfold surj_def, rule allI) 
   776   apply (drule distinct_remdups[THEN distinct_remdups 
   776   apply (drule distinct_remdups[THEN distinct_remdups 
   777                       [THEN set_eq_iff_multiset_of_eq_distinct[THEN iffD2]]]) 
   777                       [THEN set_eq_iff_multiset_of_eq_distinct[THEN iffD2]]]) 
   778   apply simp
   778   apply simp
   779   done
   779   done
   780 
   780 
       
   781 lemma multiset_of_compl_union[simp]:
       
   782  "multiset_of [x\<in>xs. P x] + multiset_of [x\<in>xs. \<not>P x] = multiset_of xs"
       
   783   by (induct xs) (auto simp: union_ac)
   781 
   784 
   782 subsection {* Pointwise ordering induced by count *}
   785 subsection {* Pointwise ordering induced by count *}
   783 
   786 
   784 consts 
   787 consts 
   785   mset_le :: "['a multiset, 'a multiset] \<Rightarrow> bool"
   788   mset_le :: "['a multiset, 'a multiset] \<Rightarrow> bool"