author | paulson |
Mon, 26 Jul 1999 10:34:54 +0200 | |
changeset 7081 | 00a0c20c81ae |
parent 7034 | 99e012d61eef |
child 7518 | 67bde103ec0c |
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 |
|
6998 | 84 |
(*"v<=w ==> z+v <= z+w"*) |
85 |
bind_thm ("zadd_zless_mono2", zadd_left_cancel_zless RS iffD2); |
|
86 |
||
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
87 |
(*"v<=w ==> v+z <= w+z"*) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
88 |
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
|
89 |
|
6998 | 90 |
(*"v<=w ==> z+v <= z+w"*) |
91 |
bind_thm ("zadd_zle_mono2", zadd_left_cancel_zle RS iffD2); |
|
92 |
||
7081 | 93 |
Goal "[| w'<=w; z'<=z |] ==> w' + z' <= w + (z::int)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
94 |
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
|
95 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
96 |
qed "zadd_zle_mono"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
97 |
|
7081 | 98 |
Goal "[| w'<w; z'<=z |] ==> w' + z' < w + (z::int)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
99 |
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
|
100 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
101 |
qed "zadd_zless_mono"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
102 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
103 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
104 |
(*** Comparison laws ***) |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
105 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
106 |
Goal "(- x < - y) = (y < (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
107 |
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
|
108 |
qed "zminus_zless_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
109 |
Addsimps [zminus_zless_zminus]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
110 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
111 |
Goal "(- x <= - y) = (y <= (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
112 |
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
|
113 |
qed "zminus_zle_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
114 |
Addsimps [zminus_zle_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 |
(** 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
|
117 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
118 |
Goal "(x < - y) = (y < - (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
119 |
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
|
120 |
qed "zless_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
121 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
122 |
Goal "(- x < y) = (- y < (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
123 |
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
|
124 |
qed "zminus_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
125 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
126 |
Goal "(x <= - y) = (y <= - (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
127 |
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
|
128 |
qed "zle_zminus"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
129 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
130 |
Goal "(- x <= y) = (- y <= (x::int))"; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
131 |
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
|
132 |
qed "zminus_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
133 |
|
6917 | 134 |
Goal "(x = - y) = (y = - (x::int))"; |
135 |
by Auto_tac; |
|
136 |
qed "equation_zminus"; |
|
137 |
||
138 |
Goal "(- x = y) = (- (y::int) = x)"; |
|
139 |
by Auto_tac; |
|
140 |
qed "zminus_equation"; |
|
141 |
||
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
142 |
Goal "- (int (Suc n)) < int 0"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
143 |
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
|
144 |
qed "negative_zless_0"; |
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 (Suc n)) < int m"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
147 |
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
|
148 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
149 |
qed "negative_zless"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
150 |
AddIffs [negative_zless]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
151 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
152 |
Goal "- int n <= int 0"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
153 |
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
|
154 |
qed "negative_zle_0"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
155 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
156 |
Goal "- int n <= int m"; |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
157 |
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
|
158 |
qed "negative_zle"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
159 |
AddIffs [negative_zle]; |
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 0 <= - (int (Suc n)))"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
162 |
by (stac zle_zminus 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
163 |
by (Simp_tac 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
164 |
qed "not_zle_0_negative"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
165 |
Addsimps [not_zle_0_negative]; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
166 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
167 |
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
|
168 |
by Safe_tac; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
169 |
by (Simp_tac 3); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
170 |
by (dtac (zle_zminus RS iffD1) 2); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
171 |
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
|
172 |
by (ALLGOALS Asm_full_simp_tac); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
173 |
qed "int_zle_neg"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
174 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
175 |
Goal "~(int n < - int m)"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
176 |
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
|
177 |
qed "not_int_zless_negative"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
178 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
179 |
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
|
180 |
by (rtac iffI 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
181 |
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
|
182 |
by (dtac sym 1); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
183 |
by (ALLGOALS Asm_simp_tac); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
184 |
qed "negative_eq_positive"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
185 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
186 |
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
|
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 |
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
|
190 |
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
|
191 |
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
|
192 |
qed "zle_iff_zadd"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
193 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
194 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
195 |
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
|
196 |
by Auto_tac; |
6917 | 197 |
qed "neg_eq_less_int0"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
198 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
199 |
Goalw [zle_def] "(~neg x) = (int 0 <= x)"; |
6917 | 200 |
by (simp_tac (simpset() addsimps [neg_eq_less_int0]) 1); |
201 |
qed "not_neg_eq_ge_int0"; |
|
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
202 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
203 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
204 |
(**** 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
|
205 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
206 |
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
|
207 |
by Auto_tac; |
7009
d6a721e7125d
more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents:
6998
diff
changeset
|
208 |
qed "nat_int"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
209 |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5562
diff
changeset
|
210 |
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
|
211 |
by (auto_tac (claset(), |
6917 | 212 |
simpset() addsimps [neg_eq_less_int0, zminus_zless])); |
7009
d6a721e7125d
more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents:
6998
diff
changeset
|
213 |
qed "nat_zminus_int"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
214 |
|
7009
d6a721e7125d
more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents:
6998
diff
changeset
|
215 |
Addsimps [nat_int, nat_zminus_int]; |
5562
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 z ==> int (nat z) = z"; |
6917 | 218 |
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
|
219 |
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
|
220 |
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
|
221 |
qed "not_neg_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
222 |
|
7081 | 223 |
Goal "neg x ==> EX n. x = - (int (Suc n))"; |
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
224 |
by (auto_tac (claset(), |
6917 | 225 |
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
|
226 |
zdiff_eq_eq RS sym, zdiff_def])); |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
227 |
qed "negD"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
228 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
229 |
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
|
230 |
by Auto_tac; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
231 |
qed "neg_nat"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
232 |
|
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
233 |
(*An alternative condition is int 0 <= w *) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
234 |
Goal "int 0 < z ==> (nat w < nat z) = (w < z)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
235 |
by (stac (zless_int RS sym) 1); |
6917 | 236 |
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
|
237 |
order_le_less]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
238 |
by (case_tac "neg w" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
239 |
by (asm_simp_tac (simpset() addsimps [not_neg_nat]) 2); |
6917 | 240 |
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
|
241 |
by (blast_tac (claset() addIs [order_less_trans]) 1); |
6917 | 242 |
val lemma = result(); |
243 |
||
244 |
Goal "z <= int 0 ==> nat z = 0"; |
|
245 |
by (auto_tac (claset(), |
|
246 |
simpset() addsimps [order_le_less, neg_eq_less_int0, |
|
247 |
zle_def, neg_nat])); |
|
7009
d6a721e7125d
more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents:
6998
diff
changeset
|
248 |
qed "nat_le_int0"; |
6917 | 249 |
|
250 |
Goal "(nat w < nat z) = (int 0 < z & w < z)"; |
|
251 |
by (case_tac "int 0 < z" 1); |
|
252 |
by (auto_tac (claset(), |
|
7009
d6a721e7125d
more renaming of theorems from _nat to _int (corresponding to a function that
paulson
parents:
6998
diff
changeset
|
253 |
simpset() addsimps [lemma, nat_le_int0, linorder_not_less])); |
6917 | 254 |
qed "zless_nat_conj"; |
255 |
||
7034 | 256 |
Goal "(0 < nat z) = (int 0 < z)"; |
257 |
by (stac (order_refl RS nat_le_int0 RS sym) 1); |
|
7081 | 258 |
by (stac zless_nat_conj 1); |
7034 | 259 |
by (Simp_tac 1); |
260 |
qed "zless_zero_nat"; |
|
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 |
(* 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
|
264 |
|
6942 | 265 |
val prems = Goal |
266 |
"[|!! n. z = int n ==> P; !! n. z = - (int (Suc n)) ==> P |] ==> P"; |
|
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
267 |
by (case_tac "neg z" 1); |
6942 | 268 |
by (fast_tac (claset() addSDs [negD] addSEs prems) 1); |
269 |
by (dtac (not_neg_nat RS sym) 1); |
|
270 |
by (eresolve_tac prems 1); |
|
5562
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
271 |
qed "int_cases"; |
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
272 |
|
02261e6880d1
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
diff
changeset
|
273 |
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
|
274 |
|
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
275 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
276 |
(*** Monotonicity of Multiplication ***) |
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::int) ==> i * int k <= j * int k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
279 |
by (induct_tac "k" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
280 |
by (stac int_Suc_int_1 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
281 |
by (ALLGOALS |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
282 |
(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
|
283 |
val lemma = result(); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
284 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
285 |
Goal "[| i <= j; int 0 <= k |] ==> i*k <= j*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
286 |
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
|
287 |
by (etac lemma 2); |
6917 | 288 |
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
|
289 |
qed "zmult_zle_mono1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
290 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
291 |
Goal "[| i <= j; k <= int 0 |] ==> j*k <= i*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
292 |
by (rtac (zminus_zle_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
293 |
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
|
294 |
zmult_zle_mono1, zle_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
295 |
qed "zmult_zle_mono1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
296 |
|
6942 | 297 |
Goal "[| i <= j; int 0 <= k |] ==> k*i <= k*j"; |
298 |
by (dtac zmult_zle_mono1 1); |
|
299 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [zmult_commute]))); |
|
300 |
qed "zmult_zle_mono2"; |
|
301 |
||
302 |
Goal "[| i <= j; k <= int 0 |] ==> k*j <= k*i"; |
|
303 |
by (dtac zmult_zle_mono1_neg 1); |
|
304 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [zmult_commute]))); |
|
305 |
qed "zmult_zle_mono2_neg"; |
|
306 |
||
6990 | 307 |
(* <= monotonicity, BOTH arguments*) |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
308 |
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
|
309 |
by (etac (zmult_zle_mono1 RS order_trans) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
310 |
by (assume_tac 1); |
6990 | 311 |
by (etac zmult_zle_mono2 1); |
312 |
by (assume_tac 1); |
|
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
313 |
qed "zmult_zle_mono"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
314 |
|
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 |
(** 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
|
317 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
318 |
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
|
319 |
by (induct_tac "k" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
320 |
by (stac int_Suc_int_1 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
321 |
by (case_tac "n=0" 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
322 |
by (ALLGOALS (asm_full_simp_tac |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
323 |
(simpset() addsimps [zadd_zmult_distrib, zadd_zless_mono, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
324 |
order_le_less]))); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
325 |
val lemma = result() RS mp; |
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; int 0 < k |] ==> k*i < k*j"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
328 |
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
|
329 |
by (etac lemma 2); |
6917 | 330 |
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
|
331 |
order_le_less]) 1); |
6917 | 332 |
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
|
333 |
by Auto_tac; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
334 |
qed "zmult_zless_mono2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
335 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
336 |
Goal "[| i<j; int 0 < k |] ==> i*k < j*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
337 |
by (dtac zmult_zless_mono2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
338 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [zmult_commute]))); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
339 |
qed "zmult_zless_mono1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
340 |
|
6990 | 341 |
(* < monotonicity, BOTH arguments*) |
342 |
Goal "[| i < j; k < l; int 0 < j; int 0 < k |] ==> i*k < j*l"; |
|
343 |
by (etac (zmult_zless_mono1 RS order_less_trans) 1); |
|
344 |
by (assume_tac 1); |
|
345 |
by (etac zmult_zless_mono2 1); |
|
346 |
by (assume_tac 1); |
|
347 |
qed "zmult_zless_mono"; |
|
348 |
||
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
349 |
Goal "[| i<j; k < int 0 |] ==> j*k < i*k"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
350 |
by (rtac (zminus_zless_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
351 |
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
|
352 |
zmult_zless_mono1, zless_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
353 |
qed "zmult_zless_mono1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
354 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
355 |
Goal "[| i<j; k < int 0 |] ==> k*j < k*i"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
356 |
by (rtac (zminus_zless_zminus RS iffD1) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
357 |
by (asm_simp_tac (simpset() addsimps [zmult_zminus RS sym, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
358 |
zmult_zless_mono2, zless_zminus]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
359 |
qed "zmult_zless_mono2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
360 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
361 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
362 |
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
|
363 |
by (case_tac "m < int 0" 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
364 |
by (auto_tac (claset(), |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
365 |
simpset() addsimps [linorder_not_less, order_le_less, |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
366 |
linorder_neq_iff])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
367 |
by (REPEAT |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
368 |
(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
|
369 |
simpset()) 1)); |
6990 | 370 |
qed "zmult_eq_int0_iff"; |
6866
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
371 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
372 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
373 |
Goal "int 0 < k ==> (m*k < n*k) = (m<n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
374 |
by (safe_tac (claset() addSIs [zmult_zless_mono1])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
375 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
376 |
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
|
377 |
qed "zmult_zless_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 "int 0 < k ==> (k*m < k*n) = (m<n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
380 |
by (dtac zmult_zless_cancel2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
381 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
382 |
qed "zmult_zless_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
383 |
Addsimps [zmult_zless_cancel1, zmult_zless_cancel2]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
384 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
385 |
Goal "k < int 0 ==> (m*k < n*k) = (n<m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
386 |
by (safe_tac (claset() addSIs [zmult_zless_mono1_neg])); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
387 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
388 |
by (blast_tac (claset() addIs [zmult_zless_mono1_neg] |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
389 |
addEs [order_less_asym]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
390 |
qed "zmult_zless_cancel2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
391 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
392 |
Goal "k < int 0 ==> (k*m < k*n) = (n<m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
393 |
by (dtac zmult_zless_cancel2_neg 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
394 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
395 |
qed "zmult_zless_cancel1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
396 |
Addsimps [zmult_zless_cancel1_neg, zmult_zless_cancel2_neg]; |
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 "int 0 < k ==> (m*k <= n*k) = (m<=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
399 |
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
|
400 |
qed "zmult_zle_cancel2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
401 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
402 |
Goal "int 0 < k ==> (k*m <= k*n) = (m<=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
403 |
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
|
404 |
qed "zmult_zle_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
405 |
Addsimps [zmult_zle_cancel1, zmult_zle_cancel2]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
406 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
407 |
Goal "k < int 0 ==> (m*k <= n*k) = (n<=m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
408 |
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
|
409 |
qed "zmult_zle_cancel2_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
410 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
411 |
Goal "k < int 0 ==> (k*m <= k*n) = (n<=m)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
412 |
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
|
413 |
qed "zmult_zle_cancel1_neg"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
414 |
Addsimps [zmult_zle_cancel1_neg, zmult_zle_cancel2_neg]; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
415 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
416 |
Goal "k ~= int 0 ==> (m*k = n*k) = (m=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
417 |
by (cut_facts_tac [linorder_less_linear] 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
418 |
by Safe_tac; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
419 |
by (assume_tac 2); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
420 |
by (REPEAT |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
421 |
(force_tac (claset() addD2 ("mono_neg", zmult_zless_mono1_neg) |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
422 |
addD2 ("mono_pos", zmult_zless_mono1), |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
423 |
simpset() addsimps [linorder_neq_iff]) 1)); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
424 |
qed "zmult_cancel2"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
425 |
|
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
426 |
Goal "k ~= int 0 ==> (k*m = k*n) = (m=n)"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
427 |
by (dtac zmult_cancel2 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
428 |
by (asm_full_simp_tac (simpset() addsimps [zmult_commute]) 1); |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
429 |
qed "zmult_cancel1"; |
f795b63139ec
many new theorems concerning multiplication and (in)equations
paulson
parents:
6717
diff
changeset
|
430 |
Addsimps [zmult_cancel1, zmult_cancel2]; |