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