163 apply (simp add: mult_strict_mono') |
163 apply (simp add: mult_strict_mono') |
164 done |
164 done |
165 |
165 |
166 subsection{*Closure Laws for the Standard Reals*} |
166 subsection{*Closure Laws for the Standard Reals*} |
167 |
167 |
168 lemma SReal_add [simp]: |
168 lemma Reals_minus_iff [simp]: "(-x \<in> Reals) = (x \<in> Reals)" |
169 "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x + y \<in> Reals" |
|
170 apply (auto simp add: SReal_def) |
|
171 apply (rule_tac x = "r + ra" in exI, simp) |
|
172 done |
|
173 |
|
174 lemma SReal_diff [simp]: |
|
175 "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x - y \<in> Reals" |
|
176 apply (auto simp add: SReal_def) |
|
177 apply (rule_tac x = "r - ra" in exI, simp) |
|
178 done |
|
179 |
|
180 lemma SReal_mult: "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x * y \<in> Reals" |
|
181 apply (simp add: SReal_def, safe) |
|
182 apply (rule_tac x = "r * ra" in exI) |
|
183 apply (simp (no_asm)) |
|
184 done |
|
185 |
|
186 lemma SReal_inverse: "(x::hypreal) \<in> Reals ==> inverse x \<in> Reals" |
|
187 apply (simp add: SReal_def) |
|
188 apply (blast intro: star_of_inverse [symmetric]) |
|
189 done |
|
190 |
|
191 lemma SReal_divide: "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x/y \<in> Reals" |
|
192 by (simp (no_asm_simp) add: SReal_mult SReal_inverse divide_inverse) |
|
193 |
|
194 lemma SReal_minus: "(x::hypreal) \<in> Reals ==> -x \<in> Reals" |
|
195 apply (simp add: SReal_def) |
|
196 apply (blast intro: star_of_minus [symmetric]) |
|
197 done |
|
198 |
|
199 lemma SReal_minus_iff [simp]: "(-x \<in> Reals) = ((x::hypreal) \<in> Reals)" |
|
200 apply auto |
169 apply auto |
201 apply (drule SReal_minus, auto) |
170 apply (drule Reals_minus, auto) |
202 done |
171 done |
203 |
172 |
204 lemma SReal_add_cancel: |
173 lemma Reals_add_cancel: "\<lbrakk>x + y \<in> Reals; y \<in> Reals\<rbrakk> \<Longrightarrow> x \<in> Reals" |
205 "[| (x::hypreal) + y \<in> Reals; y \<in> Reals |] ==> x \<in> Reals" |
174 by (drule (1) Reals_diff, simp) |
206 apply (drule_tac x = y in SReal_minus) |
|
207 apply (drule SReal_add, assumption, auto) |
|
208 done |
|
209 |
175 |
210 lemma SReal_hrabs: "(x::hypreal) \<in> Reals ==> abs x \<in> Reals" |
176 lemma SReal_hrabs: "(x::hypreal) \<in> Reals ==> abs x \<in> Reals" |
211 apply (auto simp add: SReal_def) |
177 apply (auto simp add: SReal_def) |
212 apply (rule_tac x="abs r" in exI) |
178 apply (rule_tac x="abs r" in exI) |
213 apply simp |
179 apply simp |
214 done |
180 done |
215 |
181 |
216 lemma SReal_hypreal_of_real [simp]: "hypreal_of_real x \<in> Reals" |
182 lemma SReal_hypreal_of_real [simp]: "hypreal_of_real x \<in> Reals" |
217 by (simp add: SReal_def) |
183 by (simp add: SReal_def) |
218 |
184 |
219 lemma SReal_number_of [simp]: "(number_of w ::hypreal) \<in> Reals" |
|
220 apply (simp only: star_of_number_of [symmetric]) |
|
221 apply (rule SReal_hypreal_of_real) |
|
222 done |
|
223 |
|
224 (** As always with numerals, 0 and 1 are special cases **) |
|
225 |
|
226 lemma Reals_0 [simp]: "(0::hypreal) \<in> Reals" |
|
227 apply (subst numeral_0_eq_0 [symmetric]) |
|
228 apply (rule SReal_number_of) |
|
229 done |
|
230 |
|
231 lemma Reals_1 [simp]: "(1::hypreal) \<in> Reals" |
|
232 apply (subst numeral_1_eq_1 [symmetric]) |
|
233 apply (rule SReal_number_of) |
|
234 done |
|
235 |
|
236 lemma SReal_divide_number_of: "r \<in> Reals ==> r/(number_of w::hypreal) \<in> Reals" |
185 lemma SReal_divide_number_of: "r \<in> Reals ==> r/(number_of w::hypreal) \<in> Reals" |
237 apply (simp only: divide_inverse) |
186 by simp |
238 apply (blast intro!: SReal_number_of SReal_mult SReal_inverse) |
|
239 done |
|
240 |
187 |
241 text{*epsilon is not in Reals because it is an infinitesimal*} |
188 text{*epsilon is not in Reals because it is an infinitesimal*} |
242 lemma SReal_epsilon_not_mem: "epsilon \<notin> Reals" |
189 lemma SReal_epsilon_not_mem: "epsilon \<notin> Reals" |
243 apply (simp add: SReal_def) |
190 apply (simp add: SReal_def) |
244 apply (auto simp add: hypreal_of_real_not_eq_epsilon [THEN not_sym]) |
191 apply (auto simp add: hypreal_of_real_not_eq_epsilon [THEN not_sym]) |
258 lemma hypreal_of_real_image: "hypreal_of_real `(UNIV::real set) = Reals" |
205 lemma hypreal_of_real_image: "hypreal_of_real `(UNIV::real set) = Reals" |
259 by (auto simp add: SReal_def) |
206 by (auto simp add: SReal_def) |
260 |
207 |
261 lemma inv_hypreal_of_real_image: "inv hypreal_of_real ` Reals = UNIV" |
208 lemma inv_hypreal_of_real_image: "inv hypreal_of_real ` Reals = UNIV" |
262 apply (auto simp add: SReal_def) |
209 apply (auto simp add: SReal_def) |
263 apply (rule inj_hypreal_of_real [THEN inv_f_f, THEN subst], blast) |
210 apply (rule inj_star_of [THEN inv_f_f, THEN subst], blast) |
264 done |
211 done |
265 |
212 |
266 lemma SReal_hypreal_of_real_image: |
213 lemma SReal_hypreal_of_real_image: |
267 "[| \<exists>x. x: P; P \<subseteq> Reals |] ==> \<exists>Q. P = hypreal_of_real ` Q" |
214 "[| \<exists>x. x: P; P \<subseteq> Reals |] ==> \<exists>Q. P = hypreal_of_real ` Q" |
268 apply (simp add: SReal_def, blast) |
215 apply (simp add: SReal_def, blast) |
296 |
243 |
297 subsection{* Set of Finite Elements is a Subring of the Extended Reals*} |
244 subsection{* Set of Finite Elements is a Subring of the Extended Reals*} |
298 |
245 |
299 lemma HFinite_add: "[|x \<in> HFinite; y \<in> HFinite|] ==> (x+y) \<in> HFinite" |
246 lemma HFinite_add: "[|x \<in> HFinite; y \<in> HFinite|] ==> (x+y) \<in> HFinite" |
300 apply (simp add: HFinite_def) |
247 apply (simp add: HFinite_def) |
301 apply (blast intro!: SReal_add hnorm_add_less) |
248 apply (blast intro!: Reals_add hnorm_add_less) |
302 done |
249 done |
303 |
250 |
304 lemma HFinite_mult: |
251 lemma HFinite_mult: |
305 fixes x y :: "'a::real_normed_algebra star" |
252 fixes x y :: "'a::real_normed_algebra star" |
306 shows "[|x \<in> HFinite; y \<in> HFinite|] ==> x*y \<in> HFinite" |
253 shows "[|x \<in> HFinite; y \<in> HFinite|] ==> x*y \<in> HFinite" |
307 apply (simp add: HFinite_def) |
254 apply (simp add: HFinite_def) |
308 apply (blast intro!: SReal_mult hnorm_mult_less) |
255 apply (blast intro!: Reals_mult hnorm_mult_less) |
309 done |
256 done |
310 |
257 |
311 lemma HFinite_scaleHR: |
258 lemma HFinite_scaleHR: |
312 "[|x \<in> HFinite; y \<in> HFinite|] ==> scaleHR x y \<in> HFinite" |
259 "[|x \<in> HFinite; y \<in> HFinite|] ==> scaleHR x y \<in> HFinite" |
313 apply (simp add: HFinite_def) |
260 apply (simp add: HFinite_def) |
314 apply (blast intro!: SReal_mult hnorm_scaleHR_less) |
261 apply (blast intro!: Reals_mult hnorm_scaleHR_less) |
315 done |
262 done |
316 |
263 |
317 lemma HFinite_minus_iff: "(-x \<in> HFinite) = (x \<in> HFinite)" |
264 lemma HFinite_minus_iff: "(-x \<in> HFinite) = (x \<in> HFinite)" |
318 by (simp add: HFinite_def) |
265 by (simp add: HFinite_def) |
319 |
266 |
320 lemma HFinite_star_of [simp]: "star_of x \<in> HFinite" |
267 lemma HFinite_star_of [simp]: "star_of x \<in> HFinite" |
321 apply (simp add: HFinite_def) |
268 apply (simp add: HFinite_def) |
322 apply (rule_tac x="star_of (norm x) + 1" in bexI) |
269 apply (rule_tac x="star_of (norm x) + 1" in bexI) |
323 apply (transfer, simp) |
270 apply (transfer, simp) |
324 apply (blast intro: SReal_add SReal_hypreal_of_real Reals_1) |
271 apply (blast intro: Reals_add SReal_hypreal_of_real Reals_1) |
325 done |
272 done |
326 |
273 |
327 lemma SReal_subset_HFinite: "(Reals::hypreal set) \<subseteq> HFinite" |
274 lemma SReal_subset_HFinite: "(Reals::hypreal set) \<subseteq> HFinite" |
328 by (auto simp add: SReal_def) |
275 by (auto simp add: SReal_def) |
329 |
|
330 lemma HFinite_hypreal_of_real: "hypreal_of_real x \<in> HFinite" |
|
331 by (rule HFinite_star_of) |
|
332 |
276 |
333 lemma HFiniteD: "x \<in> HFinite ==> \<exists>t \<in> Reals. hnorm x < t" |
277 lemma HFiniteD: "x \<in> HFinite ==> \<exists>t \<in> Reals. hnorm x < t" |
334 by (simp add: HFinite_def) |
278 by (simp add: HFinite_def) |
335 |
279 |
336 lemma HFinite_hrabs_iff [iff]: "(abs (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
280 lemma HFinite_hrabs_iff [iff]: "(abs (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
339 lemma HFinite_hnorm_iff [iff]: |
283 lemma HFinite_hnorm_iff [iff]: |
340 "(hnorm (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
284 "(hnorm (x::hypreal) \<in> HFinite) = (x \<in> HFinite)" |
341 by (simp add: HFinite_def) |
285 by (simp add: HFinite_def) |
342 |
286 |
343 lemma HFinite_number_of [simp]: "number_of w \<in> HFinite" |
287 lemma HFinite_number_of [simp]: "number_of w \<in> HFinite" |
344 by (unfold star_number_def, rule HFinite_star_of) |
288 unfolding star_number_def by (rule HFinite_star_of) |
345 |
289 |
346 (** As always with numerals, 0 and 1 are special cases **) |
290 (** As always with numerals, 0 and 1 are special cases **) |
347 |
291 |
348 lemma HFinite_0 [simp]: "0 \<in> HFinite" |
292 lemma HFinite_0 [simp]: "0 \<in> HFinite" |
349 by (unfold star_zero_def, rule HFinite_star_of) |
293 unfolding star_zero_def by (rule HFinite_star_of) |
350 |
294 |
351 lemma HFinite_1 [simp]: "1 \<in> HFinite" |
295 lemma HFinite_1 [simp]: "1 \<in> HFinite" |
352 by (unfold star_one_def, rule HFinite_star_of) |
296 unfolding star_one_def by (rule HFinite_star_of) |
353 |
297 |
354 lemma HFinite_bounded: |
298 lemma HFinite_bounded: |
355 "[|(x::hypreal) \<in> HFinite; y \<le> x; 0 \<le> y |] ==> y \<in> HFinite" |
299 "[|(x::hypreal) \<in> HFinite; y \<le> x; 0 \<le> y |] ==> y \<in> HFinite" |
356 apply (case_tac "x \<le> 0") |
300 apply (case_tac "x \<le> 0") |
357 apply (drule_tac y = x in order_trans) |
301 apply (drule_tac y = x in order_trans) |
420 apply (drule HFiniteD, clarify) |
364 apply (drule HFiniteD, clarify) |
421 apply (subgoal_tac "0 < t") |
365 apply (subgoal_tac "0 < t") |
422 apply (subgoal_tac "hnorm (x * y) < (r / t) * t", simp) |
366 apply (subgoal_tac "hnorm (x * y) < (r / t) * t", simp) |
423 apply (subgoal_tac "0 < r / t") |
367 apply (subgoal_tac "0 < r / t") |
424 apply (rule hnorm_mult_less) |
368 apply (rule hnorm_mult_less) |
425 apply (simp add: InfinitesimalD SReal_divide) |
369 apply (simp add: InfinitesimalD Reals_divide) |
426 apply assumption |
370 apply assumption |
427 apply (simp only: divide_pos_pos) |
371 apply (simp only: divide_pos_pos) |
428 apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
372 apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
429 done |
373 done |
430 |
374 |
450 apply (subgoal_tac "0 < t") |
394 apply (subgoal_tac "0 < t") |
451 apply (subgoal_tac "hnorm (y * x) < t * (r / t)", simp) |
395 apply (subgoal_tac "hnorm (y * x) < t * (r / t)", simp) |
452 apply (subgoal_tac "0 < r / t") |
396 apply (subgoal_tac "0 < r / t") |
453 apply (rule hnorm_mult_less) |
397 apply (rule hnorm_mult_less) |
454 apply assumption |
398 apply assumption |
455 apply (simp add: InfinitesimalD SReal_divide) |
399 apply (simp add: InfinitesimalD Reals_divide) |
456 apply (simp only: divide_pos_pos) |
400 apply (simp only: divide_pos_pos) |
457 apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
401 apply (erule order_le_less_trans [OF hnorm_ge_zero]) |
458 done |
402 done |
459 |
403 |
460 lemma Infinitesimal_scaleR2: |
404 lemma Infinitesimal_scaleR2: |
469 done |
413 done |
470 |
414 |
471 lemma Compl_HFinite: "- HFinite = HInfinite" |
415 lemma Compl_HFinite: "- HFinite = HInfinite" |
472 apply (auto simp add: HInfinite_def HFinite_def linorder_not_less) |
416 apply (auto simp add: HInfinite_def HFinite_def linorder_not_less) |
473 apply (rule_tac y="r + 1" in order_less_le_trans, simp) |
417 apply (rule_tac y="r + 1" in order_less_le_trans, simp) |
474 apply (simp add: SReal_add Reals_1) |
418 apply simp |
475 done |
419 done |
476 |
420 |
477 lemma HInfinite_inverse_Infinitesimal: |
421 lemma HInfinite_inverse_Infinitesimal: |
478 fixes x :: "'a::real_normed_div_algebra star" |
422 fixes x :: "'a::real_normed_div_algebra star" |
479 shows "x \<in> HInfinite ==> inverse x \<in> Infinitesimal" |
423 shows "x \<in> HInfinite ==> inverse x \<in> Infinitesimal" |
480 apply (rule InfinitesimalI) |
424 apply (rule InfinitesimalI) |
481 apply (subgoal_tac "x \<noteq> 0") |
425 apply (subgoal_tac "x \<noteq> 0") |
482 apply (rule inverse_less_imp_less) |
426 apply (rule inverse_less_imp_less) |
483 apply (simp add: nonzero_hnorm_inverse) |
427 apply (simp add: nonzero_hnorm_inverse) |
484 apply (simp add: HInfinite_def SReal_inverse) |
428 apply (simp add: HInfinite_def Reals_inverse) |
485 apply assumption |
429 apply assumption |
486 apply (clarify, simp add: Compl_HFinite [symmetric]) |
430 apply (clarify, simp add: Compl_HFinite [symmetric]) |
487 done |
431 done |
488 |
432 |
489 lemma HInfiniteI: "(\<And>r. r \<in> \<real> \<Longrightarrow> r < hnorm x) \<Longrightarrow> x \<in> HInfinite" |
433 lemma HInfiniteI: "(\<And>r. r \<in> \<real> \<Longrightarrow> r < hnorm x) \<Longrightarrow> x \<in> HInfinite" |
582 fixes x y :: "'a::real_normed_div_algebra star" |
526 fixes x y :: "'a::real_normed_div_algebra star" |
583 shows "[| x \<notin> Infinitesimal; y \<notin> Infinitesimal|] ==> (x*y) \<notin>Infinitesimal" |
527 shows "[| x \<notin> Infinitesimal; y \<notin> Infinitesimal|] ==> (x*y) \<notin>Infinitesimal" |
584 apply (unfold Infinitesimal_def, clarify, rename_tac r s) |
528 apply (unfold Infinitesimal_def, clarify, rename_tac r s) |
585 apply (simp only: linorder_not_less hnorm_mult) |
529 apply (simp only: linorder_not_less hnorm_mult) |
586 apply (drule_tac x = "r * s" in bspec) |
530 apply (drule_tac x = "r * s" in bspec) |
587 apply (fast intro: SReal_mult) |
531 apply (fast intro: Reals_mult) |
588 apply (drule mp, blast intro: mult_pos_pos) |
532 apply (drule mp, blast intro: mult_pos_pos) |
589 apply (drule_tac c = s and d = "hnorm y" and a = r and b = "hnorm x" in mult_mono) |
533 apply (drule_tac c = s and d = "hnorm y" and a = r and b = "hnorm x" in mult_mono) |
590 apply (simp_all (no_asm_simp)) |
534 apply (simp_all (no_asm_simp)) |
591 done |
535 done |
592 |
536 |
614 "Infinitesimal \<subseteq> HFinite" |
558 "Infinitesimal \<subseteq> HFinite" |
615 apply (simp add: Infinitesimal_def HFinite_def, auto) |
559 apply (simp add: Infinitesimal_def HFinite_def, auto) |
616 apply (rule_tac x = 1 in bexI, auto) |
560 apply (rule_tac x = 1 in bexI, auto) |
617 done |
561 done |
618 |
562 |
619 lemma Infinitesimal_hypreal_of_real_mult: |
563 lemma Infinitesimal_star_of_mult: |
620 fixes x :: "'a::real_normed_algebra star" |
564 fixes x :: "'a::real_normed_algebra star" |
621 shows "x \<in> Infinitesimal ==> x * star_of r \<in> Infinitesimal" |
565 shows "x \<in> Infinitesimal ==> x * star_of r \<in> Infinitesimal" |
622 by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult]) |
566 by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult]) |
623 |
567 |
624 lemma Infinitesimal_hypreal_of_real_mult2: |
568 lemma Infinitesimal_star_of_mult2: |
625 fixes x :: "'a::real_normed_algebra star" |
569 fixes x :: "'a::real_normed_algebra star" |
626 shows "x \<in> Infinitesimal ==> star_of r * x \<in> Infinitesimal" |
570 shows "x \<in> Infinitesimal ==> star_of r * x \<in> Infinitesimal" |
627 by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult2]) |
571 by (erule HFinite_star_of [THEN [2] Infinitesimal_HFinite_mult2]) |
628 |
572 |
629 |
573 |
770 lemma approx_mult_subst_star_of: |
714 lemma approx_mult_subst_star_of: |
771 fixes u x y :: "'a::real_normed_algebra star" |
715 fixes u x y :: "'a::real_normed_algebra star" |
772 shows "[| u @= x*star_of v; x @= y |] ==> u @= y*star_of v" |
716 shows "[| u @= x*star_of v; x @= y |] ==> u @= y*star_of v" |
773 by (auto intro: approx_mult_subst2) |
717 by (auto intro: approx_mult_subst2) |
774 |
718 |
775 lemma approx_mult_subst_SReal: |
|
776 "[| u @= x*hypreal_of_real v; x @= y |] ==> u @= y*hypreal_of_real v" |
|
777 by (rule approx_mult_subst_star_of) |
|
778 |
|
779 lemma approx_eq_imp: "a = b ==> a @= b" |
719 lemma approx_eq_imp: "a = b ==> a @= b" |
780 by (simp add: approx_def) |
720 by (simp add: approx_def) |
781 |
721 |
782 lemma Infinitesimal_minus_approx: "x \<in> Infinitesimal ==> -x @= x" |
722 lemma Infinitesimal_minus_approx: "x \<in> Infinitesimal ==> -x @= x" |
783 by (blast intro: Infinitesimal_minus_iff [THEN iffD2] |
723 by (blast intro: Infinitesimal_minus_iff [THEN iffD2] |
851 apply (auto simp add: add_assoc) |
791 apply (auto simp add: add_assoc) |
852 done |
792 done |
853 |
793 |
854 lemma approx_star_of_HFinite: "x @= star_of D ==> x \<in> HFinite" |
794 lemma approx_star_of_HFinite: "x @= star_of D ==> x \<in> HFinite" |
855 by (rule approx_sym [THEN [2] approx_HFinite], auto) |
795 by (rule approx_sym [THEN [2] approx_HFinite], auto) |
856 |
|
857 lemma approx_hypreal_of_real_HFinite: "x @= hypreal_of_real D ==> x \<in> HFinite" |
|
858 by (rule approx_star_of_HFinite) |
|
859 |
796 |
860 lemma approx_mult_HFinite: |
797 lemma approx_mult_HFinite: |
861 fixes a b c d :: "'a::real_normed_algebra star" |
798 fixes a b c d :: "'a::real_normed_algebra star" |
862 shows "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d" |
799 shows "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d" |
863 apply (rule approx_trans) |
800 apply (rule approx_trans) |
895 fixes a c :: "'a::real_normed_algebra star" |
832 fixes a c :: "'a::real_normed_algebra star" |
896 shows "[|a @= star_of b; c @= star_of d |] |
833 shows "[|a @= star_of b; c @= star_of d |] |
897 ==> a*c @= star_of b*star_of d" |
834 ==> a*c @= star_of b*star_of d" |
898 by (blast intro!: approx_mult_HFinite approx_star_of_HFinite HFinite_star_of) |
835 by (blast intro!: approx_mult_HFinite approx_star_of_HFinite HFinite_star_of) |
899 |
836 |
900 lemma approx_mult_hypreal_of_real: |
|
901 "[|a @= hypreal_of_real b; c @= hypreal_of_real d |] |
|
902 ==> a*c @= hypreal_of_real b*hypreal_of_real d" |
|
903 by (rule approx_mult_star_of) |
|
904 |
|
905 lemma approx_SReal_mult_cancel_zero: |
837 lemma approx_SReal_mult_cancel_zero: |
906 "[| (a::hypreal) \<in> Reals; a \<noteq> 0; a*x @= 0 |] ==> x @= 0" |
838 "[| (a::hypreal) \<in> Reals; a \<noteq> 0; a*x @= 0 |] ==> x @= 0" |
907 apply (drule SReal_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
839 apply (drule Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
908 apply (auto dest: approx_mult2 simp add: mult_assoc [symmetric]) |
840 apply (auto dest: approx_mult2 simp add: mult_assoc [symmetric]) |
909 done |
841 done |
910 |
842 |
911 lemma approx_mult_SReal1: "[| (a::hypreal) \<in> Reals; x @= 0 |] ==> x*a @= 0" |
843 lemma approx_mult_SReal1: "[| (a::hypreal) \<in> Reals; x @= 0 |] ==> x*a @= 0" |
912 by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult1) |
844 by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult1) |
918 "[|(a::hypreal) \<in> Reals; a \<noteq> 0 |] ==> (a*x @= 0) = (x @= 0)" |
850 "[|(a::hypreal) \<in> Reals; a \<noteq> 0 |] ==> (a*x @= 0) = (x @= 0)" |
919 by (blast intro: approx_SReal_mult_cancel_zero approx_mult_SReal2) |
851 by (blast intro: approx_SReal_mult_cancel_zero approx_mult_SReal2) |
920 |
852 |
921 lemma approx_SReal_mult_cancel: |
853 lemma approx_SReal_mult_cancel: |
922 "[| (a::hypreal) \<in> Reals; a \<noteq> 0; a* w @= a*z |] ==> w @= z" |
854 "[| (a::hypreal) \<in> Reals; a \<noteq> 0; a* w @= a*z |] ==> w @= z" |
923 apply (drule SReal_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
855 apply (drule Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
924 apply (auto dest: approx_mult2 simp add: mult_assoc [symmetric]) |
856 apply (auto dest: approx_mult2 simp add: mult_assoc [symmetric]) |
925 done |
857 done |
926 |
858 |
927 lemma approx_SReal_mult_cancel_iff1 [simp]: |
859 lemma approx_SReal_mult_cancel_iff1 [simp]: |
928 "[| (a::hypreal) \<in> Reals; a \<noteq> 0|] ==> (a* w @= a*z) = (w @= z)" |
860 "[| (a::hypreal) \<in> Reals; a \<noteq> 0|] ==> (a* w @= a*z) = (w @= z)" |
1010 |
942 |
1011 lemma star_of_HFinite_diff_Infinitesimal: |
943 lemma star_of_HFinite_diff_Infinitesimal: |
1012 "x \<noteq> 0 ==> star_of x \<in> HFinite - Infinitesimal" |
944 "x \<noteq> 0 ==> star_of x \<in> HFinite - Infinitesimal" |
1013 by simp |
945 by simp |
1014 |
946 |
1015 lemma hypreal_of_real_Infinitesimal_iff_0: |
|
1016 "(hypreal_of_real x \<in> Infinitesimal) = (x=0)" |
|
1017 by (rule star_of_Infinitesimal_iff_0) |
|
1018 |
|
1019 lemma number_of_not_Infinitesimal [simp]: |
947 lemma number_of_not_Infinitesimal [simp]: |
1020 "number_of w \<noteq> (0::hypreal) ==> (number_of w :: hypreal) \<notin> Infinitesimal" |
948 "number_of w \<noteq> (0::hypreal) ==> (number_of w :: hypreal) \<notin> Infinitesimal" |
1021 by (fast dest: SReal_number_of [THEN SReal_Infinitesimal_zero]) |
949 by (fast dest: Reals_number_of [THEN SReal_Infinitesimal_zero]) |
1022 |
950 |
1023 (*again: 1 is a special case, but not 0 this time*) |
951 (*again: 1 is a special case, but not 0 this time*) |
1024 lemma one_not_Infinitesimal [simp]: |
952 lemma one_not_Infinitesimal [simp]: |
1025 "(1::'a::{real_normed_vector,zero_neq_one} star) \<notin> Infinitesimal" |
953 "(1::'a::{real_normed_vector,zero_neq_one} star) \<notin> Infinitesimal" |
1026 apply (simp only: star_one_def star_of_Infinitesimal_iff_0) |
954 apply (simp only: star_one_def star_of_Infinitesimal_iff_0) |
1054 |
982 |
1055 lemma Infinitesimal_SReal_divide: |
983 lemma Infinitesimal_SReal_divide: |
1056 "[| (x::hypreal) \<in> Infinitesimal; y \<in> Reals |] ==> x/y \<in> Infinitesimal" |
984 "[| (x::hypreal) \<in> Infinitesimal; y \<in> Reals |] ==> x/y \<in> Infinitesimal" |
1057 apply (simp add: divide_inverse) |
985 apply (simp add: divide_inverse) |
1058 apply (auto intro!: Infinitesimal_HFinite_mult |
986 apply (auto intro!: Infinitesimal_HFinite_mult |
1059 dest!: SReal_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
987 dest!: Reals_inverse [THEN SReal_subset_HFinite [THEN subsetD]]) |
1060 done |
988 done |
1061 |
989 |
1062 (*------------------------------------------------------------------ |
990 (*------------------------------------------------------------------ |
1063 Standard Part Theorem: Every finite x: R* is infinitely |
991 Standard Part Theorem: Every finite x: R* is infinitely |
1064 close to a unique real number (i.e a member of Reals) |
992 close to a unique real number (i.e a member of Reals) |
1104 "~ (1 @= (0::'c::{zero_neq_one,real_normed_vector} star))" |
1032 "~ (1 @= (0::'c::{zero_neq_one,real_normed_vector} star))" |
1105 apply (unfold star_number_def star_zero_def star_one_def) |
1033 apply (unfold star_number_def star_zero_def star_one_def) |
1106 apply (unfold star_of_approx_iff) |
1034 apply (unfold star_of_approx_iff) |
1107 by (auto intro: sym) |
1035 by (auto intro: sym) |
1108 |
1036 |
1109 lemma hypreal_of_real_approx_iff: |
1037 lemma star_of_approx_number_of_iff [simp]: |
1110 "(hypreal_of_real k @= hypreal_of_real m) = (k = m)" |
1038 "(star_of k @= number_of w) = (k = number_of w)" |
1111 by (rule star_of_approx_iff) |
1039 by (subst star_of_approx_iff [symmetric], auto) |
1112 |
1040 |
1113 lemma hypreal_of_real_approx_number_of_iff [simp]: |
1041 lemma star_of_approx_zero_iff [simp]: "(star_of k @= 0) = (k = 0)" |
1114 "(hypreal_of_real k @= number_of w) = (k = number_of w)" |
1042 by (simp_all add: star_of_approx_iff [symmetric]) |
1115 by (subst hypreal_of_real_approx_iff [symmetric], auto) |
1043 |
1116 |
1044 lemma star_of_approx_one_iff [simp]: "(star_of k @= 1) = (k = 1)" |
1117 (*And also for 0 and 1.*) |
1045 by (simp_all add: star_of_approx_iff [symmetric]) |
1118 (*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*) |
|
1119 lemma [simp]: "(hypreal_of_real k @= 0) = (k = 0)" |
|
1120 "(hypreal_of_real k @= 1) = (k = 1)" |
|
1121 by (simp_all add: hypreal_of_real_approx_iff [symmetric]) |
|
1122 |
1046 |
1123 lemma approx_unique_real: |
1047 lemma approx_unique_real: |
1124 "[| (r::hypreal) \<in> Reals; s \<in> Reals; r @= x; s @= x|] ==> r = s" |
1048 "[| (r::hypreal) \<in> Reals; s \<in> Reals; r @= x; s @= x|] ==> r = s" |
1125 by (blast intro: SReal_approx_iff [THEN iffD1] approx_trans2) |
1049 by (blast intro: SReal_approx_iff [THEN iffD1] approx_trans2) |
1126 |
1050 |
1195 done |
1119 done |
1196 |
1120 |
1197 lemma lemma_st_part_nonempty: |
1121 lemma lemma_st_part_nonempty: |
1198 "(x::hypreal) \<in> HFinite ==> \<exists>y. y \<in> {s. s \<in> Reals & s < x}" |
1122 "(x::hypreal) \<in> HFinite ==> \<exists>y. y \<in> {s. s \<in> Reals & s < x}" |
1199 apply (drule HFiniteD, safe) |
1123 apply (drule HFiniteD, safe) |
1200 apply (drule SReal_minus) |
1124 apply (drule Reals_minus) |
1201 apply (rule_tac x = "-t" in exI) |
1125 apply (rule_tac x = "-t" in exI) |
1202 apply (auto simp add: abs_less_iff) |
1126 apply (auto simp add: abs_less_iff) |
1203 done |
1127 done |
1204 |
1128 |
1205 lemma lemma_st_part_subset: "{s. s \<in> Reals & s < x} \<subseteq> Reals" |
1129 lemma lemma_st_part_subset: "{s. s \<in> Reals & s < x} \<subseteq> Reals" |
1219 lemma lemma_st_part_le1: |
1143 lemma lemma_st_part_le1: |
1220 "[| (x::hypreal) \<in> HFinite; isLub Reals {s. s \<in> Reals & s < x} t; |
1144 "[| (x::hypreal) \<in> HFinite; isLub Reals {s. s \<in> Reals & s < x} t; |
1221 r \<in> Reals; 0 < r |] ==> x \<le> t + r" |
1145 r \<in> Reals; 0 < r |] ==> x \<le> t + r" |
1222 apply (frule isLubD1a) |
1146 apply (frule isLubD1a) |
1223 apply (rule ccontr, drule linorder_not_le [THEN iffD2]) |
1147 apply (rule ccontr, drule linorder_not_le [THEN iffD2]) |
1224 apply (drule_tac x = t in SReal_add, assumption) |
1148 apply (drule (1) Reals_add) |
1225 apply (drule_tac y = "t + r" in isLubD1 [THEN setleD], auto) |
1149 apply (drule_tac y = "r + t" in isLubD1 [THEN setleD], auto) |
1226 done |
1150 done |
1227 |
1151 |
1228 lemma hypreal_setle_less_trans: |
1152 lemma hypreal_setle_less_trans: |
1229 "[| S *<= (x::hypreal); x < y |] ==> S *<= y" |
1153 "[| S *<= (x::hypreal); x < y |] ==> S *<= y" |
1230 apply (simp add: setle_def) |
1154 apply (simp add: setle_def) |
1252 isLub Reals {s. s \<in> Reals & s < x} t; |
1176 isLub Reals {s. s \<in> Reals & s < x} t; |
1253 r \<in> Reals; 0 < r |] |
1177 r \<in> Reals; 0 < r |] |
1254 ==> t + -r \<le> x" |
1178 ==> t + -r \<le> x" |
1255 apply (frule isLubD1a) |
1179 apply (frule isLubD1a) |
1256 apply (rule ccontr, drule linorder_not_le [THEN iffD1]) |
1180 apply (rule ccontr, drule linorder_not_le [THEN iffD1]) |
1257 apply (drule SReal_minus, drule_tac x = t in SReal_add, assumption) |
1181 apply (drule Reals_minus, drule_tac a = t in Reals_add, assumption) |
1258 apply (drule lemma_st_part_gt_ub, assumption+) |
1182 apply (drule lemma_st_part_gt_ub, assumption+) |
1259 apply (drule isLub_le_isUb, assumption) |
1183 apply (drule isLub_le_isUb, assumption) |
1260 apply (drule lemma_minus_le_zero) |
1184 apply (drule lemma_minus_le_zero) |
1261 apply (auto dest: order_less_le_trans) |
1185 apply (auto dest: order_less_le_trans) |
1262 done |
1186 done |
1298 "[| (x::hypreal) \<in> HFinite; |
1222 "[| (x::hypreal) \<in> HFinite; |
1299 isLub Reals {s. s \<in> Reals & s < x} t; |
1223 isLub Reals {s. s \<in> Reals & s < x} t; |
1300 r \<in> Reals; 0 < r |] |
1224 r \<in> Reals; 0 < r |] |
1301 ==> x + -t \<noteq> r" |
1225 ==> x + -t \<noteq> r" |
1302 apply auto |
1226 apply auto |
1303 apply (frule isLubD1a [THEN SReal_minus]) |
1227 apply (frule isLubD1a [THEN Reals_minus]) |
1304 apply (drule SReal_add_cancel, assumption) |
1228 apply (drule Reals_add_cancel, assumption) |
1305 apply (drule_tac x = x in lemma_SReal_lub) |
1229 apply (drule_tac x = x in lemma_SReal_lub) |
1306 apply (drule hypreal_isLub_unique, assumption, auto) |
1230 apply (drule hypreal_isLub_unique, assumption, auto) |
1307 done |
1231 done |
1308 |
1232 |
1309 lemma lemma_st_part_not_eq2: |
1233 lemma lemma_st_part_not_eq2: |
1311 isLub Reals {s. s \<in> Reals & s < x} t; |
1235 isLub Reals {s. s \<in> Reals & s < x} t; |
1312 r \<in> Reals; 0 < r |] |
1236 r \<in> Reals; 0 < r |] |
1313 ==> -(x + -t) \<noteq> r" |
1237 ==> -(x + -t) \<noteq> r" |
1314 apply (auto) |
1238 apply (auto) |
1315 apply (frule isLubD1a) |
1239 apply (frule isLubD1a) |
1316 apply (drule SReal_add_cancel, assumption) |
1240 apply (drule Reals_add_cancel, assumption) |
1317 apply (drule_tac x = "-x" in SReal_minus, simp) |
1241 apply (drule_tac a = "-x" in Reals_minus, simp) |
1318 apply (drule_tac x = x in lemma_SReal_lub) |
1242 apply (drule_tac x = x in lemma_SReal_lub) |
1319 apply (drule hypreal_isLub_unique, assumption, auto) |
1243 apply (drule hypreal_isLub_unique, assumption, auto) |
1320 done |
1244 done |
1321 |
1245 |
1322 lemma lemma_st_part_major: |
1246 lemma lemma_st_part_major: |
1708 ==> abs (hypreal_of_real r + x) < hypreal_of_real y" |
1632 ==> abs (hypreal_of_real r + x) < hypreal_of_real y" |
1709 apply (drule_tac x = "hypreal_of_real r" in approx_hrabs_add_Infinitesimal) |
1633 apply (drule_tac x = "hypreal_of_real r" in approx_hrabs_add_Infinitesimal) |
1710 apply (drule approx_sym [THEN bex_Infinitesimal_iff2 [THEN iffD2]]) |
1634 apply (drule approx_sym [THEN bex_Infinitesimal_iff2 [THEN iffD2]]) |
1711 apply (auto intro!: Infinitesimal_add_hypreal_of_real_less |
1635 apply (auto intro!: Infinitesimal_add_hypreal_of_real_less |
1712 simp del: star_of_abs |
1636 simp del: star_of_abs |
1713 simp add: hypreal_of_real_hrabs) |
1637 simp add: star_of_abs [symmetric]) |
1714 done |
1638 done |
1715 |
1639 |
1716 lemma Infinitesimal_add_hrabs_hypreal_of_real_less2: |
1640 lemma Infinitesimal_add_hrabs_hypreal_of_real_less2: |
1717 "[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] |
1641 "[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] |
1718 ==> abs (x + hypreal_of_real r) < hypreal_of_real y" |
1642 ==> abs (x + hypreal_of_real r) < hypreal_of_real y" |
1905 |
1829 |
1906 lemma st_add: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x + y) = st x + st y" |
1830 lemma st_add: "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> st (x + y) = st x + st y" |
1907 by (simp add: st_unique st_SReal st_approx_self approx_add) |
1831 by (simp add: st_unique st_SReal st_approx_self approx_add) |
1908 |
1832 |
1909 lemma st_number_of [simp]: "st (number_of w) = number_of w" |
1833 lemma st_number_of [simp]: "st (number_of w) = number_of w" |
1910 by (rule SReal_number_of [THEN st_SReal_eq]) |
1834 by (rule Reals_number_of [THEN st_SReal_eq]) |
1911 |
1835 |
1912 (*the theorem above for the special cases of zero and one*) |
1836 (*the theorem above for the special cases of zero and one*) |
1913 lemma [simp]: "st 0 = 0" "st 1 = 1" |
1837 lemma [simp]: "st 0 = 0" "st 1 = 1" |
1914 by (simp_all add: st_SReal_eq) |
1838 by (simp_all add: st_SReal_eq) |
1915 |
1839 |
2108 lemma lemma_Infinitesimal2: |
2032 lemma lemma_Infinitesimal2: |
2109 "(\<forall>r \<in> Reals. 0 < r --> x < r) = |
2033 "(\<forall>r \<in> Reals. 0 < r --> x < r) = |
2110 (\<forall>n. x < inverse(hypreal_of_nat (Suc n)))" |
2034 (\<forall>n. x < inverse(hypreal_of_nat (Suc n)))" |
2111 apply safe |
2035 apply safe |
2112 apply (drule_tac x = "inverse (hypreal_of_real (real (Suc n))) " in bspec) |
2036 apply (drule_tac x = "inverse (hypreal_of_real (real (Suc n))) " in bspec) |
2113 apply (simp (no_asm_use) add: SReal_inverse) |
2037 apply (simp (no_asm_use)) |
2114 apply (rule real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive, THEN star_of_less [THEN iffD2], THEN [2] impE]) |
2038 apply (rule real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive, THEN star_of_less [THEN iffD2], THEN [2] impE]) |
2115 prefer 2 apply assumption |
2039 prefer 2 apply assumption |
2116 apply (simp add: real_of_nat_def) |
2040 apply (simp add: real_of_nat_def) |
2117 apply (auto dest!: reals_Archimedean simp add: SReal_iff) |
2041 apply (auto dest!: reals_Archimedean simp add: SReal_iff) |
2118 apply (drule star_of_less [THEN iffD2]) |
2042 apply (drule star_of_less [THEN iffD2]) |