1070 lemmas arith_simps = |
1070 lemmas arith_simps = |
1071 add_num_simps mult_num_simps sub_num_simps |
1071 add_num_simps mult_num_simps sub_num_simps |
1072 BitM.simps dbl_simps dbl_inc_simps dbl_dec_simps |
1072 BitM.simps dbl_simps dbl_inc_simps dbl_dec_simps |
1073 abs_zero abs_one arith_extra_simps |
1073 abs_zero abs_one arith_extra_simps |
1074 |
1074 |
|
1075 lemmas more_arith_simps = |
|
1076 neg_le_iff_le |
|
1077 minus_zero left_minus right_minus |
|
1078 mult_1_left mult_1_right |
|
1079 mult_minus_left mult_minus_right |
|
1080 minus_add_distrib minus_minus mult_assoc |
|
1081 |
|
1082 lemmas of_nat_simps = |
|
1083 of_nat_0 of_nat_1 of_nat_Suc of_nat_add of_nat_mult |
|
1084 |
1075 text {* Simplification of relational operations *} |
1085 text {* Simplification of relational operations *} |
1076 |
1086 |
1077 lemmas eq_numeral_extra = |
1087 lemmas eq_numeral_extra = |
1078 zero_neq_one one_neq_zero |
1088 zero_neq_one one_neq_zero |
1079 |
1089 |
1080 lemmas rel_simps = |
1090 lemmas rel_simps = |
1081 le_num_simps less_num_simps eq_num_simps |
1091 le_num_simps less_num_simps eq_num_simps |
1082 le_numeral_simps le_neg_numeral_simps le_numeral_extra |
1092 le_numeral_simps le_neg_numeral_simps le_numeral_extra |
1083 less_numeral_simps less_neg_numeral_simps less_numeral_extra |
1093 less_numeral_simps less_neg_numeral_simps less_numeral_extra |
1084 eq_numeral_simps eq_neg_numeral_simps eq_numeral_extra |
1094 eq_numeral_simps eq_neg_numeral_simps eq_numeral_extra |
|
1095 |
|
1096 lemma Let_numeral [simp]: "Let (numeral v) f = f (numeral v)" |
|
1097 -- {* Unfold all @{text let}s involving constants *} |
|
1098 unfolding Let_def .. |
|
1099 |
|
1100 lemma Let_neg_numeral [simp]: "Let (neg_numeral v) f = f (neg_numeral v)" |
|
1101 -- {* Unfold all @{text let}s involving constants *} |
|
1102 unfolding Let_def .. |
|
1103 |
|
1104 declaration {* |
|
1105 let |
|
1106 fun number_of thy T n = |
|
1107 if not (Sign.of_sort thy (T, @{sort numeral})) |
|
1108 then raise CTERM ("number_of", []) |
|
1109 else Numeral.mk_cnumber (Thm.ctyp_of thy T) n; |
|
1110 in |
|
1111 K ( |
|
1112 Lin_Arith.add_simps (@{thms arith_simps} @ @{thms more_arith_simps} |
|
1113 @ @{thms rel_simps} |
|
1114 @ @{thms pred_numeral_simps} |
|
1115 @ @{thms arith_special numeral_One} |
|
1116 @ @{thms of_nat_simps}) |
|
1117 #> Lin_Arith.add_simps [@{thm Suc_numeral}, |
|
1118 @{thm Let_numeral}, @{thm Let_neg_numeral}, @{thm Let_0}, @{thm Let_1}, |
|
1119 @{thm le_Suc_numeral}, @{thm le_numeral_Suc}, |
|
1120 @{thm less_Suc_numeral}, @{thm less_numeral_Suc}, |
|
1121 @{thm Suc_eq_numeral}, @{thm eq_numeral_Suc}, |
|
1122 @{thm mult_Suc}, @{thm mult_Suc_right}, |
|
1123 @{thm of_nat_numeral}] |
|
1124 #> Lin_Arith.set_number_of number_of) |
|
1125 end |
|
1126 *} |
1085 |
1127 |
1086 |
1128 |
1087 subsubsection {* Simplification of arithmetic when nested to the right. *} |
1129 subsubsection {* Simplification of arithmetic when nested to the right. *} |
1088 |
1130 |
1089 lemma add_numeral_left [simp]: |
1131 lemma add_numeral_left [simp]: |