src/HOL/Algebra/Ring.thy
changeset 23350 50c5b0912a0c
parent 22265 3c5c6bdf61de
child 23957 54fab60ddc97
equal deleted inserted replaced
23349:23a8345f89f5 23350:50c5b0912a0c
   247 
   247 
   248 lemma (in abelian_monoid) finsum_closed [simp]:
   248 lemma (in abelian_monoid) finsum_closed [simp]:
   249   fixes A
   249   fixes A
   250   assumes fin: "finite A" and f: "f \<in> A -> carrier G" 
   250   assumes fin: "finite A" and f: "f \<in> A -> carrier G" 
   251   shows "finsum G f A \<in> carrier G"
   251   shows "finsum G f A \<in> carrier G"
   252   by (rule comm_monoid.finprod_closed [OF a_comm_monoid,
   252   apply (rule comm_monoid.finprod_closed [OF a_comm_monoid,
   253     folded finsum_def, simplified monoid_record_simps])
   253     folded finsum_def, simplified monoid_record_simps])
       
   254    apply (rule fin)
       
   255   apply (rule f)
       
   256   done
   254 
   257 
   255 lemma (in abelian_monoid) finsum_Un_Int:
   258 lemma (in abelian_monoid) finsum_Un_Int:
   256   "[| finite A; finite B; g \<in> A -> carrier G; g \<in> B -> carrier G |] ==>
   259   "[| finite A; finite B; g \<in> A -> carrier G; g \<in> B -> carrier G |] ==>
   257      finsum G g (A Un B) \<oplus> finsum G g (A Int B) =
   260      finsum G g (A Un B) \<oplus> finsum G g (A Int B) =
   258      finsum G g A \<oplus> finsum G g B"
   261      finsum G g A \<oplus> finsum G g B"
   357   "monoid R"
   360   "monoid R"
   358   by (auto intro!: monoidI m_assoc)
   361   by (auto intro!: monoidI m_assoc)
   359 
   362 
   360 lemma (in ring) is_ring:
   363 lemma (in ring) is_ring:
   361   "ring R"
   364   "ring R"
   362   .
   365   by fact
   363 
   366 
   364 lemmas ring_record_simps = monoid_record_simps ring.simps
   367 lemmas ring_record_simps = monoid_record_simps ring.simps
   365 
   368 
   366 lemma cringI:
   369 lemma cringI:
   367   fixes R (structure)
   370   fixes R (structure)
   368   assumes abelian_group: "abelian_group R"
   371   assumes abelian_group: "abelian_group R"
   369     and comm_monoid: "comm_monoid R"
   372     and comm_monoid: "comm_monoid R"
   370     and l_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |]
   373     and l_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |]
   371       ==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z"
   374       ==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z"
   372   shows "cring R"
   375   shows "cring R"
   373   proof (intro cring.intro ring.intro)
   376 proof (intro cring.intro ring.intro)
   374     show "ring_axioms R"
   377   show "ring_axioms R"
   375     -- {* Right-distributivity follows from left-distributivity and
   378     -- {* Right-distributivity follows from left-distributivity and
   376           commutativity. *}
   379           commutativity. *}
   377     proof (rule ring_axioms.intro)
   380   proof (rule ring_axioms.intro)
   378       fix x y z
   381     fix x y z
   379       assume R: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R"
   382     assume R: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R"
   380       note [simp]= comm_monoid.axioms [OF comm_monoid]
   383     note [simp] = comm_monoid.axioms [OF comm_monoid]
   381         abelian_group.axioms [OF abelian_group]
   384       abelian_group.axioms [OF abelian_group]
   382         abelian_monoid.a_closed
   385       abelian_monoid.a_closed
   383         
   386         
   384       from R have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z"
   387     from R have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z"
   385         by (simp add: comm_monoid.m_comm [OF comm_monoid.intro])
   388       by (simp add: comm_monoid.m_comm [OF comm_monoid.intro])
   386       also from R have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr)
   389     also from R have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr)
   387       also from R have "... = z \<otimes> x \<oplus> z \<otimes> y"
   390     also from R have "... = z \<otimes> x \<oplus> z \<otimes> y"
   388         by (simp add: comm_monoid.m_comm [OF comm_monoid.intro])
   391       by (simp add: comm_monoid.m_comm [OF comm_monoid.intro])
   389       finally show "z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" .
   392     finally show "z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" .
   390     qed
   393   qed (rule l_distr)
   391   qed (auto intro: cring.intro
   394 qed (auto intro: cring.intro
   392       abelian_group.axioms comm_monoid.axioms ring_axioms.intro prems)
   395   abelian_group.axioms comm_monoid.axioms ring_axioms.intro prems)
   393 
   396 
   394 lemma (in cring) is_comm_monoid:
   397 lemma (in cring) is_comm_monoid:
   395   "comm_monoid R"
   398   "comm_monoid R"
   396   by (auto intro!: comm_monoidI m_assoc m_comm)
   399   by (auto intro!: comm_monoidI m_assoc m_comm)
   397 
   400 
   398 lemma (in cring) is_cring:
   401 lemma (in cring) is_cring:
   399   "cring R"
   402   "cring R" by fact
   400   .
   403 
   401 
   404 
   402 subsubsection {* Normaliser for Rings *}
   405 subsubsection {* Normaliser for Rings *}
   403 
   406 
   404 lemma (in abelian_group) r_neg2:
   407 lemma (in abelian_group) r_neg2:
   405   "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y"
   408   "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y"
   645     have "... = \<zero>" by algebra
   648     have "... = \<zero>" by algebra
   646     finally
   649     finally
   647     have "b = \<zero>" .
   650     have "b = \<zero>" .
   648     thus "a = \<zero> \<or> b = \<zero>" by simp
   651     thus "a = \<zero> \<or> b = \<zero>" by simp
   649   qed
   652   qed
   650 qed
   653 qed (rule field_Units)
   651 
   654 
   652 text {* Another variant to show that something is a field *}
   655 text {* Another variant to show that something is a field *}
   653 lemma (in cring) cring_fieldI2:
   656 lemma (in cring) cring_fieldI2:
   654   assumes notzero: "\<zero> \<noteq> \<one>"
   657   assumes notzero: "\<zero> \<noteq> \<one>"
   655   and invex: "\<And>a. \<lbrakk>a \<in> carrier R; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> \<exists>b\<in>carrier R. a \<otimes> b = \<one>"
   658   and invex: "\<And>a. \<lbrakk>a \<in> carrier R; a \<noteq> \<zero>\<rbrakk> \<Longrightarrow> \<exists>b\<in>carrier R. a \<otimes> b = \<one>"