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