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