author | haftmann |
Tue, 25 Jul 2006 16:51:26 +0200 | |
changeset 20192 | 956cd30ef3be |
parent 19765 | dfe940911617 |
child 20552 | 2c31dd358c21 |
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 |
|
19765 | 13 |
definition |
10751 | 14 |
(* internal sets *) |
19765 | 15 |
starset_n :: "(nat => 'a set) => 'a star set" ("*sn* _" [80] 80) |
16 |
"*sn* As = Iset (star_n As)" |
|
14370 | 17 |
|
19765 | 18 |
InternalSets :: "'a star set set" |
19 |
"InternalSets = {X. \<exists>As. X = *sn* As}" |
|
10751 | 20 |
|
19765 | 21 |
(* nonstandard extension of function *) |
22 |
is_starext :: "['a star => 'a star, 'a => 'a] => bool" |
|
23 |
"is_starext F f = (\<forall>x y. \<exists>X \<in> Rep_star(x). \<exists>Y \<in> Rep_star(y). |
|
10751 | 24 |
((y = (F x)) = ({n. Y n = f(X n)} : FreeUltrafilterNat)))" |
19765 | 25 |
(* internal functions *) |
26 |
starfun_n :: "(nat => ('a => 'b)) => 'a star => 'b star" ("*fn* _" [80] 80) |
|
27 |
"*fn* F = Ifun (star_n F)" |
|
10751 | 28 |
|
19765 | 29 |
InternalFuns :: "('a star => 'b star) set" |
30 |
"InternalFuns = {X. \<exists>F. X = *fn* F}" |
|
10751 | 31 |
|
32 |
||
14370 | 33 |
(*-------------------------------------------------------- |
34 |
Preamble - Pulling "EX" over "ALL" |
|
35 |
---------------------------------------------------------*) |
|
36 |
||
37 |
(* This proof does not need AC and was suggested by the |
|
38 |
referee for the JCM Paper: let f(x) be least y such |
|
39 |
that Q(x,y) |
|
40 |
*) |
|
14468 | 41 |
lemma no_choice: "\<forall>x. \<exists>y. Q x y ==> \<exists>(f :: nat => nat). \<forall>x. Q x (f x)" |
14370 | 42 |
apply (rule_tac x = "%x. LEAST y. Q x y" in exI) |
43 |
apply (blast intro: LeastI) |
|
44 |
done |
|
45 |
||
15169 | 46 |
subsection{*Properties of the Star-transform Applied to Sets of Reals*} |
14370 | 47 |
|
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
48 |
lemma STAR_UNIV_set: "*s*(UNIV::'a set) = (UNIV::'a star set)" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
49 |
by (transfer UNIV_def, rule refl) |
14370 | 50 |
|
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
51 |
lemma STAR_empty_set: "*s* {} = {}" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
52 |
by (transfer empty_def, rule refl) |
14370 | 53 |
|
54 |
lemma STAR_Un: "*s* (A Un B) = *s* A Un *s* B" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
55 |
by (transfer Un_def, rule refl) |
14370 | 56 |
|
57 |
lemma STAR_Int: "*s* (A Int B) = *s* A Int *s* B" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
58 |
by (transfer Int_def, rule refl) |
14370 | 59 |
|
60 |
lemma STAR_Compl: "*s* -A = -( *s* A)" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
61 |
by (transfer Compl_def, rule refl) |
14370 | 62 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
63 |
lemma STAR_mem_Compl: "!!x. x \<notin> *s* F ==> x : *s* (- F)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
64 |
by (transfer Compl_def, simp) |
14370 | 65 |
|
66 |
lemma STAR_diff: "*s* (A - B) = *s* A - *s* B" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
67 |
by (transfer set_diff_def, rule refl) |
14370 | 68 |
|
69 |
lemma STAR_subset: "A <= B ==> *s* A <= *s* B" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
70 |
by (transfer subset_def, simp) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
71 |
|
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
72 |
lemma STAR_mem: "a \<in> A ==> star_of a : *s* A" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
73 |
by transfer |
14370 | 74 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
75 |
lemma STAR_mem_iff: "(star_of x \<in> *s* A) = (x \<in> A)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
76 |
by (transfer, rule refl) |
14370 | 77 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
78 |
lemma STAR_star_of_image_subset: "star_of ` A <= *s* A" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
79 |
by (auto simp add: STAR_mem) |
14370 | 80 |
|
81 |
lemma STAR_hypreal_of_real_Int: "*s* X Int Reals = hypreal_of_real ` X" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
82 |
by (auto simp add: SReal_def STAR_mem_iff) |
14370 | 83 |
|
14468 | 84 |
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
|
85 |
by auto |
14370 | 86 |
|
87 |
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
|
88 |
by auto |
14370 | 89 |
|
90 |
lemma STAR_real_seq_to_hypreal: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
91 |
"\<forall>n. (X n) \<notin> M ==> star_n X \<notin> *s* M" |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
92 |
apply (unfold starset_def star_of_def) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
93 |
apply (simp add: Iset_star_n) |
14370 | 94 |
done |
95 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
96 |
lemma STAR_singleton: "*s* {x} = {star_of x}" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
97 |
by simp |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
98 |
|
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
99 |
lemma STAR_not_mem: "x \<notin> F ==> star_of x \<notin> *s* F" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
100 |
by transfer |
14370 | 101 |
|
102 |
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
|
103 |
by (blast dest: STAR_subset) |
14370 | 104 |
|
15169 | 105 |
text{*Nonstandard extension of a set (defined using a constant |
106 |
sequence) as a special case of an internal set*} |
|
14370 | 107 |
|
14468 | 108 |
lemma starset_n_starset: "\<forall>n. (As n = A) ==> *sn* As = *s* A" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
109 |
apply (drule expand_fun_eq [THEN iffD2]) |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
110 |
apply (simp add: starset_n_def starset_def star_of_def) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
111 |
done |
14370 | 112 |
|
113 |
||
114 |
(*----------------------------------------------------------------*) |
|
115 |
(* Theorems about nonstandard extensions of functions *) |
|
116 |
(*----------------------------------------------------------------*) |
|
117 |
||
118 |
(*----------------------------------------------------------------*) |
|
119 |
(* Nonstandard extension of a function (defined using a *) |
|
120 |
(* constant sequence) as a special case of an internal function *) |
|
121 |
(*----------------------------------------------------------------*) |
|
122 |
||
14468 | 123 |
lemma starfun_n_starfun: "\<forall>n. (F n = f) ==> *fn* F = *f* f" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
124 |
apply (drule expand_fun_eq [THEN iffD2]) |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
125 |
apply (simp add: starfun_n_def starfun_def star_of_def) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
126 |
done |
14370 | 127 |
|
128 |
||
129 |
(* |
|
15003 | 130 |
Prove that abs for hypreal is a nonstandard extension of abs for real w/o |
14370 | 131 |
use of congruence property (proved after this for general |
15003 | 132 |
nonstandard extensions of real valued functions). |
14370 | 133 |
|
15003 | 134 |
Proof now Uses the ultrafilter tactic! |
14370 | 135 |
*) |
136 |
||
137 |
lemma hrabs_is_starext_rabs: "is_starext abs abs" |
|
14468 | 138 |
apply (simp add: is_starext_def, safe) |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
139 |
apply (rule_tac x=x in star_cases) |
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
140 |
apply (rule_tac x=y in star_cases) |
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
141 |
apply (unfold star_n_def, auto) |
17298 | 142 |
apply (rule bexI, rule_tac [2] lemma_starrel_refl) |
143 |
apply (rule bexI, rule_tac [2] lemma_starrel_refl) |
|
17302 | 144 |
apply (fold star_n_def) |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
145 |
apply (unfold star_abs_def starfun_def star_of_def) |
17302 | 146 |
apply (simp add: Ifun_star_n star_n_eq_iff) |
14370 | 147 |
done |
148 |
||
17298 | 149 |
lemma Rep_star_FreeUltrafilterNat: |
150 |
"[| X \<in> Rep_star z; Y \<in> Rep_star z |] |
|
14370 | 151 |
==> {n. X n = Y n} : FreeUltrafilterNat" |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
152 |
by (rule FreeUltrafilterNat_Rep_hypreal) |
14370 | 153 |
|
15169 | 154 |
text{*Nonstandard extension of functions*} |
14370 | 155 |
|
156 |
lemma starfun: |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
157 |
"( *f* f) (star_n X) = star_n (%n. f (X n))" |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
158 |
by (simp add: starfun_def star_of_def Ifun_star_n) |
14370 | 159 |
|
14477 | 160 |
lemma starfun_if_eq: |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
161 |
"!!w. w \<noteq> star_of x |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
162 |
==> ( *f* (\<lambda>z. if z = x then a else g z)) w = ( *f* g) w" |
17429
e8d6ed3aacfe
merged Transfer.thy and StarType.thy into StarDef.thy; renamed Ifun2_of to starfun2; cleaned up
huffman
parents:
17318
diff
changeset
|
163 |
by (transfer, simp) |
14477 | 164 |
|
14370 | 165 |
(*------------------------------------------- |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
166 |
multiplication: ( *f) x ( *g) = *(f x g) |
14370 | 167 |
------------------------------------------*) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
168 |
lemma starfun_mult: "!!x. ( *f* f) x * ( *f* g) x = ( *f* (%x. f x * g x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
169 |
by (transfer, rule refl) |
14370 | 170 |
declare starfun_mult [symmetric, simp] |
171 |
||
172 |
(*--------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
173 |
addition: ( *f) + ( *g) = *(f + g) |
14370 | 174 |
---------------------------------------*) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
175 |
lemma starfun_add: "!!x. ( *f* f) x + ( *f* g) x = ( *f* (%x. f x + g x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
176 |
by (transfer, rule refl) |
14370 | 177 |
declare starfun_add [symmetric, simp] |
178 |
||
179 |
(*-------------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
180 |
subtraction: ( *f) + -( *g) = *(f + -g) |
14370 | 181 |
-------------------------------------------*) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
182 |
lemma starfun_minus: "!!x. - ( *f* f) x = ( *f* (%x. - f x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
183 |
by (transfer, rule refl) |
14370 | 184 |
declare starfun_minus [symmetric, simp] |
185 |
||
186 |
(*FIXME: delete*) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
187 |
lemma starfun_add_minus: "!!x. ( *f* f) x + -( *f* g) x = ( *f* (%x. f x + -g x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
188 |
by (transfer, rule refl) |
14370 | 189 |
declare starfun_add_minus [symmetric, simp] |
190 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
191 |
lemma starfun_diff: "!!x. ( *f* f) x - ( *f* g) x = ( *f* (%x. f x - g x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
192 |
by (transfer, rule refl) |
14370 | 193 |
declare starfun_diff [symmetric, simp] |
194 |
||
195 |
(*-------------------------------------- |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
196 |
composition: ( *f) o ( *g) = *(f o g) |
14370 | 197 |
---------------------------------------*) |
198 |
||
199 |
lemma starfun_o2: "(%x. ( *f* f) (( *f* g) x)) = *f* (%x. f (g x))" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
200 |
by (transfer, rule refl) |
14370 | 201 |
|
202 |
lemma starfun_o: "( *f* f) o ( *f* g) = ( *f* (f o g))" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
203 |
by (transfer o_def, rule refl) |
14370 | 204 |
|
15169 | 205 |
text{*NS extension of constant function*} |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
206 |
lemma starfun_const_fun [simp]: "!!x. ( *f* (%x. k)) x = star_of k" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
207 |
by (transfer, rule refl) |
14370 | 208 |
|
15169 | 209 |
text{*the NS extension of the identity function*} |
14370 | 210 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
211 |
lemma starfun_Id [simp]: "!!x. ( *f* (%x. x)) x = x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
212 |
by (transfer, rule refl) |
14370 | 213 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
214 |
(* this is trivial, given starfun_Id *) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
215 |
lemma starfun_Idfun_approx: |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
216 |
"x @= hypreal_of_real a ==> ( *f* (%x. x)) x @= hypreal_of_real a" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
217 |
by (simp only: starfun_Id) |
14370 | 218 |
|
15169 | 219 |
text{*The Star-function is a (nonstandard) extension of the function*} |
14370 | 220 |
|
221 |
lemma is_starext_starfun: "is_starext ( *f* f) f" |
|
14468 | 222 |
apply (simp add: is_starext_def, auto) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
223 |
apply (rule_tac x = x in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
224 |
apply (rule_tac x = y in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
225 |
apply (auto intro!: bexI [OF _ Rep_star_star_n] |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
226 |
simp add: starfun star_n_eq_iff) |
14370 | 227 |
done |
228 |
||
15169 | 229 |
text{*Any nonstandard extension is in fact the Star-function*} |
14370 | 230 |
|
231 |
lemma is_starfun_starext: "is_starext F f ==> F = *f* f" |
|
14468 | 232 |
apply (simp add: is_starext_def) |
14370 | 233 |
apply (rule ext) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
234 |
apply (rule_tac x = x in star_cases) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
235 |
apply (drule_tac x = x in spec) |
14370 | 236 |
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
|
237 |
apply (auto dest!: FreeUltrafilterNat_Compl_mem simp add: starfun, ultra) |
14370 | 238 |
done |
239 |
||
240 |
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
|
241 |
by (blast intro: is_starfun_starext is_starext_starfun) |
14370 | 242 |
|
15169 | 243 |
text{*extented function has same solution as its standard |
14370 | 244 |
version for real arguments. i.e they are the same |
15169 | 245 |
for all real arguments*} |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
246 |
lemma starfun_eq [simp]: "( *f* f) (star_of a) = star_of (f a)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
247 |
by (transfer, rule refl) |
14370 | 248 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
249 |
lemma starfun_approx: "( *f* f) (star_of a) @= hypreal_of_real (f a)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
250 |
by simp |
14370 | 251 |
|
252 |
(* useful for NS definition of derivatives *) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
253 |
lemma starfun_lambda_cancel: |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
254 |
"!!x'. ( *f* (%h. f (x + h))) x' = ( *f* f) (star_of x + x')" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
255 |
by (transfer, rule refl) |
14370 | 256 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
257 |
lemma starfun_lambda_cancel2: |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
258 |
"( *f* (%h. f(g(x + h)))) x' = ( *f* (f o g)) (star_of x + x')" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
259 |
by (unfold o_def, rule starfun_lambda_cancel) |
14370 | 260 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
261 |
lemma starfun_mult_HFinite_approx: "[| ( *f* f) x @= l; ( *f* g) x @= m; |
14370 | 262 |
l: HFinite; m: HFinite |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
263 |
|] ==> ( *f* (%x. f x * g x)) x @= l * m" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
264 |
apply (drule (3) approx_mult_HFinite) |
14370 | 265 |
apply (auto intro: approx_HFinite [OF _ approx_sym]) |
266 |
done |
|
267 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
268 |
lemma starfun_add_approx: "[| ( *f* f) x @= l; ( *f* g) x @= m |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
269 |
|] ==> ( *f* (%x. f x + g x)) x @= l + m" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
270 |
by (auto intro: approx_add) |
14370 | 271 |
|
15169 | 272 |
text{*Examples: hrabs is nonstandard extension of rabs |
273 |
inverse is nonstandard extension of inverse*} |
|
14370 | 274 |
|
275 |
(* can be proved easily using theorem "starfun" and *) |
|
276 |
(* properties of ultrafilter as for inverse below we *) |
|
277 |
(* use the theorem we proved above instead *) |
|
278 |
||
279 |
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
|
280 |
by (rule hrabs_is_starext_rabs [THEN is_starext_starfun_iff [THEN iffD1], symmetric]) |
14370 | 281 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
282 |
lemma starfun_inverse_inverse [simp]: "( *f* inverse) x = inverse(x)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
283 |
by (unfold star_inverse_def, rule refl) |
14370 | 284 |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
285 |
lemma starfun_inverse: "!!x. inverse (( *f* f) x) = ( *f* (%x. inverse (f x))) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
286 |
by (transfer, rule refl) |
14370 | 287 |
declare starfun_inverse [symmetric, simp] |
288 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
289 |
lemma starfun_divide: "!!x. ( *f* f) x / ( *f* g) x = ( *f* (%x. f x / g x)) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
290 |
by (transfer, rule refl) |
14370 | 291 |
declare starfun_divide [symmetric, simp] |
292 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
293 |
lemma starfun_inverse2: "!!x. inverse (( *f* f) x) = ( *f* (%x. inverse (f x))) x" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
294 |
by (transfer, rule refl) |
14370 | 295 |
|
15169 | 296 |
text{*General lemma/theorem needed for proofs in elementary |
297 |
topology of the reals*} |
|
14370 | 298 |
lemma starfun_mem_starset: |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
299 |
"!!x. ( *f* f) x : *s* A ==> x : *s* {x. f x \<in> A}" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
300 |
by (transfer, simp) |
14370 | 301 |
|
15169 | 302 |
text{*Alternative definition for hrabs with rabs function |
14370 | 303 |
applied entrywise to equivalence class representative. |
15169 | 304 |
This is easily proved using starfun and ns extension thm*} |
15170 | 305 |
lemma hypreal_hrabs: |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
306 |
"abs (star_n X) = star_n (%n. abs (X n))" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
307 |
by (simp only: starfun_rabs_hrabs [symmetric] starfun) |
14370 | 308 |
|
15169 | 309 |
text{*nonstandard extension of set through nonstandard extension |
14370 | 310 |
of rabs function i.e hrabs. A more general result should be |
311 |
where we replace rabs by some arbitrary function f and hrabs |
|
15169 | 312 |
by its NS extenson. See second NS set extension below.*} |
14370 | 313 |
lemma STAR_rabs_add_minus: |
314 |
"*s* {x. abs (x + - y) < r} = |
|
315 |
{x. abs(x + -hypreal_of_real y) < hypreal_of_real r}" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
316 |
by (transfer, rule refl) |
14370 | 317 |
|
318 |
lemma STAR_starfun_rabs_add_minus: |
|
319 |
"*s* {x. abs (f x + - y) < r} = |
|
320 |
{x. abs(( *f* f) x + -hypreal_of_real y) < hypreal_of_real r}" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
321 |
by (transfer, rule refl) |
14370 | 322 |
|
15169 | 323 |
text{*Another characterization of Infinitesimal and one of @= relation. |
15170 | 324 |
In this theory since @{text hypreal_hrabs} proved here. Maybe |
325 |
move both theorems??*} |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
326 |
lemma Infinitesimal_FreeUltrafilterNat_iff2: |
14468 | 327 |
"(x \<in> Infinitesimal) = |
17298 | 328 |
(\<exists>X \<in> Rep_star(x). |
14468 | 329 |
\<forall>m. {n. abs(X n) < inverse(real(Suc m))} |
330 |
\<in> FreeUltrafilterNat)" |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
331 |
apply (cases x) |
17298 | 332 |
apply (auto intro!: bexI lemma_starrel_refl |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
333 |
simp add: Infinitesimal_hypreal_of_nat_iff star_of_def |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
334 |
star_n_inverse star_n_abs star_n_less hypreal_of_nat_eq) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
335 |
apply (drule_tac x = n in spec, ultra) |
14370 | 336 |
done |
337 |
||
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
338 |
lemma approx_FreeUltrafilterNat_iff: "star_n X @= star_n Y = |
14468 | 339 |
(\<forall>m. {n. abs (X n + - Y n) < |
14370 | 340 |
inverse(real(Suc m))} : FreeUltrafilterNat)" |
341 |
apply (subst approx_minus_iff) |
|
342 |
apply (rule mem_infmal_iff [THEN subst]) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
343 |
apply (auto simp add: star_n_minus star_n_add Infinitesimal_FreeUltrafilterNat_iff2) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
344 |
apply (drule_tac x = m in spec, ultra) |
14370 | 345 |
done |
346 |
||
347 |
lemma inj_starfun: "inj starfun" |
|
348 |
apply (rule inj_onI) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
349 |
apply (rule ext, rule ccontr) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
350 |
apply (drule_tac x = "star_n (%n. xa)" in fun_cong) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17303
diff
changeset
|
351 |
apply (auto simp add: starfun star_n_eq_iff) |
14370 | 352 |
done |
353 |
||
354 |
end |