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