src/HOL/Algebra/Ring.thy
changeset 27699 489e3f33af0e
parent 27611 2c01c0bdb385
child 27714 27b4d7c01f8b
equal deleted inserted replaced
27698:197f0517f0bd 27699:489e3f33af0e
   313 
   313 
   314 text {*Usually, if this rule causes a failed congruence proof error,
   314 text {*Usually, if this rule causes a failed congruence proof error,
   315    the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown.
   315    the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown.
   316    Adding @{thm [source] Pi_def} to the simpset is often useful. *}
   316    Adding @{thm [source] Pi_def} to the simpset is often useful. *}
   317 
   317 
       
   318 lemma (in abelian_monoid) finsum_reindex:
       
   319   assumes fin: "finite A"
       
   320     shows "f : (h ` A) \<rightarrow> carrier G \<Longrightarrow> 
       
   321         inj_on h A ==> finsum G f (h ` A) = finsum G (%x. f (h x)) A"
       
   322   using fin apply induct
       
   323   apply (auto simp add: finsum_insert Pi_def)
       
   324 done
       
   325 
       
   326 (* The following is wrong.  Needed is the equivalent of (^) for addition,
       
   327   or indeed the canonical embedding from Nat into the monoid.
       
   328 
       
   329 lemma (in abelian_monoid) finsum_const:
       
   330   assumes fin [simp]: "finite A"
       
   331       and a [simp]: "a : carrier G"
       
   332     shows "finsum G (%x. a) A = a (^) card A"
       
   333   using fin apply induct
       
   334   apply force
       
   335   apply (subst finsum_insert)
       
   336   apply auto
       
   337   apply (force simp add: Pi_def)
       
   338   apply (subst m_comm)
       
   339   apply auto
       
   340 done
       
   341 *)
       
   342 
   318 
   343 
   319 section {* The Algebraic Hierarchy of Rings *}
   344 section {* The Algebraic Hierarchy of Rings *}
   320 
       
   321 
   345 
   322 subsection {* Basic Definitions *}
   346 subsection {* Basic Definitions *}
   323 
   347 
   324 locale ring = abelian_group R + monoid R +
   348 locale ring = abelian_group R + monoid R +
   325   assumes l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |]
   349   assumes l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |]
   352   by (auto intro: ring.intro
   376   by (auto intro: ring.intro
   353     abelian_group.axioms ring_axioms.intro prems)
   377     abelian_group.axioms ring_axioms.intro prems)
   354 
   378 
   355 lemma (in ring) is_abelian_group:
   379 lemma (in ring) is_abelian_group:
   356   "abelian_group R"
   380   "abelian_group R"
   357   by (auto intro!: abelian_groupI a_assoc a_comm l_neg)
   381   by unfold_locales
   358 
   382 
   359 lemma (in ring) is_monoid:
   383 lemma (in ring) is_monoid:
   360   "monoid R"
   384   "monoid R"
   361   by (auto intro!: monoidI m_assoc)
   385   by (auto intro!: monoidI m_assoc)
   362 
   386 
   392     finally show "z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" .
   416     finally show "z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" .
   393   qed (rule l_distr)
   417   qed (rule l_distr)
   394 qed (auto intro: cring.intro
   418 qed (auto intro: cring.intro
   395   abelian_group.axioms comm_monoid.axioms ring_axioms.intro prems)
   419   abelian_group.axioms comm_monoid.axioms ring_axioms.intro prems)
   396 
   420 
       
   421 (*
   397 lemma (in cring) is_comm_monoid:
   422 lemma (in cring) is_comm_monoid:
   398   "comm_monoid R"
   423   "comm_monoid R"
   399   by (auto intro!: comm_monoidI m_assoc m_comm)
   424   by (auto intro!: comm_monoidI m_assoc m_comm)
       
   425 *)
   400 
   426 
   401 lemma (in cring) is_cring:
   427 lemma (in cring) is_cring:
   402   "cring R" by (rule cring_axioms)
   428   "cring R" by (rule cring_axioms)
   403 
   429 
   404 
   430