src/HOL/Computational_Algebra/Field_as_Ring.thy
changeset 71398 e0237f2eb49d
parent 70817 dd675800469d
equal deleted inserted replaced
71397:028edb1e5b99 71398:e0237f2eb49d
    22 definition mod_field :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"
    22 definition mod_field :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"
    23   where [simp]: "mod_field x y = (if y = 0 then x else 0)"
    23   where [simp]: "mod_field x y = (if y = 0 then x else 0)"
    24 
    24 
    25 end
    25 end
    26 
    26 
    27 instantiation real :: "{unique_euclidean_ring, normalization_euclidean_semiring}"
    27 instantiation real ::
       
    28   "{unique_euclidean_ring, normalization_euclidean_semiring, normalization_semidom_multiplicative}"
    28 begin
    29 begin
    29 
    30 
    30 definition [simp]: "normalize_real = (normalize_field :: real \<Rightarrow> _)"
    31 definition [simp]: "normalize_real = (normalize_field :: real \<Rightarrow> _)"
    31 definition [simp]: "unit_factor_real = (unit_factor_field :: real \<Rightarrow> _)"
    32 definition [simp]: "unit_factor_real = (unit_factor_field :: real \<Rightarrow> _)"
    32 definition [simp]: "modulo_real = (mod_field :: real \<Rightarrow> _)"
    33 definition [simp]: "modulo_real = (mod_field :: real \<Rightarrow> _)"
    53 
    54 
    54 instance by standard (simp_all add: gcd_real_def lcm_real_def Gcd_real_def Lcm_real_def)
    55 instance by standard (simp_all add: gcd_real_def lcm_real_def Gcd_real_def Lcm_real_def)
    55 
    56 
    56 end
    57 end
    57 
    58 
    58 instantiation rat :: "{unique_euclidean_ring, normalization_euclidean_semiring}"
    59 instance real :: field_gcd ..
       
    60 
       
    61 
       
    62 instantiation rat :: 
       
    63   "{unique_euclidean_ring, normalization_euclidean_semiring, normalization_semidom_multiplicative}"
    59 begin
    64 begin
    60 
    65 
    61 definition [simp]: "normalize_rat = (normalize_field :: rat \<Rightarrow> _)"
    66 definition [simp]: "normalize_rat = (normalize_field :: rat \<Rightarrow> _)"
    62 definition [simp]: "unit_factor_rat = (unit_factor_field :: rat \<Rightarrow> _)"
    67 definition [simp]: "unit_factor_rat = (unit_factor_field :: rat \<Rightarrow> _)"
    63 definition [simp]: "modulo_rat = (mod_field :: rat \<Rightarrow> _)"
    68 definition [simp]: "modulo_rat = (mod_field :: rat \<Rightarrow> _)"
    84 
    89 
    85 instance by standard (simp_all add: gcd_rat_def lcm_rat_def Gcd_rat_def Lcm_rat_def)
    90 instance by standard (simp_all add: gcd_rat_def lcm_rat_def Gcd_rat_def Lcm_rat_def)
    86 
    91 
    87 end
    92 end
    88 
    93 
    89 instantiation complex :: "{unique_euclidean_ring, normalization_euclidean_semiring}"
    94 instance rat :: field_gcd ..
       
    95 
       
    96 
       
    97 instantiation complex ::
       
    98   "{unique_euclidean_ring, normalization_euclidean_semiring, normalization_semidom_multiplicative}"
    90 begin
    99 begin
    91 
   100 
    92 definition [simp]: "normalize_complex = (normalize_field :: complex \<Rightarrow> _)"
   101 definition [simp]: "normalize_complex = (normalize_field :: complex \<Rightarrow> _)"
    93 definition [simp]: "unit_factor_complex = (unit_factor_field :: complex \<Rightarrow> _)"
   102 definition [simp]: "unit_factor_complex = (unit_factor_field :: complex \<Rightarrow> _)"
    94 definition [simp]: "modulo_complex = (mod_field :: complex \<Rightarrow> _)"
   103 definition [simp]: "modulo_complex = (mod_field :: complex \<Rightarrow> _)"
   115 
   124 
   116 instance by standard (simp_all add: gcd_complex_def lcm_complex_def Gcd_complex_def Lcm_complex_def)
   125 instance by standard (simp_all add: gcd_complex_def lcm_complex_def Gcd_complex_def Lcm_complex_def)
   117 
   126 
   118 end
   127 end
   119 
   128 
       
   129 instance complex :: field_gcd ..
       
   130 
   120 end
   131 end