src/HOL/Big_Operators.thy
changeset 48861 461be56c312f
parent 48850 efb8641b4944
child 48893 3db108d14239
equal deleted inserted replaced
48860:56ec76f769c0 48861:461be56c312f
   102 
   102 
   103 lemma F_delta': 
   103 lemma F_delta': 
   104   assumes fS: "finite S" shows 
   104   assumes fS: "finite S" shows 
   105   "F (\<lambda>k. if a = k then b k else 1) S = (if a \<in> S then b a else 1)"
   105   "F (\<lambda>k. if a = k then b k else 1) S = (if a \<in> S then b a else 1)"
   106 using F_delta[OF fS, of a b, symmetric] by (auto intro: F_cong)
   106 using F_delta[OF fS, of a b, symmetric] by (auto intro: F_cong)
       
   107 
       
   108 lemma F_fun_f: "F (%x. g x * h x) A = (F g A * F h A)"
       
   109 by (cases "finite A") (simp_all add: distrib)
   107 
   110 
   108 lemma If_cases:
   111 lemma If_cases:
   109   fixes P :: "'b \<Rightarrow> bool" and g h :: "'b \<Rightarrow> 'a"
   112   fixes P :: "'b \<Rightarrow> bool" and g h :: "'b \<Rightarrow> 'a"
   110   assumes fA: "finite A"
   113   assumes fA: "finite A"
   111   shows "F (\<lambda>x. if P x then h x else g x) A =
   114   shows "F (\<lambda>x. if P x then h x else g x) A =
   365  apply (simp) 
   368  apply (simp) 
   366 apply (auto simp add: setsum_def
   369 apply (auto simp add: setsum_def
   367             dest: finite_cartesian_productD1 finite_cartesian_productD2) 
   370             dest: finite_cartesian_productD1 finite_cartesian_productD2) 
   368 done
   371 done
   369 
   372 
   370 lemma (in comm_monoid_add) setsum_addf: "setsum (%x. f x + g x) A = (setsum f A + setsum g A)"
   373 lemma setsum_addf: "setsum (%x. f x + g x) A = (setsum f A + setsum g A)"
   371   by (cases "finite A") (simp_all add: setsum.distrib)
   374 by (fact setsum.F_fun_f)
   372 
   375 
   373 
   376 
   374 subsubsection {* Properties in more restricted classes of structures *}
   377 subsubsection {* Properties in more restricted classes of structures *}
   375 
   378 
   376 lemma setsum_SucD: "setsum f A = Suc n ==> EX a:A. 0 < f a"
   379 lemma setsum_SucD: "setsum f A = Suc n ==> EX a:A. 0 < f a"
  1034  apply (simp) 
  1037  apply (simp) 
  1035 apply (auto simp add: setprod_def
  1038 apply (auto simp add: setprod_def
  1036             dest: finite_cartesian_productD1 finite_cartesian_productD2) 
  1039             dest: finite_cartesian_productD1 finite_cartesian_productD2) 
  1037 done
  1040 done
  1038 
  1041 
  1039 lemma setprod_timesf:
  1042 lemma setprod_timesf: "setprod (%x. f x * g x) A = (setprod f A * setprod g A)"
  1040      "setprod (%x. f x * g x) A = (setprod f A * setprod g A)"
  1043 by (fact setprod.F_fun_f)
  1041 by(simp add:setprod_def fold_image_distrib)
       
  1042 
  1044 
  1043 
  1045 
  1044 subsubsection {* Properties in more restricted classes of structures *}
  1046 subsubsection {* Properties in more restricted classes of structures *}
  1045 
  1047 
  1046 lemma setprod_eq_1_iff [simp]:
  1048 lemma setprod_eq_1_iff [simp]: