src/HOL/Algebra/Ring.thy
changeset 35847 19f1f7066917
parent 35416 d8d7d1b785af
child 35848 5443079512ea
equal deleted inserted replaced
35846:2ae4b7585501 35847:19f1f7066917
     4   Copyright: Clemens Ballarin
     4   Copyright: Clemens Ballarin
     5 *)
     5 *)
     6 
     6 
     7 theory Ring
     7 theory Ring
     8 imports FiniteProduct
     8 imports FiniteProduct
     9 uses ("ringsimp.ML") begin
     9 uses ("ringsimp.ML")
       
    10 begin
    10 
    11 
    11 
    12 
    12 section {* The Algebraic Hierarchy of Rings *}
    13 section {* The Algebraic Hierarchy of Rings *}
    13 
    14 
    14 subsection {* Abelian Groups *}
    15 subsection {* Abelian Groups *}
    17   zero :: 'a ("\<zero>\<index>")
    18   zero :: 'a ("\<zero>\<index>")
    18   add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65)
    19   add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65)
    19 
    20 
    20 text {* Derived operations. *}
    21 text {* Derived operations. *}
    21 
    22 
    22 constdefs (structure R)
    23 definition
    23   a_inv :: "[('a, 'm) ring_scheme, 'a ] => 'a" ("\<ominus>\<index> _" [81] 80)
    24   a_inv :: "[('a, 'm) ring_scheme, 'a ] => 'a" ("\<ominus>\<index> _" [81] 80)
    24   "a_inv R == m_inv (| carrier = carrier R, mult = add R, one = zero R |)"
    25   where "a_inv R == m_inv (| carrier = carrier R, mult = add R, one = zero R |)"
    25 
    26 
       
    27 definition
    26   a_minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65)
    28   a_minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65)
    27   "[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus> y == x \<oplus> (\<ominus> y)"
    29   where "[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus>\<^bsub>R\<^esub> y == x \<oplus>\<^bsub>R\<^esub> (\<ominus>\<^bsub>R\<^esub> y)"
    28 
    30 
    29 locale abelian_monoid =
    31 locale abelian_monoid =
    30   fixes G (structure)
    32   fixes G (structure)
    31   assumes a_comm_monoid:
    33   assumes a_comm_monoid:
    32      "comm_monoid (| carrier = carrier G, mult = add G, one = zero G |)"
    34      "comm_monoid (| carrier = carrier G, mult = add G, one = zero G |)"
   726 qed
   728 qed
   727 
   729 
   728 
   730 
   729 subsection {* Morphisms *}
   731 subsection {* Morphisms *}
   730 
   732 
   731 constdefs (structure R S)
   733 definition
   732   ring_hom :: "[('a, 'm) ring_scheme, ('b, 'n) ring_scheme] => ('a => 'b) set"
   734   ring_hom :: "[('a, 'm) ring_scheme, ('b, 'n) ring_scheme] => ('a => 'b) set"
   733   "ring_hom R S == {h. h \<in> carrier R -> carrier S &
   735   where "ring_hom R S ==
       
   736     {h. h \<in> carrier R -> carrier S &
   734       (ALL x y. x \<in> carrier R & y \<in> carrier R -->
   737       (ALL x y. x \<in> carrier R & y \<in> carrier R -->
   735         h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y & h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y) &
   738         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) &
   736       h \<one> = \<one>\<^bsub>S\<^esub>}"
   739       h \<one>\<^bsub>R\<^esub> = \<one>\<^bsub>S\<^esub>}"
   737 
   740 
   738 lemma ring_hom_memI:
   741 lemma ring_hom_memI:
   739   fixes R (structure) and S (structure)
   742   fixes R (structure) and S (structure)
   740   assumes hom_closed: "!!x. x \<in> carrier R ==> h x \<in> carrier S"
   743   assumes hom_closed: "!!x. x \<in> carrier R ==> h x \<in> carrier S"
   741     and hom_mult: "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==>
   744     and hom_mult: "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==>