author | berghofe |
Fri, 01 Jul 2005 13:54:12 +0200 | |
changeset 16633 | 208ebc9311f2 |
parent 15170 | e7d4d3314f4c |
child 17298 | ad73fb6144cf |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : Star.thy |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
14468 | 4 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2003/4 |
14370 | 5 |
*) |
10751 | 6 |
|
14370 | 7 |
header{*Star-Transforms in Non-Standard Analysis*} |
8 |
||
15131 | 9 |
theory Star |
15140 | 10 |
imports NSA |
15131 | 11 |
begin |
10751 | 12 |
|
13 |
constdefs |
|
14 |
(* nonstandard extension of sets *) |
|
14370 | 15 |
starset :: "real set => hypreal set" ("*s* _" [80] 80) |
14468 | 16 |
"*s* A == {x. \<forall>X \<in> Rep_hypreal(x). {n::nat. X n \<in> A}: FreeUltrafilterNat}" |
10751 | 17 |
|
18 |
(* internal sets *) |
|
14370 | 19 |
starset_n :: "(nat => real set) => hypreal set" ("*sn* _" [80] 80) |
14468 | 20 |
"*sn* As == {x. \<forall>X \<in> Rep_hypreal(x). {n::nat. X n : (As n)}: FreeUltrafilterNat}" |
14370 | 21 |
|
10751 | 22 |
InternalSets :: "hypreal set set" |
14468 | 23 |
"InternalSets == {X. \<exists>As. X = *sn* As}" |
10751 | 24 |
|
25 |
(* nonstandard extension of function *) |
|
14370 | 26 |
is_starext :: "[hypreal => hypreal, real => real] => bool" |
14468 | 27 |
"is_starext F f == (\<forall>x y. \<exists>X \<in> Rep_hypreal(x). \<exists>Y \<in> Rep_hypreal(y). |
10751 | 28 |
((y = (F x)) = ({n. Y n = f(X n)} : FreeUltrafilterNat)))" |
14370 | 29 |
|
30 |
starfun :: "(real => real) => hypreal => hypreal" ("*f* _" [80] 80) |
|
14468 | 31 |
"*f* f == (%x. Abs_hypreal(\<Union>X \<in> Rep_hypreal(x). hyprel``{%n. f(X n)}))" |
10751 | 32 |
|
33 |
(* internal functions *) |
|
14370 | 34 |
starfun_n :: "(nat => (real => real)) => hypreal => hypreal" |
35 |
("*fn* _" [80] 80) |
|
14468 | 36 |
"*fn* F == (%x. Abs_hypreal(\<Union>X \<in> Rep_hypreal(x). hyprel``{%n. (F n)(X n)}))" |
10751 | 37 |
|
14370 | 38 |
InternalFuns :: "(hypreal => hypreal) set" |
14468 | 39 |
"InternalFuns == {X. \<exists>F. X = *fn* F}" |
10751 | 40 |
|
41 |
||
42 |
||
14370 | 43 |
(*-------------------------------------------------------- |
44 |
Preamble - Pulling "EX" over "ALL" |
|
45 |
---------------------------------------------------------*) |
|
46 |
||
47 |
(* This proof does not need AC and was suggested by the |
|
48 |
referee for the JCM Paper: let f(x) be least y such |
|
49 |
that Q(x,y) |
|
50 |
*) |
|
14468 | 51 |
lemma no_choice: "\<forall>x. \<exists>y. Q x y ==> \<exists>(f :: nat => nat). \<forall>x. Q x (f x)" |
14370 | 52 |
apply (rule_tac x = "%x. LEAST y. Q x y" in exI) |
53 |
apply (blast intro: LeastI) |
|
54 |
done |
|
55 |
||
15169 | 56 |
subsection{*Properties of the Star-transform Applied to Sets of Reals*} |
14370 | 57 |
|
58 |
lemma STAR_real_set: "*s*(UNIV::real set) = (UNIV::hypreal set)" |
|
14468 | 59 |
by (simp add: starset_def) |
14370 | 60 |
declare STAR_real_set [simp] |
61 |
||
62 |
lemma STAR_empty_set: "*s* {} = {}" |
|
14468 | 63 |
by (simp add: starset_def) |
14370 | 64 |
declare STAR_empty_set [simp] |
65 |
||
66 |
lemma STAR_Un: "*s* (A Un B) = *s* A Un *s* B" |
|
14468 | 67 |
apply (auto simp add: starset_def) |
14370 | 68 |
prefer 3 apply (blast intro: FreeUltrafilterNat_subset) |
69 |
prefer 2 apply (blast intro: FreeUltrafilterNat_subset) |
|
70 |
apply (drule FreeUltrafilterNat_Compl_mem) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
71 |
apply (drule bspec, assumption) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
72 |
apply (rule_tac z = x in eq_Abs_hypreal, auto, ultra) |
14370 | 73 |
done |
74 |
||
75 |
lemma STAR_Int: "*s* (A Int B) = *s* A Int *s* B" |
|
14468 | 76 |
apply (simp add: starset_def, auto) |
14370 | 77 |
prefer 3 apply (blast intro: FreeUltrafilterNat_Int FreeUltrafilterNat_subset) |
78 |
apply (blast intro: FreeUltrafilterNat_subset)+ |
|
79 |
done |
|
80 |
||
81 |
lemma STAR_Compl: "*s* -A = -( *s* A)" |
|
82 |
apply (auto simp add: starset_def) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
83 |
apply (rule_tac [!] z = x in eq_Abs_hypreal) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
84 |
apply (auto dest!: bspec, ultra) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
85 |
apply (drule FreeUltrafilterNat_Compl_mem, ultra) |
14370 | 86 |
done |
87 |
||
88 |
lemma STAR_mem_Compl: "x \<notin> *s* F ==> x : *s* (- F)" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
89 |
by (auto simp add: STAR_Compl) |
14370 | 90 |
|
91 |
lemma STAR_diff: "*s* (A - B) = *s* A - *s* B" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
92 |
by (auto simp add: Diff_eq STAR_Int STAR_Compl) |
14370 | 93 |
|
94 |
lemma STAR_subset: "A <= B ==> *s* A <= *s* B" |
|
14468 | 95 |
apply (simp add: starset_def) |
14370 | 96 |
apply (blast intro: FreeUltrafilterNat_subset)+ |
97 |
done |
|
98 |
||
14468 | 99 |
lemma STAR_mem: "a \<in> A ==> hypreal_of_real a : *s* A" |
100 |
apply (simp add: starset_def hypreal_of_real_def) |
|
14370 | 101 |
apply (auto intro: FreeUltrafilterNat_subset) |
102 |
done |
|
103 |
||
104 |
lemma STAR_hypreal_of_real_image_subset: "hypreal_of_real ` A <= *s* A" |
|
14468 | 105 |
apply (simp add: starset_def) |
14370 | 106 |
apply (auto simp add: hypreal_of_real_def) |
107 |
apply (blast intro: FreeUltrafilterNat_subset) |
|
108 |
done |
|
109 |
||
110 |
lemma STAR_hypreal_of_real_Int: "*s* X Int Reals = hypreal_of_real ` X" |
|
14468 | 111 |
apply (simp add: starset_def) |
14370 | 112 |
apply (auto simp add: hypreal_of_real_def SReal_def) |
113 |
apply (simp add: hypreal_of_real_def [symmetric]) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
114 |
apply (rule imageI, rule ccontr) |
14370 | 115 |
apply (drule bspec) |
116 |
apply (rule lemma_hyprel_refl) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
117 |
prefer 2 apply (blast intro: FreeUltrafilterNat_subset, auto) |
14370 | 118 |
done |
119 |
||
14468 | 120 |
lemma lemma_not_hyprealA: "x \<notin> hypreal_of_real ` A ==> \<forall>y \<in> A. x \<noteq> hypreal_of_real y" |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
121 |
by auto |
14370 | 122 |
|
123 |
lemma lemma_Compl_eq: "- {n. X n = xa} = {n. X n \<noteq> xa}" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
124 |
by auto |
14370 | 125 |
|
126 |
lemma STAR_real_seq_to_hypreal: |
|
14468 | 127 |
"\<forall>n. (X n) \<notin> M |
14370 | 128 |
==> Abs_hypreal(hyprel``{X}) \<notin> *s* M" |
14468 | 129 |
apply (simp add: starset_def) |
130 |
apply (rule bexI, rule_tac [2] lemma_hyprel_refl, auto) |
|
14370 | 131 |
done |
132 |
||
133 |
lemma STAR_singleton: "*s* {x} = {hypreal_of_real x}" |
|
14468 | 134 |
apply (simp add: starset_def) |
14370 | 135 |
apply (auto simp add: hypreal_of_real_def) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
136 |
apply (rule_tac z = xa in eq_Abs_hypreal) |
14370 | 137 |
apply (auto intro: FreeUltrafilterNat_subset) |
138 |
done |
|
139 |
declare STAR_singleton [simp] |
|
140 |
||
141 |
lemma STAR_not_mem: "x \<notin> F ==> hypreal_of_real x \<notin> *s* F" |
|
142 |
apply (auto simp add: starset_def hypreal_of_real_def) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
143 |
apply (rule bexI, rule_tac [2] lemma_hyprel_refl, auto) |
14370 | 144 |
done |
145 |
||
146 |
lemma STAR_subset_closed: "[| x : *s* A; A <= B |] ==> x : *s* B" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
147 |
by (blast dest: STAR_subset) |
14370 | 148 |
|
15169 | 149 |
text{*Nonstandard extension of a set (defined using a constant |
150 |
sequence) as a special case of an internal set*} |
|
14370 | 151 |
|
14468 | 152 |
lemma starset_n_starset: "\<forall>n. (As n = A) ==> *sn* As = *s* A" |
153 |
by (simp add: starset_n_def starset_def) |
|
14370 | 154 |
|
155 |
||
156 |
(*----------------------------------------------------------------*) |
|
157 |
(* Theorems about nonstandard extensions of functions *) |
|
158 |
(*----------------------------------------------------------------*) |
|
159 |
||
160 |
(*----------------------------------------------------------------*) |
|
161 |
(* Nonstandard extension of a function (defined using a *) |
|
162 |
(* constant sequence) as a special case of an internal function *) |
|
163 |
(*----------------------------------------------------------------*) |
|
164 |
||
14468 | 165 |
lemma starfun_n_starfun: "\<forall>n. (F n = f) ==> *fn* F = *f* f" |
166 |
by (simp add: starfun_n_def starfun_def) |
|
14370 | 167 |
|
168 |
||
169 |
(* |
|
15003 | 170 |
Prove that abs for hypreal is a nonstandard extension of abs for real w/o |
14370 | 171 |
use of congruence property (proved after this for general |
15003 | 172 |
nonstandard extensions of real valued functions). |
14370 | 173 |
|
15003 | 174 |
Proof now Uses the ultrafilter tactic! |
14370 | 175 |
*) |
176 |
||
177 |
lemma hrabs_is_starext_rabs: "is_starext abs abs" |
|
14468 | 178 |
apply (simp add: is_starext_def, safe) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
179 |
apply (rule_tac z = x in eq_Abs_hypreal) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
180 |
apply (rule_tac z = y in eq_Abs_hypreal, auto) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
181 |
apply (rule bexI, rule_tac [2] lemma_hyprel_refl) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
182 |
apply (rule bexI, rule_tac [2] lemma_hyprel_refl) |
15003 | 183 |
apply (auto dest!: spec |
184 |
simp add: hypreal_minus abs_if hypreal_zero_def |
|
185 |
hypreal_le hypreal_less) |
|
14370 | 186 |
apply (arith | ultra)+ |
187 |
done |
|
188 |
||
14477 | 189 |
lemma Rep_hypreal_FreeUltrafilterNat: |
190 |
"[| X \<in> Rep_hypreal z; Y \<in> Rep_hypreal z |] |
|
14370 | 191 |
==> {n. X n = Y n} : FreeUltrafilterNat" |
14477 | 192 |
apply (cases z) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
193 |
apply (auto, ultra) |
14370 | 194 |
done |
195 |
||
15169 | 196 |
text{*Nonstandard extension of functions*} |
14370 | 197 |
|
15169 | 198 |
lemma starfun_congruent: "(%X. hyprel``{%n. f (X n)}) respects hyprel" |
14468 | 199 |
by (simp add: congruent_def, auto, ultra) |
14370 | 200 |
|
201 |
lemma starfun: |
|
202 |
"( *f* f) (Abs_hypreal(hyprel``{%n. X n})) = |
|
203 |
Abs_hypreal(hyprel `` {%n. f (X n)})" |
|
14468 | 204 |
apply (simp add: starfun_def) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
205 |
apply (rule_tac f = Abs_hypreal in arg_cong) |
14370 | 206 |
apply (simp add: hyprel_in_hypreal [THEN Abs_hypreal_inverse] |
207 |
UN_equiv_class [OF equiv_hyprel starfun_congruent]) |
|
208 |
done |
|
209 |
||
14477 | 210 |
lemma starfun_if_eq: |
211 |
"w \<noteq> hypreal_of_real x |
|
212 |
==> ( *f* (\<lambda>z. if z = x then a else g z)) w = ( *f* g) w" |
|
213 |
apply (cases w) |
|
214 |
apply (simp add: hypreal_of_real_def starfun, ultra) |
|
215 |
done |
|
216 |
||
14370 | 217 |
(*------------------------------------------- |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
218 |
multiplication: ( *f) x ( *g) = *(f x g) |
14370 | 219 |
------------------------------------------*) |
220 |
lemma starfun_mult: "( *f* f) xa * ( *f* g) xa = ( *f* (%x. f x * g x)) xa" |
|
14477 | 221 |
by (cases xa, simp add: starfun hypreal_mult) |
15003 | 222 |
|
14370 | 223 |
declare starfun_mult [symmetric, simp] |
224 |
||
225 |
(*--------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
226 |
addition: ( *f) + ( *g) = *(f + g) |
14370 | 227 |
---------------------------------------*) |
228 |
lemma starfun_add: "( *f* f) xa + ( *f* g) xa = ( *f* (%x. f x + g x)) xa" |
|
14477 | 229 |
by (cases xa, simp add: starfun hypreal_add) |
14370 | 230 |
declare starfun_add [symmetric, simp] |
231 |
||
232 |
(*-------------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
233 |
subtraction: ( *f) + -( *g) = *(f + -g) |
14370 | 234 |
-------------------------------------------*) |
235 |
||
236 |
lemma starfun_minus: "- ( *f* f) x = ( *f* (%x. - f x)) x" |
|
14477 | 237 |
apply (cases x) |
14370 | 238 |
apply (auto simp add: starfun hypreal_minus) |
239 |
done |
|
240 |
declare starfun_minus [symmetric, simp] |
|
241 |
||
242 |
(*FIXME: delete*) |
|
243 |
lemma starfun_add_minus: "( *f* f) xa + -( *f* g) xa = ( *f* (%x. f x + -g x)) xa" |
|
244 |
apply (simp (no_asm)) |
|
245 |
done |
|
246 |
declare starfun_add_minus [symmetric, simp] |
|
247 |
||
248 |
lemma starfun_diff: |
|
249 |
"( *f* f) xa - ( *f* g) xa = ( *f* (%x. f x - g x)) xa" |
|
14468 | 250 |
apply (simp add: diff_minus) |
14370 | 251 |
done |
252 |
declare starfun_diff [symmetric, simp] |
|
253 |
||
254 |
(*-------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
255 |
composition: ( *f) o ( *g) = *(f o g) |
14370 | 256 |
---------------------------------------*) |
257 |
||
258 |
lemma starfun_o2: "(%x. ( *f* f) (( *f* g) x)) = *f* (%x. f (g x))" |
|
259 |
apply (rule ext) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
260 |
apply (rule_tac z = x in eq_Abs_hypreal) |
14370 | 261 |
apply (auto simp add: starfun) |
262 |
done |
|
263 |
||
264 |
lemma starfun_o: "( *f* f) o ( *f* g) = ( *f* (f o g))" |
|
14468 | 265 |
apply (simp add: o_def) |
14370 | 266 |
apply (simp (no_asm) add: starfun_o2) |
267 |
done |
|
268 |
||
15169 | 269 |
text{*NS extension of constant function*} |
14370 | 270 |
lemma starfun_const_fun: "( *f* (%x. k)) xa = hypreal_of_real k" |
14477 | 271 |
apply (cases xa) |
14370 | 272 |
apply (auto simp add: starfun hypreal_of_real_def) |
273 |
done |
|
274 |
||
275 |
declare starfun_const_fun [simp] |
|
276 |
||
15169 | 277 |
text{*the NS extension of the identity function*} |
14370 | 278 |
|
279 |
lemma starfun_Idfun_approx: "x @= hypreal_of_real a ==> ( *f* (%x. x)) x @= hypreal_of_real a" |
|
14477 | 280 |
apply (cases x) |
14370 | 281 |
apply (auto simp add: starfun) |
282 |
done |
|
283 |
||
284 |
lemma starfun_Id: "( *f* (%x. x)) x = x" |
|
14477 | 285 |
apply (cases x) |
14370 | 286 |
apply (auto simp add: starfun) |
287 |
done |
|
288 |
declare starfun_Id [simp] |
|
289 |
||
15169 | 290 |
text{*The Star-function is a (nonstandard) extension of the function*} |
14370 | 291 |
|
292 |
lemma is_starext_starfun: "is_starext ( *f* f) f" |
|
14468 | 293 |
apply (simp add: is_starext_def, auto) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
294 |
apply (rule_tac z = x in eq_Abs_hypreal) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
295 |
apply (rule_tac z = y in eq_Abs_hypreal) |
14370 | 296 |
apply (auto intro!: bexI simp add: starfun) |
297 |
done |
|
298 |
||
15169 | 299 |
text{*Any nonstandard extension is in fact the Star-function*} |
14370 | 300 |
|
301 |
lemma is_starfun_starext: "is_starext F f ==> F = *f* f" |
|
14468 | 302 |
apply (simp add: is_starext_def) |
14370 | 303 |
apply (rule ext) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
304 |
apply (rule_tac z = x in eq_Abs_hypreal) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
305 |
apply (drule_tac x = x in spec) |
14370 | 306 |
apply (drule_tac x = "( *f* f) x" in spec) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
307 |
apply (auto dest!: FreeUltrafilterNat_Compl_mem simp add: starfun, ultra) |
14370 | 308 |
done |
309 |
||
310 |
lemma is_starext_starfun_iff: "(is_starext F f) = (F = *f* f)" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
311 |
by (blast intro: is_starfun_starext is_starext_starfun) |
14370 | 312 |
|
15169 | 313 |
text{*extented function has same solution as its standard |
14370 | 314 |
version for real arguments. i.e they are the same |
15169 | 315 |
for all real arguments*} |
14370 | 316 |
lemma starfun_eq: "( *f* f) (hypreal_of_real a) = hypreal_of_real (f a)" |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
317 |
by (auto simp add: starfun hypreal_of_real_def) |
14370 | 318 |
|
319 |
declare starfun_eq [simp] |
|
320 |
||
321 |
lemma starfun_approx: "( *f* f) (hypreal_of_real a) @= hypreal_of_real (f a)" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
322 |
by auto |
14370 | 323 |
|
324 |
(* useful for NS definition of derivatives *) |
|
325 |
lemma starfun_lambda_cancel: "( *f* (%h. f (x + h))) xa = ( *f* f) (hypreal_of_real x + xa)" |
|
14477 | 326 |
apply (cases xa) |
14370 | 327 |
apply (auto simp add: starfun hypreal_of_real_def hypreal_add) |
328 |
done |
|
329 |
||
330 |
lemma starfun_lambda_cancel2: "( *f* (%h. f(g(x + h)))) xa = ( *f* (f o g)) (hypreal_of_real x + xa)" |
|
14477 | 331 |
apply (cases xa) |
14370 | 332 |
apply (auto simp add: starfun hypreal_of_real_def hypreal_add) |
333 |
done |
|
334 |
||
335 |
lemma starfun_mult_HFinite_approx: "[| ( *f* f) xa @= l; ( *f* g) xa @= m; |
|
336 |
l: HFinite; m: HFinite |
|
337 |
|] ==> ( *f* (%x. f x * g x)) xa @= l * m" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
338 |
apply (drule approx_mult_HFinite, assumption+) |
14370 | 339 |
apply (auto intro: approx_HFinite [OF _ approx_sym]) |
340 |
done |
|
341 |
||
342 |
lemma starfun_add_approx: "[| ( *f* f) xa @= l; ( *f* g) xa @= m |
|
343 |
|] ==> ( *f* (%x. f x + g x)) xa @= l + m" |
|
344 |
apply (auto intro: approx_add) |
|
345 |
done |
|
346 |
||
15169 | 347 |
text{*Examples: hrabs is nonstandard extension of rabs |
348 |
inverse is nonstandard extension of inverse*} |
|
14370 | 349 |
|
350 |
(* can be proved easily using theorem "starfun" and *) |
|
351 |
(* properties of ultrafilter as for inverse below we *) |
|
352 |
(* use the theorem we proved above instead *) |
|
353 |
||
354 |
lemma starfun_rabs_hrabs: "*f* abs = abs" |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
355 |
by (rule hrabs_is_starext_rabs [THEN is_starext_starfun_iff [THEN iffD1], symmetric]) |
14370 | 356 |
|
357 |
lemma starfun_inverse_inverse: "( *f* inverse) x = inverse(x)" |
|
14477 | 358 |
apply (cases x) |
14370 | 359 |
apply (auto simp add: starfun hypreal_inverse hypreal_zero_def) |
360 |
done |
|
361 |
declare starfun_inverse_inverse [simp] |
|
362 |
||
363 |
lemma starfun_inverse: "inverse (( *f* f) x) = ( *f* (%x. inverse (f x))) x" |
|
14477 | 364 |
apply (cases x) |
14370 | 365 |
apply (auto simp add: starfun hypreal_inverse) |
366 |
done |
|
367 |
declare starfun_inverse [symmetric, simp] |
|
368 |
||
14468 | 369 |
lemma starfun_divide: "( *f* f) xa / ( *f* g) xa = ( *f* (%x. f x / g x)) xa" |
370 |
by (simp add: divide_inverse) |
|
14370 | 371 |
declare starfun_divide [symmetric, simp] |
372 |
||
373 |
lemma starfun_inverse2: "inverse (( *f* f) x) = ( *f* (%x. inverse (f x))) x" |
|
14477 | 374 |
apply (cases x) |
14370 | 375 |
apply (auto intro: FreeUltrafilterNat_subset dest!: FreeUltrafilterNat_Compl_mem simp add: starfun hypreal_inverse hypreal_zero_def) |
376 |
done |
|
377 |
||
15169 | 378 |
text{*General lemma/theorem needed for proofs in elementary |
379 |
topology of the reals*} |
|
14370 | 380 |
lemma starfun_mem_starset: |
14468 | 381 |
"( *f* f) x : *s* A ==> x : *s* {x. f x \<in> A}" |
382 |
apply (simp add: starset_def) |
|
14477 | 383 |
apply (cases x) |
14370 | 384 |
apply (auto simp add: starfun) |
385 |
apply (rename_tac "X") |
|
386 |
apply (drule_tac x = "%n. f (X n) " in bspec) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
387 |
apply (auto, ultra) |
14370 | 388 |
done |
389 |
||
15169 | 390 |
text{*Alternative definition for hrabs with rabs function |
14370 | 391 |
applied entrywise to equivalence class representative. |
15169 | 392 |
This is easily proved using starfun and ns extension thm*} |
15170 | 393 |
lemma hypreal_hrabs: |
394 |
"abs (Abs_hypreal (hyprel``{X})) = Abs_hypreal(hyprel `` {%n. abs (X n)})" |
|
395 |
by (simp add: starfun_rabs_hrabs [symmetric] starfun) |
|
14370 | 396 |
|
15169 | 397 |
text{*nonstandard extension of set through nonstandard extension |
14370 | 398 |
of rabs function i.e hrabs. A more general result should be |
399 |
where we replace rabs by some arbitrary function f and hrabs |
|
15169 | 400 |
by its NS extenson. See second NS set extension below.*} |
14370 | 401 |
lemma STAR_rabs_add_minus: |
402 |
"*s* {x. abs (x + - y) < r} = |
|
403 |
{x. abs(x + -hypreal_of_real y) < hypreal_of_real r}" |
|
14468 | 404 |
apply (simp add: starset_def, safe) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
405 |
apply (rule_tac [!] z = x in eq_Abs_hypreal) |
15170 | 406 |
apply (auto intro!: exI dest!: bspec |
407 |
simp add: hypreal_minus hypreal_of_real_def hypreal_add |
|
408 |
hypreal_hrabs hypreal_less) |
|
409 |
apply ultra |
|
14370 | 410 |
done |
411 |
||
412 |
lemma STAR_starfun_rabs_add_minus: |
|
413 |
"*s* {x. abs (f x + - y) < r} = |
|
414 |
{x. abs(( *f* f) x + -hypreal_of_real y) < hypreal_of_real r}" |
|
14468 | 415 |
apply (simp add: starset_def, safe) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
416 |
apply (rule_tac [!] z = x in eq_Abs_hypreal) |
15170 | 417 |
apply (auto intro!: exI dest!: bspec |
418 |
simp add: hypreal_minus hypreal_of_real_def hypreal_add |
|
419 |
hypreal_hrabs hypreal_less starfun) |
|
420 |
apply ultra |
|
14370 | 421 |
done |
422 |
||
15169 | 423 |
text{*Another characterization of Infinitesimal and one of @= relation. |
15170 | 424 |
In this theory since @{text hypreal_hrabs} proved here. Maybe |
425 |
move both theorems??*} |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
426 |
lemma Infinitesimal_FreeUltrafilterNat_iff2: |
14468 | 427 |
"(x \<in> Infinitesimal) = |
428 |
(\<exists>X \<in> Rep_hypreal(x). |
|
429 |
\<forall>m. {n. abs(X n) < inverse(real(Suc m))} |
|
430 |
\<in> FreeUltrafilterNat)" |
|
14477 | 431 |
apply (cases x) |
14370 | 432 |
apply (auto intro!: bexI lemma_hyprel_refl |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
433 |
simp add: Infinitesimal_hypreal_of_nat_iff hypreal_of_real_def |
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
434 |
hypreal_inverse hypreal_hrabs hypreal_less hypreal_of_nat_eq) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
435 |
apply (drule_tac x = n in spec, ultra) |
14370 | 436 |
done |
437 |
||
438 |
lemma approx_FreeUltrafilterNat_iff: "(Abs_hypreal(hyprel``{X}) @= Abs_hypreal(hyprel``{Y})) = |
|
14468 | 439 |
(\<forall>m. {n. abs (X n + - Y n) < |
14370 | 440 |
inverse(real(Suc m))} : FreeUltrafilterNat)" |
441 |
apply (subst approx_minus_iff) |
|
442 |
apply (rule mem_infmal_iff [THEN subst]) |
|
443 |
apply (auto simp add: hypreal_minus hypreal_add Infinitesimal_FreeUltrafilterNat_iff2) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
444 |
apply (drule_tac x = m in spec, ultra) |
14370 | 445 |
done |
446 |
||
447 |
lemma inj_starfun: "inj starfun" |
|
448 |
apply (rule inj_onI) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
449 |
apply (rule ext, rule ccontr) |
14370 | 450 |
apply (drule_tac x = "Abs_hypreal (hyprel ``{%n. xa}) " in fun_cong) |
451 |
apply (auto simp add: starfun) |
|
452 |
done |
|
453 |
||
454 |
ML |
|
455 |
{* |
|
456 |
val starset_def = thm"starset_def"; |
|
457 |
val starset_n_def = thm"starset_n_def"; |
|
458 |
val InternalSets_def = thm"InternalSets_def"; |
|
459 |
val is_starext_def = thm"is_starext_def"; |
|
460 |
val starfun_def = thm"starfun_def"; |
|
461 |
val starfun_n_def = thm"starfun_n_def"; |
|
462 |
val InternalFuns_def = thm"InternalFuns_def"; |
|
463 |
||
464 |
val no_choice = thm "no_choice"; |
|
465 |
val STAR_real_set = thm "STAR_real_set"; |
|
466 |
val STAR_empty_set = thm "STAR_empty_set"; |
|
467 |
val STAR_Un = thm "STAR_Un"; |
|
468 |
val STAR_Int = thm "STAR_Int"; |
|
469 |
val STAR_Compl = thm "STAR_Compl"; |
|
470 |
val STAR_mem_Compl = thm "STAR_mem_Compl"; |
|
471 |
val STAR_diff = thm "STAR_diff"; |
|
472 |
val STAR_subset = thm "STAR_subset"; |
|
473 |
val STAR_mem = thm "STAR_mem"; |
|
474 |
val STAR_hypreal_of_real_image_subset = thm "STAR_hypreal_of_real_image_subset"; |
|
475 |
val STAR_hypreal_of_real_Int = thm "STAR_hypreal_of_real_Int"; |
|
476 |
val STAR_real_seq_to_hypreal = thm "STAR_real_seq_to_hypreal"; |
|
477 |
val STAR_singleton = thm "STAR_singleton"; |
|
478 |
val STAR_not_mem = thm "STAR_not_mem"; |
|
479 |
val STAR_subset_closed = thm "STAR_subset_closed"; |
|
480 |
val starset_n_starset = thm "starset_n_starset"; |
|
481 |
val starfun_n_starfun = thm "starfun_n_starfun"; |
|
482 |
val hrabs_is_starext_rabs = thm "hrabs_is_starext_rabs"; |
|
483 |
val Rep_hypreal_FreeUltrafilterNat = thm "Rep_hypreal_FreeUltrafilterNat"; |
|
484 |
val starfun_congruent = thm "starfun_congruent"; |
|
485 |
val starfun = thm "starfun"; |
|
486 |
val starfun_mult = thm "starfun_mult"; |
|
487 |
val starfun_add = thm "starfun_add"; |
|
488 |
val starfun_minus = thm "starfun_minus"; |
|
489 |
val starfun_add_minus = thm "starfun_add_minus"; |
|
490 |
val starfun_diff = thm "starfun_diff"; |
|
491 |
val starfun_o2 = thm "starfun_o2"; |
|
492 |
val starfun_o = thm "starfun_o"; |
|
493 |
val starfun_const_fun = thm "starfun_const_fun"; |
|
494 |
val starfun_Idfun_approx = thm "starfun_Idfun_approx"; |
|
495 |
val starfun_Id = thm "starfun_Id"; |
|
496 |
val is_starext_starfun = thm "is_starext_starfun"; |
|
497 |
val is_starfun_starext = thm "is_starfun_starext"; |
|
498 |
val is_starext_starfun_iff = thm "is_starext_starfun_iff"; |
|
499 |
val starfun_eq = thm "starfun_eq"; |
|
500 |
val starfun_approx = thm "starfun_approx"; |
|
501 |
val starfun_lambda_cancel = thm "starfun_lambda_cancel"; |
|
502 |
val starfun_lambda_cancel2 = thm "starfun_lambda_cancel2"; |
|
503 |
val starfun_mult_HFinite_approx = thm "starfun_mult_HFinite_approx"; |
|
504 |
val starfun_add_approx = thm "starfun_add_approx"; |
|
505 |
val starfun_rabs_hrabs = thm "starfun_rabs_hrabs"; |
|
506 |
val starfun_inverse_inverse = thm "starfun_inverse_inverse"; |
|
507 |
val starfun_inverse = thm "starfun_inverse"; |
|
508 |
val starfun_divide = thm "starfun_divide"; |
|
509 |
val starfun_inverse2 = thm "starfun_inverse2"; |
|
510 |
val starfun_mem_starset = thm "starfun_mem_starset"; |
|
511 |
val hypreal_hrabs = thm "hypreal_hrabs"; |
|
512 |
val STAR_rabs_add_minus = thm "STAR_rabs_add_minus"; |
|
513 |
val STAR_starfun_rabs_add_minus = thm "STAR_starfun_rabs_add_minus"; |
|
514 |
val Infinitesimal_FreeUltrafilterNat_iff2 = thm "Infinitesimal_FreeUltrafilterNat_iff2"; |
|
515 |
val approx_FreeUltrafilterNat_iff = thm "approx_FreeUltrafilterNat_iff"; |
|
516 |
val inj_starfun = thm "inj_starfun"; |
|
517 |
*} |
|
518 |
||
519 |
end |