author | paulson |
Tue, 10 Feb 2004 12:02:11 +0100 | |
changeset 14378 | 69c4d5997669 |
parent 14371 | c78c7da09519 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : NatStar.ML |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : *-transforms in NSA which extends |
|
5 |
sets of reals, and nat=>real, |
|
6 |
nat=>nat functions |
|
7 |
*) |
|
8 |
||
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
9 |
val hypnat_of_nat_eq = thm"hypnat_of_nat_eq"; |
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
10 |
val SHNat_eq = thm"SHNat_eq"; |
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
11 |
|
10751 | 12 |
Goalw [starsetNat_def] |
13 |
"*sNat*(UNIV::nat set) = (UNIV::hypnat set)"; |
|
14 |
by (auto_tac (claset(), simpset() addsimps [FreeUltrafilterNat_Nat_set])); |
|
15 |
qed "NatStar_real_set"; |
|
16 |
||
17 |
Goalw [starsetNat_def] "*sNat* {} = {}"; |
|
18 |
by (Step_tac 1); |
|
19 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
20 |
by (dres_inst_tac [("x","%n. xa n")] bspec 1); |
|
21 |
by (auto_tac (claset(), simpset() addsimps [FreeUltrafilterNat_empty])); |
|
22 |
qed "NatStar_empty_set"; |
|
23 |
||
24 |
Addsimps [NatStar_empty_set]; |
|
25 |
||
26 |
Goalw [starsetNat_def] |
|
27 |
"*sNat* (A Un B) = *sNat* A Un *sNat* B"; |
|
28 |
by (Auto_tac); |
|
29 |
by (REPEAT(blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 2)); |
|
30 |
by (dtac FreeUltrafilterNat_Compl_mem 1); |
|
31 |
by (dtac bspec 1 THEN assume_tac 1); |
|
32 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
33 |
by (Auto_tac); |
|
34 |
by (Fuf_tac 1); |
|
35 |
qed "NatStar_Un"; |
|
36 |
||
37 |
Goalw [starsetNat_n_def] |
|
38 |
"*sNatn* (%n. (A n) Un (B n)) = *sNatn* A Un *sNatn* B"; |
|
39 |
by Auto_tac; |
|
40 |
by (dres_inst_tac [("x","Xa")] bspec 1); |
|
41 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 2); |
|
42 |
by (auto_tac (claset() addSDs [bspec], simpset())); |
|
43 |
by (TRYALL(Ultra_tac)); |
|
44 |
qed "starsetNat_n_Un"; |
|
45 |
||
46 |
Goalw [InternalNatSets_def] |
|
47 |
"[| X : InternalNatSets; Y : InternalNatSets |] \ |
|
48 |
\ ==> (X Un Y) : InternalNatSets"; |
|
49 |
by (auto_tac (claset(), |
|
50 |
simpset() addsimps [starsetNat_n_Un RS sym])); |
|
51 |
qed "InternalNatSets_Un"; |
|
52 |
||
53 |
Goalw [starsetNat_def] "*sNat* (A Int B) = *sNat* A Int *sNat* B"; |
|
54 |
by (Auto_tac); |
|
55 |
by (blast_tac (claset() addIs [FreeUltrafilterNat_Int, |
|
56 |
FreeUltrafilterNat_subset]) 3); |
|
57 |
by (REPEAT(blast_tac (claset() addIs |
|
58 |
[FreeUltrafilterNat_subset]) 1)); |
|
59 |
qed "NatStar_Int"; |
|
60 |
||
61 |
Goalw [starsetNat_n_def] |
|
62 |
"*sNatn* (%n. (A n) Int (B n)) = *sNatn* A Int *sNatn* B"; |
|
63 |
by (Auto_tac); |
|
64 |
by (auto_tac (claset() addSDs [bspec], |
|
65 |
simpset())); |
|
66 |
by (TRYALL(Ultra_tac)); |
|
67 |
qed "starsetNat_n_Int"; |
|
68 |
||
69 |
Goalw [InternalNatSets_def] |
|
70 |
"[| X : InternalNatSets; Y : InternalNatSets |] \ |
|
71 |
\ ==> (X Int Y) : InternalNatSets"; |
|
72 |
by (auto_tac (claset(), |
|
73 |
simpset() addsimps [starsetNat_n_Int RS sym])); |
|
74 |
qed "InternalNatSets_Int"; |
|
75 |
||
13810 | 76 |
Goalw [starsetNat_def] "*sNat* (-A) = -( *sNat* A)"; |
10751 | 77 |
by (Auto_tac); |
78 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
79 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 2); |
|
80 |
by (REPEAT(Step_tac 1) THEN Auto_tac); |
|
81 |
by (TRYALL(Ultra_tac)); |
|
82 |
qed "NatStar_Compl"; |
|
83 |
||
13810 | 84 |
Goalw [starsetNat_n_def] "*sNatn* ((%n. - A n)) = -( *sNatn* A)"; |
10751 | 85 |
by (Auto_tac); |
86 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
87 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 2); |
|
88 |
by (REPEAT(Step_tac 1) THEN Auto_tac); |
|
89 |
by (TRYALL(Ultra_tac)); |
|
90 |
qed "starsetNat_n_Compl"; |
|
91 |
||
92 |
Goalw [InternalNatSets_def] |
|
93 |
"X :InternalNatSets ==> -X : InternalNatSets"; |
|
94 |
by (auto_tac (claset(), |
|
95 |
simpset() addsimps [starsetNat_n_Compl RS sym])); |
|
96 |
qed "InternalNatSets_Compl"; |
|
97 |
||
98 |
Goalw [starsetNat_n_def] |
|
99 |
"*sNatn* (%n. (A n) - (B n)) = *sNatn* A - *sNatn* B"; |
|
100 |
by (Auto_tac); |
|
101 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 2); |
|
102 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 3); |
|
103 |
by (auto_tac (claset() addSDs [bspec], simpset())); |
|
104 |
by (TRYALL(Ultra_tac)); |
|
105 |
qed "starsetNat_n_diff"; |
|
106 |
||
107 |
Goalw [InternalNatSets_def] |
|
108 |
"[| X : InternalNatSets; Y : InternalNatSets |] \ |
|
109 |
\ ==> (X - Y) : InternalNatSets"; |
|
110 |
by (auto_tac (claset(), simpset() addsimps [starsetNat_n_diff RS sym])); |
|
111 |
qed "InternalNatSets_diff"; |
|
112 |
||
113 |
Goalw [starsetNat_def] "A <= B ==> *sNat* A <= *sNat* B"; |
|
114 |
by (REPEAT(blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1)); |
|
115 |
qed "NatStar_subset"; |
|
116 |
||
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
117 |
Goal "a : A ==> hypnat_of_nat a : *sNat* A"; |
10751 | 118 |
by (auto_tac (claset() addIs [FreeUltrafilterNat_subset], |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
119 |
simpset() addsimps [starsetNat_def,hypnat_of_nat_eq])); |
10751 | 120 |
qed "NatStar_mem"; |
121 |
||
10834 | 122 |
Goalw [starsetNat_def] "hypnat_of_nat ` A <= *sNat* A"; |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
123 |
by (auto_tac (claset(), simpset() addsimps [hypnat_of_nat_eq])); |
10751 | 124 |
by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 1); |
125 |
qed "NatStar_hypreal_of_real_image_subset"; |
|
126 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
127 |
Goal "Nats <= *sNat* (UNIV:: nat set)"; |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
128 |
by (auto_tac (claset(), simpset() addsimps [starsetNat_def,SHNat_eq,hypnat_of_nat_eq])); |
10751 | 129 |
qed "NatStar_SHNat_subset"; |
130 |
||
131 |
Goalw [starsetNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
132 |
"*sNat* X Int Nats = hypnat_of_nat ` X"; |
10751 | 133 |
by (auto_tac (claset(), |
134 |
simpset() addsimps |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
135 |
[hypnat_of_nat_eq,SHNat_eq])); |
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
136 |
by (simp_tac (simpset() addsimps [hypnat_of_nat_eq RS sym]) 1); |
10751 | 137 |
by (rtac imageI 1 THEN rtac ccontr 1); |
138 |
by (dtac bspec 1); |
|
139 |
by (rtac lemma_hypnatrel_refl 1); |
|
140 |
by (blast_tac (claset() addIs [FreeUltrafilterNat_subset]) 2); |
|
141 |
by (Auto_tac); |
|
142 |
qed "NatStar_hypreal_of_real_Int"; |
|
143 |
||
10834 | 144 |
Goal "x ~: hypnat_of_nat ` A ==> ALL y: A. x ~= hypnat_of_nat y"; |
10751 | 145 |
by (Auto_tac); |
146 |
qed "lemma_not_hypnatA"; |
|
147 |
||
148 |
Goalw [starsetNat_n_def,starsetNat_def] "*sNat* X = *sNatn* (%n. X)"; |
|
149 |
by Auto_tac; |
|
150 |
qed "starsetNat_starsetNat_n_eq"; |
|
151 |
||
13810 | 152 |
Goalw [InternalNatSets_def] "( *sNat* X) : InternalNatSets"; |
10751 | 153 |
by (auto_tac (claset(), |
154 |
simpset() addsimps [starsetNat_starsetNat_n_eq])); |
|
155 |
qed "InternalNatSets_starsetNat_n"; |
|
156 |
Addsimps [InternalNatSets_starsetNat_n]; |
|
157 |
||
158 |
Goal "X : InternalNatSets ==> UNIV - X : InternalNatSets"; |
|
159 |
by (auto_tac (claset() addIs [InternalNatSets_Compl], simpset())); |
|
160 |
qed "InternalNatSets_UNIV_diff"; |
|
161 |
||
162 |
(*------------------------------------------------------------------ |
|
163 |
Nonstandard extension of a set (defined using a constant |
|
164 |
sequence) as a special case of an internal set |
|
165 |
-----------------------------------------------------------------*) |
|
166 |
||
167 |
Goalw [starsetNat_n_def,starsetNat_def] |
|
168 |
"ALL n. (As n = A) ==> *sNatn* As = *sNat* A"; |
|
169 |
by (Auto_tac); |
|
170 |
qed "starsetNat_n_starsetNat"; |
|
171 |
||
172 |
(*------------------------------------------------------ |
|
173 |
Theorems about nonstandard extensions of functions |
|
174 |
------------------------------------------------------*) |
|
175 |
||
176 |
(*------------------------------------------------------------------ |
|
177 |
Nonstandard extension of a function (defined using a constant |
|
178 |
sequence) as a special case of an internal function |
|
179 |
-----------------------------------------------------------------*) |
|
180 |
||
181 |
Goalw [starfunNat_n_def,starfunNat_def] |
|
182 |
"ALL n. (F n = f) ==> *fNatn* F = *fNat* f"; |
|
183 |
by (Auto_tac); |
|
184 |
qed "starfunNat_n_starfunNat"; |
|
185 |
||
186 |
Goalw [starfunNat2_n_def,starfunNat2_def] |
|
187 |
"ALL n. (F n = f) ==> *fNat2n* F = *fNat2* f"; |
|
188 |
by (Auto_tac); |
|
189 |
qed "starfunNat2_n_starfunNat2"; |
|
190 |
||
191 |
Goalw [congruent_def] |
|
10834 | 192 |
"congruent hypnatrel (%X. hypnatrel``{%n. f (X n)})"; |
12486 | 193 |
by Safe_tac; |
10751 | 194 |
by (ALLGOALS(Fuf_tac)); |
195 |
qed "starfunNat_congruent"; |
|
196 |
||
197 |
(* f::nat=>real *) |
|
198 |
Goalw [starfunNat_def] |
|
13810 | 199 |
"( *fNat* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \ |
10834 | 200 |
\ Abs_hypreal(hyprel `` {%n. f (X n)})"; |
10751 | 201 |
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); |
202 |
by (simp_tac (simpset() addsimps |
|
203 |
[hyprel_in_hypreal RS Abs_hypreal_inverse]) 1); |
|
204 |
by (Auto_tac THEN Fuf_tac 1); |
|
205 |
qed "starfunNat"; |
|
206 |
||
207 |
(* f::nat=>nat *) |
|
208 |
Goalw [starfunNat2_def] |
|
13810 | 209 |
"( *fNat2* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \ |
10834 | 210 |
\ Abs_hypnat(hypnatrel `` {%n. f (X n)})"; |
10751 | 211 |
by (res_inst_tac [("f","Abs_hypnat")] arg_cong 1); |
212 |
by (simp_tac (simpset() addsimps |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14268
diff
changeset
|
213 |
[hypnatrel_in_hypnat RS thm"Abs_hypnat_inverse", |
10751 | 214 |
[equiv_hypnatrel, starfunNat_congruent] MRS UN_equiv_class]) 1); |
215 |
qed "starfunNat2"; |
|
216 |
||
217 |
(*--------------------------------------------- |
|
218 |
multiplication: ( *f ) x ( *g ) = *(f x g) |
|
219 |
---------------------------------------------*) |
|
13810 | 220 |
Goal "( *fNat* f) z * ( *fNat* g) z = ( *fNat* (%x. f x * g x)) z"; |
10751 | 221 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
222 |
by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_mult])); |
|
223 |
qed "starfunNat_mult"; |
|
224 |
||
13810 | 225 |
Goal "( *fNat2* f) z * ( *fNat2* g) z = ( *fNat2* (%x. f x * g x)) z"; |
10751 | 226 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
227 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_mult])); |
|
228 |
qed "starfunNat2_mult"; |
|
229 |
||
230 |
(*--------------------------------------- |
|
231 |
addition: ( *f ) + ( *g ) = *(f + g) |
|
232 |
---------------------------------------*) |
|
13810 | 233 |
Goal "( *fNat* f) z + ( *fNat* g) z = ( *fNat* (%x. f x + g x)) z"; |
10751 | 234 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
235 |
by (auto_tac (claset(), simpset() addsimps [starfunNat,hypreal_add])); |
|
236 |
qed "starfunNat_add"; |
|
237 |
||
13810 | 238 |
Goal "( *fNat2* f) z + ( *fNat2* g) z = ( *fNat2* (%x. f x + g x)) z"; |
10751 | 239 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
240 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_add])); |
|
241 |
qed "starfunNat2_add"; |
|
242 |
||
13810 | 243 |
Goal "( *fNat2* f) z - ( *fNat2* g) z = ( *fNat2* (%x. f x - g x)) z"; |
10751 | 244 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
245 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_minus])); |
|
246 |
qed "starfunNat2_minus"; |
|
247 |
||
248 |
(*-------------------------------------- |
|
249 |
composition: ( *f ) o ( *g ) = *(f o g) |
|
250 |
---------------------------------------*) |
|
251 |
(***** ( *f::nat=>real ) o ( *g::nat=>nat ) = *(f o g) *****) |
|
252 |
||
13810 | 253 |
Goal "( *fNat* f) o ( *fNat2* g) = ( *fNat* (f o g))"; |
10751 | 254 |
by (rtac ext 1); |
255 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
256 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2, starfunNat])); |
|
257 |
qed "starfunNatNat2_o"; |
|
258 |
||
13810 | 259 |
Goal "(%x. ( *fNat* f) (( *fNat2* g) x)) = ( *fNat* (%x. f(g x)))"; |
10751 | 260 |
by (rtac ( simplify (simpset() addsimps [o_def]) starfunNatNat2_o) 1); |
261 |
qed "starfunNatNat2_o2"; |
|
262 |
||
263 |
(***** ( *f::nat=>nat ) o ( *g::nat=>nat ) = *(f o g) *****) |
|
13810 | 264 |
Goal "( *fNat2* f) o ( *fNat2* g) = ( *fNat2* (f o g))"; |
10751 | 265 |
by (rtac ext 1); |
266 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
267 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2])); |
|
268 |
qed "starfunNat2_o"; |
|
269 |
||
270 |
(***** ( *f::real=>real ) o ( *g::nat=>real ) = *(f o g) *****) |
|
271 |
||
13810 | 272 |
Goal "( *f* f) o ( *fNat* g) = ( *fNat* (f o g))"; |
10751 | 273 |
by (rtac ext 1); |
274 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
275 |
by (auto_tac (claset(), simpset() addsimps [starfunNat,starfun])); |
|
276 |
qed "starfun_stafunNat_o"; |
|
277 |
||
13810 | 278 |
Goal "(%x. ( *f* f) (( *fNat* g) x)) = ( *fNat* (%x. f (g x)))"; |
10751 | 279 |
by (rtac ( simplify (simpset() addsimps [o_def]) starfun_stafunNat_o) 1); |
280 |
qed "starfun_stafunNat_o2"; |
|
281 |
||
282 |
(*-------------------------------------- |
|
283 |
NS extension of constant function |
|
284 |
--------------------------------------*) |
|
13810 | 285 |
Goal "( *fNat* (%x. k)) z = hypreal_of_real k"; |
10751 | 286 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
287 |
by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_of_real_def])); |
|
288 |
qed "starfunNat_const_fun"; |
|
289 |
Addsimps [starfunNat_const_fun]; |
|
290 |
||
13810 | 291 |
Goal "( *fNat2* (%x. k)) z = hypnat_of_nat k"; |
10751 | 292 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
293 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2, hypnat_of_nat_eq])); |
10751 | 294 |
qed "starfunNat2_const_fun"; |
295 |
||
296 |
Addsimps [starfunNat2_const_fun]; |
|
297 |
||
13810 | 298 |
Goal "- ( *fNat* f) x = ( *fNat* (%x. - f x)) x"; |
10751 | 299 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
300 |
by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_minus])); |
|
301 |
qed "starfunNat_minus"; |
|
302 |
||
13810 | 303 |
Goal "inverse (( *fNat* f) x) = ( *fNat* (%x. inverse (f x))) x"; |
10751 | 304 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
305 |
by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_inverse])); |
|
306 |
qed "starfunNat_inverse"; |
|
307 |
||
308 |
(*-------------------------------------------------------- |
|
309 |
extented function has same solution as its standard |
|
310 |
version for natural arguments. i.e they are the same |
|
311 |
for all natural arguments (c.f. Hoskins pg. 107- SEQ) |
|
312 |
-------------------------------------------------------*) |
|
313 |
||
13810 | 314 |
Goal "( *fNat* f) (hypnat_of_nat a) = hypreal_of_real (f a)"; |
10751 | 315 |
by (auto_tac (claset(), |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
316 |
simpset() addsimps [starfunNat,hypnat_of_nat_eq,hypreal_of_real_def])); |
10751 | 317 |
qed "starfunNat_eq"; |
318 |
||
319 |
Addsimps [starfunNat_eq]; |
|
320 |
||
13810 | 321 |
Goal "( *fNat2* f) (hypnat_of_nat a) = hypnat_of_nat (f a)"; |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
322 |
by (auto_tac (claset(), simpset() addsimps [starfunNat2,hypnat_of_nat_eq])); |
10751 | 323 |
qed "starfunNat2_eq"; |
324 |
||
325 |
Addsimps [starfunNat2_eq]; |
|
326 |
||
13810 | 327 |
Goal "( *fNat* f) (hypnat_of_nat a) @= hypreal_of_real (f a)"; |
10751 | 328 |
by (Auto_tac); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
329 |
qed "starfunNat_approx"; |
10751 | 330 |
|
331 |
||
332 |
(*----------------------------------------------------------------- |
|
333 |
Example of transfer of a property from reals to hyperreals |
|
334 |
--- used for limit comparison of sequences |
|
335 |
----------------------------------------------------------------*) |
|
336 |
Goal "ALL n. N <= n --> f n <= g n \ |
|
13810 | 337 |
\ ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n <= ( *fNat* g) n"; |
10751 | 338 |
by (Step_tac 1); |
339 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
340 |
by (auto_tac (claset(), |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
341 |
simpset() addsimps [starfunNat, hypnat_of_nat_eq,hypreal_le, |
10751 | 342 |
hypreal_less, hypnat_le,hypnat_less])); |
343 |
by (Ultra_tac 1); |
|
344 |
by Auto_tac; |
|
345 |
qed "starfun_le_mono"; |
|
346 |
||
347 |
(*****----- and another -----*****) |
|
348 |
Goal "ALL n. N <= n --> f n < g n \ |
|
13810 | 349 |
\ ==> ALL n. hypnat_of_nat N <= n --> ( *fNat* f) n < ( *fNat* g) n"; |
10751 | 350 |
by (Step_tac 1); |
351 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
352 |
by (auto_tac (claset(), |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
353 |
simpset() addsimps [starfunNat, hypnat_of_nat_eq,hypreal_le, |
10751 | 354 |
hypreal_less, hypnat_le,hypnat_less])); |
355 |
by (Ultra_tac 1); |
|
356 |
by Auto_tac; |
|
357 |
qed "starfun_less_mono"; |
|
358 |
||
359 |
(*---------------------------------------------------------------- |
|
360 |
NS extension when we displace argument by one |
|
361 |
---------------------------------------------------------------*) |
|
13810 | 362 |
Goal "( *fNat* (%n. f (Suc n))) N = ( *fNat* f) (N + (1::hypnat))"; |
10751 | 363 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
364 |
by (auto_tac (claset(), |
|
365 |
simpset() addsimps [starfunNat, hypnat_one_def,hypnat_add])); |
|
366 |
qed "starfunNat_shift_one"; |
|
367 |
||
368 |
(*---------------------------------------------------------------- |
|
369 |
NS extension with rabs |
|
370 |
---------------------------------------------------------------*) |
|
13810 | 371 |
Goal "( *fNat* (%n. abs (f n))) N = abs(( *fNat* f) N)"; |
10751 | 372 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
373 |
by (auto_tac (claset(), simpset() addsimps [starfunNat, hypreal_hrabs])); |
|
374 |
qed "starfunNat_rabs"; |
|
375 |
||
376 |
(*---------------------------------------------------------------- |
|
377 |
The hyperpow function as a NS extension of realpow |
|
378 |
----------------------------------------------------------------*) |
|
13810 | 379 |
Goal "( *fNat* (%n. r ^ n)) N = (hypreal_of_real r) pow N"; |
10751 | 380 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
381 |
by (auto_tac (claset(), |
|
382 |
simpset() addsimps [hyperpow, hypreal_of_real_def,starfunNat])); |
|
383 |
qed "starfunNat_pow"; |
|
384 |
||
13810 | 385 |
Goal "( *fNat* (%n. (X n) ^ m)) N = ( *fNat* X) N pow hypnat_of_nat m"; |
10751 | 386 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
387 |
by (auto_tac (claset(), |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
388 |
simpset() addsimps [hyperpow, hypnat_of_nat_eq,starfunNat])); |
10751 | 389 |
qed "starfunNat_pow2"; |
390 |
||
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
391 |
Goal "( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n"; |
10751 | 392 |
by (res_inst_tac [("z","R")] eq_Abs_hypreal 1); |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
393 |
by (auto_tac (claset(), simpset() addsimps [hyperpow,starfun,hypnat_of_nat_eq])); |
10751 | 394 |
qed "starfun_pow"; |
395 |
||
396 |
(*----------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
397 |
hypreal_of_hypnat as NS extension of real (from "nat")! |
10751 | 398 |
-------------------------------------------------------*) |
13810 | 399 |
Goal "( *fNat* real) = hypreal_of_hypnat"; |
10751 | 400 |
by (rtac ext 1); |
401 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
402 |
by (auto_tac (claset(), simpset() addsimps [hypreal_of_hypnat,starfunNat])); |
|
403 |
qed "starfunNat_real_of_nat"; |
|
404 |
||
405 |
Goal "N : HNatInfinite \ |
|
13810 | 406 |
\ ==> ( *fNat* (%x::nat. inverse(real x))) N = inverse(hypreal_of_hypnat N)"; |
10751 | 407 |
by (res_inst_tac [("f1","inverse")] (starfun_stafunNat_o2 RS subst) 1); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
408 |
by (subgoal_tac "hypreal_of_hypnat N ~= 0" 1); |
10751 | 409 |
by (auto_tac (claset(), |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14268
diff
changeset
|
410 |
simpset() addsimps [HNatInfinite_not_eq_zero, starfunNat_real_of_nat, starfun_inverse_inverse])); |
10751 | 411 |
qed "starfunNat_inverse_real_of_nat_eq"; |
412 |
||
413 |
(*---------------------------------------------------------- |
|
414 |
Internal functions - some redundancy with *fNat* now |
|
415 |
---------------------------------------------------------*) |
|
416 |
Goalw [congruent_def] |
|
10834 | 417 |
"congruent hypnatrel (%X. hypnatrel``{%n. f n (X n)})"; |
12486 | 418 |
by Safe_tac; |
10751 | 419 |
by (ALLGOALS(Fuf_tac)); |
420 |
qed "starfunNat_n_congruent"; |
|
421 |
||
422 |
Goalw [starfunNat_n_def] |
|
13810 | 423 |
"( *fNatn* f) (Abs_hypnat(hypnatrel``{%n. X n})) = \ |
10834 | 424 |
\ Abs_hypreal(hyprel `` {%n. f n (X n)})"; |
10751 | 425 |
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); |
426 |
by Auto_tac; |
|
427 |
by (Ultra_tac 1); |
|
428 |
qed "starfunNat_n"; |
|
429 |
||
430 |
(*------------------------------------------------- |
|
431 |
multiplication: ( *fn ) x ( *gn ) = *(fn x gn) |
|
432 |
-------------------------------------------------*) |
|
13810 | 433 |
Goal "( *fNatn* f) z * ( *fNatn* g) z = ( *fNatn* (% i x. f i x * g i x)) z"; |
10751 | 434 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
435 |
by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_mult])); |
|
436 |
qed "starfunNat_n_mult"; |
|
437 |
||
438 |
(*----------------------------------------------- |
|
439 |
addition: ( *fn ) + ( *gn ) = *(fn + gn) |
|
440 |
-----------------------------------------------*) |
|
13810 | 441 |
Goal "( *fNatn* f) z + ( *fNatn* g) z = ( *fNatn* (%i x. f i x + g i x)) z"; |
10751 | 442 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
443 |
by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypreal_add])); |
|
444 |
qed "starfunNat_n_add"; |
|
445 |
||
446 |
(*------------------------------------------------- |
|
447 |
subtraction: ( *fn ) + -( *gn ) = *(fn + -gn) |
|
448 |
-------------------------------------------------*) |
|
13810 | 449 |
Goal "( *fNatn* f) z + -( *fNatn* g) z = ( *fNatn* (%i x. f i x + -g i x)) z"; |
10751 | 450 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
451 |
by (auto_tac (claset(), |
|
452 |
simpset() addsimps [starfunNat_n, hypreal_minus,hypreal_add])); |
|
453 |
qed "starfunNat_n_add_minus"; |
|
454 |
||
455 |
(*-------------------------------------------------- |
|
456 |
composition: ( *fn ) o ( *gn ) = *(fn o gn) |
|
457 |
-------------------------------------------------*) |
|
458 |
||
13810 | 459 |
Goal "( *fNatn* (%i x. k)) z = hypreal_of_real k"; |
10751 | 460 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
461 |
by (auto_tac (claset(), |
|
462 |
simpset() addsimps [starfunNat_n, hypreal_of_real_def])); |
|
463 |
qed "starfunNat_n_const_fun"; |
|
464 |
||
465 |
Addsimps [starfunNat_n_const_fun]; |
|
466 |
||
13810 | 467 |
Goal "- ( *fNatn* f) x = ( *fNatn* (%i x. - (f i) x)) x"; |
10751 | 468 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
469 |
by (auto_tac (claset(), simpset() addsimps [starfunNat_n, hypreal_minus])); |
|
470 |
qed "starfunNat_n_minus"; |
|
471 |
||
13810 | 472 |
Goal "( *fNatn* f) (hypnat_of_nat n) = Abs_hypreal(hyprel `` {%i. f i n})"; |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
473 |
by (auto_tac (claset(), simpset() addsimps [starfunNat_n,hypnat_of_nat_eq])); |
10751 | 474 |
qed "starfunNat_n_eq"; |
475 |
Addsimps [starfunNat_n_eq]; |
|
476 |
||
13810 | 477 |
Goal "(( *fNat* f) = ( *fNat* g)) = (f = g)"; |
10751 | 478 |
by Auto_tac; |
479 |
by (rtac ext 1 THEN rtac ccontr 1); |
|
480 |
by (dres_inst_tac [("x","hypnat_of_nat(x)")] fun_cong 1); |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
481 |
by (auto_tac (claset(), simpset() addsimps [starfunNat,hypnat_of_nat_eq])); |
10751 | 482 |
qed "starfun_eq_iff"; |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
483 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
484 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
485 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
486 |
(*MOVE UP*) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
487 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
488 |
Goal "N : HNatInfinite \ |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
489 |
\ ==> ( *fNat* (%x. inverse (real x))) N : Infinitesimal"; |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
490 |
by (res_inst_tac [("f1","inverse")] (starfun_stafunNat_o2 RS subst) 1); |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
491 |
by (subgoal_tac "hypreal_of_hypnat N ~= 0" 1); |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14268
diff
changeset
|
492 |
by (auto_tac (claset(), simpset() addsimps [HNatInfinite_not_eq_zero, starfunNat_real_of_nat])); |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
493 |
qed "starfunNat_inverse_real_of_nat_Infinitesimal"; |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
13810
diff
changeset
|
494 |
Addsimps [starfunNat_inverse_real_of_nat_Infinitesimal]; |