author | paulson |
Sat, 30 Dec 2000 22:13:18 +0100 | |
changeset 10752 | c4f1bf2acf4c |
parent 10712 | 351ba950d4d9 |
child 10797 | 028d22926a41 |
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 "(0::real) - x = -x"; |
5588 | 274 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
275 |
qed "real_diff_0"; |
|
276 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
277 |
Goal "x - (0::real) = x"; |
5588 | 278 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
279 |
qed "real_diff_0_right"; |
|
280 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
281 |
Goal "x - x = (0::real)"; |
5588 | 282 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
283 |
qed "real_diff_self"; |
|
284 |
||
285 |
Addsimps [real_diff_0, real_diff_0_right, real_diff_self]; |
|
286 |
||
287 |
||
288 |
(*** Congruence property for multiplication ***) |
|
289 |
||
290 |
Goal "!!(x1::preal). [| x1 + y2 = x2 + y1 |] ==> \ |
|
291 |
\ x * x1 + y * y1 + (x * y2 + x2 * y) = \ |
|
292 |
\ x * x2 + y * y2 + (x * y1 + x1 * y)"; |
|
293 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_left_commute, |
|
294 |
preal_add_assoc RS sym,preal_add_mult_distrib2 RS sym]) 1); |
|
295 |
by (rtac (preal_mult_commute RS subst) 1); |
|
296 |
by (res_inst_tac [("y1","x2")] (preal_mult_commute RS subst) 1); |
|
297 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc, |
|
298 |
preal_add_mult_distrib2 RS sym]) 1); |
|
299 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
300 |
qed "real_mult_congruent2_lemma"; |
|
301 |
||
302 |
Goal |
|
303 |
"congruent2 realrel (%p1 p2. \ |
|
9369 | 304 |
\ (%(x1,y1). (%(x2,y2). realrel^^{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)"; |
5588 | 305 |
by (rtac (equiv_realrel RS congruent2_commuteI) 1); |
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
306 |
by (Clarify_tac 1); |
5588 | 307 |
by (rewtac split_def); |
308 |
by (asm_simp_tac (simpset() addsimps [preal_mult_commute,preal_add_commute]) 1); |
|
309 |
by (auto_tac (claset(),simpset() addsimps [real_mult_congruent2_lemma])); |
|
310 |
qed "real_mult_congruent2"; |
|
311 |
||
312 |
Goalw [real_mult_def] |
|
313 |
"Abs_real((realrel^^{(x1,y1)})) * Abs_real((realrel^^{(x2,y2)})) = \ |
|
314 |
\ Abs_real(realrel ^^ {(x1*x2+y1*y2,x1*y2+x2*y1)})"; |
|
9391 | 315 |
by (simp_tac (simpset() addsimps |
316 |
[[equiv_realrel, real_mult_congruent2] MRS UN_equiv_class2]) 1); |
|
5588 | 317 |
qed "real_mult"; |
318 |
||
319 |
Goal "(z::real) * w = w * z"; |
|
320 |
by (res_inst_tac [("z","z")] eq_Abs_real 1); |
|
321 |
by (res_inst_tac [("z","w")] eq_Abs_real 1); |
|
322 |
by (asm_simp_tac |
|
323 |
(simpset() addsimps [real_mult] @ preal_add_ac @ preal_mult_ac) 1); |
|
324 |
qed "real_mult_commute"; |
|
325 |
||
326 |
Goal "((z1::real) * z2) * z3 = z1 * (z2 * z3)"; |
|
327 |
by (res_inst_tac [("z","z1")] eq_Abs_real 1); |
|
328 |
by (res_inst_tac [("z","z2")] eq_Abs_real 1); |
|
329 |
by (res_inst_tac [("z","z3")] eq_Abs_real 1); |
|
330 |
by (asm_simp_tac (simpset() addsimps [preal_add_mult_distrib2,real_mult] @ |
|
331 |
preal_add_ac @ preal_mult_ac) 1); |
|
332 |
qed "real_mult_assoc"; |
|
333 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
334 |
Goal "(z1::real) * (z2 * z3) = z2 * (z1 * z3)"; |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
335 |
by (rtac (real_mult_commute RS trans) 1); |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
336 |
by (rtac (real_mult_assoc RS trans) 1); |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
337 |
by (rtac (real_mult_commute RS arg_cong) 1); |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
338 |
qed "real_mult_left_commute"; |
5588 | 339 |
|
340 |
(* real multiplication is an AC operator *) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
341 |
bind_thms ("real_mult_ac", |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
342 |
[real_mult_assoc, real_mult_commute, real_mult_left_commute]); |
5588 | 343 |
|
344 |
Goalw [real_one_def,pnat_one_def] "1r * z = z"; |
|
345 |
by (res_inst_tac [("z","z")] eq_Abs_real 1); |
|
346 |
by (asm_full_simp_tac |
|
347 |
(simpset() addsimps [real_mult, |
|
348 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
349 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
350 |
qed "real_mult_1"; |
|
351 |
||
352 |
Addsimps [real_mult_1]; |
|
353 |
||
354 |
Goal "z * 1r = z"; |
|
355 |
by (simp_tac (simpset() addsimps [real_mult_commute]) 1); |
|
356 |
qed "real_mult_1_right"; |
|
357 |
||
358 |
Addsimps [real_mult_1_right]; |
|
359 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
360 |
Goalw [real_zero_def,pnat_one_def] "0 * z = (0::real)"; |
5588 | 361 |
by (res_inst_tac [("z","z")] eq_Abs_real 1); |
362 |
by (asm_full_simp_tac (simpset() addsimps [real_mult, |
|
363 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
364 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
365 |
qed "real_mult_0"; |
|
366 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
367 |
Goal "z * 0 = (0::real)"; |
5588 | 368 |
by (simp_tac (simpset() addsimps [real_mult_commute, real_mult_0]) 1); |
369 |
qed "real_mult_0_right"; |
|
370 |
||
371 |
Addsimps [real_mult_0_right, real_mult_0]; |
|
372 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
373 |
Goal "-(x * y) = (-x) * (y::real)"; |
5588 | 374 |
by (res_inst_tac [("z","x")] eq_Abs_real 1); |
375 |
by (res_inst_tac [("z","y")] eq_Abs_real 1); |
|
376 |
by (auto_tac (claset(), |
|
377 |
simpset() addsimps [real_minus,real_mult] |
|
9391 | 378 |
@ preal_mult_ac @ preal_add_ac)); |
5588 | 379 |
qed "real_minus_mult_eq1"; |
380 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
381 |
Goal "-(x * y) = x * (- y :: real)"; |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
382 |
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
|
383 |
real_minus_mult_eq1]) 1); |
5588 | 384 |
qed "real_minus_mult_eq2"; |
385 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
386 |
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
|
387 |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
388 |
Goal "(- 1r) * z = -z"; |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
389 |
by (Simp_tac 1); |
5588 | 390 |
qed "real_mult_minus_1"; |
391 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
392 |
Goal "z * (- 1r) = -z"; |
5588 | 393 |
by (stac real_mult_commute 1); |
394 |
by (Simp_tac 1); |
|
395 |
qed "real_mult_minus_1_right"; |
|
396 |
||
397 |
Addsimps [real_mult_minus_1_right]; |
|
398 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
399 |
Goal "(-x) * (-y) = x * (y::real)"; |
5588 | 400 |
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
|
401 |
real_minus_mult_eq1 RS sym]) 1); |
5588 | 402 |
qed "real_minus_mult_cancel"; |
403 |
||
404 |
Addsimps [real_minus_mult_cancel]; |
|
405 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
406 |
Goal "(-x) * y = x * (- y :: real)"; |
5588 | 407 |
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
|
408 |
real_minus_mult_eq1 RS sym]) 1); |
5588 | 409 |
qed "real_minus_mult_commute"; |
410 |
||
411 |
(** Lemmas **) |
|
412 |
||
9266 | 413 |
Goal "(z::real) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
414 |
by (asm_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
415 |
qed "real_add_assoc_cong"; |
|
5588 | 416 |
|
9266 | 417 |
Goal "(z::real) + (v + w) = v + (z + w)"; |
418 |
by (REPEAT (ares_tac [real_add_commute RS real_add_assoc_cong] 1)); |
|
419 |
qed "real_add_assoc_swap"; |
|
5588 | 420 |
|
421 |
Goal "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"; |
|
422 |
by (res_inst_tac [("z","z1")] eq_Abs_real 1); |
|
423 |
by (res_inst_tac [("z","z2")] eq_Abs_real 1); |
|
424 |
by (res_inst_tac [("z","w")] eq_Abs_real 1); |
|
425 |
by (asm_simp_tac |
|
426 |
(simpset() addsimps [preal_add_mult_distrib2, real_add, real_mult] @ |
|
427 |
preal_add_ac @ preal_mult_ac) 1); |
|
428 |
qed "real_add_mult_distrib"; |
|
429 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
430 |
val real_mult_commute'= inst "z" "w" real_mult_commute; |
5588 | 431 |
|
432 |
Goal "(w::real) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
433 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
434 |
real_add_mult_distrib]) 1); |
5588 | 435 |
qed "real_add_mult_distrib2"; |
436 |
||
8027 | 437 |
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
|
438 |
by (simp_tac (simpset() addsimps [real_add_mult_distrib]) 1); |
8027 | 439 |
qed "real_diff_mult_distrib"; |
440 |
||
441 |
Goal "(w::real) * (z1 - z2) = (w * z1) - (w * z2)"; |
|
442 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
|
443 |
real_diff_mult_distrib]) 1); |
|
444 |
qed "real_diff_mult_distrib2"; |
|
445 |
||
5588 | 446 |
(*** one and zero are distinct ***) |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
447 |
Goalw [real_zero_def,real_one_def] "0 ~= 1r"; |
5588 | 448 |
by (auto_tac (claset(), |
449 |
simpset() addsimps [preal_self_less_add_left RS preal_not_refl2])); |
|
450 |
qed "real_zero_not_eq_one"; |
|
451 |
||
452 |
(*** existence of inverse ***) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
453 |
(** lemma -- alternative definition of 0 **) |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
454 |
Goalw [real_zero_def] "0 = Abs_real (realrel ^^ {(x, x)})"; |
5588 | 455 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
456 |
qed "real_zero_iff"; |
|
457 |
||
458 |
Goalw [real_zero_def,real_one_def] |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
459 |
"!!(x::real). x ~= 0 ==> EX y. x*y = 1r"; |
5588 | 460 |
by (res_inst_tac [("z","x")] eq_Abs_real 1); |
461 |
by (cut_inst_tac [("r1.0","xa"),("r2.0","y")] preal_linear 1); |
|
462 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
463 |
simpset() addsimps [real_zero_iff RS sym])); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
464 |
by (res_inst_tac [("x","Abs_real (realrel ^^ \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
465 |
\ {(preal_of_prat(prat_of_pnat 1p),pinv(D)+\ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
466 |
\ preal_of_prat(prat_of_pnat 1p))})")] exI 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
467 |
by (res_inst_tac [("x","Abs_real (realrel ^^ \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
468 |
\ {(pinv(D)+preal_of_prat(prat_of_pnat 1p),\ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
469 |
\ preal_of_prat(prat_of_pnat 1p))})")] exI 2); |
5588 | 470 |
by (auto_tac (claset(), |
471 |
simpset() addsimps [real_mult, |
|
472 |
pnat_one_def,preal_mult_1_right,preal_add_mult_distrib2, |
|
473 |
preal_add_mult_distrib,preal_mult_1,preal_mult_inv_right] |
|
474 |
@ preal_add_ac @ preal_mult_ac)); |
|
475 |
qed "real_mult_inv_right_ex"; |
|
476 |
||
10648 | 477 |
Goal "x ~= 0 ==> EX y. y*x = 1r"; |
478 |
by (dtac real_mult_inv_right_ex 1); |
|
479 |
by (auto_tac (claset(), simpset() addsimps [real_mult_commute])); |
|
5588 | 480 |
qed "real_mult_inv_left_ex"; |
481 |
||
10606 | 482 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x)*x = 1r"; |
7499 | 483 |
by (ftac real_mult_inv_left_ex 1); |
5588 | 484 |
by (Step_tac 1); |
9969 | 485 |
by (rtac someI2 1); |
5588 | 486 |
by Auto_tac; |
487 |
qed "real_mult_inv_left"; |
|
10648 | 488 |
Addsimps [real_mult_inv_left]; |
5588 | 489 |
|
10606 | 490 |
Goal "x ~= 0 ==> x*inverse(x) = 1r"; |
10648 | 491 |
by (stac real_mult_commute 1); |
492 |
by (auto_tac (claset(), simpset() addsimps [real_mult_inv_left])); |
|
5588 | 493 |
qed "real_mult_inv_right"; |
10648 | 494 |
Addsimps [real_mult_inv_right]; |
495 |
||
496 |
(** Inverse of zero! Useful to simplify certain equations **) |
|
497 |
||
498 |
Goalw [real_inverse_def] "inverse 0 = (0::real)"; |
|
499 |
by (rtac someI2 1); |
|
500 |
by (auto_tac (claset(), simpset() addsimps [real_zero_not_eq_one])); |
|
501 |
qed "INVERSE_ZERO"; |
|
502 |
||
503 |
Goal "a / (0::real) = 0"; |
|
504 |
by (simp_tac (simpset() addsimps [real_divide_def, INVERSE_ZERO]) 1); |
|
505 |
qed "DIVISION_BY_ZERO"; (*NOT for adding to default simpset*) |
|
506 |
||
507 |
fun real_div_undefined_case_tac s i = |
|
508 |
case_tac s i THEN |
|
509 |
asm_simp_tac (simpset() addsimps [DIVISION_BY_ZERO, INVERSE_ZERO]) i; |
|
510 |
||
5588 | 511 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
512 |
Goal "(c::real) ~= 0 ==> (c*a=c*b) = (a=b)"; |
5588 | 513 |
by Auto_tac; |
10606 | 514 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
10648 | 515 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
5588 | 516 |
qed "real_mult_left_cancel"; |
517 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
518 |
Goal "(c::real) ~= 0 ==> (a*c=b*c) = (a=b)"; |
5588 | 519 |
by (Step_tac 1); |
10606 | 520 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
10648 | 521 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
5588 | 522 |
qed "real_mult_right_cancel"; |
523 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
524 |
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
|
525 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
526 |
qed "real_mult_left_cancel_ccontr"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
527 |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
528 |
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
|
529 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
530 |
qed "real_mult_right_cancel_ccontr"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
531 |
|
10606 | 532 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x::real) ~= 0"; |
7499 | 533 |
by (ftac real_mult_inv_left_ex 1); |
5588 | 534 |
by (etac exE 1); |
9969 | 535 |
by (rtac someI2 1); |
5588 | 536 |
by (auto_tac (claset(), |
10648 | 537 |
simpset() addsimps [real_mult_0, real_zero_not_eq_one])); |
10606 | 538 |
qed "real_inverse_not_zero"; |
5588 | 539 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
540 |
Goal "[| x ~= 0; y ~= 0 |] ==> x * y ~= (0::real)"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
541 |
by (Step_tac 1); |
10606 | 542 |
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
|
543 |
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
|
544 |
qed "real_mult_not_zero"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
545 |
|
10648 | 546 |
Goal "inverse(inverse (x::real)) = x"; |
547 |
by (real_div_undefined_case_tac "x=0" 1); |
|
10606 | 548 |
by (res_inst_tac [("c1","inverse x")] (real_mult_right_cancel RS iffD1) 1); |
549 |
by (etac real_inverse_not_zero 1); |
|
550 |
by (auto_tac (claset() addDs [real_inverse_not_zero],simpset())); |
|
551 |
qed "real_inverse_inverse"; |
|
10648 | 552 |
Addsimps [real_inverse_inverse]; |
5588 | 553 |
|
10606 | 554 |
Goalw [real_inverse_def] "inverse(1r) = 1r"; |
5588 | 555 |
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
|
556 |
not_sym RS real_mult_inv_left_ex] 1); |
5588 | 557 |
by (auto_tac (claset(), |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
558 |
simpset() addsimps [real_zero_not_eq_one RS not_sym])); |
10606 | 559 |
qed "real_inverse_1"; |
560 |
Addsimps [real_inverse_1]; |
|
5588 | 561 |
|
10648 | 562 |
Goal "inverse(-x) = -inverse(x::real)"; |
563 |
by (real_div_undefined_case_tac "x=0" 1); |
|
5588 | 564 |
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
|
565 |
by (stac real_mult_inv_left 2); |
5588 | 566 |
by Auto_tac; |
10606 | 567 |
qed "real_minus_inverse"; |
5588 | 568 |
|
10648 | 569 |
Goal "inverse(x*y) = inverse(x)*inverse(y::real)"; |
570 |
by (real_div_undefined_case_tac "x=0" 1); |
|
571 |
by (real_div_undefined_case_tac "y=0" 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
572 |
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
|
573 |
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
|
574 |
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
|
575 |
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
|
576 |
by (auto_tac (claset(),simpset() addsimps [real_mult_left_commute])); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
577 |
by (asm_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1); |
10606 | 578 |
qed "real_inverse_distrib"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
579 |
|
10648 | 580 |
Goal "(x::real) * (y/z) = (x*y)/z"; |
581 |
by (simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 1); |
|
582 |
qed "real_times_divide1_eq"; |
|
583 |
||
584 |
Goal "(y/z) * (x::real) = (y*x)/z"; |
|
585 |
by (simp_tac (simpset() addsimps [real_divide_def]@real_mult_ac) 1); |
|
586 |
qed "real_times_divide2_eq"; |
|
587 |
||
588 |
Addsimps [real_times_divide1_eq, real_times_divide2_eq]; |
|
589 |
||
590 |
Goal "(x::real) / (y/z) = (x*z)/y"; |
|
591 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib]@ |
|
592 |
real_mult_ac) 1); |
|
593 |
qed "real_divide_divide1_eq"; |
|
594 |
||
595 |
Goal "((x::real) / y) / z = x/(y*z)"; |
|
596 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib, |
|
597 |
real_mult_assoc]) 1); |
|
598 |
qed "real_divide_divide2_eq"; |
|
599 |
||
600 |
Addsimps [real_divide_divide1_eq, real_divide_divide2_eq]; |
|
601 |
||
602 |
(** As with multiplication, pull minus signs OUT of the / operator **) |
|
603 |
||
604 |
Goal "(-x) / (y::real) = - (x/y)"; |
|
605 |
by (simp_tac (simpset() addsimps [real_divide_def]) 1); |
|
606 |
qed "real_minus_divide_eq"; |
|
607 |
Addsimps [real_minus_divide_eq]; |
|
608 |
||
609 |
Goal "(x / -(y::real)) = - (x/y)"; |
|
610 |
by (simp_tac (simpset() addsimps [real_divide_def, real_minus_inverse]) 1); |
|
611 |
qed "real_divide_minus_eq"; |
|
612 |
Addsimps [real_divide_minus_eq]; |
|
613 |
||
614 |
Goal "(x+y)/(z::real) = x/z + y/z"; |
|
615 |
by (simp_tac (simpset() addsimps [real_divide_def, real_add_mult_distrib]) 1); |
|
616 |
qed "real_add_divide_distrib"; |
|
617 |
||
618 |
(*The following would e.g. convert (x+y)/2 to x/2 + y/2. Sometimes that |
|
619 |
leads to cancellations in x or y, but is also prevents "multiplying out" |
|
620 |
the 2 in e.g. (x+y)/2 = 5. |
|
621 |
||
622 |
Addsimps [inst "z" "number_of ?w" real_add_divide_distrib]; |
|
623 |
**) |
|
624 |
||
625 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
626 |
(*--------------------------------------------------------- |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
627 |
Theorems for ordering |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
628 |
--------------------------------------------------------*) |
5588 | 629 |
(* prove introduction and elimination rules for real_less *) |
630 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
631 |
(* 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
|
632 |
|
5588 | 633 |
(*** lemmas ***) |
634 |
Goal "!!(x::preal). [| x = y; x1 = y1 |] ==> x + y1 = x1 + y"; |
|
635 |
by (asm_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
636 |
qed "preal_lemma_eq_rev_sum"; |
|
637 |
||
638 |
Goal "!!(b::preal). x + (b + y) = x1 + (b + y1) ==> x + y = x1 + y1"; |
|
639 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
640 |
qed "preal_add_left_commute_cancel"; |
|
641 |
||
642 |
Goal "!!(x::preal). [| x + y2a = x2a + y; \ |
|
643 |
\ x + y2b = x2b + y |] \ |
|
644 |
\ ==> x2a + y2b = x2b + y2a"; |
|
645 |
by (dtac preal_lemma_eq_rev_sum 1); |
|
646 |
by (assume_tac 1); |
|
647 |
by (thin_tac "x + y2b = x2b + y" 1); |
|
648 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
649 |
by (dtac preal_add_left_commute_cancel 1); |
|
650 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
651 |
qed "preal_lemma_for_not_refl"; |
|
652 |
||
653 |
Goal "~ (R::real) < R"; |
|
654 |
by (res_inst_tac [("z","R")] eq_Abs_real 1); |
|
655 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
|
656 |
by (dtac preal_lemma_for_not_refl 1); |
|
10752
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
657 |
by (assume_tac 1); |
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
658 |
by Auto_tac; |
5588 | 659 |
qed "real_less_not_refl"; |
660 |
||
661 |
(*** y < y ==> P ***) |
|
662 |
bind_thm("real_less_irrefl", real_less_not_refl RS notE); |
|
663 |
AddSEs [real_less_irrefl]; |
|
664 |
||
665 |
Goal "!!(x::real). x < y ==> x ~= y"; |
|
666 |
by (auto_tac (claset(),simpset() addsimps [real_less_not_refl])); |
|
667 |
qed "real_not_refl2"; |
|
668 |
||
669 |
(* lemma re-arranging and eliminating terms *) |
|
670 |
Goal "!! (a::preal). [| a + b = c + d; \ |
|
671 |
\ x2b + d + (c + y2e) < a + y2b + (x2e + b) |] \ |
|
672 |
\ ==> x2b + y2e < x2e + y2b"; |
|
673 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
674 |
by (res_inst_tac [("C","c+d")] preal_add_left_less_cancel 1); |
|
675 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
676 |
qed "preal_lemma_trans"; |
|
677 |
||
678 |
(** heavy re-writing involved*) |
|
679 |
Goal "!!(R1::real). [| R1 < R2; R2 < R3 |] ==> R1 < R3"; |
|
680 |
by (res_inst_tac [("z","R1")] eq_Abs_real 1); |
|
681 |
by (res_inst_tac [("z","R2")] eq_Abs_real 1); |
|
682 |
by (res_inst_tac [("z","R3")] eq_Abs_real 1); |
|
683 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
|
684 |
by (REPEAT(rtac exI 1)); |
|
685 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
686 |
by (REPEAT(Blast_tac 2)); |
|
687 |
by (dtac preal_lemma_for_not_refl 1 THEN assume_tac 1); |
|
688 |
by (blast_tac (claset() addDs [preal_add_less_mono] |
|
689 |
addIs [preal_lemma_trans]) 1); |
|
690 |
qed "real_less_trans"; |
|
691 |
||
9167 | 692 |
Goal "!! (R1::real). R1 < R2 ==> ~ (R2 < R1)"; |
693 |
by (rtac notI 1); |
|
5588 | 694 |
by (dtac real_less_trans 1 THEN assume_tac 1); |
695 |
by (asm_full_simp_tac (simpset() addsimps [real_less_not_refl]) 1); |
|
9167 | 696 |
qed "real_less_not_sym"; |
697 |
||
698 |
(* [| x < y; ~P ==> y < x |] ==> P *) |
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
699 |
bind_thm ("real_less_asym", real_less_not_sym RS contrapos_np); |
5588 | 700 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
701 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
702 |
"real_of_preal ((z1::preal) + z2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
703 |
\ real_of_preal z1 + real_of_preal z2"; |
5588 | 704 |
by (asm_simp_tac (simpset() addsimps [real_add, |
705 |
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
|
706 |
qed "real_of_preal_add"; |
5588 | 707 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
708 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
709 |
"real_of_preal ((z1::preal) * z2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
710 |
\ real_of_preal z1* real_of_preal z2"; |
5588 | 711 |
by (full_simp_tac (simpset() addsimps [real_mult, |
712 |
preal_add_mult_distrib2,preal_mult_1, |
|
713 |
preal_mult_1_right,pnat_one_def] |
|
714 |
@ preal_add_ac @ preal_mult_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
715 |
qed "real_of_preal_mult"; |
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 |
"!!(x::preal). y < x ==> \ |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
719 |
\ EX m. Abs_real (realrel ^^ {(x,y)}) = real_of_preal m"; |
5588 | 720 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
721 |
simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
722 |
qed "real_of_preal_ExI"; |
5588 | 723 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
724 |
Goalw [real_of_preal_def] |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
725 |
"!!(x::preal). EX m. Abs_real (realrel ^^ {(x,y)}) = \ |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
726 |
\ real_of_preal m ==> y < x"; |
5588 | 727 |
by (auto_tac (claset(), |
728 |
simpset() addsimps |
|
729 |
[preal_add_commute,preal_add_assoc])); |
|
730 |
by (asm_full_simp_tac (simpset() addsimps |
|
731 |
[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
|
732 |
qed "real_of_preal_ExD"; |
5588 | 733 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
734 |
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
|
735 |
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
|
736 |
qed "real_of_preal_iff"; |
5588 | 737 |
|
738 |
(*** Gleason prop 9-4.4 p 127 ***) |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
739 |
Goalw [real_of_preal_def,real_zero_def] |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
740 |
"EX m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)"; |
5588 | 741 |
by (res_inst_tac [("z","x")] eq_Abs_real 1); |
742 |
by (auto_tac (claset(),simpset() addsimps [real_minus] @ preal_add_ac)); |
|
743 |
by (cut_inst_tac [("r1.0","x"),("r2.0","y")] preal_linear 1); |
|
744 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
745 |
simpset() addsimps [preal_add_assoc RS sym])); |
|
746 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
747 |
qed "real_of_preal_trichotomy"; |
5588 | 748 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
749 |
Goal "!!P. [| !!m. x = real_of_preal m ==> P; \ |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
750 |
\ x = 0 ==> P; \ |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
751 |
\ !!m. x = -(real_of_preal m) ==> P |] ==> P"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
752 |
by (cut_inst_tac [("x","x")] real_of_preal_trichotomy 1); |
5588 | 753 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
754 |
qed "real_of_preal_trichotomyE"; |
5588 | 755 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
756 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
757 |
"real_of_preal m1 < real_of_preal m2 ==> m1 < m2"; |
5588 | 758 |
by (auto_tac (claset(),simpset() addsimps [real_less_def] @ preal_add_ac)); |
759 |
by (auto_tac (claset(),simpset() addsimps [preal_add_assoc RS sym])); |
|
760 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
761 |
qed "real_of_preal_lessD"; |
5588 | 762 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
763 |
Goal "m1 < m2 ==> real_of_preal m1 < real_of_preal m2"; |
5588 | 764 |
by (dtac preal_less_add_left_Ex 1); |
765 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
766 |
simpset() addsimps [real_of_preal_add, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
767 |
real_of_preal_def,real_less_def])); |
5588 | 768 |
by (REPEAT(rtac exI 1)); |
769 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
770 |
by (REPEAT(Blast_tac 2)); |
|
771 |
by (simp_tac (simpset() addsimps [preal_self_less_add_left] |
|
772 |
delsimps [preal_add_less_iff2]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
773 |
qed "real_of_preal_lessI"; |
5588 | 774 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
775 |
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
|
776 |
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
|
777 |
qed "real_of_preal_less_iff1"; |
5588 | 778 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
779 |
Addsimps [real_of_preal_less_iff1]; |
5588 | 780 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
781 |
Goal "- real_of_preal m < real_of_preal m"; |
5588 | 782 |
by (auto_tac (claset(), |
783 |
simpset() addsimps |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
784 |
[real_of_preal_def,real_less_def,real_minus])); |
5588 | 785 |
by (REPEAT(rtac exI 1)); |
786 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
787 |
by (REPEAT(Blast_tac 2)); |
|
788 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
789 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
790 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
791 |
qed "real_of_preal_minus_less_self"; |
5588 | 792 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
793 |
Goalw [real_zero_def] "- real_of_preal m < 0"; |
5588 | 794 |
by (auto_tac (claset(), |
7292 | 795 |
simpset() addsimps [real_of_preal_def, |
796 |
real_less_def,real_minus])); |
|
5588 | 797 |
by (REPEAT(rtac exI 1)); |
798 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
799 |
by (REPEAT(Blast_tac 2)); |
|
800 |
by (full_simp_tac (simpset() addsimps |
|
801 |
[preal_self_less_add_right] @ preal_add_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
802 |
qed "real_of_preal_minus_less_zero"; |
5588 | 803 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
804 |
Goal "~ 0 < - real_of_preal m"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
805 |
by (cut_facts_tac [real_of_preal_minus_less_zero] 1); |
5588 | 806 |
by (fast_tac (claset() addDs [real_less_trans] |
807 |
addEs [real_less_irrefl]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
808 |
qed "real_of_preal_not_minus_gt_zero"; |
5588 | 809 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
810 |
Goalw [real_zero_def] "0 < real_of_preal m"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
811 |
by (auto_tac (claset(),simpset() addsimps |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
812 |
[real_of_preal_def,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_zero_less"; |
5588 | 819 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
820 |
Goal "~ real_of_preal m < 0"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
821 |
by (cut_facts_tac [real_of_preal_zero_less] 1); |
5588 | 822 |
by (blast_tac (claset() addDs [real_less_trans] |
7292 | 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_less_zero"; |
5588 | 825 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
826 |
Goal "0 < - (- real_of_preal m)"; |
5588 | 827 |
by (simp_tac (simpset() addsimps |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
828 |
[real_of_preal_zero_less]) 1); |
5588 | 829 |
qed "real_minus_minus_zero_less"; |
830 |
||
831 |
(* another lemma *) |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
832 |
Goalw [real_zero_def] |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
833 |
"0 < real_of_preal m + real_of_preal m1"; |
5588 | 834 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
835 |
simpset() addsimps [real_of_preal_def, |
7292 | 836 |
real_less_def,real_add])); |
5588 | 837 |
by (REPEAT(rtac exI 1)); |
838 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
839 |
by (REPEAT(Blast_tac 2)); |
|
840 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
841 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
842 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
843 |
qed "real_of_preal_sum_zero_less"; |
5588 | 844 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
845 |
Goal "- real_of_preal m < real_of_preal m1"; |
5588 | 846 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
847 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
848 |
real_less_def,real_minus])); |
5588 | 849 |
by (REPEAT(rtac exI 1)); |
850 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
851 |
by (REPEAT(Blast_tac 2)); |
|
852 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
853 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
854 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
855 |
qed "real_of_preal_minus_less_all"; |
5588 | 856 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
857 |
Goal "~ real_of_preal m < - real_of_preal m1"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
858 |
by (cut_facts_tac [real_of_preal_minus_less_all] 1); |
5588 | 859 |
by (blast_tac (claset() addDs [real_less_trans] |
860 |
addEs [real_less_irrefl]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
861 |
qed "real_of_preal_not_minus_gt_all"; |
5588 | 862 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
863 |
Goal "- real_of_preal m1 < - real_of_preal m2 \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
864 |
\ ==> real_of_preal m2 < real_of_preal m1"; |
5588 | 865 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
866 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
867 |
real_less_def,real_minus])); |
5588 | 868 |
by (REPEAT(rtac exI 1)); |
869 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
870 |
by (REPEAT(Blast_tac 2)); |
|
871 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
872 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
873 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
874 |
qed "real_of_preal_minus_less_rev1"; |
5588 | 875 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
876 |
Goal "real_of_preal m1 < real_of_preal m2 \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
877 |
\ ==> - real_of_preal m2 < - real_of_preal m1"; |
5588 | 878 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
879 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
880 |
real_less_def,real_minus])); |
5588 | 881 |
by (REPEAT(rtac exI 1)); |
882 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
883 |
by (REPEAT(Blast_tac 2)); |
|
884 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
885 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
886 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
887 |
qed "real_of_preal_minus_less_rev2"; |
5588 | 888 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
889 |
Goal "(- real_of_preal m1 < - real_of_preal m2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
890 |
\ (real_of_preal m2 < real_of_preal m1)"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
891 |
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
|
892 |
real_of_preal_minus_less_rev2]) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
893 |
qed "real_of_preal_minus_less_rev_iff"; |
5588 | 894 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
895 |
Addsimps [real_of_preal_minus_less_rev_iff]; |
5588 | 896 |
|
897 |
(*** linearity ***) |
|
898 |
Goal "(R1::real) < R2 | R1 = R2 | R2 < R1"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
899 |
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
|
900 |
by (ALLGOALS(res_inst_tac [("x","R2")] real_of_preal_trichotomyE)); |
5588 | 901 |
by (auto_tac (claset() addSDs [preal_le_anti_sym], |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
902 |
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
|
903 |
real_of_preal_zero_less,real_of_preal_minus_less_all])); |
5588 | 904 |
qed "real_linear"; |
905 |
||
906 |
Goal "!!w::real. (w ~= z) = (w<z | z<w)"; |
|
907 |
by (cut_facts_tac [real_linear] 1); |
|
908 |
by (Blast_tac 1); |
|
909 |
qed "real_neq_iff"; |
|
910 |
||
911 |
Goal "!!(R1::real). [| R1 < R2 ==> P; R1 = R2 ==> P; \ |
|
912 |
\ R2 < R1 ==> P |] ==> P"; |
|
913 |
by (cut_inst_tac [("R1.0","R1"),("R2.0","R2")] real_linear 1); |
|
914 |
by Auto_tac; |
|
915 |
qed "real_linear_less2"; |
|
916 |
||
917 |
(*** Properties of <= ***) |
|
918 |
||
919 |
Goalw [real_le_def] "~(w < z) ==> z <= (w::real)"; |
|
920 |
by (assume_tac 1); |
|
921 |
qed "real_leI"; |
|
922 |
||
923 |
Goalw [real_le_def] "z<=w ==> ~(w<(z::real))"; |
|
924 |
by (assume_tac 1); |
|
925 |
qed "real_leD"; |
|
926 |
||
7428 | 927 |
bind_thm ("real_leE", make_elim real_leD); |
5588 | 928 |
|
929 |
Goal "(~(w < z)) = (z <= (w::real))"; |
|
930 |
by (blast_tac (claset() addSIs [real_leI,real_leD]) 1); |
|
931 |
qed "real_less_le_iff"; |
|
932 |
||
933 |
Goalw [real_le_def] "~ z <= w ==> w<(z::real)"; |
|
934 |
by (Blast_tac 1); |
|
935 |
qed "not_real_leE"; |
|
936 |
||
937 |
Goalw [real_le_def] "!!(x::real). x <= y ==> x < y | x = y"; |
|
938 |
by (cut_facts_tac [real_linear] 1); |
|
939 |
by (blast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
940 |
qed "real_le_imp_less_or_eq"; |
|
941 |
||
942 |
Goalw [real_le_def] "z<w | z=w ==> z <=(w::real)"; |
|
943 |
by (cut_facts_tac [real_linear] 1); |
|
944 |
by (fast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
945 |
qed "real_less_or_eq_imp_le"; |
|
946 |
||
947 |
Goal "(x <= (y::real)) = (x < y | x=y)"; |
|
948 |
by (REPEAT(ares_tac [iffI, real_less_or_eq_imp_le, real_le_imp_less_or_eq] 1)); |
|
949 |
qed "real_le_less"; |
|
950 |
||
951 |
Goal "w <= (w::real)"; |
|
952 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
953 |
qed "real_le_refl"; |
|
954 |
||
955 |
(* Axiom 'linorder_linear' of class 'linorder': *) |
|
956 |
Goal "(z::real) <= w | w <= z"; |
|
957 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
958 |
by (cut_facts_tac [real_linear] 1); |
|
959 |
by (Blast_tac 1); |
|
960 |
qed "real_le_linear"; |
|
961 |
||
962 |
Goal "[| i <= j; j <= k |] ==> i <= (k::real)"; |
|
963 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
10752
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
964 |
rtac real_less_or_eq_imp_le, |
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
965 |
blast_tac (claset() addIs [real_less_trans])]); |
5588 | 966 |
qed "real_le_trans"; |
967 |
||
968 |
Goal "[| z <= w; w <= z |] ==> z = (w::real)"; |
|
969 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
970 |
fast_tac (claset() addEs [real_less_irrefl,real_less_asym])]); |
|
971 |
qed "real_le_anti_sym"; |
|
972 |
||
973 |
Goal "[| ~ y < x; y ~= x |] ==> x < (y::real)"; |
|
974 |
by (rtac not_real_leE 1); |
|
975 |
by (blast_tac (claset() addDs [real_le_imp_less_or_eq]) 1); |
|
976 |
qed "not_less_not_eq_real_less"; |
|
977 |
||
978 |
(* Axiom 'order_less_le' of class 'order': *) |
|
979 |
Goal "(w::real) < z = (w <= z & w ~= z)"; |
|
980 |
by (simp_tac (simpset() addsimps [real_le_def, real_neq_iff]) 1); |
|
981 |
by (blast_tac (claset() addSEs [real_less_asym]) 1); |
|
982 |
qed "real_less_le"; |
|
983 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
984 |
Goal "(0 < -R) = (R < (0::real))"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
985 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
5588 | 986 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
987 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
988 |
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
|
989 |
real_of_preal_minus_less_zero])); |
5588 | 990 |
qed "real_minus_zero_less_iff"; |
991 |
||
992 |
Addsimps [real_minus_zero_less_iff]; |
|
993 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
994 |
Goal "(-R < 0) = ((0::real) < R)"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
995 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
5588 | 996 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
997 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
998 |
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
|
999 |
real_of_preal_minus_less_zero])); |
5588 | 1000 |
qed "real_minus_zero_less_iff2"; |
1001 |
||
1002 |
(*Alternative definition for real_less*) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1003 |
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
|
1004 |
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
|
1005 |
by (ALLGOALS(res_inst_tac [("x","S")] real_of_preal_trichotomyE)); |
5588 | 1006 |
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
|
1007 |
simpset() addsimps [real_of_preal_not_minus_gt_all, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1008 |
real_of_preal_add, real_of_preal_not_less_zero, |
5588 | 1009 |
real_less_not_refl, |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1010 |
real_of_preal_not_minus_gt_zero])); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1011 |
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
|
1012 |
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
|
1013 |
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
|
1014 |
by (res_inst_tac [("x","real_of_preal D")] exI 4); |
5588 | 1015 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1016 |
simpset() addsimps [real_of_preal_zero_less, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1017 |
real_of_preal_sum_zero_less,real_add_assoc])); |
5588 | 1018 |
qed "real_less_add_positive_left_Ex"; |
1019 |
||
1020 |
(** change naff name(s)! **) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1021 |
Goal "(W < S) ==> (0 < S + (-W::real))"; |
5588 | 1022 |
by (dtac real_less_add_positive_left_Ex 1); |
1023 |
by (auto_tac (claset(), |
|
1024 |
simpset() addsimps [real_add_minus, |
|
1025 |
real_add_zero_right] @ real_add_ac)); |
|
1026 |
qed "real_less_sum_gt_zero"; |
|
1027 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
1028 |
Goal "!!S::real. T = S + W ==> S = T + (-W)"; |
5588 | 1029 |
by (asm_simp_tac (simpset() addsimps real_add_ac) 1); |
1030 |
qed "real_lemma_change_eq_subj"; |
|
1031 |
||
1032 |
(* FIXME: long! *) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1033 |
Goal "(0 < S + (-W::real)) ==> (W < S)"; |
5588 | 1034 |
by (rtac ccontr 1); |
1035 |
by (dtac (real_leI RS real_le_imp_less_or_eq) 1); |
|
1036 |
by (auto_tac (claset(), |
|
1037 |
simpset() addsimps [real_less_not_refl])); |
|
1038 |
by (EVERY1[dtac real_less_add_positive_left_Ex, etac exE, etac conjE]); |
|
1039 |
by (Asm_full_simp_tac 1); |
|
1040 |
by (dtac real_lemma_change_eq_subj 1); |
|
1041 |
by Auto_tac; |
|
1042 |
by (dtac real_less_sum_gt_zero 1); |
|
1043 |
by (asm_full_simp_tac (simpset() addsimps real_add_ac) 1); |
|
1044 |
by (EVERY1[rotate_tac 1, dtac (real_add_left_commute RS ssubst)]); |
|
1045 |
by (auto_tac (claset() addEs [real_less_asym], simpset())); |
|
1046 |
qed "real_sum_gt_zero_less"; |
|
1047 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1048 |
Goal "(0 < S + (-W::real)) = (W < S)"; |
5588 | 1049 |
by (blast_tac (claset() addIs [real_less_sum_gt_zero, |
1050 |
real_sum_gt_zero_less]) 1); |
|
1051 |
qed "real_less_sum_gt_0_iff"; |
|
1052 |
||
1053 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1054 |
Goalw [real_diff_def] "(x<y) = (x-y < (0::real))"; |
5588 | 1055 |
by (stac (real_minus_zero_less_iff RS sym) 1); |
1056 |
by (simp_tac (simpset() addsimps [real_add_commute, |
|
1057 |
real_less_sum_gt_0_iff]) 1); |
|
1058 |
qed "real_less_eq_diff"; |
|
1059 |
||
1060 |
||
1061 |
(*** Subtraction laws ***) |
|
1062 |
||
1063 |
Goal "x + (y - z) = (x + y) - (z::real)"; |
|
1064 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1065 |
qed "real_add_diff_eq"; |
|
1066 |
||
1067 |
Goal "(x - y) + z = (x + z) - (y::real)"; |
|
1068 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1069 |
qed "real_diff_add_eq"; |
|
1070 |
||
1071 |
Goal "(x - y) - z = x - (y + (z::real))"; |
|
1072 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1073 |
qed "real_diff_diff_eq"; |
|
1074 |
||
1075 |
Goal "x - (y - z) = (x + z) - (y::real)"; |
|
1076 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1077 |
qed "real_diff_diff_eq2"; |
|
1078 |
||
1079 |
Goal "(x-y < z) = (x < z + (y::real))"; |
|
1080 |
by (stac real_less_eq_diff 1); |
|
1081 |
by (res_inst_tac [("y1", "z")] (real_less_eq_diff RS ssubst) 1); |
|
1082 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1083 |
qed "real_diff_less_eq"; |
|
1084 |
||
1085 |
Goal "(x < z-y) = (x + (y::real) < z)"; |
|
1086 |
by (stac real_less_eq_diff 1); |
|
1087 |
by (res_inst_tac [("y1", "z-y")] (real_less_eq_diff RS ssubst) 1); |
|
1088 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1089 |
qed "real_less_diff_eq"; |
|
1090 |
||
1091 |
Goalw [real_le_def] "(x-y <= z) = (x <= z + (y::real))"; |
|
1092 |
by (simp_tac (simpset() addsimps [real_less_diff_eq]) 1); |
|
1093 |
qed "real_diff_le_eq"; |
|
1094 |
||
1095 |
Goalw [real_le_def] "(x <= z-y) = (x + (y::real) <= z)"; |
|
1096 |
by (simp_tac (simpset() addsimps [real_diff_less_eq]) 1); |
|
1097 |
qed "real_le_diff_eq"; |
|
1098 |
||
1099 |
Goalw [real_diff_def] "(x-y = z) = (x = z + (y::real))"; |
|
1100 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1101 |
qed "real_diff_eq_eq"; |
|
1102 |
||
1103 |
Goalw [real_diff_def] "(x = z-y) = (x + (y::real) = z)"; |
|
1104 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1105 |
qed "real_eq_diff_eq"; |
|
1106 |
||
1107 |
(*This list of rewrites simplifies (in)equalities by bringing subtractions |
|
1108 |
to the top and then moving negative terms to the other side. |
|
1109 |
Use with real_add_ac*) |
|
9108 | 1110 |
bind_thms ("real_compare_rls", |
5588 | 1111 |
[symmetric real_diff_def, |
1112 |
real_add_diff_eq, real_diff_add_eq, real_diff_diff_eq, real_diff_diff_eq2, |
|
1113 |
real_diff_less_eq, real_less_diff_eq, real_diff_le_eq, real_le_diff_eq, |
|
9108 | 1114 |
real_diff_eq_eq, real_eq_diff_eq]); |
5588 | 1115 |
|
1116 |
||
1117 |
(** For the cancellation simproc. |
|
1118 |
The idea is to cancel like terms on opposite sides by subtraction **) |
|
1119 |
||
1120 |
Goal "(x::real) - y = x' - y' ==> (x<y) = (x'<y')"; |
|
1121 |
by (stac real_less_eq_diff 1); |
|
1122 |
by (res_inst_tac [("y1", "y")] (real_less_eq_diff RS ssubst) 1); |
|
1123 |
by (Asm_simp_tac 1); |
|
1124 |
qed "real_less_eqI"; |
|
1125 |
||
1126 |
Goal "(x::real) - y = x' - y' ==> (y<=x) = (y'<=x')"; |
|
1127 |
by (dtac real_less_eqI 1); |
|
1128 |
by (asm_simp_tac (simpset() addsimps [real_le_def]) 1); |
|
1129 |
qed "real_le_eqI"; |
|
1130 |
||
1131 |
Goal "(x::real) - y = x' - y' ==> (x=y) = (x'=y')"; |
|
1132 |
by Safe_tac; |
|
1133 |
by (ALLGOALS |
|
1134 |
(asm_full_simp_tac |
|
1135 |
(simpset() addsimps [real_eq_diff_eq, real_diff_eq_eq]))); |
|
1136 |
qed "real_eq_eqI"; |