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