src/HOL/Nonstandard_Analysis/HyperDef.thy
author wenzelm
Sun, 31 Dec 2023 19:24:37 +0100
changeset 79409 e1895596e1b9
parent 75866 9eeed5c424f9
child 80914 d97fdabd9e2b
permissions -rw-r--r--
minor performance tuning: proper Same.operation; clarified modules;
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
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
    93
subsection \<open>Injection from \<^typ>\<open>hypreal\<close>\<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
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
   136
subsection \<open>Properties of \<^term>\<open>starrel\<close>\<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
67613
ce654b0e6d69 more symbols;
wenzelm
parents: 67399
diff changeset
   141
lemma starrel_in_hypreal [simp]: "starrel``{x}\<in>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
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
   148
subsection \<open>\<^term>\<open>hypreal_of_real\<close>: the Injection from \<^typ>\<open>real\<close> to \<^typ>\<open>hypreal\<close>\<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
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
   163
subsection \<open>Properties of \<^term>\<open>star_n\<close>\<close>
64435
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.
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
   202
  Use assumption that member \<^term>\<open>\<U>\<close> is not finite.\<close>
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   203
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   204
lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> \<omega>"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   205
proof -
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   206
  have False if "\<forall>\<^sub>F n in \<U>. x = 1 + real n" for x
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   207
  proof -
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   208
    have "finite {n::nat. x = 1 + real n}"
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   209
      by (simp add: finite_nat_set_iff_bounded_le) (metis add.commute nat_le_linear nat_le_real_less)
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   210
    then show False
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   211
      using FreeUltrafilterNat.finite that by blast
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   212
  qed
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   213
  then show ?thesis
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   214
    by (auto simp add: omega_def star_of_def star_n_eq_iff)
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   215
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   216
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   217
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
   218
61981
1b5845c62fa0 more symbols;
wenzelm
parents: 61975
diff changeset
   219
lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> \<epsilon>"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   220
proof -
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   221
  have False if "\<forall>\<^sub>F n in \<U>. x = inverse (1 + real n)" for x
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   222
  proof -
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   223
    have "finite {n::nat. x = inverse (1 + real n)}"
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   224
      by (simp add: finite_nat_set_iff_bounded_le) (metis add.commute inverse_inverse_eq linear nat_le_real_less of_nat_Suc) 
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   225
    then show False
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   226
      using FreeUltrafilterNat.finite that by blast
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   227
  qed
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   228
  then show ?thesis
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   229
    by (auto simp: epsilon_def star_of_def star_n_eq_iff)
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   230
qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   231
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   232
lemma epsilon_ge_zero [simp]: "0 \<le> \<epsilon>"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   233
  by (simp add: epsilon_def star_n_zero_num star_n_le)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   234
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   235
lemma epsilon_not_zero: "\<epsilon> \<noteq> 0"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   236
  using hypreal_of_real_not_eq_epsilon by force
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   237
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   238
lemma epsilon_inverse_omega: "\<epsilon> = inverse \<omega>"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   239
  by (simp add: epsilon_def omega_def star_n_inverse)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   240
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   241
lemma epsilon_gt_zero: "0 < \<epsilon>"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70356
diff changeset
   242
  by (simp add: epsilon_inverse_omega)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   243
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   244
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   245
subsection \<open>Embedding the Naturals into the Hyperreals\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   246
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   247
abbreviation hypreal_of_nat :: "nat \<Rightarrow> hypreal"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   248
  where "hypreal_of_nat \<equiv> of_nat"
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
lemma SNat_eq: "Nats = {n. \<exists>N. n = hypreal_of_nat N}"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   251
  by (simp add: Nats_def image_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   252
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   253
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
   254
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   255
lemma hypreal_of_nat: "hypreal_of_nat m = star_n (\<lambda>n. real m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   256
  by (simp add: star_of_def [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   257
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   258
declaration \<open>
70356
4a327c061870 streamlined setup for linear algebra, particularly removed redundant rule declarations
haftmann
parents: 70232
diff changeset
   259
  K (Lin_Arith.add_simps @{thms star_of_zero star_of_one
4a327c061870 streamlined setup for linear algebra, particularly removed redundant rule declarations
haftmann
parents: 70232
diff changeset
   260
      star_of_numeral star_of_add
4a327c061870 streamlined setup for linear algebra, particularly removed redundant rule declarations
haftmann
parents: 70232
diff changeset
   261
      star_of_minus star_of_diff star_of_mult}
4a327c061870 streamlined setup for linear algebra, particularly removed redundant rule declarations
haftmann
parents: 70232
diff changeset
   262
  #> Lin_Arith.add_inj_thms @{thms star_of_le [THEN iffD2]
4a327c061870 streamlined setup for linear algebra, particularly removed redundant rule declarations
haftmann
parents: 70232
diff changeset
   263
      star_of_less [THEN iffD2] star_of_eq [THEN iffD2]}
69597
ff784d5a5bfb isabelle update -u control_cartouches;
wenzelm
parents: 67613
diff changeset
   264
  #> Lin_Arith.add_inj_const (\<^const_name>\<open>StarDef.star_of\<close>, \<^typ>\<open>real \<Rightarrow> hypreal\<close>))
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   265
\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   266
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   267
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
   268
  \<open>K Lin_Arith.simproc\<close>
43595
7ae4a23b5be6 modernized some simproc setup;
wenzelm
parents: 42463
diff changeset
   269
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   270
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 61945
diff changeset
   271
subsection \<open>Exponentials on the Hyperreals\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   272
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   273
lemma hpowr_0 [simp]: "r ^ 0 = (1::hypreal)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   274
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   275
  by (rule power_0)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   276
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   277
lemma hpowr_Suc [simp]: "r ^ (Suc n) = r * (r ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   278
  for r :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   279
  by (rule power_Suc)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   280
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   281
lemma hrealpow: "star_n X ^ m = star_n (\<lambda>n. (X n::real) ^ m)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   282
  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
   283
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   284
lemma hrealpow_sum_square_expand:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   285
  "(x + y) ^ Suc (Suc 0) =
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   286
    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
   287
  for x y :: hypreal
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   288
  by (simp add: distrib_left distrib_right)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   289
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   290
lemma power_hypreal_of_real_numeral:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   291
  "(numeral v :: hypreal) ^ n = hypreal_of_real ((numeral v) ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   292
  by simp
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   293
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
   294
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   295
lemma power_hypreal_of_real_neg_numeral:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   296
  "(- numeral v :: hypreal) ^ n = hypreal_of_real ((- numeral v) ^ n)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   297
  by simp
47108
2a1953f0d20d merged fork with new numeral representation (see NEWS)
huffman
parents: 45605
diff changeset
   298
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
   299
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   300
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   301
subsection \<open>Powers with Hypernatural Exponents\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   302
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   303
text \<open>Hypernatural powers of hyperreals.\<close>
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   304
definition pow :: "'a::power star \<Rightarrow> nat star \<Rightarrow> 'a star"  (infixr "pow" 80)
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 64438
diff changeset
   305
  where hyperpow_def [transfer_unfold]: "R pow N = ( *f2* (^)) R N"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   306
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   307
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
   308
  by (simp add: hyperpow_def)
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 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
   311
  by (simp add: hyperpow_def starfun2_star_n)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   312
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   313
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
   314
  by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   315
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   316
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
   317
  by transfer (rule power_not_zero)
56217
dc429a5b13c4 Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents: 55911
diff changeset
   318
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   319
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
   320
  by transfer (rule power_inverse [symmetric])
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 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
   323
  by transfer (rule power_abs [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   324
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   325
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
   326
  by transfer (rule power_add)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   327
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   328
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
   329
  by transfer (rule power_one_right)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   330
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   331
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
   332
  by transfer (rule power2_eq_square)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   333
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   334
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
   335
  by transfer (rule zero_less_power)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   336
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   337
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
   338
  by transfer (rule zero_le_power)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   339
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   340
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
   341
  by transfer (rule power_mono [OF _ order_less_imp_le])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   342
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   343
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
   344
  by transfer (rule power_one)
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 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
   347
  by transfer (rule abs_power_minus)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   348
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   349
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
   350
  by transfer (rule power_mult_distrib)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   351
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   352
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
   353
  by (auto simp add: hyperpow_two zero_le_mult_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   354
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   355
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
   356
  by (simp add: hyperpow_hrabs)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   357
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   358
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
   359
  by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   360
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   361
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
   362
  by transfer (rule one_le_power)
27468
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 two_hyperpow_ge_one [simp]: "(1::hypreal) \<le> 2 pow n"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   365
  by (metis hyperpow_eq_one hyperpow_le one_le_numeral zero_less_one)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   366
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   367
lemma hyperpow_minus_one2 [simp]: "\<And>n. (- 1) pow (2 * n) = (1::hypreal)"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   368
  by transfer (rule power_minus1_even)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   369
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   370
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
   371
  by transfer (rule power_decreasing [OF order_less_imp_le])
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 hyperpow_SHNat_le:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   374
  "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
   375
  by (auto intro!: hyperpow_less_le simp: HNatInfinite_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   376
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   377
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
   378
  by transfer (rule refl)
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 hyperpow_SReal [simp]: "(hypreal_of_real r) pow (hypnat_of_nat n) \<in> \<real>"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   381
  by (simp add: Reals_eq_Standard)
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_zero_HNatInfinite [simp]: "N \<in> HNatInfinite \<Longrightarrow> (0::hypreal) pow N = 0"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   384
  by (drule HNatInfinite_is_Suc, auto)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   385
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   386
lemma hyperpow_le_le: "(0::hypreal) \<le> r \<Longrightarrow> r \<le> 1 \<Longrightarrow> n \<le> N \<Longrightarrow> r pow N \<le> r pow n"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   387
  by (metis hyperpow_less_le le_less)
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_Suc_le_self2: "(0::hypreal) \<le> r \<Longrightarrow> r < 1 \<Longrightarrow> r pow (n + (1::hypnat)) \<le> r"
70232
d19266b7465f clearout of some useless lemmas
paulson <lp15@cam.ac.uk>
parents: 69597
diff changeset
   390
  by (metis hyperpow_less_le hyperpow_one hypnat_add_self_le le_less)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   391
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   392
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
   393
  by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   394
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   395
lemma of_hypreal_hyperpow:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 63648
diff changeset
   396
  "\<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
   397
  by transfer (rule of_real_power)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   398
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   399
end