author | wenzelm |
Wed, 02 Aug 2000 19:40:14 +0200 | |
changeset 9502 | 50ec59aff389 |
parent 9436 | 62bb04ab4b01 |
child 9509 | 0f3ee1f89ca8 |
permissions | -rw-r--r-- |
9436
62bb04ab4b01
rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
9269
diff
changeset
|
1 |
(* Title: HOL/Integ/IntArith.ML |
7707 | 2 |
ID: $Id$ |
3 |
Authors: Larry Paulson and Tobias Nipkow |
|
4 |
*) |
|
5 |
||
9269 | 6 |
Goal "abs(abs(x::int)) = abs(x)"; |
7 |
by(arith_tac 1); |
|
9214 | 8 |
qed "abs_abs"; |
9 |
Addsimps [abs_abs]; |
|
10 |
||
9269 | 11 |
Goal "abs(-(x::int)) = abs(x)"; |
12 |
by(arith_tac 1); |
|
9214 | 13 |
qed "abs_minus"; |
14 |
Addsimps [abs_minus]; |
|
15 |
||
9269 | 16 |
Goal "abs(x+y) <= abs(x) + abs(y::int)"; |
17 |
by(arith_tac 1); |
|
18 |
qed "triangle_ineq"; |
|
19 |
||
9214 | 20 |
|
9063 | 21 |
(*** Some convenient biconditionals for products of signs ***) |
7707 | 22 |
|
9063 | 23 |
Goal "[| (#0::int) < i; #0 < j |] ==> #0 < i*j"; |
24 |
by (dtac zmult_zless_mono1 1); |
|
25 |
by Auto_tac; |
|
26 |
qed "zmult_pos"; |
|
7707 | 27 |
|
9063 | 28 |
Goal "[| i < (#0::int); j < #0 |] ==> #0 < i*j"; |
29 |
by (dtac zmult_zless_mono1_neg 1); |
|
30 |
by Auto_tac; |
|
31 |
qed "zmult_neg"; |
|
7707 | 32 |
|
9063 | 33 |
Goal "[| (#0::int) < i; j < #0 |] ==> i*j < #0"; |
34 |
by (dtac zmult_zless_mono1_neg 1); |
|
35 |
by Auto_tac; |
|
36 |
qed "zmult_pos_neg"; |
|
7707 | 37 |
|
9063 | 38 |
Goal "((#0::int) < x*y) = (#0 < x & #0 < y | x < #0 & y < #0)"; |
39 |
by (auto_tac (claset(), |
|
40 |
simpset() addsimps [order_le_less, linorder_not_less, |
|
41 |
zmult_pos, zmult_neg])); |
|
42 |
by (ALLGOALS (rtac ccontr)); |
|
43 |
by (auto_tac (claset(), |
|
44 |
simpset() addsimps [order_le_less, linorder_not_less])); |
|
45 |
by (ALLGOALS (etac rev_mp)); |
|
46 |
by (ALLGOALS (dtac zmult_pos_neg THEN' assume_tac)); |
|
47 |
by (auto_tac (claset() addDs [order_less_not_sym], |
|
48 |
simpset() addsimps [zmult_commute])); |
|
49 |
qed "int_0_less_mult_iff"; |
|
7707 | 50 |
|
9063 | 51 |
Goal "((#0::int) <= x*y) = (#0 <= x & #0 <= y | x <= #0 & y <= #0)"; |
52 |
by (auto_tac (claset(), |
|
53 |
simpset() addsimps [order_le_less, linorder_not_less, |
|
54 |
int_0_less_mult_iff])); |
|
55 |
qed "int_0_le_mult_iff"; |
|
7707 | 56 |
|
9063 | 57 |
Goal "(x*y < (#0::int)) = (#0 < x & y < #0 | x < #0 & #0 < y)"; |
58 |
by (auto_tac (claset(), |
|
59 |
simpset() addsimps [int_0_le_mult_iff, |
|
60 |
linorder_not_le RS sym])); |
|
61 |
by (auto_tac (claset() addDs [order_less_not_sym], |
|
62 |
simpset() addsimps [linorder_not_le])); |
|
63 |
qed "zmult_less_0_iff"; |
|
7707 | 64 |
|
9063 | 65 |
Goal "(x*y <= (#0::int)) = (#0 <= x & y <= #0 | x <= #0 & #0 <= y)"; |
66 |
by (auto_tac (claset() addDs [order_less_not_sym], |
|
67 |
simpset() addsimps [int_0_less_mult_iff, |
|
68 |
linorder_not_less RS sym])); |
|
69 |
qed "zmult_le_0_iff"; |