equal
deleted
inserted
replaced
1735 lemma setsum_product: |
1735 lemma setsum_product: |
1736 fixes f :: "'a => ('b::semiring_0)" |
1736 fixes f :: "'a => ('b::semiring_0)" |
1737 shows "setsum f A * setsum g B = (\<Sum>i\<in>A. \<Sum>j\<in>B. f i * g j)" |
1737 shows "setsum f A * setsum g B = (\<Sum>i\<in>A. \<Sum>j\<in>B. f i * g j)" |
1738 by (simp add: setsum_right_distrib setsum_left_distrib) (rule setsum_commute) |
1738 by (simp add: setsum_right_distrib setsum_left_distrib) (rule setsum_commute) |
1739 |
1739 |
|
1740 lemma setsum_mult_setsum_if_inj: |
|
1741 fixes f :: "'a => ('b::semiring_0)" |
|
1742 shows "inj_on (%(a,b). f a * g b) (A \<times> B) ==> |
|
1743 setsum f A * setsum g B = setsum id {f a * g b|a b. a:A & b:B}" |
|
1744 by(auto simp: setsum_product setsum_cartesian_product |
|
1745 intro!: setsum_reindex_cong[symmetric]) |
|
1746 |
1740 |
1747 |
1741 subsection {* Generalized product over a set *} |
1748 subsection {* Generalized product over a set *} |
1742 |
1749 |
1743 definition setprod :: "('a => 'b) => 'a set => 'b::comm_monoid_mult" |
1750 definition setprod :: "('a => 'b) => 'a set => 'b::comm_monoid_mult" |
1744 where "setprod f A == if finite A then fold_image (op *) f 1 A else 1" |
1751 where "setprod f A == if finite A then fold_image (op *) f 1 A else 1" |