| author | paulson |
| Mon, 18 Dec 2000 12:21:54 +0100 | |
| changeset 10689 | 5c44de6aadf4 |
| parent 10648 | a8c647cfa31f |
| child 10712 | 351ba950d4d9 |
| permissions | -rw-r--r-- |
| 5588 | 1 |
(* Title : Real/RealDef.ML |
| 7219 | 2 |
ID : $Id$ |
| 5588 | 3 |
Author : Jacques D. Fleuriot |
4 |
Copyright : 1998 University of Cambridge |
|
5 |
Description : The reals |
|
6 |
*) |
|
7 |
||
8 |
(*** Proving that realrel is an equivalence relation ***) |
|
9 |
||
10 |
Goal "[| (x1::preal) + y2 = x2 + y1; x2 + y3 = x3 + y2 |] \ |
|
11 |
\ ==> x1 + y3 = x3 + y1"; |
|
12 |
by (res_inst_tac [("C","y2")] preal_add_right_cancel 1);
|
|
13 |
by (rotate_tac 1 1 THEN dtac sym 1); |
|
14 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
15 |
by (rtac (preal_add_left_commute RS subst) 1); |
|
16 |
by (res_inst_tac [("x1","x1")] (preal_add_assoc RS subst) 1);
|
|
17 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
18 |
qed "preal_trans_lemma"; |
|
19 |
||
20 |
(** Natural deduction for realrel **) |
|
21 |
||
22 |
Goalw [realrel_def] |
|
23 |
"(((x1,y1),(x2,y2)): realrel) = (x1 + y2 = x2 + y1)"; |
|
24 |
by (Blast_tac 1); |
|
25 |
qed "realrel_iff"; |
|
26 |
||
27 |
Goalw [realrel_def] |
|
28 |
"[| x1 + y2 = x2 + y1 |] ==> ((x1,y1),(x2,y2)): realrel"; |
|
29 |
by (Blast_tac 1); |
|
30 |
qed "realrelI"; |
|
31 |
||
32 |
Goalw [realrel_def] |
|
33 |
"p: realrel --> (EX x1 y1 x2 y2. \ |
|
34 |
\ p = ((x1,y1),(x2,y2)) & x1 + y2 = x2 + y1)"; |
|
35 |
by (Blast_tac 1); |
|
36 |
qed "realrelE_lemma"; |
|
37 |
||
| 9969 | 38 |
val [major,minor] = Goal |
| 5588 | 39 |
"[| p: realrel; \ |
40 |
\ !!x1 y1 x2 y2. [| p = ((x1,y1),(x2,y2)); x1+y2 = x2+y1 \ |
|
41 |
\ |] ==> Q |] ==> Q"; |
|
42 |
by (cut_facts_tac [major RS (realrelE_lemma RS mp)] 1); |
|
43 |
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); |
|
44 |
qed "realrelE"; |
|
45 |
||
46 |
AddSIs [realrelI]; |
|
47 |
AddSEs [realrelE]; |
|
48 |
||
49 |
Goal "(x,x): realrel"; |
|
| 9369 | 50 |
by (pair_tac "x" 1); |
51 |
by (rtac realrelI 1); |
|
52 |
by (rtac refl 1); |
|
| 5588 | 53 |
qed "realrel_refl"; |
54 |
||
| 9391 | 55 |
Goalw [equiv_def, refl_def, sym_def, trans_def] "equiv UNIV realrel"; |
| 5588 | 56 |
by (fast_tac (claset() addSIs [realrel_refl] |
| 9391 | 57 |
addSEs [sym, preal_trans_lemma]) 1); |
| 5588 | 58 |
qed "equiv_realrel"; |
59 |
||
| 9391 | 60 |
(* (realrel ^^ {x} = realrel ^^ {y}) = ((x,y) : realrel) *)
|
| 9108 | 61 |
bind_thm ("equiv_realrel_iff",
|
| 9391 | 62 |
[equiv_realrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff); |
| 5588 | 63 |
|
64 |
Goalw [real_def,realrel_def,quotient_def] "realrel^^{(x,y)}:real";
|
|
65 |
by (Blast_tac 1); |
|
66 |
qed "realrel_in_real"; |
|
67 |
||
68 |
Goal "inj_on Abs_real real"; |
|
69 |
by (rtac inj_on_inverseI 1); |
|
70 |
by (etac Abs_real_inverse 1); |
|
71 |
qed "inj_on_Abs_real"; |
|
72 |
||
73 |
Addsimps [equiv_realrel_iff,inj_on_Abs_real RS inj_on_iff, |
|
74 |
realrel_iff, realrel_in_real, Abs_real_inverse]; |
|
75 |
||
76 |
Addsimps [equiv_realrel RS eq_equiv_class_iff]; |
|
| 9108 | 77 |
bind_thm ("eq_realrelD", equiv_realrel RSN (2,eq_equiv_class));
|
| 5588 | 78 |
|
79 |
Goal "inj(Rep_real)"; |
|
80 |
by (rtac inj_inverseI 1); |
|
81 |
by (rtac Rep_real_inverse 1); |
|
82 |
qed "inj_Rep_real"; |
|
83 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
84 |
(** real_of_preal: the injection from preal to real **) |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
85 |
Goal "inj(real_of_preal)"; |
| 5588 | 86 |
by (rtac injI 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
87 |
by (rewtac real_of_preal_def); |
| 5588 | 88 |
by (dtac (inj_on_Abs_real RS inj_onD) 1); |
89 |
by (REPEAT (rtac realrel_in_real 1)); |
|
90 |
by (dtac eq_equiv_class 1); |
|
91 |
by (rtac equiv_realrel 1); |
|
92 |
by (Blast_tac 1); |
|
93 |
by Safe_tac; |
|
94 |
by (Asm_full_simp_tac 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
95 |
qed "inj_real_of_preal"; |
| 5588 | 96 |
|
| 9969 | 97 |
val [prem] = Goal |
| 5588 | 98 |
"(!!x y. z = Abs_real(realrel^^{(x,y)}) ==> P) ==> P";
|
99 |
by (res_inst_tac [("x1","z")]
|
|
100 |
(rewrite_rule [real_def] Rep_real RS quotientE) 1); |
|
101 |
by (dres_inst_tac [("f","Abs_real")] arg_cong 1);
|
|
102 |
by (res_inst_tac [("p","x")] PairE 1);
|
|
103 |
by (rtac prem 1); |
|
104 |
by (asm_full_simp_tac (simpset() addsimps [Rep_real_inverse]) 1); |
|
105 |
qed "eq_Abs_real"; |
|
106 |
||
107 |
(**** real_minus: additive inverse on real ****) |
|
108 |
||
109 |
Goalw [congruent_def] |
|
| 9369 | 110 |
"congruent realrel (%p. (%(x,y). realrel^^{(y,x)}) p)";
|
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
111 |
by (Clarify_tac 1); |
| 5588 | 112 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
113 |
qed "real_minus_congruent"; |
|
114 |
||
115 |
Goalw [real_minus_def] |
|
116 |
"- (Abs_real(realrel^^{(x,y)})) = Abs_real(realrel ^^ {(y,x)})";
|
|
117 |
by (res_inst_tac [("f","Abs_real")] arg_cong 1);
|
|
118 |
by (simp_tac (simpset() addsimps |
|
| 9391 | 119 |
[realrel_in_real RS Abs_real_inverse, |
120 |
[equiv_realrel, real_minus_congruent] MRS UN_equiv_class]) 1); |
|
| 5588 | 121 |
qed "real_minus"; |
122 |
||
123 |
Goal "- (- z) = (z::real)"; |
|
124 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
|
125 |
by (asm_simp_tac (simpset() addsimps [real_minus]) 1); |
|
126 |
qed "real_minus_minus"; |
|
127 |
||
128 |
Addsimps [real_minus_minus]; |
|
129 |
||
130 |
Goal "inj(%r::real. -r)"; |
|
131 |
by (rtac injI 1); |
|
132 |
by (dres_inst_tac [("f","uminus")] arg_cong 1);
|
|
133 |
by (asm_full_simp_tac (simpset() addsimps [real_minus_minus]) 1); |
|
134 |
qed "inj_real_minus"; |
|
135 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
136 |
Goalw [real_zero_def] "-0 = (0::real)"; |
| 5588 | 137 |
by (simp_tac (simpset() addsimps [real_minus]) 1); |
138 |
qed "real_minus_zero"; |
|
139 |
||
140 |
Addsimps [real_minus_zero]; |
|
141 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
142 |
Goal "(-x = 0) = (x = (0::real))"; |
| 5588 | 143 |
by (res_inst_tac [("z","x")] eq_Abs_real 1);
|
144 |
by (auto_tac (claset(), |
|
145 |
simpset() addsimps [real_zero_def, real_minus] @ preal_add_ac)); |
|
146 |
qed "real_minus_zero_iff"; |
|
147 |
||
148 |
Addsimps [real_minus_zero_iff]; |
|
149 |
||
150 |
(*** Congruence property for addition ***) |
|
151 |
Goalw [congruent2_def] |
|
152 |
"congruent2 realrel (%p1 p2. \ |
|
| 9369 | 153 |
\ (%(x1,y1). (%(x2,y2). realrel^^{(x1+x2, y1+y2)}) p2) p1)";
|
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
154 |
by (Clarify_tac 1); |
| 5588 | 155 |
by (asm_simp_tac (simpset() addsimps [preal_add_assoc]) 1); |
156 |
by (res_inst_tac [("z1.1","x1a")] (preal_add_left_commute RS ssubst) 1);
|
|
157 |
by (asm_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
158 |
by (asm_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
159 |
qed "real_add_congruent2"; |
|
160 |
||
161 |
Goalw [real_add_def] |
|
162 |
"Abs_real(realrel^^{(x1,y1)}) + Abs_real(realrel^^{(x2,y2)}) = \
|
|
163 |
\ Abs_real(realrel^^{(x1+x2, y1+y2)})";
|
|
| 9391 | 164 |
by (simp_tac (simpset() addsimps |
165 |
[[equiv_realrel, real_add_congruent2] MRS UN_equiv_class2]) 1); |
|
| 5588 | 166 |
qed "real_add"; |
167 |
||
168 |
Goal "(z::real) + w = w + z"; |
|
169 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
|
170 |
by (res_inst_tac [("z","w")] eq_Abs_real 1);
|
|
171 |
by (asm_simp_tac (simpset() addsimps preal_add_ac @ [real_add]) 1); |
|
172 |
qed "real_add_commute"; |
|
173 |
||
174 |
Goal "((z1::real) + z2) + z3 = z1 + (z2 + z3)"; |
|
175 |
by (res_inst_tac [("z","z1")] eq_Abs_real 1);
|
|
176 |
by (res_inst_tac [("z","z2")] eq_Abs_real 1);
|
|
177 |
by (res_inst_tac [("z","z3")] eq_Abs_real 1);
|
|
178 |
by (asm_simp_tac (simpset() addsimps [real_add, preal_add_assoc]) 1); |
|
179 |
qed "real_add_assoc"; |
|
180 |
||
181 |
(*For AC rewriting*) |
|
182 |
Goal "(x::real)+(y+z)=y+(x+z)"; |
|
183 |
by (rtac (real_add_commute RS trans) 1); |
|
184 |
by (rtac (real_add_assoc RS trans) 1); |
|
185 |
by (rtac (real_add_commute RS arg_cong) 1); |
|
186 |
qed "real_add_left_commute"; |
|
187 |
||
188 |
(* real addition is an AC operator *) |
|
| 7428 | 189 |
bind_thms ("real_add_ac", [real_add_assoc,real_add_commute,real_add_left_commute]);
|
| 5588 | 190 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
191 |
Goalw [real_of_preal_def,real_zero_def] "(0::real) + z = z"; |
| 5588 | 192 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
193 |
by (asm_full_simp_tac (simpset() addsimps [real_add] @ preal_add_ac) 1); |
|
194 |
qed "real_add_zero_left"; |
|
195 |
Addsimps [real_add_zero_left]; |
|
196 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
197 |
Goal "z + (0::real) = z"; |
| 5588 | 198 |
by (simp_tac (simpset() addsimps [real_add_commute]) 1); |
199 |
qed "real_add_zero_right"; |
|
200 |
Addsimps [real_add_zero_right]; |
|
201 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
202 |
Goalw [real_zero_def] "z + (-z) = (0::real)"; |
| 5588 | 203 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
204 |
by (asm_full_simp_tac (simpset() addsimps [real_minus, |
|
205 |
real_add, preal_add_commute]) 1); |
|
206 |
qed "real_add_minus"; |
|
207 |
Addsimps [real_add_minus]; |
|
208 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
209 |
Goal "(-z) + z = (0::real)"; |
| 5588 | 210 |
by (simp_tac (simpset() addsimps [real_add_commute]) 1); |
211 |
qed "real_add_minus_left"; |
|
212 |
Addsimps [real_add_minus_left]; |
|
213 |
||
214 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
215 |
Goal "z + ((- z) + w) = (w::real)"; |
| 5588 | 216 |
by (simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
217 |
qed "real_add_minus_cancel"; |
|
218 |
||
219 |
Goal "(-z) + (z + w) = (w::real)"; |
|
220 |
by (simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
221 |
qed "real_minus_add_cancel"; |
|
222 |
||
223 |
Addsimps [real_add_minus_cancel, real_minus_add_cancel]; |
|
224 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
225 |
Goal "EX y. (x::real) + y = 0"; |
| 5588 | 226 |
by (blast_tac (claset() addIs [real_add_minus]) 1); |
227 |
qed "real_minus_ex"; |
|
228 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
229 |
Goal "EX! y. (x::real) + y = 0"; |
| 5588 | 230 |
by (auto_tac (claset() addIs [real_add_minus],simpset())); |
231 |
by (dres_inst_tac [("f","%x. ya+x")] arg_cong 1);
|
|
232 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
233 |
by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); |
|
234 |
qed "real_minus_ex1"; |
|
235 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
236 |
Goal "EX! y. y + (x::real) = 0"; |
| 5588 | 237 |
by (auto_tac (claset() addIs [real_add_minus_left],simpset())); |
238 |
by (dres_inst_tac [("f","%x. x+ya")] arg_cong 1);
|
|
239 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc]) 1); |
|
240 |
by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); |
|
241 |
qed "real_minus_left_ex1"; |
|
242 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
243 |
Goal "x + y = (0::real) ==> x = -y"; |
| 5588 | 244 |
by (cut_inst_tac [("z","y")] real_add_minus_left 1);
|
245 |
by (res_inst_tac [("x1","y")] (real_minus_left_ex1 RS ex1E) 1);
|
|
246 |
by (Blast_tac 1); |
|
247 |
qed "real_add_minus_eq_minus"; |
|
248 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
249 |
Goal "EX (y::real). x = -y"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
250 |
by (cut_inst_tac [("x","x")] real_minus_ex 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
251 |
by (etac exE 1 THEN dtac real_add_minus_eq_minus 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
252 |
by (Fast_tac 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
253 |
qed "real_as_add_inverse_ex"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
254 |
|
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
255 |
Goal "-(x + y) = (-x) + (- y :: real)"; |
| 5588 | 256 |
by (res_inst_tac [("z","x")] eq_Abs_real 1);
|
257 |
by (res_inst_tac [("z","y")] eq_Abs_real 1);
|
|
258 |
by (auto_tac (claset(),simpset() addsimps [real_minus,real_add])); |
|
259 |
qed "real_minus_add_distrib"; |
|
260 |
||
261 |
Addsimps [real_minus_add_distrib]; |
|
262 |
||
263 |
Goal "((x::real) + y = x + z) = (y = z)"; |
|
264 |
by (Step_tac 1); |
|
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
265 |
by (dres_inst_tac [("f","%t. (-x) + t")] arg_cong 1);
|
| 5588 | 266 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
267 |
qed "real_add_left_cancel"; |
|
268 |
||
269 |
Goal "(y + (x::real)= z + x) = (y = z)"; |
|
270 |
by (simp_tac (simpset() addsimps [real_add_commute,real_add_left_cancel]) 1); |
|
271 |
qed "real_add_right_cancel"; |
|
272 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
273 |
Goal "((x::real) = y) = (0 = x + (- y))"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
274 |
by (Step_tac 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
275 |
by (res_inst_tac [("x1","-y")]
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
276 |
(real_add_right_cancel RS iffD1) 2); |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
277 |
by Auto_tac; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
278 |
qed "real_eq_minus_iff"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
279 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
280 |
Goal "((x::real) = y) = (x + (- y) = 0)"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
281 |
by (Step_tac 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
282 |
by (res_inst_tac [("x1","-y")]
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
283 |
(real_add_right_cancel RS iffD1) 2); |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
284 |
by Auto_tac; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
285 |
qed "real_eq_minus_iff2"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
286 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
287 |
Goal "(0::real) - x = -x"; |
| 5588 | 288 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
289 |
qed "real_diff_0"; |
|
290 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
291 |
Goal "x - (0::real) = x"; |
| 5588 | 292 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
293 |
qed "real_diff_0_right"; |
|
294 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
295 |
Goal "x - x = (0::real)"; |
| 5588 | 296 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
297 |
qed "real_diff_self"; |
|
298 |
||
299 |
Addsimps [real_diff_0, real_diff_0_right, real_diff_self]; |
|
300 |
||
301 |
||
302 |
(*** Congruence property for multiplication ***) |
|
303 |
||
304 |
Goal "!!(x1::preal). [| x1 + y2 = x2 + y1 |] ==> \ |
|
305 |
\ x * x1 + y * y1 + (x * y2 + x2 * y) = \ |
|
306 |
\ x * x2 + y * y2 + (x * y1 + x1 * y)"; |
|
307 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_left_commute, |
|
308 |
preal_add_assoc RS sym,preal_add_mult_distrib2 RS sym]) 1); |
|
309 |
by (rtac (preal_mult_commute RS subst) 1); |
|
310 |
by (res_inst_tac [("y1","x2")] (preal_mult_commute RS subst) 1);
|
|
311 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc, |
|
312 |
preal_add_mult_distrib2 RS sym]) 1); |
|
313 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
314 |
qed "real_mult_congruent2_lemma"; |
|
315 |
||
316 |
Goal |
|
317 |
"congruent2 realrel (%p1 p2. \ |
|
| 9369 | 318 |
\ (%(x1,y1). (%(x2,y2). realrel^^{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)";
|
| 5588 | 319 |
by (rtac (equiv_realrel RS congruent2_commuteI) 1); |
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
320 |
by (Clarify_tac 1); |
| 5588 | 321 |
by (rewtac split_def); |
322 |
by (asm_simp_tac (simpset() addsimps [preal_mult_commute,preal_add_commute]) 1); |
|
323 |
by (auto_tac (claset(),simpset() addsimps [real_mult_congruent2_lemma])); |
|
324 |
qed "real_mult_congruent2"; |
|
325 |
||
326 |
Goalw [real_mult_def] |
|
327 |
"Abs_real((realrel^^{(x1,y1)})) * Abs_real((realrel^^{(x2,y2)})) = \
|
|
328 |
\ Abs_real(realrel ^^ {(x1*x2+y1*y2,x1*y2+x2*y1)})";
|
|
| 9391 | 329 |
by (simp_tac (simpset() addsimps |
330 |
[[equiv_realrel, real_mult_congruent2] MRS UN_equiv_class2]) 1); |
|
| 5588 | 331 |
qed "real_mult"; |
332 |
||
333 |
Goal "(z::real) * w = w * z"; |
|
334 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
|
335 |
by (res_inst_tac [("z","w")] eq_Abs_real 1);
|
|
336 |
by (asm_simp_tac |
|
337 |
(simpset() addsimps [real_mult] @ preal_add_ac @ preal_mult_ac) 1); |
|
338 |
qed "real_mult_commute"; |
|
339 |
||
340 |
Goal "((z1::real) * z2) * z3 = z1 * (z2 * z3)"; |
|
341 |
by (res_inst_tac [("z","z1")] eq_Abs_real 1);
|
|
342 |
by (res_inst_tac [("z","z2")] eq_Abs_real 1);
|
|
343 |
by (res_inst_tac [("z","z3")] eq_Abs_real 1);
|
|
344 |
by (asm_simp_tac (simpset() addsimps [preal_add_mult_distrib2,real_mult] @ |
|
345 |
preal_add_ac @ preal_mult_ac) 1); |
|
346 |
qed "real_mult_assoc"; |
|
347 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
348 |
Goal "(z1::real) * (z2 * z3) = z2 * (z1 * z3)"; |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
349 |
by (rtac (real_mult_commute RS trans) 1); |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
350 |
by (rtac (real_mult_assoc RS trans) 1); |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
351 |
by (rtac (real_mult_commute RS arg_cong) 1); |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
352 |
qed "real_mult_left_commute"; |
| 5588 | 353 |
|
354 |
(* real multiplication is an AC operator *) |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
355 |
bind_thms ("real_mult_ac",
|
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
356 |
[real_mult_assoc, real_mult_commute, real_mult_left_commute]); |
| 5588 | 357 |
|
358 |
Goalw [real_one_def,pnat_one_def] "1r * z = z"; |
|
359 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
|
360 |
by (asm_full_simp_tac |
|
361 |
(simpset() addsimps [real_mult, |
|
362 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
363 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
364 |
qed "real_mult_1"; |
|
365 |
||
366 |
Addsimps [real_mult_1]; |
|
367 |
||
368 |
Goal "z * 1r = z"; |
|
369 |
by (simp_tac (simpset() addsimps [real_mult_commute]) 1); |
|
370 |
qed "real_mult_1_right"; |
|
371 |
||
372 |
Addsimps [real_mult_1_right]; |
|
373 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
374 |
Goalw [real_zero_def,pnat_one_def] "0 * z = (0::real)"; |
| 5588 | 375 |
by (res_inst_tac [("z","z")] eq_Abs_real 1);
|
376 |
by (asm_full_simp_tac (simpset() addsimps [real_mult, |
|
377 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
378 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
379 |
qed "real_mult_0"; |
|
380 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
381 |
Goal "z * 0 = (0::real)"; |
| 5588 | 382 |
by (simp_tac (simpset() addsimps [real_mult_commute, real_mult_0]) 1); |
383 |
qed "real_mult_0_right"; |
|
384 |
||
385 |
Addsimps [real_mult_0_right, real_mult_0]; |
|
386 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
387 |
Goal "-(x * y) = (-x) * (y::real)"; |
| 5588 | 388 |
by (res_inst_tac [("z","x")] eq_Abs_real 1);
|
389 |
by (res_inst_tac [("z","y")] eq_Abs_real 1);
|
|
390 |
by (auto_tac (claset(), |
|
391 |
simpset() addsimps [real_minus,real_mult] |
|
| 9391 | 392 |
@ preal_mult_ac @ preal_add_ac)); |
| 5588 | 393 |
qed "real_minus_mult_eq1"; |
394 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
395 |
Goal "-(x * y) = x * (- y :: real)"; |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
396 |
by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute, |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
397 |
real_minus_mult_eq1]) 1); |
| 5588 | 398 |
qed "real_minus_mult_eq2"; |
399 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
400 |
Addsimps [real_minus_mult_eq1 RS sym, real_minus_mult_eq2 RS sym]; |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
401 |
|
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
402 |
Goal "(- 1r) * z = -z"; |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
403 |
by (Simp_tac 1); |
| 5588 | 404 |
qed "real_mult_minus_1"; |
405 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
406 |
Goal "z * (- 1r) = -z"; |
| 5588 | 407 |
by (stac real_mult_commute 1); |
408 |
by (Simp_tac 1); |
|
409 |
qed "real_mult_minus_1_right"; |
|
410 |
||
411 |
Addsimps [real_mult_minus_1_right]; |
|
412 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
413 |
Goal "(-x) * (-y) = x * (y::real)"; |
| 5588 | 414 |
by (full_simp_tac (simpset() addsimps [real_minus_mult_eq2 RS sym, |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
415 |
real_minus_mult_eq1 RS sym]) 1); |
| 5588 | 416 |
qed "real_minus_mult_cancel"; |
417 |
||
418 |
Addsimps [real_minus_mult_cancel]; |
|
419 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
420 |
Goal "(-x) * y = x * (- y :: real)"; |
| 5588 | 421 |
by (full_simp_tac (simpset() addsimps [real_minus_mult_eq2 RS sym, |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
422 |
real_minus_mult_eq1 RS sym]) 1); |
| 5588 | 423 |
qed "real_minus_mult_commute"; |
424 |
||
425 |
(** Lemmas **) |
|
426 |
||
| 9266 | 427 |
Goal "(z::real) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
428 |
by (asm_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
429 |
qed "real_add_assoc_cong"; |
|
| 5588 | 430 |
|
| 9266 | 431 |
Goal "(z::real) + (v + w) = v + (z + w)"; |
432 |
by (REPEAT (ares_tac [real_add_commute RS real_add_assoc_cong] 1)); |
|
433 |
qed "real_add_assoc_swap"; |
|
| 5588 | 434 |
|
435 |
Goal "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"; |
|
436 |
by (res_inst_tac [("z","z1")] eq_Abs_real 1);
|
|
437 |
by (res_inst_tac [("z","z2")] eq_Abs_real 1);
|
|
438 |
by (res_inst_tac [("z","w")] eq_Abs_real 1);
|
|
439 |
by (asm_simp_tac |
|
440 |
(simpset() addsimps [preal_add_mult_distrib2, real_add, real_mult] @ |
|
441 |
preal_add_ac @ preal_mult_ac) 1); |
|
442 |
qed "real_add_mult_distrib"; |
|
443 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
444 |
val real_mult_commute'= inst "z" "w" real_mult_commute; |
| 5588 | 445 |
|
446 |
Goal "(w::real) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
447 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
448 |
real_add_mult_distrib]) 1); |
| 5588 | 449 |
qed "real_add_mult_distrib2"; |
450 |
||
| 8027 | 451 |
Goalw [real_diff_def] "((z1::real) - z2) * w = (z1 * w) - (z2 * w)"; |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
452 |
by (simp_tac (simpset() addsimps [real_add_mult_distrib]) 1); |
| 8027 | 453 |
qed "real_diff_mult_distrib"; |
454 |
||
455 |
Goal "(w::real) * (z1 - z2) = (w * z1) - (w * z2)"; |
|
456 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
|
457 |
real_diff_mult_distrib]) 1); |
|
458 |
qed "real_diff_mult_distrib2"; |
|
459 |
||
| 5588 | 460 |
(*** one and zero are distinct ***) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
461 |
Goalw [real_zero_def,real_one_def] "0 ~= 1r"; |
| 5588 | 462 |
by (auto_tac (claset(), |
463 |
simpset() addsimps [preal_self_less_add_left RS preal_not_refl2])); |
|
464 |
qed "real_zero_not_eq_one"; |
|
465 |
||
466 |
(*** existence of inverse ***) |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
467 |
(** lemma -- alternative definition of 0 **) |
|
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
468 |
Goalw [real_zero_def] "0 = Abs_real (realrel ^^ {(x, x)})";
|
| 5588 | 469 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
470 |
qed "real_zero_iff"; |
|
471 |
||
472 |
Goalw [real_zero_def,real_one_def] |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
473 |
"!!(x::real). x ~= 0 ==> EX y. x*y = 1r"; |
| 5588 | 474 |
by (res_inst_tac [("z","x")] eq_Abs_real 1);
|
475 |
by (cut_inst_tac [("r1.0","xa"),("r2.0","y")] preal_linear 1);
|
|
476 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
477 |
simpset() addsimps [real_zero_iff RS sym])); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
478 |
by (res_inst_tac [("x","Abs_real (realrel ^^ \
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
479 |
\ {(preal_of_prat(prat_of_pnat 1p),pinv(D)+\
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
480 |
\ preal_of_prat(prat_of_pnat 1p))})")] exI 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
481 |
by (res_inst_tac [("x","Abs_real (realrel ^^ \
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
482 |
\ {(pinv(D)+preal_of_prat(prat_of_pnat 1p),\
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
483 |
\ preal_of_prat(prat_of_pnat 1p))})")] exI 2); |
| 5588 | 484 |
by (auto_tac (claset(), |
485 |
simpset() addsimps [real_mult, |
|
486 |
pnat_one_def,preal_mult_1_right,preal_add_mult_distrib2, |
|
487 |
preal_add_mult_distrib,preal_mult_1,preal_mult_inv_right] |
|
488 |
@ preal_add_ac @ preal_mult_ac)); |
|
489 |
qed "real_mult_inv_right_ex"; |
|
490 |
||
| 10648 | 491 |
Goal "x ~= 0 ==> EX y. y*x = 1r"; |
492 |
by (dtac real_mult_inv_right_ex 1); |
|
493 |
by (auto_tac (claset(), simpset() addsimps [real_mult_commute])); |
|
| 5588 | 494 |
qed "real_mult_inv_left_ex"; |
495 |
||
| 10606 | 496 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x)*x = 1r"; |
| 7499 | 497 |
by (ftac real_mult_inv_left_ex 1); |
| 5588 | 498 |
by (Step_tac 1); |
| 9969 | 499 |
by (rtac someI2 1); |
| 5588 | 500 |
by Auto_tac; |
501 |
qed "real_mult_inv_left"; |
|
| 10648 | 502 |
Addsimps [real_mult_inv_left]; |
| 5588 | 503 |
|
| 10606 | 504 |
Goal "x ~= 0 ==> x*inverse(x) = 1r"; |
| 10648 | 505 |
by (stac real_mult_commute 1); |
506 |
by (auto_tac (claset(), simpset() addsimps [real_mult_inv_left])); |
|
| 5588 | 507 |
qed "real_mult_inv_right"; |
| 10648 | 508 |
Addsimps [real_mult_inv_right]; |
509 |
||
510 |
(** Inverse of zero! Useful to simplify certain equations **) |
|
511 |
||
512 |
Goalw [real_inverse_def] "inverse 0 = (0::real)"; |
|
513 |
by (rtac someI2 1); |
|
514 |
by (auto_tac (claset(), simpset() addsimps [real_zero_not_eq_one])); |
|
515 |
qed "INVERSE_ZERO"; |
|
516 |
||
517 |
Goal "a / (0::real) = 0"; |
|
518 |
by (simp_tac (simpset() addsimps [real_divide_def, INVERSE_ZERO]) 1); |
|
519 |
qed "DIVISION_BY_ZERO"; (*NOT for adding to default simpset*) |
|
520 |
||
521 |
fun real_div_undefined_case_tac s i = |
|
522 |
case_tac s i THEN |
|
523 |
asm_simp_tac (simpset() addsimps [DIVISION_BY_ZERO, INVERSE_ZERO]) i; |
|
524 |
||
| 5588 | 525 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
526 |
Goal "(c::real) ~= 0 ==> (c*a=c*b) = (a=b)"; |
| 5588 | 527 |
by Auto_tac; |
| 10606 | 528 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1);
|
| 10648 | 529 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
| 5588 | 530 |
qed "real_mult_left_cancel"; |
531 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
532 |
Goal "(c::real) ~= 0 ==> (a*c=b*c) = (a=b)"; |
| 5588 | 533 |
by (Step_tac 1); |
| 10606 | 534 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1);
|
| 10648 | 535 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
| 5588 | 536 |
qed "real_mult_right_cancel"; |
537 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
538 |
Goal "c*a ~= c*b ==> a ~= b"; |
|
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
539 |
by Auto_tac; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
540 |
qed "real_mult_left_cancel_ccontr"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
541 |
|
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
542 |
Goal "a*c ~= b*c ==> a ~= b"; |
|
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
543 |
by Auto_tac; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
544 |
qed "real_mult_right_cancel_ccontr"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
545 |
|
| 10606 | 546 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x::real) ~= 0"; |
| 7499 | 547 |
by (ftac real_mult_inv_left_ex 1); |
| 5588 | 548 |
by (etac exE 1); |
| 9969 | 549 |
by (rtac someI2 1); |
| 5588 | 550 |
by (auto_tac (claset(), |
| 10648 | 551 |
simpset() addsimps [real_mult_0, real_zero_not_eq_one])); |
| 10606 | 552 |
qed "real_inverse_not_zero"; |
| 5588 | 553 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
554 |
Goal "[| x ~= 0; y ~= 0 |] ==> x * y ~= (0::real)"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
555 |
by (Step_tac 1); |
| 10606 | 556 |
by (dres_inst_tac [("f","%z. inverse x*z")] arg_cong 1);
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
557 |
by (asm_full_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
558 |
qed "real_mult_not_zero"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
559 |
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
560 |
bind_thm ("real_mult_not_zeroE",real_mult_not_zero RS notE);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
561 |
|
| 10648 | 562 |
Goal "inverse(inverse (x::real)) = x"; |
563 |
by (real_div_undefined_case_tac "x=0" 1); |
|
| 10606 | 564 |
by (res_inst_tac [("c1","inverse x")] (real_mult_right_cancel RS iffD1) 1);
|
565 |
by (etac real_inverse_not_zero 1); |
|
566 |
by (auto_tac (claset() addDs [real_inverse_not_zero],simpset())); |
|
567 |
qed "real_inverse_inverse"; |
|
| 10648 | 568 |
Addsimps [real_inverse_inverse]; |
| 5588 | 569 |
|
| 10606 | 570 |
Goalw [real_inverse_def] "inverse(1r) = 1r"; |
| 5588 | 571 |
by (cut_facts_tac [real_zero_not_eq_one RS |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
572 |
not_sym RS real_mult_inv_left_ex] 1); |
| 5588 | 573 |
by (auto_tac (claset(), |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
574 |
simpset() addsimps [real_zero_not_eq_one RS not_sym])); |
| 10606 | 575 |
qed "real_inverse_1"; |
576 |
Addsimps [real_inverse_1]; |
|
| 5588 | 577 |
|
| 10648 | 578 |
Goal "inverse(-x) = -inverse(x::real)"; |
579 |
by (real_div_undefined_case_tac "x=0" 1); |
|
| 5588 | 580 |
by (res_inst_tac [("c1","-x")] (real_mult_right_cancel RS iffD1) 1);
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
581 |
by (stac real_mult_inv_left 2); |
| 5588 | 582 |
by Auto_tac; |
| 10606 | 583 |
qed "real_minus_inverse"; |
| 5588 | 584 |
|
| 10648 | 585 |
Goal "inverse(x*y) = inverse(x)*inverse(y::real)"; |
586 |
by (real_div_undefined_case_tac "x=0" 1); |
|
587 |
by (real_div_undefined_case_tac "y=0" 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
588 |
by (forw_inst_tac [("y","y")] real_mult_not_zero 1 THEN assume_tac 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
589 |
by (res_inst_tac [("c1","x")] (real_mult_left_cancel RS iffD1) 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
590 |
by (auto_tac (claset(),simpset() addsimps [real_mult_assoc RS sym])); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
591 |
by (res_inst_tac [("c1","y")] (real_mult_left_cancel RS iffD1) 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
592 |
by (auto_tac (claset(),simpset() addsimps [real_mult_left_commute])); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
593 |
by (asm_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1); |
| 10606 | 594 |
qed "real_inverse_distrib"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
595 |
|
| 10648 | 596 |
Goal "(x::real) * (y/z) = (x*y)/z"; |
597 |
by (simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 1); |
|
598 |
qed "real_times_divide1_eq"; |
|
599 |
||
600 |
Goal "(y/z) * (x::real) = (y*x)/z"; |
|
601 |
by (simp_tac (simpset() addsimps [real_divide_def]@real_mult_ac) 1); |
|
602 |
qed "real_times_divide2_eq"; |
|
603 |
||
604 |
Addsimps [real_times_divide1_eq, real_times_divide2_eq]; |
|
605 |
||
606 |
Goal "(x::real) / (y/z) = (x*z)/y"; |
|
607 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib]@ |
|
608 |
real_mult_ac) 1); |
|
609 |
qed "real_divide_divide1_eq"; |
|
610 |
||
611 |
Goal "((x::real) / y) / z = x/(y*z)"; |
|
612 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib, |
|
613 |
real_mult_assoc]) 1); |
|
614 |
qed "real_divide_divide2_eq"; |
|
615 |
||
616 |
Addsimps [real_divide_divide1_eq, real_divide_divide2_eq]; |
|
617 |
||
618 |
(** As with multiplication, pull minus signs OUT of the / operator **) |
|
619 |
||
620 |
Goal "(-x) / (y::real) = - (x/y)"; |
|
621 |
by (simp_tac (simpset() addsimps [real_divide_def]) 1); |
|
622 |
qed "real_minus_divide_eq"; |
|
623 |
Addsimps [real_minus_divide_eq]; |
|
624 |
||
625 |
Goal "(x / -(y::real)) = - (x/y)"; |
|
626 |
by (simp_tac (simpset() addsimps [real_divide_def, real_minus_inverse]) 1); |
|
627 |
qed "real_divide_minus_eq"; |
|
628 |
Addsimps [real_divide_minus_eq]; |
|
629 |
||
630 |
Goal "(x+y)/(z::real) = x/z + y/z"; |
|
631 |
by (simp_tac (simpset() addsimps [real_divide_def, real_add_mult_distrib]) 1); |
|
632 |
qed "real_add_divide_distrib"; |
|
633 |
||
634 |
(*The following would e.g. convert (x+y)/2 to x/2 + y/2. Sometimes that |
|
635 |
leads to cancellations in x or y, but is also prevents "multiplying out" |
|
636 |
the 2 in e.g. (x+y)/2 = 5. |
|
637 |
||
638 |
Addsimps [inst "z" "number_of ?w" real_add_divide_distrib]; |
|
639 |
**) |
|
640 |
||
641 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
642 |
(*--------------------------------------------------------- |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
643 |
Theorems for ordering |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
644 |
--------------------------------------------------------*) |
| 5588 | 645 |
(* prove introduction and elimination rules for real_less *) |
646 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
647 |
(* real_less is a strong order i.e. nonreflexive and transitive *) |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
648 |
|
| 5588 | 649 |
(*** lemmas ***) |
650 |
Goal "!!(x::preal). [| x = y; x1 = y1 |] ==> x + y1 = x1 + y"; |
|
651 |
by (asm_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
652 |
qed "preal_lemma_eq_rev_sum"; |
|
653 |
||
654 |
Goal "!!(b::preal). x + (b + y) = x1 + (b + y1) ==> x + y = x1 + y1"; |
|
655 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
656 |
qed "preal_add_left_commute_cancel"; |
|
657 |
||
658 |
Goal "!!(x::preal). [| x + y2a = x2a + y; \ |
|
659 |
\ x + y2b = x2b + y |] \ |
|
660 |
\ ==> x2a + y2b = x2b + y2a"; |
|
661 |
by (dtac preal_lemma_eq_rev_sum 1); |
|
662 |
by (assume_tac 1); |
|
663 |
by (thin_tac "x + y2b = x2b + y" 1); |
|
664 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
665 |
by (dtac preal_add_left_commute_cancel 1); |
|
666 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
667 |
qed "preal_lemma_for_not_refl"; |
|
668 |
||
669 |
Goal "~ (R::real) < R"; |
|
670 |
by (res_inst_tac [("z","R")] eq_Abs_real 1);
|
|
671 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
|
672 |
by (dtac preal_lemma_for_not_refl 1); |
|
673 |
by (assume_tac 1 THEN rotate_tac 2 1); |
|
674 |
by (auto_tac (claset(),simpset() addsimps [preal_less_not_refl])); |
|
675 |
qed "real_less_not_refl"; |
|
676 |
||
677 |
(*** y < y ==> P ***) |
|
678 |
bind_thm("real_less_irrefl", real_less_not_refl RS notE);
|
|
679 |
AddSEs [real_less_irrefl]; |
|
680 |
||
681 |
Goal "!!(x::real). x < y ==> x ~= y"; |
|
682 |
by (auto_tac (claset(),simpset() addsimps [real_less_not_refl])); |
|
683 |
qed "real_not_refl2"; |
|
684 |
||
685 |
(* lemma re-arranging and eliminating terms *) |
|
686 |
Goal "!! (a::preal). [| a + b = c + d; \ |
|
687 |
\ x2b + d + (c + y2e) < a + y2b + (x2e + b) |] \ |
|
688 |
\ ==> x2b + y2e < x2e + y2b"; |
|
689 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
690 |
by (res_inst_tac [("C","c+d")] preal_add_left_less_cancel 1);
|
|
691 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
692 |
qed "preal_lemma_trans"; |
|
693 |
||
694 |
(** heavy re-writing involved*) |
|
695 |
Goal "!!(R1::real). [| R1 < R2; R2 < R3 |] ==> R1 < R3"; |
|
696 |
by (res_inst_tac [("z","R1")] eq_Abs_real 1);
|
|
697 |
by (res_inst_tac [("z","R2")] eq_Abs_real 1);
|
|
698 |
by (res_inst_tac [("z","R3")] eq_Abs_real 1);
|
|
699 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
|
700 |
by (REPEAT(rtac exI 1)); |
|
701 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
702 |
by (REPEAT(Blast_tac 2)); |
|
703 |
by (dtac preal_lemma_for_not_refl 1 THEN assume_tac 1); |
|
704 |
by (blast_tac (claset() addDs [preal_add_less_mono] |
|
705 |
addIs [preal_lemma_trans]) 1); |
|
706 |
qed "real_less_trans"; |
|
707 |
||
| 9167 | 708 |
Goal "!! (R1::real). R1 < R2 ==> ~ (R2 < R1)"; |
709 |
by (rtac notI 1); |
|
| 5588 | 710 |
by (dtac real_less_trans 1 THEN assume_tac 1); |
711 |
by (asm_full_simp_tac (simpset() addsimps [real_less_not_refl]) 1); |
|
| 9167 | 712 |
qed "real_less_not_sym"; |
713 |
||
714 |
(* [| x < y; ~P ==> y < x |] ==> P *) |
|
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
715 |
bind_thm ("real_less_asym", real_less_not_sym RS contrapos_np);
|
| 5588 | 716 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
717 |
Goalw [real_of_preal_def] |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
718 |
"real_of_preal ((z1::preal) + z2) = \ |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
719 |
\ real_of_preal z1 + real_of_preal z2"; |
| 5588 | 720 |
by (asm_simp_tac (simpset() addsimps [real_add, |
721 |
preal_add_mult_distrib,preal_mult_1] addsimps preal_add_ac) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
722 |
qed "real_of_preal_add"; |
| 5588 | 723 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
724 |
Goalw [real_of_preal_def] |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
725 |
"real_of_preal ((z1::preal) * z2) = \ |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
726 |
\ real_of_preal z1* real_of_preal z2"; |
| 5588 | 727 |
by (full_simp_tac (simpset() addsimps [real_mult, |
728 |
preal_add_mult_distrib2,preal_mult_1, |
|
729 |
preal_mult_1_right,pnat_one_def] |
|
730 |
@ preal_add_ac @ preal_mult_ac) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
731 |
qed "real_of_preal_mult"; |
| 5588 | 732 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
733 |
Goalw [real_of_preal_def] |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
734 |
"!!(x::preal). y < x ==> \ |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
735 |
\ EX m. Abs_real (realrel ^^ {(x,y)}) = real_of_preal m";
|
| 5588 | 736 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
737 |
simpset() addsimps preal_add_ac)); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
738 |
qed "real_of_preal_ExI"; |
| 5588 | 739 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
740 |
Goalw [real_of_preal_def] |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
741 |
"!!(x::preal). EX m. Abs_real (realrel ^^ {(x,y)}) = \
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
742 |
\ real_of_preal m ==> y < x"; |
| 5588 | 743 |
by (auto_tac (claset(), |
744 |
simpset() addsimps |
|
745 |
[preal_add_commute,preal_add_assoc])); |
|
746 |
by (asm_full_simp_tac (simpset() addsimps |
|
747 |
[preal_add_assoc RS sym,preal_self_less_add_left]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
748 |
qed "real_of_preal_ExD"; |
| 5588 | 749 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
750 |
Goal "(EX m. Abs_real (realrel ^^ {(x,y)}) = real_of_preal m) = (y < x)";
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
751 |
by (blast_tac (claset() addSIs [real_of_preal_ExI,real_of_preal_ExD]) 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
752 |
qed "real_of_preal_iff"; |
| 5588 | 753 |
|
754 |
(*** Gleason prop 9-4.4 p 127 ***) |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
755 |
Goalw [real_of_preal_def,real_zero_def] |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
756 |
"EX m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)"; |
| 5588 | 757 |
by (res_inst_tac [("z","x")] eq_Abs_real 1);
|
758 |
by (auto_tac (claset(),simpset() addsimps [real_minus] @ preal_add_ac)); |
|
759 |
by (cut_inst_tac [("r1.0","x"),("r2.0","y")] preal_linear 1);
|
|
760 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
761 |
simpset() addsimps [preal_add_assoc RS sym])); |
|
762 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
763 |
qed "real_of_preal_trichotomy"; |
| 5588 | 764 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
765 |
Goal "!!P. [| !!m. x = real_of_preal m ==> P; \ |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
766 |
\ x = 0 ==> P; \ |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
767 |
\ !!m. x = -(real_of_preal m) ==> P |] ==> P"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
768 |
by (cut_inst_tac [("x","x")] real_of_preal_trichotomy 1);
|
| 5588 | 769 |
by Auto_tac; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
770 |
qed "real_of_preal_trichotomyE"; |
| 5588 | 771 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
772 |
Goalw [real_of_preal_def] |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
773 |
"real_of_preal m1 < real_of_preal m2 ==> m1 < m2"; |
| 5588 | 774 |
by (auto_tac (claset(),simpset() addsimps [real_less_def] @ preal_add_ac)); |
775 |
by (auto_tac (claset(),simpset() addsimps [preal_add_assoc RS sym])); |
|
776 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
777 |
qed "real_of_preal_lessD"; |
| 5588 | 778 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
779 |
Goal "m1 < m2 ==> real_of_preal m1 < real_of_preal m2"; |
| 5588 | 780 |
by (dtac preal_less_add_left_Ex 1); |
781 |
by (auto_tac (claset(), |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
782 |
simpset() addsimps [real_of_preal_add, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
783 |
real_of_preal_def,real_less_def])); |
| 5588 | 784 |
by (REPEAT(rtac exI 1)); |
785 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
786 |
by (REPEAT(Blast_tac 2)); |
|
787 |
by (simp_tac (simpset() addsimps [preal_self_less_add_left] |
|
788 |
delsimps [preal_add_less_iff2]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
789 |
qed "real_of_preal_lessI"; |
| 5588 | 790 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
791 |
Goal "(real_of_preal m1 < real_of_preal m2) = (m1 < m2)"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
792 |
by (blast_tac (claset() addIs [real_of_preal_lessI,real_of_preal_lessD]) 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
793 |
qed "real_of_preal_less_iff1"; |
| 5588 | 794 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
795 |
Addsimps [real_of_preal_less_iff1]; |
| 5588 | 796 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
797 |
Goal "- real_of_preal m < real_of_preal m"; |
| 5588 | 798 |
by (auto_tac (claset(), |
799 |
simpset() addsimps |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
800 |
[real_of_preal_def,real_less_def,real_minus])); |
| 5588 | 801 |
by (REPEAT(rtac exI 1)); |
802 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
803 |
by (REPEAT(Blast_tac 2)); |
|
804 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
805 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
806 |
preal_add_assoc RS sym]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
807 |
qed "real_of_preal_minus_less_self"; |
| 5588 | 808 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
809 |
Goalw [real_zero_def] "- real_of_preal m < 0"; |
| 5588 | 810 |
by (auto_tac (claset(), |
| 7292 | 811 |
simpset() addsimps [real_of_preal_def, |
812 |
real_less_def,real_minus])); |
|
| 5588 | 813 |
by (REPEAT(rtac exI 1)); |
814 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
815 |
by (REPEAT(Blast_tac 2)); |
|
816 |
by (full_simp_tac (simpset() addsimps |
|
817 |
[preal_self_less_add_right] @ preal_add_ac) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
818 |
qed "real_of_preal_minus_less_zero"; |
| 5588 | 819 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
820 |
Goal "~ 0 < - real_of_preal m"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
821 |
by (cut_facts_tac [real_of_preal_minus_less_zero] 1); |
| 5588 | 822 |
by (fast_tac (claset() addDs [real_less_trans] |
823 |
addEs [real_less_irrefl]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
824 |
qed "real_of_preal_not_minus_gt_zero"; |
| 5588 | 825 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
826 |
Goalw [real_zero_def] "0 < real_of_preal m"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
827 |
by (auto_tac (claset(),simpset() addsimps |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
828 |
[real_of_preal_def,real_less_def,real_minus])); |
| 5588 | 829 |
by (REPEAT(rtac exI 1)); |
830 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
831 |
by (REPEAT(Blast_tac 2)); |
|
832 |
by (full_simp_tac (simpset() addsimps |
|
833 |
[preal_self_less_add_right] @ preal_add_ac) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
834 |
qed "real_of_preal_zero_less"; |
| 5588 | 835 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
836 |
Goal "~ real_of_preal m < 0"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
837 |
by (cut_facts_tac [real_of_preal_zero_less] 1); |
| 5588 | 838 |
by (blast_tac (claset() addDs [real_less_trans] |
| 7292 | 839 |
addEs [real_less_irrefl]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
840 |
qed "real_of_preal_not_less_zero"; |
| 5588 | 841 |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
842 |
Goal "0 < - (- real_of_preal m)"; |
| 5588 | 843 |
by (simp_tac (simpset() addsimps |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
844 |
[real_of_preal_zero_less]) 1); |
| 5588 | 845 |
qed "real_minus_minus_zero_less"; |
846 |
||
847 |
(* another lemma *) |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
848 |
Goalw [real_zero_def] |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
849 |
"0 < real_of_preal m + real_of_preal m1"; |
| 5588 | 850 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
851 |
simpset() addsimps [real_of_preal_def, |
| 7292 | 852 |
real_less_def,real_add])); |
| 5588 | 853 |
by (REPEAT(rtac exI 1)); |
854 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
855 |
by (REPEAT(Blast_tac 2)); |
|
856 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
857 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
858 |
preal_add_assoc RS sym]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
859 |
qed "real_of_preal_sum_zero_less"; |
| 5588 | 860 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
861 |
Goal "- real_of_preal m < real_of_preal m1"; |
| 5588 | 862 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
863 |
simpset() addsimps [real_of_preal_def, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
864 |
real_less_def,real_minus])); |
| 5588 | 865 |
by (REPEAT(rtac exI 1)); |
866 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
867 |
by (REPEAT(Blast_tac 2)); |
|
868 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
869 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
870 |
preal_add_assoc RS sym]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
871 |
qed "real_of_preal_minus_less_all"; |
| 5588 | 872 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
873 |
Goal "~ real_of_preal m < - real_of_preal m1"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
874 |
by (cut_facts_tac [real_of_preal_minus_less_all] 1); |
| 5588 | 875 |
by (blast_tac (claset() addDs [real_less_trans] |
876 |
addEs [real_less_irrefl]) 1); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
877 |
qed "real_of_preal_not_minus_gt_all"; |
| 5588 | 878 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
879 |
Goal "- real_of_preal m1 < - real_of_preal m2 \ |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
880 |
\ ==> real_of_preal m2 < real_of_preal m1"; |
| 5588 | 881 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
882 |
simpset() addsimps [real_of_preal_def, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
883 |
real_less_def,real_minus])); |
| 5588 | 884 |
by (REPEAT(rtac exI 1)); |
885 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
886 |
by (REPEAT(Blast_tac 2)); |
|
887 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
888 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
889 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
890 |
qed "real_of_preal_minus_less_rev1"; |
| 5588 | 891 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
892 |
Goal "real_of_preal m1 < real_of_preal m2 \ |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
893 |
\ ==> - real_of_preal m2 < - real_of_preal m1"; |
| 5588 | 894 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
895 |
simpset() addsimps [real_of_preal_def, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
896 |
real_less_def,real_minus])); |
| 5588 | 897 |
by (REPEAT(rtac exI 1)); |
898 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
899 |
by (REPEAT(Blast_tac 2)); |
|
900 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
901 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
902 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
903 |
qed "real_of_preal_minus_less_rev2"; |
| 5588 | 904 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
905 |
Goal "(- real_of_preal m1 < - real_of_preal m2) = \ |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
906 |
\ (real_of_preal m2 < real_of_preal m1)"; |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
907 |
by (blast_tac (claset() addSIs [real_of_preal_minus_less_rev1, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
908 |
real_of_preal_minus_less_rev2]) 1); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
909 |
qed "real_of_preal_minus_less_rev_iff"; |
| 5588 | 910 |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
911 |
Addsimps [real_of_preal_minus_less_rev_iff]; |
| 5588 | 912 |
|
913 |
(*** linearity ***) |
|
914 |
Goal "(R1::real) < R2 | R1 = R2 | R2 < R1"; |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
915 |
by (res_inst_tac [("x","R1")] real_of_preal_trichotomyE 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
916 |
by (ALLGOALS(res_inst_tac [("x","R2")] real_of_preal_trichotomyE));
|
| 5588 | 917 |
by (auto_tac (claset() addSDs [preal_le_anti_sym], |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
918 |
simpset() addsimps [preal_less_le_iff,real_of_preal_minus_less_zero, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
919 |
real_of_preal_zero_less,real_of_preal_minus_less_all])); |
| 5588 | 920 |
qed "real_linear"; |
921 |
||
922 |
Goal "!!w::real. (w ~= z) = (w<z | z<w)"; |
|
923 |
by (cut_facts_tac [real_linear] 1); |
|
924 |
by (Blast_tac 1); |
|
925 |
qed "real_neq_iff"; |
|
926 |
||
927 |
Goal "!!(R1::real). [| R1 < R2 ==> P; R1 = R2 ==> P; \ |
|
928 |
\ R2 < R1 ==> P |] ==> P"; |
|
929 |
by (cut_inst_tac [("R1.0","R1"),("R2.0","R2")] real_linear 1);
|
|
930 |
by Auto_tac; |
|
931 |
qed "real_linear_less2"; |
|
932 |
||
933 |
(*** Properties of <= ***) |
|
934 |
||
935 |
Goalw [real_le_def] "~(w < z) ==> z <= (w::real)"; |
|
936 |
by (assume_tac 1); |
|
937 |
qed "real_leI"; |
|
938 |
||
939 |
Goalw [real_le_def] "z<=w ==> ~(w<(z::real))"; |
|
940 |
by (assume_tac 1); |
|
941 |
qed "real_leD"; |
|
942 |
||
| 7428 | 943 |
bind_thm ("real_leE", make_elim real_leD);
|
| 5588 | 944 |
|
945 |
Goal "(~(w < z)) = (z <= (w::real))"; |
|
946 |
by (blast_tac (claset() addSIs [real_leI,real_leD]) 1); |
|
947 |
qed "real_less_le_iff"; |
|
948 |
||
949 |
Goalw [real_le_def] "~ z <= w ==> w<(z::real)"; |
|
950 |
by (Blast_tac 1); |
|
951 |
qed "not_real_leE"; |
|
952 |
||
953 |
Goalw [real_le_def] "z < w ==> z <= (w::real)"; |
|
954 |
by (blast_tac (claset() addEs [real_less_asym]) 1); |
|
955 |
qed "real_less_imp_le"; |
|
956 |
||
957 |
Goalw [real_le_def] "!!(x::real). x <= y ==> x < y | x = y"; |
|
958 |
by (cut_facts_tac [real_linear] 1); |
|
959 |
by (blast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
960 |
qed "real_le_imp_less_or_eq"; |
|
961 |
||
962 |
Goalw [real_le_def] "z<w | z=w ==> z <=(w::real)"; |
|
963 |
by (cut_facts_tac [real_linear] 1); |
|
964 |
by (fast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
965 |
qed "real_less_or_eq_imp_le"; |
|
966 |
||
967 |
Goal "(x <= (y::real)) = (x < y | x=y)"; |
|
968 |
by (REPEAT(ares_tac [iffI, real_less_or_eq_imp_le, real_le_imp_less_or_eq] 1)); |
|
969 |
qed "real_le_less"; |
|
970 |
||
971 |
Goal "w <= (w::real)"; |
|
972 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
973 |
qed "real_le_refl"; |
|
974 |
||
975 |
AddIffs [real_le_refl]; |
|
976 |
||
977 |
(* Axiom 'linorder_linear' of class 'linorder': *) |
|
978 |
Goal "(z::real) <= w | w <= z"; |
|
979 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
980 |
by (cut_facts_tac [real_linear] 1); |
|
981 |
by (Blast_tac 1); |
|
982 |
qed "real_le_linear"; |
|
983 |
||
984 |
Goal "[| i <= j; j < k |] ==> i < (k::real)"; |
|
985 |
by (dtac real_le_imp_less_or_eq 1); |
|
986 |
by (blast_tac (claset() addIs [real_less_trans]) 1); |
|
987 |
qed "real_le_less_trans"; |
|
988 |
||
989 |
Goal "!! (i::real). [| i < j; j <= k |] ==> i < k"; |
|
990 |
by (dtac real_le_imp_less_or_eq 1); |
|
991 |
by (blast_tac (claset() addIs [real_less_trans]) 1); |
|
992 |
qed "real_less_le_trans"; |
|
993 |
||
994 |
Goal "[| i <= j; j <= k |] ==> i <= (k::real)"; |
|
995 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
996 |
rtac real_less_or_eq_imp_le, blast_tac (claset() addIs [real_less_trans])]); |
|
997 |
qed "real_le_trans"; |
|
998 |
||
999 |
Goal "[| z <= w; w <= z |] ==> z = (w::real)"; |
|
1000 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
1001 |
fast_tac (claset() addEs [real_less_irrefl,real_less_asym])]); |
|
1002 |
qed "real_le_anti_sym"; |
|
1003 |
||
1004 |
Goal "[| ~ y < x; y ~= x |] ==> x < (y::real)"; |
|
1005 |
by (rtac not_real_leE 1); |
|
1006 |
by (blast_tac (claset() addDs [real_le_imp_less_or_eq]) 1); |
|
1007 |
qed "not_less_not_eq_real_less"; |
|
1008 |
||
1009 |
(* Axiom 'order_less_le' of class 'order': *) |
|
1010 |
Goal "(w::real) < z = (w <= z & w ~= z)"; |
|
1011 |
by (simp_tac (simpset() addsimps [real_le_def, real_neq_iff]) 1); |
|
1012 |
by (blast_tac (claset() addSEs [real_less_asym]) 1); |
|
1013 |
qed "real_less_le"; |
|
1014 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1015 |
Goal "(0 < -R) = (R < (0::real))"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1016 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1);
|
| 5588 | 1017 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1018 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1019 |
real_of_preal_not_less_zero,real_of_preal_zero_less, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1020 |
real_of_preal_minus_less_zero])); |
| 5588 | 1021 |
qed "real_minus_zero_less_iff"; |
1022 |
||
1023 |
Addsimps [real_minus_zero_less_iff]; |
|
1024 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1025 |
Goal "(-R < 0) = ((0::real) < R)"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1026 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1);
|
| 5588 | 1027 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1028 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1029 |
real_of_preal_not_less_zero,real_of_preal_zero_less, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1030 |
real_of_preal_minus_less_zero])); |
| 5588 | 1031 |
qed "real_minus_zero_less_iff2"; |
1032 |
||
1033 |
(*Alternative definition for real_less*) |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1034 |
Goal "R < S ==> EX T::real. 0 < T & R + T = S"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1035 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1036 |
by (ALLGOALS(res_inst_tac [("x","S")] real_of_preal_trichotomyE));
|
| 5588 | 1037 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1038 |
simpset() addsimps [real_of_preal_not_minus_gt_all, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1039 |
real_of_preal_add, real_of_preal_not_less_zero, |
| 5588 | 1040 |
real_less_not_refl, |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1041 |
real_of_preal_not_minus_gt_zero])); |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1042 |
by (res_inst_tac [("x","real_of_preal D")] exI 1);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1043 |
by (res_inst_tac [("x","real_of_preal m+real_of_preal ma")] exI 2);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1044 |
by (res_inst_tac [("x","real_of_preal m")] exI 3);
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1045 |
by (res_inst_tac [("x","real_of_preal D")] exI 4);
|
| 5588 | 1046 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1047 |
simpset() addsimps [real_of_preal_zero_less, |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1048 |
real_of_preal_sum_zero_less,real_add_assoc])); |
| 5588 | 1049 |
qed "real_less_add_positive_left_Ex"; |
1050 |
||
1051 |
(** change naff name(s)! **) |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1052 |
Goal "(W < S) ==> (0 < S + (-W::real))"; |
| 5588 | 1053 |
by (dtac real_less_add_positive_left_Ex 1); |
1054 |
by (auto_tac (claset(), |
|
1055 |
simpset() addsimps [real_add_minus, |
|
1056 |
real_add_zero_right] @ real_add_ac)); |
|
1057 |
qed "real_less_sum_gt_zero"; |
|
1058 |
||
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
1059 |
Goal "!!S::real. T = S + W ==> S = T + (-W)"; |
| 5588 | 1060 |
by (asm_simp_tac (simpset() addsimps real_add_ac) 1); |
1061 |
qed "real_lemma_change_eq_subj"; |
|
1062 |
||
1063 |
(* FIXME: long! *) |
|
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1064 |
Goal "(0 < S + (-W::real)) ==> (W < S)"; |
| 5588 | 1065 |
by (rtac ccontr 1); |
1066 |
by (dtac (real_leI RS real_le_imp_less_or_eq) 1); |
|
1067 |
by (auto_tac (claset(), |
|
1068 |
simpset() addsimps [real_less_not_refl])); |
|
1069 |
by (EVERY1[dtac real_less_add_positive_left_Ex, etac exE, etac conjE]); |
|
1070 |
by (Asm_full_simp_tac 1); |
|
1071 |
by (dtac real_lemma_change_eq_subj 1); |
|
1072 |
by Auto_tac; |
|
1073 |
by (dtac real_less_sum_gt_zero 1); |
|
1074 |
by (asm_full_simp_tac (simpset() addsimps real_add_ac) 1); |
|
1075 |
by (EVERY1[rotate_tac 1, dtac (real_add_left_commute RS ssubst)]); |
|
1076 |
by (auto_tac (claset() addEs [real_less_asym], simpset())); |
|
1077 |
qed "real_sum_gt_zero_less"; |
|
1078 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1079 |
Goal "(0 < S + (-W::real)) = (W < S)"; |
| 5588 | 1080 |
by (blast_tac (claset() addIs [real_less_sum_gt_zero, |
1081 |
real_sum_gt_zero_less]) 1); |
|
1082 |
qed "real_less_sum_gt_0_iff"; |
|
1083 |
||
1084 |
||
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1085 |
Goalw [real_diff_def] "(x<y) = (x-y < (0::real))"; |
| 5588 | 1086 |
by (stac (real_minus_zero_less_iff RS sym) 1); |
1087 |
by (simp_tac (simpset() addsimps [real_add_commute, |
|
1088 |
real_less_sum_gt_0_iff]) 1); |
|
1089 |
qed "real_less_eq_diff"; |
|
1090 |
||
1091 |
||
1092 |
(*** Subtraction laws ***) |
|
1093 |
||
1094 |
Goal "x + (y - z) = (x + y) - (z::real)"; |
|
1095 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1096 |
qed "real_add_diff_eq"; |
|
1097 |
||
1098 |
Goal "(x - y) + z = (x + z) - (y::real)"; |
|
1099 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1100 |
qed "real_diff_add_eq"; |
|
1101 |
||
1102 |
Goal "(x - y) - z = x - (y + (z::real))"; |
|
1103 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1104 |
qed "real_diff_diff_eq"; |
|
1105 |
||
1106 |
Goal "x - (y - z) = (x + z) - (y::real)"; |
|
1107 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1108 |
qed "real_diff_diff_eq2"; |
|
1109 |
||
1110 |
Goal "(x-y < z) = (x < z + (y::real))"; |
|
1111 |
by (stac real_less_eq_diff 1); |
|
1112 |
by (res_inst_tac [("y1", "z")] (real_less_eq_diff RS ssubst) 1);
|
|
1113 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1114 |
qed "real_diff_less_eq"; |
|
1115 |
||
1116 |
Goal "(x < z-y) = (x + (y::real) < z)"; |
|
1117 |
by (stac real_less_eq_diff 1); |
|
1118 |
by (res_inst_tac [("y1", "z-y")] (real_less_eq_diff RS ssubst) 1);
|
|
1119 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1120 |
qed "real_less_diff_eq"; |
|
1121 |
||
1122 |
Goalw [real_le_def] "(x-y <= z) = (x <= z + (y::real))"; |
|
1123 |
by (simp_tac (simpset() addsimps [real_less_diff_eq]) 1); |
|
1124 |
qed "real_diff_le_eq"; |
|
1125 |
||
1126 |
Goalw [real_le_def] "(x <= z-y) = (x + (y::real) <= z)"; |
|
1127 |
by (simp_tac (simpset() addsimps [real_diff_less_eq]) 1); |
|
1128 |
qed "real_le_diff_eq"; |
|
1129 |
||
1130 |
Goalw [real_diff_def] "(x-y = z) = (x = z + (y::real))"; |
|
1131 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1132 |
qed "real_diff_eq_eq"; |
|
1133 |
||
1134 |
Goalw [real_diff_def] "(x = z-y) = (x + (y::real) = z)"; |
|
1135 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1136 |
qed "real_eq_diff_eq"; |
|
1137 |
||
1138 |
(*This list of rewrites simplifies (in)equalities by bringing subtractions |
|
1139 |
to the top and then moving negative terms to the other side. |
|
1140 |
Use with real_add_ac*) |
|
| 9108 | 1141 |
bind_thms ("real_compare_rls",
|
| 5588 | 1142 |
[symmetric real_diff_def, |
1143 |
real_add_diff_eq, real_diff_add_eq, real_diff_diff_eq, real_diff_diff_eq2, |
|
1144 |
real_diff_less_eq, real_less_diff_eq, real_diff_le_eq, real_le_diff_eq, |
|
| 9108 | 1145 |
real_diff_eq_eq, real_eq_diff_eq]); |
| 5588 | 1146 |
|
1147 |
||
1148 |
(** For the cancellation simproc. |
|
1149 |
The idea is to cancel like terms on opposite sides by subtraction **) |
|
1150 |
||
1151 |
Goal "(x::real) - y = x' - y' ==> (x<y) = (x'<y')"; |
|
1152 |
by (stac real_less_eq_diff 1); |
|
1153 |
by (res_inst_tac [("y1", "y")] (real_less_eq_diff RS ssubst) 1);
|
|
1154 |
by (Asm_simp_tac 1); |
|
1155 |
qed "real_less_eqI"; |
|
1156 |
||
1157 |
Goal "(x::real) - y = x' - y' ==> (y<=x) = (y'<=x')"; |
|
1158 |
by (dtac real_less_eqI 1); |
|
1159 |
by (asm_simp_tac (simpset() addsimps [real_le_def]) 1); |
|
1160 |
qed "real_le_eqI"; |
|
1161 |
||
1162 |
Goal "(x::real) - y = x' - y' ==> (x=y) = (x'=y')"; |
|
1163 |
by Safe_tac; |
|
1164 |
by (ALLGOALS |
|
1165 |
(asm_full_simp_tac |
|
1166 |
(simpset() addsimps [real_eq_diff_eq, real_diff_eq_eq]))); |
|
1167 |
qed "real_eq_eqI"; |