src/HOL/Library/Multiset.thy
changeset 15402 97204f3b4705
parent 15316 2a6ff941a115
child 15630 cc3776f004e2
equal deleted inserted replaced
15401:ba28d103bada 15402:97204f3b4705
   174 theorem size_union [simp]: "size (M + N::'a multiset) = size M + size N"
   174 theorem size_union [simp]: "size (M + N::'a multiset) = size M + size N"
   175   apply (unfold size_def)
   175   apply (unfold size_def)
   176   apply (subgoal_tac "count (M + N) = (\<lambda>a. count M a + count N a)")
   176   apply (subgoal_tac "count (M + N) = (\<lambda>a. count M a + count N a)")
   177    prefer 2
   177    prefer 2
   178    apply (rule ext, simp)
   178    apply (rule ext, simp)
   179   apply (simp (no_asm_simp) add: setsum_Un setsum_addf setsum_count_Int)
   179   apply (simp (no_asm_simp) add: setsum_Un_nat setsum_addf setsum_count_Int)
   180   apply (subst Int_commute)
   180   apply (subst Int_commute)
   181   apply (simp (no_asm_simp) add: setsum_count_Int)
   181   apply (simp (no_asm_simp) add: setsum_count_Int)
   182   done
   182   done
   183 
   183 
   184 theorem size_eq_0_iff_empty [iff]: "(size M = 0) = (M = {#})"
   184 theorem size_eq_0_iff_empty [iff]: "(size M = 0) = (M = {#})"