equal
deleted
inserted
replaced
10 |
10 |
11 |
11 |
12 subsection{*Inequality Reasoning for the Arithmetic Simproc*} |
12 subsection{*Inequality Reasoning for the Arithmetic Simproc*} |
13 |
13 |
14 lemma zless_imp_add1_zle: "w<z ==> w + (1::int) \<le> z" |
14 lemma zless_imp_add1_zle: "w<z ==> w + (1::int) \<le> z" |
15 proof (auto simp add: zle_def zless_iff_Suc_zadd) |
15 apply (rule eq_Abs_Integ [of z]) |
16 fix m n |
16 apply (rule eq_Abs_Integ [of w]) |
17 assume "w + 1 = w + (1 + int m) + (1 + int n)" |
17 apply (simp add: linorder_not_le [symmetric] zle int_def zadd One_int_def) |
18 hence "(w + 1) + (1 + int (m + n)) = (w + 1) + 0" |
18 done |
19 by (simp add: add_ac zadd_int [symmetric]) |
19 |
20 hence "int (Suc(m+n)) = 0" |
|
21 by (simp only: Ring_and_Field.add_left_cancel int_Suc) |
|
22 thus False by (simp only: int_eq_0_conv) |
|
23 qed |
|
24 |
20 |
25 use "int_arith1.ML" |
21 use "int_arith1.ML" |
26 setup int_arith_setup |
22 setup int_arith_setup |
27 |
23 |
28 |
24 |
84 |
80 |
85 lemma nat_2: "nat 2 = Suc (Suc 0)" |
81 lemma nat_2: "nat 2 = Suc (Suc 0)" |
86 by (subst nat_eq_iff, simp) |
82 by (subst nat_eq_iff, simp) |
87 |
83 |
88 lemma nat_less_eq_zless: "0 \<le> w ==> (nat w < nat z) = (w<z)" |
84 lemma nat_less_eq_zless: "0 \<le> w ==> (nat w < nat z) = (w<z)" |
89 apply (case_tac "neg z") |
85 apply (case_tac "z < 0") |
90 apply (auto simp add: nat_less_iff) |
86 apply (auto simp add: nat_less_iff) |
91 apply (auto intro: zless_trans simp add: neg_eq_less_0 zle_def) |
87 done |
92 done |
88 |
93 |
89 |
94 lemma nat_le_eq_zle: "0 < w | 0 \<le> z ==> (nat w \<le> nat z) = (w\<le>z)" |
90 lemma nat_le_eq_zle: "0 < w | 0 \<le> z ==> (nat w \<le> nat z) = (w\<le>z)" |
95 by (auto simp add: linorder_not_less [symmetric] zless_nat_conj) |
91 by (auto simp add: linorder_not_less [symmetric] zless_nat_conj) |
96 |
92 |
97 |
93 |
227 subsection{*Products and 1, by T. M. Rasmussen*} |
223 subsection{*Products and 1, by T. M. Rasmussen*} |
228 |
224 |
229 lemma zmult_eq_self_iff: "(m = m*(n::int)) = (n = 1 | m = 0)" |
225 lemma zmult_eq_self_iff: "(m = m*(n::int)) = (n = 1 | m = 0)" |
230 apply auto |
226 apply auto |
231 apply (subgoal_tac "m*1 = m*n") |
227 apply (subgoal_tac "m*1 = m*n") |
232 apply (drule zmult_cancel1 [THEN iffD1], auto) |
228 apply (drule mult_cancel_left [THEN iffD1], auto) |
233 done |
229 done |
234 |
230 |
235 lemma zless_1_zmult: "[| 1 < m; 1 < n |] ==> 1 < m*(n::int)" |
231 lemma zless_1_zmult: "[| 1 < m; 1 < n |] ==> 1 < m*(n::int)" |
236 apply (rule_tac y = "1*n" in order_less_trans) |
232 apply (rule_tac y = "1*n" in order_less_trans) |
237 apply (rule_tac [2] zmult_zless_mono1) |
233 apply (rule_tac [2] mult_strict_right_mono) |
238 apply (simp_all (no_asm_simp)) |
234 apply (simp_all (no_asm_simp)) |
239 done |
235 done |
240 |
236 |
241 lemma pos_zmult_eq_1_iff: "0 < (m::int) ==> (m * n = 1) = (m = 1 & n = 1)" |
237 lemma pos_zmult_eq_1_iff: "0 < (m::int) ==> (m * n = 1) = (m = 1 & n = 1)" |
242 apply auto |
238 apply auto |