src/HOL/ex/Numeral.thy
changeset 31029 e564767f8f78
parent 31028 9c5b6a92da39
child 31902 862ae16a799d
equal deleted inserted replaced
31028:9c5b6a92da39 31029:e564767f8f78
   707 
   707 
   708 lemma power_of_num [numeral]: "of_num x ^ of_num y = of_num (pow x y)"
   708 lemma power_of_num [numeral]: "of_num x ^ of_num y = of_num (pow x y)"
   709   unfolding of_num_pow ..
   709   unfolding of_num_pow ..
   710 
   710 
   711 lemma power_zero_of_num [numeral]:
   711 lemma power_zero_of_num [numeral]:
   712   "0 ^ of_num n = (0::'a::{semiring_0,power})"
   712   "0 ^ of_num n = (0::'a::semiring_1)"
   713   using of_num_pos [where n=n and ?'a=nat]
   713   using of_num_pos [where n=n and ?'a=nat]
   714   by (simp add: power_0_left)
   714   by (simp add: power_0_left)
   715 
   715 
   716 lemma power_minus_Dig0 [numeral]:
   716 lemma power_minus_Dig0 [numeral]:
   717   fixes x :: "'a::{ring_1}"
   717   fixes x :: "'a::ring_1"
   718   shows "(- x) ^ of_num (Dig0 n) = x ^ of_num (Dig0 n)"
   718   shows "(- x) ^ of_num (Dig0 n) = x ^ of_num (Dig0 n)"
   719   by (induct n rule: num_induct) (simp_all add: of_num.simps of_num_inc)
   719   by (induct n rule: num_induct) (simp_all add: of_num.simps of_num_inc)
   720 
   720 
   721 lemma power_minus_Dig1 [numeral]:
   721 lemma power_minus_Dig1 [numeral]:
   722   fixes x :: "'a::{ring_1}"
   722   fixes x :: "'a::ring_1"
   723   shows "(- x) ^ of_num (Dig1 n) = - (x ^ of_num (Dig1 n))"
   723   shows "(- x) ^ of_num (Dig1 n) = - (x ^ of_num (Dig1 n))"
   724   by (induct n rule: num_induct) (simp_all add: of_num.simps of_num_inc)
   724   by (induct n rule: num_induct) (simp_all add: of_num.simps of_num_inc)
   725 
   725 
   726 declare power_one [numeral]
   726 declare power_one [numeral]
   727 
   727 
   879 hide (open) const sub dup
   879 hide (open) const sub dup
   880 
   880 
   881 
   881 
   882 subsection {* Numeral equations as default simplification rules *}
   882 subsection {* Numeral equations as default simplification rules *}
   883 
   883 
   884 text {* TODO.  Be more precise here with respect to subsumed facts.  Or use named theorems anyway. *}
   884 declare (in semiring_numeral) of_num_One [simp]
   885 declare (in semiring_numeral) numeral [simp]
   885 declare (in semiring_numeral) of_num_plus_one [simp]
   886 declare (in semiring_1) numeral [simp]
   886 declare (in semiring_numeral) of_num_one_plus [simp]
   887 declare (in semiring_char_0) numeral [simp]
   887 declare (in semiring_numeral) of_num_plus [simp]
   888 declare (in ring_1) numeral [simp]
   888 declare (in semiring_numeral) of_num_times [simp]
       
   889 
       
   890 declare (in semiring_1) of_nat_of_num [simp]
       
   891 
       
   892 declare (in semiring_char_0) of_num_eq_iff [simp]
       
   893 declare (in semiring_char_0) of_num_eq_one_iff [simp]
       
   894 declare (in semiring_char_0) one_eq_of_num_iff [simp]
       
   895 
       
   896 declare (in ordered_semidom) of_num_pos [simp]
       
   897 declare (in ordered_semidom) of_num_less_eq_iff [simp]
       
   898 declare (in ordered_semidom) of_num_less_eq_one_iff [simp]
       
   899 declare (in ordered_semidom) one_less_eq_of_num_iff [simp]
       
   900 declare (in ordered_semidom) of_num_less_iff [simp]
       
   901 declare (in ordered_semidom) of_num_less_one_iff [simp]
       
   902 declare (in ordered_semidom) one_less_of_num_iff [simp]
       
   903 declare (in ordered_semidom) of_num_nonneg [simp]
       
   904 declare (in ordered_semidom) of_num_less_zero_iff [simp]
       
   905 declare (in ordered_semidom) of_num_le_zero_iff [simp]
       
   906 
       
   907 declare (in ordered_idom) le_signed_numeral_special [simp]
       
   908 declare (in ordered_idom) less_signed_numeral_special [simp]
       
   909 
       
   910 declare (in semiring_1_minus) Dig_of_num_minus_one [simp]
       
   911 declare (in semiring_1_minus) Dig_one_minus_of_num [simp]
       
   912 
       
   913 declare (in ring_1) Dig_plus_uminus [simp]
       
   914 declare (in ring_1) of_int_of_num [simp]
       
   915 
       
   916 declare power_of_num [simp]
       
   917 declare power_zero_of_num [simp]
       
   918 declare power_minus_Dig0 [simp]
       
   919 declare power_minus_Dig1 [simp]
       
   920 
       
   921 declare Suc_of_num [simp]
       
   922 
   889 thm numeral
   923 thm numeral
   890 
   924 
   891 
   925 
   892 subsection {* Simplification Procedures *}
   926 subsection {* Simplification Procedures *}
   893 
   927