equal
deleted
inserted
replaced
3374 lemma (in monoid_add) listsum_map_filter: |
3374 lemma (in monoid_add) listsum_map_filter: |
3375 assumes "\<And>x. x \<in> set xs \<Longrightarrow> \<not> P x \<Longrightarrow> f x = 0" |
3375 assumes "\<And>x. x \<in> set xs \<Longrightarrow> \<not> P x \<Longrightarrow> f x = 0" |
3376 shows "listsum (map f (filter P xs)) = listsum (map f xs)" |
3376 shows "listsum (map f (filter P xs)) = listsum (map f xs)" |
3377 using assms by (induct xs) auto |
3377 using assms by (induct xs) auto |
3378 |
3378 |
3379 lemma (in monoid_add) distinct_listsum_conv_Setsum: |
3379 lemma (in comm_monoid_add) distinct_listsum_conv_Setsum: |
3380 "distinct xs \<Longrightarrow> listsum xs = Setsum (set xs)" |
3380 "distinct xs \<Longrightarrow> listsum xs = Setsum (set xs)" |
3381 by (induct xs) simp_all |
3381 by (induct xs) simp_all |
3382 |
3382 |
3383 lemma listsum_eq_0_nat_iff_nat [simp]: |
3383 lemma listsum_eq_0_nat_iff_nat [simp]: |
3384 "listsum ns = (0::nat) \<longleftrightarrow> (\<forall>n \<in> set ns. n = 0)" |
3384 "listsum ns = (0::nat) \<longleftrightarrow> (\<forall>n \<in> set ns. n = 0)" |