author | wenzelm |
Sun, 31 Dec 2023 19:24:37 +0100 | |
changeset 79409 | e1895596e1b9 |
parent 75866 | 9eeed5c424f9 |
child 80914 | d97fdabd9e2b |
permissions | -rw-r--r-- |
62479 | 1 |
(* Title: HOL/Nonstandard_Analysis/HyperDef.thy |
2 |
Author: Jacques D. Fleuriot |
|
3 |
Copyright: 1998 University of Cambridge |
|
27468 | 4 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
5 |
*) |
|
6 |
||
64435 | 7 |
section \<open>Construction of Hyperreals Using Ultrafilters\<close> |
27468 | 8 |
|
9 |
theory HyperDef |
|
64435 | 10 |
imports Complex_Main HyperNat |
27468 | 11 |
begin |
12 |
||
42463 | 13 |
type_synonym hypreal = "real star" |
27468 | 14 |
|
64435 | 15 |
abbreviation hypreal_of_real :: "real \<Rightarrow> real star" |
16 |
where "hypreal_of_real \<equiv> star_of" |
|
27468 | 17 |
|
64435 | 18 |
abbreviation hypreal_of_hypnat :: "hypnat \<Rightarrow> hypreal" |
19 |
where "hypreal_of_hypnat \<equiv> of_hypnat" |
|
27468 | 20 |
|
64435 | 21 |
definition omega :: hypreal ("\<omega>") |
22 |
where "\<omega> = star_n (\<lambda>n. real (Suc n))" |
|
23 |
\<comment> \<open>an infinite number \<open>= [<1, 2, 3, \<dots>>]\<close>\<close> |
|
27468 | 24 |
|
64435 | 25 |
definition epsilon :: hypreal ("\<epsilon>") |
26 |
where "\<epsilon> = star_n (\<lambda>n. inverse (real (Suc n)))" |
|
27 |
\<comment> \<open>an infinitesimal number \<open>= [<1, 1/2, 1/3, \<dots>>]\<close>\<close> |
|
27468 | 28 |
|
29 |
||
61975 | 30 |
subsection \<open>Real vector class instances\<close> |
27468 | 31 |
|
32 |
instantiation star :: (scaleR) scaleR |
|
33 |
begin |
|
64435 | 34 |
definition star_scaleR_def [transfer_unfold]: "scaleR r \<equiv> *f* (scaleR r)" |
35 |
instance .. |
|
27468 | 36 |
end |
37 |
||
38 |
lemma Standard_scaleR [simp]: "x \<in> Standard \<Longrightarrow> scaleR r x \<in> Standard" |
|
64435 | 39 |
by (simp add: star_scaleR_def) |
27468 | 40 |
|
41 |
lemma star_of_scaleR [simp]: "star_of (scaleR r x) = scaleR r (star_of x)" |
|
64435 | 42 |
by transfer (rule refl) |
27468 | 43 |
|
44 |
instance star :: (real_vector) real_vector |
|
45 |
proof |
|
46 |
fix a b :: real |
|
47 |
show "\<And>x y::'a star. scaleR a (x + y) = scaleR a x + scaleR a y" |
|
48 |
by transfer (rule scaleR_right_distrib) |
|
49 |
show "\<And>x::'a star. scaleR (a + b) x = scaleR a x + scaleR b x" |
|
50 |
by transfer (rule scaleR_left_distrib) |
|
51 |
show "\<And>x::'a star. scaleR a (scaleR b x) = scaleR (a * b) x" |
|
52 |
by transfer (rule scaleR_scaleR) |
|
53 |
show "\<And>x::'a star. scaleR 1 x = x" |
|
54 |
by transfer (rule scaleR_one) |
|
55 |
qed |
|
56 |
||
57 |
instance star :: (real_algebra) real_algebra |
|
58 |
proof |
|
59 |
fix a :: real |
|
60 |
show "\<And>x y::'a star. scaleR a x * y = scaleR a (x * y)" |
|
61 |
by transfer (rule mult_scaleR_left) |
|
62 |
show "\<And>x y::'a star. x * scaleR a y = scaleR a (x * y)" |
|
63 |
by transfer (rule mult_scaleR_right) |
|
64 |
qed |
|
65 |
||
66 |
instance star :: (real_algebra_1) real_algebra_1 .. |
|
67 |
||
68 |
instance star :: (real_div_algebra) real_div_algebra .. |
|
69 |
||
27553 | 70 |
instance star :: (field_char_0) field_char_0 .. |
71 |
||
27468 | 72 |
instance star :: (real_field) real_field .. |
73 |
||
74 |
lemma star_of_real_def [transfer_unfold]: "of_real r = star_of (of_real r)" |
|
64435 | 75 |
by (unfold of_real_def, transfer, rule refl) |
27468 | 76 |
|
77 |
lemma Standard_of_real [simp]: "of_real r \<in> Standard" |
|
64435 | 78 |
by (simp add: star_of_real_def) |
27468 | 79 |
|
80 |
lemma star_of_of_real [simp]: "star_of (of_real r) = of_real r" |
|
64435 | 81 |
by transfer (rule refl) |
27468 | 82 |
|
83 |
lemma of_real_eq_star_of [simp]: "of_real = star_of" |
|
84 |
proof |
|
64435 | 85 |
show "of_real r = star_of r" for r :: real |
27468 | 86 |
by transfer simp |
87 |
qed |
|
88 |
||
61070 | 89 |
lemma Reals_eq_Standard: "(\<real> :: hypreal set) = Standard" |
64435 | 90 |
by (simp add: Reals_def Standard_def) |
27468 | 91 |
|
92 |
||
69597 | 93 |
subsection \<open>Injection from \<^typ>\<open>hypreal\<close>\<close> |
27468 | 94 |
|
64435 | 95 |
definition of_hypreal :: "hypreal \<Rightarrow> 'a::real_algebra_1 star" |
96 |
where [transfer_unfold]: "of_hypreal = *f* of_real" |
|
27468 | 97 |
|
64435 | 98 |
lemma Standard_of_hypreal [simp]: "r \<in> Standard \<Longrightarrow> of_hypreal r \<in> Standard" |
99 |
by (simp add: of_hypreal_def) |
|
27468 | 100 |
|
101 |
lemma of_hypreal_0 [simp]: "of_hypreal 0 = 0" |
|
64435 | 102 |
by transfer (rule of_real_0) |
27468 | 103 |
|
104 |
lemma of_hypreal_1 [simp]: "of_hypreal 1 = 1" |
|
64435 | 105 |
by transfer (rule of_real_1) |
27468 | 106 |
|
64435 | 107 |
lemma of_hypreal_add [simp]: "\<And>x y. of_hypreal (x + y) = of_hypreal x + of_hypreal y" |
108 |
by transfer (rule of_real_add) |
|
27468 | 109 |
|
110 |
lemma of_hypreal_minus [simp]: "\<And>x. of_hypreal (- x) = - of_hypreal x" |
|
64435 | 111 |
by transfer (rule of_real_minus) |
27468 | 112 |
|
64435 | 113 |
lemma of_hypreal_diff [simp]: "\<And>x y. of_hypreal (x - y) = of_hypreal x - of_hypreal y" |
114 |
by transfer (rule of_real_diff) |
|
27468 | 115 |
|
64435 | 116 |
lemma of_hypreal_mult [simp]: "\<And>x y. of_hypreal (x * y) = of_hypreal x * of_hypreal y" |
117 |
by transfer (rule of_real_mult) |
|
27468 | 118 |
|
119 |
lemma of_hypreal_inverse [simp]: |
|
120 |
"\<And>x. of_hypreal (inverse x) = |
|
64435 | 121 |
inverse (of_hypreal x :: 'a::{real_div_algebra, division_ring} star)" |
122 |
by transfer (rule of_real_inverse) |
|
27468 | 123 |
|
124 |
lemma of_hypreal_divide [simp]: |
|
125 |
"\<And>x y. of_hypreal (x / y) = |
|
64435 | 126 |
(of_hypreal x / of_hypreal y :: 'a::{real_field, field} star)" |
127 |
by transfer (rule of_real_divide) |
|
27468 | 128 |
|
64435 | 129 |
lemma of_hypreal_eq_iff [simp]: "\<And>x y. (of_hypreal x = of_hypreal y) = (x = y)" |
130 |
by transfer (rule of_real_eq_iff) |
|
27468 | 131 |
|
64435 | 132 |
lemma of_hypreal_eq_0_iff [simp]: "\<And>x. (of_hypreal x = 0) = (x = 0)" |
133 |
by transfer (rule of_real_eq_0_iff) |
|
27468 | 134 |
|
135 |
||
69597 | 136 |
subsection \<open>Properties of \<^term>\<open>starrel\<close>\<close> |
27468 | 137 |
|
138 |
lemma lemma_starrel_refl [simp]: "x \<in> starrel `` {x}" |
|
64435 | 139 |
by (simp add: starrel_def) |
27468 | 140 |
|
67613 | 141 |
lemma starrel_in_hypreal [simp]: "starrel``{x}\<in>star" |
64435 | 142 |
by (simp add: star_def starrel_def quotient_def, blast) |
27468 | 143 |
|
144 |
declare Abs_star_inject [simp] Abs_star_inverse [simp] |
|
145 |
declare equiv_starrel [THEN eq_equiv_class_iff, simp] |
|
146 |
||
64435 | 147 |
|
69597 | 148 |
subsection \<open>\<^term>\<open>hypreal_of_real\<close>: the Injection from \<^typ>\<open>real\<close> to \<^typ>\<open>hypreal\<close>\<close> |
27468 | 149 |
|
150 |
lemma inj_star_of: "inj star_of" |
|
64435 | 151 |
by (rule inj_onI) simp |
27468 | 152 |
|
64435 | 153 |
lemma mem_Rep_star_iff: "X \<in> Rep_star x \<longleftrightarrow> x = star_n X" |
154 |
by (cases x) (simp add: star_n_def) |
|
27468 | 155 |
|
64435 | 156 |
lemma Rep_star_star_n_iff [simp]: "X \<in> Rep_star (star_n Y) \<longleftrightarrow> eventually (\<lambda>n. Y n = X n) \<U>" |
157 |
by (simp add: star_n_def) |
|
27468 | 158 |
|
159 |
lemma Rep_star_star_n: "X \<in> Rep_star (star_n X)" |
|
64435 | 160 |
by simp |
27468 | 161 |
|
162 |
||
69597 | 163 |
subsection \<open>Properties of \<^term>\<open>star_n\<close>\<close> |
64435 | 164 |
|
165 |
lemma star_n_add: "star_n X + star_n Y = star_n (\<lambda>n. X n + Y n)" |
|
166 |
by (simp only: star_add_def starfun2_star_n) |
|
27468 | 167 |
|
64435 | 168 |
lemma star_n_minus: "- star_n X = star_n (\<lambda>n. -(X n))" |
169 |
by (simp only: star_minus_def starfun_star_n) |
|
27468 | 170 |
|
64435 | 171 |
lemma star_n_diff: "star_n X - star_n Y = star_n (\<lambda>n. X n - Y n)" |
172 |
by (simp only: star_diff_def starfun2_star_n) |
|
27468 | 173 |
|
64435 | 174 |
lemma star_n_mult: "star_n X * star_n Y = star_n (\<lambda>n. X n * Y n)" |
175 |
by (simp only: star_mult_def starfun2_star_n) |
|
27468 | 176 |
|
64435 | 177 |
lemma star_n_inverse: "inverse (star_n X) = star_n (\<lambda>n. inverse (X n))" |
178 |
by (simp only: star_inverse_def starfun_star_n) |
|
27468 | 179 |
|
64438 | 180 |
lemma star_n_le: "star_n X \<le> star_n Y = eventually (\<lambda>n. X n \<le> Y n) \<U>" |
64435 | 181 |
by (simp only: star_le_def starP2_star_n) |
182 |
||
64438 | 183 |
lemma star_n_less: "star_n X < star_n Y = eventually (\<lambda>n. X n < Y n) \<U>" |
64435 | 184 |
by (simp only: star_less_def starP2_star_n) |
27468 | 185 |
|
64435 | 186 |
lemma star_n_zero_num: "0 = star_n (\<lambda>n. 0)" |
187 |
by (simp only: star_zero_def star_of_def) |
|
27468 | 188 |
|
64435 | 189 |
lemma star_n_one_num: "1 = star_n (\<lambda>n. 1)" |
190 |
by (simp only: star_one_def star_of_def) |
|
27468 | 191 |
|
64435 | 192 |
lemma star_n_abs: "\<bar>star_n X\<bar> = star_n (\<lambda>n. \<bar>X n\<bar>)" |
193 |
by (simp only: star_abs_def starfun_star_n) |
|
27468 | 194 |
|
61981 | 195 |
lemma hypreal_omega_gt_zero [simp]: "0 < \<omega>" |
64435 | 196 |
by (simp add: omega_def star_n_zero_num star_n_less) |
27468 | 197 |
|
198 |
||
64435 | 199 |
subsection \<open>Existence of Infinite Hyperreal Number\<close> |
200 |
||
201 |
text \<open>Existence of infinite number not corresponding to any real number. |
|
69597 | 202 |
Use assumption that member \<^term>\<open>\<U>\<close> is not finite.\<close> |
64435 | 203 |
|
61981 | 204 |
lemma hypreal_of_real_not_eq_omega: "hypreal_of_real x \<noteq> \<omega>" |
70232 | 205 |
proof - |
206 |
have False if "\<forall>\<^sub>F n in \<U>. x = 1 + real n" for x |
|
207 |
proof - |
|
208 |
have "finite {n::nat. x = 1 + real n}" |
|
209 |
by (simp add: finite_nat_set_iff_bounded_le) (metis add.commute nat_le_linear nat_le_real_less) |
|
210 |
then show False |
|
211 |
using FreeUltrafilterNat.finite that by blast |
|
212 |
qed |
|
213 |
then show ?thesis |
|
214 |
by (auto simp add: omega_def star_of_def star_n_eq_iff) |
|
215 |
qed |
|
27468 | 216 |
|
64435 | 217 |
text \<open>Existence of infinitesimal number also not corresponding to any real number.\<close> |
27468 | 218 |
|
61981 | 219 |
lemma hypreal_of_real_not_eq_epsilon: "hypreal_of_real x \<noteq> \<epsilon>" |
70232 | 220 |
proof - |
221 |
have False if "\<forall>\<^sub>F n in \<U>. x = inverse (1 + real n)" for x |
|
222 |
proof - |
|
223 |
have "finite {n::nat. x = inverse (1 + real n)}" |
|
224 |
by (simp add: finite_nat_set_iff_bounded_le) (metis add.commute inverse_inverse_eq linear nat_le_real_less of_nat_Suc) |
|
225 |
then show False |
|
226 |
using FreeUltrafilterNat.finite that by blast |
|
227 |
qed |
|
228 |
then show ?thesis |
|
229 |
by (auto simp: epsilon_def star_of_def star_n_eq_iff) |
|
230 |
qed |
|
27468 | 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 | 236 |
using hypreal_of_real_not_eq_epsilon by force |
27468 | 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 | 239 |
by (simp add: epsilon_def omega_def star_n_inverse) |
27468 | 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 | 243 |
|
244 |
||
64435 | 245 |
subsection \<open>Embedding the Naturals into the Hyperreals\<close> |
246 |
||
247 |
abbreviation hypreal_of_nat :: "nat \<Rightarrow> hypreal" |
|
248 |
where "hypreal_of_nat \<equiv> of_nat" |
|
27468 | 249 |
|
250 |
lemma SNat_eq: "Nats = {n. \<exists>N. n = hypreal_of_nat N}" |
|
64435 | 251 |
by (simp add: Nats_def image_def) |
27468 | 252 |
|
64435 | 253 |
text \<open>Naturals embedded in hyperreals: is a hyperreal c.f. NS extension.\<close> |
27468 | 254 |
|
64435 | 255 |
lemma hypreal_of_nat: "hypreal_of_nat m = star_n (\<lambda>n. real m)" |
256 |
by (simp add: star_of_def [symmetric]) |
|
27468 | 257 |
|
61975 | 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 | 264 |
#> Lin_Arith.add_inj_const (\<^const_name>\<open>StarDef.star_of\<close>, \<^typ>\<open>real \<Rightarrow> hypreal\<close>)) |
61975 | 265 |
\<close> |
27468 | 266 |
|
64435 | 267 |
simproc_setup fast_arith_hypreal ("(m::hypreal) < n" | "(m::hypreal) \<le> n" | "(m::hypreal) = n") = |
61975 | 268 |
\<open>K Lin_Arith.simproc\<close> |
43595 | 269 |
|
27468 | 270 |
|
61975 | 271 |
subsection \<open>Exponentials on the Hyperreals\<close> |
27468 | 272 |
|
64435 | 273 |
lemma hpowr_0 [simp]: "r ^ 0 = (1::hypreal)" |
274 |
for r :: hypreal |
|
275 |
by (rule power_0) |
|
27468 | 276 |
|
64435 | 277 |
lemma hpowr_Suc [simp]: "r ^ (Suc n) = r * (r ^ n)" |
278 |
for r :: hypreal |
|
279 |
by (rule power_Suc) |
|
27468 | 280 |
|
64435 | 281 |
lemma hrealpow: "star_n X ^ m = star_n (\<lambda>n. (X n::real) ^ m)" |
282 |
by (induct m) (auto simp: star_n_one_num star_n_mult) |
|
27468 | 283 |
|
284 |
lemma hrealpow_sum_square_expand: |
|
64435 | 285 |
"(x + y) ^ Suc (Suc 0) = |
286 |
x ^ Suc (Suc 0) + y ^ Suc (Suc 0) + (hypreal_of_nat (Suc (Suc 0))) * x * y" |
|
287 |
for x y :: hypreal |
|
288 |
by (simp add: distrib_left distrib_right) |
|
27468 | 289 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
45605
diff
changeset
|
290 |
lemma power_hypreal_of_real_numeral: |
64435 | 291 |
"(numeral v :: hypreal) ^ n = hypreal_of_real ((numeral v) ^ n)" |
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 | 296 |
"(- numeral v :: hypreal) ^ n = hypreal_of_real ((- numeral v) ^ n)" |
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 | 299 |
|
300 |
||
64435 | 301 |
subsection \<open>Powers with Hypernatural Exponents\<close> |
27468 | 302 |
|
64435 | 303 |
text \<open>Hypernatural powers of hyperreals.\<close> |
304 |
definition pow :: "'a::power star \<Rightarrow> nat star \<Rightarrow> 'a star" (infixr "pow" 80) |
|
67399 | 305 |
where hyperpow_def [transfer_unfold]: "R pow N = ( *f2* (^)) R N" |
27468 | 306 |
|
64435 | 307 |
lemma Standard_hyperpow [simp]: "r \<in> Standard \<Longrightarrow> n \<in> Standard \<Longrightarrow> r pow n \<in> Standard" |
308 |
by (simp add: hyperpow_def) |
|
27468 | 309 |
|
64435 | 310 |
lemma hyperpow: "star_n X pow star_n Y = star_n (\<lambda>n. X n ^ Y n)" |
311 |
by (simp add: hyperpow_def starfun2_star_n) |
|
312 |
||
313 |
lemma hyperpow_zero [simp]: "\<And>n. (0::'a::{power,semiring_0} star) pow (n + (1::hypnat)) = 0" |
|
314 |
by transfer simp |
|
27468 | 315 |
|
64435 | 316 |
lemma hyperpow_not_zero: "\<And>r n. r \<noteq> (0::'a::{field} star) \<Longrightarrow> r pow n \<noteq> 0" |
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 | 319 |
lemma hyperpow_inverse: "\<And>r n. r \<noteq> (0::'a::field star) \<Longrightarrow> inverse (r pow n) = (inverse r) pow n" |
320 |
by transfer (rule power_inverse [symmetric]) |
|
27468 | 321 |
|
64435 | 322 |
lemma hyperpow_hrabs: "\<And>r n. \<bar>r::'a::{linordered_idom} star\<bar> pow n = \<bar>r pow n\<bar>" |
323 |
by transfer (rule power_abs [symmetric]) |
|
27468 | 324 |
|
64435 | 325 |
lemma hyperpow_add: "\<And>r n m. (r::'a::monoid_mult star) pow (n + m) = (r pow n) * (r pow m)" |
326 |
by transfer (rule power_add) |
|
27468 | 327 |
|
64435 | 328 |
lemma hyperpow_one [simp]: "\<And>r. (r::'a::monoid_mult star) pow (1::hypnat) = r" |
329 |
by transfer (rule power_one_right) |
|
27468 | 330 |
|
64435 | 331 |
lemma hyperpow_two: "\<And>r. (r::'a::monoid_mult star) pow (2::hypnat) = r * r" |
332 |
by transfer (rule power2_eq_square) |
|
27468 | 333 |
|
64435 | 334 |
lemma hyperpow_gt_zero: "\<And>r n. (0::'a::{linordered_semidom} star) < r \<Longrightarrow> 0 < r pow n" |
335 |
by transfer (rule zero_less_power) |
|
336 |
||
337 |
lemma hyperpow_ge_zero: "\<And>r n. (0::'a::{linordered_semidom} star) \<le> r \<Longrightarrow> 0 \<le> r pow n" |
|
338 |
by transfer (rule zero_le_power) |
|
27468 | 339 |
|
64435 | 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" |
341 |
by transfer (rule power_mono [OF _ order_less_imp_le]) |
|
27468 | 342 |
|
64435 | 343 |
lemma hyperpow_eq_one [simp]: "\<And>n. 1 pow n = (1::'a::monoid_mult star)" |
344 |
by transfer (rule power_one) |
|
27468 | 345 |
|
64435 | 346 |
lemma hrabs_hyperpow_minus [simp]: "\<And>(a::'a::linordered_idom star) n. \<bar>(-a) pow n\<bar> = \<bar>a pow n\<bar>" |
347 |
by transfer (rule abs_power_minus) |
|
27468 | 348 |
|
64435 | 349 |
lemma hyperpow_mult: "\<And>r s n. (r * s::'a::comm_monoid_mult star) pow n = (r pow n) * (s pow n)" |
350 |
by transfer (rule power_mult_distrib) |
|
27468 | 351 |
|
64435 | 352 |
lemma hyperpow_two_le [simp]: "\<And>r. (0::'a::{monoid_mult,linordered_ring_strict} star) \<le> r pow 2" |
353 |
by (auto simp add: hyperpow_two zero_le_mult_iff) |
|
27468 | 354 |
|
64435 | 355 |
lemma hyperpow_two_hrabs [simp]: "\<bar>x::'a::linordered_idom star\<bar> pow 2 = x pow 2" |
356 |
by (simp add: hyperpow_hrabs) |
|
27468 | 357 |
|
64435 | 358 |
lemma hyperpow_two_gt_one: "\<And>r::'a::linordered_semidom star. 1 < r \<Longrightarrow> 1 < r pow 2" |
359 |
by transfer simp |
|
27468 | 360 |
|
64435 | 361 |
lemma hyperpow_two_ge_one: "\<And>r::'a::linordered_semidom star. 1 \<le> r \<Longrightarrow> 1 \<le> r pow 2" |
362 |
by transfer (rule one_le_power) |
|
27468 | 363 |
|
364 |
lemma two_hyperpow_ge_one [simp]: "(1::hypreal) \<le> 2 pow n" |
|
70232 | 365 |
by (metis hyperpow_eq_one hyperpow_le one_le_numeral zero_less_one) |
27468 | 366 |
|
64435 | 367 |
lemma hyperpow_minus_one2 [simp]: "\<And>n. (- 1) pow (2 * n) = (1::hypreal)" |
368 |
by transfer (rule power_minus1_even) |
|
27468 | 369 |
|
64435 | 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" |
371 |
by transfer (rule power_decreasing [OF order_less_imp_le]) |
|
27468 | 372 |
|
373 |
lemma hyperpow_SHNat_le: |
|
64435 | 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" |
375 |
by (auto intro!: hyperpow_less_le simp: HNatInfinite_iff) |
|
27468 | 376 |
|
64435 | 377 |
lemma hyperpow_realpow: "(hypreal_of_real r) pow (hypnat_of_nat n) = hypreal_of_real (r ^ n)" |
378 |
by transfer (rule refl) |
|
27468 | 379 |
|
64435 | 380 |
lemma hyperpow_SReal [simp]: "(hypreal_of_real r) pow (hypnat_of_nat n) \<in> \<real>" |
381 |
by (simp add: Reals_eq_Standard) |
|
27468 | 382 |
|
64435 | 383 |
lemma hyperpow_zero_HNatInfinite [simp]: "N \<in> HNatInfinite \<Longrightarrow> (0::hypreal) pow N = 0" |
384 |
by (drule HNatInfinite_is_Suc, auto) |
|
27468 | 385 |
|
64435 | 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 | 387 |
by (metis hyperpow_less_le le_less) |
27468 | 388 |
|
64435 | 389 |
lemma hyperpow_Suc_le_self2: "(0::hypreal) \<le> r \<Longrightarrow> r < 1 \<Longrightarrow> r pow (n + (1::hypnat)) \<le> r" |
70232 | 390 |
by (metis hyperpow_less_le hyperpow_one hypnat_add_self_le le_less) |
27468 | 391 |
|
392 |
lemma hyperpow_hypnat_of_nat: "\<And>x. x pow hypnat_of_nat n = x ^ n" |
|
64435 | 393 |
by transfer (rule refl) |
27468 | 394 |
|
395 |
lemma of_hypreal_hyperpow: |
|
64435 | 396 |
"\<And>x n. of_hypreal (x pow n) = (of_hypreal x::'a::{real_algebra_1} star) pow n" |
397 |
by transfer (rule of_real_power) |
|
27468 | 398 |
|
399 |
end |