author | paulson |
Thu, 08 Jul 1999 13:43:42 +0200 | |
changeset 6917 | eba301caceea |
parent 6866 | f795b63139ec |
child 6942 | f291292d727c |
permissions | -rw-r--r-- |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/Integ/Int.ML |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
4 |
Copyright 1998 University of Cambridge |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
5 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
6 |
Type "int" is a linear order |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
7 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
8 |
And many further lemmas |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
9 |
*) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
10 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
11 |
Goal "(w<z) = neg(w-z)"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
12 |
by (simp_tac (simpset() addsimps [zless_def]) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
13 |
qed "zless_eq_neg"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
14 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
15 |
Goal "(w=z) = iszero(w-z)"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
16 |
by (simp_tac (simpset() addsimps [iszero_def, zdiff_eq_eq]) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
17 |
qed "eq_eq_iszero"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
18 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
19 |
Goal "(w<=z) = (~ neg(z-w))"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
20 |
by (simp_tac (simpset() addsimps [zle_def, zless_def]) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
21 |
qed "zle_eq_not_neg"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
22 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
23 |
|
5593 | 24 |
(*** Inequality lemmas involving int (Suc m) ***) |
25 |
||
26 |
Goal "(w < z + int (Suc m)) = (w < z + int m | w = z + int m)"; |
|
27 |
by (auto_tac (claset(), |
|
28 |
simpset() addsimps [zless_iff_Suc_zadd, zadd_assoc, zadd_int])); |
|
6717
70b251dc7055
int_Suc->int_Suc_int_1 avoiding confusion with the more useful Bin.int_Suc
paulson
parents:
5593
diff
changeset
|
29 |
by (cut_inst_tac [("m","m")] int_Suc_int_1 1); |
70b251dc7055
int_Suc->int_Suc_int_1 avoiding confusion with the more useful Bin.int_Suc
paulson
parents:
5593
diff
changeset
|
30 |
by (cut_inst_tac [("m","n")] int_Suc_int_1 1); |
5593 | 31 |
by (Asm_full_simp_tac 1); |
32 |
by (exhaust_tac "n" 1); |
|
33 |
by Auto_tac; |
|
6717
70b251dc7055
int_Suc->int_Suc_int_1 avoiding confusion with the more useful Bin.int_Suc
paulson
parents:
5593
diff
changeset
|
34 |
by (cut_inst_tac [("m","m")] int_Suc_int_1 1); |
5593 | 35 |
by (full_simp_tac (simpset() addsimps zadd_ac) 1); |
36 |
by (asm_full_simp_tac (simpset() addsimps [zadd_assoc RS sym]) 1); |
|
37 |
by (auto_tac (claset(), |
|
38 |
simpset() addsimps [zless_iff_Suc_zadd, zadd_assoc, zadd_int])); |
|
39 |
qed "zless_add_int_Suc_eq"; |
|
40 |
||
41 |
||
42 |
Goal "(w + int (Suc m) <= z) = (w + int m < z)"; |
|
43 |
by (simp_tac (simpset() addsimps [zle_def, zless_add_int_Suc_eq]) 1); |
|
44 |
by (auto_tac (claset() addIs [zle_anti_sym] addEs [zless_asym], |
|
45 |
simpset() addsimps [zless_imp_zle, symmetric zle_def])); |
|
46 |
qed "add_int_Suc_zle_eq"; |
|
47 |
||
48 |
||
49 |
(* (w < int (Suc m)) = (w < int m | w = int m) *) |
|
50 |
bind_thm ("less_int_Suc_eq", |
|
51 |
simplify (simpset()) |
|
52 |
(read_instantiate [("z", "int 0")] zless_add_int_Suc_eq)); |
|
53 |
||
54 |
Goal "(w <= int (Suc m)) = (w <= int m | w = int (Suc m))"; |
|
55 |
by (simp_tac (simpset() addsimps [less_int_Suc_eq, order_le_less]) 1); |
|
56 |
qed "le_int_Suc_eq"; |
|
57 |
||
58 |
||
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
59 |
(*** Monotonicity results ***) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
60 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
61 |
Goal "(v+z < w+z) = (v < (w::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
62 |
by (Simp_tac 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
63 |
qed "zadd_right_cancel_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
64 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
65 |
Goal "(z+v < z+w) = (v < (w::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
66 |
by (Simp_tac 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
67 |
qed "zadd_left_cancel_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
68 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
69 |
Addsimps [zadd_right_cancel_zless, zadd_left_cancel_zless]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
70 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
71 |
Goal "(v+z <= w+z) = (v <= (w::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
72 |
by (Simp_tac 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
73 |
qed "zadd_right_cancel_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
74 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
75 |
Goal "(z+v <= z+w) = (v <= (w::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
76 |
by (Simp_tac 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
77 |
qed "zadd_left_cancel_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
78 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
79 |
Addsimps [zadd_right_cancel_zle, zadd_left_cancel_zle]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
80 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
81 |
(*"v<=w ==> v+z <= w+z"*) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
82 |
bind_thm ("zadd_zless_mono1", zadd_right_cancel_zless RS iffD2); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
83 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
84 |
(*"v<=w ==> v+z <= w+z"*) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
85 |
bind_thm ("zadd_zle_mono1", zadd_right_cancel_zle RS iffD2); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
86 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
87 |
Goal "!!z z'::int. [| w'<=w; z'<=z |] ==> w' + z' <= w + z"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
88 |
by (etac (zadd_zle_mono1 RS zle_trans) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
89 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
90 |
qed "zadd_zle_mono"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
91 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
92 |
Goal "!!z z'::int. [| w'<w; z'<=z |] ==> w' + z' < w + z"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
93 |
by (etac (zadd_zless_mono1 RS zless_zle_trans) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
94 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
95 |
qed "zadd_zless_mono"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
96 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
97 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
98 |
(*** Comparison laws ***) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
99 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
100 |
Goal "(- x < - y) = (y < (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
101 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
102 |
qed "zminus_zless_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
103 |
Addsimps [zminus_zless_zminus]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
104 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
105 |
Goal "(- x <= - y) = (y <= (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
106 |
by (simp_tac (simpset() addsimps [zle_def]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
107 |
qed "zminus_zle_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
108 |
Addsimps [zminus_zle_zminus]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
109 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
110 |
(** The next several equations can make the simplifier loop! **) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
111 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
112 |
Goal "(x < - y) = (y < - (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
113 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
114 |
qed "zless_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
115 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
116 |
Goal "(- x < y) = (- y < (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
117 |
by (simp_tac (simpset() addsimps [zless_def, zdiff_def] @ zadd_ac) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
118 |
qed "zminus_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
119 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
120 |
Goal "(x <= - y) = (y <= - (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
121 |
by (simp_tac (simpset() addsimps [zle_def, zminus_zless]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
122 |
qed "zle_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
123 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
124 |
Goal "(- x <= y) = (- y <= (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
125 |
by (simp_tac (simpset() addsimps [zle_def, zless_zminus]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
126 |
qed "zminus_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
127 |
|
6917 | 128 |
Goal "(x = - y) = (y = - (x::int))"; |
129 |
by Auto_tac; |
|
130 |
qed "equation_zminus"; |
|
131 |
||
132 |
Goal "(- x = y) = (- (y::int) = x)"; |
|
133 |
by Auto_tac; |
|
134 |
qed "zminus_equation"; |
|
135 |
||
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
136 |
Goal "- (int (Suc n)) < int 0"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
137 |
by (simp_tac (simpset() addsimps [zless_def]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
138 |
qed "negative_zless_0"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
139 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
140 |
Goal "- (int (Suc n)) < int m"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
141 |
by (rtac (negative_zless_0 RS zless_zle_trans) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
142 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
143 |
qed "negative_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
144 |
AddIffs [negative_zless]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
145 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
146 |
Goal "- int n <= int 0"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
147 |
by (simp_tac (simpset() addsimps [zminus_zle]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
148 |
qed "negative_zle_0"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
149 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
150 |
Goal "- int n <= int m"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
151 |
by (simp_tac (simpset() addsimps [zless_def, zle_def, zdiff_def, zadd_int]) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
152 |
qed "negative_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
153 |
AddIffs [negative_zle]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
154 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
155 |
Goal "~(int 0 <= - (int (Suc n)))"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
156 |
by (stac zle_zminus 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
157 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
158 |
qed "not_zle_0_negative"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
159 |
Addsimps [not_zle_0_negative]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
160 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
161 |
Goal "(int n <= - int m) = (n = 0 & m = 0)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
162 |
by Safe_tac; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
163 |
by (Simp_tac 3); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
164 |
by (dtac (zle_zminus RS iffD1) 2); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
165 |
by (ALLGOALS (dtac (negative_zle_0 RSN(2,zle_trans)))); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
166 |
by (ALLGOALS Asm_full_simp_tac); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
167 |
qed "int_zle_neg"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
168 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
169 |
Goal "~(int n < - int m)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
170 |
by (simp_tac (simpset() addsimps [symmetric zle_def]) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
171 |
qed "not_int_zless_negative"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
172 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
173 |
Goal "(- int n = int m) = (n = 0 & m = 0)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
174 |
by (rtac iffI 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
175 |
by (rtac (int_zle_neg RS iffD1) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
176 |
by (dtac sym 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
177 |
by (ALLGOALS Asm_simp_tac); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
178 |
qed "negative_eq_positive"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
179 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
180 |
Addsimps [negative_eq_positive, not_int_zless_negative]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
181 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
182 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
183 |
Goal "(w <= z) = (EX n. z = w + int n)"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
184 |
by (auto_tac (claset() addSIs [not_sym RS not0_implies_Suc], |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
185 |
simpset() addsimps [zless_iff_Suc_zadd, integ_le_less])); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
186 |
qed "zle_iff_zadd"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
187 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
188 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
189 |
Goalw [zdiff_def,zless_def] "neg x = (x < int 0)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
190 |
by Auto_tac; |
6917 | 191 |
qed "neg_eq_less_int0"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
192 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
193 |
Goalw [zle_def] "(~neg x) = (int 0 <= x)"; |
6917 | 194 |
by (simp_tac (simpset() addsimps [neg_eq_less_int0]) 1); |
195 |
qed "not_neg_eq_ge_int0"; |
|
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
196 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
197 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
198 |
(**** nat: magnitide of an integer, as a natural number ****) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
199 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
200 |
Goalw [nat_def] "nat(int n) = n"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
201 |
by Auto_tac; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
202 |
qed "nat_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
203 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
204 |
Goalw [nat_def] "nat(- int n) = 0"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
205 |
by (auto_tac (claset(), |
6917 | 206 |
simpset() addsimps [neg_eq_less_int0, zminus_zless])); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
207 |
qed "nat_zminus_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
208 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
209 |
Addsimps [nat_nat, nat_zminus_nat]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
210 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
211 |
Goal "~ neg z ==> int (nat z) = z"; |
6917 | 212 |
by (dtac (not_neg_eq_ge_int0 RS iffD1) 1); |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
213 |
by (dtac zle_imp_zless_or_eq 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
214 |
by (auto_tac (claset(), simpset() addsimps [zless_iff_Suc_zadd])); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
215 |
qed "not_neg_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
216 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
217 |
Goal "neg x ==> ? n. x = - (int (Suc n))"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
218 |
by (auto_tac (claset(), |
6917 | 219 |
simpset() addsimps [neg_eq_less_int0, zless_iff_Suc_zadd, |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
220 |
zdiff_eq_eq RS sym, zdiff_def])); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
221 |
qed "negD"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
222 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
223 |
Goalw [nat_def] "neg z ==> nat z = 0"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
224 |
by Auto_tac; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
225 |
qed "neg_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
226 |
|
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
227 |
(*An alternative condition is int 0 <= w *) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
228 |
Goal "int 0 < z ==> (nat w < nat z) = (w < z)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
229 |
by (stac (zless_int RS sym) 1); |
6917 | 230 |
by (asm_simp_tac (simpset() addsimps [not_neg_nat, not_neg_eq_ge_int0, |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
231 |
order_le_less]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
232 |
by (case_tac "neg w" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
233 |
by (asm_simp_tac (simpset() addsimps [not_neg_nat]) 2); |
6917 | 234 |
by (asm_full_simp_tac (simpset() addsimps [neg_eq_less_int0, neg_nat]) 1); |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
235 |
by (blast_tac (claset() addIs [order_less_trans]) 1); |
6917 | 236 |
val lemma = result(); |
237 |
||
238 |
Goal "z <= int 0 ==> nat z = 0"; |
|
239 |
by (auto_tac (claset(), |
|
240 |
simpset() addsimps [order_le_less, neg_eq_less_int0, |
|
241 |
zle_def, neg_nat])); |
|
242 |
qed "nat_le_0"; |
|
243 |
||
244 |
Goal "(nat w < nat z) = (int 0 < z & w < z)"; |
|
245 |
by (case_tac "int 0 < z" 1); |
|
246 |
by (auto_tac (claset(), |
|
247 |
simpset() addsimps [lemma, nat_le_0, linorder_not_less])); |
|
248 |
qed "zless_nat_conj"; |
|
249 |
||
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
250 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
251 |
(* a case theorem distinguishing non-negative and negative int *) |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
252 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
253 |
val prems = Goal "[|!! n. P (int n); !! n. P (- (int (Suc n))) |] ==> P z"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
254 |
by (case_tac "neg z" 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
255 |
by (blast_tac (claset() addSDs [negD] addSIs prems) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
256 |
by (etac (not_neg_nat RS subst) 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
257 |
by (resolve_tac prems 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
258 |
qed "int_cases"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
259 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
260 |
fun int_case_tac x = res_inst_tac [("z",x)] int_cases; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
261 |
|
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
262 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
263 |
(*** Monotonicity of Multiplication ***) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
264 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
265 |
Goal "i <= (j::int) ==> i * int k <= j * int k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
266 |
by (induct_tac "k" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
267 |
by (stac int_Suc_int_1 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
268 |
by (ALLGOALS |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
269 |
(asm_simp_tac (simpset() addsimps [zadd_zmult_distrib2, zadd_zle_mono]))); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
270 |
val lemma = result(); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
271 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
272 |
Goal "[| i <= j; int 0 <= k |] ==> i*k <= j*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
273 |
by (res_inst_tac [("t", "k")] (not_neg_nat RS subst) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
274 |
by (etac lemma 2); |
6917 | 275 |
by (full_simp_tac (simpset() addsimps [not_neg_eq_ge_int0]) 1); |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
276 |
qed "zmult_zle_mono1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
277 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
278 |
Goal "[| i <= j; k <= int 0 |] ==> j*k <= i*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
279 |
by (rtac (zminus_zle_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
280 |
by (asm_simp_tac (simpset() addsimps [zmult_zminus_right RS sym, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
281 |
zmult_zle_mono1, zle_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
282 |
qed "zmult_zle_mono1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
283 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
284 |
(*<=monotonicity, BOTH arguments*) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
285 |
Goal "[| i <= j; k <= l; int 0 <= j; int 0 <= k |] ==> i*k <= j*l"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
286 |
by (etac (zmult_zle_mono1 RS order_trans) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
287 |
by (assume_tac 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
288 |
by (rtac order_trans 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
289 |
by (stac zmult_commute 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
290 |
by (etac zmult_zle_mono1 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
291 |
by (assume_tac 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
292 |
by (simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
293 |
qed "zmult_zle_mono"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
294 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
295 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
296 |
(** strict, in 1st argument; proof is by induction on k>0 **) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
297 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
298 |
Goal "i<j ==> 0<k --> int k * i < int k * j"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
299 |
by (induct_tac "k" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
300 |
by (stac int_Suc_int_1 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
301 |
by (case_tac "n=0" 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
302 |
by (ALLGOALS (asm_full_simp_tac |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
303 |
(simpset() addsimps [zadd_zmult_distrib, zadd_zless_mono, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
304 |
order_le_less]))); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
305 |
val lemma = result() RS mp; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
306 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
307 |
Goal "[| i<j; int 0 < k |] ==> k*i < k*j"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
308 |
by (res_inst_tac [("t", "k")] (not_neg_nat RS subst) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
309 |
by (etac lemma 2); |
6917 | 310 |
by (asm_simp_tac (simpset() addsimps [not_neg_eq_ge_int0, |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
311 |
order_le_less]) 1); |
6917 | 312 |
by (forward_tac [conjI RS (zless_nat_conj RS iffD2)] 1); |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
313 |
by Auto_tac; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
314 |
qed "zmult_zless_mono2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
315 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
316 |
Goal "[| i<j; int 0 < k |] ==> i*k < j*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
317 |
by (dtac zmult_zless_mono2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
318 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [zmult_commute]))); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
319 |
qed "zmult_zless_mono1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
320 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
321 |
Goal "[| i<j; k < int 0 |] ==> j*k < i*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
322 |
by (rtac (zminus_zless_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
323 |
by (asm_simp_tac (simpset() addsimps [zmult_zminus_right RS sym, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
324 |
zmult_zless_mono1, zless_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
325 |
qed "zmult_zless_mono1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
326 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
327 |
Goal "[| i<j; k < int 0 |] ==> k*j < k*i"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
328 |
by (rtac (zminus_zless_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
329 |
by (asm_simp_tac (simpset() addsimps [zmult_zminus RS sym, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
330 |
zmult_zless_mono2, zless_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
331 |
qed "zmult_zless_mono2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
332 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
333 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
334 |
Goal "(m*n = int 0) = (m = int 0 | n = int 0)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
335 |
by (case_tac "m < int 0" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
336 |
by (auto_tac (claset(), |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
337 |
simpset() addsimps [linorder_not_less, order_le_less, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
338 |
linorder_neq_iff])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
339 |
by (REPEAT |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
340 |
(force_tac (claset() addDs [zmult_zless_mono1_neg, zmult_zless_mono1], |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
341 |
simpset()) 1)); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
342 |
qed "zmult_eq_iff"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
343 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
344 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
345 |
Goal "int 0 < k ==> (m*k < n*k) = (m<n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
346 |
by (safe_tac (claset() addSIs [zmult_zless_mono1])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
347 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
348 |
by (blast_tac (claset() addIs [zmult_zless_mono1] addEs [order_less_asym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
349 |
qed "zmult_zless_cancel2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
350 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
351 |
Goal "int 0 < k ==> (k*m < k*n) = (m<n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
352 |
by (dtac zmult_zless_cancel2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
353 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
354 |
qed "zmult_zless_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
355 |
Addsimps [zmult_zless_cancel1, zmult_zless_cancel2]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
356 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
357 |
Goal "k < int 0 ==> (m*k < n*k) = (n<m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
358 |
by (safe_tac (claset() addSIs [zmult_zless_mono1_neg])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
359 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
360 |
by (blast_tac (claset() addIs [zmult_zless_mono1_neg] |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
361 |
addEs [order_less_asym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
362 |
qed "zmult_zless_cancel2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
363 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
364 |
Goal "k < int 0 ==> (k*m < k*n) = (n<m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
365 |
by (dtac zmult_zless_cancel2_neg 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
366 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
367 |
qed "zmult_zless_cancel1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
368 |
Addsimps [zmult_zless_cancel1_neg, zmult_zless_cancel2_neg]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
369 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
370 |
Goal "int 0 < k ==> (m*k <= n*k) = (m<=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
371 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
372 |
qed "zmult_zle_cancel2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
373 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
374 |
Goal "int 0 < k ==> (k*m <= k*n) = (m<=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
375 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
376 |
qed "zmult_zle_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
377 |
Addsimps [zmult_zle_cancel1, zmult_zle_cancel2]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
378 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
379 |
Goal "k < int 0 ==> (m*k <= n*k) = (n<=m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
380 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
381 |
qed "zmult_zle_cancel2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
382 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
383 |
Goal "k < int 0 ==> (k*m <= k*n) = (n<=m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
384 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
385 |
qed "zmult_zle_cancel1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
386 |
Addsimps [zmult_zle_cancel1_neg, zmult_zle_cancel2_neg]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
387 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
388 |
Goal "k ~= int 0 ==> (m*k = n*k) = (m=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
389 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
390 |
by Safe_tac; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
391 |
by (assume_tac 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
392 |
by (REPEAT |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
393 |
(force_tac (claset() addD2 ("mono_neg", zmult_zless_mono1_neg) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
394 |
addD2 ("mono_pos", zmult_zless_mono1), |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
395 |
simpset() addsimps [linorder_neq_iff]) 1)); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
396 |
qed "zmult_cancel2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
397 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
398 |
Goal "k ~= int 0 ==> (k*m = k*n) = (m=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
399 |
by (dtac zmult_cancel2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
400 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
401 |
qed "zmult_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
402 |
Addsimps [zmult_cancel1, zmult_cancel2]; |