src/HOL/Algebra/Ring.thy
changeset 61384 9f5145281888
parent 61382 efac889fccbc
child 61565 352c73a689da
equal deleted inserted replaced
61383:6762c8445138 61384:9f5145281888
   139 lemmas finsum_add = add.finprod_mult
   139 lemmas finsum_add = add.finprod_mult
   140 lemmas finsum_infinite = add.finprod_infinite
   140 lemmas finsum_infinite = add.finprod_infinite
   141 
   141 
   142 lemmas finsum_cong = add.finprod_cong
   142 lemmas finsum_cong = add.finprod_cong
   143 text \<open>Usually, if this rule causes a failed congruence proof error,
   143 text \<open>Usually, if this rule causes a failed congruence proof error,
   144    the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown.
   144    the reason is that the premise @{text "g \<in> B \<rightarrow> carrier G"} cannot be shown.
   145    Adding @{thm [source] Pi_def} to the simpset is often useful.\<close>
   145    Adding @{thm [source] Pi_def} to the simpset is often useful.\<close>
   146 
   146 
   147 lemmas finsum_reindex = add.finprod_reindex
   147 lemmas finsum_reindex = add.finprod_reindex
   148 
   148 
   149 (* The following would be wrong.  Needed is the equivalent of (^) for addition,
   149 (* The following would be wrong.  Needed is the equivalent of (^) for addition,
   488 
   488 
   489 
   489 
   490 subsubsection \<open>Sums over Finite Sets\<close>
   490 subsubsection \<open>Sums over Finite Sets\<close>
   491 
   491 
   492 lemma (in semiring) finsum_ldistr:
   492 lemma (in semiring) finsum_ldistr:
   493   "[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==>
   493   "[| finite A; a \<in> carrier R; f \<in> A \<rightarrow> carrier R |] ==>
   494    finsum R f A \<otimes> a = finsum R (%i. f i \<otimes> a) A"
   494    finsum R f A \<otimes> a = finsum R (%i. f i \<otimes> a) A"
   495 proof (induct set: finite)
   495 proof (induct set: finite)
   496   case empty then show ?case by simp
   496   case empty then show ?case by simp
   497 next
   497 next
   498   case (insert x F) then show ?case by (simp add: Pi_def l_distr)
   498   case (insert x F) then show ?case by (simp add: Pi_def l_distr)
   499 qed
   499 qed
   500 
   500 
   501 lemma (in semiring) finsum_rdistr:
   501 lemma (in semiring) finsum_rdistr:
   502   "[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==>
   502   "[| finite A; a \<in> carrier R; f \<in> A \<rightarrow> carrier R |] ==>
   503    a \<otimes> finsum R f A = finsum R (%i. a \<otimes> f i) A"
   503    a \<otimes> finsum R f A = finsum R (%i. a \<otimes> f i) A"
   504 proof (induct set: finite)
   504 proof (induct set: finite)
   505   case empty then show ?case by simp
   505   case empty then show ?case by simp
   506 next
   506 next
   507   case (insert x F) then show ?case by (simp add: Pi_def r_distr)
   507   case (insert x F) then show ?case by (simp add: Pi_def r_distr)
   607 subsection \<open>Morphisms\<close>
   607 subsection \<open>Morphisms\<close>
   608 
   608 
   609 definition
   609 definition
   610   ring_hom :: "[('a, 'm) ring_scheme, ('b, 'n) ring_scheme] => ('a => 'b) set"
   610   ring_hom :: "[('a, 'm) ring_scheme, ('b, 'n) ring_scheme] => ('a => 'b) set"
   611   where "ring_hom R S =
   611   where "ring_hom R S =
   612     {h. h \<in> carrier R -> carrier S &
   612     {h. h \<in> carrier R \<rightarrow> carrier S &
   613       (ALL x y. x \<in> carrier R & y \<in> carrier R -->
   613       (ALL x y. x \<in> carrier R & y \<in> carrier R -->
   614         h (x \<otimes>\<^bsub>R\<^esub> y) = h x \<otimes>\<^bsub>S\<^esub> h y & h (x \<oplus>\<^bsub>R\<^esub> y) = h x \<oplus>\<^bsub>S\<^esub> h y) &
   614         h (x \<otimes>\<^bsub>R\<^esub> y) = h x \<otimes>\<^bsub>S\<^esub> h y & h (x \<oplus>\<^bsub>R\<^esub> y) = h x \<oplus>\<^bsub>S\<^esub> h y) &
   615       h \<one>\<^bsub>R\<^esub> = \<one>\<^bsub>S\<^esub>}"
   615       h \<one>\<^bsub>R\<^esub> = \<one>\<^bsub>S\<^esub>}"
   616 
   616 
   617 lemma ring_hom_memI:
   617 lemma ring_hom_memI:
   673     by (simp add: hom_add [symmetric] R.r_neg S.r_neg del: hom_add)
   673     by (simp add: hom_add [symmetric] R.r_neg S.r_neg del: hom_add)
   674   with R show ?thesis by simp
   674   with R show ?thesis by simp
   675 qed
   675 qed
   676 
   676 
   677 lemma (in ring_hom_cring) hom_finsum [simp]:
   677 lemma (in ring_hom_cring) hom_finsum [simp]:
   678   "f \<in> A -> carrier R ==>
   678   "f \<in> A \<rightarrow> carrier R ==>
   679   h (finsum R f A) = finsum S (h o f) A"
   679   h (finsum R f A) = finsum S (h o f) A"
   680   by (induct A rule: infinite_finite_induct, auto simp: Pi_def)
   680   by (induct A rule: infinite_finite_induct, auto simp: Pi_def)
   681 
   681 
   682 lemma (in ring_hom_cring) hom_finprod:
   682 lemma (in ring_hom_cring) hom_finprod:
   683   "f \<in> A -> carrier R ==>
   683   "f \<in> A \<rightarrow> carrier R ==>
   684   h (finprod R f A) = finprod S (h o f) A"
   684   h (finprod R f A) = finprod S (h o f) A"
   685   by (induct A rule: infinite_finite_induct, auto simp: Pi_def)
   685   by (induct A rule: infinite_finite_induct, auto simp: Pi_def)
   686 
   686 
   687 declare ring_hom_cring.hom_finprod [simp]
   687 declare ring_hom_cring.hom_finprod [simp]
   688 
   688