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