author | wenzelm |
Wed, 05 Dec 2001 03:13:57 +0100 | |
changeset 12378 | 86c58273f8c0 |
parent 12018 | ec054019c910 |
child 12486 | 0ed8bdd883e0 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : NSA.ML |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : Infinite numbers, Infinitesimals, |
|
5 |
infinitely close relation etc. |
|
6 |
*) |
|
7 |
||
8 |
fun CLAIM_SIMP str thms = |
|
9 |
prove_goal (the_context()) str |
|
10 |
(fn prems => [cut_facts_tac prems 1, |
|
11 |
auto_tac (claset(),simpset() addsimps thms)]); |
|
12 |
fun CLAIM str = CLAIM_SIMP str []; |
|
13 |
||
14 |
(*-------------------------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
15 |
Closure laws for members of (embedded) set standard real Reals |
10751 | 16 |
--------------------------------------------------------------------*) |
17 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
18 |
Goalw [SReal_def] "[| (x::hypreal): Reals; y: Reals |] ==> x + y: Reals"; |
10751 | 19 |
by (Step_tac 1); |
20 |
by (res_inst_tac [("x","r + ra")] exI 1); |
|
21 |
by (Simp_tac 1); |
|
22 |
qed "SReal_add"; |
|
23 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
24 |
Goalw [SReal_def] "[| (x::hypreal): Reals; y: Reals |] ==> x * y: Reals"; |
10751 | 25 |
by (Step_tac 1); |
26 |
by (res_inst_tac [("x","r * ra")] exI 1); |
|
27 |
by (simp_tac (simpset() addsimps [hypreal_of_real_mult]) 1); |
|
28 |
qed "SReal_mult"; |
|
29 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
30 |
Goalw [SReal_def] "(x::hypreal): Reals ==> inverse x : Reals"; |
10751 | 31 |
by (blast_tac (claset() addIs [hypreal_of_real_inverse RS sym]) 1); |
32 |
qed "SReal_inverse"; |
|
33 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
34 |
Goal "[| (x::hypreal): Reals; y: Reals |] ==> x/y: Reals"; |
10751 | 35 |
by (asm_simp_tac (simpset() addsimps [SReal_mult,SReal_inverse, |
36 |
hypreal_divide_def]) 1); |
|
37 |
qed "SReal_divide"; |
|
38 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
39 |
Goalw [SReal_def] "(x::hypreal): Reals ==> -x : Reals"; |
10751 | 40 |
by (blast_tac (claset() addIs [hypreal_of_real_minus RS sym]) 1); |
41 |
qed "SReal_minus"; |
|
42 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
43 |
Goal "(-x : Reals) = ((x::hypreal): Reals)"; |
10751 | 44 |
by Auto_tac; |
45 |
by (etac SReal_minus 2); |
|
46 |
by (dtac SReal_minus 1); |
|
47 |
by Auto_tac; |
|
48 |
qed "SReal_minus_iff"; |
|
49 |
Addsimps [SReal_minus_iff]; |
|
50 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
51 |
Goal "[| (x::hypreal) + y : Reals; y: Reals |] ==> x: Reals"; |
10751 | 52 |
by (dres_inst_tac [("x","y")] SReal_minus 1); |
53 |
by (dtac SReal_add 1); |
|
54 |
by (assume_tac 1); |
|
55 |
by Auto_tac; |
|
56 |
qed "SReal_add_cancel"; |
|
57 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
58 |
Goalw [SReal_def] "(x::hypreal): Reals ==> abs x : Reals"; |
10751 | 59 |
by (auto_tac (claset(), simpset() addsimps [hypreal_of_real_hrabs])); |
60 |
qed "SReal_hrabs"; |
|
61 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
62 |
Goalw [SReal_def] "hypreal_of_real x: Reals"; |
10751 | 63 |
by (Blast_tac 1); |
64 |
qed "SReal_hypreal_of_real"; |
|
65 |
Addsimps [SReal_hypreal_of_real]; |
|
66 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
67 |
Goalw [hypreal_number_of_def] "(number_of w ::hypreal) : Reals"; |
10751 | 68 |
by (rtac SReal_hypreal_of_real 1); |
69 |
qed "SReal_number_of"; |
|
70 |
Addsimps [SReal_number_of]; |
|
71 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
72 |
(** As always with numerals, 0 and 1 are special cases **) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
73 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
74 |
Goal "(0::hypreal) : Reals"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
75 |
by (stac (hypreal_numeral_0_eq_0 RS sym) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
76 |
by (rtac SReal_number_of 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
77 |
qed "Reals_0"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
78 |
Addsimps [Reals_0]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
79 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
80 |
Goal "(1::hypreal) : Reals"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
81 |
by (stac (hypreal_numeral_1_eq_1 RS sym) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
82 |
by (rtac SReal_number_of 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
83 |
qed "Reals_1"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
84 |
Addsimps [Reals_1]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
85 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
86 |
Goalw [hypreal_divide_def] "r : Reals ==> r/(number_of w::hypreal) : Reals"; |
10751 | 87 |
by (blast_tac (claset() addSIs [SReal_number_of, SReal_mult, |
88 |
SReal_inverse]) 1); |
|
89 |
qed "SReal_divide_number_of"; |
|
90 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
91 |
(* Infinitesimal epsilon not in Reals *) |
10751 | 92 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
93 |
Goalw [SReal_def] "epsilon ~: Reals"; |
10751 | 94 |
by (auto_tac (claset(), |
95 |
simpset() addsimps [hypreal_of_real_not_eq_epsilon RS not_sym])); |
|
96 |
qed "SReal_epsilon_not_mem"; |
|
97 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
98 |
Goalw [SReal_def] "omega ~: Reals"; |
10751 | 99 |
by (auto_tac (claset(), |
100 |
simpset() addsimps [hypreal_of_real_not_eq_omega RS not_sym])); |
|
101 |
qed "SReal_omega_not_mem"; |
|
102 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
103 |
Goalw [SReal_def] "{x. hypreal_of_real x : Reals} = (UNIV::real set)"; |
10751 | 104 |
by Auto_tac; |
105 |
qed "SReal_UNIV_real"; |
|
106 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
107 |
Goalw [SReal_def] "(x: Reals) = (EX y. x = hypreal_of_real y)"; |
10751 | 108 |
by Auto_tac; |
109 |
qed "SReal_iff"; |
|
110 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
111 |
Goalw [SReal_def] "hypreal_of_real `(UNIV::real set) = Reals"; |
10751 | 112 |
by Auto_tac; |
113 |
qed "hypreal_of_real_image"; |
|
114 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
115 |
Goalw [SReal_def] "inv hypreal_of_real `Reals = (UNIV::real set)"; |
10751 | 116 |
by Auto_tac; |
117 |
by (rtac (inj_hypreal_of_real RS inv_f_f RS subst) 1); |
|
118 |
by (Blast_tac 1); |
|
119 |
qed "inv_hypreal_of_real_image"; |
|
120 |
||
121 |
Goalw [SReal_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
122 |
"[| EX x. x: P; P <= Reals |] ==> EX Q. P = hypreal_of_real ` Q"; |
10751 | 123 |
by (Best_tac 1); |
124 |
qed "SReal_hypreal_of_real_image"; |
|
125 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
126 |
Goal "[| (x::hypreal): Reals; y: Reals; x<y |] ==> EX r: Reals. x<r & r<y"; |
10751 | 127 |
by (auto_tac (claset(), simpset() addsimps [SReal_iff])); |
128 |
by (dtac real_dense 1 THEN Step_tac 1); |
|
129 |
by (res_inst_tac [("x","hypreal_of_real r")] bexI 1); |
|
130 |
by Auto_tac; |
|
131 |
qed "SReal_dense"; |
|
132 |
||
133 |
(*------------------------------------------------------------------ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
134 |
Completeness of Reals |
10751 | 135 |
------------------------------------------------------------------*) |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
136 |
Goal "P <= Reals ==> ((EX x:P. y < x) = \ |
10751 | 137 |
\ (EX X. hypreal_of_real X : P & y < hypreal_of_real X))"; |
138 |
by (blast_tac (claset() addSDs [SReal_iff RS iffD1]) 1); |
|
139 |
by (flexflex_tac ); |
|
140 |
qed "SReal_sup_lemma"; |
|
141 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
142 |
Goal "[| P <= Reals; EX x. x: P; EX y : Reals. ALL x: P. x < y |] \ |
10751 | 143 |
\ ==> (EX X. X: {w. hypreal_of_real w : P}) & \ |
144 |
\ (EX Y. ALL X: {w. hypreal_of_real w : P}. X < Y)"; |
|
145 |
by (rtac conjI 1); |
|
146 |
by (fast_tac (claset() addSDs [SReal_iff RS iffD1]) 1); |
|
147 |
by (Auto_tac THEN forward_tac [subsetD] 1 THEN assume_tac 1); |
|
148 |
by (dtac (SReal_iff RS iffD1) 1); |
|
149 |
by (Auto_tac THEN res_inst_tac [("x","ya")] exI 1); |
|
150 |
by Auto_tac; |
|
151 |
qed "SReal_sup_lemma2"; |
|
152 |
||
153 |
(*------------------------------------------------------ |
|
154 |
lifting of ub and property of lub |
|
155 |
-------------------------------------------------------*) |
|
156 |
Goalw [isUb_def,setle_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
157 |
"(isUb (Reals) (hypreal_of_real ` Q) (hypreal_of_real Y)) = \ |
10751 | 158 |
\ (isUb (UNIV :: real set) Q Y)"; |
159 |
by Auto_tac; |
|
160 |
qed "hypreal_of_real_isUb_iff"; |
|
161 |
||
162 |
Goalw [isLub_def,leastP_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
163 |
"isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y) \ |
10751 | 164 |
\ ==> isLub (UNIV :: real set) Q Y"; |
165 |
by (auto_tac (claset() addIs [hypreal_of_real_isUb_iff RS iffD2], |
|
166 |
simpset() addsimps [hypreal_of_real_isUb_iff, setge_def])); |
|
167 |
qed "hypreal_of_real_isLub1"; |
|
168 |
||
169 |
Goalw [isLub_def,leastP_def] |
|
170 |
"isLub (UNIV :: real set) Q Y \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
171 |
\ ==> isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)"; |
10751 | 172 |
by (auto_tac (claset(), |
173 |
simpset() addsimps [hypreal_of_real_isUb_iff, setge_def])); |
|
174 |
by (forw_inst_tac [("x2","x")] (isUbD2a RS (SReal_iff RS iffD1) RS exE) 1); |
|
175 |
by (assume_tac 2); |
|
176 |
by (dres_inst_tac [("x","xa")] spec 1); |
|
177 |
by (auto_tac (claset(), simpset() addsimps [hypreal_of_real_isUb_iff])); |
|
178 |
qed "hypreal_of_real_isLub2"; |
|
179 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
180 |
Goal "(isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)) = \ |
10751 | 181 |
\ (isLub (UNIV :: real set) Q Y)"; |
182 |
by (blast_tac (claset() addIs [hypreal_of_real_isLub1, |
|
183 |
hypreal_of_real_isLub2]) 1); |
|
184 |
qed "hypreal_of_real_isLub_iff"; |
|
185 |
||
186 |
(* lemmas *) |
|
187 |
Goalw [isUb_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
188 |
"isUb Reals P Y ==> EX Yo. isUb Reals P (hypreal_of_real Yo)"; |
10751 | 189 |
by (auto_tac (claset(), simpset() addsimps [SReal_iff])); |
190 |
qed "lemma_isUb_hypreal_of_real"; |
|
191 |
||
192 |
Goalw [isLub_def,leastP_def,isUb_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
193 |
"isLub Reals P Y ==> EX Yo. isLub Reals P (hypreal_of_real Yo)"; |
10751 | 194 |
by (auto_tac (claset(), simpset() addsimps [SReal_iff])); |
195 |
qed "lemma_isLub_hypreal_of_real"; |
|
196 |
||
197 |
Goalw [isLub_def,leastP_def,isUb_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
198 |
"EX Yo. isLub Reals P (hypreal_of_real Yo) ==> EX Y. isLub Reals P Y"; |
10751 | 199 |
by Auto_tac; |
200 |
qed "lemma_isLub_hypreal_of_real2"; |
|
201 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
202 |
Goal "[| P <= Reals; EX x. x: P; EX Y. isUb Reals P Y |] \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
203 |
\ ==> EX t::hypreal. isLub Reals P t"; |
10751 | 204 |
by (forward_tac [SReal_hypreal_of_real_image] 1); |
205 |
by (Auto_tac THEN dtac lemma_isUb_hypreal_of_real 1); |
|
206 |
by (auto_tac (claset() addSIs [reals_complete, lemma_isLub_hypreal_of_real2], |
|
207 |
simpset() addsimps [hypreal_of_real_isLub_iff,hypreal_of_real_isUb_iff])); |
|
208 |
qed "SReal_complete"; |
|
209 |
||
210 |
(*-------------------------------------------------------------------- |
|
211 |
Set of finite elements is a subring of the extended reals |
|
212 |
--------------------------------------------------------------------*) |
|
213 |
Goalw [HFinite_def] "[|x : HFinite; y : HFinite|] ==> (x+y) : HFinite"; |
|
214 |
by (blast_tac (claset() addSIs [SReal_add,hrabs_add_less]) 1); |
|
215 |
qed "HFinite_add"; |
|
216 |
||
217 |
Goalw [HFinite_def] "[|x : HFinite; y : HFinite|] ==> x*y : HFinite"; |
|
218 |
by (Asm_full_simp_tac 1); |
|
219 |
by (blast_tac (claset() addSIs [SReal_mult,hrabs_mult_less]) 1); |
|
220 |
qed "HFinite_mult"; |
|
221 |
||
222 |
Goalw [HFinite_def] "(-x : HFinite) = (x : HFinite)"; |
|
223 |
by (Simp_tac 1); |
|
224 |
qed "HFinite_minus_iff"; |
|
225 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
226 |
Goalw [SReal_def,HFinite_def] "Reals <= HFinite"; |
10751 | 227 |
by Auto_tac; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
228 |
by (res_inst_tac [("x","1 + abs(hypreal_of_real r)")] exI 1); |
10751 | 229 |
by (auto_tac (claset(), simpset() addsimps [hypreal_of_real_hrabs])); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
230 |
by (res_inst_tac [("x","1 + abs r")] exI 1); |
10751 | 231 |
by (Simp_tac 1); |
232 |
qed "SReal_subset_HFinite"; |
|
233 |
||
234 |
Goal "hypreal_of_real x : HFinite"; |
|
235 |
by (auto_tac (claset() addIs [(SReal_subset_HFinite RS subsetD)], |
|
236 |
simpset())); |
|
237 |
qed "HFinite_hypreal_of_real"; |
|
238 |
||
239 |
Addsimps [HFinite_hypreal_of_real]; |
|
240 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
241 |
Goalw [HFinite_def] "x : HFinite ==> EX t: Reals. abs x < t"; |
10751 | 242 |
by Auto_tac; |
243 |
qed "HFiniteD"; |
|
244 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
245 |
Goalw [HFinite_def] "(abs x : HFinite) = (x : HFinite)"; |
10751 | 246 |
by (auto_tac (claset(), simpset() addsimps [hrabs_idempotent])); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
247 |
qed "HFinite_hrabs_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
248 |
AddIffs [HFinite_hrabs_iff]; |
10751 | 249 |
|
250 |
Goal "number_of w : HFinite"; |
|
251 |
by (rtac (SReal_number_of RS (SReal_subset_HFinite RS subsetD)) 1); |
|
252 |
qed "HFinite_number_of"; |
|
253 |
Addsimps [HFinite_number_of]; |
|
254 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
255 |
(** As always with numerals, 0 and 1 are special cases **) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
256 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
257 |
Goal "0 : HFinite"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
258 |
by (stac (hypreal_numeral_0_eq_0 RS sym) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
259 |
by (rtac HFinite_number_of 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
260 |
qed "HFinite_0"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
261 |
Addsimps [HFinite_0]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
262 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
263 |
Goal "1 : HFinite"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
264 |
by (stac (hypreal_numeral_1_eq_1 RS sym) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
265 |
by (rtac HFinite_number_of 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
266 |
qed "HFinite_1"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
267 |
Addsimps [HFinite_1]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
268 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
269 |
Goal "[|x : HFinite; y <= x; 0 <= y |] ==> y: HFinite"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
270 |
by (case_tac "x <= 0" 1); |
10751 | 271 |
by (dres_inst_tac [("y","x")] order_trans 1); |
272 |
by (dtac hypreal_le_anti_sym 2); |
|
273 |
by (auto_tac (claset() addSDs [not_hypreal_leE], simpset())); |
|
274 |
by (auto_tac (claset() addSIs [bexI] addIs [order_le_less_trans], |
|
275 |
simpset() addsimps [hrabs_eqI1,hrabs_eqI2,hrabs_minus_eqI1,HFinite_def])); |
|
276 |
qed "HFinite_bounded"; |
|
277 |
||
278 |
(*------------------------------------------------------------------ |
|
279 |
Set of infinitesimals is a subring of the hyperreals |
|
280 |
------------------------------------------------------------------*) |
|
281 |
Goalw [Infinitesimal_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
282 |
"x : Infinitesimal ==> ALL r: Reals. 0 < r --> abs x < r"; |
10751 | 283 |
by Auto_tac; |
284 |
qed "InfinitesimalD"; |
|
285 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
286 |
Goalw [Infinitesimal_def] "0 : Infinitesimal"; |
10751 | 287 |
by (simp_tac (simpset() addsimps [hrabs_zero]) 1); |
288 |
qed "Infinitesimal_zero"; |
|
289 |
AddIffs [Infinitesimal_zero]; |
|
290 |
||
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
291 |
Goal "x/(2::hypreal) + x/(2::hypreal) = x"; |
10751 | 292 |
by Auto_tac; |
293 |
qed "hypreal_sum_of_halves"; |
|
294 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
295 |
Goal "0 < r ==> 0 < r/(2::hypreal)"; |
10751 | 296 |
by Auto_tac; |
297 |
qed "hypreal_half_gt_zero"; |
|
298 |
||
299 |
Goalw [Infinitesimal_def] |
|
300 |
"[| x : Infinitesimal; y : Infinitesimal |] ==> (x+y) : Infinitesimal"; |
|
301 |
by Auto_tac; |
|
302 |
by (rtac (hypreal_sum_of_halves RS subst) 1); |
|
303 |
by (dtac hypreal_half_gt_zero 1); |
|
304 |
by (blast_tac (claset() addIs [hrabs_add_less, hrabs_add_less, |
|
305 |
SReal_divide_number_of]) 1); |
|
306 |
qed "Infinitesimal_add"; |
|
307 |
||
308 |
Goalw [Infinitesimal_def] "(-x:Infinitesimal) = (x:Infinitesimal)"; |
|
309 |
by (Full_simp_tac 1); |
|
310 |
qed "Infinitesimal_minus_iff"; |
|
311 |
Addsimps [Infinitesimal_minus_iff]; |
|
312 |
||
313 |
Goal "[| x : Infinitesimal; y : Infinitesimal |] ==> x-y : Infinitesimal"; |
|
314 |
by (asm_simp_tac |
|
315 |
(simpset() addsimps [hypreal_diff_def, Infinitesimal_add]) 1); |
|
316 |
qed "Infinitesimal_diff"; |
|
317 |
||
318 |
Goalw [Infinitesimal_def] |
|
319 |
"[| x : Infinitesimal; y : Infinitesimal |] ==> (x * y) : Infinitesimal"; |
|
320 |
by Auto_tac; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
321 |
by (case_tac "y=0" 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
322 |
by (cut_inst_tac [("u","abs x"),("v","1"),("x","abs y"),("y","r")] |
10751 | 323 |
hypreal_mult_less_mono 2); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
324 |
by Auto_tac; |
10751 | 325 |
qed "Infinitesimal_mult"; |
326 |
||
327 |
Goal "[| x : Infinitesimal; y : HFinite |] ==> (x * y) : Infinitesimal"; |
|
328 |
by (auto_tac (claset() addSDs [HFiniteD], |
|
329 |
simpset() addsimps [Infinitesimal_def])); |
|
330 |
by (forward_tac [hrabs_less_gt_zero] 1); |
|
331 |
by (dres_inst_tac [("x","r/t")] bspec 1); |
|
332 |
by (blast_tac (claset() addIs [SReal_divide]) 1); |
|
333 |
by (asm_full_simp_tac (simpset() addsimps [hypreal_0_less_divide_iff]) 1); |
|
334 |
by (case_tac "x=0 | y=0" 1); |
|
335 |
by (cut_inst_tac [("u","abs x"),("v","r/t"),("x","abs y")] |
|
336 |
hypreal_mult_less_mono 2); |
|
337 |
by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_divide_iff])); |
|
338 |
qed "Infinitesimal_HFinite_mult"; |
|
339 |
||
340 |
Goal "[| x : Infinitesimal; y : HFinite |] ==> (y * x) : Infinitesimal"; |
|
341 |
by (auto_tac (claset() addDs [Infinitesimal_HFinite_mult], |
|
342 |
simpset() addsimps [hypreal_mult_commute])); |
|
343 |
qed "Infinitesimal_HFinite_mult2"; |
|
344 |
||
345 |
(*** rather long proof ***) |
|
346 |
Goalw [HInfinite_def,Infinitesimal_def] |
|
347 |
"x: HInfinite ==> inverse x: Infinitesimal"; |
|
348 |
by Auto_tac; |
|
349 |
by (eres_inst_tac [("x","inverse r")] ballE 1); |
|
350 |
by (rtac (hrabs_inverse RS ssubst) 1); |
|
351 |
by (forw_inst_tac [("x1","r"),("z","abs x")] |
|
352 |
(hypreal_inverse_gt_0 RS order_less_trans) 1); |
|
353 |
by (assume_tac 1); |
|
354 |
by (dtac ((hypreal_inverse_inverse RS sym) RS subst) 1); |
|
355 |
by (rtac (hypreal_inverse_less_iff RS iffD1) 1); |
|
356 |
by (auto_tac (claset(), simpset() addsimps [SReal_inverse])); |
|
357 |
qed "HInfinite_inverse_Infinitesimal"; |
|
358 |
||
359 |
||
360 |
||
361 |
Goalw [HInfinite_def] "[|x: HInfinite;y: HInfinite|] ==> (x*y): HInfinite"; |
|
362 |
by Auto_tac; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
363 |
by (eres_inst_tac [("x","1")] ballE 1); |
10751 | 364 |
by (eres_inst_tac [("x","r")] ballE 1); |
365 |
by (case_tac "y=0" 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
366 |
by (cut_inst_tac [("x","1"),("y","abs x"), |
10751 | 367 |
("u","r"),("v","abs y")] hypreal_mult_less_mono 2); |
368 |
by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac)); |
|
369 |
qed "HInfinite_mult"; |
|
370 |
||
371 |
Goalw [HInfinite_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
372 |
"[|x: HInfinite; 0 <= y; 0 <= x|] ==> (x + y): HInfinite"; |
10751 | 373 |
by (auto_tac (claset() addSIs [hypreal_add_zero_less_le_mono], |
374 |
simpset() addsimps [hrabs_eqI1, hypreal_add_commute, |
|
375 |
hypreal_le_add_order])); |
|
376 |
qed "HInfinite_add_ge_zero"; |
|
377 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
378 |
Goal "[|x: HInfinite; 0 <= y; 0 <= x|] ==> (y + x): HInfinite"; |
10751 | 379 |
by (auto_tac (claset() addSIs [HInfinite_add_ge_zero], |
380 |
simpset() addsimps [hypreal_add_commute])); |
|
381 |
qed "HInfinite_add_ge_zero2"; |
|
382 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
383 |
Goal "[|x: HInfinite; 0 < y; 0 < x|] ==> (x + y): HInfinite"; |
10751 | 384 |
by (blast_tac (claset() addIs [HInfinite_add_ge_zero, |
385 |
order_less_imp_le]) 1); |
|
386 |
qed "HInfinite_add_gt_zero"; |
|
387 |
||
388 |
Goalw [HInfinite_def] "(-x: HInfinite) = (x: HInfinite)"; |
|
389 |
by Auto_tac; |
|
390 |
qed "HInfinite_minus_iff"; |
|
391 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
392 |
Goal "[|x: HInfinite; y <= 0; x <= 0|] ==> (x + y): HInfinite"; |
10751 | 393 |
by (dtac (HInfinite_minus_iff RS iffD2) 1); |
394 |
by (rtac (HInfinite_minus_iff RS iffD1) 1); |
|
395 |
by (auto_tac (claset() addIs [HInfinite_add_ge_zero], |
|
396 |
simpset() addsimps [hypreal_minus_zero_le_iff])); |
|
397 |
qed "HInfinite_add_le_zero"; |
|
398 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
399 |
Goal "[|x: HInfinite; y < 0; x < 0|] ==> (x + y): HInfinite"; |
10751 | 400 |
by (blast_tac (claset() addIs [HInfinite_add_le_zero, |
401 |
order_less_imp_le]) 1); |
|
402 |
qed "HInfinite_add_lt_zero"; |
|
403 |
||
404 |
Goal "[|a: HFinite; b: HFinite; c: HFinite|] \ |
|
405 |
\ ==> a*a + b*b + c*c : HFinite"; |
|
406 |
by (auto_tac (claset() addIs [HFinite_mult,HFinite_add], simpset())); |
|
407 |
qed "HFinite_sum_squares"; |
|
408 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
409 |
Goal "x ~: Infinitesimal ==> x ~= 0"; |
10751 | 410 |
by Auto_tac; |
411 |
qed "not_Infinitesimal_not_zero"; |
|
412 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
413 |
Goal "x: HFinite - Infinitesimal ==> x ~= 0"; |
10751 | 414 |
by Auto_tac; |
415 |
qed "not_Infinitesimal_not_zero2"; |
|
416 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
417 |
Goal "(abs x : Infinitesimal) = (x : Infinitesimal)"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
418 |
by (auto_tac (claset(), simpset() addsimps [hrabs_def])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
419 |
qed "Infinitesimal_hrabs_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
420 |
AddIffs [Infinitesimal_hrabs_iff]; |
10751 | 421 |
|
422 |
Goal "x : HFinite - Infinitesimal ==> abs x : HFinite - Infinitesimal"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
423 |
by (Blast_tac 1); |
10751 | 424 |
qed "HFinite_diff_Infinitesimal_hrabs"; |
425 |
||
426 |
Goalw [Infinitesimal_def] |
|
427 |
"[| e : Infinitesimal; abs x < e |] ==> x : Infinitesimal"; |
|
428 |
by (auto_tac (claset() addSDs [bspec], simpset())); |
|
429 |
by (dres_inst_tac [("x","e")] (hrabs_ge_self RS order_le_less_trans) 1); |
|
430 |
by (fast_tac (claset() addIs [order_less_trans]) 1); |
|
431 |
qed "hrabs_less_Infinitesimal"; |
|
432 |
||
433 |
Goal "[| e : Infinitesimal; abs x <= e |] ==> x : Infinitesimal"; |
|
434 |
by (blast_tac (claset() addDs [order_le_imp_less_or_eq] |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
435 |
addIs [hrabs_less_Infinitesimal]) 1); |
10751 | 436 |
qed "hrabs_le_Infinitesimal"; |
437 |
||
438 |
Goalw [Infinitesimal_def] |
|
439 |
"[| e : Infinitesimal; \ |
|
440 |
\ e' : Infinitesimal; \ |
|
441 |
\ e' < x ; x < e |] ==> x : Infinitesimal"; |
|
442 |
by (auto_tac (claset() addSDs [bspec], simpset())); |
|
443 |
by (dres_inst_tac [("x","e")] (hrabs_ge_self RS order_le_less_trans) 1); |
|
444 |
by (dtac (hrabs_interval_iff RS iffD1) 1); |
|
445 |
by (fast_tac(claset() addIs [order_less_trans,hrabs_interval_iff RS iffD2]) 1); |
|
446 |
qed "Infinitesimal_interval"; |
|
447 |
||
448 |
Goal "[| e : Infinitesimal; e' : Infinitesimal; \ |
|
449 |
\ e' <= x ; x <= e |] ==> x : Infinitesimal"; |
|
450 |
by (auto_tac (claset() addIs [Infinitesimal_interval], |
|
451 |
simpset() addsimps [hypreal_le_eq_less_or_eq])); |
|
452 |
qed "Infinitesimal_interval2"; |
|
453 |
||
454 |
Goalw [Infinitesimal_def] |
|
455 |
"[| x ~: Infinitesimal; y ~: Infinitesimal|] ==> (x*y) ~:Infinitesimal"; |
|
456 |
by (Clarify_tac 1); |
|
457 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less]) 1); |
|
458 |
by (eres_inst_tac [("x","r*ra")] ballE 1); |
|
459 |
by (fast_tac (claset() addIs [SReal_mult]) 2); |
|
460 |
by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_mult_iff])); |
|
461 |
by (cut_inst_tac [("x","ra"),("y","abs y"), |
|
462 |
("u","r"),("v","abs x")] hypreal_mult_le_mono 1); |
|
463 |
by Auto_tac; |
|
464 |
qed "not_Infinitesimal_mult"; |
|
465 |
||
466 |
Goal "x*y : Infinitesimal ==> x : Infinitesimal | y : Infinitesimal"; |
|
467 |
by (rtac ccontr 1); |
|
468 |
by (dtac (de_Morgan_disj RS iffD1) 1); |
|
469 |
by (fast_tac (claset() addDs [not_Infinitesimal_mult]) 1); |
|
470 |
qed "Infinitesimal_mult_disj"; |
|
471 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
472 |
Goal "x: HFinite-Infinitesimal ==> x ~= 0"; |
10751 | 473 |
by (Blast_tac 1); |
474 |
qed "HFinite_Infinitesimal_not_zero"; |
|
475 |
||
476 |
Goal "[| x : HFinite - Infinitesimal; \ |
|
477 |
\ y : HFinite - Infinitesimal \ |
|
478 |
\ |] ==> (x*y) : HFinite - Infinitesimal"; |
|
479 |
by (Clarify_tac 1); |
|
480 |
by (blast_tac (claset() addDs [HFinite_mult,not_Infinitesimal_mult]) 1); |
|
481 |
qed "HFinite_Infinitesimal_diff_mult"; |
|
482 |
||
483 |
Goalw [Infinitesimal_def,HFinite_def] |
|
484 |
"Infinitesimal <= HFinite"; |
|
485 |
by Auto_tac; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
486 |
by (res_inst_tac [("x","1")] bexI 1); |
10751 | 487 |
by Auto_tac; |
488 |
qed "Infinitesimal_subset_HFinite"; |
|
489 |
||
490 |
Goal "x: Infinitesimal ==> x * hypreal_of_real r : Infinitesimal"; |
|
491 |
by (etac (HFinite_hypreal_of_real RSN |
|
492 |
(2,Infinitesimal_HFinite_mult)) 1); |
|
493 |
qed "Infinitesimal_hypreal_of_real_mult"; |
|
494 |
||
495 |
Goal "x: Infinitesimal ==> hypreal_of_real r * x: Infinitesimal"; |
|
496 |
by (etac (HFinite_hypreal_of_real RSN |
|
497 |
(2,Infinitesimal_HFinite_mult2)) 1); |
|
498 |
qed "Infinitesimal_hypreal_of_real_mult2"; |
|
499 |
||
500 |
(*---------------------------------------------------------------------- |
|
501 |
Infinitely close relation @= |
|
502 |
----------------------------------------------------------------------*) |
|
503 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
504 |
Goalw [Infinitesimal_def,approx_def] |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
505 |
"(x:Infinitesimal) = (x @= 0)"; |
10751 | 506 |
by (Simp_tac 1); |
507 |
qed "mem_infmal_iff"; |
|
508 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
509 |
Goalw [approx_def]" (x @= y) = (x + -y @= 0)"; |
10751 | 510 |
by (Simp_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
511 |
qed "approx_minus_iff"; |
10751 | 512 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
513 |
Goalw [approx_def]" (x @= y) = (-y + x @= 0)"; |
10751 | 514 |
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
515 |
qed "approx_minus_iff2"; |
10751 | 516 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
517 |
Goalw [approx_def,Infinitesimal_def] "x @= x"; |
10751 | 518 |
by (Simp_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
519 |
qed "approx_refl"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
520 |
AddIffs [approx_refl]; |
10751 | 521 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
522 |
Goalw [approx_def] "x @= y ==> y @= x"; |
10751 | 523 |
by (rtac (hypreal_minus_distrib1 RS subst) 1); |
524 |
by (etac (Infinitesimal_minus_iff RS iffD2) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
525 |
qed "approx_sym"; |
10751 | 526 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
527 |
Goalw [approx_def] "[| x @= y; y @= z |] ==> x @= z"; |
10751 | 528 |
by (dtac Infinitesimal_add 1); |
529 |
by (assume_tac 1); |
|
530 |
by Auto_tac; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
531 |
qed "approx_trans"; |
10751 | 532 |
|
533 |
Goal "[| r @= x; s @= x |] ==> r @= s"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
534 |
by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
535 |
qed "approx_trans2"; |
10751 | 536 |
|
537 |
Goal "[| x @= r; x @= s|] ==> r @= s"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
538 |
by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
539 |
qed "approx_trans3"; |
10751 | 540 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
541 |
Goal "(number_of w @= x) = (x @= number_of w)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
542 |
by (blast_tac (claset() addIs [approx_sym]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
543 |
qed "number_of_approx_reorient"; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
544 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
545 |
Goal "(0 @= x) = (x @= 0)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
546 |
by (blast_tac (claset() addIs [approx_sym]) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
547 |
qed "zero_approx_reorient"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
548 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
549 |
Goal "(1 @= x) = (x @= 1)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
550 |
by (blast_tac (claset() addIs [approx_sym]) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
551 |
qed "one_approx_reorient"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
552 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
553 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
554 |
(*** re-orientation, following HOL/Integ/Bin.ML |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
555 |
We re-orient x @=y where x is 0, 1 or a numeral, unless y is as well! |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
556 |
***) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
557 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
558 |
(*reorientation simprules using ==, for the following simproc*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
559 |
val meta_zero_approx_reorient = zero_approx_reorient RS eq_reflection; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
560 |
val meta_one_approx_reorient = one_approx_reorient RS eq_reflection; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
561 |
val meta_number_of_approx_reorient = number_of_approx_reorient RS eq_reflection; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
562 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
563 |
(*reorientation simplification procedure: reorients (polymorphic) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
564 |
0 = x, 1 = x, nnn = x provided x isn't 0, 1 or a numeral.*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
565 |
fun reorient_proc sg _ (_ $ t $ u) = |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
566 |
case u of |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
567 |
Const("0", _) => None |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
568 |
| Const("1", _) => None |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
569 |
| Const("Numeral.number_of", _) $ _ => None |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
570 |
| _ => Some (case t of |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
571 |
Const("0", _) => meta_zero_approx_reorient |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
572 |
| Const("1", _) => meta_one_approx_reorient |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
573 |
| Const("Numeral.number_of", _) $ _ => |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
574 |
meta_number_of_approx_reorient); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
575 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
576 |
val approx_reorient_simproc = |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
577 |
Bin_Simprocs.prep_simproc ("reorient_simproc", |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
578 |
Bin_Simprocs.prep_pats ["0@=x", "1@=x", "number_of w @= x"], |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
579 |
reorient_proc); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
580 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
581 |
Addsimprocs [approx_reorient_simproc]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
582 |
|
10751 | 583 |
|
584 |
Goal "(x-y : Infinitesimal) = (x @= y)"; |
|
585 |
by (auto_tac (claset(), |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
586 |
simpset() addsimps [hypreal_diff_def, approx_minus_iff RS sym, |
10751 | 587 |
mem_infmal_iff])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
588 |
qed "Infinitesimal_approx_minus"; |
10751 | 589 |
|
590 |
Goalw [monad_def] "(x @= y) = (monad(x)=monad(y))"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
591 |
by (auto_tac (claset() addDs [approx_sym] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
592 |
addSEs [approx_trans,equalityCE], |
10751 | 593 |
simpset())); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
594 |
qed "approx_monad_iff"; |
10751 | 595 |
|
596 |
Goal "[| x: Infinitesimal; y: Infinitesimal |] ==> x @= y"; |
|
597 |
by (asm_full_simp_tac (simpset() addsimps [mem_infmal_iff]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
598 |
by (blast_tac (claset() addIs [approx_trans, approx_sym]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
599 |
qed "Infinitesimal_approx"; |
10751 | 600 |
|
601 |
val prem1::prem2::rest = |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
602 |
goalw thy [approx_def] "[| a @= b; c @= d |] ==> a+c @= b+d"; |
10751 | 603 |
by (rtac (hypreal_minus_add_distrib RS ssubst) 1); |
604 |
by (rtac (hypreal_add_assoc RS ssubst) 1); |
|
605 |
by (res_inst_tac [("y1","c")] (hypreal_add_left_commute RS subst) 1); |
|
606 |
by (rtac (hypreal_add_assoc RS subst) 1); |
|
607 |
by (rtac ([prem1,prem2] MRS Infinitesimal_add) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
608 |
qed "approx_add"; |
10751 | 609 |
|
610 |
Goal "a @= b ==> -a @= -b"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
611 |
by (rtac ((approx_minus_iff RS iffD2) RS approx_sym) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
612 |
by (dtac (approx_minus_iff RS iffD1) 1); |
10751 | 613 |
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
614 |
qed "approx_minus"; |
10751 | 615 |
|
616 |
Goal "-a @= -b ==> a @= b"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
617 |
by (auto_tac (claset() addDs [approx_minus], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
618 |
qed "approx_minus2"; |
10751 | 619 |
|
620 |
Goal "(-a @= -b) = (a @= b)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
621 |
by (blast_tac (claset() addIs [approx_minus,approx_minus2]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
622 |
qed "approx_minus_cancel"; |
10751 | 623 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
624 |
Addsimps [approx_minus_cancel]; |
10751 | 625 |
|
626 |
Goal "[| a @= b; c @= d |] ==> a + -c @= b + -d"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
627 |
by (blast_tac (claset() addSIs [approx_add,approx_minus]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
628 |
qed "approx_add_minus"; |
10751 | 629 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
630 |
Goalw [approx_def] "[| a @= b; c: HFinite|] ==> a*c @= b*c"; |
10751 | 631 |
by (asm_full_simp_tac (simpset() addsimps [Infinitesimal_HFinite_mult, |
632 |
hypreal_minus_mult_eq1,hypreal_add_mult_distrib RS sym] |
|
633 |
delsimps [hypreal_minus_mult_eq1 RS sym]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
634 |
qed "approx_mult1"; |
10751 | 635 |
|
636 |
Goal "[|a @= b; c: HFinite|] ==> c*a @= c*b"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
637 |
by (asm_simp_tac (simpset() addsimps [approx_mult1,hypreal_mult_commute]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
638 |
qed "approx_mult2"; |
10751 | 639 |
|
640 |
Goal "[|u @= v*x; x @= y; v: HFinite|] ==> u @= v*y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
641 |
by (fast_tac (claset() addIs [approx_mult2,approx_trans]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
642 |
qed "approx_mult_subst"; |
10751 | 643 |
|
644 |
Goal "[| u @= x*v; x @= y; v: HFinite |] ==> u @= y*v"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
645 |
by (fast_tac (claset() addIs [approx_mult1,approx_trans]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
646 |
qed "approx_mult_subst2"; |
10751 | 647 |
|
648 |
Goal "[| u @= x*hypreal_of_real v; x @= y |] ==> u @= y*hypreal_of_real v"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
649 |
by (auto_tac (claset() addIs [approx_mult_subst2], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
650 |
qed "approx_mult_subst_SReal"; |
10751 | 651 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
652 |
Goalw [approx_def] "a = b ==> a @= b"; |
10751 | 653 |
by (Asm_simp_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
654 |
qed "approx_eq_imp"; |
10751 | 655 |
|
656 |
Goal "x: Infinitesimal ==> -x @= x"; |
|
657 |
by (fast_tac (HOL_cs addIs [Infinitesimal_minus_iff RS iffD2, |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
658 |
mem_infmal_iff RS iffD1,approx_trans2]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
659 |
qed "Infinitesimal_minus_approx"; |
10751 | 660 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
661 |
Goalw [approx_def] "(EX y: Infinitesimal. x + -z = y) = (x @= z)"; |
10751 | 662 |
by (Blast_tac 1); |
663 |
qed "bex_Infinitesimal_iff"; |
|
664 |
||
665 |
Goal "(EX y: Infinitesimal. x = z + y) = (x @= z)"; |
|
666 |
by (asm_full_simp_tac (simpset() addsimps [bex_Infinitesimal_iff RS sym]) 1); |
|
667 |
by (Force_tac 1); |
|
668 |
qed "bex_Infinitesimal_iff2"; |
|
669 |
||
670 |
Goal "[| y: Infinitesimal; x + y = z |] ==> x @= z"; |
|
671 |
by (rtac (bex_Infinitesimal_iff RS iffD1) 1); |
|
672 |
by (dtac (Infinitesimal_minus_iff RS iffD2) 1); |
|
673 |
by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib, |
|
674 |
hypreal_add_assoc RS sym])); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
675 |
qed "Infinitesimal_add_approx"; |
10751 | 676 |
|
677 |
Goal "y: Infinitesimal ==> x @= x + y"; |
|
678 |
by (rtac (bex_Infinitesimal_iff RS iffD1) 1); |
|
679 |
by (dtac (Infinitesimal_minus_iff RS iffD2) 1); |
|
680 |
by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib, |
|
681 |
hypreal_add_assoc RS sym])); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
682 |
qed "Infinitesimal_add_approx_self"; |
10751 | 683 |
|
684 |
Goal "y: Infinitesimal ==> x @= y + x"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
685 |
by (auto_tac (claset() addDs [Infinitesimal_add_approx_self], |
10751 | 686 |
simpset() addsimps [hypreal_add_commute])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
687 |
qed "Infinitesimal_add_approx_self2"; |
10751 | 688 |
|
689 |
Goal "y: Infinitesimal ==> x @= x + -y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
690 |
by (blast_tac (claset() addSIs [Infinitesimal_add_approx_self, |
10751 | 691 |
Infinitesimal_minus_iff RS iffD2]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
692 |
qed "Infinitesimal_add_minus_approx_self"; |
10751 | 693 |
|
694 |
Goal "[| y: Infinitesimal; x+y @= z|] ==> x @= z"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
695 |
by (dres_inst_tac [("x","x")] (Infinitesimal_add_approx_self RS approx_sym) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
696 |
by (etac (approx_trans3 RS approx_sym) 1); |
10751 | 697 |
by (assume_tac 1); |
698 |
qed "Infinitesimal_add_cancel"; |
|
699 |
||
700 |
Goal "[| y: Infinitesimal; x @= z + y|] ==> x @= z"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
701 |
by (dres_inst_tac [("x","z")] (Infinitesimal_add_approx_self2 RS approx_sym) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
702 |
by (etac (approx_trans3 RS approx_sym) 1); |
10751 | 703 |
by (asm_full_simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
704 |
by (etac approx_sym 1); |
10751 | 705 |
qed "Infinitesimal_add_right_cancel"; |
706 |
||
707 |
Goal "d + b @= d + c ==> b @= c"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
708 |
by (dtac (approx_minus_iff RS iffD1) 1); |
10751 | 709 |
by (asm_full_simp_tac (simpset() addsimps |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
710 |
[hypreal_minus_add_distrib,approx_minus_iff RS sym] |
10751 | 711 |
@ hypreal_add_ac) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
712 |
qed "approx_add_left_cancel"; |
10751 | 713 |
|
714 |
Goal "b + d @= c + d ==> b @= c"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
715 |
by (rtac approx_add_left_cancel 1); |
10751 | 716 |
by (asm_full_simp_tac (simpset() addsimps |
717 |
[hypreal_add_commute]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
718 |
qed "approx_add_right_cancel"; |
10751 | 719 |
|
720 |
Goal "b @= c ==> d + b @= d + c"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
721 |
by (rtac (approx_minus_iff RS iffD2) 1); |
10751 | 722 |
by (asm_full_simp_tac (simpset() addsimps |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
723 |
[hypreal_minus_add_distrib,approx_minus_iff RS sym] |
10751 | 724 |
@ hypreal_add_ac) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
725 |
qed "approx_add_mono1"; |
10751 | 726 |
|
727 |
Goal "b @= c ==> b + a @= c + a"; |
|
728 |
by (asm_simp_tac (simpset() addsimps |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
729 |
[hypreal_add_commute,approx_add_mono1]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
730 |
qed "approx_add_mono2"; |
10751 | 731 |
|
732 |
Goal "(a + b @= a + c) = (b @= c)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
733 |
by (fast_tac (claset() addEs [approx_add_left_cancel, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
734 |
approx_add_mono1]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
735 |
qed "approx_add_left_iff"; |
10751 | 736 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
737 |
Addsimps [approx_add_left_iff]; |
10751 | 738 |
|
739 |
Goal "(b + a @= c + a) = (b @= c)"; |
|
740 |
by (simp_tac (simpset() addsimps [hypreal_add_commute]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
741 |
qed "approx_add_right_iff"; |
10751 | 742 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
743 |
Addsimps [approx_add_right_iff]; |
10751 | 744 |
|
745 |
Goal "[| x: HFinite; x @= y |] ==> y: HFinite"; |
|
746 |
by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1); |
|
747 |
by (Step_tac 1); |
|
748 |
by (dtac (Infinitesimal_subset_HFinite RS subsetD |
|
749 |
RS (HFinite_minus_iff RS iffD2)) 1); |
|
750 |
by (dtac HFinite_add 1); |
|
751 |
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc])); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
752 |
qed "approx_HFinite"; |
10751 | 753 |
|
754 |
Goal "x @= hypreal_of_real D ==> x: HFinite"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
755 |
by (rtac (approx_sym RSN (2,approx_HFinite)) 1); |
10751 | 756 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
757 |
qed "approx_hypreal_of_real_HFinite"; |
10751 | 758 |
|
759 |
Goal "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
760 |
by (rtac approx_trans 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
761 |
by (rtac approx_mult2 2); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
762 |
by (rtac approx_mult1 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
763 |
by (blast_tac (claset() addIs [approx_HFinite, approx_sym]) 2); |
10751 | 764 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
765 |
qed "approx_mult_HFinite"; |
10751 | 766 |
|
767 |
Goal "[|a @= hypreal_of_real b; c @= hypreal_of_real d |] \ |
|
768 |
\ ==> a*c @= hypreal_of_real b*hypreal_of_real d"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
769 |
by (blast_tac (claset() addSIs [approx_mult_HFinite, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
770 |
approx_hypreal_of_real_HFinite,HFinite_hypreal_of_real]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
771 |
qed "approx_mult_hypreal_of_real"; |
10751 | 772 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
773 |
Goal "[| a: Reals; a ~= 0; a*x @= 0 |] ==> x @= 0"; |
10751 | 774 |
by (dtac (SReal_inverse RS (SReal_subset_HFinite RS subsetD)) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
775 |
by (auto_tac (claset() addDs [approx_mult2], |
10751 | 776 |
simpset() addsimps [hypreal_mult_assoc RS sym])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
777 |
qed "approx_SReal_mult_cancel_zero"; |
10751 | 778 |
|
779 |
(* REM comments: newly added *) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
780 |
Goal "[| a: Reals; x @= 0 |] ==> x*a @= 0"; |
10751 | 781 |
by (auto_tac (claset() addDs [(SReal_subset_HFinite RS subsetD), |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
782 |
approx_mult1], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
783 |
qed "approx_mult_SReal1"; |
10751 | 784 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
785 |
Goal "[| a: Reals; x @= 0 |] ==> a*x @= 0"; |
10751 | 786 |
by (auto_tac (claset() addDs [(SReal_subset_HFinite RS subsetD), |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
787 |
approx_mult2], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
788 |
qed "approx_mult_SReal2"; |
10751 | 789 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
790 |
Goal "[|a : Reals; a ~= 0 |] ==> (a*x @= 0) = (x @= 0)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
791 |
by (blast_tac (claset() addIs [approx_SReal_mult_cancel_zero, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
792 |
approx_mult_SReal2]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
793 |
qed "approx_mult_SReal_zero_cancel_iff"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
794 |
Addsimps [approx_mult_SReal_zero_cancel_iff]; |
10751 | 795 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
796 |
Goal "[| a: Reals; a ~= 0; a* w @= a*z |] ==> w @= z"; |
10751 | 797 |
by (dtac (SReal_inverse RS (SReal_subset_HFinite RS subsetD)) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
798 |
by (auto_tac (claset() addDs [approx_mult2], |
10751 | 799 |
simpset() addsimps [hypreal_mult_assoc RS sym])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
800 |
qed "approx_SReal_mult_cancel"; |
10751 | 801 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
802 |
Goal "[| a: Reals; a ~= 0|] ==> (a* w @= a*z) = (w @= z)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
803 |
by (auto_tac (claset() addSIs [approx_mult2,SReal_subset_HFinite RS subsetD] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
804 |
addIs [approx_SReal_mult_cancel], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
805 |
qed "approx_SReal_mult_cancel_iff1"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
806 |
Addsimps [approx_SReal_mult_cancel_iff1]; |
10751 | 807 |
|
808 |
Goal "[| z <= f; f @= g; g <= z |] ==> f @= z"; |
|
809 |
by (asm_full_simp_tac (simpset() addsimps [bex_Infinitesimal_iff2 RS sym]) 1); |
|
810 |
by Auto_tac; |
|
811 |
by (res_inst_tac [("x","g+y-z")] bexI 1); |
|
812 |
by (Simp_tac 1); |
|
813 |
by (rtac Infinitesimal_interval2 1); |
|
814 |
by (rtac Infinitesimal_zero 2); |
|
815 |
by Auto_tac; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
816 |
qed "approx_le_bound"; |
10751 | 817 |
|
818 |
(*----------------------------------------------------------------- |
|
819 |
Zero is the only infinitesimal that is also a real |
|
820 |
-----------------------------------------------------------------*) |
|
821 |
||
822 |
Goalw [Infinitesimal_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
823 |
"[| x: Reals; y: Infinitesimal; 0 < x |] ==> y < x"; |
10751 | 824 |
by (rtac (hrabs_ge_self RS order_le_less_trans) 1); |
825 |
by Auto_tac; |
|
826 |
qed "Infinitesimal_less_SReal"; |
|
827 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
828 |
Goal "y: Infinitesimal ==> ALL r: Reals. 0 < r --> y < r"; |
10751 | 829 |
by (blast_tac (claset() addIs [Infinitesimal_less_SReal]) 1); |
830 |
qed "Infinitesimal_less_SReal2"; |
|
831 |
||
832 |
Goalw [Infinitesimal_def] |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
833 |
"[| 0 < y; y: Reals|] ==> y ~: Infinitesimal"; |
10751 | 834 |
by (auto_tac (claset(), simpset() addsimps [hrabs_def])); |
835 |
qed "SReal_not_Infinitesimal"; |
|
836 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
837 |
Goal "[| y < 0; y : Reals |] ==> y ~: Infinitesimal"; |
10751 | 838 |
by (stac (Infinitesimal_minus_iff RS sym) 1); |
839 |
by (rtac SReal_not_Infinitesimal 1); |
|
840 |
by Auto_tac; |
|
841 |
qed "SReal_minus_not_Infinitesimal"; |
|
842 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
843 |
Goal "Reals Int Infinitesimal = {0}"; |
10751 | 844 |
by Auto_tac; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
845 |
by (cut_inst_tac [("x","x"),("y","0")] hypreal_linear 1); |
10751 | 846 |
by (blast_tac (claset() addDs [SReal_not_Infinitesimal, |
847 |
SReal_minus_not_Infinitesimal]) 1); |
|
848 |
qed "SReal_Int_Infinitesimal_zero"; |
|
849 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
850 |
Goal "[| x: Reals; x: Infinitesimal|] ==> x = 0"; |
10751 | 851 |
by (cut_facts_tac [SReal_Int_Infinitesimal_zero] 1); |
852 |
by (Blast_tac 1); |
|
853 |
qed "SReal_Infinitesimal_zero"; |
|
854 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
855 |
Goal "[| x : Reals; x ~= 0 |] ==> x : HFinite - Infinitesimal"; |
10751 | 856 |
by (auto_tac (claset() addDs [SReal_Infinitesimal_zero, |
857 |
SReal_subset_HFinite RS subsetD], |
|
858 |
simpset())); |
|
859 |
qed "SReal_HFinite_diff_Infinitesimal"; |
|
860 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
861 |
Goal "hypreal_of_real x ~= 0 ==> hypreal_of_real x : HFinite - Infinitesimal"; |
10751 | 862 |
by (rtac SReal_HFinite_diff_Infinitesimal 1); |
863 |
by Auto_tac; |
|
864 |
qed "hypreal_of_real_HFinite_diff_Infinitesimal"; |
|
865 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
866 |
Goal "(hypreal_of_real x : Infinitesimal) = (x=0)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
867 |
by Auto_tac; |
10751 | 868 |
by (rtac ccontr 1); |
869 |
by (rtac (hypreal_of_real_HFinite_diff_Infinitesimal RS DiffD2) 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
870 |
by Auto_tac; |
10751 | 871 |
qed "hypreal_of_real_Infinitesimal_iff_0"; |
872 |
AddIffs [hypreal_of_real_Infinitesimal_iff_0]; |
|
873 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
874 |
Goal "number_of w ~= (0::hypreal) ==> number_of w ~: Infinitesimal"; |
10751 | 875 |
by (fast_tac (claset() addDs [SReal_number_of RS SReal_Infinitesimal_zero]) 1); |
876 |
qed "number_of_not_Infinitesimal"; |
|
877 |
Addsimps [number_of_not_Infinitesimal]; |
|
878 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
879 |
(*again: 1 is a special case, but not 0 this time*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
880 |
Goal "1 ~: Infinitesimal"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
881 |
by (stac (hypreal_numeral_1_eq_1 RS sym) 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
882 |
by (rtac number_of_not_Infinitesimal 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
883 |
by (Simp_tac 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
884 |
qed "one_not_Infinitesimal"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
885 |
Addsimps [one_not_Infinitesimal]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
886 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
887 |
Goal "[| y: Reals; x @= y; y~= 0 |] ==> x ~= 0"; |
10751 | 888 |
by (cut_inst_tac [("x","y")] hypreal_trichotomy 1); |
889 |
by (Asm_full_simp_tac 1); |
|
890 |
by (blast_tac (claset() addDs |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
891 |
[approx_sym RS (mem_infmal_iff RS iffD2), |
10751 | 892 |
SReal_not_Infinitesimal, SReal_minus_not_Infinitesimal]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
893 |
qed "approx_SReal_not_zero"; |
10751 | 894 |
|
895 |
Goal "[| x @= y; y : HFinite - Infinitesimal |] \ |
|
896 |
\ ==> x : HFinite - Infinitesimal"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
897 |
by (auto_tac (claset() addIs [approx_sym RSN (2,approx_HFinite)], |
10751 | 898 |
simpset() addsimps [mem_infmal_iff])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
899 |
by (dtac approx_trans3 1 THEN assume_tac 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
900 |
by (blast_tac (claset() addDs [approx_sym]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
901 |
qed "HFinite_diff_Infinitesimal_approx"; |
10751 | 902 |
|
903 |
(*The premise y~=0 is essential; otherwise x/y =0 and we lose the |
|
904 |
HFinite premise.*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
905 |
Goal "[| y ~= 0; y: Infinitesimal; x/y : HFinite |] ==> x : Infinitesimal"; |
10751 | 906 |
by (dtac Infinitesimal_HFinite_mult2 1); |
907 |
by (assume_tac 1); |
|
908 |
by (asm_full_simp_tac |
|
909 |
(simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 1); |
|
910 |
qed "Infinitesimal_ratio"; |
|
911 |
||
912 |
(*------------------------------------------------------------------ |
|
913 |
Standard Part Theorem: Every finite x: R* is infinitely |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
914 |
close to a unique real number (i.e a member of Reals) |
10751 | 915 |
------------------------------------------------------------------*) |
916 |
(*------------------------------------------------------------------ |
|
917 |
Uniqueness: Two infinitely close reals are equal |
|
918 |
------------------------------------------------------------------*) |
|
919 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
920 |
Goal "[|x: Reals; y: Reals|] ==> (x @= y) = (x = y)"; |
10751 | 921 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
922 |
by (rewrite_goals_tac [approx_def]); |
10751 | 923 |
by (dres_inst_tac [("x","y")] SReal_minus 1); |
924 |
by (dtac SReal_add 1 THEN assume_tac 1); |
|
925 |
by (dtac SReal_Infinitesimal_zero 1 THEN assume_tac 1); |
|
926 |
by (dtac sym 1); |
|
927 |
by (asm_full_simp_tac (simpset() addsimps [hypreal_eq_minus_iff RS sym]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
928 |
qed "SReal_approx_iff"; |
10751 | 929 |
|
930 |
Goal "(number_of v @= number_of w) = (number_of v = (number_of w :: hypreal))"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
931 |
by (rtac SReal_approx_iff 1); |
10751 | 932 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
933 |
qed "number_of_approx_iff"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
934 |
Addsimps [number_of_approx_iff]; |
10751 | 935 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
936 |
(*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
937 |
Addsimps |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
938 |
(map (simplify (simpset())) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
939 |
[inst "v" "Pls" number_of_approx_iff, |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
940 |
inst "v" "Pls BIT True" number_of_approx_iff, |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
941 |
inst "w" "Pls" number_of_approx_iff, |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
942 |
inst "w" "Pls BIT True" number_of_approx_iff]); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
943 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
944 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
945 |
Goal "~ (0 @= 1)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
946 |
by (stac SReal_approx_iff 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
947 |
by Auto_tac; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
948 |
qed "not_0_approx_1"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
949 |
Addsimps [not_0_approx_1]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
950 |
|
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
951 |
Goal "~ (1 @= 0)"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
952 |
by (stac SReal_approx_iff 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
953 |
by Auto_tac; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
954 |
qed "not_1_approx_0"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
955 |
Addsimps [not_1_approx_0]; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
956 |
|
10751 | 957 |
Goal "(hypreal_of_real k @= hypreal_of_real m) = (k = m)"; |
958 |
by Auto_tac; |
|
959 |
by (rtac (inj_hypreal_of_real RS injD) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
960 |
by (rtac (SReal_approx_iff RS iffD1) 1); |
10751 | 961 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
962 |
qed "hypreal_of_real_approx_iff"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
963 |
Addsimps [hypreal_of_real_approx_iff]; |
10751 | 964 |
|
965 |
Goal "(hypreal_of_real k @= number_of w) = (k = number_of w)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
966 |
by (stac (hypreal_of_real_approx_iff RS sym) 1); |
10751 | 967 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
968 |
qed "hypreal_of_real_approx_number_of_iff"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
969 |
Addsimps [hypreal_of_real_approx_number_of_iff]; |
10751 | 970 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
971 |
(*And also for 0 and 1.*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
972 |
Addsimps |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
973 |
(map (simplify (simpset())) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
974 |
[inst "w" "Pls" hypreal_of_real_approx_number_of_iff, |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
975 |
inst "w" "Pls BIT True" hypreal_of_real_approx_number_of_iff]); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
976 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
977 |
Goal "[| r: Reals; s: Reals; r @= x; s @= x|] ==> r = s"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
978 |
by (blast_tac (claset() addIs [(SReal_approx_iff RS iffD1), |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
979 |
approx_trans2]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
980 |
qed "approx_unique_real"; |
10751 | 981 |
|
982 |
(*------------------------------------------------------------------ |
|
983 |
Existence of unique real infinitely close |
|
984 |
------------------------------------------------------------------*) |
|
985 |
(* lemma about lubs *) |
|
986 |
Goal "!!(x::hypreal). [| isLub R S x; isLub R S y |] ==> x = y"; |
|
987 |
by (forward_tac [isLub_isUb] 1); |
|
988 |
by (forw_inst_tac [("x","y")] isLub_isUb 1); |
|
989 |
by (blast_tac (claset() addSIs [hypreal_le_anti_sym] |
|
990 |
addSDs [isLub_le_isUb]) 1); |
|
991 |
qed "hypreal_isLub_unique"; |
|
992 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
993 |
Goal "x: HFinite ==> EX u. isUb Reals {s. s: Reals & s < x} u"; |
10751 | 994 |
by (dtac HFiniteD 1 THEN Step_tac 1); |
995 |
by (rtac exI 1 THEN rtac isUbI 1 THEN assume_tac 2); |
|
996 |
by (auto_tac (claset() addIs [order_less_imp_le,setleI,isUbI, |
|
997 |
order_less_trans], simpset() addsimps [hrabs_interval_iff])); |
|
998 |
qed "lemma_st_part_ub"; |
|
999 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1000 |
Goal "x: HFinite ==> EX y. y: {s. s: Reals & s < x}"; |
10751 | 1001 |
by (dtac HFiniteD 1 THEN Step_tac 1); |
1002 |
by (dtac SReal_minus 1); |
|
1003 |
by (res_inst_tac [("x","-t")] exI 1); |
|
1004 |
by (auto_tac (claset(), simpset() addsimps [hrabs_interval_iff])); |
|
1005 |
qed "lemma_st_part_nonempty"; |
|
1006 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1007 |
Goal "{s. s: Reals & s < x} <= Reals"; |
10751 | 1008 |
by Auto_tac; |
1009 |
qed "lemma_st_part_subset"; |
|
1010 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1011 |
Goal "x: HFinite ==> EX t. isLub Reals {s. s: Reals & s < x} t"; |
10751 | 1012 |
by (blast_tac (claset() addSIs [SReal_complete,lemma_st_part_ub, |
1013 |
lemma_st_part_nonempty, lemma_st_part_subset]) 1); |
|
1014 |
qed "lemma_st_part_lub"; |
|
1015 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1016 |
Goal "((t::hypreal) + r <= t) = (r <= 0)"; |
10751 | 1017 |
by (Step_tac 1); |
1018 |
by (dres_inst_tac [("x","-t")] hypreal_add_left_le_mono1 1); |
|
1019 |
by (dres_inst_tac [("x","t")] hypreal_add_left_le_mono1 2); |
|
1020 |
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc RS sym])); |
|
1021 |
qed "lemma_hypreal_le_left_cancel"; |
|
1022 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1023 |
Goal "[| x: HFinite; isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1024 |
\ r: Reals; 0 < r |] ==> x <= t + r"; |
10751 | 1025 |
by (forward_tac [isLubD1a] 1); |
1026 |
by (rtac ccontr 1 THEN dtac (linorder_not_le RS iffD2) 1); |
|
1027 |
by (dres_inst_tac [("x","t")] SReal_add 1 THEN assume_tac 1); |
|
1028 |
by (dres_inst_tac [("y","t + r")] (isLubD1 RS setleD) 1); |
|
1029 |
by Auto_tac; |
|
1030 |
qed "lemma_st_part_le1"; |
|
1031 |
||
1032 |
Goalw [setle_def] "!!x::hypreal. [| S *<= x; x < y |] ==> S *<= y"; |
|
1033 |
by (auto_tac (claset() addSDs [bspec,order_le_less_trans] |
|
1034 |
addIs [order_less_imp_le], |
|
1035 |
simpset())); |
|
1036 |
qed "hypreal_setle_less_trans"; |
|
1037 |
||
1038 |
Goalw [isUb_def] |
|
1039 |
"!!x::hypreal. [| isUb R S x; x < y; y: R |] ==> isUb R S y"; |
|
1040 |
by (blast_tac (claset() addIs [hypreal_setle_less_trans]) 1); |
|
1041 |
qed "hypreal_gt_isUb"; |
|
1042 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1043 |
Goal "[| x: HFinite; x < y; y: Reals |] \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1044 |
\ ==> isUb Reals {s. s: Reals & s < x} y"; |
10751 | 1045 |
by (auto_tac (claset() addDs [order_less_trans] |
1046 |
addIs [order_less_imp_le] addSIs [isUbI,setleI], simpset())); |
|
1047 |
qed "lemma_st_part_gt_ub"; |
|
1048 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1049 |
Goal "t <= t + -r ==> r <= (0::hypreal)"; |
10751 | 1050 |
by (dres_inst_tac [("x","-t")] hypreal_add_left_le_mono1 1); |
1051 |
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc RS sym])); |
|
1052 |
qed "lemma_minus_le_zero"; |
|
1053 |
||
1054 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1055 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1056 |
\ r: Reals; 0 < r |] \ |
10751 | 1057 |
\ ==> t + -r <= x"; |
1058 |
by (forward_tac [isLubD1a] 1); |
|
1059 |
by (rtac ccontr 1 THEN dtac not_hypreal_leE 1); |
|
1060 |
by (dtac SReal_minus 1 THEN dres_inst_tac [("x","t")] |
|
1061 |
SReal_add 1 THEN assume_tac 1); |
|
1062 |
by (dtac lemma_st_part_gt_ub 1 THEN REPEAT(assume_tac 1)); |
|
1063 |
by (dtac isLub_le_isUb 1 THEN assume_tac 1); |
|
1064 |
by (dtac lemma_minus_le_zero 1); |
|
1065 |
by (auto_tac (claset() addDs [order_less_le_trans], simpset())); |
|
1066 |
qed "lemma_st_part_le2"; |
|
1067 |
||
1068 |
Goal "((x::hypreal) <= t + r) = (x + -t <= r)"; |
|
1069 |
by Auto_tac; |
|
1070 |
qed "lemma_hypreal_le_swap"; |
|
1071 |
||
1072 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1073 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1074 |
\ r: Reals; 0 < r |] \ |
10751 | 1075 |
\ ==> x + -t <= r"; |
1076 |
by (blast_tac (claset() addSIs [lemma_hypreal_le_swap RS iffD1, |
|
1077 |
lemma_st_part_le1]) 1); |
|
1078 |
qed "lemma_st_part1a"; |
|
1079 |
||
1080 |
Goal "(t + -r <= x) = (-(x + -t) <= (r::hypreal))"; |
|
1081 |
by Auto_tac; |
|
1082 |
qed "lemma_hypreal_le_swap2"; |
|
1083 |
||
1084 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1085 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1086 |
\ r: Reals; 0 < r |] \ |
10751 | 1087 |
\ ==> -(x + -t) <= r"; |
1088 |
by (blast_tac (claset() addSIs [lemma_hypreal_le_swap2 RS iffD1, |
|
1089 |
lemma_st_part_le2]) 1); |
|
1090 |
qed "lemma_st_part2a"; |
|
1091 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1092 |
Goal "(x::hypreal): Reals ==> isUb Reals {s. s: Reals & s < x} x"; |
10751 | 1093 |
by (auto_tac (claset() addIs [isUbI, setleI,order_less_imp_le], simpset())); |
1094 |
qed "lemma_SReal_ub"; |
|
1095 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1096 |
Goal "(x::hypreal): Reals ==> isLub Reals {s. s: Reals & s < x} x"; |
10751 | 1097 |
by (auto_tac (claset() addSIs [isLubI2,lemma_SReal_ub,setgeI], simpset())); |
1098 |
by (forward_tac [isUbD2a] 1); |
|
1099 |
by (res_inst_tac [("x","x"),("y","y")] hypreal_linear_less2 1); |
|
1100 |
by (auto_tac (claset() addSIs [order_less_imp_le], simpset())); |
|
1101 |
by (EVERY1[dtac SReal_dense, assume_tac, assume_tac, Step_tac]); |
|
1102 |
by (dres_inst_tac [("y","r")] isUbD 1); |
|
1103 |
by (auto_tac (claset() addDs [order_less_le_trans], simpset())); |
|
1104 |
qed "lemma_SReal_lub"; |
|
1105 |
||
1106 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1107 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1108 |
\ r: Reals; 0 < r |] \ |
10751 | 1109 |
\ ==> x + -t ~= r"; |
1110 |
by Auto_tac; |
|
1111 |
by (forward_tac [isLubD1a RS SReal_minus] 1); |
|
1112 |
by (dtac SReal_add_cancel 1 THEN assume_tac 1); |
|
1113 |
by (dres_inst_tac [("x","x")] lemma_SReal_lub 1); |
|
1114 |
by (dtac hypreal_isLub_unique 1 THEN assume_tac 1); |
|
1115 |
by Auto_tac; |
|
1116 |
qed "lemma_st_part_not_eq1"; |
|
1117 |
||
1118 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1119 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1120 |
\ r: Reals; 0 < r |] \ |
10751 | 1121 |
\ ==> -(x + -t) ~= r"; |
1122 |
by (auto_tac (claset(), simpset() addsimps [hypreal_minus_add_distrib])); |
|
1123 |
by (forward_tac [isLubD1a] 1); |
|
1124 |
by (dtac SReal_add_cancel 1 THEN assume_tac 1); |
|
1125 |
by (dres_inst_tac [("x","-x")] SReal_minus 1); |
|
1126 |
by (Asm_full_simp_tac 1); |
|
1127 |
by (dres_inst_tac [("x","x")] lemma_SReal_lub 1); |
|
1128 |
by (dtac hypreal_isLub_unique 1 THEN assume_tac 1); |
|
1129 |
by Auto_tac; |
|
1130 |
qed "lemma_st_part_not_eq2"; |
|
1131 |
||
1132 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1133 |
\ isLub Reals {s. s: Reals & s < x} t; \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1134 |
\ r: Reals; 0 < r |] \ |
10751 | 1135 |
\ ==> abs (x + -t) < r"; |
1136 |
by (forward_tac [lemma_st_part1a] 1); |
|
1137 |
by (forward_tac [lemma_st_part2a] 4); |
|
1138 |
by Auto_tac; |
|
1139 |
by (REPEAT(dtac order_le_imp_less_or_eq 1)); |
|
1140 |
by (auto_tac (claset() addDs [lemma_st_part_not_eq1, |
|
1141 |
lemma_st_part_not_eq2], simpset() addsimps [hrabs_interval_iff2])); |
|
1142 |
qed "lemma_st_part_major"; |
|
1143 |
||
1144 |
Goal "[| x: HFinite; \ |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1145 |
\ isLub Reals {s. s: Reals & s < x} t |] \ |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1146 |
\ ==> ALL r: Reals. 0 < r --> abs (x + -t) < r"; |
10751 | 1147 |
by (blast_tac (claset() addSDs [lemma_st_part_major]) 1); |
1148 |
qed "lemma_st_part_major2"; |
|
1149 |
||
1150 |
(*---------------------------------------------- |
|
1151 |
Existence of real and Standard Part Theorem |
|
1152 |
----------------------------------------------*) |
|
1153 |
Goal "x: HFinite ==> \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1154 |
\ EX t: Reals. ALL r: Reals. 0 < r --> abs (x + -t) < r"; |
10751 | 1155 |
by (forward_tac [lemma_st_part_lub] 1 THEN Step_tac 1); |
1156 |
by (forward_tac [isLubD1a] 1); |
|
1157 |
by (blast_tac (claset() addDs [lemma_st_part_major2]) 1); |
|
1158 |
qed "lemma_st_part_Ex"; |
|
1159 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1160 |
Goalw [approx_def,Infinitesimal_def] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1161 |
"x:HFinite ==> EX t: Reals. x @= t"; |
10751 | 1162 |
by (dtac lemma_st_part_Ex 1); |
1163 |
by Auto_tac; |
|
1164 |
qed "st_part_Ex"; |
|
1165 |
||
1166 |
(*-------------------------------- |
|
1167 |
Unique real infinitely close |
|
1168 |
-------------------------------*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1169 |
Goal "x:HFinite ==> EX! t. t: Reals & x @= t"; |
10751 | 1170 |
by (dtac st_part_Ex 1 THEN Step_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1171 |
by (dtac approx_sym 2 THEN dtac approx_sym 2 |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1172 |
THEN dtac approx_sym 2); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1173 |
by (auto_tac (claset() addSIs [approx_unique_real], simpset())); |
10751 | 1174 |
qed "st_part_Ex1"; |
1175 |
||
1176 |
(*------------------------------------------------------------------ |
|
1177 |
Finite and Infinite --- more theorems |
|
1178 |
------------------------------------------------------------------*) |
|
1179 |
||
1180 |
Goalw [HFinite_def,HInfinite_def] "HFinite Int HInfinite = {}"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1181 |
by (auto_tac (claset() addIs [hypreal_less_irrefl] addDs [order_less_trans], |
10751 | 1182 |
simpset())); |
1183 |
qed "HFinite_Int_HInfinite_empty"; |
|
1184 |
Addsimps [HFinite_Int_HInfinite_empty]; |
|
1185 |
||
1186 |
Goal "x: HFinite ==> x ~: HInfinite"; |
|
1187 |
by (EVERY1[Step_tac, dtac IntI, assume_tac]); |
|
1188 |
by Auto_tac; |
|
1189 |
qed "HFinite_not_HInfinite"; |
|
1190 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1191 |
Goalw [HInfinite_def, HFinite_def] "x~: HFinite ==> x: HInfinite"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1192 |
by Auto_tac; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1193 |
by (dres_inst_tac [("x","r + 1")] bspec 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1194 |
by (auto_tac (claset(), simpset() addsimps [SReal_add])); |
10751 | 1195 |
qed "not_HFinite_HInfinite"; |
1196 |
||
1197 |
Goal "x : HInfinite | x : HFinite"; |
|
1198 |
by (blast_tac (claset() addIs [not_HFinite_HInfinite]) 1); |
|
1199 |
qed "HInfinite_HFinite_disj"; |
|
1200 |
||
1201 |
Goal "(x : HInfinite) = (x ~: HFinite)"; |
|
1202 |
by (blast_tac (claset() addDs [HFinite_not_HInfinite, |
|
1203 |
not_HFinite_HInfinite]) 1); |
|
1204 |
qed "HInfinite_HFinite_iff"; |
|
1205 |
||
1206 |
Goal "(x : HFinite) = (x ~: HInfinite)"; |
|
1207 |
by (simp_tac (simpset() addsimps [HInfinite_HFinite_iff]) 1); |
|
1208 |
qed "HFinite_HInfinite_iff"; |
|
1209 |
||
1210 |
(*------------------------------------------------------------------ |
|
1211 |
Finite, Infinite and Infinitesimal --- more theorems |
|
1212 |
------------------------------------------------------------------*) |
|
1213 |
||
1214 |
Goal "x ~: Infinitesimal ==> x : HInfinite | x : HFinite - Infinitesimal"; |
|
1215 |
by (fast_tac (claset() addIs [not_HFinite_HInfinite]) 1); |
|
1216 |
qed "HInfinite_diff_HFinite_Infinitesimal_disj"; |
|
1217 |
||
1218 |
Goal "[| x : HFinite; x ~: Infinitesimal |] ==> inverse x : HFinite"; |
|
1219 |
by (cut_inst_tac [("x","inverse x")] HInfinite_HFinite_disj 1); |
|
1220 |
by (auto_tac (claset() addSDs [HInfinite_inverse_Infinitesimal], simpset())); |
|
1221 |
qed "HFinite_inverse"; |
|
1222 |
||
1223 |
Goal "x : HFinite - Infinitesimal ==> inverse x : HFinite"; |
|
1224 |
by (blast_tac (claset() addIs [HFinite_inverse]) 1); |
|
1225 |
qed "HFinite_inverse2"; |
|
1226 |
||
1227 |
(* stronger statement possible in fact *) |
|
1228 |
Goal "x ~: Infinitesimal ==> inverse(x) : HFinite"; |
|
1229 |
by (dtac HInfinite_diff_HFinite_Infinitesimal_disj 1); |
|
1230 |
by (blast_tac (claset() addIs [HFinite_inverse, |
|
1231 |
HInfinite_inverse_Infinitesimal, |
|
1232 |
Infinitesimal_subset_HFinite RS subsetD]) 1); |
|
1233 |
qed "Infinitesimal_inverse_HFinite"; |
|
1234 |
||
1235 |
Goal "x : HFinite - Infinitesimal ==> inverse x : HFinite - Infinitesimal"; |
|
1236 |
by (auto_tac (claset() addIs [Infinitesimal_inverse_HFinite], simpset())); |
|
1237 |
by (dtac Infinitesimal_HFinite_mult2 1); |
|
1238 |
by (assume_tac 1); |
|
1239 |
by (asm_full_simp_tac |
|
1240 |
(simpset() addsimps [not_Infinitesimal_not_zero, hypreal_mult_inverse]) 1); |
|
1241 |
qed "HFinite_not_Infinitesimal_inverse"; |
|
1242 |
||
1243 |
Goal "[| x @= y; y : HFinite - Infinitesimal |] \ |
|
1244 |
\ ==> inverse x @= inverse y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1245 |
by (forward_tac [HFinite_diff_Infinitesimal_approx] 1); |
10751 | 1246 |
by (assume_tac 1); |
1247 |
by (forward_tac [not_Infinitesimal_not_zero2] 1); |
|
1248 |
by (forw_inst_tac [("x","x")] not_Infinitesimal_not_zero2 1); |
|
1249 |
by (REPEAT(dtac HFinite_inverse2 1)); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1250 |
by (dtac approx_mult2 1 THEN assume_tac 1); |
10751 | 1251 |
by Auto_tac; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1252 |
by (dres_inst_tac [("c","inverse x")] approx_mult1 1 |
10751 | 1253 |
THEN assume_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1254 |
by (auto_tac (claset() addIs [approx_sym], |
10751 | 1255 |
simpset() addsimps [hypreal_mult_assoc])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1256 |
qed "approx_inverse"; |
10751 | 1257 |
|
1258 |
(*Used for NSLIM_inverse, NSLIMSEQ_inverse*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1259 |
bind_thm ("hypreal_of_real_approx_inverse", |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1260 |
hypreal_of_real_HFinite_diff_Infinitesimal RSN (2, approx_inverse)); |
10751 | 1261 |
|
1262 |
Goal "[| x: HFinite - Infinitesimal; \ |
|
1263 |
\ h : Infinitesimal |] ==> inverse(x + h) @= inverse x"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1264 |
by (auto_tac (claset() addIs [approx_inverse, approx_sym, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1265 |
Infinitesimal_add_approx_self], |
10751 | 1266 |
simpset())); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1267 |
qed "inverse_add_Infinitesimal_approx"; |
10751 | 1268 |
|
1269 |
Goal "[| x: HFinite - Infinitesimal; \ |
|
1270 |
\ h : Infinitesimal |] ==> inverse(h + x) @= inverse x"; |
|
1271 |
by (rtac (hypreal_add_commute RS subst) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1272 |
by (blast_tac (claset() addIs [inverse_add_Infinitesimal_approx]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1273 |
qed "inverse_add_Infinitesimal_approx2"; |
10751 | 1274 |
|
1275 |
Goal "[| x : HFinite - Infinitesimal; \ |
|
1276 |
\ h : Infinitesimal |] ==> inverse(x + h) + -inverse x @= h"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1277 |
by (rtac approx_trans2 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1278 |
by (auto_tac (claset() addIs [inverse_add_Infinitesimal_approx], |
10751 | 1279 |
simpset() addsimps [mem_infmal_iff, |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1280 |
approx_minus_iff RS sym])); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1281 |
qed "inverse_add_Infinitesimal_approx_Infinitesimal"; |
10751 | 1282 |
|
1283 |
Goal "(x : Infinitesimal) = (x*x : Infinitesimal)"; |
|
1284 |
by (auto_tac (claset() addIs [Infinitesimal_mult], simpset())); |
|
1285 |
by (rtac ccontr 1 THEN forward_tac [Infinitesimal_inverse_HFinite] 1); |
|
1286 |
by (forward_tac [not_Infinitesimal_not_zero] 1); |
|
1287 |
by (auto_tac (claset() addDs [Infinitesimal_HFinite_mult], |
|
1288 |
simpset() addsimps [hypreal_mult_assoc])); |
|
1289 |
qed "Infinitesimal_square_iff"; |
|
1290 |
Addsimps [Infinitesimal_square_iff RS sym]; |
|
1291 |
||
1292 |
Goal "(x*x : HFinite) = (x : HFinite)"; |
|
1293 |
by (auto_tac (claset() addIs [HFinite_mult], simpset())); |
|
1294 |
by (auto_tac (claset() addDs [HInfinite_mult], |
|
1295 |
simpset() addsimps [HFinite_HInfinite_iff])); |
|
1296 |
qed "HFinite_square_iff"; |
|
1297 |
Addsimps [HFinite_square_iff]; |
|
1298 |
||
1299 |
Goal "(x*x : HInfinite) = (x : HInfinite)"; |
|
1300 |
by (auto_tac (claset(), simpset() addsimps |
|
1301 |
[HInfinite_HFinite_iff])); |
|
1302 |
qed "HInfinite_square_iff"; |
|
1303 |
Addsimps [HInfinite_square_iff]; |
|
1304 |
||
1305 |
Goal "[| a: HFinite-Infinitesimal; a* w @= a*z |] ==> w @= z"; |
|
1306 |
by (Step_tac 1); |
|
1307 |
by (ftac HFinite_inverse 1 THEN assume_tac 1); |
|
1308 |
by (dtac not_Infinitesimal_not_zero 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1309 |
by (auto_tac (claset() addDs [approx_mult2], |
10751 | 1310 |
simpset() addsimps [hypreal_mult_assoc RS sym])); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1311 |
qed "approx_HFinite_mult_cancel"; |
10751 | 1312 |
|
1313 |
Goal "a: HFinite-Infinitesimal ==> (a * w @= a * z) = (w @= z)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1314 |
by (auto_tac (claset() addIs [approx_mult2, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1315 |
approx_HFinite_mult_cancel], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1316 |
qed "approx_HFinite_mult_cancel_iff1"; |
10751 | 1317 |
|
1318 |
(*------------------------------------------------------------------ |
|
1319 |
more about absolute value (hrabs) |
|
1320 |
------------------------------------------------------------------*) |
|
1321 |
||
1322 |
Goal "abs x @= x | abs x @= -x"; |
|
1323 |
by (cut_inst_tac [("x","x")] hrabs_disj 1); |
|
1324 |
by Auto_tac; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1325 |
qed "approx_hrabs_disj"; |
10751 | 1326 |
|
1327 |
(*------------------------------------------------------------------ |
|
1328 |
Theorems about monads |
|
1329 |
------------------------------------------------------------------*) |
|
1330 |
||
1331 |
Goal "monad (abs x) <= monad(x) Un monad(-x)"; |
|
1332 |
by (res_inst_tac [("x1","x")] (hrabs_disj RS disjE) 1); |
|
1333 |
by Auto_tac; |
|
1334 |
qed "monad_hrabs_Un_subset"; |
|
1335 |
||
1336 |
Goal "e : Infinitesimal ==> monad (x+e) = monad x"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1337 |
by (fast_tac (claset() addSIs [Infinitesimal_add_approx_self RS approx_sym, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1338 |
approx_monad_iff RS iffD1]) 1); |
10751 | 1339 |
qed "Infinitesimal_monad_eq"; |
1340 |
||
1341 |
Goalw [monad_def] "(u:monad x) = (-u:monad (-x))"; |
|
1342 |
by Auto_tac; |
|
1343 |
qed "mem_monad_iff"; |
|
1344 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1345 |
Goalw [monad_def] "(x:Infinitesimal) = (x:monad 0)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1346 |
by (auto_tac (claset() addIs [approx_sym], |
10751 | 1347 |
simpset() addsimps [mem_infmal_iff])); |
1348 |
qed "Infinitesimal_monad_zero_iff"; |
|
1349 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1350 |
Goal "(x:monad 0) = (-x:monad 0)"; |
10751 | 1351 |
by (simp_tac (simpset() addsimps [Infinitesimal_monad_zero_iff RS sym]) 1); |
1352 |
qed "monad_zero_minus_iff"; |
|
1353 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1354 |
Goal "(x:monad 0) = (abs x:monad 0)"; |
10751 | 1355 |
by (res_inst_tac [("x1","x")] (hrabs_disj RS disjE) 1); |
1356 |
by (auto_tac (claset(), simpset() addsimps [monad_zero_minus_iff RS sym])); |
|
1357 |
qed "monad_zero_hrabs_iff"; |
|
1358 |
||
1359 |
Goalw [monad_def] "x:monad x"; |
|
1360 |
by (Simp_tac 1); |
|
1361 |
qed "mem_monad_self"; |
|
1362 |
Addsimps [mem_monad_self]; |
|
1363 |
||
1364 |
(*------------------------------------------------------------------ |
|
1365 |
Proof that x @= y ==> abs x @= abs y |
|
1366 |
------------------------------------------------------------------*) |
|
1367 |
Goal "x @= y ==> {x,y}<=monad x"; |
|
1368 |
by (Simp_tac 1); |
|
1369 |
by (asm_full_simp_tac (simpset() addsimps |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1370 |
[approx_monad_iff]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1371 |
qed "approx_subset_monad"; |
10751 | 1372 |
|
1373 |
Goal "x @= y ==> {x,y}<=monad y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1374 |
by (dtac approx_sym 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1375 |
by (fast_tac (claset() addDs [approx_subset_monad]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1376 |
qed "approx_subset_monad2"; |
10751 | 1377 |
|
1378 |
Goalw [monad_def] "u:monad x ==> x @= u"; |
|
1379 |
by (Fast_tac 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1380 |
qed "mem_monad_approx"; |
10751 | 1381 |
|
1382 |
Goalw [monad_def] "x @= u ==> u:monad x"; |
|
1383 |
by (Fast_tac 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1384 |
qed "approx_mem_monad"; |
10751 | 1385 |
|
1386 |
Goalw [monad_def] "x @= u ==> x:monad u"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1387 |
by (blast_tac (claset() addSIs [approx_sym]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1388 |
qed "approx_mem_monad2"; |
10751 | 1389 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1390 |
Goal "[| x @= y;x:monad 0 |] ==> y:monad 0"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1391 |
by (dtac mem_monad_approx 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1392 |
by (fast_tac (claset() addIs [approx_mem_monad,approx_trans]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1393 |
qed "approx_mem_monad_zero"; |
10751 | 1394 |
|
1395 |
Goal "[| x @= y; x: Infinitesimal |] ==> abs x @= abs y"; |
|
1396 |
by (dtac (Infinitesimal_monad_zero_iff RS iffD1) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1397 |
by (blast_tac (claset() addIs [approx_mem_monad_zero, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1398 |
monad_zero_hrabs_iff RS iffD1, mem_monad_approx, approx_trans3]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1399 |
qed "Infinitesimal_approx_hrabs"; |
10751 | 1400 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1401 |
Goal "[| 0 < x; x ~:Infinitesimal; e :Infinitesimal |] ==> e < x"; |
10751 | 1402 |
by (rtac ccontr 1); |
1403 |
by (auto_tac (claset() |
|
1404 |
addIs [Infinitesimal_zero RSN (2, Infinitesimal_interval)] |
|
1405 |
addSDs [hypreal_leI, order_le_imp_less_or_eq], |
|
1406 |
simpset())); |
|
1407 |
qed "less_Infinitesimal_less"; |
|
1408 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1409 |
Goal "[| 0 < x; x ~: Infinitesimal; u: monad x |] ==> 0 < u"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1410 |
by (dtac (mem_monad_approx RS approx_sym) 1); |
10751 | 1411 |
by (etac (bex_Infinitesimal_iff2 RS iffD2 RS bexE) 1); |
1412 |
by (dres_inst_tac [("e","-xa")] less_Infinitesimal_less 1); |
|
1413 |
by Auto_tac; |
|
1414 |
qed "Ball_mem_monad_gt_zero"; |
|
1415 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1416 |
Goal "[| x < 0; x ~: Infinitesimal; u: monad x |] ==> u < 0"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1417 |
by (dtac (mem_monad_approx RS approx_sym) 1); |
10751 | 1418 |
by (etac (bex_Infinitesimal_iff RS iffD2 RS bexE) 1); |
1419 |
by (cut_inst_tac [("x","-x"),("e","xa")] less_Infinitesimal_less 1); |
|
1420 |
by Auto_tac; |
|
1421 |
qed "Ball_mem_monad_less_zero"; |
|
1422 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1423 |
Goal "[|0 < x; x ~: Infinitesimal; x @= y|] ==> 0 < y"; |
10751 | 1424 |
by (blast_tac (claset() addDs [Ball_mem_monad_gt_zero, |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1425 |
approx_subset_monad]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1426 |
qed "lemma_approx_gt_zero"; |
10751 | 1427 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1428 |
Goal "[|x < 0; x ~: Infinitesimal; x @= y|] ==> y < 0"; |
10751 | 1429 |
by (blast_tac (claset() addDs [Ball_mem_monad_less_zero, |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1430 |
approx_subset_monad]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1431 |
qed "lemma_approx_less_zero"; |
10751 | 1432 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1433 |
Goal "[| x @= y; x < 0; x ~: Infinitesimal |] ==> abs x @= abs y"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1434 |
by (forward_tac [lemma_approx_less_zero] 1); |
10751 | 1435 |
by (REPEAT(assume_tac 1)); |
1436 |
by (REPEAT(dtac hrabs_minus_eqI2 1)); |
|
1437 |
by Auto_tac; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1438 |
qed "approx_hrabs1"; |
10751 | 1439 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1440 |
Goal "[| x @= y; 0 < x; x ~: Infinitesimal |] ==> abs x @= abs y"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1441 |
by (forward_tac [lemma_approx_gt_zero] 1); |
10751 | 1442 |
by (REPEAT(assume_tac 1)); |
1443 |
by (REPEAT(dtac hrabs_eqI2 1)); |
|
1444 |
by Auto_tac; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1445 |
qed "approx_hrabs2"; |
10751 | 1446 |
|
1447 |
Goal "x @= y ==> abs x @= abs y"; |
|
1448 |
by (res_inst_tac [("Q","x:Infinitesimal")] (excluded_middle RS disjE) 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1449 |
by (res_inst_tac [("x1","x"),("y1","0")] (hypreal_linear RS disjE) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1450 |
by (auto_tac (claset() addIs [approx_hrabs1,approx_hrabs2, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1451 |
Infinitesimal_approx_hrabs], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1452 |
qed "approx_hrabs"; |
10751 | 1453 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1454 |
Goal "abs(x) @= 0 ==> x @= 0"; |
10751 | 1455 |
by (cut_inst_tac [("x","x")] hrabs_disj 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1456 |
by (auto_tac (claset() addDs [approx_minus], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1457 |
qed "approx_hrabs_zero_cancel"; |
10751 | 1458 |
|
1459 |
Goal "e: Infinitesimal ==> abs x @= abs(x+e)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1460 |
by (fast_tac (claset() addIs [approx_hrabs, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1461 |
Infinitesimal_add_approx_self]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1462 |
qed "approx_hrabs_add_Infinitesimal"; |
10751 | 1463 |
|
1464 |
Goal "e: Infinitesimal ==> abs x @= abs(x + -e)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1465 |
by (fast_tac (claset() addIs [approx_hrabs, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1466 |
Infinitesimal_add_minus_approx_self]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1467 |
qed "approx_hrabs_add_minus_Infinitesimal"; |
10751 | 1468 |
|
1469 |
Goal "[| e: Infinitesimal; e': Infinitesimal; \ |
|
1470 |
\ abs(x+e) = abs(y+e')|] ==> abs x @= abs y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1471 |
by (dres_inst_tac [("x","x")] approx_hrabs_add_Infinitesimal 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1472 |
by (dres_inst_tac [("x","y")] approx_hrabs_add_Infinitesimal 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1473 |
by (auto_tac (claset() addIs [approx_trans2], simpset())); |
10751 | 1474 |
qed "hrabs_add_Infinitesimal_cancel"; |
1475 |
||
1476 |
Goal "[| e: Infinitesimal; e': Infinitesimal; \ |
|
1477 |
\ abs(x + -e) = abs(y + -e')|] ==> abs x @= abs y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1478 |
by (dres_inst_tac [("x","x")] approx_hrabs_add_minus_Infinitesimal 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1479 |
by (dres_inst_tac [("x","y")] approx_hrabs_add_minus_Infinitesimal 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1480 |
by (auto_tac (claset() addIs [approx_trans2], simpset())); |
10751 | 1481 |
qed "hrabs_add_minus_Infinitesimal_cancel"; |
1482 |
||
1483 |
(* interesting slightly counterintuitive theorem: necessary |
|
1484 |
for proving that an open interval is an NS open set |
|
1485 |
*) |
|
1486 |
Goalw [Infinitesimal_def] |
|
1487 |
"[| x < y; u: Infinitesimal |] \ |
|
1488 |
\ ==> hypreal_of_real x + u < hypreal_of_real y"; |
|
1489 |
by (dtac (hypreal_of_real_less_iff RS iffD2) 1); |
|
1490 |
by (dtac (hypreal_less_minus_iff RS iffD1) 1 THEN Step_tac 1); |
|
1491 |
by (rtac (hypreal_less_minus_iff RS iffD2) 1); |
|
1492 |
by (dres_inst_tac [("x","hypreal_of_real y + -hypreal_of_real x")] bspec 1); |
|
1493 |
by (auto_tac (claset(), |
|
1494 |
simpset() addsimps [hypreal_add_commute, |
|
1495 |
hrabs_interval_iff, |
|
1496 |
SReal_add, SReal_minus])); |
|
1497 |
qed "Infinitesimal_add_hypreal_of_real_less"; |
|
1498 |
||
1499 |
Goal "[| x: Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] \ |
|
1500 |
\ ==> abs (hypreal_of_real r + x) < hypreal_of_real y"; |
|
1501 |
by (dres_inst_tac [("x","hypreal_of_real r")] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1502 |
approx_hrabs_add_Infinitesimal 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1503 |
by (dtac (approx_sym RS (bex_Infinitesimal_iff2 RS iffD2)) 1); |
10751 | 1504 |
by (auto_tac (claset() addSIs [Infinitesimal_add_hypreal_of_real_less], |
1505 |
simpset() addsimps [hypreal_of_real_hrabs])); |
|
1506 |
qed "Infinitesimal_add_hrabs_hypreal_of_real_less"; |
|
1507 |
||
1508 |
Goal "[| x: Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] \ |
|
1509 |
\ ==> abs (x + hypreal_of_real r) < hypreal_of_real y"; |
|
1510 |
by (rtac (hypreal_add_commute RS subst) 1); |
|
1511 |
by (etac Infinitesimal_add_hrabs_hypreal_of_real_less 1); |
|
1512 |
by (assume_tac 1); |
|
1513 |
qed "Infinitesimal_add_hrabs_hypreal_of_real_less2"; |
|
1514 |
||
1515 |
Goalw [hypreal_le_def] |
|
1516 |
"[| u: Infinitesimal; hypreal_of_real x + u <= hypreal_of_real y |] \ |
|
1517 |
\ ==> hypreal_of_real x <= hypreal_of_real y"; |
|
1518 |
by (EVERY1 [rtac notI, rtac contrapos_np, assume_tac]); |
|
1519 |
by (res_inst_tac [("C","-u")] hypreal_less_add_right_cancel 1); |
|
1520 |
by (Asm_full_simp_tac 1); |
|
1521 |
by (dtac (Infinitesimal_minus_iff RS iffD2) 1); |
|
1522 |
by (dtac Infinitesimal_add_hypreal_of_real_less 1); |
|
1523 |
by (assume_tac 1); |
|
1524 |
by Auto_tac; |
|
1525 |
qed "Infinitesimal_add_cancel_hypreal_of_real_le"; |
|
1526 |
||
1527 |
Goal "[| u: Infinitesimal; hypreal_of_real x + u <= hypreal_of_real y |] \ |
|
1528 |
\ ==> x <= y"; |
|
1529 |
by (blast_tac (claset() addSIs [hypreal_of_real_le_iff RS iffD1, |
|
1530 |
Infinitesimal_add_cancel_hypreal_of_real_le]) 1); |
|
1531 |
qed "Infinitesimal_add_cancel_real_le"; |
|
1532 |
||
1533 |
Goal "[| u: Infinitesimal; v: Infinitesimal; \ |
|
1534 |
\ hypreal_of_real x + u <= hypreal_of_real y + v |] \ |
|
1535 |
\ ==> hypreal_of_real x <= hypreal_of_real y"; |
|
1536 |
by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
|
1537 |
by Auto_tac; |
|
1538 |
by (dres_inst_tac [("u","v-u")] Infinitesimal_add_hypreal_of_real_less 1); |
|
1539 |
by (auto_tac (claset(), simpset() addsimps [Infinitesimal_diff])); |
|
1540 |
qed "hypreal_of_real_le_add_Infininitesimal_cancel"; |
|
1541 |
||
1542 |
Goal "[| u: Infinitesimal; v: Infinitesimal; \ |
|
1543 |
\ hypreal_of_real x + u <= hypreal_of_real y + v |] \ |
|
1544 |
\ ==> x <= y"; |
|
1545 |
by (blast_tac (claset() addSIs [hypreal_of_real_le_iff RS iffD1, |
|
1546 |
hypreal_of_real_le_add_Infininitesimal_cancel]) 1); |
|
1547 |
qed "hypreal_of_real_le_add_Infininitesimal_cancel2"; |
|
1548 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1549 |
Goal "[| hypreal_of_real x < e; e: Infinitesimal |] ==> hypreal_of_real x <= 0"; |
10751 | 1550 |
by (rtac hypreal_leI 1 THEN Step_tac 1); |
1551 |
by (dtac Infinitesimal_interval 1); |
|
1552 |
by (dtac (SReal_hypreal_of_real RS SReal_Infinitesimal_zero) 4); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1553 |
by Auto_tac; |
10751 | 1554 |
qed "hypreal_of_real_less_Infinitesimal_le_zero"; |
1555 |
||
1556 |
(*used once, in NSDERIV_inverse*) |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1557 |
Goal "[| h: Infinitesimal; x ~= 0 |] ==> hypreal_of_real x + h ~= 0"; |
10751 | 1558 |
by Auto_tac; |
1559 |
qed "Infinitesimal_add_not_zero"; |
|
1560 |
||
1561 |
Goal "x*x + y*y : Infinitesimal ==> x*x : Infinitesimal"; |
|
1562 |
by (rtac Infinitesimal_interval2 1); |
|
1563 |
by (rtac hypreal_le_square 3); |
|
1564 |
by (rtac hypreal_self_le_add_pos 3); |
|
1565 |
by Auto_tac; |
|
1566 |
qed "Infinitesimal_square_cancel"; |
|
1567 |
Addsimps [Infinitesimal_square_cancel]; |
|
1568 |
||
1569 |
Goal "x*x + y*y : HFinite ==> x*x : HFinite"; |
|
1570 |
by (rtac HFinite_bounded 1); |
|
1571 |
by (rtac hypreal_self_le_add_pos 2); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1572 |
by (rtac (hypreal_le_square) 2); |
10751 | 1573 |
by (assume_tac 1); |
1574 |
qed "HFinite_square_cancel"; |
|
1575 |
Addsimps [HFinite_square_cancel]; |
|
1576 |
||
1577 |
Goal "x*x + y*y : Infinitesimal ==> y*y : Infinitesimal"; |
|
1578 |
by (rtac Infinitesimal_square_cancel 1); |
|
1579 |
by (rtac (hypreal_add_commute RS subst) 1); |
|
1580 |
by (Simp_tac 1); |
|
1581 |
qed "Infinitesimal_square_cancel2"; |
|
1582 |
Addsimps [Infinitesimal_square_cancel2]; |
|
1583 |
||
1584 |
Goal "x*x + y*y : HFinite ==> y*y : HFinite"; |
|
1585 |
by (rtac HFinite_square_cancel 1); |
|
1586 |
by (rtac (hypreal_add_commute RS subst) 1); |
|
1587 |
by (Simp_tac 1); |
|
1588 |
qed "HFinite_square_cancel2"; |
|
1589 |
Addsimps [HFinite_square_cancel2]; |
|
1590 |
||
1591 |
Goal "x*x + y*y + z*z : Infinitesimal ==> x*x : Infinitesimal"; |
|
1592 |
by (blast_tac (claset() addIs [hypreal_self_le_add_pos2, |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1593 |
Infinitesimal_interval2, hypreal_le_square]) 1); |
10751 | 1594 |
qed "Infinitesimal_sum_square_cancel"; |
1595 |
Addsimps [Infinitesimal_sum_square_cancel]; |
|
1596 |
||
1597 |
Goal "x*x + y*y + z*z : HFinite ==> x*x : HFinite"; |
|
1598 |
by (blast_tac (claset() addIs [hypreal_self_le_add_pos2, HFinite_bounded, |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1599 |
hypreal_le_square, |
10751 | 1600 |
HFinite_number_of]) 1); |
1601 |
qed "HFinite_sum_square_cancel"; |
|
1602 |
Addsimps [HFinite_sum_square_cancel]; |
|
1603 |
||
1604 |
Goal "y*y + x*x + z*z : Infinitesimal ==> x*x : Infinitesimal"; |
|
1605 |
by (rtac Infinitesimal_sum_square_cancel 1); |
|
1606 |
by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
1607 |
qed "Infinitesimal_sum_square_cancel2"; |
|
1608 |
Addsimps [Infinitesimal_sum_square_cancel2]; |
|
1609 |
||
1610 |
Goal "y*y + x*x + z*z : HFinite ==> x*x : HFinite"; |
|
1611 |
by (rtac HFinite_sum_square_cancel 1); |
|
1612 |
by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
1613 |
qed "HFinite_sum_square_cancel2"; |
|
1614 |
Addsimps [HFinite_sum_square_cancel2]; |
|
1615 |
||
1616 |
Goal "z*z + y*y + x*x : Infinitesimal ==> x*x : Infinitesimal"; |
|
1617 |
by (rtac Infinitesimal_sum_square_cancel 1); |
|
1618 |
by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
1619 |
qed "Infinitesimal_sum_square_cancel3"; |
|
1620 |
Addsimps [Infinitesimal_sum_square_cancel3]; |
|
1621 |
||
1622 |
Goal "z*z + y*y + x*x : HFinite ==> x*x : HFinite"; |
|
1623 |
by (rtac HFinite_sum_square_cancel 1); |
|
1624 |
by (asm_full_simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
1625 |
qed "HFinite_sum_square_cancel3"; |
|
1626 |
Addsimps [HFinite_sum_square_cancel3]; |
|
1627 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1628 |
Goal "[| y: monad x; 0 < hypreal_of_real e |] \ |
10751 | 1629 |
\ ==> abs (y + -x) < hypreal_of_real e"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1630 |
by (dtac (mem_monad_approx RS approx_sym) 1); |
10751 | 1631 |
by (dtac (bex_Infinitesimal_iff RS iffD2) 1); |
1632 |
by (auto_tac (claset() addSDs [InfinitesimalD], simpset())); |
|
1633 |
qed "monad_hrabs_less"; |
|
1634 |
||
1635 |
Goal "x: monad (hypreal_of_real a) ==> x: HFinite"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1636 |
by (dtac (mem_monad_approx RS approx_sym) 1); |
10751 | 1637 |
by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1); |
1638 |
by (step_tac (claset() addSDs |
|
1639 |
[Infinitesimal_subset_HFinite RS subsetD]) 1); |
|
1640 |
by (etac (SReal_hypreal_of_real RS (SReal_subset_HFinite |
|
1641 |
RS subsetD) RS HFinite_add) 1); |
|
1642 |
qed "mem_monad_SReal_HFinite"; |
|
1643 |
||
1644 |
(*------------------------------------------------------------------ |
|
1645 |
Theorems about standard part |
|
1646 |
------------------------------------------------------------------*) |
|
1647 |
||
1648 |
Goalw [st_def] "x: HFinite ==> st x @= x"; |
|
1649 |
by (forward_tac [st_part_Ex] 1 THEN Step_tac 1); |
|
1650 |
by (rtac someI2 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1651 |
by (auto_tac (claset() addIs [approx_sym], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1652 |
qed "st_approx_self"; |
10751 | 1653 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1654 |
Goalw [st_def] "x: HFinite ==> st x: Reals"; |
10751 | 1655 |
by (forward_tac [st_part_Ex] 1 THEN Step_tac 1); |
1656 |
by (rtac someI2 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1657 |
by (auto_tac (claset() addIs [approx_sym], simpset())); |
10751 | 1658 |
qed "st_SReal"; |
1659 |
||
1660 |
Goal "x: HFinite ==> st x: HFinite"; |
|
1661 |
by (etac (st_SReal RS (SReal_subset_HFinite RS subsetD)) 1); |
|
1662 |
qed "st_HFinite"; |
|
1663 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1664 |
Goalw [st_def] "x: Reals ==> st x = x"; |
10751 | 1665 |
by (rtac some_equality 1); |
1666 |
by (fast_tac (claset() addIs [(SReal_subset_HFinite RS subsetD)]) 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1667 |
by (blast_tac (claset() addDs [SReal_approx_iff RS iffD1]) 1); |
10751 | 1668 |
qed "st_SReal_eq"; |
1669 |
||
1670 |
(* should be added to simpset *) |
|
1671 |
Goal "st (hypreal_of_real x) = hypreal_of_real x"; |
|
1672 |
by (rtac (SReal_hypreal_of_real RS st_SReal_eq) 1); |
|
1673 |
qed "st_hypreal_of_real"; |
|
1674 |
||
1675 |
Goal "[| x: HFinite; y: HFinite; st x = st y |] ==> x @= y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1676 |
by (auto_tac (claset() addSDs [st_approx_self] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1677 |
addSEs [approx_trans3], simpset())); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1678 |
qed "st_eq_approx"; |
10751 | 1679 |
|
1680 |
Goal "[| x: HFinite; y: HFinite; x @= y |] ==> st x = st y"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1681 |
by (EVERY1 [forward_tac [st_approx_self], |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1682 |
forw_inst_tac [("x","y")] st_approx_self, |
10751 | 1683 |
dtac st_SReal,dtac st_SReal]); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1684 |
by (fast_tac (claset() addEs [approx_trans, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1685 |
approx_trans2,SReal_approx_iff RS iffD1]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1686 |
qed "approx_st_eq"; |
10751 | 1687 |
|
1688 |
Goal "[| x: HFinite; y: HFinite|] \ |
|
1689 |
\ ==> (x @= y) = (st x = st y)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1690 |
by (blast_tac (claset() addIs [approx_st_eq, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1691 |
st_eq_approx]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1692 |
qed "st_eq_approx_iff"; |
10751 | 1693 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1694 |
Goal "[| x: Reals; e: Infinitesimal |] ==> st(x + e) = x"; |
10751 | 1695 |
by (forward_tac [st_SReal_eq RS subst] 1); |
1696 |
by (assume_tac 2); |
|
1697 |
by (forward_tac [SReal_subset_HFinite RS subsetD] 1); |
|
1698 |
by (forward_tac [Infinitesimal_subset_HFinite RS subsetD] 1); |
|
1699 |
by (dtac st_SReal_eq 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1700 |
by (rtac approx_st_eq 1); |
10751 | 1701 |
by (auto_tac (claset() addIs [HFinite_add], |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1702 |
simpset() addsimps [Infinitesimal_add_approx_self |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1703 |
RS approx_sym])); |
10751 | 1704 |
qed "st_Infinitesimal_add_SReal"; |
1705 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1706 |
Goal "[| x: Reals; e: Infinitesimal |] \ |
10751 | 1707 |
\ ==> st(e + x) = x"; |
1708 |
by (rtac (hypreal_add_commute RS subst) 1); |
|
1709 |
by (blast_tac (claset() addSIs [st_Infinitesimal_add_SReal]) 1); |
|
1710 |
qed "st_Infinitesimal_add_SReal2"; |
|
1711 |
||
1712 |
Goal "x: HFinite ==> \ |
|
1713 |
\ EX e: Infinitesimal. x = st(x) + e"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1714 |
by (blast_tac (claset() addSDs [(st_approx_self RS |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1715 |
approx_sym),bex_Infinitesimal_iff2 RS iffD2]) 1); |
10751 | 1716 |
qed "HFinite_st_Infinitesimal_add"; |
1717 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1718 |
Goal "[| x: HFinite; y: HFinite |] ==> st (x + y) = st(x) + st(y)"; |
10751 | 1719 |
by (forward_tac [HFinite_st_Infinitesimal_add] 1); |
1720 |
by (forw_inst_tac [("x","y")] HFinite_st_Infinitesimal_add 1); |
|
1721 |
by (Step_tac 1); |
|
1722 |
by (subgoal_tac "st (x + y) = st ((st x + e) + (st y + ea))" 1); |
|
1723 |
by (dtac sym 2 THEN dtac sym 2); |
|
1724 |
by (Asm_full_simp_tac 2); |
|
1725 |
by (asm_simp_tac (simpset() addsimps hypreal_add_ac) 1); |
|
1726 |
by (REPEAT(dtac st_SReal 1)); |
|
1727 |
by (dtac SReal_add 1 THEN assume_tac 1); |
|
1728 |
by (dtac Infinitesimal_add 1 THEN assume_tac 1); |
|
1729 |
by (rtac (hypreal_add_assoc RS subst) 1); |
|
1730 |
by (blast_tac (claset() addSIs [st_Infinitesimal_add_SReal2]) 1); |
|
1731 |
qed "st_add"; |
|
1732 |
||
1733 |
Goal "st (number_of w) = number_of w"; |
|
1734 |
by (rtac (SReal_number_of RS st_SReal_eq) 1); |
|
1735 |
qed "st_number_of"; |
|
1736 |
Addsimps [st_number_of]; |
|
1737 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1738 |
(*the theorem above for the special cases of zero and one*) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1739 |
Addsimps |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1740 |
(map (simplify (simpset())) |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1741 |
[inst "w" "Pls" st_number_of, inst "w" "Pls BIT True" st_number_of]); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1742 |
|
10751 | 1743 |
Goal "y: HFinite ==> st(-y) = -st(y)"; |
1744 |
by (forward_tac [HFinite_minus_iff RS iffD2] 1); |
|
1745 |
by (rtac hypreal_add_minus_eq_minus 1); |
|
1746 |
by (dtac (st_add RS sym) 1 THEN assume_tac 1); |
|
1747 |
by Auto_tac; |
|
1748 |
qed "st_minus"; |
|
1749 |
||
1750 |
Goalw [hypreal_diff_def] |
|
1751 |
"[| x: HFinite; y: HFinite |] ==> st (x-y) = st(x) - st(y)"; |
|
1752 |
by (forw_inst_tac [("y1","y")] (st_minus RS sym) 1); |
|
1753 |
by (dres_inst_tac [("x1","y")] (HFinite_minus_iff RS iffD2) 1); |
|
1754 |
by (asm_simp_tac (simpset() addsimps [st_add]) 1); |
|
1755 |
qed "st_diff"; |
|
1756 |
||
1757 |
(* lemma *) |
|
1758 |
Goal "[| x: HFinite; y: HFinite; \ |
|
1759 |
\ e: Infinitesimal; \ |
|
1760 |
\ ea : Infinitesimal |] \ |
|
1761 |
\ ==> e*y + x*ea + e*ea: Infinitesimal"; |
|
1762 |
by (forw_inst_tac [("x","e"),("y","y")] Infinitesimal_HFinite_mult 1); |
|
1763 |
by (forw_inst_tac [("x","ea"),("y","x")] Infinitesimal_HFinite_mult 2); |
|
1764 |
by (dtac Infinitesimal_mult 3); |
|
1765 |
by (auto_tac (claset() addIs [Infinitesimal_add], |
|
1766 |
simpset() addsimps hypreal_add_ac @ hypreal_mult_ac)); |
|
1767 |
qed "lemma_st_mult"; |
|
1768 |
||
1769 |
Goal "[| x: HFinite; y: HFinite |] \ |
|
1770 |
\ ==> st (x * y) = st(x) * st(y)"; |
|
1771 |
by (forward_tac [HFinite_st_Infinitesimal_add] 1); |
|
1772 |
by (forw_inst_tac [("x","y")] HFinite_st_Infinitesimal_add 1); |
|
1773 |
by (Step_tac 1); |
|
1774 |
by (subgoal_tac "st (x * y) = st ((st x + e) * (st y + ea))" 1); |
|
1775 |
by (dtac sym 2 THEN dtac sym 2); |
|
1776 |
by (Asm_full_simp_tac 2); |
|
1777 |
by (thin_tac "x = st x + e" 1); |
|
1778 |
by (thin_tac "y = st y + ea" 1); |
|
1779 |
by (asm_full_simp_tac (simpset() addsimps |
|
1780 |
[hypreal_add_mult_distrib,hypreal_add_mult_distrib2]) 1); |
|
1781 |
by (REPEAT(dtac st_SReal 1)); |
|
1782 |
by (full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1); |
|
1783 |
by (rtac st_Infinitesimal_add_SReal 1); |
|
1784 |
by (blast_tac (claset() addSIs [SReal_mult]) 1); |
|
1785 |
by (REPEAT(dtac (SReal_subset_HFinite RS subsetD) 1)); |
|
1786 |
by (rtac (hypreal_add_assoc RS subst) 1); |
|
1787 |
by (blast_tac (claset() addSIs [lemma_st_mult]) 1); |
|
1788 |
qed "st_mult"; |
|
1789 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1790 |
Goal "x: Infinitesimal ==> st x = 0"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1791 |
by (stac (hypreal_numeral_0_eq_0 RS sym) 1); |
10751 | 1792 |
by (rtac (st_number_of RS subst) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1793 |
by (rtac approx_st_eq 1); |
10751 | 1794 |
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD], |
1795 |
simpset() addsimps [mem_infmal_iff RS sym])); |
|
1796 |
qed "st_Infinitesimal"; |
|
1797 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1798 |
Goal "st(x) ~= 0 ==> x ~: Infinitesimal"; |
10751 | 1799 |
by (fast_tac (claset() addIs [st_Infinitesimal]) 1); |
1800 |
qed "st_not_Infinitesimal"; |
|
1801 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1802 |
Goal "[| x: HFinite; st x ~= 0 |] \ |
10751 | 1803 |
\ ==> st(inverse x) = inverse (st x)"; |
1804 |
by (res_inst_tac [("c1","st x")] (hypreal_mult_left_cancel RS iffD1) 1); |
|
1805 |
by (auto_tac (claset(), |
|
1806 |
simpset() addsimps [st_mult RS sym, st_not_Infinitesimal, |
|
1807 |
HFinite_inverse])); |
|
1808 |
by (stac hypreal_mult_inverse 1); |
|
1809 |
by Auto_tac; |
|
1810 |
qed "st_inverse"; |
|
1811 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1812 |
Goal "[| x: HFinite; y: HFinite; st y ~= 0 |] \ |
10751 | 1813 |
\ ==> st(x/y) = (st x) / (st y)"; |
1814 |
by (auto_tac (claset(), |
|
1815 |
simpset() addsimps [hypreal_divide_def, st_mult, st_not_Infinitesimal, |
|
1816 |
HFinite_inverse, st_inverse])); |
|
1817 |
qed "st_divide"; |
|
1818 |
Addsimps [st_divide]; |
|
1819 |
||
1820 |
Goal "x: HFinite ==> st(st(x)) = st(x)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1821 |
by (blast_tac (claset() addIs [st_HFinite, st_approx_self, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1822 |
approx_st_eq]) 1); |
10751 | 1823 |
qed "st_idempotent"; |
1824 |
Addsimps [st_idempotent]; |
|
1825 |
||
1826 |
(*** lemmas ***) |
|
1827 |
Goal "[| x: HFinite; y: HFinite; \ |
|
1828 |
\ u: Infinitesimal; st x < st y \ |
|
1829 |
\ |] ==> st x + u < st y"; |
|
1830 |
by (REPEAT(dtac st_SReal 1)); |
|
1831 |
by (auto_tac (claset() addSIs [Infinitesimal_add_hypreal_of_real_less], |
|
1832 |
simpset() addsimps [SReal_iff])); |
|
1833 |
qed "Infinitesimal_add_st_less"; |
|
1834 |
||
1835 |
Goalw [hypreal_le_def] |
|
1836 |
"[| x: HFinite; y: HFinite; \ |
|
1837 |
\ u: Infinitesimal; st x <= st y + u\ |
|
1838 |
\ |] ==> st x <= st y"; |
|
1839 |
by (auto_tac (claset() addDs [Infinitesimal_add_st_less], |
|
1840 |
simpset())); |
|
1841 |
qed "Infinitesimal_add_st_le_cancel"; |
|
1842 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1843 |
Goal "[| x: HFinite; y: HFinite; x <= y |] ==> st(x) <= st(y)"; |
10751 | 1844 |
by (forward_tac [HFinite_st_Infinitesimal_add] 1); |
1845 |
by (rotate_tac 1 1); |
|
1846 |
by (forward_tac [HFinite_st_Infinitesimal_add] 1); |
|
1847 |
by (Step_tac 1); |
|
1848 |
by (rtac Infinitesimal_add_st_le_cancel 1); |
|
1849 |
by (res_inst_tac [("x","ea"),("y","e")] |
|
1850 |
Infinitesimal_diff 3); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1851 |
by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc RS sym])); |
10751 | 1852 |
qed "st_le"; |
1853 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1854 |
Goal "[| 0 <= x; x: HFinite |] ==> 0 <= st x"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1855 |
by (stac (hypreal_numeral_0_eq_0 RS sym) 1); |
10751 | 1856 |
by (rtac (st_number_of RS subst) 1); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1857 |
by (rtac st_le 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1858 |
by Auto_tac; |
10751 | 1859 |
qed "st_zero_le"; |
1860 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1861 |
Goal "[| x <= 0; x: HFinite |] ==> st x <= 0"; |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1862 |
by (stac (hypreal_numeral_0_eq_0 RS sym) 1); |
10751 | 1863 |
by (rtac (st_number_of RS subst) 1); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1864 |
by (rtac st_le 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1865 |
by Auto_tac; |
10751 | 1866 |
qed "st_zero_ge"; |
1867 |
||
1868 |
Goal "x: HFinite ==> abs(st x) = st(abs x)"; |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1869 |
by (case_tac "0 <= x" 1); |
10751 | 1870 |
by (auto_tac (claset() addSDs [not_hypreal_leE, order_less_imp_le], |
1871 |
simpset() addsimps [st_zero_le,hrabs_eqI1, hrabs_minus_eqI1, |
|
1872 |
st_zero_ge,st_minus])); |
|
1873 |
qed "st_hrabs"; |
|
1874 |
||
1875 |
(*-------------------------------------------------------------------- |
|
1876 |
Alternative definitions for HFinite using Free ultrafilter |
|
1877 |
--------------------------------------------------------------------*) |
|
1878 |
||
1879 |
Goal "[| X: Rep_hypreal x; Y: Rep_hypreal x |] \ |
|
1880 |
\ ==> {n. X n = Y n} : FreeUltrafilterNat"; |
|
1881 |
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
1882 |
by Auto_tac; |
|
1883 |
by (Ultra_tac 1); |
|
1884 |
qed "FreeUltrafilterNat_Rep_hypreal"; |
|
1885 |
||
1886 |
Goal "{n. Yb n < Y n} Int {n. -y = Yb n} <= {n. -y < Y n}"; |
|
1887 |
by Auto_tac; |
|
1888 |
qed "lemma_free1"; |
|
1889 |
||
1890 |
Goal "{n. Xa n < Yc n} Int {n. y = Yc n} <= {n. Xa n < y}"; |
|
1891 |
by Auto_tac; |
|
1892 |
qed "lemma_free2"; |
|
1893 |
||
1894 |
Goalw [HFinite_def] |
|
1895 |
"x : HFinite ==> EX X: Rep_hypreal x. \ |
|
1896 |
\ EX u. {n. abs (X n) < u}: FreeUltrafilterNat"; |
|
1897 |
by (auto_tac (claset(), simpset() addsimps |
|
1898 |
[hrabs_interval_iff])); |
|
1899 |
by (auto_tac (claset(), simpset() addsimps |
|
1900 |
[hypreal_less_def,SReal_iff,hypreal_minus, |
|
1901 |
hypreal_of_real_def])); |
|
1902 |
by (dtac FreeUltrafilterNat_Rep_hypreal 1 THEN assume_tac 1); |
|
1903 |
by (res_inst_tac [("x","Y")] bexI 1 THEN assume_tac 2); |
|
1904 |
by (res_inst_tac [("x","y")] exI 1); |
|
1905 |
by (Ultra_tac 1 THEN arith_tac 1); |
|
1906 |
qed "HFinite_FreeUltrafilterNat"; |
|
1907 |
||
1908 |
Goalw [HFinite_def] |
|
1909 |
"EX X: Rep_hypreal x. \ |
|
1910 |
\ EX u. {n. abs (X n) < u}: FreeUltrafilterNat\ |
|
1911 |
\ ==> x : HFinite"; |
|
1912 |
by (auto_tac (claset(), simpset() addsimps |
|
1913 |
[hrabs_interval_iff])); |
|
1914 |
by (res_inst_tac [("x","hypreal_of_real u")] bexI 1); |
|
1915 |
by (auto_tac (claset() addSIs [exI], simpset() addsimps |
|
1916 |
[hypreal_less_def,SReal_iff,hypreal_minus, |
|
1917 |
hypreal_of_real_def])); |
|
1918 |
by (ALLGOALS(Ultra_tac THEN' arith_tac)); |
|
1919 |
qed "FreeUltrafilterNat_HFinite"; |
|
1920 |
||
1921 |
Goal "(x : HFinite) = (EX X: Rep_hypreal x. \ |
|
1922 |
\ EX u. {n. abs (X n) < u}: FreeUltrafilterNat)"; |
|
1923 |
by (blast_tac (claset() addSIs [HFinite_FreeUltrafilterNat, |
|
1924 |
FreeUltrafilterNat_HFinite]) 1); |
|
1925 |
qed "HFinite_FreeUltrafilterNat_iff"; |
|
1926 |
||
1927 |
(*-------------------------------------------------------------------- |
|
1928 |
Alternative definitions for HInfinite using Free ultrafilter |
|
1929 |
--------------------------------------------------------------------*) |
|
1930 |
Goal "- {n. (u::real) < abs (xa n)} = {n. abs (xa n) <= u}"; |
|
1931 |
by Auto_tac; |
|
1932 |
qed "lemma_Compl_eq"; |
|
1933 |
||
1934 |
Goal "- {n. abs (xa n) < (u::real)} = {n. u <= abs (xa n)}"; |
|
1935 |
by Auto_tac; |
|
1936 |
qed "lemma_Compl_eq2"; |
|
1937 |
||
1938 |
Goal "{n. abs (xa n) <= (u::real)} Int {n. u <= abs (xa n)} \ |
|
1939 |
\ = {n. abs(xa n) = u}"; |
|
1940 |
by Auto_tac; |
|
1941 |
qed "lemma_Int_eq1"; |
|
1942 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1943 |
Goal "{n. abs (xa n) = u} <= {n. abs (xa n) < u + (1::real)}"; |
10751 | 1944 |
by Auto_tac; |
1945 |
qed "lemma_FreeUltrafilterNat_one"; |
|
1946 |
||
1947 |
(*------------------------------------- |
|
1948 |
Exclude this type of sets from free |
|
1949 |
ultrafilter for Infinite numbers! |
|
1950 |
-------------------------------------*) |
|
1951 |
Goal "[| xa: Rep_hypreal x; \ |
|
1952 |
\ {n. abs (xa n) = u} : FreeUltrafilterNat \ |
|
1953 |
\ |] ==> x: HFinite"; |
|
1954 |
by (rtac FreeUltrafilterNat_HFinite 1); |
|
1955 |
by (res_inst_tac [("x","xa")] bexI 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
1956 |
by (res_inst_tac [("x","u + 1")] exI 1); |
10751 | 1957 |
by (Ultra_tac 1 THEN assume_tac 1); |
1958 |
qed "FreeUltrafilterNat_const_Finite"; |
|
1959 |
||
1960 |
val [prem] = goal thy "x : HInfinite ==> EX X: Rep_hypreal x. \ |
|
1961 |
\ ALL u. {n. u < abs (X n)}: FreeUltrafilterNat"; |
|
1962 |
by (cut_facts_tac [(prem RS (HInfinite_HFinite_iff RS iffD1))] 1); |
|
1963 |
by (cut_inst_tac [("x","x")] Rep_hypreal_nonempty 1); |
|
1964 |
by (auto_tac (claset(), simpset() delsimps [Rep_hypreal_nonempty] |
|
1965 |
addsimps [HFinite_FreeUltrafilterNat_iff,Bex_def])); |
|
1966 |
by (REPEAT(dtac spec 1)); |
|
1967 |
by Auto_tac; |
|
1968 |
by (dres_inst_tac [("x","u")] spec 1 THEN |
|
1969 |
REPEAT(dtac FreeUltrafilterNat_Compl_mem 1)); |
|
1970 |
by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
1971 |
||
1972 |
||
1973 |
by (asm_full_simp_tac (simpset() addsimps [lemma_Compl_eq, |
|
1974 |
lemma_Compl_eq2,lemma_Int_eq1]) 1); |
|
1975 |
by (auto_tac (claset() addDs [FreeUltrafilterNat_const_Finite], |
|
1976 |
simpset() addsimps [(prem RS (HInfinite_HFinite_iff RS iffD1))])); |
|
1977 |
qed "HInfinite_FreeUltrafilterNat"; |
|
1978 |
||
1979 |
(* yet more lemmas! *) |
|
1980 |
Goal "{n. abs (Xa n) < u} Int {n. X n = Xa n} \ |
|
1981 |
\ <= {n. abs (X n) < (u::real)}"; |
|
1982 |
by Auto_tac; |
|
1983 |
qed "lemma_Int_HI"; |
|
1984 |
||
1985 |
Goal "{n. u < abs (X n)} Int {n. abs (X n) < (u::real)} = {}"; |
|
1986 |
by (auto_tac (claset() addIs [real_less_asym], simpset())); |
|
1987 |
qed "lemma_Int_HIa"; |
|
1988 |
||
1989 |
Goal "EX X: Rep_hypreal x. ALL u. \ |
|
1990 |
\ {n. u < abs (X n)}: FreeUltrafilterNat\ |
|
1991 |
\ ==> x : HInfinite"; |
|
1992 |
by (rtac (HInfinite_HFinite_iff RS iffD2) 1); |
|
1993 |
by (Step_tac 1 THEN dtac HFinite_FreeUltrafilterNat 1); |
|
1994 |
by Auto_tac; |
|
1995 |
by (dres_inst_tac [("x","u")] spec 1); |
|
1996 |
by (dtac FreeUltrafilterNat_Rep_hypreal 1 THEN assume_tac 1); |
|
1997 |
by (dres_inst_tac [("Y","{n. X n = Xa n}")] FreeUltrafilterNat_Int 1); |
|
1998 |
by (dtac (lemma_Int_HI RSN (2,FreeUltrafilterNat_subset)) 2); |
|
1999 |
by (dres_inst_tac [("Y","{n. abs (X n) < u}")] FreeUltrafilterNat_Int 2); |
|
2000 |
by (auto_tac (claset(), simpset() addsimps [lemma_Int_HIa, |
|
2001 |
FreeUltrafilterNat_empty])); |
|
2002 |
qed "FreeUltrafilterNat_HInfinite"; |
|
2003 |
||
2004 |
Goal "(x : HInfinite) = (EX X: Rep_hypreal x. \ |
|
2005 |
\ ALL u. {n. u < abs (X n)}: FreeUltrafilterNat)"; |
|
2006 |
by (blast_tac (claset() addSIs [HInfinite_FreeUltrafilterNat, |
|
2007 |
FreeUltrafilterNat_HInfinite]) 1); |
|
2008 |
qed "HInfinite_FreeUltrafilterNat_iff"; |
|
2009 |
||
2010 |
(*-------------------------------------------------------------------- |
|
2011 |
Alternative definitions for Infinitesimal using Free ultrafilter |
|
2012 |
--------------------------------------------------------------------*) |
|
2013 |
||
2014 |
Goal "{n. - u < Yd n} Int {n. xa n = Yd n} <= {n. -u < xa n}"; |
|
2015 |
by Auto_tac; |
|
2016 |
qed "lemma_free4"; |
|
2017 |
||
2018 |
Goal "{n. Yb n < u} Int {n. xa n = Yb n} <= {n. xa n < u}"; |
|
2019 |
by Auto_tac; |
|
2020 |
qed "lemma_free5"; |
|
2021 |
||
2022 |
Goalw [Infinitesimal_def] |
|
2023 |
"x : Infinitesimal ==> EX X: Rep_hypreal x. \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2024 |
\ ALL u. 0 < u --> {n. abs (X n) < u}: FreeUltrafilterNat"; |
10751 | 2025 |
by (auto_tac (claset(), simpset() addsimps [hrabs_interval_iff])); |
2026 |
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
2027 |
by (EVERY[Auto_tac, rtac bexI 1, rtac lemma_hyprel_refl 2, Step_tac 1]); |
|
2028 |
by (dtac (hypreal_of_real_less_iff RS iffD2) 1); |
|
2029 |
by (dres_inst_tac [("x","hypreal_of_real u")] bspec 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2030 |
by Auto_tac; |
10751 | 2031 |
by (auto_tac (claset(), |
2032 |
simpset() addsimps [hypreal_less_def, hypreal_minus, |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2033 |
hypreal_of_real_def])); |
10751 | 2034 |
by (Ultra_tac 1 THEN arith_tac 1); |
2035 |
qed "Infinitesimal_FreeUltrafilterNat"; |
|
2036 |
||
2037 |
Goalw [Infinitesimal_def] |
|
2038 |
"EX X: Rep_hypreal x. \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2039 |
\ ALL u. 0 < u --> {n. abs (X n) < u} : FreeUltrafilterNat \ |
10751 | 2040 |
\ ==> x : Infinitesimal"; |
2041 |
by (auto_tac (claset(), |
|
2042 |
simpset() addsimps [hrabs_interval_iff,abs_interval_iff])); |
|
2043 |
by (auto_tac (claset(), |
|
2044 |
simpset() addsimps [SReal_iff])); |
|
2045 |
by (auto_tac (claset() addSIs [exI] |
|
2046 |
addIs [FreeUltrafilterNat_subset], |
|
2047 |
simpset() addsimps [hypreal_less_def, hypreal_minus,hypreal_of_real_def])); |
|
2048 |
qed "FreeUltrafilterNat_Infinitesimal"; |
|
2049 |
||
2050 |
Goal "(x : Infinitesimal) = (EX X: Rep_hypreal x. \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2051 |
\ ALL u. 0 < u --> {n. abs (X n) < u}: FreeUltrafilterNat)"; |
10751 | 2052 |
by (blast_tac (claset() addSIs [Infinitesimal_FreeUltrafilterNat, |
2053 |
FreeUltrafilterNat_Infinitesimal]) 1); |
|
2054 |
qed "Infinitesimal_FreeUltrafilterNat_iff"; |
|
2055 |
||
2056 |
(*------------------------------------------------------------------------ |
|
2057 |
Infinitesimals as smaller than 1/n for all n::nat (> 0) |
|
2058 |
------------------------------------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2059 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2060 |
Goal "(ALL r. 0 < r --> x < r) = (ALL n. x < inverse(real (Suc n)))"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2061 |
by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc_gt_zero])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2062 |
by (blast_tac (claset() addSDs [reals_Archimedean] |
10751 | 2063 |
addIs [order_less_trans]) 1); |
2064 |
qed "lemma_Infinitesimal"; |
|
2065 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2066 |
Goal "(ALL r: Reals. 0 < r --> x < r) = \ |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2067 |
\ (ALL n. x < inverse(hypreal_of_nat (Suc n)))"; |
10751 | 2068 |
by (Step_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2069 |
by (dres_inst_tac [("x","inverse (hypreal_of_real(real (Suc n)))")] |
10751 | 2070 |
bspec 1); |
2071 |
by (full_simp_tac (simpset() addsimps [SReal_inverse]) 1); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2072 |
by (rtac (real_of_nat_Suc_gt_zero RS real_inverse_gt_0 RS |
10751 | 2073 |
(hypreal_of_real_less_iff RS iffD2) RSN(2,impE)) 1); |
2074 |
by (assume_tac 2); |
|
2075 |
by (asm_full_simp_tac (simpset() addsimps |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2076 |
[real_of_nat_Suc_gt_zero, hypreal_of_nat_def]) 1); |
10751 | 2077 |
by (auto_tac (claset() addSDs [reals_Archimedean], |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2078 |
simpset() addsimps [SReal_iff])); |
10751 | 2079 |
by (dtac (hypreal_of_real_less_iff RS iffD2) 1); |
2080 |
by (asm_full_simp_tac (simpset() addsimps |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2081 |
[real_of_nat_Suc_gt_zero, hypreal_of_nat_def])1); |
10751 | 2082 |
by (blast_tac (claset() addIs [order_less_trans]) 1); |
2083 |
qed "lemma_Infinitesimal2"; |
|
2084 |
||
2085 |
Goalw [Infinitesimal_def] |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2086 |
"Infinitesimal = {x. ALL n. abs x < inverse (hypreal_of_nat (Suc n))}"; |
10751 | 2087 |
by (auto_tac (claset(), simpset() addsimps [lemma_Infinitesimal2])); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2088 |
qed "Infinitesimal_hypreal_of_nat_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2089 |
|
10751 | 2090 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2091 |
(*------------------------------------------------------------------------- |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2092 |
Proof that omega is an infinite number and |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2093 |
hence that epsilon is an infinitesimal number. |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2094 |
-------------------------------------------------------------------------*) |
10751 | 2095 |
Goal "{n. n < Suc m} = {n. n < m} Un {n. n = m}"; |
2096 |
by (auto_tac (claset(), simpset() addsimps [less_Suc_eq])); |
|
2097 |
qed "Suc_Un_eq"; |
|
2098 |
||
2099 |
(*------------------------------------------- |
|
2100 |
Prove that any segment is finite and |
|
2101 |
hence cannot belong to FreeUltrafilterNat |
|
2102 |
-------------------------------------------*) |
|
2103 |
Goal "finite {n::nat. n < m}"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2104 |
by (induct_tac "m" 1); |
10751 | 2105 |
by (auto_tac (claset(), simpset() addsimps [Suc_Un_eq])); |
2106 |
qed "finite_nat_segment"; |
|
2107 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2108 |
Goal "finite {n::nat. real n < real (m::nat)}"; |
10751 | 2109 |
by (auto_tac (claset() addIs [finite_nat_segment], simpset())); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2110 |
qed "finite_real_of_nat_segment"; |
10751 | 2111 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2112 |
Goal "finite {n::nat. real n < u}"; |
10751 | 2113 |
by (cut_inst_tac [("x","u")] reals_Archimedean2 1); |
2114 |
by (Step_tac 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2115 |
by (rtac (finite_real_of_nat_segment RSN (2,finite_subset)) 1); |
10751 | 2116 |
by (auto_tac (claset() addDs [order_less_trans], simpset())); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2117 |
qed "finite_real_of_nat_less_real"; |
10751 | 2118 |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2119 |
Goal "{n. f n <= u} = {n. f n < u} Un {n. u = (f n :: real)}"; |
10751 | 2120 |
by (auto_tac (claset() addDs [order_le_imp_less_or_eq], |
2121 |
simpset() addsimps [order_less_imp_le])); |
|
2122 |
qed "lemma_real_le_Un_eq"; |
|
2123 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2124 |
Goal "finite {n::nat. real n <= u}"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2125 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2126 |
simpset() addsimps [lemma_real_le_Un_eq,lemma_finite_omega_set, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2127 |
finite_real_of_nat_less_real])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2128 |
qed "finite_real_of_nat_le_real"; |
10751 | 2129 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2130 |
Goal "finite {n::nat. abs(real n) <= u}"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2131 |
by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2132 |
finite_real_of_nat_le_real]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2133 |
qed "finite_rabs_real_of_nat_le_real"; |
10751 | 2134 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2135 |
Goal "{n. abs(real n) <= u} ~: FreeUltrafilterNat"; |
10751 | 2136 |
by (blast_tac (claset() addSIs [FreeUltrafilterNat_finite, |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2137 |
finite_rabs_real_of_nat_le_real]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2138 |
qed "rabs_real_of_nat_le_real_FreeUltrafilterNat"; |
10751 | 2139 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2140 |
Goal "{n. u < real n} : FreeUltrafilterNat"; |
10751 | 2141 |
by (rtac ccontr 1 THEN dtac FreeUltrafilterNat_Compl_mem 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2142 |
by (subgoal_tac "- {n::nat. u < real n} = {n. real n <= u}" 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2143 |
by (Force_tac 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2144 |
by (asm_full_simp_tac (simpset() addsimps |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2145 |
[finite_real_of_nat_le_real RS FreeUltrafilterNat_finite]) 1); |
10751 | 2146 |
qed "FreeUltrafilterNat_nat_gt_real"; |
2147 |
||
2148 |
(*-------------------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2149 |
The complement of {n. abs(real n) <= u} = |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2150 |
{n. u < abs (real n)} is in FreeUltrafilterNat |
10751 | 2151 |
by property of (free) ultrafilters |
2152 |
--------------------------------------------------------------*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2153 |
Goal "- {n::nat. real n <= u} = {n. u < real n}"; |
10751 | 2154 |
by (auto_tac (claset() addSDs [order_le_less_trans], |
2155 |
simpset() addsimps [not_real_leE])); |
|
2156 |
val lemma = result(); |
|
2157 |
||
2158 |
(*----------------------------------------------- |
|
2159 |
Omega is a member of HInfinite |
|
2160 |
-----------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2161 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2162 |
Goal "hyprel``{%n::nat. real (Suc n)} : hypreal"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2163 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2164 |
qed "hypreal_omega"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2165 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2166 |
Goal "{n. u < real n} : FreeUltrafilterNat"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2167 |
by (cut_inst_tac [("u","u")] rabs_real_of_nat_le_real_FreeUltrafilterNat 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2168 |
by (auto_tac (claset() addDs [FreeUltrafilterNat_Compl_mem], |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2169 |
simpset() addsimps [lemma])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2170 |
qed "FreeUltrafilterNat_omega"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2171 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2172 |
Goalw [omega_def] "omega: HInfinite"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2173 |
by (auto_tac (claset() addSIs [FreeUltrafilterNat_HInfinite], |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2174 |
simpset())); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2175 |
by (rtac bexI 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2176 |
by (rtac lemma_hyprel_refl 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2177 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2178 |
by (simp_tac (simpset() addsimps [real_of_nat_Suc, real_diff_less_eq RS sym, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2179 |
FreeUltrafilterNat_omega]) 1); |
10751 | 2180 |
qed "HInfinite_omega"; |
2181 |
||
2182 |
(*----------------------------------------------- |
|
2183 |
Epsilon is a member of Infinitesimal |
|
2184 |
-----------------------------------------------*) |
|
2185 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2186 |
Goal "epsilon : Infinitesimal"; |
10751 | 2187 |
by (auto_tac (claset() addSIs [HInfinite_inverse_Infinitesimal,HInfinite_omega], |
2188 |
simpset() addsimps [hypreal_epsilon_inverse_omega])); |
|
2189 |
qed "Infinitesimal_epsilon"; |
|
2190 |
Addsimps [Infinitesimal_epsilon]; |
|
2191 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2192 |
Goal "epsilon : HFinite"; |
10751 | 2193 |
by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD], |
2194 |
simpset())); |
|
2195 |
qed "HFinite_epsilon"; |
|
2196 |
Addsimps [HFinite_epsilon]; |
|
2197 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2198 |
Goal "epsilon @= 0"; |
10751 | 2199 |
by (simp_tac (simpset() addsimps [mem_infmal_iff RS sym]) 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2200 |
qed "epsilon_approx_zero"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2201 |
Addsimps [epsilon_approx_zero]; |
10751 | 2202 |
|
2203 |
(*------------------------------------------------------------------------ |
|
2204 |
Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given |
|
2205 |
that ALL n. |X n - a| < 1/n. Used in proof of NSLIM => LIM. |
|
2206 |
-----------------------------------------------------------------------*) |
|
2207 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2208 |
Goal "0 < u ==> \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2209 |
\ (u < inverse (real(Suc n))) = (real(Suc n) < inverse u)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2210 |
by (asm_full_simp_tac (simpset() addsimps [real_inverse_eq_divide]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2211 |
by (stac pos_real_less_divide_eq 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2212 |
by (assume_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2213 |
by (stac pos_real_less_divide_eq 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2214 |
by (simp_tac (simpset() addsimps [real_mult_commute]) 2); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2215 |
by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2216 |
qed "real_of_nat_less_inverse_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2217 |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2218 |
Goal "0 < u ==> finite {n. u < inverse(real(Suc n))}"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2219 |
by (asm_simp_tac (simpset() addsimps [real_of_nat_less_inverse_iff]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2220 |
by (asm_simp_tac (simpset() addsimps [real_of_nat_Suc, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2221 |
real_less_diff_eq RS sym]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2222 |
by (rtac finite_real_of_nat_less_real 1); |
10751 | 2223 |
qed "finite_inverse_real_of_posnat_gt_real"; |
2224 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2225 |
Goal "{n. u <= inverse(real(Suc n))} = \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2226 |
\ {n. u < inverse(real(Suc n))} Un {n. u = inverse(real(Suc n))}"; |
10751 | 2227 |
by (auto_tac (claset() addDs [order_le_imp_less_or_eq], |
2228 |
simpset() addsimps [order_less_imp_le])); |
|
2229 |
qed "lemma_real_le_Un_eq2"; |
|
2230 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2231 |
Goal "(inverse (real(Suc n)) <= r) = (1 <= r * real(Suc n))"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2232 |
by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2233 |
by (simp_tac (simpset() addsimps [real_inverse_eq_divide]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2234 |
by (stac pos_real_less_divide_eq 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2235 |
by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2236 |
by (simp_tac (simpset() addsimps [real_mult_commute]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2237 |
qed "real_of_nat_inverse_le_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2238 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2239 |
Goal "(u = inverse (real(Suc n))) = (real(Suc n) = inverse u)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2240 |
by (auto_tac (claset(), |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2241 |
simpset() addsimps [real_inverse_inverse, real_of_nat_Suc_gt_zero, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2242 |
real_not_refl2 RS not_sym])); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2243 |
qed "real_of_nat_inverse_eq_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2244 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2245 |
Goal "finite {n::nat. u = inverse(real(Suc n))}"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2246 |
by (asm_simp_tac (simpset() addsimps [real_of_nat_inverse_eq_iff]) 1); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2247 |
by (cut_inst_tac [("x","inverse u - 1")] lemma_finite_omega_set 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2248 |
by (asm_full_simp_tac (simpset() addsimps [real_of_nat_Suc, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2249 |
real_diff_eq_eq RS sym, eq_commute]) 1); |
10751 | 2250 |
qed "lemma_finite_omega_set2"; |
2251 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2252 |
Goal "0 < u ==> finite {n. u <= inverse(real(Suc n))}"; |
10751 | 2253 |
by (auto_tac (claset(), |
2254 |
simpset() addsimps [lemma_real_le_Un_eq2,lemma_finite_omega_set2, |
|
2255 |
finite_inverse_real_of_posnat_gt_real])); |
|
2256 |
qed "finite_inverse_real_of_posnat_ge_real"; |
|
2257 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2258 |
Goal "0 < u ==> \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2259 |
\ {n. u <= inverse(real(Suc n))} ~: FreeUltrafilterNat"; |
10751 | 2260 |
by (blast_tac (claset() addSIs [FreeUltrafilterNat_finite, |
2261 |
finite_inverse_real_of_posnat_ge_real]) 1); |
|
2262 |
qed "inverse_real_of_posnat_ge_real_FreeUltrafilterNat"; |
|
2263 |
||
2264 |
(*-------------------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2265 |
The complement of {n. u <= inverse(real(Suc n))} = |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2266 |
{n. inverse(real(Suc n)) < u} is in FreeUltrafilterNat |
10751 | 2267 |
by property of (free) ultrafilters |
2268 |
--------------------------------------------------------------*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2269 |
Goal "- {n. u <= inverse(real(Suc n))} = \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2270 |
\ {n. inverse(real(Suc n)) < u}"; |
10751 | 2271 |
by (auto_tac (claset() addSDs [order_le_less_trans], |
2272 |
simpset() addsimps [not_real_leE])); |
|
2273 |
val lemma = result(); |
|
2274 |
||
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2275 |
Goal "0 < u ==> \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2276 |
\ {n. inverse(real(Suc n)) < u} : FreeUltrafilterNat"; |
10751 | 2277 |
by (cut_inst_tac [("u","u")] inverse_real_of_posnat_ge_real_FreeUltrafilterNat 1); |
2278 |
by (auto_tac (claset() addDs [FreeUltrafilterNat_Compl_mem], |
|
2279 |
simpset() addsimps [lemma])); |
|
2280 |
qed "FreeUltrafilterNat_inverse_real_of_posnat"; |
|
2281 |
||
2282 |
(*-------------------------------------------------------------- |
|
2283 |
Example where we get a hyperreal from a real sequence |
|
2284 |
for which a particular property holds. The theorem is |
|
2285 |
used in proofs about equivalence of nonstandard and |
|
2286 |
standard neighbourhoods. Also used for equivalence of |
|
2287 |
nonstandard ans standard definitions of pointwise |
|
2288 |
limit (the theorem was previously in REALTOPOS.thy). |
|
2289 |
-------------------------------------------------------------*) |
|
2290 |
(*----------------------------------------------------- |
|
2291 |
|X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x|: Infinitesimal |
|
2292 |
-----------------------------------------------------*) |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2293 |
Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \ |
10834 | 2294 |
\ ==> Abs_hypreal(hyprel``{X}) + -hypreal_of_real x : Infinitesimal"; |
10751 | 2295 |
by (auto_tac (claset() addSIs [bexI] |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2296 |
addDs [FreeUltrafilterNat_inverse_real_of_posnat, |
10751 | 2297 |
FreeUltrafilterNat_all,FreeUltrafilterNat_Int] |
2298 |
addIs [order_less_trans, FreeUltrafilterNat_subset], |
|
2299 |
simpset() addsimps [hypreal_minus, |
|
2300 |
hypreal_of_real_def,hypreal_add, |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2301 |
Infinitesimal_FreeUltrafilterNat_iff,hypreal_inverse])); |
10751 | 2302 |
qed "real_seq_to_hypreal_Infinitesimal"; |
2303 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2304 |
Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \ |
10834 | 2305 |
\ ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2306 |
by (rtac (approx_minus_iff RS ssubst) 1); |
10751 | 2307 |
by (rtac (mem_infmal_iff RS subst) 1); |
2308 |
by (etac real_seq_to_hypreal_Infinitesimal 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2309 |
qed "real_seq_to_hypreal_approx"; |
10751 | 2310 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2311 |
Goal "ALL n. abs(x + -X n) < inverse(real(Suc n)) \ |
10834 | 2312 |
\ ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x"; |
10751 | 2313 |
by (asm_full_simp_tac (simpset() addsimps [abs_minus_add_cancel, |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2314 |
real_seq_to_hypreal_approx]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2315 |
qed "real_seq_to_hypreal_approx2"; |
10751 | 2316 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
2317 |
Goal "ALL n. abs(X n + -Y n) < inverse(real(Suc n)) \ |
10834 | 2318 |
\ ==> Abs_hypreal(hyprel``{X}) + \ |
2319 |
\ -Abs_hypreal(hyprel``{Y}) : Infinitesimal"; |
|
10751 | 2320 |
by (auto_tac (claset() addSIs [bexI] |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11704
diff
changeset
|
2321 |
addDs [FreeUltrafilterNat_inverse_real_of_posnat, |
10751 | 2322 |
FreeUltrafilterNat_all,FreeUltrafilterNat_Int] |
2323 |
addIs [order_less_trans, FreeUltrafilterNat_subset], |
|
2324 |
simpset() addsimps |
|
2325 |
[Infinitesimal_FreeUltrafilterNat_iff,hypreal_minus,hypreal_add, |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
2326 |
hypreal_inverse])); |
10751 | 2327 |
qed "real_seq_to_hypreal_Infinitesimal2"; |