src/HOL/Algebra/IntRing.thy
changeset 28823 dcbef866c9e2
parent 28524 644b62cf678f
child 29237 e90d9d51106b
equal deleted inserted replaced
28822:7ca11ecbc4fb 28823:dcbef866c9e2
     3   Id:        $Id$
     3   Id:        $Id$
     4   Author:    Stephan Hohe, TU Muenchen
     4   Author:    Stephan Hohe, TU Muenchen
     5 *)
     5 *)
     6 
     6 
     7 theory IntRing
     7 theory IntRing
     8 imports QuotRing Int Primes
     8 imports QuotRing Lattice Int Primes
     9 begin
     9 begin
    10 
    10 
    11 
    11 
    12 section {* The Ring of Integers *}
    12 section {* The Ring of Integers *}
    13 
    13 
   102     and "mult \<Z> x y = x * y"
   102     and "mult \<Z> x y = x * y"
   103     and "one \<Z> = 1"
   103     and "one \<Z> = 1"
   104     and "pow \<Z> x n = x^n"
   104     and "pow \<Z> x n = x^n"
   105 proof -
   105 proof -
   106   -- "Specification"
   106   -- "Specification"
   107   show "monoid \<Z>" by (unfold_locales) (auto simp: int_ring_def)
   107   show "monoid \<Z>" proof qed (auto simp: int_ring_def)
   108   then interpret int: monoid ["\<Z>"] .
   108   then interpret int: monoid ["\<Z>"] .
   109 
   109 
   110   -- "Carrier"
   110   -- "Carrier"
   111   show "carrier \<Z> = UNIV" by (simp add: int_ring_def)
   111   show "carrier \<Z> = UNIV" by (simp add: int_ring_def)
   112 
   112 
   119 
   119 
   120 interpretation int: comm_monoid ["\<Z>"]
   120 interpretation int: comm_monoid ["\<Z>"]
   121   where "finprod \<Z> f A = (if finite A then setprod f A else undefined)"
   121   where "finprod \<Z> f A = (if finite A then setprod f A else undefined)"
   122 proof -
   122 proof -
   123   -- "Specification"
   123   -- "Specification"
   124   show "comm_monoid \<Z>" by (unfold_locales) (auto simp: int_ring_def)
   124   show "comm_monoid \<Z>" proof qed (auto simp: int_ring_def)
   125   then interpret int: comm_monoid ["\<Z>"] .
   125   then interpret int: comm_monoid ["\<Z>"] .
   126 
   126 
   127   -- "Operations"
   127   -- "Operations"
   128   { fix x y have "mult \<Z> x y = x * y" by (simp add: int_ring_def) }
   128   { fix x y have "mult \<Z> x y = x * y" by (simp add: int_ring_def) }
   129   note mult = this
   129   note mult = this
   144   where "zero \<Z> = 0"
   144   where "zero \<Z> = 0"
   145     and "add \<Z> x y = x + y"
   145     and "add \<Z> x y = x + y"
   146     and "finsum \<Z> f A = (if finite A then setsum f A else undefined)"
   146     and "finsum \<Z> f A = (if finite A then setsum f A else undefined)"
   147 proof -
   147 proof -
   148   -- "Specification"
   148   -- "Specification"
   149   show "abelian_monoid \<Z>" by (unfold_locales) (auto simp: int_ring_def)
   149   show "abelian_monoid \<Z>" proof qed (auto simp: int_ring_def)
   150   then interpret int: abelian_monoid ["\<Z>"] .
   150   then interpret int: abelian_monoid ["\<Z>"] .
   151 
   151 
   152   -- "Operations"
   152   -- "Operations"
   153   { fix x y show "add \<Z> x y = x + y" by (simp add: int_ring_def) }
   153   { fix x y show "add \<Z> x y = x + y" by (simp add: int_ring_def) }
   154   note add = this
   154   note add = this
   187   note a_inv = this
   187   note a_inv = this
   188   show "a_minus \<Z> x y = x - y" by (simp add: int.minus_eq add a_inv)
   188   show "a_minus \<Z> x y = x - y" by (simp add: int.minus_eq add a_inv)
   189 qed
   189 qed
   190 
   190 
   191 interpretation int: "domain" ["\<Z>"]
   191 interpretation int: "domain" ["\<Z>"]
   192   by (unfold_locales) (auto simp: int_ring_def left_distrib right_distrib)
   192   proof qed (auto simp: int_ring_def left_distrib right_distrib)
   193 
   193 
   194 
   194 
   195 text {* Removal of occurrences of @{term UNIV} in interpretation result
   195 text {* Removal of occurrences of @{term UNIV} in interpretation result
   196   --- experimental. *}
   196   --- experimental. *}
   197 
   197 
   209   where "carrier (| carrier = UNIV::int set, eq = op =, le = op \<le> |) = UNIV"
   209   where "carrier (| carrier = UNIV::int set, eq = op =, le = op \<le> |) = UNIV"
   210     and "le (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x \<le> y)"
   210     and "le (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x \<le> y)"
   211     and "lless (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x < y)"
   211     and "lless (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x < y)"
   212 proof -
   212 proof -
   213   show "partial_order (| carrier = UNIV::int set, eq = op =, le = op \<le> |)"
   213   show "partial_order (| carrier = UNIV::int set, eq = op =, le = op \<le> |)"
   214     by unfold_locales simp_all
   214     proof qed simp_all
   215   show "carrier (| carrier = UNIV::int set, eq = op =, le = op \<le> |) = UNIV"
   215   show "carrier (| carrier = UNIV::int set, eq = op =, le = op \<le> |) = UNIV"
   216     by simp
   216     by simp
   217   show "le (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x \<le> y)"
   217   show "le (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x \<le> y)"
   218     by simp
   218     by simp
   219   show "lless (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x < y)"
   219   show "lless (| carrier = UNIV::int set, eq = op =, le = op \<le> |) x y = (x < y)"
   246     done
   246     done
   247 qed
   247 qed
   248 
   248 
   249 interpretation int (* [unfolded UNIV] *) :
   249 interpretation int (* [unfolded UNIV] *) :
   250   total_order ["(| carrier = UNIV::int set, eq = op =, le = op \<le> |)"]
   250   total_order ["(| carrier = UNIV::int set, eq = op =, le = op \<le> |)"]
   251   by unfold_locales clarsimp
   251   proof qed clarsimp
   252 
   252 
   253 
   253 
   254 subsection {* Generated Ideals of @{text "\<Z>"} *}
   254 subsection {* Generated Ideals of @{text "\<Z>"} *}
   255 
   255 
   256 lemma int_Idl:
   256 lemma int_Idl: