src/HOL/IntDef.thy
changeset 23431 25ca91279a9b
parent 23402 6472c689664f
child 23438 dd824e86fa8a
equal deleted inserted replaced
23430:771117253634 23431:25ca91279a9b
   363 qed
   363 qed
   364 
   364 
   365 lemma zadd_int_left: "(int m) + (int n + z) = int (m + n) + z"
   365 lemma zadd_int_left: "(int m) + (int n + z) = int (m + n) + z"
   366 by simp
   366 by simp
   367 
   367 
   368 lemma int_Suc: "int (Suc m) = 1 + (int m)"
       
   369 by simp
       
   370 
       
   371 lemma int_Suc0_eq_1: "int (Suc 0) = 1"
   368 lemma int_Suc0_eq_1: "int (Suc 0) = 1"
   372 by simp
   369 by simp
   373 
   370 
   374 lemma abs_of_nat [simp]: "\<bar>of_nat n::'a::ordered_idom\<bar> = of_nat n"
   371 lemma abs_of_nat [simp]: "\<bar>of_nat n::'a::ordered_idom\<bar> = of_nat n"
   375 by (rule  of_nat_0_le_iff [THEN abs_of_nonneg]) (* belongs in Nat.thy *)
   372 by (rule  of_nat_0_le_iff [THEN abs_of_nonneg]) (* belongs in Nat.thy *)
   504 by (simp add: diff_minus)
   501 by (simp add: diff_minus)
   505 
   502 
   506 lemma of_int_mult [simp]: "of_int (w*z) = of_int w * of_int z"
   503 lemma of_int_mult [simp]: "of_int (w*z) = of_int w * of_int z"
   507 apply (cases w, cases z)
   504 apply (cases w, cases z)
   508 apply (simp add: compare_rls of_int left_diff_distrib right_diff_distrib
   505 apply (simp add: compare_rls of_int left_diff_distrib right_diff_distrib
   509                  mult add_ac)
   506                  mult add_ac of_nat_mult)
   510 done
   507 done
   511 
   508 
   512 lemma of_int_le_iff [simp]:
   509 lemma of_int_le_iff [simp]:
   513      "(of_int w \<le> (of_int z::'a::ordered_idom)) = (w \<le> z)"
   510      "(of_int w \<le> (of_int z::'a::ordered_idom)) = (w \<le> z)"
   514 apply (cases w)
   511 apply (cases w)
   643   apply (erule finite_induct, auto)
   640   apply (erule finite_induct, auto)
   644   done
   641   done
   645 
   642 
   646 lemma of_nat_setprod: "of_nat (setprod f A) = (\<Prod>x\<in>A. of_nat(f x))"
   643 lemma of_nat_setprod: "of_nat (setprod f A) = (\<Prod>x\<in>A. of_nat(f x))"
   647   apply (cases "finite A")
   644   apply (cases "finite A")
   648   apply (erule finite_induct, auto)
   645   apply (erule finite_induct, auto simp add: of_nat_mult)
   649   done
   646   done
   650 
   647 
   651 lemma of_int_setprod: "of_int (setprod f A) = (\<Prod>x\<in>A. of_int(f x))"
   648 lemma of_int_setprod: "of_int (setprod f A) = (\<Prod>x\<in>A. of_int(f x))"
   652   apply (cases "finite A")
   649   apply (cases "finite A")
   653   apply (erule finite_induct, auto)
   650   apply (erule finite_induct, auto)
   710 done
   707 done
   711 
   708 
   712 
   709 
   713 subsection {* Legacy theorems *}
   710 subsection {* Legacy theorems *}
   714 
   711 
   715 lemmas zminus_zminus = minus_minus [where 'a=int]
   712 lemmas zminus_zminus = minus_minus [of "?z::int"]
   716 lemmas zminus_0 = minus_zero [where 'a=int]
   713 lemmas zminus_0 = minus_zero [where 'a=int]
   717 lemmas zminus_zadd_distrib = minus_add_distrib [where 'a=int]
   714 lemmas zminus_zadd_distrib = minus_add_distrib [of "?z::int" "?w"]
   718 lemmas zadd_commute = add_commute [where 'a=int]
   715 lemmas zadd_commute = add_commute [of "?z::int" "?w"]
   719 lemmas zadd_assoc = add_assoc [where 'a=int]
   716 lemmas zadd_assoc = add_assoc [of "?z1.0::int" "?z2.0" "?z3.0"]
   720 lemmas zadd_left_commute = add_left_commute [where 'a=int]
   717 lemmas zadd_left_commute = add_left_commute [of "?x::int" "?y" "?z"]
   721 lemmas zadd_ac = zadd_assoc zadd_commute zadd_left_commute
   718 lemmas zadd_ac = zadd_assoc zadd_commute zadd_left_commute
   722 lemmas zmult_ac = OrderedGroup.mult_ac
   719 lemmas zmult_ac = OrderedGroup.mult_ac
   723 lemmas zadd_0 = OrderedGroup.add_0_left [where 'a=int]
   720 lemmas zadd_0 = OrderedGroup.add_0_left [of "?z::int"]
   724 lemmas zadd_0_right = OrderedGroup.add_0_left [where 'a=int]
   721 lemmas zadd_0_right = OrderedGroup.add_0_left [of "?z::int"]
   725 lemmas zadd_zminus_inverse2 = left_minus [where 'a=int]
   722 lemmas zadd_zminus_inverse2 = left_minus [of "?z::int"]
   726 lemmas zmult_zminus = mult_minus_left [where 'a=int]
   723 lemmas zmult_zminus = mult_minus_left [of "?z::int" "?w"]
   727 lemmas zmult_commute = mult_commute [where 'a=int]
   724 lemmas zmult_commute = mult_commute [of "?z::int" "?w"]
   728 lemmas zmult_assoc = mult_assoc [where 'a=int]
   725 lemmas zmult_assoc = mult_assoc [of "?z1.0::int" "?z2.0" "?z3.0"]
   729 lemmas zadd_zmult_distrib = left_distrib [where 'a=int]
   726 lemmas zadd_zmult_distrib = left_distrib [of "?z1.0::int" "?z2.0" "?w"]
   730 lemmas zadd_zmult_distrib2 = right_distrib [where 'a=int]
   727 lemmas zadd_zmult_distrib2 = right_distrib [of "?w::int" "?z1.0" "?z2.0"]
   731 lemmas zdiff_zmult_distrib = left_diff_distrib [where 'a=int]
   728 lemmas zdiff_zmult_distrib = left_diff_distrib [of "?z1.0::int" "?z2.0" "?w"]
   732 lemmas zdiff_zmult_distrib2 = right_diff_distrib [where 'a=int]
   729 lemmas zdiff_zmult_distrib2 = right_diff_distrib [of "?w::int" "?z1.0" "?z2.0"]
   733 
   730 
   734 lemmas int_distrib =
   731 lemmas int_distrib =
   735   zadd_zmult_distrib zadd_zmult_distrib2
   732   zadd_zmult_distrib zadd_zmult_distrib2
   736   zdiff_zmult_distrib zdiff_zmult_distrib2
   733   zdiff_zmult_distrib zdiff_zmult_distrib2
   737 
   734 
   738 lemmas zmult_1 = mult_1_left [where 'a=int]
   735 lemmas zmult_1 = mult_1_left [of "?z::int"]
   739 lemmas zmult_1_right = mult_1_right [where 'a=int]
   736 lemmas zmult_1_right = mult_1_right [of "?z::int"]
   740 
   737 
   741 lemmas zle_refl = order_refl [where 'a=int]
   738 lemmas zle_refl = order_refl [of "?w::int"]
   742 lemmas zle_trans = order_trans [where 'a=int and x="?i" and y="?j" and z="?k"]
   739 lemmas zle_trans = order_trans [where 'a=int and x="?i" and y="?j" and z="?k"]
   743 lemmas zle_anti_sym = order_antisym [where 'a=int]
   740 lemmas zle_anti_sym = order_antisym [of "?z::int" "?w"]
   744 lemmas zle_linear = linorder_linear [where 'a=int]
   741 lemmas zle_linear = linorder_linear [of "?z::int" "?w"]
   745 lemmas zless_linear = linorder_less_linear [where 'a = int]
   742 lemmas zless_linear = linorder_less_linear [where 'a = int]
   746 
   743 
   747 lemmas zadd_left_mono = add_left_mono [where 'a=int]
   744 lemmas zadd_left_mono = add_left_mono [of "?i::int" "?j" "?k"]
   748 lemmas zadd_strict_right_mono = add_strict_right_mono [where 'a=int]
   745 lemmas zadd_strict_right_mono = add_strict_right_mono [of "?i::int" "?j" "?k"]
   749 lemmas zadd_zless_mono = add_less_le_mono [where 'a=int]
   746 lemmas zadd_zless_mono = add_less_le_mono [of "?w'::int" "?w" "?z'" "?z"]
   750 
   747 
   751 lemmas int_0_less_1 = zero_less_one [where 'a=int]
   748 lemmas int_0_less_1 = zero_less_one [where 'a=int]
   752 lemmas int_0_neq_1 = zero_neq_one [where 'a=int]
   749 lemmas int_0_neq_1 = zero_neq_one [where 'a=int]
   753 
   750 
   754 lemmas inj_int = inj_of_nat [where 'a=int]
   751 lemmas inj_int = inj_of_nat [where 'a=int]
   755 lemmas int_int_eq = of_nat_eq_iff [where 'a=int]
   752 lemmas int_int_eq = of_nat_eq_iff [where 'a=int]
   756 lemmas zadd_int = of_nat_add [where 'a=int, symmetric]
   753 lemmas zadd_int = of_nat_add [where 'a=int, symmetric]
   757 lemmas int_mult = of_nat_mult [where 'a=int]
   754 lemmas int_mult = of_nat_mult [where 'a=int]
   758 lemmas zmult_int = of_nat_mult [where 'a=int, symmetric]
   755 lemmas zmult_int = of_nat_mult [where 'a=int, symmetric]
   759 lemmas int_eq_0_conv = of_nat_eq_0_iff [where 'a=int]
   756 lemmas int_eq_0_conv = of_nat_eq_0_iff [where 'a=int and m="?n"]
   760 lemmas zless_int = of_nat_less_iff [where 'a=int]
   757 lemmas zless_int = of_nat_less_iff [where 'a=int]
   761 lemmas int_less_0_conv = of_nat_less_0_iff [where 'a=int]
   758 lemmas int_less_0_conv = of_nat_less_0_iff [where 'a=int and m="?k"]
   762 lemmas zero_less_int_conv = of_nat_0_less_iff [where 'a=int]
   759 lemmas zero_less_int_conv = of_nat_0_less_iff [where 'a=int]
   763 lemmas zle_int = of_nat_le_iff [where 'a=int]
   760 lemmas zle_int = of_nat_le_iff [where 'a=int]
   764 lemmas zero_zle_int = of_nat_0_le_iff [where 'a=int]
   761 lemmas zero_zle_int = of_nat_0_le_iff [where 'a=int]
   765 lemmas int_le_0_conv = of_nat_le_0_iff [where 'a=int]
   762 lemmas int_le_0_conv = of_nat_le_0_iff [where 'a=int and m="?n"]
   766 lemmas int_0 = of_nat_0 [where ?'a_1.0=int]
   763 lemmas int_0 = of_nat_0 [where ?'a_1.0=int]
   767 lemmas int_1 = of_nat_1 [where 'a=int]
   764 lemmas int_1 = of_nat_1 [where 'a=int]
   768 lemmas abs_int_eq = abs_of_nat [where 'a=int]
   765 lemmas int_Suc = of_nat_Suc [where ?'a_1.0=int]
       
   766 lemmas abs_int_eq = abs_of_nat [where 'a=int and n="?m"]
   769 lemmas of_int_int_eq = of_int_of_nat_eq [where 'a=int]
   767 lemmas of_int_int_eq = of_int_of_nat_eq [where 'a=int]
   770 lemmas int_setsum = of_nat_setsum [where 'a=int]
   768 lemmas int_setsum = of_nat_setsum [where 'a=int]
   771 lemmas int_setprod = of_nat_setprod [where 'a=int]
   769 lemmas int_setprod = of_nat_setprod [where 'a=int]
   772 lemmas zdiff_int = of_nat_diff [where 'a=int, symmetric]
   770 lemmas zdiff_int = of_nat_diff [where 'a=int, symmetric]
   773 lemmas zless_le = less_int_def [THEN meta_eq_to_obj_eq]
   771 lemmas zless_le = less_int_def [THEN meta_eq_to_obj_eq]