src/HOL/Nonstandard_Analysis/HyperDef.thy
author eberlm <eberlm@in.tum.de>
Mon, 29 May 2017 09:14:15 +0200
changeset 65956 639eb3617a86
parent 64438 f91cae6c1d74
child 67399 eab6ce8368fa
permissions -rw-r--r--
reorganised material on sublists
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62479
716336f19aa9 clarified session;
wenzelm
parents: 62390
diff changeset
     1
(*  Title:      HOL/Nonstandard_Analysis/HyperDef.thy
716336f19aa9 clarified session;
wenzelm
parents: 62390
diff changeset
     2
    Author:     Jacques D. Fleuriot
716336f19aa9 clarified session;
wenzelm
parents: 62390
diff changeset
     3
    Copyright:  1998  University of Cambridge
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     4
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
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
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
     7
section \<open>Construction of Hyperreals Using Ultrafilters\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     8
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     9
theory HyperDef
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    10
  imports Complex_Main HyperNat
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    11
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    12
42463
f270e3e18be5 modernized specifications;
wenzelm
parents: 38715
diff changeset
    13
type_synonym hypreal = "real star"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    14
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    15
abbreviation hypreal_of_real :: "real \<Rightarrow> real star"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    16
  where "hypreal_of_real \<equiv> star_of"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    17
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    18
abbreviation hypreal_of_hypnat :: "hypnat \<Rightarrow> hypreal"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    19
  where "hypreal_of_hypnat \<equiv> of_hypnat"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    20
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    21
definition omega :: hypreal  ("\<omega>")
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    22
  where "\<omega> = star_n (\<lambda>n. real (Suc n))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    23
    \<comment> \<open>an infinite number \<open>= [<1, 2, 3, \<dots>>]\<close>\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    24
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    25
definition epsilon :: hypreal  ("\<epsilon>")
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    26
  where "\<epsilon> = star_n (\<lambda>n. inverse (real (Suc n)))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    27
    \<comment> \<open>an infinitesimal number \<open>= [<1, 1/2, 1/3, \<dots>>]\<close>\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    28
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    29
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
    30
subsection \<open>Real vector class instances\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    31
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    32
instantiation star :: (scaleR) scaleR
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    33
begin
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    34
  definition star_scaleR_def [transfer_unfold]: "scaleR r \<equiv> *f* (scaleR r)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    35
  instance ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    36
end
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
lemma Standard_scaleR [simp]: "x \<in> Standard \<Longrightarrow> scaleR r x \<in> Standard"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    39
  by (simp add: star_scaleR_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    40
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    41
lemma star_of_scaleR [simp]: "star_of (scaleR r x) = scaleR r (star_of x)"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    42
  by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    43
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    44
instance star :: (real_vector) real_vector
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    45
proof
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    46
  fix a b :: real
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    47
  show "\<And>x y::'a star. scaleR a (x + y) = scaleR a x + scaleR a y"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    48
    by transfer (rule scaleR_right_distrib)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    49
  show "\<And>x::'a star. scaleR (a + b) x = scaleR a x + scaleR b x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    50
    by transfer (rule scaleR_left_distrib)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    51
  show "\<And>x::'a star. scaleR a (scaleR b x) = scaleR (a * b) x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    52
    by transfer (rule scaleR_scaleR)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    53
  show "\<And>x::'a star. scaleR 1 x = x"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    54
    by transfer (rule scaleR_one)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    55
qed
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
instance star :: (real_algebra) real_algebra
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    58
proof
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    59
  fix a :: real
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    60
  show "\<And>x y::'a star. scaleR a x * y = scaleR a (x * y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    61
    by transfer (rule mult_scaleR_left)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    62
  show "\<And>x y::'a star. x * scaleR a y = scaleR a (x * y)"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    63
    by transfer (rule mult_scaleR_right)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    64
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    65
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    66
instance star :: (real_algebra_1) real_algebra_1 ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    67
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    68
instance star :: (real_div_algebra) real_div_algebra ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    69
27553
d315a513a150 instance real_field < field_char_0;
huffman
parents: 27468
diff changeset
    70
instance star :: (field_char_0) field_char_0 ..
d315a513a150 instance real_field < field_char_0;
huffman
parents: 27468
diff changeset
    71
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    72
instance star :: (real_field) real_field ..
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    73
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    74
lemma star_of_real_def [transfer_unfold]: "of_real r = star_of (of_real r)"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    75
  by (unfold of_real_def, transfer, rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    76
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    77
lemma Standard_of_real [simp]: "of_real r \<in> Standard"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    78
  by (simp add: star_of_real_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    79
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    80
lemma star_of_of_real [simp]: "star_of (of_real r) = of_real r"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    81
  by transfer (rule refl)
27468
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 of_real_eq_star_of [simp]: "of_real = star_of"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    84
proof
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    85
  show "of_real r = star_of r" for r :: real
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    86
    by transfer simp
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    87
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    88
61070
b72a990adfe2 prefer symbols;
wenzelm
parents: 60867
diff changeset
    89
lemma Reals_eq_Standard: "(\<real> :: hypreal set) = Standard"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    90
  by (simp add: Reals_def Standard_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    91
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    92
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
    93
subsection \<open>Injection from @{typ hypreal}\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    94
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    95
definition of_hypreal :: "hypreal \<Rightarrow> 'a::real_algebra_1 star"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    96
  where [transfer_unfold]: "of_hypreal = *f* of_real"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    97
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    98
lemma Standard_of_hypreal [simp]: "r \<in> Standard \<Longrightarrow> of_hypreal r \<in> Standard"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
    99
  by (simp add: of_hypreal_def)
27468
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 of_hypreal_0 [simp]: "of_hypreal 0 = 0"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   102
  by transfer (rule of_real_0)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   103
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   104
lemma of_hypreal_1 [simp]: "of_hypreal 1 = 1"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   105
  by transfer (rule of_real_1)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   106
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   107
lemma of_hypreal_add [simp]: "\<And>x y. of_hypreal (x + y) = of_hypreal x + of_hypreal y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   108
  by transfer (rule of_real_add)
27468
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 of_hypreal_minus [simp]: "\<And>x. of_hypreal (- x) = - of_hypreal x"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   111
  by transfer (rule of_real_minus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   112
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   113
lemma of_hypreal_diff [simp]: "\<And>x y. of_hypreal (x - y) = of_hypreal x - of_hypreal y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   114
  by transfer (rule of_real_diff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   115
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   116
lemma of_hypreal_mult [simp]: "\<And>x y. of_hypreal (x * y) = of_hypreal x * of_hypreal y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   117
  by transfer (rule of_real_mult)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   118
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   119
lemma of_hypreal_inverse [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   120
  "\<And>x. of_hypreal (inverse x) =
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   121
    inverse (of_hypreal x :: 'a::{real_div_algebra, division_ring} star)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   122
  by transfer (rule of_real_inverse)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   123
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   124
lemma of_hypreal_divide [simp]:
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   125
  "\<And>x y. of_hypreal (x / y) =
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   126
    (of_hypreal x / of_hypreal y :: 'a::{real_field, field} star)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   127
  by transfer (rule of_real_divide)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   128
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   129
lemma of_hypreal_eq_iff [simp]: "\<And>x y. (of_hypreal x = of_hypreal y) = (x = y)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   130
  by transfer (rule of_real_eq_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   131
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   132
lemma of_hypreal_eq_0_iff [simp]: "\<And>x. (of_hypreal x = 0) = (x = 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   133
  by transfer (rule of_real_eq_0_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   134
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   135
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   136
subsection \<open>Properties of @{term starrel}\<close>
27468
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 lemma_starrel_refl [simp]: "x \<in> starrel `` {x}"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   139
  by (simp add: starrel_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   140
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   141
lemma starrel_in_hypreal [simp]: "starrel``{x}:star"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   142
  by (simp add: star_def starrel_def quotient_def, blast)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   143
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   144
declare Abs_star_inject [simp] Abs_star_inverse [simp]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   145
declare equiv_starrel [THEN eq_equiv_class_iff, simp]
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   146
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   147
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   148
subsection \<open>@{term hypreal_of_real}: the Injection from @{typ real} to @{typ hypreal}\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   149
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   150
lemma inj_star_of: "inj star_of"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   151
  by (rule inj_onI) simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   152
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   153
lemma mem_Rep_star_iff: "X \<in> Rep_star x \<longleftrightarrow> x = star_n X"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   154
  by (cases x) (simp add: star_n_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   155
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   156
lemma Rep_star_star_n_iff [simp]: "X \<in> Rep_star (star_n Y) \<longleftrightarrow> eventually (\<lambda>n. Y n = X n) \<U>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   157
  by (simp add: star_n_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   158
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   159
lemma Rep_star_star_n: "X \<in> Rep_star (star_n X)"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   160
  by simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   161
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   162
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   163
subsection \<open>Properties of @{term star_n}\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   164
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   165
lemma star_n_add: "star_n X + star_n Y = star_n (\<lambda>n. X n + Y n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   166
  by (simp only: star_add_def starfun2_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   167
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   168
lemma star_n_minus: "- star_n X = star_n (\<lambda>n. -(X n))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   169
  by (simp only: star_minus_def starfun_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   170
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   171
lemma star_n_diff: "star_n X - star_n Y = star_n (\<lambda>n. X n - Y n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   172
  by (simp only: star_diff_def starfun2_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   173
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   174
lemma star_n_mult: "star_n X * star_n Y = star_n (\<lambda>n. X n * Y n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   175
  by (simp only: star_mult_def starfun2_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   176
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   177
lemma star_n_inverse: "inverse (star_n X) = star_n (\<lambda>n. inverse (X n))"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   178
  by (simp only: star_inverse_def starfun_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   179
64438
wenzelm
parents: 64435
diff changeset
   180
lemma star_n_le: "star_n X \<le> star_n Y = eventually (\<lambda>n. X n \<le> Y n) \<U>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   181
  by (simp only: star_le_def starP2_star_n)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   182
64438
wenzelm
parents: 64435
diff changeset
   183
lemma star_n_less: "star_n X < star_n Y = eventually (\<lambda>n. X n < Y n) \<U>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   184
  by (simp only: star_less_def starP2_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   185
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   186
lemma star_n_zero_num: "0 = star_n (\<lambda>n. 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   187
  by (simp only: star_zero_def star_of_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   188
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   189
lemma star_n_one_num: "1 = star_n (\<lambda>n. 1)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   190
  by (simp only: star_one_def star_of_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   191
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   192
lemma star_n_abs: "\<bar>star_n X\<bar> = star_n (\<lambda>n. \<bar>X n\<bar>)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   193
  by (simp only: star_abs_def starfun_star_n)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   194
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   195
lemma hypreal_omega_gt_zero [simp]: "0 < \<omega>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   196
  by (simp add: omega_def star_n_zero_num star_n_less)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   197
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   198
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   199
subsection \<open>Existence of Infinite Hyperreal Number\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   200
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   201
text \<open>Existence of infinite number not corresponding to any real number.
64438
wenzelm
parents: 64435
diff changeset
   202
  Use assumption that member @{term \<U>} is not finite.\<close>
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   203
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   204
text \<open>A few lemmas first.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   205
61806
d2e62ae01cd8 Cauchy's integral formula for circles. Starting to fix eventually_mono.
paulson <lp15@cam.ac.uk>
parents: 61609
diff changeset
   206
lemma lemma_omega_empty_singleton_disj:
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61378
diff changeset
   207
  "{n::nat. x = real n} = {} \<or> (\<exists>y. {n::nat. x = real n} = {y})"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   208
  by force
27468
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 lemma_finite_omega_set: "finite {n::nat. x = real n}"
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 61378
diff changeset
   211
  using lemma_omega_empty_singleton_disj [of x] by auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   212
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   213
lemma not_ex_hypreal_of_real_eq_omega: "\<nexists>x. hypreal_of_real x = \<omega>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   214
  apply (simp add: omega_def star_of_def star_n_eq_iff)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   215
  apply clarify
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   216
  apply (rule_tac x2="x-1" in lemma_finite_omega_set [THEN FreeUltrafilterNat.finite, THEN notE])
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   217
  apply (erule eventually_mono)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   218
  apply auto
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   219
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   220
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   221
lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> \<omega>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   222
  using not_ex_hypreal_of_real_eq_omega by auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   223
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   224
text \<open>Existence of infinitesimal number also not corresponding to any real number.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   225
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   226
lemma lemma_epsilon_empty_singleton_disj:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   227
  "{n::nat. x = inverse(real(Suc n))} = {} \<or> (\<exists>y. {n::nat. x = inverse(real(Suc n))} = {y})"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   228
  by auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   229
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   230
lemma lemma_finite_epsilon_set: "finite {n. x = inverse (real (Suc n))}"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   231
  using lemma_epsilon_empty_singleton_disj [of x] by auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   232
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   233
lemma not_ex_hypreal_of_real_eq_epsilon: "\<nexists>x. hypreal_of_real x = \<epsilon>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   234
  by (auto simp: epsilon_def star_of_def star_n_eq_iff
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   235
      lemma_finite_epsilon_set [THEN FreeUltrafilterNat.finite] simp del: of_nat_Suc)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   236
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   237
lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> \<epsilon>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   238
  using not_ex_hypreal_of_real_eq_epsilon by auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   239
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   240
lemma hypreal_epsilon_not_zero: "\<epsilon> \<noteq> 0"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   241
  by (simp add: epsilon_def star_zero_def star_of_def star_n_eq_iff FreeUltrafilterNat.proper
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   242
      del: star_of_zero)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   243
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   244
lemma hypreal_epsilon_inverse_omega: "\<epsilon> = inverse \<omega>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   245
  by (simp add: epsilon_def omega_def star_n_inverse)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   246
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   247
lemma hypreal_epsilon_gt_zero: "0 < \<epsilon>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   248
  by (simp add: hypreal_epsilon_inverse_omega)
27468
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
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   251
subsection \<open>Absolute Value Function for the Hyperreals\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   252
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   253
lemma hrabs_add_less: "\<bar>x\<bar> < r \<Longrightarrow> \<bar>y\<bar> < s \<Longrightarrow> \<bar>x + y\<bar> < r + s"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   254
  for x y r s :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   255
  by (simp add: abs_if split: if_split_asm)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   256
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   257
lemma hrabs_less_gt_zero: "\<bar>x\<bar> < r \<Longrightarrow> 0 < r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   258
  for x r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   259
  by (blast intro!: order_le_less_trans abs_ge_zero)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   260
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   261
lemma hrabs_disj: "\<bar>x\<bar> = x \<or> \<bar>x\<bar> = -x"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   262
  for x :: "'a::abs_if"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   263
  by (simp add: abs_if)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   264
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   265
lemma hrabs_add_lemma_disj: "y + - x + (y + - z) = \<bar>x + - z\<bar> \<Longrightarrow> y = z \<or> x = y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   266
  for x y z :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   267
  by (simp add: abs_if split: if_split_asm)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   268
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   269
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   270
subsection \<open>Embedding the Naturals into the Hyperreals\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   271
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   272
abbreviation hypreal_of_nat :: "nat \<Rightarrow> hypreal"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   273
  where "hypreal_of_nat \<equiv> of_nat"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   274
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   275
lemma SNat_eq: "Nats = {n. \<exists>N. n = hypreal_of_nat N}"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   276
  by (simp add: Nats_def image_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   277
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   278
text \<open>Naturals embedded in hyperreals: is a hyperreal c.f. NS extension.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   279
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   280
lemma hypreal_of_nat: "hypreal_of_nat m = star_n (\<lambda>n. real m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   281
  by (simp add: star_of_def [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   282
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   283
declaration \<open>
31100
6a2e67fe4488 tuned interface of Lin_Arith
haftmann
parents: 31017
diff changeset
   284
  K (Lin_Arith.add_inj_thms [@{thm star_of_le} RS iffD2,
6a2e67fe4488 tuned interface of Lin_Arith
haftmann
parents: 31017
diff changeset
   285
    @{thm star_of_less} RS iffD2, @{thm star_of_eq} RS iffD2]
6a2e67fe4488 tuned interface of Lin_Arith
haftmann
parents: 31017
diff changeset
   286
  #> Lin_Arith.add_simps [@{thm star_of_zero}, @{thm star_of_one},
55911
d00023bd3554 remove simp rules made redundant by the replacement of neg_numeral with negated numerals
huffman
parents: 54489
diff changeset
   287
      @{thm star_of_numeral}, @{thm star_of_add},
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   288
      @{thm star_of_minus}, @{thm star_of_diff}, @{thm star_of_mult}]
43595
7ae4a23b5be6 modernized some simproc setup;
wenzelm
parents: 42463
diff changeset
   289
  #> Lin_Arith.add_inj_const (@{const_name "StarDef.star_of"}, @{typ "real \<Rightarrow> hypreal"}))
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   290
\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   291
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   292
simproc_setup fast_arith_hypreal ("(m::hypreal) < n" | "(m::hypreal) \<le> n" | "(m::hypreal) = n") =
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   293
  \<open>K Lin_Arith.simproc\<close>
43595
7ae4a23b5be6 modernized some simproc setup;
wenzelm
parents: 42463
diff changeset
   294
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   295
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   296
subsection \<open>Exponentials on the Hyperreals\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   297
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   298
lemma hpowr_0 [simp]: "r ^ 0 = (1::hypreal)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   299
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   300
  by (rule power_0)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   301
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   302
lemma hpowr_Suc [simp]: "r ^ (Suc n) = r * (r ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   303
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   304
  by (rule power_Suc)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   305
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   306
lemma hrealpow_two: "r ^ Suc (Suc 0) = r * r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   307
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   308
  by simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   309
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   310
lemma hrealpow_two_le [simp]: "0 \<le> r ^ Suc (Suc 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   311
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   312
  by (auto simp add: zero_le_mult_iff)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   313
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   314
lemma hrealpow_two_le_add_order [simp]: "0 \<le> u ^ Suc (Suc 0) + v ^ Suc (Suc 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   315
  for u v :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   316
  by (simp only: hrealpow_two_le add_nonneg_nonneg)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   317
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   318
lemma hrealpow_two_le_add_order2 [simp]: "0 \<le> u ^ Suc (Suc 0) + v ^ Suc (Suc 0) + w ^ Suc (Suc 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   319
  for u v w :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   320
  by (simp only: hrealpow_two_le add_nonneg_nonneg)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   321
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   322
lemma hypreal_add_nonneg_eq_0_iff: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> x + y = 0 \<longleftrightarrow> x = 0 \<and> y = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   323
  for x y :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   324
  by arith
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   325
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   326
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   327
(* FIXME: DELETE THESE *)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   328
lemma hypreal_three_squares_add_zero_iff: "x * x + y * y + z * z = 0 \<longleftrightarrow> x = 0 \<and> y = 0 \<and> z = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   329
  for x y z :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   330
  by (simp only: zero_le_square add_nonneg_nonneg hypreal_add_nonneg_eq_0_iff) auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   331
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   332
lemma hrealpow_three_squares_add_zero_iff [simp]:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   333
  "x ^ Suc (Suc 0) + y ^ Suc (Suc 0) + z ^ Suc (Suc 0) = 0 \<longleftrightarrow> x = 0 \<and> y = 0 \<and> z = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   334
  for x y z :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   335
  by (simp only: hypreal_three_squares_add_zero_iff hrealpow_two)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   336
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   337
(*FIXME: This and RealPow.abs_realpow_two should be replaced by an abstract
35050
9f841f20dca6 renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents: 35043
diff changeset
   338
  result proved in Rings or Fields*)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   339
lemma hrabs_hrealpow_two [simp]: "\<bar>x ^ Suc (Suc 0)\<bar> = x ^ Suc (Suc 0)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   340
  for x :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   341
  by (simp add: abs_mult)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   342
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   343
lemma two_hrealpow_ge_one [simp]: "(1::hypreal) \<le> 2 ^ n"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   344
  using power_increasing [of 0 n "2::hypreal"] by simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   345
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   346
lemma hrealpow: "star_n X ^ m = star_n (\<lambda>n. (X n::real) ^ m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   347
  by (induct m) (auto simp: star_n_one_num star_n_mult)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   348
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   349
lemma hrealpow_sum_square_expand:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   350
  "(x + y) ^ Suc (Suc 0) =
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   351
    x ^ Suc (Suc 0) + y ^ Suc (Suc 0) + (hypreal_of_nat (Suc (Suc 0))) * x * y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   352
  for x y :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   353
  by (simp add: distrib_left distrib_right)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   354
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   355
lemma power_hypreal_of_real_numeral:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   356
  "(numeral v :: hypreal) ^ n = hypreal_of_real ((numeral v) ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   357
  by simp
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   358
declare power_hypreal_of_real_numeral [of _ "numeral w", simp] for w
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   359
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   360
lemma power_hypreal_of_real_neg_numeral:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   361
  "(- numeral v :: hypreal) ^ n = hypreal_of_real ((- numeral v) ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   362
  by simp
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   363
declare power_hypreal_of_real_neg_numeral [of _ "numeral w", simp] for w
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   364
(*
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   365
lemma hrealpow_HFinite:
31017
2c227493ea56 stripped class recpower further
haftmann
parents: 31001
diff changeset
   366
  fixes x :: "'a::{real_normed_algebra,power} star"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   367
  shows "x \<in> HFinite ==> x ^ n \<in> HFinite"
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   368
apply (induct_tac "n")
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   369
apply (auto simp add: power_Suc intro: HFinite_mult)
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   370
done
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   371
*)
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
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   374
subsection \<open>Powers with Hypernatural Exponents\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   375
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   376
text \<open>Hypernatural powers of hyperreals.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   377
definition pow :: "'a::power star \<Rightarrow> nat star \<Rightarrow> 'a star"  (infixr "pow" 80)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   378
  where hyperpow_def [transfer_unfold]: "R pow N = ( *f2* op ^) R N"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   379
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   380
lemma Standard_hyperpow [simp]: "r \<in> Standard \<Longrightarrow> n \<in> Standard \<Longrightarrow> r pow n \<in> Standard"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   381
  by (simp add: hyperpow_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   382
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   383
lemma hyperpow: "star_n X pow star_n Y = star_n (\<lambda>n. X n ^ Y n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   384
  by (simp add: hyperpow_def starfun2_star_n)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   385
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   386
lemma hyperpow_zero [simp]: "\<And>n. (0::'a::{power,semiring_0} star) pow (n + (1::hypnat)) = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   387
  by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   388
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   389
lemma hyperpow_not_zero: "\<And>r n. r \<noteq> (0::'a::{field} star) \<Longrightarrow> r pow n \<noteq> 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   390
  by transfer (rule power_not_zero)
56217
dc429a5b13c4 Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents: 55911
diff changeset
   391
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   392
lemma hyperpow_inverse: "\<And>r n. r \<noteq> (0::'a::field star) \<Longrightarrow> inverse (r pow n) = (inverse r) pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   393
  by transfer (rule power_inverse [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   394
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   395
lemma hyperpow_hrabs: "\<And>r n. \<bar>r::'a::{linordered_idom} star\<bar> pow n = \<bar>r pow n\<bar>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   396
  by transfer (rule power_abs [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   397
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   398
lemma hyperpow_add: "\<And>r n m. (r::'a::monoid_mult star) pow (n + m) = (r pow n) * (r pow m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   399
  by transfer (rule power_add)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   400
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   401
lemma hyperpow_one [simp]: "\<And>r. (r::'a::monoid_mult star) pow (1::hypnat) = r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   402
  by transfer (rule power_one_right)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   403
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   404
lemma hyperpow_two: "\<And>r. (r::'a::monoid_mult star) pow (2::hypnat) = r * r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   405
  by transfer (rule power2_eq_square)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   406
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   407
lemma hyperpow_gt_zero: "\<And>r n. (0::'a::{linordered_semidom} star) < r \<Longrightarrow> 0 < r pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   408
  by transfer (rule zero_less_power)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   409
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   410
lemma hyperpow_ge_zero: "\<And>r n. (0::'a::{linordered_semidom} star) \<le> r \<Longrightarrow> 0 \<le> r pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   411
  by transfer (rule zero_le_power)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   412
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   413
lemma hyperpow_le: "\<And>x y n. (0::'a::{linordered_semidom} star) < x \<Longrightarrow> x \<le> y \<Longrightarrow> x pow n \<le> y pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   414
  by transfer (rule power_mono [OF _ order_less_imp_le])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   415
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   416
lemma hyperpow_eq_one [simp]: "\<And>n. 1 pow n = (1::'a::monoid_mult star)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   417
  by transfer (rule power_one)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   418
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   419
lemma hrabs_hyperpow_minus [simp]: "\<And>(a::'a::linordered_idom star) n. \<bar>(-a) pow n\<bar> = \<bar>a pow n\<bar>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   420
  by transfer (rule abs_power_minus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   421
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   422
lemma hyperpow_mult: "\<And>r s n. (r * s::'a::comm_monoid_mult star) pow n = (r pow n) * (s pow n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   423
  by transfer (rule power_mult_distrib)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   424
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   425
lemma hyperpow_two_le [simp]: "\<And>r. (0::'a::{monoid_mult,linordered_ring_strict} star) \<le> r pow 2"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   426
  by (auto simp add: hyperpow_two zero_le_mult_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   427
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   428
lemma hrabs_hyperpow_two [simp]:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   429
  "\<bar>x pow 2\<bar> = (x::'a::{monoid_mult,linordered_ring_strict} star) pow 2"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   430
  by (simp only: abs_of_nonneg hyperpow_two_le)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   431
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   432
lemma hyperpow_two_hrabs [simp]: "\<bar>x::'a::linordered_idom star\<bar> pow 2 = x pow 2"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   433
  by (simp add: hyperpow_hrabs)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   434
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   435
text \<open>The precondition could be weakened to @{term "0\<le>x"}.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   436
lemma hypreal_mult_less_mono: "u < v \<Longrightarrow> x < y \<Longrightarrow> 0 < v \<Longrightarrow> 0 < x \<Longrightarrow> u * x < v * y"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   437
  for u v x y :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   438
  by (simp add: mult_strict_mono order_less_imp_le)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   439
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   440
lemma hyperpow_two_gt_one: "\<And>r::'a::linordered_semidom star. 1 < r \<Longrightarrow> 1 < r pow 2"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   441
  by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   442
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   443
lemma hyperpow_two_ge_one: "\<And>r::'a::linordered_semidom star. 1 \<le> r \<Longrightarrow> 1 \<le> r pow 2"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   444
  by transfer (rule one_le_power)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   445
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   446
lemma two_hyperpow_ge_one [simp]: "(1::hypreal) \<le> 2 pow n"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   447
  apply (rule_tac y = "1 pow n" in order_trans)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   448
   apply (rule_tac [2] hyperpow_le)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   449
    apply auto
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   450
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   451
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   452
lemma hyperpow_minus_one2 [simp]: "\<And>n. (- 1) pow (2 * n) = (1::hypreal)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   453
  by transfer (rule power_minus1_even)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   454
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   455
lemma hyperpow_less_le: "\<And>r n N. (0::hypreal) \<le> r \<Longrightarrow> r \<le> 1 \<Longrightarrow> n < N \<Longrightarrow> r pow N \<le> r pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   456
  by transfer (rule power_decreasing [OF order_less_imp_le])
27468
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 hyperpow_SHNat_le:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   459
  "0 \<le> r \<Longrightarrow> r \<le> (1::hypreal) \<Longrightarrow> N \<in> HNatInfinite \<Longrightarrow> \<forall>n\<in>Nats. r pow N \<le> r pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   460
  by (auto intro!: hyperpow_less_le simp: HNatInfinite_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   461
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   462
lemma hyperpow_realpow: "(hypreal_of_real r) pow (hypnat_of_nat n) = hypreal_of_real (r ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   463
  by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   464
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   465
lemma hyperpow_SReal [simp]: "(hypreal_of_real r) pow (hypnat_of_nat n) \<in> \<real>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   466
  by (simp add: Reals_eq_Standard)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   467
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   468
lemma hyperpow_zero_HNatInfinite [simp]: "N \<in> HNatInfinite \<Longrightarrow> (0::hypreal) pow N = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   469
  by (drule HNatInfinite_is_Suc, auto)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   470
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   471
lemma hyperpow_le_le: "(0::hypreal) \<le> r \<Longrightarrow> r \<le> 1 \<Longrightarrow> n \<le> N \<Longrightarrow> r pow N \<le> r pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   472
  apply (drule order_le_less [of n, THEN iffD1])
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   473
  apply (auto intro: hyperpow_less_le)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   474
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   475
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   476
lemma hyperpow_Suc_le_self2: "(0::hypreal) \<le> r \<Longrightarrow> r < 1 \<Longrightarrow> r pow (n + (1::hypnat)) \<le> r"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   477
  apply (drule_tac n = " (1::hypnat) " in hyperpow_le_le)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   478
    apply auto
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   479
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   480
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   481
lemma hyperpow_hypnat_of_nat: "\<And>x. x pow hypnat_of_nat n = x ^ n"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   482
  by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   483
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   484
lemma of_hypreal_hyperpow:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   485
  "\<And>x n. of_hypreal (x pow n) = (of_hypreal x::'a::{real_algebra_1} star) pow n"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   486
  by transfer (rule of_real_power)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   487
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   488
end