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