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