author | blanchet |
Tue, 16 Sep 2014 19:23:37 +0200 | |
changeset 58352 | 37745650a3f4 |
parent 57514 | bdc2c6b40bf2 |
child 58810 | 922a233805d2 |
permissions | -rw-r--r-- |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32155
diff
changeset
|
1 |
(* Title: HOL/NSA/NSA.thy |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32155
diff
changeset
|
2 |
Author: Jacques D. Fleuriot, University of Cambridge |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32155
diff
changeset
|
3 |
Author: Lawrence C Paulson, University of Cambridge |
27468 | 4 |
*) |
5 |
||
6 |
header{*Infinite Numbers, Infinitesimals, Infinitely Close Relation*} |
|
7 |
||
8 |
theory NSA |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54230
diff
changeset
|
9 |
imports HyperDef "~~/src/HOL/Library/Lubs_Glbs" |
27468 | 10 |
begin |
11 |
||
12 |
definition |
|
31449 | 13 |
hnorm :: "'a::real_normed_vector star \<Rightarrow> real star" where |
27468 | 14 |
[transfer_unfold]: "hnorm = *f* norm" |
15 |
||
16 |
definition |
|
17 |
Infinitesimal :: "('a::real_normed_vector) star set" where |
|
37765 | 18 |
"Infinitesimal = {x. \<forall>r \<in> Reals. 0 < r --> hnorm x < r}" |
27468 | 19 |
|
20 |
definition |
|
21 |
HFinite :: "('a::real_normed_vector) star set" where |
|
37765 | 22 |
"HFinite = {x. \<exists>r \<in> Reals. hnorm x < r}" |
27468 | 23 |
|
24 |
definition |
|
25 |
HInfinite :: "('a::real_normed_vector) star set" where |
|
37765 | 26 |
"HInfinite = {x. \<forall>r \<in> Reals. r < hnorm x}" |
27468 | 27 |
|
28 |
definition |
|
29 |
approx :: "['a::real_normed_vector star, 'a star] => bool" (infixl "@=" 50) where |
|
30 |
--{*the `infinitely close' relation*} |
|
31 |
"(x @= y) = ((x - y) \<in> Infinitesimal)" |
|
32 |
||
33 |
definition |
|
34 |
st :: "hypreal => hypreal" where |
|
35 |
--{*the standard part of a hyperreal*} |
|
36 |
"st = (%x. @r. x \<in> HFinite & r \<in> Reals & r @= x)" |
|
37 |
||
38 |
definition |
|
39 |
monad :: "'a::real_normed_vector star => 'a star set" where |
|
40 |
"monad x = {y. x @= y}" |
|
41 |
||
42 |
definition |
|
43 |
galaxy :: "'a::real_normed_vector star => 'a star set" where |
|
44 |
"galaxy x = {y. (x + -y) \<in> HFinite}" |
|
45 |
||
46 |
notation (xsymbols) |
|
47 |
approx (infixl "\<approx>" 50) |
|
48 |
||
49 |
notation (HTML output) |
|
50 |
approx (infixl "\<approx>" 50) |
|
51 |
||
52 |
lemma SReal_def: "Reals == {x. \<exists>r. x = hypreal_of_real r}" |
|
53 |
by (simp add: Reals_def image_def) |
|
54 |
||
55 |
subsection {* Nonstandard Extension of the Norm Function *} |
|
56 |
||
57 |
definition |
|
58 |
scaleHR :: "real star \<Rightarrow> 'a star \<Rightarrow> 'a::real_normed_vector star" where |
|
37765 | 59 |
[transfer_unfold]: "scaleHR = starfun2 scaleR" |
27468 | 60 |
|
61 |
lemma Standard_hnorm [simp]: "x \<in> Standard \<Longrightarrow> hnorm x \<in> Standard" |
|
62 |
by (simp add: hnorm_def) |
|
63 |
||
64 |
lemma star_of_norm [simp]: "star_of (norm x) = hnorm (star_of x)" |
|
65 |
by transfer (rule refl) |
|
66 |
||
67 |
lemma hnorm_ge_zero [simp]: |
|
68 |
"\<And>x::'a::real_normed_vector star. 0 \<le> hnorm x" |
|
69 |
by transfer (rule norm_ge_zero) |
|
70 |
||
71 |
lemma hnorm_eq_zero [simp]: |
|
72 |
"\<And>x::'a::real_normed_vector star. (hnorm x = 0) = (x = 0)" |
|
73 |
by transfer (rule norm_eq_zero) |
|
74 |
||
75 |
lemma hnorm_triangle_ineq: |
|
76 |
"\<And>x y::'a::real_normed_vector star. hnorm (x + y) \<le> hnorm x + hnorm y" |
|
77 |
by transfer (rule norm_triangle_ineq) |
|
78 |
||
79 |
lemma hnorm_triangle_ineq3: |
|
80 |
"\<And>x y::'a::real_normed_vector star. \<bar>hnorm x - hnorm y\<bar> \<le> hnorm (x - y)" |
|
81 |
by transfer (rule norm_triangle_ineq3) |
|
82 |
||
83 |
lemma hnorm_scaleR: |
|
84 |
"\<And>x::'a::real_normed_vector star. |
|
85 |
hnorm (a *\<^sub>R x) = \<bar>star_of a\<bar> * hnorm x" |
|
86 |
by transfer (rule norm_scaleR) |
|
87 |
||
88 |
lemma hnorm_scaleHR: |
|
89 |
"\<And>a (x::'a::real_normed_vector star). |
|
90 |
hnorm (scaleHR a x) = \<bar>a\<bar> * hnorm x" |
|
91 |
by transfer (rule norm_scaleR) |
|
92 |
||
93 |
lemma hnorm_mult_ineq: |
|
94 |
"\<And>x y::'a::real_normed_algebra star. hnorm (x * y) \<le> hnorm x * hnorm y" |
|
95 |
by transfer (rule norm_mult_ineq) |
|
96 |
||
97 |
lemma hnorm_mult: |
|
98 |
"\<And>x y::'a::real_normed_div_algebra star. hnorm (x * y) = hnorm x * hnorm y" |
|
99 |
by transfer (rule norm_mult) |
|
100 |
||
101 |
lemma hnorm_hyperpow: |
|
31017 | 102 |
"\<And>(x::'a::{real_normed_div_algebra} star) n. |
27468 | 103 |
hnorm (x pow n) = hnorm x pow n" |
104 |
by transfer (rule norm_power) |
|
105 |
||
106 |
lemma hnorm_one [simp]: |
|
107 |
"hnorm (1\<Colon>'a::real_normed_div_algebra star) = 1" |
|
108 |
by transfer (rule norm_one) |
|
109 |
||
110 |
lemma hnorm_zero [simp]: |
|
111 |
"hnorm (0\<Colon>'a::real_normed_vector star) = 0" |
|
112 |
by transfer (rule norm_zero) |
|
113 |
||
114 |
lemma zero_less_hnorm_iff [simp]: |
|
115 |
"\<And>x::'a::real_normed_vector star. (0 < hnorm x) = (x \<noteq> 0)" |
|
116 |
by transfer (rule zero_less_norm_iff) |
|
117 |
||
118 |
lemma hnorm_minus_cancel [simp]: |
|
119 |
"\<And>x::'a::real_normed_vector star. hnorm (- x) = hnorm x" |
|
120 |
by transfer (rule norm_minus_cancel) |
|
121 |
||
122 |
lemma hnorm_minus_commute: |
|
123 |
"\<And>a b::'a::real_normed_vector star. hnorm (a - b) = hnorm (b - a)" |
|
124 |
by transfer (rule norm_minus_commute) |
|
125 |
||
126 |
lemma hnorm_triangle_ineq2: |
|
127 |
"\<And>a b::'a::real_normed_vector star. hnorm a - hnorm b \<le> hnorm (a - b)" |
|
128 |
by transfer (rule norm_triangle_ineq2) |
|
129 |
||
130 |
lemma hnorm_triangle_ineq4: |
|
131 |
"\<And>a b::'a::real_normed_vector star. hnorm (a - b) \<le> hnorm a + hnorm b" |
|
132 |
by transfer (rule norm_triangle_ineq4) |
|
133 |
||
134 |
lemma abs_hnorm_cancel [simp]: |
|
135 |
"\<And>a::'a::real_normed_vector star. \<bar>hnorm a\<bar> = hnorm a" |
|
136 |
by transfer (rule abs_norm_cancel) |
|
137 |
||
138 |
lemma hnorm_of_hypreal [simp]: |
|
139 |
"\<And>r. hnorm (of_hypreal r::'a::real_normed_algebra_1 star) = \<bar>r\<bar>" |
|
140 |
by transfer (rule norm_of_real) |
|
141 |
||
142 |
lemma nonzero_hnorm_inverse: |
|
143 |
"\<And>a::'a::real_normed_div_algebra star. |
|
144 |
a \<noteq> 0 \<Longrightarrow> hnorm (inverse a) = inverse (hnorm a)" |
|
145 |
by transfer (rule nonzero_norm_inverse) |
|
146 |
||
147 |
lemma hnorm_inverse: |
|
36409 | 148 |
"\<And>a::'a::{real_normed_div_algebra, division_ring_inverse_zero} star. |
27468 | 149 |
hnorm (inverse a) = inverse (hnorm a)" |
150 |
by transfer (rule norm_inverse) |
|
151 |
||
152 |
lemma hnorm_divide: |
|
36409 | 153 |
"\<And>a b::'a::{real_normed_field, field_inverse_zero} star. |
27468 | 154 |
hnorm (a / b) = hnorm a / hnorm b" |
155 |
by transfer (rule norm_divide) |
|
156 |
||
157 |
lemma hypreal_hnorm_def [simp]: |
|
30080 | 158 |
"\<And>r::hypreal. hnorm r = \<bar>r\<bar>" |
27468 | 159 |
by transfer (rule real_norm_def) |
160 |
||
161 |
lemma hnorm_add_less: |
|
162 |
"\<And>(x::'a::real_normed_vector star) y r s. |
|
163 |
\<lbrakk>hnorm x < r; hnorm y < s\<rbrakk> \<Longrightarrow> hnorm (x + y) < r + s" |
|
164 |
by transfer (rule norm_add_less) |
|
165 |
||
166 |
lemma hnorm_mult_less: |
|
167 |
"\<And>(x::'a::real_normed_algebra star) y r s. |
|
168 |
\<lbrakk>hnorm x < r; hnorm y < s\<rbrakk> \<Longrightarrow> hnorm (x * y) < r * s" |
|
169 |
by transfer (rule norm_mult_less) |
|
170 |
||
171 |
lemma hnorm_scaleHR_less: |
|
172 |
"\<lbrakk>\<bar>x\<bar> < r; hnorm y < s\<rbrakk> \<Longrightarrow> hnorm (scaleHR x y) < r * s" |
|
173 |
apply (simp only: hnorm_scaleHR) |
|
174 |
apply (simp add: mult_strict_mono') |
|
175 |
done |
|
176 |
||
177 |
subsection{*Closure Laws for the Standard Reals*} |
|
178 |
||
179 |
lemma Reals_minus_iff [simp]: "(-x \<in> Reals) = (x \<in> Reals)" |
|
180 |
apply auto |
|
181 |
apply (drule Reals_minus, auto) |
|
182 |
done |
|
183 |
||
184 |
lemma Reals_add_cancel: "\<lbrakk>x + y \<in> Reals; y \<in> Reals\<rbrakk> \<Longrightarrow> x \<in> Reals" |
|
185 |
by (drule (1) Reals_diff, simp) |
|
186 |
||
187 |
lemma SReal_hrabs: "(x::hypreal) \<in> Reals ==> abs x \<in> Reals" |
|
188 |
by (simp add: Reals_eq_Standard) |
|
189 |
||
190 |
lemma SReal_hypreal_of_real [simp]: "hypreal_of_real x \<in> Reals" |
|
191 |
by (simp add: Reals_eq_Standard) |
|
192 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
193 |
lemma SReal_divide_numeral: "r \<in> Reals ==> r/(numeral w::hypreal) \<in> Reals" |
27468 | 194 |
by simp |
195 |
||
196 |
text{*epsilon is not in Reals because it is an infinitesimal*} |
|
197 |
lemma SReal_epsilon_not_mem: "epsilon \<notin> Reals" |
|
198 |
apply (simp add: SReal_def) |
|
199 |
apply (auto simp add: hypreal_of_real_not_eq_epsilon [THEN not_sym]) |
|
200 |
done |
|
201 |
||
202 |
lemma SReal_omega_not_mem: "omega \<notin> Reals" |
|
203 |
apply (simp add: SReal_def) |
|
204 |
apply (auto simp add: hypreal_of_real_not_eq_omega [THEN not_sym]) |
|
205 |
done |
|
206 |
||
207 |
lemma SReal_UNIV_real: "{x. hypreal_of_real x \<in> Reals} = (UNIV::real set)" |
|
208 |
by simp |
|
209 |
||
210 |
lemma SReal_iff: "(x \<in> Reals) = (\<exists>y. x = hypreal_of_real y)" |
|
211 |
by (simp add: SReal_def) |
|
212 |
||
213 |
lemma hypreal_of_real_image: "hypreal_of_real `(UNIV::real set) = Reals" |
|
214 |
by (simp add: Reals_eq_Standard Standard_def) |
|
215 |
||
216 |
lemma inv_hypreal_of_real_image: "inv hypreal_of_real ` Reals = UNIV" |
|
217 |
apply (auto simp add: SReal_def) |
|
218 |
apply (rule inj_star_of [THEN inv_f_f, THEN subst], blast) |
|
219 |
done |
|
220 |
||
221 |
lemma SReal_hypreal_of_real_image: |
|
222 |
"[| \<exists>x. x: P; P \<subseteq> Reals |] ==> \<exists>Q. P = hypreal_of_real ` Q" |
|
223 |
by (simp add: SReal_def image_def, blast) |
|
224 |
||
225 |
lemma SReal_dense: |
|
226 |
"[| (x::hypreal) \<in> Reals; y \<in> Reals; x<y |] ==> \<exists>r \<in> Reals. x<r & r<y" |
|
227 |
apply (auto simp add: SReal_def) |
|
228 |
apply (drule dense, auto) |
|
229 |
done |
|
230 |
||
231 |
text{*Completeness of Reals, but both lemmas are unused.*} |
|
232 |
||
233 |
lemma SReal_sup_lemma: |
|
234 |
"P \<subseteq> Reals ==> ((\<exists>x \<in> P. y < x) = |
|
235 |
(\<exists>X. hypreal_of_real X \<in> P & y < hypreal_of_real X))" |
|
236 |
by (blast dest!: SReal_iff [THEN iffD1]) |
|
237 |
||
238 |
lemma SReal_sup_lemma2: |
|
239 |
"[| P \<subseteq> Reals; \<exists>x. x \<in> P; \<exists>y \<in> Reals. \<forall>x \<in> P. x < y |] |
|
240 |
==> (\<exists>X. X \<in> {w. hypreal_of_real w \<in> P}) & |
|
241 |
(\<exists>Y. \<forall>X \<in> {w. hypreal_of_real w \<in> P}. X < Y)" |
|
242 |
apply (rule conjI) |
|
243 |
apply (fast dest!: SReal_iff [THEN iffD1]) |
|
244 |
apply (auto, frule subsetD, assumption) |
|
245 |
apply (drule SReal_iff [THEN iffD1]) |
|
246 |
apply (auto, rule_tac x = ya in exI, auto) |
|
247 |
done |
|
248 |
||
249 |
||
250 |
subsection{* Set of Finite Elements is a Subring of the Extended Reals*} |
|
251 |
||
252 |
lemma HFinite_add: "[|x \<in> HFinite; y \<in> HFinite|] ==> (x+y) \<in> HFinite" |
|
253 |
apply (simp add: HFinite_def) |
|
254 |
apply (blast intro!: Reals_add hnorm_add_less) |
|
255 |
done |
|
256 |
||
257 |
lemma HFinite_mult: |
|
258 |
fixes x y :: "'a::real_normed_algebra star" |
|
259 |
shows "[|x \<in> HFinite; y \<in> HFinite|] ==> x*y \<in> HFinite" |
|
260 |
apply (simp add: HFinite_def) |
|
261 |
apply (blast intro!: Reals_mult hnorm_mult_less) |
|
262 |
done |
|
263 |
||
264 |
lemma HFinite_scaleHR: |
|
265 |
"[|x \<in> HFinite; y \<in> HFinite|] ==> scaleHR x y \<in> HFinite" |
|
266 |
apply (simp add: HFinite_def) |
|
267 |
apply (blast intro!: Reals_mult hnorm_scaleHR_less) |
|
268 |
done |
|
269 |
||
270 |
lemma HFinite_minus_iff: "(-x \<in> HFinite) = (x \<in> HFinite)" |
|
271 |
by (simp add: HFinite_def) |
|
272 |
||
273 |
lemma HFinite_star_of [simp]: "star_of x \<in> HFinite" |
|
274 |
apply (simp add: HFinite_def) |
|
275 |
apply (rule_tac x="star_of (norm x) + 1" in bexI) |
|
276 |
apply (transfer, simp) |
|
277 |
apply (blast intro: Reals_add SReal_hypreal_of_real Reals_1) |
|
278 |
done |
|
279 |
||
280 |
lemma SReal_subset_HFinite: "(Reals::hypreal set) \<subseteq> HFinite" |
|
281 |
by (auto simp add: SReal_def) |
|
282 |
||
283 |
lemma HFiniteD: "x \<in> HFinite ==> \<exists>t \<in> Reals. hnorm x < t" |
|
284 |
by (simp add: HFinite_def) |
|
285 |
||
286 |
lemma HFinite_hrabs_iff [iff]: "(abs (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
|
287 |
by (simp add: HFinite_def) |
|
288 |
||
289 |
lemma HFinite_hnorm_iff [iff]: |
|
290 |
"(hnorm (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
|
291 |
by (simp add: HFinite_def) |
|
292 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
293 |
lemma HFinite_numeral [simp]: "numeral w \<in> HFinite" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
294 |
unfolding star_numeral_def by (rule HFinite_star_of) |
27468 | 295 |
|
296 |
(** As always with numerals, 0 and 1 are special cases **) |
|
297 |
||
298 |
lemma HFinite_0 [simp]: "0 \<in> HFinite" |
|
299 |
unfolding star_zero_def by (rule HFinite_star_of) |
|
300 |
||
301 |
lemma HFinite_1 [simp]: "1 \<in> HFinite" |
|
302 |
unfolding star_one_def by (rule HFinite_star_of) |
|
303 |
||
304 |
lemma hrealpow_HFinite: |
|
31017 | 305 |
fixes x :: "'a::{real_normed_algebra,monoid_mult} star" |
27468 | 306 |
shows "x \<in> HFinite ==> x ^ n \<in> HFinite" |
31017 | 307 |
apply (induct n) |
27468 | 308 |
apply (auto simp add: power_Suc intro: HFinite_mult) |
309 |
done |
|
310 |
||
311 |
lemma HFinite_bounded: |
|
312 |
"[|(x::hypreal) \<in> HFinite; y \<le> x; 0 \<le> y |] ==> y \<in> HFinite" |
|
31017 | 313 |
apply (cases "x \<le> 0") |
27468 | 314 |
apply (drule_tac y = x in order_trans) |
315 |
apply (drule_tac [2] order_antisym) |
|
316 |
apply (auto simp add: linorder_not_le) |
|
317 |
apply (auto intro: order_le_less_trans simp add: abs_if HFinite_def) |
|
318 |
done |
|
319 |
||
320 |
||
321 |
subsection{* Set of Infinitesimals is a Subring of the Hyperreals*} |
|
322 |
||
323 |
lemma InfinitesimalI: |
|
324 |
"(\<And>r. \<lbrakk>r \<in> \<real>; 0 < r\<rbrakk> \<Longrightarrow> hnorm x < r) \<Longrightarrow> x \<in> Infinitesimal" |
|
325 |
by (simp add: Infinitesimal_def) |
|
326 |
||
327 |
lemma InfinitesimalD: |
|
328 |
"x \<in> Infinitesimal ==> \<forall>r \<in> Reals. 0 < r --> hnorm x < r" |
|
329 |
by (simp add: Infinitesimal_def) |
|
330 |
||
331 |
lemma InfinitesimalI2: |
|
332 |
"(\<And>r. 0 < r \<Longrightarrow> hnorm x < star_of r) \<Longrightarrow> x \<in> Infinitesimal" |
|
333 |
by (auto simp add: Infinitesimal_def SReal_def) |
|
334 |
||
335 |
lemma InfinitesimalD2: |
|
336 |
"\<lbrakk>x \<in> Infinitesimal; 0 < r\<rbrakk> \<Longrightarrow> hnorm x < star_of r" |
|
337 |
by (auto simp add: Infinitesimal_def SReal_def) |
|
338 |
||
339 |
lemma Infinitesimal_zero [iff]: "0 \<in> Infinitesimal" |
|
340 |
by (simp add: Infinitesimal_def) |
|
341 |
||
342 |
lemma hypreal_sum_of_halves: "x/(2::hypreal) + x/(2::hypreal) = x" |
|
343 |
by auto |
|
344 |
||
345 |
lemma Infinitesimal_add: |
|
346 |
"[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> (x+y) \<in> Infinitesimal" |
|
347 |
apply (rule InfinitesimalI) |
|
348 |
apply (rule hypreal_sum_of_halves [THEN subst]) |
|
349 |
apply (drule half_gt_zero) |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
350 |
apply (blast intro: hnorm_add_less SReal_divide_numeral dest: InfinitesimalD) |
27468 | 351 |
done |
352 |
||
353 |
lemma Infinitesimal_minus_iff [simp]: "(-x:Infinitesimal) = (x:Infinitesimal)" |
|
354 |
by (simp add: Infinitesimal_def) |
|
355 |
||
356 |
lemma Infinitesimal_hnorm_iff: |
|
357 |
"(hnorm x \<in> Infinitesimal) = (x \<in> Infinitesimal)" |
|
358 |
by (simp add: Infinitesimal_def) |
|
359 |
||
360 |
lemma Infinitesimal_hrabs_iff [iff]: |
|
361 |
"(abs (x::hypreal) \<in> Infinitesimal) = (x \<in> Infinitesimal)" |
|
362 |
by (simp add: abs_if) |
|
363 |
||
364 |
lemma Infinitesimal_of_hypreal_iff [simp]: |
|
365 |
"((of_hypreal x::'a::real_normed_algebra_1 star) \<in> Infinitesimal) = |
|
366 |
(x \<in> Infinitesimal)" |
|
367 |
by (subst Infinitesimal_hnorm_iff [symmetric], simp) |
|
368 |
||
369 |
lemma Infinitesimal_diff: |
|
370 |
"[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> x-y \<in> Infinitesimal" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
371 |
using Infinitesimal_add [of x "- y"] by simp |
27468 | 372 |
|
373 |
lemma Infinitesimal_mult: |
|
374 |
fixes x y :: "'a::real_normed_algebra star" |
|
375 |
shows "[|x \<in> Infinitesimal; y \<in> Infinitesimal|] ==> (x * y) \<in> Infinitesimal" |
|
376 |
apply (rule InfinitesimalI) |
|
377 |
apply (subgoal_tac "hnorm (x * y) < 1 * r", simp only: mult_1) |
|
378 |
apply (rule hnorm_mult_less) |
|
379 |
apply (simp_all add: InfinitesimalD) |
|
380 |
done |
|
381 |
||
382 |
lemma Infinitesimal_HFinite_mult: |
|
383 |
fixes x y :: "'a::real_normed_algebra star" |
|
384 |
shows "[| x \<in> Infinitesimal; y \<in> HFinite |] ==> (x * y) \<in> Infinitesimal" |
|
385 |
apply (rule InfinitesimalI) |
|
386 |
apply (drule HFiniteD, clarify) |
|
387 |
apply (subgoal_tac "0 < t") |
|
388 |
apply (subgoal_tac "hnorm (x * y) < (r / t) * t", simp) |
|
389 |
apply (subgoal_tac "0 < r / t") |
|
390 |
apply (rule hnorm_mult_less) |
|
56541 | 391 |
apply (simp add: InfinitesimalD) |
27468 | 392 |
apply assumption |
56541 | 393 |
apply simp |
27468 | 394 |
apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
395 |
done |
|
396 |
||
397 |
lemma Infinitesimal_HFinite_scaleHR: |
|
398 |
"[| x \<in> Infinitesimal; y \<in> HFinite |] ==> scaleHR x y \<in> Infinitesimal" |
|
399 |
apply (rule InfinitesimalI) |
|
400 |
apply (drule HFiniteD, clarify) |
|
401 |
apply (drule InfinitesimalD) |
|
402 |
apply (simp add: hnorm_scaleHR) |
|
403 |
apply (subgoal_tac "0 < t") |
|
404 |
apply (subgoal_tac "\<bar>x\<bar> * hnorm y < (r / t) * t", simp) |
|
405 |
apply (subgoal_tac "0 < r / t") |
|
406 |
apply (rule mult_strict_mono', simp_all) |
|
407 |
apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
|
408 |
done |
|
409 |
||
410 |
lemma Infinitesimal_HFinite_mult2: |
|
411 |
fixes x y :: "'a::real_normed_algebra star" |
|
412 |
shows "[| x \<in> Infinitesimal; y \<in> HFinite |] ==> (y * x) \<in> Infinitesimal" |
|
413 |
apply (rule InfinitesimalI) |
|
414 |
apply (drule HFiniteD, clarify) |
|
415 |
apply (subgoal_tac "0 < t") |
|
416 |
apply (subgoal_tac "hnorm (y * x) < t * (r / t)", simp) |
|
417 |
apply (subgoal_tac "0 < r / t") |
|
418 |
apply (rule hnorm_mult_less) |
|
419 |
apply assumption |
|
56541 | 420 |
apply (simp add: InfinitesimalD) |
421 |
apply simp |
|
27468 | 422 |
apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
423 |
done |
|
424 |
||
425 |
lemma Infinitesimal_scaleR2: |
|
426 |
"x \<in> Infinitesimal ==> a *\<^sub>R x \<in> Infinitesimal" |
|
427 |
apply (case_tac "a = 0", simp) |
|
428 |
apply (rule InfinitesimalI) |
|
429 |
apply (drule InfinitesimalD) |
|
430 |
apply (drule_tac x="r / \<bar>star_of a\<bar>" in bspec) |
|
431 |
apply (simp add: Reals_eq_Standard) |
|
56541 | 432 |
apply simp |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
433 |
apply (simp add: hnorm_scaleR pos_less_divide_eq mult.commute) |
27468 | 434 |
done |
435 |
||
436 |
lemma Compl_HFinite: "- HFinite = HInfinite" |
|
437 |
apply (auto simp add: HInfinite_def HFinite_def linorder_not_less) |
|
438 |
apply (rule_tac y="r + 1" in order_less_le_trans, simp) |
|
439 |
apply simp |
|
440 |
done |
|
441 |
||
442 |
lemma HInfinite_inverse_Infinitesimal: |
|
443 |
fixes x :: "'a::real_normed_div_algebra star" |
|
444 |
shows "x \<in> HInfinite ==> inverse x \<in> Infinitesimal" |
|
445 |
apply (rule InfinitesimalI) |
|
446 |
apply (subgoal_tac "x \<noteq> 0") |
|
447 |
apply (rule inverse_less_imp_less) |
|
448 |
apply (simp add: nonzero_hnorm_inverse) |
|
449 |
apply (simp add: HInfinite_def Reals_inverse) |
|
450 |
apply assumption |
|
451 |
apply (clarify, simp add: Compl_HFinite [symmetric]) |
|
452 |
done |
|
453 |
||
454 |
lemma HInfiniteI: "(\<And>r. r \<in> \<real> \<Longrightarrow> r < hnorm x) \<Longrightarrow> x \<in> HInfinite" |
|
455 |
by (simp add: HInfinite_def) |
|
456 |
||
457 |
lemma HInfiniteD: "\<lbrakk>x \<in> HInfinite; r \<in> \<real>\<rbrakk> \<Longrightarrow> r < hnorm x" |
|
458 |
by (simp add: HInfinite_def) |
|
459 |
||
460 |
lemma HInfinite_mult: |
|
461 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
462 |
shows "[|x \<in> HInfinite; y \<in> HInfinite|] ==> (x*y) \<in> HInfinite" |
|
463 |
apply (rule HInfiniteI, simp only: hnorm_mult) |
|
464 |
apply (subgoal_tac "r * 1 < hnorm x * hnorm y", simp only: mult_1) |
|
465 |
apply (case_tac "x = 0", simp add: HInfinite_def) |
|
466 |
apply (rule mult_strict_mono) |
|
467 |
apply (simp_all add: HInfiniteD) |
|
468 |
done |
|
469 |
||
470 |
lemma hypreal_add_zero_less_le_mono: "[|r < x; (0::hypreal) \<le> y|] ==> r < x+y" |
|
471 |
by (auto dest: add_less_le_mono) |
|
472 |
||
473 |
lemma HInfinite_add_ge_zero: |
|
474 |
"[|(x::hypreal) \<in> HInfinite; 0 \<le> y; 0 \<le> x|] ==> (x + y): HInfinite" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
475 |
by (auto intro!: hypreal_add_zero_less_le_mono |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
476 |
simp add: abs_if add.commute add_nonneg_nonneg HInfinite_def) |
27468 | 477 |
|
478 |
lemma HInfinite_add_ge_zero2: |
|
479 |
"[|(x::hypreal) \<in> HInfinite; 0 \<le> y; 0 \<le> x|] ==> (y + x): HInfinite" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
480 |
by (auto intro!: HInfinite_add_ge_zero simp add: add.commute) |
27468 | 481 |
|
482 |
lemma HInfinite_add_gt_zero: |
|
483 |
"[|(x::hypreal) \<in> HInfinite; 0 < y; 0 < x|] ==> (x + y): HInfinite" |
|
484 |
by (blast intro: HInfinite_add_ge_zero order_less_imp_le) |
|
485 |
||
486 |
lemma HInfinite_minus_iff: "(-x \<in> HInfinite) = (x \<in> HInfinite)" |
|
487 |
by (simp add: HInfinite_def) |
|
488 |
||
489 |
lemma HInfinite_add_le_zero: |
|
490 |
"[|(x::hypreal) \<in> HInfinite; y \<le> 0; x \<le> 0|] ==> (x + y): HInfinite" |
|
491 |
apply (drule HInfinite_minus_iff [THEN iffD2]) |
|
492 |
apply (rule HInfinite_minus_iff [THEN iffD1]) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
493 |
apply (simp only: minus_add add.commute) |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
494 |
apply (rule HInfinite_add_ge_zero) |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
495 |
apply simp_all |
27468 | 496 |
done |
497 |
||
498 |
lemma HInfinite_add_lt_zero: |
|
499 |
"[|(x::hypreal) \<in> HInfinite; y < 0; x < 0|] ==> (x + y): HInfinite" |
|
500 |
by (blast intro: HInfinite_add_le_zero order_less_imp_le) |
|
501 |
||
502 |
lemma HFinite_sum_squares: |
|
503 |
fixes a b c :: "'a::real_normed_algebra star" |
|
504 |
shows "[|a: HFinite; b: HFinite; c: HFinite|] |
|
505 |
==> a*a + b*b + c*c \<in> HFinite" |
|
506 |
by (auto intro: HFinite_mult HFinite_add) |
|
507 |
||
508 |
lemma not_Infinitesimal_not_zero: "x \<notin> Infinitesimal ==> x \<noteq> 0" |
|
509 |
by auto |
|
510 |
||
511 |
lemma not_Infinitesimal_not_zero2: "x \<in> HFinite - Infinitesimal ==> x \<noteq> 0" |
|
512 |
by auto |
|
513 |
||
514 |
lemma HFinite_diff_Infinitesimal_hrabs: |
|
515 |
"(x::hypreal) \<in> HFinite - Infinitesimal ==> abs x \<in> HFinite - Infinitesimal" |
|
516 |
by blast |
|
517 |
||
518 |
lemma hnorm_le_Infinitesimal: |
|
519 |
"\<lbrakk>e \<in> Infinitesimal; hnorm x \<le> e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal" |
|
520 |
by (auto simp add: Infinitesimal_def abs_less_iff) |
|
521 |
||
522 |
lemma hnorm_less_Infinitesimal: |
|
523 |
"\<lbrakk>e \<in> Infinitesimal; hnorm x < e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal" |
|
524 |
by (erule hnorm_le_Infinitesimal, erule order_less_imp_le) |
|
525 |
||
526 |
lemma hrabs_le_Infinitesimal: |
|
527 |
"[| e \<in> Infinitesimal; abs (x::hypreal) \<le> e |] ==> x \<in> Infinitesimal" |
|
528 |
by (erule hnorm_le_Infinitesimal, simp) |
|
529 |
||
530 |
lemma hrabs_less_Infinitesimal: |
|
531 |
"[| e \<in> Infinitesimal; abs (x::hypreal) < e |] ==> x \<in> Infinitesimal" |
|
532 |
by (erule hnorm_less_Infinitesimal, simp) |
|
533 |
||
534 |
lemma Infinitesimal_interval: |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
535 |
"[| e \<in> Infinitesimal; e' \<in> Infinitesimal; e' < x ; x < e |] |
27468 | 536 |
==> (x::hypreal) \<in> Infinitesimal" |
537 |
by (auto simp add: Infinitesimal_def abs_less_iff) |
|
538 |
||
539 |
lemma Infinitesimal_interval2: |
|
540 |
"[| e \<in> Infinitesimal; e' \<in> Infinitesimal; |
|
541 |
e' \<le> x ; x \<le> e |] ==> (x::hypreal) \<in> Infinitesimal" |
|
542 |
by (auto intro: Infinitesimal_interval simp add: order_le_less) |
|
543 |
||
544 |
||
545 |
lemma lemma_Infinitesimal_hyperpow: |
|
546 |
"[| (x::hypreal) \<in> Infinitesimal; 0 < N |] ==> abs (x pow N) \<le> abs x" |
|
547 |
apply (unfold Infinitesimal_def) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
548 |
apply (auto intro!: hyperpow_Suc_le_self2 |
27468 | 549 |
simp add: hyperpow_hrabs [symmetric] hypnat_gt_zero_iff2 abs_ge_zero) |
550 |
done |
|
551 |
||
552 |
lemma Infinitesimal_hyperpow: |
|
553 |
"[| (x::hypreal) \<in> Infinitesimal; 0 < N |] ==> x pow N \<in> Infinitesimal" |
|
554 |
apply (rule hrabs_le_Infinitesimal) |
|
555 |
apply (rule_tac [2] lemma_Infinitesimal_hyperpow, auto) |
|
556 |
done |
|
557 |
||
558 |
lemma hrealpow_hyperpow_Infinitesimal_iff: |
|
559 |
"(x ^ n \<in> Infinitesimal) = (x pow (hypnat_of_nat n) \<in> Infinitesimal)" |
|
560 |
by (simp only: hyperpow_hypnat_of_nat) |
|
561 |
||
562 |
lemma Infinitesimal_hrealpow: |
|
563 |
"[| (x::hypreal) \<in> Infinitesimal; 0 < n |] ==> x ^ n \<in> Infinitesimal" |
|
564 |
by (simp add: hrealpow_hyperpow_Infinitesimal_iff Infinitesimal_hyperpow) |
|
565 |
||
566 |
lemma not_Infinitesimal_mult: |
|
567 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
568 |
shows "[| x \<notin> Infinitesimal; y \<notin> Infinitesimal|] ==> (x*y) \<notin>Infinitesimal" |
|
569 |
apply (unfold Infinitesimal_def, clarify, rename_tac r s) |
|
570 |
apply (simp only: linorder_not_less hnorm_mult) |
|
571 |
apply (drule_tac x = "r * s" in bspec) |
|
572 |
apply (fast intro: Reals_mult) |
|
56544 | 573 |
apply (simp) |
27468 | 574 |
apply (drule_tac c = s and d = "hnorm y" and a = r and b = "hnorm x" in mult_mono) |
575 |
apply (simp_all (no_asm_simp)) |
|
576 |
done |
|
577 |
||
578 |
lemma Infinitesimal_mult_disj: |
|
579 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
580 |
shows "x*y \<in> Infinitesimal ==> x \<in> Infinitesimal | y \<in> Infinitesimal" |
|
581 |
apply (rule ccontr) |
|
582 |
apply (drule de_Morgan_disj [THEN iffD1]) |
|
583 |
apply (fast dest: not_Infinitesimal_mult) |
|
584 |
done |
|
585 |
||
586 |
lemma HFinite_Infinitesimal_not_zero: "x \<in> HFinite-Infinitesimal ==> x \<noteq> 0" |
|
587 |
by blast |
|
588 |
||
589 |
lemma HFinite_Infinitesimal_diff_mult: |
|
590 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
591 |
shows "[| x \<in> HFinite - Infinitesimal; |
|
592 |
y \<in> HFinite - Infinitesimal |
|
593 |
|] ==> (x*y) \<in> HFinite - Infinitesimal" |
|
594 |
apply clarify |
|
595 |
apply (blast dest: HFinite_mult not_Infinitesimal_mult) |
|
596 |
done |
|
597 |
||
598 |
lemma Infinitesimal_subset_HFinite: |
|
599 |
"Infinitesimal \<subseteq> HFinite" |
|
600 |
apply (simp add: Infinitesimal_def HFinite_def, auto) |
|
601 |
apply (rule_tac x = 1 in bexI, auto) |
|
602 |
done |
|
603 |
||
604 |
lemma Infinitesimal_star_of_mult: |
|
605 |
fixes x :: "'a::real_normed_algebra star" |
|
606 |
shows "x \<in> Infinitesimal ==> x * star_of r \<in> Infinitesimal" |
|
607 |
by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult]) |
|
608 |
||
609 |
lemma Infinitesimal_star_of_mult2: |
|
610 |
fixes x :: "'a::real_normed_algebra star" |
|
611 |
shows "x \<in> Infinitesimal ==> star_of r * x \<in> Infinitesimal" |
|
612 |
by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult2]) |
|
613 |
||
614 |
||
615 |
subsection{*The Infinitely Close Relation*} |
|
616 |
||
617 |
lemma mem_infmal_iff: "(x \<in> Infinitesimal) = (x @= 0)" |
|
618 |
by (simp add: Infinitesimal_def approx_def) |
|
619 |
||
620 |
lemma approx_minus_iff: " (x @= y) = (x - y @= 0)" |
|
621 |
by (simp add: approx_def) |
|
622 |
||
623 |
lemma approx_minus_iff2: " (x @= y) = (-y + x @= 0)" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
624 |
by (simp add: approx_def add.commute) |
27468 | 625 |
|
626 |
lemma approx_refl [iff]: "x @= x" |
|
627 |
by (simp add: approx_def Infinitesimal_def) |
|
628 |
||
629 |
lemma hypreal_minus_distrib1: "-(y + -(x::'a::ab_group_add)) = x + -y" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
630 |
by (simp add: add.commute) |
27468 | 631 |
|
632 |
lemma approx_sym: "x @= y ==> y @= x" |
|
633 |
apply (simp add: approx_def) |
|
634 |
apply (drule Infinitesimal_minus_iff [THEN iffD2]) |
|
635 |
apply simp |
|
636 |
done |
|
637 |
||
638 |
lemma approx_trans: "[| x @= y; y @= z |] ==> x @= z" |
|
639 |
apply (simp add: approx_def) |
|
640 |
apply (drule (1) Infinitesimal_add) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
641 |
apply simp |
27468 | 642 |
done |
643 |
||
644 |
lemma approx_trans2: "[| r @= x; s @= x |] ==> r @= s" |
|
645 |
by (blast intro: approx_sym approx_trans) |
|
646 |
||
647 |
lemma approx_trans3: "[| x @= r; x @= s|] ==> r @= s" |
|
648 |
by (blast intro: approx_sym approx_trans) |
|
649 |
||
45541
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
650 |
lemma approx_reorient: "(x @= y) = (y @= x)" |
27468 | 651 |
by (blast intro: approx_sym) |
652 |
||
653 |
(*reorientation simplification procedure: reorients (polymorphic) |
|
654 |
0 = x, 1 = x, nnn = x provided x isn't 0, 1 or a numeral.*) |
|
45541
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
655 |
simproc_setup approx_reorient_simproc |
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
656 |
("0 @= x" | "1 @= y" | "numeral w @= z" | "- 1 @= y" | "- numeral w @= r") = |
45541
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
657 |
{* |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
658 |
let val rule = @{thm approx_reorient} RS eq_reflection |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
659 |
fun proc phi ss ct = case term_of ct of |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
660 |
_ $ t $ u => if can HOLogic.dest_number u then NONE |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
661 |
else if can HOLogic.dest_number t then SOME rule else NONE |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
662 |
| _ => NONE |
934866fc776c
simplify implementation of approx_reorient_simproc
huffman
parents:
45540
diff
changeset
|
663 |
in proc end |
27468 | 664 |
*} |
665 |
||
666 |
lemma Infinitesimal_approx_minus: "(x-y \<in> Infinitesimal) = (x @= y)" |
|
667 |
by (simp add: approx_minus_iff [symmetric] mem_infmal_iff) |
|
668 |
||
669 |
lemma approx_monad_iff: "(x @= y) = (monad(x)=monad(y))" |
|
670 |
apply (simp add: monad_def) |
|
671 |
apply (auto dest: approx_sym elim!: approx_trans equalityCE) |
|
672 |
done |
|
673 |
||
674 |
lemma Infinitesimal_approx: |
|
675 |
"[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> x @= y" |
|
676 |
apply (simp add: mem_infmal_iff) |
|
677 |
apply (blast intro: approx_trans approx_sym) |
|
678 |
done |
|
679 |
||
680 |
lemma approx_add: "[| a @= b; c @= d |] ==> a+c @= b+d" |
|
681 |
proof (unfold approx_def) |
|
682 |
assume inf: "a - b \<in> Infinitesimal" "c - d \<in> Infinitesimal" |
|
683 |
have "a + c - (b + d) = (a - b) + (c - d)" by simp |
|
684 |
also have "... \<in> Infinitesimal" using inf by (rule Infinitesimal_add) |
|
685 |
finally show "a + c - (b + d) \<in> Infinitesimal" . |
|
686 |
qed |
|
687 |
||
688 |
lemma approx_minus: "a @= b ==> -a @= -b" |
|
689 |
apply (rule approx_minus_iff [THEN iffD2, THEN approx_sym]) |
|
690 |
apply (drule approx_minus_iff [THEN iffD1]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
691 |
apply (simp add: add.commute) |
27468 | 692 |
done |
693 |
||
694 |
lemma approx_minus2: "-a @= -b ==> a @= b" |
|
695 |
by (auto dest: approx_minus) |
|
696 |
||
697 |
lemma approx_minus_cancel [simp]: "(-a @= -b) = (a @= b)" |
|
698 |
by (blast intro: approx_minus approx_minus2) |
|
699 |
||
700 |
lemma approx_add_minus: "[| a @= b; c @= d |] ==> a + -c @= b + -d" |
|
701 |
by (blast intro!: approx_add approx_minus) |
|
702 |
||
703 |
lemma approx_diff: "[| a @= b; c @= d |] ==> a - c @= b - d" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
704 |
using approx_add [of a b "- c" "- d"] by simp |
27468 | 705 |
|
706 |
lemma approx_mult1: |
|
707 |
fixes a b c :: "'a::real_normed_algebra star" |
|
708 |
shows "[| a @= b; c: HFinite|] ==> a*c @= b*c" |
|
709 |
by (simp add: approx_def Infinitesimal_HFinite_mult |
|
710 |
left_diff_distrib [symmetric]) |
|
711 |
||
712 |
lemma approx_mult2: |
|
713 |
fixes a b c :: "'a::real_normed_algebra star" |
|
714 |
shows "[|a @= b; c: HFinite|] ==> c*a @= c*b" |
|
715 |
by (simp add: approx_def Infinitesimal_HFinite_mult2 |
|
716 |
right_diff_distrib [symmetric]) |
|
717 |
||
718 |
lemma approx_mult_subst: |
|
719 |
fixes u v x y :: "'a::real_normed_algebra star" |
|
720 |
shows "[|u @= v*x; x @= y; v \<in> HFinite|] ==> u @= v*y" |
|
721 |
by (blast intro: approx_mult2 approx_trans) |
|
722 |
||
723 |
lemma approx_mult_subst2: |
|
724 |
fixes u v x y :: "'a::real_normed_algebra star" |
|
725 |
shows "[| u @= x*v; x @= y; v \<in> HFinite |] ==> u @= y*v" |
|
726 |
by (blast intro: approx_mult1 approx_trans) |
|
727 |
||
728 |
lemma approx_mult_subst_star_of: |
|
729 |
fixes u x y :: "'a::real_normed_algebra star" |
|
730 |
shows "[| u @= x*star_of v; x @= y |] ==> u @= y*star_of v" |
|
731 |
by (auto intro: approx_mult_subst2) |
|
732 |
||
733 |
lemma approx_eq_imp: "a = b ==> a @= b" |
|
734 |
by (simp add: approx_def) |
|
735 |
||
736 |
lemma Infinitesimal_minus_approx: "x \<in> Infinitesimal ==> -x @= x" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
737 |
by (blast intro: Infinitesimal_minus_iff [THEN iffD2] |
27468 | 738 |
mem_infmal_iff [THEN iffD1] approx_trans2) |
739 |
||
740 |
lemma bex_Infinitesimal_iff: "(\<exists>y \<in> Infinitesimal. x - z = y) = (x @= z)" |
|
741 |
by (simp add: approx_def) |
|
742 |
||
743 |
lemma bex_Infinitesimal_iff2: "(\<exists>y \<in> Infinitesimal. x = z + y) = (x @= z)" |
|
744 |
by (force simp add: bex_Infinitesimal_iff [symmetric]) |
|
745 |
||
746 |
lemma Infinitesimal_add_approx: "[| y \<in> Infinitesimal; x + y = z |] ==> x @= z" |
|
747 |
apply (rule bex_Infinitesimal_iff [THEN iffD1]) |
|
748 |
apply (drule Infinitesimal_minus_iff [THEN iffD2]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
749 |
apply (auto simp add: add.assoc [symmetric]) |
27468 | 750 |
done |
751 |
||
752 |
lemma Infinitesimal_add_approx_self: "y \<in> Infinitesimal ==> x @= x + y" |
|
753 |
apply (rule bex_Infinitesimal_iff [THEN iffD1]) |
|
754 |
apply (drule Infinitesimal_minus_iff [THEN iffD2]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
755 |
apply (auto simp add: add.assoc [symmetric]) |
27468 | 756 |
done |
757 |
||
758 |
lemma Infinitesimal_add_approx_self2: "y \<in> Infinitesimal ==> x @= y + x" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
759 |
by (auto dest: Infinitesimal_add_approx_self simp add: add.commute) |
27468 | 760 |
|
761 |
lemma Infinitesimal_add_minus_approx_self: "y \<in> Infinitesimal ==> x @= x + -y" |
|
762 |
by (blast intro!: Infinitesimal_add_approx_self Infinitesimal_minus_iff [THEN iffD2]) |
|
763 |
||
764 |
lemma Infinitesimal_add_cancel: "[| y \<in> Infinitesimal; x+y @= z|] ==> x @= z" |
|
765 |
apply (drule_tac x = x in Infinitesimal_add_approx_self [THEN approx_sym]) |
|
766 |
apply (erule approx_trans3 [THEN approx_sym], assumption) |
|
767 |
done |
|
768 |
||
769 |
lemma Infinitesimal_add_right_cancel: |
|
770 |
"[| y \<in> Infinitesimal; x @= z + y|] ==> x @= z" |
|
771 |
apply (drule_tac x = z in Infinitesimal_add_approx_self2 [THEN approx_sym]) |
|
772 |
apply (erule approx_trans3 [THEN approx_sym]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
773 |
apply (simp add: add.commute) |
27468 | 774 |
apply (erule approx_sym) |
775 |
done |
|
776 |
||
777 |
lemma approx_add_left_cancel: "d + b @= d + c ==> b @= c" |
|
778 |
apply (drule approx_minus_iff [THEN iffD1]) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
779 |
apply (simp add: approx_minus_iff [symmetric] ac_simps) |
27468 | 780 |
done |
781 |
||
782 |
lemma approx_add_right_cancel: "b + d @= c + d ==> b @= c" |
|
783 |
apply (rule approx_add_left_cancel) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
784 |
apply (simp add: add.commute) |
27468 | 785 |
done |
786 |
||
787 |
lemma approx_add_mono1: "b @= c ==> d + b @= d + c" |
|
788 |
apply (rule approx_minus_iff [THEN iffD2]) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
789 |
apply (simp add: approx_minus_iff [symmetric] ac_simps) |
27468 | 790 |
done |
791 |
||
792 |
lemma approx_add_mono2: "b @= c ==> b + a @= c + a" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
793 |
by (simp add: add.commute approx_add_mono1) |
27468 | 794 |
|
795 |
lemma approx_add_left_iff [simp]: "(a + b @= a + c) = (b @= c)" |
|
796 |
by (fast elim: approx_add_left_cancel approx_add_mono1) |
|
797 |
||
798 |
lemma approx_add_right_iff [simp]: "(b + a @= c + a) = (b @= c)" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
799 |
by (simp add: add.commute) |
27468 | 800 |
|
801 |
lemma approx_HFinite: "[| x \<in> HFinite; x @= y |] ==> y \<in> HFinite" |
|
802 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2], safe) |
|
803 |
apply (drule Infinitesimal_subset_HFinite [THEN subsetD, THEN HFinite_minus_iff [THEN iffD2]]) |
|
804 |
apply (drule HFinite_add) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
805 |
apply (auto simp add: add.assoc) |
27468 | 806 |
done |
807 |
||
808 |
lemma approx_star_of_HFinite: "x @= star_of D ==> x \<in> HFinite" |
|
809 |
by (rule approx_sym [THEN [2] approx_HFinite], auto) |
|
810 |
||
811 |
lemma approx_mult_HFinite: |
|
812 |
fixes a b c d :: "'a::real_normed_algebra star" |
|
813 |
shows "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d" |
|
814 |
apply (rule approx_trans) |
|
815 |
apply (rule_tac [2] approx_mult2) |
|
816 |
apply (rule approx_mult1) |
|
817 |
prefer 2 apply (blast intro: approx_HFinite approx_sym, auto) |
|
818 |
done |
|
819 |
||
820 |
lemma scaleHR_left_diff_distrib: |
|
821 |
"\<And>a b x. scaleHR (a - b) x = scaleHR a x - scaleHR b x" |
|
822 |
by transfer (rule scaleR_left_diff_distrib) |
|
823 |
||
824 |
lemma approx_scaleR1: |
|
825 |
"[| a @= star_of b; c: HFinite|] ==> scaleHR a c @= b *\<^sub>R c" |
|
826 |
apply (unfold approx_def) |
|
827 |
apply (drule (1) Infinitesimal_HFinite_scaleHR) |
|
828 |
apply (simp only: scaleHR_left_diff_distrib) |
|
829 |
apply (simp add: scaleHR_def star_scaleR_def [symmetric]) |
|
830 |
done |
|
831 |
||
832 |
lemma approx_scaleR2: |
|
833 |
"a @= b ==> c *\<^sub>R a @= c *\<^sub>R b" |
|
834 |
by (simp add: approx_def Infinitesimal_scaleR2 |
|
835 |
scaleR_right_diff_distrib [symmetric]) |
|
836 |
||
837 |
lemma approx_scaleR_HFinite: |
|
838 |
"[|a @= star_of b; c @= d; d: HFinite|] ==> scaleHR a c @= b *\<^sub>R d" |
|
839 |
apply (rule approx_trans) |
|
840 |
apply (rule_tac [2] approx_scaleR2) |
|
841 |
apply (rule approx_scaleR1) |
|
842 |
prefer 2 apply (blast intro: approx_HFinite approx_sym, auto) |
|
843 |
done |
|
844 |
||
845 |
lemma approx_mult_star_of: |
|
846 |
fixes a c :: "'a::real_normed_algebra star" |
|
847 |
shows "[|a @= star_of b; c @= star_of d |] |
|
848 |
==> a*c @= star_of b*star_of d" |
|
849 |
by (blast intro!: approx_mult_HFinite approx_star_of_HFinite HFinite_star_of) |
|
850 |
||
851 |
lemma approx_SReal_mult_cancel_zero: |
|
852 |
"[| (a::hypreal) \<in> Reals; a \<noteq> 0; a*x @= 0 |] ==> x @= 0" |
|
853 |
apply (drule Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
854 |
apply (auto dest: approx_mult2 simp add: mult.assoc [symmetric]) |
27468 | 855 |
done |
856 |
||
857 |
lemma approx_mult_SReal1: "[| (a::hypreal) \<in> Reals; x @= 0 |] ==> x*a @= 0" |
|
858 |
by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult1) |
|
859 |
||
860 |
lemma approx_mult_SReal2: "[| (a::hypreal) \<in> Reals; x @= 0 |] ==> a*x @= 0" |
|
861 |
by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult2) |
|
862 |
||
863 |
lemma approx_mult_SReal_zero_cancel_iff [simp]: |
|
864 |
"[|(a::hypreal) \<in> Reals; a \<noteq> 0 |] ==> (a*x @= 0) = (x @= 0)" |
|
865 |
by (blast intro: approx_SReal_mult_cancel_zero approx_mult_SReal2) |
|
866 |
||
867 |
lemma approx_SReal_mult_cancel: |
|
868 |
"[| (a::hypreal) \<in> Reals; a \<noteq> 0; a* w @= a*z |] ==> w @= z" |
|
869 |
apply (drule Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
870 |
apply (auto dest: approx_mult2 simp add: mult.assoc [symmetric]) |
27468 | 871 |
done |
872 |
||
873 |
lemma approx_SReal_mult_cancel_iff1 [simp]: |
|
874 |
"[| (a::hypreal) \<in> Reals; a \<noteq> 0|] ==> (a* w @= a*z) = (w @= z)" |
|
875 |
by (auto intro!: approx_mult2 SReal_subset_HFinite [THEN subsetD] |
|
876 |
intro: approx_SReal_mult_cancel) |
|
877 |
||
878 |
lemma approx_le_bound: "[| (z::hypreal) \<le> f; f @= g; g \<le> z |] ==> f @= z" |
|
879 |
apply (simp add: bex_Infinitesimal_iff2 [symmetric], auto) |
|
880 |
apply (rule_tac x = "g+y-z" in bexI) |
|
881 |
apply (simp (no_asm)) |
|
882 |
apply (rule Infinitesimal_interval2) |
|
883 |
apply (rule_tac [2] Infinitesimal_zero, auto) |
|
884 |
done |
|
885 |
||
886 |
lemma approx_hnorm: |
|
887 |
fixes x y :: "'a::real_normed_vector star" |
|
888 |
shows "x \<approx> y \<Longrightarrow> hnorm x \<approx> hnorm y" |
|
889 |
proof (unfold approx_def) |
|
890 |
assume "x - y \<in> Infinitesimal" |
|
891 |
hence 1: "hnorm (x - y) \<in> Infinitesimal" |
|
892 |
by (simp only: Infinitesimal_hnorm_iff) |
|
893 |
moreover have 2: "(0::real star) \<in> Infinitesimal" |
|
894 |
by (rule Infinitesimal_zero) |
|
895 |
moreover have 3: "0 \<le> \<bar>hnorm x - hnorm y\<bar>" |
|
896 |
by (rule abs_ge_zero) |
|
897 |
moreover have 4: "\<bar>hnorm x - hnorm y\<bar> \<le> hnorm (x - y)" |
|
898 |
by (rule hnorm_triangle_ineq3) |
|
899 |
ultimately have "\<bar>hnorm x - hnorm y\<bar> \<in> Infinitesimal" |
|
900 |
by (rule Infinitesimal_interval2) |
|
901 |
thus "hnorm x - hnorm y \<in> Infinitesimal" |
|
902 |
by (simp only: Infinitesimal_hrabs_iff) |
|
903 |
qed |
|
904 |
||
905 |
||
906 |
subsection{* Zero is the Only Infinitesimal that is also a Real*} |
|
907 |
||
908 |
lemma Infinitesimal_less_SReal: |
|
909 |
"[| (x::hypreal) \<in> Reals; y \<in> Infinitesimal; 0 < x |] ==> y < x" |
|
910 |
apply (simp add: Infinitesimal_def) |
|
911 |
apply (rule abs_ge_self [THEN order_le_less_trans], auto) |
|
912 |
done |
|
913 |
||
914 |
lemma Infinitesimal_less_SReal2: |
|
915 |
"(y::hypreal) \<in> Infinitesimal ==> \<forall>r \<in> Reals. 0 < r --> y < r" |
|
916 |
by (blast intro: Infinitesimal_less_SReal) |
|
917 |
||
918 |
lemma SReal_not_Infinitesimal: |
|
919 |
"[| 0 < y; (y::hypreal) \<in> Reals|] ==> y \<notin> Infinitesimal" |
|
920 |
apply (simp add: Infinitesimal_def) |
|
921 |
apply (auto simp add: abs_if) |
|
922 |
done |
|
923 |
||
924 |
lemma SReal_minus_not_Infinitesimal: |
|
925 |
"[| y < 0; (y::hypreal) \<in> Reals |] ==> y \<notin> Infinitesimal" |
|
926 |
apply (subst Infinitesimal_minus_iff [symmetric]) |
|
927 |
apply (rule SReal_not_Infinitesimal, auto) |
|
928 |
done |
|
929 |
||
930 |
lemma SReal_Int_Infinitesimal_zero: "Reals Int Infinitesimal = {0::hypreal}" |
|
931 |
apply auto |
|
932 |
apply (cut_tac x = x and y = 0 in linorder_less_linear) |
|
933 |
apply (blast dest: SReal_not_Infinitesimal SReal_minus_not_Infinitesimal) |
|
934 |
done |
|
935 |
||
936 |
lemma SReal_Infinitesimal_zero: |
|
937 |
"[| (x::hypreal) \<in> Reals; x \<in> Infinitesimal|] ==> x = 0" |
|
938 |
by (cut_tac SReal_Int_Infinitesimal_zero, blast) |
|
939 |
||
940 |
lemma SReal_HFinite_diff_Infinitesimal: |
|
941 |
"[| (x::hypreal) \<in> Reals; x \<noteq> 0 |] ==> x \<in> HFinite - Infinitesimal" |
|
942 |
by (auto dest: SReal_Infinitesimal_zero SReal_subset_HFinite [THEN subsetD]) |
|
943 |
||
944 |
lemma hypreal_of_real_HFinite_diff_Infinitesimal: |
|
945 |
"hypreal_of_real x \<noteq> 0 ==> hypreal_of_real x \<in> HFinite - Infinitesimal" |
|
946 |
by (rule SReal_HFinite_diff_Infinitesimal, auto) |
|
947 |
||
948 |
lemma star_of_Infinitesimal_iff_0 [iff]: |
|
949 |
"(star_of x \<in> Infinitesimal) = (x = 0)" |
|
950 |
apply (auto simp add: Infinitesimal_def) |
|
951 |
apply (drule_tac x="hnorm (star_of x)" in bspec) |
|
952 |
apply (simp add: SReal_def) |
|
953 |
apply (rule_tac x="norm x" in exI, simp) |
|
954 |
apply simp |
|
955 |
done |
|
956 |
||
957 |
lemma star_of_HFinite_diff_Infinitesimal: |
|
958 |
"x \<noteq> 0 ==> star_of x \<in> HFinite - Infinitesimal" |
|
959 |
by simp |
|
960 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
961 |
lemma numeral_not_Infinitesimal [simp]: |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
962 |
"numeral w \<noteq> (0::hypreal) ==> (numeral w :: hypreal) \<notin> Infinitesimal" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
963 |
by (fast dest: Reals_numeral [THEN SReal_Infinitesimal_zero]) |
27468 | 964 |
|
965 |
(*again: 1 is a special case, but not 0 this time*) |
|
966 |
lemma one_not_Infinitesimal [simp]: |
|
967 |
"(1::'a::{real_normed_vector,zero_neq_one} star) \<notin> Infinitesimal" |
|
968 |
apply (simp only: star_one_def star_of_Infinitesimal_iff_0) |
|
969 |
apply simp |
|
970 |
done |
|
971 |
||
972 |
lemma approx_SReal_not_zero: |
|
973 |
"[| (y::hypreal) \<in> Reals; x @= y; y\<noteq> 0 |] ==> x \<noteq> 0" |
|
974 |
apply (cut_tac x = 0 and y = y in linorder_less_linear, simp) |
|
975 |
apply (blast dest: approx_sym [THEN mem_infmal_iff [THEN iffD2]] SReal_not_Infinitesimal SReal_minus_not_Infinitesimal) |
|
976 |
done |
|
977 |
||
978 |
lemma HFinite_diff_Infinitesimal_approx: |
|
979 |
"[| x @= y; y \<in> HFinite - Infinitesimal |] |
|
980 |
==> x \<in> HFinite - Infinitesimal" |
|
981 |
apply (auto intro: approx_sym [THEN [2] approx_HFinite] |
|
982 |
simp add: mem_infmal_iff) |
|
983 |
apply (drule approx_trans3, assumption) |
|
984 |
apply (blast dest: approx_sym) |
|
985 |
done |
|
986 |
||
987 |
(*The premise y\<noteq>0 is essential; otherwise x/y =0 and we lose the |
|
988 |
HFinite premise.*) |
|
989 |
lemma Infinitesimal_ratio: |
|
990 |
fixes x y :: "'a::{real_normed_div_algebra,field} star" |
|
991 |
shows "[| y \<noteq> 0; y \<in> Infinitesimal; x/y \<in> HFinite |] |
|
992 |
==> x \<in> Infinitesimal" |
|
993 |
apply (drule Infinitesimal_HFinite_mult2, assumption) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
994 |
apply (simp add: divide_inverse mult.assoc) |
27468 | 995 |
done |
996 |
||
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
997 |
lemma Infinitesimal_SReal_divide: |
27468 | 998 |
"[| (x::hypreal) \<in> Infinitesimal; y \<in> Reals |] ==> x/y \<in> Infinitesimal" |
999 |
apply (simp add: divide_inverse) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1000 |
apply (auto intro!: Infinitesimal_HFinite_mult |
27468 | 1001 |
dest!: Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
1002 |
done |
|
1003 |
||
1004 |
(*------------------------------------------------------------------ |
|
1005 |
Standard Part Theorem: Every finite x: R* is infinitely |
|
1006 |
close to a unique real number (i.e a member of Reals) |
|
1007 |
------------------------------------------------------------------*) |
|
1008 |
||
1009 |
subsection{* Uniqueness: Two Infinitely Close Reals are Equal*} |
|
1010 |
||
1011 |
lemma star_of_approx_iff [simp]: "(star_of x @= star_of y) = (x = y)" |
|
1012 |
apply safe |
|
1013 |
apply (simp add: approx_def) |
|
1014 |
apply (simp only: star_of_diff [symmetric]) |
|
1015 |
apply (simp only: star_of_Infinitesimal_iff_0) |
|
1016 |
apply simp |
|
1017 |
done |
|
1018 |
||
1019 |
lemma SReal_approx_iff: |
|
1020 |
"[|(x::hypreal) \<in> Reals; y \<in> Reals|] ==> (x @= y) = (x = y)" |
|
1021 |
apply auto |
|
1022 |
apply (simp add: approx_def) |
|
1023 |
apply (drule (1) Reals_diff) |
|
1024 |
apply (drule (1) SReal_Infinitesimal_zero) |
|
1025 |
apply simp |
|
1026 |
done |
|
1027 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1028 |
lemma numeral_approx_iff [simp]: |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1029 |
"(numeral v @= (numeral w :: 'a::{numeral,real_normed_vector} star)) = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1030 |
(numeral v = (numeral w :: 'a))" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1031 |
apply (unfold star_numeral_def) |
27468 | 1032 |
apply (rule star_of_approx_iff) |
1033 |
done |
|
1034 |
||
1035 |
(*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*) |
|
1036 |
lemma [simp]: |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1037 |
"(numeral w @= (0::'a::{numeral,real_normed_vector} star)) = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1038 |
(numeral w = (0::'a))" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1039 |
"((0::'a::{numeral,real_normed_vector} star) @= numeral w) = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1040 |
(numeral w = (0::'a))" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1041 |
"(numeral w @= (1::'b::{numeral,one,real_normed_vector} star)) = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1042 |
(numeral w = (1::'b))" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1043 |
"((1::'b::{numeral,one,real_normed_vector} star) @= numeral w) = |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1044 |
(numeral w = (1::'b))" |
27468 | 1045 |
"~ (0 @= (1::'c::{zero_neq_one,real_normed_vector} star))" |
1046 |
"~ (1 @= (0::'c::{zero_neq_one,real_normed_vector} star))" |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1047 |
apply (unfold star_numeral_def star_zero_def star_one_def) |
27468 | 1048 |
apply (unfold star_of_approx_iff) |
1049 |
by (auto intro: sym) |
|
1050 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1051 |
lemma star_of_approx_numeral_iff [simp]: |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1052 |
"(star_of k @= numeral w) = (k = numeral w)" |
27468 | 1053 |
by (subst star_of_approx_iff [symmetric], auto) |
1054 |
||
1055 |
lemma star_of_approx_zero_iff [simp]: "(star_of k @= 0) = (k = 0)" |
|
1056 |
by (simp_all add: star_of_approx_iff [symmetric]) |
|
1057 |
||
1058 |
lemma star_of_approx_one_iff [simp]: "(star_of k @= 1) = (k = 1)" |
|
1059 |
by (simp_all add: star_of_approx_iff [symmetric]) |
|
1060 |
||
1061 |
lemma approx_unique_real: |
|
1062 |
"[| (r::hypreal) \<in> Reals; s \<in> Reals; r @= x; s @= x|] ==> r = s" |
|
1063 |
by (blast intro: SReal_approx_iff [THEN iffD1] approx_trans2) |
|
1064 |
||
1065 |
||
1066 |
subsection{* Existence of Unique Real Infinitely Close*} |
|
1067 |
||
1068 |
subsubsection{*Lifting of the Ub and Lub Properties*} |
|
1069 |
||
1070 |
lemma hypreal_of_real_isUb_iff: |
|
1071 |
"(isUb (Reals) (hypreal_of_real ` Q) (hypreal_of_real Y)) = |
|
1072 |
(isUb (UNIV :: real set) Q Y)" |
|
1073 |
by (simp add: isUb_def setle_def) |
|
1074 |
||
1075 |
lemma hypreal_of_real_isLub1: |
|
1076 |
"isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y) |
|
1077 |
==> isLub (UNIV :: real set) Q Y" |
|
1078 |
apply (simp add: isLub_def leastP_def) |
|
1079 |
apply (auto intro: hypreal_of_real_isUb_iff [THEN iffD2] |
|
1080 |
simp add: hypreal_of_real_isUb_iff setge_def) |
|
1081 |
done |
|
1082 |
||
1083 |
lemma hypreal_of_real_isLub2: |
|
1084 |
"isLub (UNIV :: real set) Q Y |
|
1085 |
==> isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)" |
|
56225 | 1086 |
apply (auto simp add: isLub_def leastP_def hypreal_of_real_isUb_iff setge_def) |
1087 |
by (metis SReal_iff hypreal_of_real_isUb_iff isUbD2a star_of_le) |
|
27468 | 1088 |
|
1089 |
lemma hypreal_of_real_isLub_iff: |
|
1090 |
"(isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)) = |
|
1091 |
(isLub (UNIV :: real set) Q Y)" |
|
1092 |
by (blast intro: hypreal_of_real_isLub1 hypreal_of_real_isLub2) |
|
1093 |
||
1094 |
lemma lemma_isUb_hypreal_of_real: |
|
1095 |
"isUb Reals P Y ==> \<exists>Yo. isUb Reals P (hypreal_of_real Yo)" |
|
1096 |
by (auto simp add: SReal_iff isUb_def) |
|
1097 |
||
1098 |
lemma lemma_isLub_hypreal_of_real: |
|
1099 |
"isLub Reals P Y ==> \<exists>Yo. isLub Reals P (hypreal_of_real Yo)" |
|
1100 |
by (auto simp add: isLub_def leastP_def isUb_def SReal_iff) |
|
1101 |
||
1102 |
lemma lemma_isLub_hypreal_of_real2: |
|
1103 |
"\<exists>Yo. isLub Reals P (hypreal_of_real Yo) ==> \<exists>Y. isLub Reals P Y" |
|
1104 |
by (auto simp add: isLub_def leastP_def isUb_def) |
|
1105 |
||
1106 |
lemma SReal_complete: |
|
1107 |
"[| P \<subseteq> Reals; \<exists>x. x \<in> P; \<exists>Y. isUb Reals P Y |] |
|
1108 |
==> \<exists>t::hypreal. isLub Reals P t" |
|
1109 |
apply (frule SReal_hypreal_of_real_image) |
|
1110 |
apply (auto, drule lemma_isUb_hypreal_of_real) |
|
1111 |
apply (auto intro!: reals_complete lemma_isLub_hypreal_of_real2 |
|
1112 |
simp add: hypreal_of_real_isLub_iff hypreal_of_real_isUb_iff) |
|
1113 |
done |
|
1114 |
||
1115 |
(* lemma about lubs *) |
|
1116 |
||
1117 |
lemma lemma_st_part_ub: |
|
1118 |
"(x::hypreal) \<in> HFinite ==> \<exists>u. isUb Reals {s. s \<in> Reals & s < x} u" |
|
1119 |
apply (drule HFiniteD, safe) |
|
1120 |
apply (rule exI, rule isUbI) |
|
1121 |
apply (auto intro: setleI isUbI simp add: abs_less_iff) |
|
1122 |
done |
|
1123 |
||
1124 |
lemma lemma_st_part_nonempty: |
|
1125 |
"(x::hypreal) \<in> HFinite ==> \<exists>y. y \<in> {s. s \<in> Reals & s < x}" |
|
1126 |
apply (drule HFiniteD, safe) |
|
1127 |
apply (drule Reals_minus) |
|
1128 |
apply (rule_tac x = "-t" in exI) |
|
1129 |
apply (auto simp add: abs_less_iff) |
|
1130 |
done |
|
1131 |
||
1132 |
lemma lemma_st_part_lub: |
|
1133 |
"(x::hypreal) \<in> HFinite ==> \<exists>t. isLub Reals {s. s \<in> Reals & s < x} t" |
|
56225 | 1134 |
by (blast intro!: SReal_complete lemma_st_part_ub lemma_st_part_nonempty Collect_restrict) |
27468 | 1135 |
|
1136 |
lemma lemma_st_part_le1: |
|
1137 |
"[| (x::hypreal) \<in> HFinite; isLub Reals {s. s \<in> Reals & s < x} t; |
|
1138 |
r \<in> Reals; 0 < r |] ==> x \<le> t + r" |
|
1139 |
apply (frule isLubD1a) |
|
1140 |
apply (rule ccontr, drule linorder_not_le [THEN iffD2]) |
|
1141 |
apply (drule (1) Reals_add) |
|
1142 |
apply (drule_tac y = "r + t" in isLubD1 [THEN setleD], auto) |
|
1143 |
done |
|
1144 |
||
1145 |
lemma hypreal_setle_less_trans: |
|
1146 |
"[| S *<= (x::hypreal); x < y |] ==> S *<= y" |
|
1147 |
apply (simp add: setle_def) |
|
1148 |
apply (auto dest!: bspec order_le_less_trans intro: order_less_imp_le) |
|
1149 |
done |
|
1150 |
||
1151 |
lemma hypreal_gt_isUb: |
|
1152 |
"[| isUb R S (x::hypreal); x < y; y \<in> R |] ==> isUb R S y" |
|
1153 |
apply (simp add: isUb_def) |
|
1154 |
apply (blast intro: hypreal_setle_less_trans) |
|
1155 |
done |
|
1156 |
||
1157 |
lemma lemma_st_part_gt_ub: |
|
1158 |
"[| (x::hypreal) \<in> HFinite; x < y; y \<in> Reals |] |
|
1159 |
==> isUb Reals {s. s \<in> Reals & s < x} y" |
|
1160 |
by (auto dest: order_less_trans intro: order_less_imp_le intro!: isUbI setleI) |
|
1161 |
||
1162 |
lemma lemma_minus_le_zero: "t \<le> t + -r ==> r \<le> (0::hypreal)" |
|
1163 |
apply (drule_tac c = "-t" in add_left_mono) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1164 |
apply (auto simp add: add.assoc [symmetric]) |
27468 | 1165 |
done |
1166 |
||
1167 |
lemma lemma_st_part_le2: |
|
1168 |
"[| (x::hypreal) \<in> HFinite; |
|
1169 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1170 |
r \<in> Reals; 0 < r |] |
|
1171 |
==> t + -r \<le> x" |
|
1172 |
apply (frule isLubD1a) |
|
1173 |
apply (rule ccontr, drule linorder_not_le [THEN iffD1]) |
|
1174 |
apply (drule Reals_minus, drule_tac a = t in Reals_add, assumption) |
|
1175 |
apply (drule lemma_st_part_gt_ub, assumption+) |
|
1176 |
apply (drule isLub_le_isUb, assumption) |
|
1177 |
apply (drule lemma_minus_le_zero) |
|
1178 |
apply (auto dest: order_less_le_trans) |
|
1179 |
done |
|
1180 |
||
1181 |
lemma lemma_st_part1a: |
|
1182 |
"[| (x::hypreal) \<in> HFinite; |
|
1183 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1184 |
r \<in> Reals; 0 < r |] |
|
1185 |
==> x + -t \<le> r" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1186 |
apply (subgoal_tac "x \<le> t+r") |
27468 | 1187 |
apply (auto intro: lemma_st_part_le1) |
1188 |
done |
|
1189 |
||
1190 |
lemma lemma_st_part2a: |
|
1191 |
"[| (x::hypreal) \<in> HFinite; |
|
1192 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1193 |
r \<in> Reals; 0 < r |] |
|
1194 |
==> -(x + -t) \<le> r" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1195 |
apply (subgoal_tac "(t + -r \<le> x)") |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
1196 |
apply simp |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
1197 |
apply (rule lemma_st_part_le2) |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
1198 |
apply auto |
27468 | 1199 |
done |
1200 |
||
1201 |
lemma lemma_SReal_ub: |
|
1202 |
"(x::hypreal) \<in> Reals ==> isUb Reals {s. s \<in> Reals & s < x} x" |
|
1203 |
by (auto intro: isUbI setleI order_less_imp_le) |
|
1204 |
||
1205 |
lemma lemma_SReal_lub: |
|
1206 |
"(x::hypreal) \<in> Reals ==> isLub Reals {s. s \<in> Reals & s < x} x" |
|
1207 |
apply (auto intro!: isLubI2 lemma_SReal_ub setgeI) |
|
1208 |
apply (frule isUbD2a) |
|
1209 |
apply (rule_tac x = x and y = y in linorder_cases) |
|
1210 |
apply (auto intro!: order_less_imp_le) |
|
1211 |
apply (drule SReal_dense, assumption, assumption, safe) |
|
1212 |
apply (drule_tac y = r in isUbD) |
|
1213 |
apply (auto dest: order_less_le_trans) |
|
1214 |
done |
|
1215 |
||
1216 |
lemma lemma_st_part_not_eq1: |
|
1217 |
"[| (x::hypreal) \<in> HFinite; |
|
1218 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1219 |
r \<in> Reals; 0 < r |] |
|
1220 |
==> x + -t \<noteq> r" |
|
1221 |
apply auto |
|
1222 |
apply (frule isLubD1a [THEN Reals_minus]) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
1223 |
using Reals_add_cancel [of x "- t"] apply simp |
27468 | 1224 |
apply (drule_tac x = x in lemma_SReal_lub) |
56225 | 1225 |
apply (drule isLub_unique, assumption, auto) |
27468 | 1226 |
done |
1227 |
||
1228 |
lemma lemma_st_part_not_eq2: |
|
1229 |
"[| (x::hypreal) \<in> HFinite; |
|
1230 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1231 |
r \<in> Reals; 0 < r |] |
|
1232 |
==> -(x + -t) \<noteq> r" |
|
1233 |
apply (auto) |
|
1234 |
apply (frule isLubD1a) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
51521
diff
changeset
|
1235 |
using Reals_add_cancel [of "- x" t] apply simp |
27468 | 1236 |
apply (drule_tac x = x in lemma_SReal_lub) |
56225 | 1237 |
apply (drule isLub_unique, assumption, auto) |
27468 | 1238 |
done |
1239 |
||
1240 |
lemma lemma_st_part_major: |
|
1241 |
"[| (x::hypreal) \<in> HFinite; |
|
1242 |
isLub Reals {s. s \<in> Reals & s < x} t; |
|
1243 |
r \<in> Reals; 0 < r |] |
|
1244 |
==> abs (x - t) < r" |
|
1245 |
apply (frule lemma_st_part1a) |
|
1246 |
apply (frule_tac [4] lemma_st_part2a, auto) |
|
1247 |
apply (drule order_le_imp_less_or_eq)+ |
|
1248 |
apply (auto dest: lemma_st_part_not_eq1 lemma_st_part_not_eq2 simp add: abs_less_iff) |
|
1249 |
done |
|
1250 |
||
1251 |
lemma lemma_st_part_major2: |
|
1252 |
"[| (x::hypreal) \<in> HFinite; isLub Reals {s. s \<in> Reals & s < x} t |] |
|
1253 |
==> \<forall>r \<in> Reals. 0 < r --> abs (x - t) < r" |
|
1254 |
by (blast dest!: lemma_st_part_major) |
|
1255 |
||
1256 |
||
1257 |
text{*Existence of real and Standard Part Theorem*} |
|
1258 |
lemma lemma_st_part_Ex: |
|
1259 |
"(x::hypreal) \<in> HFinite |
|
1260 |
==> \<exists>t \<in> Reals. \<forall>r \<in> Reals. 0 < r --> abs (x - t) < r" |
|
1261 |
apply (frule lemma_st_part_lub, safe) |
|
1262 |
apply (frule isLubD1a) |
|
1263 |
apply (blast dest: lemma_st_part_major2) |
|
1264 |
done |
|
1265 |
||
1266 |
lemma st_part_Ex: |
|
1267 |
"(x::hypreal) \<in> HFinite ==> \<exists>t \<in> Reals. x @= t" |
|
1268 |
apply (simp add: approx_def Infinitesimal_def) |
|
1269 |
apply (drule lemma_st_part_Ex, auto) |
|
1270 |
done |
|
1271 |
||
1272 |
text{*There is a unique real infinitely close*} |
|
1273 |
lemma st_part_Ex1: "x \<in> HFinite ==> EX! t::hypreal. t \<in> Reals & x @= t" |
|
1274 |
apply (drule st_part_Ex, safe) |
|
1275 |
apply (drule_tac [2] approx_sym, drule_tac [2] approx_sym, drule_tac [2] approx_sym) |
|
1276 |
apply (auto intro!: approx_unique_real) |
|
1277 |
done |
|
1278 |
||
1279 |
subsection{* Finite, Infinite and Infinitesimal*} |
|
1280 |
||
1281 |
lemma HFinite_Int_HInfinite_empty [simp]: "HFinite Int HInfinite = {}" |
|
1282 |
apply (simp add: HFinite_def HInfinite_def) |
|
1283 |
apply (auto dest: order_less_trans) |
|
1284 |
done |
|
1285 |
||
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1286 |
lemma HFinite_not_HInfinite: |
27468 | 1287 |
assumes x: "x \<in> HFinite" shows "x \<notin> HInfinite" |
1288 |
proof |
|
1289 |
assume x': "x \<in> HInfinite" |
|
1290 |
with x have "x \<in> HFinite \<inter> HInfinite" by blast |
|
1291 |
thus False by auto |
|
1292 |
qed |
|
1293 |
||
1294 |
lemma not_HFinite_HInfinite: "x\<notin> HFinite ==> x \<in> HInfinite" |
|
1295 |
apply (simp add: HInfinite_def HFinite_def, auto) |
|
1296 |
apply (drule_tac x = "r + 1" in bspec) |
|
1297 |
apply (auto) |
|
1298 |
done |
|
1299 |
||
1300 |
lemma HInfinite_HFinite_disj: "x \<in> HInfinite | x \<in> HFinite" |
|
1301 |
by (blast intro: not_HFinite_HInfinite) |
|
1302 |
||
1303 |
lemma HInfinite_HFinite_iff: "(x \<in> HInfinite) = (x \<notin> HFinite)" |
|
1304 |
by (blast dest: HFinite_not_HInfinite not_HFinite_HInfinite) |
|
1305 |
||
1306 |
lemma HFinite_HInfinite_iff: "(x \<in> HFinite) = (x \<notin> HInfinite)" |
|
1307 |
by (simp add: HInfinite_HFinite_iff) |
|
1308 |
||
1309 |
||
1310 |
lemma HInfinite_diff_HFinite_Infinitesimal_disj: |
|
1311 |
"x \<notin> Infinitesimal ==> x \<in> HInfinite | x \<in> HFinite - Infinitesimal" |
|
1312 |
by (fast intro: not_HFinite_HInfinite) |
|
1313 |
||
1314 |
lemma HFinite_inverse: |
|
1315 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1316 |
shows "[| x \<in> HFinite; x \<notin> Infinitesimal |] ==> inverse x \<in> HFinite" |
|
1317 |
apply (subgoal_tac "x \<noteq> 0") |
|
1318 |
apply (cut_tac x = "inverse x" in HInfinite_HFinite_disj) |
|
1319 |
apply (auto dest!: HInfinite_inverse_Infinitesimal |
|
1320 |
simp add: nonzero_inverse_inverse_eq) |
|
1321 |
done |
|
1322 |
||
1323 |
lemma HFinite_inverse2: |
|
1324 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1325 |
shows "x \<in> HFinite - Infinitesimal ==> inverse x \<in> HFinite" |
|
1326 |
by (blast intro: HFinite_inverse) |
|
1327 |
||
1328 |
(* stronger statement possible in fact *) |
|
1329 |
lemma Infinitesimal_inverse_HFinite: |
|
1330 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1331 |
shows "x \<notin> Infinitesimal ==> inverse(x) \<in> HFinite" |
|
1332 |
apply (drule HInfinite_diff_HFinite_Infinitesimal_disj) |
|
1333 |
apply (blast intro: HFinite_inverse HInfinite_inverse_Infinitesimal Infinitesimal_subset_HFinite [THEN subsetD]) |
|
1334 |
done |
|
1335 |
||
1336 |
lemma HFinite_not_Infinitesimal_inverse: |
|
1337 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1338 |
shows "x \<in> HFinite - Infinitesimal ==> inverse x \<in> HFinite - Infinitesimal" |
|
1339 |
apply (auto intro: Infinitesimal_inverse_HFinite) |
|
1340 |
apply (drule Infinitesimal_HFinite_mult2, assumption) |
|
56225 | 1341 |
apply (simp add: not_Infinitesimal_not_zero) |
27468 | 1342 |
done |
1343 |
||
1344 |
lemma approx_inverse: |
|
1345 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
1346 |
shows |
|
1347 |
"[| x @= y; y \<in> HFinite - Infinitesimal |] |
|
1348 |
==> inverse x @= inverse y" |
|
1349 |
apply (frule HFinite_diff_Infinitesimal_approx, assumption) |
|
1350 |
apply (frule not_Infinitesimal_not_zero2) |
|
1351 |
apply (frule_tac x = x in not_Infinitesimal_not_zero2) |
|
1352 |
apply (drule HFinite_inverse2)+ |
|
1353 |
apply (drule approx_mult2, assumption, auto) |
|
1354 |
apply (drule_tac c = "inverse x" in approx_mult1, assumption) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1355 |
apply (auto intro: approx_sym simp add: mult.assoc) |
27468 | 1356 |
done |
1357 |
||
1358 |
(*Used for NSLIM_inverse, NSLIMSEQ_inverse*) |
|
1359 |
lemmas star_of_approx_inverse = star_of_HFinite_diff_Infinitesimal [THEN [2] approx_inverse] |
|
1360 |
lemmas hypreal_of_real_approx_inverse = hypreal_of_real_HFinite_diff_Infinitesimal [THEN [2] approx_inverse] |
|
1361 |
||
1362 |
lemma inverse_add_Infinitesimal_approx: |
|
1363 |
fixes x h :: "'a::real_normed_div_algebra star" |
|
1364 |
shows |
|
1365 |
"[| x \<in> HFinite - Infinitesimal; |
|
1366 |
h \<in> Infinitesimal |] ==> inverse(x + h) @= inverse x" |
|
1367 |
apply (auto intro: approx_inverse approx_sym Infinitesimal_add_approx_self) |
|
1368 |
done |
|
1369 |
||
1370 |
lemma inverse_add_Infinitesimal_approx2: |
|
1371 |
fixes x h :: "'a::real_normed_div_algebra star" |
|
1372 |
shows |
|
1373 |
"[| x \<in> HFinite - Infinitesimal; |
|
1374 |
h \<in> Infinitesimal |] ==> inverse(h + x) @= inverse x" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1375 |
apply (rule add.commute [THEN subst]) |
27468 | 1376 |
apply (blast intro: inverse_add_Infinitesimal_approx) |
1377 |
done |
|
1378 |
||
1379 |
lemma inverse_add_Infinitesimal_approx_Infinitesimal: |
|
1380 |
fixes x h :: "'a::real_normed_div_algebra star" |
|
1381 |
shows |
|
1382 |
"[| x \<in> HFinite - Infinitesimal; |
|
1383 |
h \<in> Infinitesimal |] ==> inverse(x + h) - inverse x @= h" |
|
1384 |
apply (rule approx_trans2) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1385 |
apply (auto intro: inverse_add_Infinitesimal_approx |
27468 | 1386 |
simp add: mem_infmal_iff approx_minus_iff [symmetric]) |
1387 |
done |
|
1388 |
||
1389 |
lemma Infinitesimal_square_iff: |
|
1390 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1391 |
shows "(x \<in> Infinitesimal) = (x*x \<in> Infinitesimal)" |
|
1392 |
apply (auto intro: Infinitesimal_mult) |
|
1393 |
apply (rule ccontr, frule Infinitesimal_inverse_HFinite) |
|
1394 |
apply (frule not_Infinitesimal_not_zero) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1395 |
apply (auto dest: Infinitesimal_HFinite_mult simp add: mult.assoc) |
27468 | 1396 |
done |
1397 |
declare Infinitesimal_square_iff [symmetric, simp] |
|
1398 |
||
1399 |
lemma HFinite_square_iff [simp]: |
|
1400 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1401 |
shows "(x*x \<in> HFinite) = (x \<in> HFinite)" |
|
1402 |
apply (auto intro: HFinite_mult) |
|
1403 |
apply (auto dest: HInfinite_mult simp add: HFinite_HInfinite_iff) |
|
1404 |
done |
|
1405 |
||
1406 |
lemma HInfinite_square_iff [simp]: |
|
1407 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1408 |
shows "(x*x \<in> HInfinite) = (x \<in> HInfinite)" |
|
1409 |
by (auto simp add: HInfinite_HFinite_iff) |
|
1410 |
||
1411 |
lemma approx_HFinite_mult_cancel: |
|
1412 |
fixes a w z :: "'a::real_normed_div_algebra star" |
|
1413 |
shows "[| a: HFinite-Infinitesimal; a* w @= a*z |] ==> w @= z" |
|
1414 |
apply safe |
|
1415 |
apply (frule HFinite_inverse, assumption) |
|
1416 |
apply (drule not_Infinitesimal_not_zero) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1417 |
apply (auto dest: approx_mult2 simp add: mult.assoc [symmetric]) |
27468 | 1418 |
done |
1419 |
||
1420 |
lemma approx_HFinite_mult_cancel_iff1: |
|
1421 |
fixes a w z :: "'a::real_normed_div_algebra star" |
|
1422 |
shows "a: HFinite-Infinitesimal ==> (a * w @= a * z) = (w @= z)" |
|
1423 |
by (auto intro: approx_mult2 approx_HFinite_mult_cancel) |
|
1424 |
||
1425 |
lemma HInfinite_HFinite_add_cancel: |
|
1426 |
"[| x + y \<in> HInfinite; y \<in> HFinite |] ==> x \<in> HInfinite" |
|
1427 |
apply (rule ccontr) |
|
1428 |
apply (drule HFinite_HInfinite_iff [THEN iffD2]) |
|
1429 |
apply (auto dest: HFinite_add simp add: HInfinite_HFinite_iff) |
|
1430 |
done |
|
1431 |
||
1432 |
lemma HInfinite_HFinite_add: |
|
1433 |
"[| x \<in> HInfinite; y \<in> HFinite |] ==> x + y \<in> HInfinite" |
|
1434 |
apply (rule_tac y = "-y" in HInfinite_HFinite_add_cancel) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1435 |
apply (auto simp add: add.assoc HFinite_minus_iff) |
27468 | 1436 |
done |
1437 |
||
1438 |
lemma HInfinite_ge_HInfinite: |
|
1439 |
"[| (x::hypreal) \<in> HInfinite; x \<le> y; 0 \<le> x |] ==> y \<in> HInfinite" |
|
1440 |
by (auto intro: HFinite_bounded simp add: HInfinite_HFinite_iff) |
|
1441 |
||
1442 |
lemma Infinitesimal_inverse_HInfinite: |
|
1443 |
fixes x :: "'a::real_normed_div_algebra star" |
|
1444 |
shows "[| x \<in> Infinitesimal; x \<noteq> 0 |] ==> inverse x \<in> HInfinite" |
|
1445 |
apply (rule ccontr, drule HFinite_HInfinite_iff [THEN iffD2]) |
|
1446 |
apply (auto dest: Infinitesimal_HFinite_mult2) |
|
1447 |
done |
|
1448 |
||
1449 |
lemma HInfinite_HFinite_not_Infinitesimal_mult: |
|
1450 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
1451 |
shows "[| x \<in> HInfinite; y \<in> HFinite - Infinitesimal |] |
|
1452 |
==> x * y \<in> HInfinite" |
|
1453 |
apply (rule ccontr, drule HFinite_HInfinite_iff [THEN iffD2]) |
|
1454 |
apply (frule HFinite_Infinitesimal_not_zero) |
|
1455 |
apply (drule HFinite_not_Infinitesimal_inverse) |
|
1456 |
apply (safe, drule HFinite_mult) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1457 |
apply (auto simp add: mult.assoc HFinite_HInfinite_iff) |
27468 | 1458 |
done |
1459 |
||
1460 |
lemma HInfinite_HFinite_not_Infinitesimal_mult2: |
|
1461 |
fixes x y :: "'a::real_normed_div_algebra star" |
|
1462 |
shows "[| x \<in> HInfinite; y \<in> HFinite - Infinitesimal |] |
|
1463 |
==> y * x \<in> HInfinite" |
|
1464 |
apply (rule ccontr, drule HFinite_HInfinite_iff [THEN iffD2]) |
|
1465 |
apply (frule HFinite_Infinitesimal_not_zero) |
|
1466 |
apply (drule HFinite_not_Infinitesimal_inverse) |
|
1467 |
apply (safe, drule_tac x="inverse y" in HFinite_mult) |
|
1468 |
apply assumption |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1469 |
apply (auto simp add: mult.assoc [symmetric] HFinite_HInfinite_iff) |
27468 | 1470 |
done |
1471 |
||
1472 |
lemma HInfinite_gt_SReal: |
|
1473 |
"[| (x::hypreal) \<in> HInfinite; 0 < x; y \<in> Reals |] ==> y < x" |
|
1474 |
by (auto dest!: bspec simp add: HInfinite_def abs_if order_less_imp_le) |
|
1475 |
||
1476 |
lemma HInfinite_gt_zero_gt_one: |
|
1477 |
"[| (x::hypreal) \<in> HInfinite; 0 < x |] ==> 1 < x" |
|
1478 |
by (auto intro: HInfinite_gt_SReal) |
|
1479 |
||
1480 |
||
1481 |
lemma not_HInfinite_one [simp]: "1 \<notin> HInfinite" |
|
1482 |
apply (simp (no_asm) add: HInfinite_HFinite_iff) |
|
1483 |
done |
|
1484 |
||
1485 |
lemma approx_hrabs_disj: "abs (x::hypreal) @= x | abs x @= -x" |
|
1486 |
by (cut_tac x = x in hrabs_disj, auto) |
|
1487 |
||
1488 |
||
1489 |
subsection{*Theorems about Monads*} |
|
1490 |
||
1491 |
lemma monad_hrabs_Un_subset: "monad (abs x) \<le> monad(x::hypreal) Un monad(-x)" |
|
1492 |
by (rule_tac x1 = x in hrabs_disj [THEN disjE], auto) |
|
1493 |
||
1494 |
lemma Infinitesimal_monad_eq: "e \<in> Infinitesimal ==> monad (x+e) = monad x" |
|
1495 |
by (fast intro!: Infinitesimal_add_approx_self [THEN approx_sym] approx_monad_iff [THEN iffD1]) |
|
1496 |
||
1497 |
lemma mem_monad_iff: "(u \<in> monad x) = (-u \<in> monad (-x))" |
|
1498 |
by (simp add: monad_def) |
|
1499 |
||
1500 |
lemma Infinitesimal_monad_zero_iff: "(x \<in> Infinitesimal) = (x \<in> monad 0)" |
|
1501 |
by (auto intro: approx_sym simp add: monad_def mem_infmal_iff) |
|
1502 |
||
1503 |
lemma monad_zero_minus_iff: "(x \<in> monad 0) = (-x \<in> monad 0)" |
|
1504 |
apply (simp (no_asm) add: Infinitesimal_monad_zero_iff [symmetric]) |
|
1505 |
done |
|
1506 |
||
1507 |
lemma monad_zero_hrabs_iff: "((x::hypreal) \<in> monad 0) = (abs x \<in> monad 0)" |
|
1508 |
apply (rule_tac x1 = x in hrabs_disj [THEN disjE]) |
|
1509 |
apply (auto simp add: monad_zero_minus_iff [symmetric]) |
|
1510 |
done |
|
1511 |
||
1512 |
lemma mem_monad_self [simp]: "x \<in> monad x" |
|
1513 |
by (simp add: monad_def) |
|
1514 |
||
1515 |
||
1516 |
subsection{*Proof that @{term "x @= y"} implies @{term"\<bar>x\<bar> @= \<bar>y\<bar>"}*} |
|
1517 |
||
1518 |
lemma approx_subset_monad: "x @= y ==> {x,y} \<le> monad x" |
|
1519 |
apply (simp (no_asm)) |
|
1520 |
apply (simp add: approx_monad_iff) |
|
1521 |
done |
|
1522 |
||
1523 |
lemma approx_subset_monad2: "x @= y ==> {x,y} \<le> monad y" |
|
1524 |
apply (drule approx_sym) |
|
1525 |
apply (fast dest: approx_subset_monad) |
|
1526 |
done |
|
1527 |
||
1528 |
lemma mem_monad_approx: "u \<in> monad x ==> x @= u" |
|
1529 |
by (simp add: monad_def) |
|
1530 |
||
1531 |
lemma approx_mem_monad: "x @= u ==> u \<in> monad x" |
|
1532 |
by (simp add: monad_def) |
|
1533 |
||
1534 |
lemma approx_mem_monad2: "x @= u ==> x \<in> monad u" |
|
1535 |
apply (simp add: monad_def) |
|
1536 |
apply (blast intro!: approx_sym) |
|
1537 |
done |
|
1538 |
||
1539 |
lemma approx_mem_monad_zero: "[| x @= y;x \<in> monad 0 |] ==> y \<in> monad 0" |
|
1540 |
apply (drule mem_monad_approx) |
|
1541 |
apply (fast intro: approx_mem_monad approx_trans) |
|
1542 |
done |
|
1543 |
||
1544 |
lemma Infinitesimal_approx_hrabs: |
|
1545 |
"[| x @= y; (x::hypreal) \<in> Infinitesimal |] ==> abs x @= abs y" |
|
1546 |
apply (drule Infinitesimal_monad_zero_iff [THEN iffD1]) |
|
1547 |
apply (blast intro: approx_mem_monad_zero monad_zero_hrabs_iff [THEN iffD1] mem_monad_approx approx_trans3) |
|
1548 |
done |
|
1549 |
||
1550 |
lemma less_Infinitesimal_less: |
|
1551 |
"[| 0 < x; (x::hypreal) \<notin>Infinitesimal; e :Infinitesimal |] ==> e < x" |
|
1552 |
apply (rule ccontr) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1553 |
apply (auto intro: Infinitesimal_zero [THEN [2] Infinitesimal_interval] |
27468 | 1554 |
dest!: order_le_imp_less_or_eq simp add: linorder_not_less) |
1555 |
done |
|
1556 |
||
1557 |
lemma Ball_mem_monad_gt_zero: |
|
1558 |
"[| 0 < (x::hypreal); x \<notin> Infinitesimal; u \<in> monad x |] ==> 0 < u" |
|
1559 |
apply (drule mem_monad_approx [THEN approx_sym]) |
|
1560 |
apply (erule bex_Infinitesimal_iff2 [THEN iffD2, THEN bexE]) |
|
1561 |
apply (drule_tac e = "-xa" in less_Infinitesimal_less, auto) |
|
1562 |
done |
|
1563 |
||
1564 |
lemma Ball_mem_monad_less_zero: |
|
1565 |
"[| (x::hypreal) < 0; x \<notin> Infinitesimal; u \<in> monad x |] ==> u < 0" |
|
1566 |
apply (drule mem_monad_approx [THEN approx_sym]) |
|
1567 |
apply (erule bex_Infinitesimal_iff [THEN iffD2, THEN bexE]) |
|
1568 |
apply (cut_tac x = "-x" and e = xa in less_Infinitesimal_less, auto) |
|
1569 |
done |
|
1570 |
||
1571 |
lemma lemma_approx_gt_zero: |
|
1572 |
"[|0 < (x::hypreal); x \<notin> Infinitesimal; x @= y|] ==> 0 < y" |
|
1573 |
by (blast dest: Ball_mem_monad_gt_zero approx_subset_monad) |
|
1574 |
||
1575 |
lemma lemma_approx_less_zero: |
|
1576 |
"[|(x::hypreal) < 0; x \<notin> Infinitesimal; x @= y|] ==> y < 0" |
|
1577 |
by (blast dest: Ball_mem_monad_less_zero approx_subset_monad) |
|
1578 |
||
1579 |
theorem approx_hrabs: "(x::hypreal) @= y ==> abs x @= abs y" |
|
1580 |
by (drule approx_hnorm, simp) |
|
1581 |
||
1582 |
lemma approx_hrabs_zero_cancel: "abs(x::hypreal) @= 0 ==> x @= 0" |
|
1583 |
apply (cut_tac x = x in hrabs_disj) |
|
1584 |
apply (auto dest: approx_minus) |
|
1585 |
done |
|
1586 |
||
1587 |
lemma approx_hrabs_add_Infinitesimal: |
|
1588 |
"(e::hypreal) \<in> Infinitesimal ==> abs x @= abs(x+e)" |
|
1589 |
by (fast intro: approx_hrabs Infinitesimal_add_approx_self) |
|
1590 |
||
1591 |
lemma approx_hrabs_add_minus_Infinitesimal: |
|
1592 |
"(e::hypreal) \<in> Infinitesimal ==> abs x @= abs(x + -e)" |
|
1593 |
by (fast intro: approx_hrabs Infinitesimal_add_minus_approx_self) |
|
1594 |
||
1595 |
lemma hrabs_add_Infinitesimal_cancel: |
|
1596 |
"[| (e::hypreal) \<in> Infinitesimal; e' \<in> Infinitesimal; |
|
1597 |
abs(x+e) = abs(y+e')|] ==> abs x @= abs y" |
|
1598 |
apply (drule_tac x = x in approx_hrabs_add_Infinitesimal) |
|
1599 |
apply (drule_tac x = y in approx_hrabs_add_Infinitesimal) |
|
1600 |
apply (auto intro: approx_trans2) |
|
1601 |
done |
|
1602 |
||
1603 |
lemma hrabs_add_minus_Infinitesimal_cancel: |
|
1604 |
"[| (e::hypreal) \<in> Infinitesimal; e' \<in> Infinitesimal; |
|
1605 |
abs(x + -e) = abs(y + -e')|] ==> abs x @= abs y" |
|
1606 |
apply (drule_tac x = x in approx_hrabs_add_minus_Infinitesimal) |
|
1607 |
apply (drule_tac x = y in approx_hrabs_add_minus_Infinitesimal) |
|
1608 |
apply (auto intro: approx_trans2) |
|
1609 |
done |
|
1610 |
||
1611 |
subsection {* More @{term HFinite} and @{term Infinitesimal} Theorems *} |
|
1612 |
||
1613 |
(* interesting slightly counterintuitive theorem: necessary |
|
1614 |
for proving that an open interval is an NS open set |
|
1615 |
*) |
|
1616 |
lemma Infinitesimal_add_hypreal_of_real_less: |
|
1617 |
"[| x < y; u \<in> Infinitesimal |] |
|
1618 |
==> hypreal_of_real x + u < hypreal_of_real y" |
|
1619 |
apply (simp add: Infinitesimal_def) |
|
1620 |
apply (drule_tac x = "hypreal_of_real y + -hypreal_of_real x" in bspec, simp) |
|
1621 |
apply (simp add: abs_less_iff) |
|
1622 |
done |
|
1623 |
||
1624 |
lemma Infinitesimal_add_hrabs_hypreal_of_real_less: |
|
1625 |
"[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] |
|
1626 |
==> abs (hypreal_of_real r + x) < hypreal_of_real y" |
|
1627 |
apply (drule_tac x = "hypreal_of_real r" in approx_hrabs_add_Infinitesimal) |
|
1628 |
apply (drule approx_sym [THEN bex_Infinitesimal_iff2 [THEN iffD2]]) |
|
1629 |
apply (auto intro!: Infinitesimal_add_hypreal_of_real_less |
|
1630 |
simp del: star_of_abs |
|
1631 |
simp add: star_of_abs [symmetric]) |
|
1632 |
done |
|
1633 |
||
1634 |
lemma Infinitesimal_add_hrabs_hypreal_of_real_less2: |
|
1635 |
"[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] |
|
1636 |
==> abs (x + hypreal_of_real r) < hypreal_of_real y" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1637 |
apply (rule add.commute [THEN subst]) |
27468 | 1638 |
apply (erule Infinitesimal_add_hrabs_hypreal_of_real_less, assumption) |
1639 |
done |
|
1640 |
||
1641 |
lemma hypreal_of_real_le_add_Infininitesimal_cancel: |
|
1642 |
"[| u \<in> Infinitesimal; v \<in> Infinitesimal; |
|
1643 |
hypreal_of_real x + u \<le> hypreal_of_real y + v |] |
|
1644 |
==> hypreal_of_real x \<le> hypreal_of_real y" |
|
1645 |
apply (simp add: linorder_not_less [symmetric], auto) |
|
1646 |
apply (drule_tac u = "v-u" in Infinitesimal_add_hypreal_of_real_less) |
|
1647 |
apply (auto simp add: Infinitesimal_diff) |
|
1648 |
done |
|
1649 |
||
1650 |
lemma hypreal_of_real_le_add_Infininitesimal_cancel2: |
|
1651 |
"[| u \<in> Infinitesimal; v \<in> Infinitesimal; |
|
1652 |
hypreal_of_real x + u \<le> hypreal_of_real y + v |] |
|
1653 |
==> x \<le> y" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1654 |
by (blast intro: star_of_le [THEN iffD1] |
27468 | 1655 |
intro!: hypreal_of_real_le_add_Infininitesimal_cancel) |
1656 |
||
1657 |
lemma hypreal_of_real_less_Infinitesimal_le_zero: |
|
1658 |
"[| hypreal_of_real x < e; e \<in> Infinitesimal |] ==> hypreal_of_real x \<le> 0" |
|
1659 |
apply (rule linorder_not_less [THEN iffD1], safe) |
|
1660 |
apply (drule Infinitesimal_interval) |
|
1661 |
apply (drule_tac [4] SReal_hypreal_of_real [THEN SReal_Infinitesimal_zero], auto) |
|
1662 |
done |
|
1663 |
||
1664 |
(*used once, in Lim/NSDERIV_inverse*) |
|
1665 |
lemma Infinitesimal_add_not_zero: |
|
1666 |
"[| h \<in> Infinitesimal; x \<noteq> 0 |] ==> star_of x + h \<noteq> 0" |
|
1667 |
apply auto |
|
34146
14595e0c27e8
rename equals_zero_I to minus_unique (keep old name too)
huffman
parents:
32960
diff
changeset
|
1668 |
apply (subgoal_tac "h = - star_of x", auto intro: minus_unique [symmetric]) |
27468 | 1669 |
done |
1670 |
||
1671 |
lemma Infinitesimal_square_cancel [simp]: |
|
1672 |
"(x::hypreal)*x + y*y \<in> Infinitesimal ==> x*x \<in> Infinitesimal" |
|
1673 |
apply (rule Infinitesimal_interval2) |
|
1674 |
apply (rule_tac [3] zero_le_square, assumption) |
|
1675 |
apply (auto) |
|
1676 |
done |
|
1677 |
||
1678 |
lemma HFinite_square_cancel [simp]: |
|
1679 |
"(x::hypreal)*x + y*y \<in> HFinite ==> x*x \<in> HFinite" |
|
1680 |
apply (rule HFinite_bounded, assumption) |
|
1681 |
apply (auto) |
|
1682 |
done |
|
1683 |
||
1684 |
lemma Infinitesimal_square_cancel2 [simp]: |
|
1685 |
"(x::hypreal)*x + y*y \<in> Infinitesimal ==> y*y \<in> Infinitesimal" |
|
1686 |
apply (rule Infinitesimal_square_cancel) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1687 |
apply (rule add.commute [THEN subst]) |
27468 | 1688 |
apply (simp (no_asm)) |
1689 |
done |
|
1690 |
||
1691 |
lemma HFinite_square_cancel2 [simp]: |
|
1692 |
"(x::hypreal)*x + y*y \<in> HFinite ==> y*y \<in> HFinite" |
|
1693 |
apply (rule HFinite_square_cancel) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
1694 |
apply (rule add.commute [THEN subst]) |
27468 | 1695 |
apply (simp (no_asm)) |
1696 |
done |
|
1697 |
||
1698 |
lemma Infinitesimal_sum_square_cancel [simp]: |
|
1699 |
"(x::hypreal)*x + y*y + z*z \<in> Infinitesimal ==> x*x \<in> Infinitesimal" |
|
1700 |
apply (rule Infinitesimal_interval2, assumption) |
|
1701 |
apply (rule_tac [2] zero_le_square, simp) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1702 |
apply (insert zero_le_square [of y]) |
27468 | 1703 |
apply (insert zero_le_square [of z], simp del:zero_le_square) |
1704 |
done |
|
1705 |
||
1706 |
lemma HFinite_sum_square_cancel [simp]: |
|
1707 |
"(x::hypreal)*x + y*y + z*z \<in> HFinite ==> x*x \<in> HFinite" |
|
1708 |
apply (rule HFinite_bounded, assumption) |
|
1709 |
apply (rule_tac [2] zero_le_square) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1710 |
apply (insert zero_le_square [of y]) |
27468 | 1711 |
apply (insert zero_le_square [of z], simp del:zero_le_square) |
1712 |
done |
|
1713 |
||
1714 |
lemma Infinitesimal_sum_square_cancel2 [simp]: |
|
1715 |
"(y::hypreal)*y + x*x + z*z \<in> Infinitesimal ==> x*x \<in> Infinitesimal" |
|
1716 |
apply (rule Infinitesimal_sum_square_cancel) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1717 |
apply (simp add: ac_simps) |
27468 | 1718 |
done |
1719 |
||
1720 |
lemma HFinite_sum_square_cancel2 [simp]: |
|
1721 |
"(y::hypreal)*y + x*x + z*z \<in> HFinite ==> x*x \<in> HFinite" |
|
1722 |
apply (rule HFinite_sum_square_cancel) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1723 |
apply (simp add: ac_simps) |
27468 | 1724 |
done |
1725 |
||
1726 |
lemma Infinitesimal_sum_square_cancel3 [simp]: |
|
1727 |
"(z::hypreal)*z + y*y + x*x \<in> Infinitesimal ==> x*x \<in> Infinitesimal" |
|
1728 |
apply (rule Infinitesimal_sum_square_cancel) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1729 |
apply (simp add: ac_simps) |
27468 | 1730 |
done |
1731 |
||
1732 |
lemma HFinite_sum_square_cancel3 [simp]: |
|
1733 |
"(z::hypreal)*z + y*y + x*x \<in> HFinite ==> x*x \<in> HFinite" |
|
1734 |
apply (rule HFinite_sum_square_cancel) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1735 |
apply (simp add: ac_simps) |
27468 | 1736 |
done |
1737 |
||
1738 |
lemma monad_hrabs_less: |
|
1739 |
"[| y \<in> monad x; 0 < hypreal_of_real e |] |
|
1740 |
==> abs (y - x) < hypreal_of_real e" |
|
1741 |
apply (drule mem_monad_approx [THEN approx_sym]) |
|
1742 |
apply (drule bex_Infinitesimal_iff [THEN iffD2]) |
|
1743 |
apply (auto dest!: InfinitesimalD) |
|
1744 |
done |
|
1745 |
||
1746 |
lemma mem_monad_SReal_HFinite: |
|
1747 |
"x \<in> monad (hypreal_of_real a) ==> x \<in> HFinite" |
|
1748 |
apply (drule mem_monad_approx [THEN approx_sym]) |
|
1749 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2]) |
|
1750 |
apply (safe dest!: Infinitesimal_subset_HFinite [THEN subsetD]) |
|
1751 |
apply (erule SReal_hypreal_of_real [THEN SReal_subset_HFinite [THEN subsetD], THEN HFinite_add]) |
|
1752 |
done |
|
1753 |
||
1754 |
||
1755 |
subsection{* Theorems about Standard Part*} |
|
1756 |
||
1757 |
lemma st_approx_self: "x \<in> HFinite ==> st x @= x" |
|
1758 |
apply (simp add: st_def) |
|
1759 |
apply (frule st_part_Ex, safe) |
|
1760 |
apply (rule someI2) |
|
1761 |
apply (auto intro: approx_sym) |
|
1762 |
done |
|
1763 |
||
1764 |
lemma st_SReal: "x \<in> HFinite ==> st x \<in> Reals" |
|
1765 |
apply (simp add: st_def) |
|
1766 |
apply (frule st_part_Ex, safe) |
|
1767 |
apply (rule someI2) |
|
1768 |
apply (auto intro: approx_sym) |
|
1769 |
done |
|
1770 |
||
1771 |
lemma st_HFinite: "x \<in> HFinite ==> st x \<in> HFinite" |
|
1772 |
by (erule st_SReal [THEN SReal_subset_HFinite [THEN subsetD]]) |
|
1773 |
||
1774 |
lemma st_unique: "\<lbrakk>r \<in> \<real>; r \<approx> x\<rbrakk> \<Longrightarrow> st x = r" |
|
1775 |
apply (frule SReal_subset_HFinite [THEN subsetD]) |
|
1776 |
apply (drule (1) approx_HFinite) |
|
1777 |
apply (unfold st_def) |
|
1778 |
apply (rule some_equality) |
|
1779 |
apply (auto intro: approx_unique_real) |
|
1780 |
done |
|
1781 |
||
1782 |
lemma st_SReal_eq: "x \<in> Reals ==> st x = x" |
|
56225 | 1783 |
by (metis approx_refl st_unique) |
27468 | 1784 |
|
1785 |
lemma st_hypreal_of_real [simp]: "st (hypreal_of_real x) = hypreal_of_real x" |
|
1786 |
by (rule SReal_hypreal_of_real [THEN st_SReal_eq]) |
|
1787 |
||
1788 |
lemma st_eq_approx: "[| x \<in> HFinite; y \<in> HFinite; st x = st y |] ==> x @= y" |
|
1789 |
by (auto dest!: st_approx_self elim!: approx_trans3) |
|
1790 |
||
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1791 |
lemma approx_st_eq: |
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1792 |
assumes x: "x \<in> HFinite" and y: "y \<in> HFinite" and xy: "x @= y" |
27468 | 1793 |
shows "st x = st y" |
1794 |
proof - |
|
1795 |
have "st x @= x" "st y @= y" "st x \<in> Reals" "st y \<in> Reals" |
|
41541 | 1796 |
by (simp_all add: st_approx_self st_SReal x y) |
1797 |
with xy show ?thesis |
|
27468 | 1798 |
by (fast elim: approx_trans approx_trans2 SReal_approx_iff [THEN iffD1]) |
1799 |
qed |
|
1800 |
||
1801 |
lemma st_eq_approx_iff: |
|
1802 |
"[| x \<in> HFinite; y \<in> HFinite|] |
|
1803 |
==> (x @= y) = (st x = st y)" |
|
1804 |
by (blast intro: approx_st_eq st_eq_approx) |
|
1805 |
||
1806 |
lemma st_Infinitesimal_add_SReal: |
|
1807 |
"[| x \<in> Reals; e \<in> Infinitesimal |] ==> st(x + e) = x" |
|
1808 |
apply (erule st_unique) |
|
1809 |
apply (erule Infinitesimal_add_approx_self) |
|
1810 |
done |
|
1811 |
||
1812 |
lemma st_Infinitesimal_add_SReal2: |
|
1813 |
"[| x \<in> Reals; e \<in> Infinitesimal |] ==> st(e + x) = x" |
|
1814 |
apply (erule st_unique) |
|
1815 |
apply (erule Infinitesimal_add_approx_self2) |
|
1816 |
done |
|
1817 |
||
1818 |
lemma HFinite_st_Infinitesimal_add: |
|
1819 |
"x \<in> HFinite ==> \<exists>e \<in> Infinitesimal. x = st(x) + e" |
|
1820 |
by (blast dest!: st_approx_self [THEN approx_sym] bex_Infinitesimal_iff2 [THEN iffD2]) |
|
1821 |
||
1822 |
lemma st_add: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x + y) = st x + st y" |
|
1823 |
by (simp add: st_unique st_SReal st_approx_self approx_add) |
|
1824 |
||
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1825 |
lemma st_numeral [simp]: "st (numeral w) = numeral w" |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1826 |
by (rule Reals_numeral [THEN st_SReal_eq]) |
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45541
diff
changeset
|
1827 |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1828 |
lemma st_neg_numeral [simp]: "st (- numeral w) = - numeral w" |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1829 |
proof - |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1830 |
from Reals_numeral have "numeral w \<in> \<real>" . |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1831 |
then have "- numeral w \<in> \<real>" by simp |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1832 |
with st_SReal_eq show ?thesis . |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1833 |
qed |
27468 | 1834 |
|
45540 | 1835 |
lemma st_0 [simp]: "st 0 = 0" |
1836 |
by (simp add: st_SReal_eq) |
|
1837 |
||
1838 |
lemma st_1 [simp]: "st 1 = 1" |
|
1839 |
by (simp add: st_SReal_eq) |
|
27468 | 1840 |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1841 |
lemma st_neg_1 [simp]: "st (- 1) = - 1" |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1842 |
by (simp add: st_SReal_eq) |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54263
diff
changeset
|
1843 |
|
27468 | 1844 |
lemma st_minus: "x \<in> HFinite \<Longrightarrow> st (- x) = - st x" |
1845 |
by (simp add: st_unique st_SReal st_approx_self approx_minus) |
|
1846 |
||
1847 |
lemma st_diff: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x - y) = st x - st y" |
|
1848 |
by (simp add: st_unique st_SReal st_approx_self approx_diff) |
|
1849 |
||
1850 |
lemma st_mult: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x * y) = st x * st y" |
|
1851 |
by (simp add: st_unique st_SReal st_approx_self approx_mult_HFinite) |
|
1852 |
||
1853 |
lemma st_Infinitesimal: "x \<in> Infinitesimal ==> st x = 0" |
|
1854 |
by (simp add: st_unique mem_infmal_iff) |
|
1855 |
||
1856 |
lemma st_not_Infinitesimal: "st(x) \<noteq> 0 ==> x \<notin> Infinitesimal" |
|
1857 |
by (fast intro: st_Infinitesimal) |
|
1858 |
||
1859 |
lemma st_inverse: |
|
1860 |
"[| x \<in> HFinite; st x \<noteq> 0 |] |
|
1861 |
==> st(inverse x) = inverse (st x)" |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1862 |
apply (rule_tac c1 = "st x" in mult_left_cancel [THEN iffD1]) |
27468 | 1863 |
apply (auto simp add: st_mult [symmetric] st_not_Infinitesimal HFinite_inverse) |
1864 |
apply (subst right_inverse, auto) |
|
1865 |
done |
|
1866 |
||
1867 |
lemma st_divide [simp]: |
|
1868 |
"[| x \<in> HFinite; y \<in> HFinite; st y \<noteq> 0 |] |
|
1869 |
==> st(x/y) = (st x) / (st y)" |
|
1870 |
by (simp add: divide_inverse st_mult st_not_Infinitesimal HFinite_inverse st_inverse) |
|
1871 |
||
1872 |
lemma st_idempotent [simp]: "x \<in> HFinite ==> st(st(x)) = st(x)" |
|
1873 |
by (blast intro: st_HFinite st_approx_self approx_st_eq) |
|
1874 |
||
1875 |
lemma Infinitesimal_add_st_less: |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1876 |
"[| x \<in> HFinite; y \<in> HFinite; u \<in> Infinitesimal; st x < st y |] |
27468 | 1877 |
==> st x + u < st y" |
1878 |
apply (drule st_SReal)+ |
|
1879 |
apply (auto intro!: Infinitesimal_add_hypreal_of_real_less simp add: SReal_iff) |
|
1880 |
done |
|
1881 |
||
1882 |
lemma Infinitesimal_add_st_le_cancel: |
|
1883 |
"[| x \<in> HFinite; y \<in> HFinite; |
|
1884 |
u \<in> Infinitesimal; st x \<le> st y + u |
|
1885 |
|] ==> st x \<le> st y" |
|
1886 |
apply (simp add: linorder_not_less [symmetric]) |
|
1887 |
apply (auto dest: Infinitesimal_add_st_less) |
|
1888 |
done |
|
1889 |
||
1890 |
lemma st_le: "[| x \<in> HFinite; y \<in> HFinite; x \<le> y |] ==> st(x) \<le> st(y)" |
|
56225 | 1891 |
by (metis approx_le_bound approx_sym linear st_SReal st_approx_self st_part_Ex1) |
27468 | 1892 |
|
1893 |
lemma st_zero_le: "[| 0 \<le> x; x \<in> HFinite |] ==> 0 \<le> st x" |
|
45540 | 1894 |
apply (subst st_0 [symmetric]) |
27468 | 1895 |
apply (rule st_le, auto) |
1896 |
done |
|
1897 |
||
1898 |
lemma st_zero_ge: "[| x \<le> 0; x \<in> HFinite |] ==> st x \<le> 0" |
|
45540 | 1899 |
apply (subst st_0 [symmetric]) |
27468 | 1900 |
apply (rule st_le, auto) |
1901 |
done |
|
1902 |
||
1903 |
lemma st_hrabs: "x \<in> HFinite ==> abs(st x) = st(abs x)" |
|
1904 |
apply (simp add: linorder_not_le st_zero_le abs_if st_minus |
|
1905 |
linorder_not_less) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1906 |
apply (auto dest!: st_zero_ge [OF order_less_imp_le]) |
27468 | 1907 |
done |
1908 |
||
1909 |
||
1910 |
||
1911 |
subsection {* Alternative Definitions using Free Ultrafilter *} |
|
1912 |
||
1913 |
subsubsection {* @{term HFinite} *} |
|
1914 |
||
1915 |
lemma HFinite_FreeUltrafilterNat: |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
54489
diff
changeset
|
1916 |
"star_n X \<in> HFinite |
27468 | 1917 |
==> \<exists>u. {n. norm (X n) < u} \<in> FreeUltrafilterNat" |
1918 |
apply (auto simp add: HFinite_def SReal_def) |
|
1919 |
apply (rule_tac x=r in exI) |
|
1920 |
apply (simp add: hnorm_def star_of_def starfun_star_n) |
|
1921 |
apply (simp add: star_less_def starP2_star_n) |
|
1922 |
done |
|
1923 |
||
1924 |
lemma FreeUltrafilterNat_HFinite: |
|
1925 |
"\<exists>u. {n. norm (X n) < u} \<in> FreeUltrafilterNat |
|
1926 |
==> star_n X \<in> HFinite" |
|
1927 |
apply (auto simp add: HFinite_def mem_Rep_star_iff) |
|
1928 |
apply (rule_tac x="star_of u" in bexI) |
|
1929 |
apply (simp add: hnorm_def starfun_star_n star_of_def) |
|
1930 |
apply (simp add: star_less_def starP2_star_n) |
|
1931 |
apply (simp add: SReal_def) |
|
1932 |
done |
|
1933 |
||
1934 |
lemma HFinite_FreeUltrafilterNat_iff: |
|
1935 |
"(star_n X \<in> HFinite) = (\<exists>u. {n. norm (X n) < u} \<in> FreeUltrafilterNat)" |
|
1936 |
by (blast intro!: HFinite_FreeUltrafilterNat FreeUltrafilterNat_HFinite) |
|
1937 |
||
1938 |
subsubsection {* @{term HInfinite} *} |
|
1939 |
||
56225 | 1940 |
lemma lemma_Compl_eq: "- {n. u < norm (f n)} = {n. norm (f n) \<le> u}" |
27468 | 1941 |
by auto |
1942 |
||
56225 | 1943 |
lemma lemma_Compl_eq2: "- {n. norm (f n) < u} = {n. u \<le> norm (f n)}" |
27468 | 1944 |
by auto |
1945 |
||
1946 |
lemma lemma_Int_eq1: |
|
56225 | 1947 |
"{n. norm (f n) \<le> u} Int {n. u \<le> norm (f n)} = {n. norm(f n) = u}" |
27468 | 1948 |
by auto |
1949 |
||
1950 |
lemma lemma_FreeUltrafilterNat_one: |
|
56225 | 1951 |
"{n. norm (f n) = u} \<le> {n. norm (f n) < u + (1::real)}" |
27468 | 1952 |
by auto |
1953 |
||
1954 |
(*------------------------------------- |
|
1955 |
Exclude this type of sets from free |
|
1956 |
ultrafilter for Infinite numbers! |
|
1957 |
-------------------------------------*) |
|
1958 |
lemma FreeUltrafilterNat_const_Finite: |
|
1959 |
"{n. norm (X n) = u} \<in> FreeUltrafilterNat ==> star_n X \<in> HFinite" |
|
1960 |
apply (rule FreeUltrafilterNat_HFinite) |
|
1961 |
apply (rule_tac x = "u + 1" in exI) |
|
1962 |
apply (erule ultra, simp) |
|
1963 |
done |
|
1964 |
||
1965 |
lemma HInfinite_FreeUltrafilterNat: |
|
1966 |
"star_n X \<in> HInfinite ==> \<forall>u. {n. u < norm (X n)} \<in> FreeUltrafilterNat" |
|
1967 |
apply (drule HInfinite_HFinite_iff [THEN iffD1]) |
|
1968 |
apply (simp add: HFinite_FreeUltrafilterNat_iff) |
|
1969 |
apply (rule allI, drule_tac x="u + 1" in spec) |
|
1970 |
apply (drule FreeUltrafilterNat.not_memD) |
|
1971 |
apply (simp add: Collect_neg_eq [symmetric] linorder_not_less) |
|
1972 |
apply (erule ultra, simp) |
|
1973 |
done |
|
1974 |
||
1975 |
lemma lemma_Int_HI: |
|
1976 |
"{n. norm (Xa n) < u} Int {n. X n = Xa n} \<subseteq> {n. norm (X n) < (u::real)}" |
|
1977 |
by auto |
|
1978 |
||
1979 |
lemma lemma_Int_HIa: "{n. u < norm (X n)} Int {n. norm (X n) < u} = {}" |
|
1980 |
by (auto intro: order_less_asym) |
|
1981 |
||
1982 |
lemma FreeUltrafilterNat_HInfinite: |
|
1983 |
"\<forall>u. {n. u < norm (X n)} \<in> FreeUltrafilterNat ==> star_n X \<in> HInfinite" |
|
1984 |
apply (rule HInfinite_HFinite_iff [THEN iffD2]) |
|
1985 |
apply (safe, drule HFinite_FreeUltrafilterNat, safe) |
|
1986 |
apply (drule_tac x = u in spec) |
|
1987 |
apply (drule (1) FreeUltrafilterNat.Int) |
|
1988 |
apply (simp add: Collect_conj_eq [symmetric]) |
|
1989 |
apply (subgoal_tac "\<forall>n. \<not> (norm (X n) < u \<and> u < norm (X n))", auto) |
|
1990 |
done |
|
1991 |
||
1992 |
lemma HInfinite_FreeUltrafilterNat_iff: |
|
1993 |
"(star_n X \<in> HInfinite) = (\<forall>u. {n. u < norm (X n)} \<in> FreeUltrafilterNat)" |
|
1994 |
by (blast intro!: HInfinite_FreeUltrafilterNat FreeUltrafilterNat_HInfinite) |
|
1995 |
||
1996 |
subsubsection {* @{term Infinitesimal} *} |
|
1997 |
||
1998 |
lemma ball_SReal_eq: "(\<forall>x::hypreal \<in> Reals. P x) = (\<forall>x::real. P (star_of x))" |
|
1999 |
by (unfold SReal_def, auto) |
|
2000 |
||
2001 |
lemma Infinitesimal_FreeUltrafilterNat: |
|
2002 |
"star_n X \<in> Infinitesimal ==> \<forall>u>0. {n. norm (X n) < u} \<in> \<U>" |
|
2003 |
apply (simp add: Infinitesimal_def ball_SReal_eq) |
|
2004 |
apply (simp add: hnorm_def starfun_star_n star_of_def) |
|
2005 |
apply (simp add: star_less_def starP2_star_n) |
|
2006 |
done |
|
2007 |
||
2008 |
lemma FreeUltrafilterNat_Infinitesimal: |
|
2009 |
"\<forall>u>0. {n. norm (X n) < u} \<in> \<U> ==> star_n X \<in> Infinitesimal" |
|
2010 |
apply (simp add: Infinitesimal_def ball_SReal_eq) |
|
2011 |
apply (simp add: hnorm_def starfun_star_n star_of_def) |
|
2012 |
apply (simp add: star_less_def starP2_star_n) |
|
2013 |
done |
|
2014 |
||
2015 |
lemma Infinitesimal_FreeUltrafilterNat_iff: |
|
2016 |
"(star_n X \<in> Infinitesimal) = (\<forall>u>0. {n. norm (X n) < u} \<in> \<U>)" |
|
2017 |
by (blast intro!: Infinitesimal_FreeUltrafilterNat FreeUltrafilterNat_Infinitesimal) |
|
2018 |
||
2019 |
(*------------------------------------------------------------------------ |
|
2020 |
Infinitesimals as smaller than 1/n for all n::nat (> 0) |
|
2021 |
------------------------------------------------------------------------*) |
|
2022 |
||
2023 |
lemma lemma_Infinitesimal: |
|
2024 |
"(\<forall>r. 0 < r --> x < r) = (\<forall>n. x < inverse(real (Suc n)))" |
|
2025 |
apply (auto simp add: real_of_nat_Suc_gt_zero) |
|
2026 |
apply (blast dest!: reals_Archimedean intro: order_less_trans) |
|
2027 |
done |
|
2028 |
||
2029 |
lemma lemma_Infinitesimal2: |
|
2030 |
"(\<forall>r \<in> Reals. 0 < r --> x < r) = |
|
2031 |
(\<forall>n. x < inverse(hypreal_of_nat (Suc n)))" |
|
2032 |
apply safe |
|
2033 |
apply (drule_tac x = "inverse (hypreal_of_real (real (Suc n))) " in bspec) |
|
2034 |
apply (simp (no_asm_use)) |
|
2035 |
apply (rule real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive, THEN star_of_less [THEN iffD2], THEN [2] impE]) |
|
2036 |
prefer 2 apply assumption |
|
2037 |
apply (simp add: real_of_nat_def) |
|
2038 |
apply (auto dest!: reals_Archimedean simp add: SReal_iff) |
|
2039 |
apply (drule star_of_less [THEN iffD2]) |
|
2040 |
apply (simp add: real_of_nat_def) |
|
2041 |
apply (blast intro: order_less_trans) |
|
2042 |
done |
|
2043 |
||
2044 |
||
2045 |
lemma Infinitesimal_hypreal_of_nat_iff: |
|
2046 |
"Infinitesimal = {x. \<forall>n. hnorm x < inverse (hypreal_of_nat (Suc n))}" |
|
2047 |
apply (simp add: Infinitesimal_def) |
|
2048 |
apply (auto simp add: lemma_Infinitesimal2) |
|
2049 |
done |
|
2050 |
||
2051 |
||
2052 |
subsection{*Proof that @{term omega} is an infinite number*} |
|
2053 |
||
2054 |
text{*It will follow that epsilon is an infinitesimal number.*} |
|
2055 |
||
2056 |
lemma Suc_Un_eq: "{n. n < Suc m} = {n. n < m} Un {n. n = m}" |
|
2057 |
by (auto simp add: less_Suc_eq) |
|
2058 |
||
2059 |
(*------------------------------------------- |
|
2060 |
Prove that any segment is finite and |
|
2061 |
hence cannot belong to FreeUltrafilterNat |
|
2062 |
-------------------------------------------*) |
|
2063 |
lemma finite_nat_segment: "finite {n::nat. n < m}" |
|
2064 |
apply (induct "m") |
|
2065 |
apply (auto simp add: Suc_Un_eq) |
|
2066 |
done |
|
2067 |
||
2068 |
lemma finite_real_of_nat_segment: "finite {n::nat. real n < real (m::nat)}" |
|
2069 |
by (auto intro: finite_nat_segment) |
|
2070 |
||
2071 |
lemma finite_real_of_nat_less_real: "finite {n::nat. real n < u}" |
|
2072 |
apply (cut_tac x = u in reals_Archimedean2, safe) |
|
2073 |
apply (rule finite_real_of_nat_segment [THEN [2] finite_subset]) |
|
2074 |
apply (auto dest: order_less_trans) |
|
2075 |
done |
|
2076 |
||
2077 |
lemma lemma_real_le_Un_eq: |
|
2078 |
"{n. f n \<le> u} = {n. f n < u} Un {n. u = (f n :: real)}" |
|
2079 |
by (auto dest: order_le_imp_less_or_eq simp add: order_less_imp_le) |
|
2080 |
||
2081 |
lemma finite_real_of_nat_le_real: "finite {n::nat. real n \<le> u}" |
|
2082 |
by (auto simp add: lemma_real_le_Un_eq lemma_finite_omega_set finite_real_of_nat_less_real) |
|
2083 |
||
2084 |
lemma finite_rabs_real_of_nat_le_real: "finite {n::nat. abs(real n) \<le> u}" |
|
2085 |
apply (simp (no_asm) add: real_of_nat_Suc_gt_zero finite_real_of_nat_le_real) |
|
2086 |
done |
|
2087 |
||
2088 |
lemma rabs_real_of_nat_le_real_FreeUltrafilterNat: |
|
2089 |
"{n. abs(real n) \<le> u} \<notin> FreeUltrafilterNat" |
|
2090 |
by (blast intro!: FreeUltrafilterNat.finite finite_rabs_real_of_nat_le_real) |
|
2091 |
||
2092 |
lemma FreeUltrafilterNat_nat_gt_real: "{n. u < real n} \<in> FreeUltrafilterNat" |
|
2093 |
apply (rule ccontr, drule FreeUltrafilterNat.not_memD) |
|
2094 |
apply (subgoal_tac "- {n::nat. u < real n} = {n. real n \<le> u}") |
|
2095 |
prefer 2 apply force |
|
2096 |
apply (simp add: finite_real_of_nat_le_real [THEN FreeUltrafilterNat.finite]) |
|
2097 |
done |
|
2098 |
||
2099 |
(*-------------------------------------------------------------- |
|
2100 |
The complement of {n. abs(real n) \<le> u} = |
|
2101 |
{n. u < abs (real n)} is in FreeUltrafilterNat |
|
2102 |
by property of (free) ultrafilters |
|
2103 |
--------------------------------------------------------------*) |
|
2104 |
||
2105 |
lemma Compl_real_le_eq: "- {n::nat. real n \<le> u} = {n. u < real n}" |
|
2106 |
by (auto dest!: order_le_less_trans simp add: linorder_not_le) |
|
2107 |
||
2108 |
text{*@{term omega} is a member of @{term HInfinite}*} |
|
2109 |
||
2110 |
lemma FreeUltrafilterNat_omega: "{n. u < real n} \<in> FreeUltrafilterNat" |
|
2111 |
apply (cut_tac u = u in rabs_real_of_nat_le_real_FreeUltrafilterNat) |
|
2112 |
apply (auto dest: FreeUltrafilterNat.not_memD simp add: Compl_real_le_eq) |
|
2113 |
done |
|
2114 |
||
2115 |
theorem HInfinite_omega [simp]: "omega \<in> HInfinite" |
|
2116 |
apply (simp add: omega_def) |
|
2117 |
apply (rule FreeUltrafilterNat_HInfinite) |
|
56225 | 2118 |
apply (simp add: real_of_nat_Suc diff_less_eq [symmetric] FreeUltrafilterNat_omega) |
27468 | 2119 |
done |
2120 |
||
2121 |
(*----------------------------------------------- |
|
2122 |
Epsilon is a member of Infinitesimal |
|
2123 |
-----------------------------------------------*) |
|
2124 |
||
2125 |
lemma Infinitesimal_epsilon [simp]: "epsilon \<in> Infinitesimal" |
|
2126 |
by (auto intro!: HInfinite_inverse_Infinitesimal HInfinite_omega simp add: hypreal_epsilon_inverse_omega) |
|
2127 |
||
2128 |
lemma HFinite_epsilon [simp]: "epsilon \<in> HFinite" |
|
2129 |
by (auto intro: Infinitesimal_subset_HFinite [THEN subsetD]) |
|
2130 |
||
2131 |
lemma epsilon_approx_zero [simp]: "epsilon @= 0" |
|
2132 |
apply (simp (no_asm) add: mem_infmal_iff [symmetric]) |
|
2133 |
done |
|
2134 |
||
2135 |
(*------------------------------------------------------------------------ |
|
2136 |
Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given |
|
2137 |
that \<forall>n. |X n - a| < 1/n. Used in proof of NSLIM => LIM. |
|
2138 |
-----------------------------------------------------------------------*) |
|
2139 |
||
2140 |
lemma real_of_nat_less_inverse_iff: |
|
2141 |
"0 < u ==> (u < inverse (real(Suc n))) = (real(Suc n) < inverse u)" |
|
2142 |
apply (simp add: inverse_eq_divide) |
|
2143 |
apply (subst pos_less_divide_eq, assumption) |
|
2144 |
apply (subst pos_less_divide_eq) |
|
2145 |
apply (simp add: real_of_nat_Suc_gt_zero) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56544
diff
changeset
|
2146 |
apply (simp add: mult.commute) |
27468 | 2147 |
done |
2148 |
||
2149 |
lemma finite_inverse_real_of_posnat_gt_real: |
|
2150 |
"0 < u ==> finite {n. u < inverse(real(Suc n))}" |
|
2151 |
apply (simp (no_asm_simp) add: real_of_nat_less_inverse_iff) |
|
2152 |
apply (simp (no_asm_simp) add: real_of_nat_Suc less_diff_eq [symmetric]) |
|
2153 |
apply (rule finite_real_of_nat_less_real) |
|
2154 |
done |
|
2155 |
||
2156 |
lemma lemma_real_le_Un_eq2: |
|
2157 |
"{n. u \<le> inverse(real(Suc n))} = |
|
2158 |
{n. u < inverse(real(Suc n))} Un {n. u = inverse(real(Suc n))}" |
|
2159 |
apply (auto dest: order_le_imp_less_or_eq simp add: order_less_imp_le) |
|
2160 |
done |
|
2161 |
||
2162 |
lemma finite_inverse_real_of_posnat_ge_real: |
|
2163 |
"0 < u ==> finite {n. u \<le> inverse(real(Suc n))}" |
|
56225 | 2164 |
by (auto simp add: lemma_real_le_Un_eq2 lemma_finite_epsilon_set finite_inverse_real_of_posnat_gt_real) |
27468 | 2165 |
|
2166 |
lemma inverse_real_of_posnat_ge_real_FreeUltrafilterNat: |
|
2167 |
"0 < u ==> {n. u \<le> inverse(real(Suc n))} \<notin> FreeUltrafilterNat" |
|
2168 |
by (blast intro!: FreeUltrafilterNat.finite finite_inverse_real_of_posnat_ge_real) |
|
2169 |
||
2170 |
(*-------------------------------------------------------------- |
|
2171 |
The complement of {n. u \<le> inverse(real(Suc n))} = |
|
2172 |
{n. inverse(real(Suc n)) < u} is in FreeUltrafilterNat |
|
2173 |
by property of (free) ultrafilters |
|
2174 |
--------------------------------------------------------------*) |
|
2175 |
lemma Compl_le_inverse_eq: |
|
56225 | 2176 |
"- {n. u \<le> inverse(real(Suc n))} = {n. inverse(real(Suc n)) < u}" |
2177 |
by (auto dest!: order_le_less_trans simp add: linorder_not_le) |
|
2178 |
||
27468 | 2179 |
|
2180 |
lemma FreeUltrafilterNat_inverse_real_of_posnat: |
|
2181 |
"0 < u ==> |
|
2182 |
{n. inverse(real(Suc n)) < u} \<in> FreeUltrafilterNat" |
|
56225 | 2183 |
by (metis Compl_le_inverse_eq FreeUltrafilterNat.ultra inverse_real_of_posnat_ge_real_FreeUltrafilterNat) |
27468 | 2184 |
|
2185 |
text{* Example of an hypersequence (i.e. an extended standard sequence) |
|
2186 |
whose term with an hypernatural suffix is an infinitesimal i.e. |
|
2187 |
the whn'nth term of the hypersequence is a member of Infinitesimal*} |
|
2188 |
||
2189 |
lemma SEQ_Infinitesimal: |
|
2190 |
"( *f* (%n::nat. inverse(real(Suc n)))) whn : Infinitesimal" |
|
2191 |
apply (simp add: hypnat_omega_def starfun_star_n star_n_inverse) |
|
2192 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff) |
|
2193 |
apply (simp add: real_of_nat_Suc_gt_zero FreeUltrafilterNat_inverse_real_of_posnat) |
|
2194 |
done |
|
2195 |
||
2196 |
text{* Example where we get a hyperreal from a real sequence |
|
2197 |
for which a particular property holds. The theorem is |
|
2198 |
used in proofs about equivalence of nonstandard and |
|
2199 |
standard neighbourhoods. Also used for equivalence of |
|
2200 |
nonstandard ans standard definitions of pointwise |
|
2201 |
limit.*} |
|
2202 |
||
2203 |
(*----------------------------------------------------- |
|
2204 |
|X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x| \<in> Infinitesimal |
|
2205 |
-----------------------------------------------------*) |
|
2206 |
lemma real_seq_to_hypreal_Infinitesimal: |
|
2207 |
"\<forall>n. norm(X n - x) < inverse(real(Suc n)) |
|
2208 |
==> star_n X - star_of x \<in> Infinitesimal" |
|
56225 | 2209 |
unfolding star_n_diff star_of_def Infinitesimal_FreeUltrafilterNat_iff star_n_inverse |
2210 |
by (auto dest: FreeUltrafilterNat_inverse_real_of_posnat FreeUltrafilterNat.Int |
|
2211 |
intro: order_less_trans FreeUltrafilterNat.subset) |
|
27468 | 2212 |
|
2213 |
lemma real_seq_to_hypreal_approx: |
|
2214 |
"\<forall>n. norm(X n - x) < inverse(real(Suc n)) |
|
2215 |
==> star_n X @= star_of x" |
|
56225 | 2216 |
by (metis bex_Infinitesimal_iff real_seq_to_hypreal_Infinitesimal) |
27468 | 2217 |
|
2218 |
lemma real_seq_to_hypreal_approx2: |
|
2219 |
"\<forall>n. norm(x - X n) < inverse(real(Suc n)) |
|
2220 |
==> star_n X @= star_of x" |
|
56225 | 2221 |
by (metis norm_minus_commute real_seq_to_hypreal_approx) |
27468 | 2222 |
|
2223 |
lemma real_seq_to_hypreal_Infinitesimal2: |
|
2224 |
"\<forall>n. norm(X n - Y n) < inverse(real(Suc n)) |
|
2225 |
==> star_n X - star_n Y \<in> Infinitesimal" |
|
56225 | 2226 |
unfolding Infinitesimal_FreeUltrafilterNat_iff star_n_diff |
2227 |
by (auto dest: FreeUltrafilterNat_inverse_real_of_posnat |
|
2228 |
intro: order_less_trans FreeUltrafilterNat.subset) |
|
27468 | 2229 |
|
2230 |
end |