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