author | wenzelm |
Wed, 03 Oct 2001 20:54:16 +0200 | |
changeset 11655 | 923e4d0d36d5 |
parent 11468 | 02cd5d5bc497 |
child 11701 | 3d51fbf81c17 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : HyperNat.ML |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : Explicit construction of hypernaturals using |
|
5 |
ultrafilters |
|
6 |
*) |
|
7 |
||
8 |
(*------------------------------------------------------------------------ |
|
9 |
Properties of hypnatrel |
|
10 |
------------------------------------------------------------------------*) |
|
11 |
||
12 |
(** Proving that hyprel is an equivalence relation **) |
|
13 |
(** Natural deduction for hypnatrel - similar to hyprel! **) |
|
14 |
||
15 |
Goalw [hypnatrel_def] |
|
16 |
"((X,Y): hypnatrel) = ({n. X n = Y n}: FreeUltrafilterNat)"; |
|
17 |
by (Fast_tac 1); |
|
18 |
qed "hypnatrel_iff"; |
|
19 |
||
20 |
Goalw [hypnatrel_def] |
|
21 |
"{n. X n = Y n}: FreeUltrafilterNat ==> (X,Y): hypnatrel"; |
|
22 |
by (Fast_tac 1); |
|
23 |
qed "hypnatrelI"; |
|
24 |
||
25 |
Goalw [hypnatrel_def] |
|
26 |
"p: hypnatrel --> (EX X Y. \ |
|
27 |
\ p = (X,Y) & {n. X n = Y n} : FreeUltrafilterNat)"; |
|
28 |
by (Fast_tac 1); |
|
29 |
qed "hypnatrelE_lemma"; |
|
30 |
||
31 |
val [major,minor] = Goal |
|
32 |
"[| p: hypnatrel; \ |
|
33 |
\ !!X Y. [| p = (X,Y); {n. X n = Y n}: FreeUltrafilterNat |] \ |
|
34 |
\ ==> Q |] \ |
|
35 |
\ ==> Q"; |
|
36 |
by (cut_facts_tac [major RS (hypnatrelE_lemma RS mp)] 1); |
|
37 |
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); |
|
38 |
qed "hypnatrelE"; |
|
39 |
||
40 |
AddSIs [hypnatrelI]; |
|
41 |
AddSEs [hypnatrelE]; |
|
42 |
||
43 |
Goalw [hypnatrel_def] "(x,x): hypnatrel"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
44 |
by Auto_tac; |
10751 | 45 |
qed "hypnatrel_refl"; |
46 |
||
47 |
Goalw [hypnatrel_def] "(x,y): hypnatrel --> (y,x):hypnatrel"; |
|
48 |
by (auto_tac (claset() addIs [lemma_perm RS subst], simpset())); |
|
49 |
qed_spec_mp "hypnatrel_sym"; |
|
50 |
||
51 |
Goalw [hypnatrel_def] |
|
52 |
"(x,y): hypnatrel --> (y,z):hypnatrel --> (x,z):hypnatrel"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
53 |
by Auto_tac; |
10751 | 54 |
by (Fuf_tac 1); |
55 |
qed_spec_mp "hypnatrel_trans"; |
|
56 |
||
57 |
Goalw [equiv_def, refl_def, sym_def, trans_def] |
|
58 |
"equiv UNIV hypnatrel"; |
|
59 |
by (auto_tac (claset() addSIs [hypnatrel_refl] |
|
60 |
addSEs [hypnatrel_sym,hypnatrel_trans] |
|
61 |
delrules [hypnatrelI,hypnatrelE], |
|
62 |
simpset())); |
|
63 |
qed "equiv_hypnatrel"; |
|
64 |
||
65 |
val equiv_hypnatrel_iff = |
|
66 |
[UNIV_I, UNIV_I] MRS (equiv_hypnatrel RS eq_equiv_class_iff); |
|
67 |
||
10834 | 68 |
Goalw [hypnat_def,hypnatrel_def,quotient_def] "hypnatrel``{x}:hypnat"; |
10751 | 69 |
by (Blast_tac 1); |
70 |
qed "hypnatrel_in_hypnat"; |
|
71 |
||
72 |
Goal "inj_on Abs_hypnat hypnat"; |
|
73 |
by (rtac inj_on_inverseI 1); |
|
74 |
by (etac Abs_hypnat_inverse 1); |
|
75 |
qed "inj_on_Abs_hypnat"; |
|
76 |
||
77 |
Addsimps [equiv_hypnatrel_iff,inj_on_Abs_hypnat RS inj_on_iff, |
|
78 |
hypnatrel_iff, hypnatrel_in_hypnat, Abs_hypnat_inverse]; |
|
79 |
||
80 |
Addsimps [equiv_hypnatrel RS eq_equiv_class_iff]; |
|
81 |
val eq_hypnatrelD = equiv_hypnatrel RSN (2,eq_equiv_class); |
|
82 |
||
83 |
Goal "inj(Rep_hypnat)"; |
|
84 |
by (rtac inj_inverseI 1); |
|
85 |
by (rtac Rep_hypnat_inverse 1); |
|
86 |
qed "inj_Rep_hypnat"; |
|
87 |
||
10834 | 88 |
Goalw [hypnatrel_def] "x: hypnatrel `` {x}"; |
10751 | 89 |
by (Step_tac 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
90 |
by Auto_tac; |
10751 | 91 |
qed "lemma_hypnatrel_refl"; |
92 |
||
93 |
Addsimps [lemma_hypnatrel_refl]; |
|
94 |
||
95 |
Goalw [hypnat_def] "{} ~: hypnat"; |
|
96 |
by (auto_tac (claset() addSEs [quotientE],simpset())); |
|
97 |
qed "hypnat_empty_not_mem"; |
|
98 |
||
99 |
Addsimps [hypnat_empty_not_mem]; |
|
100 |
||
101 |
Goal "Rep_hypnat x ~= {}"; |
|
102 |
by (cut_inst_tac [("x","x")] Rep_hypnat 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
103 |
by Auto_tac; |
10751 | 104 |
qed "Rep_hypnat_nonempty"; |
105 |
||
106 |
Addsimps [Rep_hypnat_nonempty]; |
|
107 |
||
108 |
(*------------------------------------------------------------------------ |
|
109 |
hypnat_of_nat: the injection from nat to hypnat |
|
110 |
------------------------------------------------------------------------*) |
|
111 |
Goal "inj(hypnat_of_nat)"; |
|
112 |
by (rtac injI 1); |
|
113 |
by (rewtac hypnat_of_nat_def); |
|
114 |
by (dtac (inj_on_Abs_hypnat RS inj_onD) 1); |
|
115 |
by (REPEAT (rtac hypnatrel_in_hypnat 1)); |
|
116 |
by (dtac eq_equiv_class 1); |
|
117 |
by (rtac equiv_hypnatrel 1); |
|
118 |
by (Fast_tac 1); |
|
119 |
by (rtac ccontr 1 THEN rotate_tac 1 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
120 |
by Auto_tac; |
10751 | 121 |
qed "inj_hypnat_of_nat"; |
122 |
||
123 |
val [prem] = Goal |
|
10834 | 124 |
"(!!x. z = Abs_hypnat(hypnatrel``{x}) ==> P) ==> P"; |
10751 | 125 |
by (res_inst_tac [("x1","z")] |
126 |
(rewrite_rule [hypnat_def] Rep_hypnat RS quotientE) 1); |
|
127 |
by (dres_inst_tac [("f","Abs_hypnat")] arg_cong 1); |
|
128 |
by (res_inst_tac [("x","x")] prem 1); |
|
129 |
by (asm_full_simp_tac (simpset() addsimps [Rep_hypnat_inverse]) 1); |
|
130 |
qed "eq_Abs_hypnat"; |
|
131 |
||
132 |
(*----------------------------------------------------------- |
|
133 |
Addition for hyper naturals: hypnat_add |
|
134 |
-----------------------------------------------------------*) |
|
135 |
Goalw [congruent2_def] |
|
10834 | 136 |
"congruent2 hypnatrel (%X Y. hypnatrel``{%n. X n + Y n})"; |
10751 | 137 |
by Safe_tac; |
138 |
by (ALLGOALS(Fuf_tac)); |
|
139 |
qed "hypnat_add_congruent2"; |
|
140 |
||
141 |
Goalw [hypnat_add_def] |
|
10834 | 142 |
"Abs_hypnat(hypnatrel``{%n. X n}) + Abs_hypnat(hypnatrel``{%n. Y n}) = \ |
143 |
\ Abs_hypnat(hypnatrel``{%n. X n + Y n})"; |
|
10751 | 144 |
by (asm_simp_tac |
145 |
(simpset() addsimps [[equiv_hypnatrel, hypnat_add_congruent2] |
|
146 |
MRS UN_equiv_class2]) 1); |
|
147 |
qed "hypnat_add"; |
|
148 |
||
149 |
Goal "(z::hypnat) + w = w + z"; |
|
150 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
151 |
by (res_inst_tac [("z","w")] eq_Abs_hypnat 1); |
|
152 |
by (asm_simp_tac (simpset() addsimps (add_ac @ [hypnat_add])) 1); |
|
153 |
qed "hypnat_add_commute"; |
|
154 |
||
155 |
Goal "((z1::hypnat) + z2) + z3 = z1 + (z2 + z3)"; |
|
156 |
by (res_inst_tac [("z","z1")] eq_Abs_hypnat 1); |
|
157 |
by (res_inst_tac [("z","z2")] eq_Abs_hypnat 1); |
|
158 |
by (res_inst_tac [("z","z3")] eq_Abs_hypnat 1); |
|
159 |
by (asm_simp_tac (simpset() addsimps [hypnat_add,add_assoc]) 1); |
|
160 |
qed "hypnat_add_assoc"; |
|
161 |
||
162 |
(*For AC rewriting*) |
|
163 |
Goal "(x::hypnat)+(y+z)=y+(x+z)"; |
|
164 |
by (rtac (hypnat_add_commute RS trans) 1); |
|
165 |
by (rtac (hypnat_add_assoc RS trans) 1); |
|
166 |
by (rtac (hypnat_add_commute RS arg_cong) 1); |
|
167 |
qed "hypnat_add_left_commute"; |
|
168 |
||
169 |
(* hypnat addition is an AC operator *) |
|
170 |
val hypnat_add_ac = [hypnat_add_assoc,hypnat_add_commute, |
|
171 |
hypnat_add_left_commute]; |
|
172 |
||
173 |
Goalw [hypnat_zero_def] "(0::hypnat) + z = z"; |
|
174 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
175 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_add]) 1); |
|
176 |
qed "hypnat_add_zero_left"; |
|
177 |
||
178 |
Goal "z + (0::hypnat) = z"; |
|
179 |
by (simp_tac (simpset() addsimps |
|
180 |
[hypnat_add_zero_left,hypnat_add_commute]) 1); |
|
181 |
qed "hypnat_add_zero_right"; |
|
182 |
||
183 |
Addsimps [hypnat_add_zero_left,hypnat_add_zero_right]; |
|
184 |
||
185 |
(*----------------------------------------------------------- |
|
186 |
Subtraction for hyper naturals: hypnat_minus |
|
187 |
-----------------------------------------------------------*) |
|
188 |
Goalw [congruent2_def] |
|
10834 | 189 |
"congruent2 hypnatrel (%X Y. hypnatrel``{%n. X n - Y n})"; |
10751 | 190 |
by Safe_tac; |
191 |
by (ALLGOALS(Fuf_tac)); |
|
192 |
qed "hypnat_minus_congruent2"; |
|
193 |
||
194 |
Goalw [hypnat_minus_def] |
|
10834 | 195 |
"Abs_hypnat(hypnatrel``{%n. X n}) - Abs_hypnat(hypnatrel``{%n. Y n}) = \ |
196 |
\ Abs_hypnat(hypnatrel``{%n. X n - Y n})"; |
|
10751 | 197 |
by (asm_simp_tac |
198 |
(simpset() addsimps [[equiv_hypnatrel, hypnat_minus_congruent2] |
|
199 |
MRS UN_equiv_class2]) 1); |
|
200 |
qed "hypnat_minus"; |
|
201 |
||
202 |
Goalw [hypnat_zero_def] "z - z = (0::hypnat)"; |
|
203 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
204 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus]) 1); |
|
205 |
qed "hypnat_minus_zero"; |
|
206 |
||
207 |
Goalw [hypnat_zero_def] "(0::hypnat) - n = 0"; |
|
208 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
209 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus]) 1); |
|
210 |
qed "hypnat_diff_0_eq_0"; |
|
211 |
||
212 |
Addsimps [hypnat_minus_zero,hypnat_diff_0_eq_0]; |
|
213 |
||
214 |
Goalw [hypnat_zero_def] "(m+n = (0::hypnat)) = (m=0 & n=0)"; |
|
215 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
216 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
217 |
by (auto_tac (claset() addIs [FreeUltrafilterNat_subset] |
|
218 |
addDs [FreeUltrafilterNat_Int], |
|
219 |
simpset() addsimps [hypnat_add] )); |
|
220 |
qed "hypnat_add_is_0"; |
|
221 |
||
222 |
AddIffs [hypnat_add_is_0]; |
|
223 |
||
224 |
Goal "!!i::hypnat. i-j-k = i - (j+k)"; |
|
225 |
by (res_inst_tac [("z","i")] eq_Abs_hypnat 1); |
|
226 |
by (res_inst_tac [("z","j")] eq_Abs_hypnat 1); |
|
227 |
by (res_inst_tac [("z","k")] eq_Abs_hypnat 1); |
|
228 |
by (asm_full_simp_tac (simpset() addsimps |
|
229 |
[hypnat_minus,hypnat_add,diff_diff_left]) 1); |
|
230 |
qed "hypnat_diff_diff_left"; |
|
231 |
||
232 |
Goal "!!i::hypnat. i-j-k = i-k-j"; |
|
233 |
by (simp_tac (simpset() addsimps |
|
234 |
[hypnat_diff_diff_left, hypnat_add_commute]) 1); |
|
235 |
qed "hypnat_diff_commute"; |
|
236 |
||
237 |
Goal "!!n::hypnat. (n+m) - n = m"; |
|
238 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
239 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
240 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus,hypnat_add]) 1); |
|
241 |
qed "hypnat_diff_add_inverse"; |
|
242 |
Addsimps [hypnat_diff_add_inverse]; |
|
243 |
||
244 |
Goal "!!n::hypnat.(m+n) - n = m"; |
|
245 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
246 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
247 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus,hypnat_add]) 1); |
|
248 |
qed "hypnat_diff_add_inverse2"; |
|
249 |
Addsimps [hypnat_diff_add_inverse2]; |
|
250 |
||
251 |
Goal "!!k::hypnat. (k+m) - (k+n) = m - n"; |
|
252 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
253 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
254 |
by (res_inst_tac [("z","k")] eq_Abs_hypnat 1); |
|
255 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus,hypnat_add]) 1); |
|
256 |
qed "hypnat_diff_cancel"; |
|
257 |
Addsimps [hypnat_diff_cancel]; |
|
258 |
||
259 |
Goal "!!m::hypnat. (m+k) - (n+k) = m - n"; |
|
260 |
val hypnat_add_commute_k = read_instantiate [("w","k")] hypnat_add_commute; |
|
261 |
by (asm_simp_tac (simpset() addsimps ([hypnat_add_commute_k])) 1); |
|
262 |
qed "hypnat_diff_cancel2"; |
|
263 |
Addsimps [hypnat_diff_cancel2]; |
|
264 |
||
265 |
Goalw [hypnat_zero_def] "!!n::hypnat. n - (n+m) = (0::hypnat)"; |
|
266 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
267 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
268 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_minus,hypnat_add]) 1); |
|
269 |
qed "hypnat_diff_add_0"; |
|
270 |
Addsimps [hypnat_diff_add_0]; |
|
271 |
||
272 |
(*----------------------------------------------------------- |
|
273 |
Multiplication for hyper naturals: hypnat_mult |
|
274 |
-----------------------------------------------------------*) |
|
275 |
Goalw [congruent2_def] |
|
10834 | 276 |
"congruent2 hypnatrel (%X Y. hypnatrel``{%n. X n * Y n})"; |
10751 | 277 |
by Safe_tac; |
278 |
by (ALLGOALS(Fuf_tac)); |
|
279 |
qed "hypnat_mult_congruent2"; |
|
280 |
||
281 |
Goalw [hypnat_mult_def] |
|
10834 | 282 |
"Abs_hypnat(hypnatrel``{%n. X n}) * Abs_hypnat(hypnatrel``{%n. Y n}) = \ |
283 |
\ Abs_hypnat(hypnatrel``{%n. X n * Y n})"; |
|
10751 | 284 |
by (asm_simp_tac |
285 |
(simpset() addsimps [[equiv_hypnatrel,hypnat_mult_congruent2] MRS |
|
286 |
UN_equiv_class2]) 1); |
|
287 |
qed "hypnat_mult"; |
|
288 |
||
289 |
Goal "(z::hypnat) * w = w * z"; |
|
290 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
291 |
by (res_inst_tac [("z","w")] eq_Abs_hypnat 1); |
|
292 |
by (asm_simp_tac (simpset() addsimps ([hypnat_mult] @ mult_ac)) 1); |
|
293 |
qed "hypnat_mult_commute"; |
|
294 |
||
295 |
Goal "((z1::hypnat) * z2) * z3 = z1 * (z2 * z3)"; |
|
296 |
by (res_inst_tac [("z","z1")] eq_Abs_hypnat 1); |
|
297 |
by (res_inst_tac [("z","z2")] eq_Abs_hypnat 1); |
|
298 |
by (res_inst_tac [("z","z3")] eq_Abs_hypnat 1); |
|
299 |
by (asm_simp_tac (simpset() addsimps [hypnat_mult,mult_assoc]) 1); |
|
300 |
qed "hypnat_mult_assoc"; |
|
301 |
||
302 |
||
303 |
Goal "(z1::hypnat) * (z2 * z3) = z2 * (z1 * z3)"; |
|
304 |
by (rtac (hypnat_mult_commute RS trans) 1); |
|
305 |
by (rtac (hypnat_mult_assoc RS trans) 1); |
|
306 |
by (rtac (hypnat_mult_commute RS arg_cong) 1); |
|
307 |
qed "hypnat_mult_left_commute"; |
|
308 |
||
309 |
(* hypnat multiplication is an AC operator *) |
|
310 |
val hypnat_mult_ac = [hypnat_mult_assoc, hypnat_mult_commute, |
|
311 |
hypnat_mult_left_commute]; |
|
312 |
||
313 |
Goalw [hypnat_one_def] "1hn * z = z"; |
|
314 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
315 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_mult]) 1); |
|
316 |
qed "hypnat_mult_1"; |
|
317 |
Addsimps [hypnat_mult_1]; |
|
318 |
||
319 |
Goal "z * 1hn = z"; |
|
320 |
by (simp_tac (simpset() addsimps [hypnat_mult_commute]) 1); |
|
321 |
qed "hypnat_mult_1_right"; |
|
322 |
Addsimps [hypnat_mult_1_right]; |
|
323 |
||
324 |
Goalw [hypnat_zero_def] "(0::hypnat) * z = 0"; |
|
325 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
326 |
by (asm_full_simp_tac (simpset() addsimps [hypnat_mult]) 1); |
|
327 |
qed "hypnat_mult_0"; |
|
328 |
Addsimps [hypnat_mult_0]; |
|
329 |
||
330 |
Goal "z * (0::hypnat) = 0"; |
|
331 |
by (simp_tac (simpset() addsimps [hypnat_mult_commute]) 1); |
|
332 |
qed "hypnat_mult_0_right"; |
|
333 |
Addsimps [hypnat_mult_0_right]; |
|
334 |
||
335 |
Goal "!!m::hypnat. (m - n) * k = (m * k) - (n * k)"; |
|
336 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
337 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
338 |
by (res_inst_tac [("z","k")] eq_Abs_hypnat 1); |
|
339 |
by (asm_simp_tac (simpset() addsimps [hypnat_mult, |
|
340 |
hypnat_minus,diff_mult_distrib]) 1); |
|
341 |
qed "hypnat_diff_mult_distrib" ; |
|
342 |
||
343 |
Goal "!!m::hypnat. k * (m - n) = (k * m) - (k * n)"; |
|
344 |
val hypnat_mult_commute_k = read_instantiate [("z","k")] hypnat_mult_commute; |
|
345 |
by (simp_tac (simpset() addsimps [hypnat_diff_mult_distrib, |
|
346 |
hypnat_mult_commute_k]) 1); |
|
347 |
qed "hypnat_diff_mult_distrib2" ; |
|
348 |
||
349 |
(*-------------------------- |
|
350 |
A Few more theorems |
|
351 |
-------------------------*) |
|
352 |
||
353 |
Goal "(z::hypnat) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
|
354 |
by (asm_simp_tac (simpset() addsimps [hypnat_add_assoc RS sym]) 1); |
|
355 |
qed "hypnat_add_assoc_cong"; |
|
356 |
||
357 |
Goal "(z::hypnat) + (v + w) = v + (z + w)"; |
|
358 |
by (REPEAT (ares_tac [hypnat_add_commute RS hypnat_add_assoc_cong] 1)); |
|
359 |
qed "hypnat_add_assoc_swap"; |
|
360 |
||
361 |
Goal "((z1::hypnat) + z2) * w = (z1 * w) + (z2 * w)"; |
|
362 |
by (res_inst_tac [("z","z1")] eq_Abs_hypnat 1); |
|
363 |
by (res_inst_tac [("z","z2")] eq_Abs_hypnat 1); |
|
364 |
by (res_inst_tac [("z","w")] eq_Abs_hypnat 1); |
|
365 |
by (asm_simp_tac (simpset() addsimps [hypnat_mult,hypnat_add, |
|
366 |
add_mult_distrib]) 1); |
|
367 |
qed "hypnat_add_mult_distrib"; |
|
368 |
Addsimps [hypnat_add_mult_distrib]; |
|
369 |
||
370 |
val hypnat_mult_commute'= read_instantiate [("z","w")] hypnat_mult_commute; |
|
371 |
||
372 |
Goal "(w::hypnat) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
373 |
by (simp_tac (simpset() addsimps [hypnat_mult_commute']) 1); |
|
374 |
qed "hypnat_add_mult_distrib2"; |
|
375 |
Addsimps [hypnat_add_mult_distrib2]; |
|
376 |
||
377 |
(*** (hypnat) one and zero are distinct ***) |
|
378 |
Goalw [hypnat_zero_def,hypnat_one_def] "(0::hypnat) ~= 1hn"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
379 |
by Auto_tac; |
10751 | 380 |
qed "hypnat_zero_not_eq_one"; |
381 |
Addsimps [hypnat_zero_not_eq_one]; |
|
382 |
Addsimps [hypnat_zero_not_eq_one RS not_sym]; |
|
383 |
||
384 |
Goalw [hypnat_zero_def] "(m*n = (0::hypnat)) = (m=0 | n=0)"; |
|
385 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
386 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
387 |
by (auto_tac (claset() addSDs [FreeUltrafilterNat_Compl_mem], |
|
388 |
simpset() addsimps [hypnat_mult])); |
|
389 |
by (ALLGOALS(Fuf_tac)); |
|
390 |
qed "hypnat_mult_is_0"; |
|
391 |
Addsimps [hypnat_mult_is_0]; |
|
392 |
||
393 |
(*------------------------------------------------------------------ |
|
394 |
Theorems for ordering |
|
395 |
------------------------------------------------------------------*) |
|
396 |
||
397 |
(* prove introduction and elimination rules for hypnat_less *) |
|
398 |
||
399 |
Goalw [hypnat_less_def] |
|
11655 | 400 |
"(P < (Q::hypnat)) = (EX X Y. X : Rep_hypnat(P) & \ |
10751 | 401 |
\ Y : Rep_hypnat(Q) & \ |
402 |
\ {n. X n < Y n} : FreeUltrafilterNat)"; |
|
403 |
by (Fast_tac 1); |
|
404 |
qed "hypnat_less_iff"; |
|
405 |
||
406 |
Goalw [hypnat_less_def] |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
407 |
"[| {n. X n < Y n} : FreeUltrafilterNat; \ |
10751 | 408 |
\ X : Rep_hypnat(P); \ |
409 |
\ Y : Rep_hypnat(Q) |] ==> P < (Q::hypnat)"; |
|
410 |
by (Fast_tac 1); |
|
411 |
qed "hypnat_lessI"; |
|
412 |
||
413 |
Goalw [hypnat_less_def] |
|
414 |
"!! R1. [| R1 < (R2::hypnat); \ |
|
415 |
\ !!X Y. {n. X n < Y n} : FreeUltrafilterNat ==> P; \ |
|
416 |
\ !!X. X : Rep_hypnat(R1) ==> P; \ |
|
417 |
\ !!Y. Y : Rep_hypnat(R2) ==> P |] \ |
|
418 |
\ ==> P"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
419 |
by Auto_tac; |
10751 | 420 |
qed "hypnat_lessE"; |
421 |
||
422 |
Goalw [hypnat_less_def] |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
423 |
"R1 < (R2::hypnat) ==> (EX X Y. {n. X n < Y n} : FreeUltrafilterNat & \ |
10751 | 424 |
\ X : Rep_hypnat(R1) & \ |
425 |
\ Y : Rep_hypnat(R2))"; |
|
426 |
by (Fast_tac 1); |
|
427 |
qed "hypnat_lessD"; |
|
428 |
||
429 |
Goal "~ (R::hypnat) < R"; |
|
430 |
by (res_inst_tac [("z","R")] eq_Abs_hypnat 1); |
|
431 |
by (auto_tac (claset(),simpset() addsimps [hypnat_less_def])); |
|
432 |
by (Fuf_empty_tac 1); |
|
433 |
qed "hypnat_less_not_refl"; |
|
434 |
Addsimps [hypnat_less_not_refl]; |
|
435 |
||
436 |
bind_thm("hypnat_less_irrefl",hypnat_less_not_refl RS notE); |
|
437 |
||
438 |
Goalw [hypnat_less_def,hypnat_zero_def] "~ n<(0::hypnat)"; |
|
439 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
440 |
by Auto_tac; |
10751 | 441 |
by (Fuf_empty_tac 1); |
442 |
qed "hypnat_not_less0"; |
|
443 |
AddIffs [hypnat_not_less0]; |
|
444 |
||
445 |
(* n<(0::hypnat) ==> R *) |
|
446 |
bind_thm ("hypnat_less_zeroE", hypnat_not_less0 RS notE); |
|
447 |
||
448 |
Goalw [hypnat_less_def,hypnat_zero_def,hypnat_one_def] |
|
449 |
"(n<1hn) = (n=0)"; |
|
450 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
451 |
by (auto_tac (claset() addSIs [exI] addEs |
|
452 |
[FreeUltrafilterNat_subset],simpset())); |
|
453 |
by (Fuf_tac 1); |
|
454 |
qed "hypnat_less_one"; |
|
455 |
AddIffs [hypnat_less_one]; |
|
456 |
||
457 |
Goal "!!(R1::hypnat). [| R1 < R2; R2 < R3 |] ==> R1 < R3"; |
|
458 |
by (res_inst_tac [("z","R1")] eq_Abs_hypnat 1); |
|
459 |
by (res_inst_tac [("z","R2")] eq_Abs_hypnat 1); |
|
460 |
by (res_inst_tac [("z","R3")] eq_Abs_hypnat 1); |
|
461 |
by (auto_tac (claset(),simpset() addsimps [hypnat_less_def])); |
|
462 |
by (res_inst_tac [("x","X")] exI 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
463 |
by Auto_tac; |
10751 | 464 |
by (res_inst_tac [("x","Ya")] exI 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
465 |
by Auto_tac; |
10751 | 466 |
by (Fuf_tac 1); |
467 |
qed "hypnat_less_trans"; |
|
468 |
||
469 |
Goal "!! (R1::hypnat). [| R1 < R2; R2 < R1 |] ==> P"; |
|
470 |
by (dtac hypnat_less_trans 1 THEN assume_tac 1); |
|
471 |
by (Asm_full_simp_tac 1); |
|
472 |
qed "hypnat_less_asym"; |
|
473 |
||
474 |
(*----- hypnat less iff less a.e -----*) |
|
475 |
(* See comments in HYPER for corresponding thm *) |
|
476 |
||
477 |
Goalw [hypnat_less_def] |
|
10834 | 478 |
"(Abs_hypnat(hypnatrel``{%n. X n}) < \ |
479 |
\ Abs_hypnat(hypnatrel``{%n. Y n})) = \ |
|
10751 | 480 |
\ ({n. X n < Y n} : FreeUltrafilterNat)"; |
481 |
by (auto_tac (claset() addSIs [lemma_hypnatrel_refl],simpset())); |
|
482 |
by (Fuf_tac 1); |
|
483 |
qed "hypnat_less"; |
|
484 |
||
485 |
Goal "~ m<n --> n+(m-n) = (m::hypnat)"; |
|
486 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
487 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
488 |
by (auto_tac (claset(),simpset() addsimps |
|
489 |
[hypnat_minus,hypnat_add,hypnat_less])); |
|
490 |
by (dtac FreeUltrafilterNat_Compl_mem 1); |
|
491 |
by (Fuf_tac 1); |
|
492 |
qed_spec_mp "hypnat_add_diff_inverse"; |
|
493 |
||
494 |
Goal "n<=m ==> n+(m-n) = (m::hypnat)"; |
|
495 |
by (asm_full_simp_tac (simpset() addsimps |
|
496 |
[hypnat_add_diff_inverse, hypnat_le_def]) 1); |
|
497 |
qed "hypnat_le_add_diff_inverse"; |
|
498 |
||
499 |
Goal "n<=m ==> (m-n)+n = (m::hypnat)"; |
|
500 |
by (asm_simp_tac (simpset() addsimps [hypnat_le_add_diff_inverse, |
|
501 |
hypnat_add_commute]) 1); |
|
502 |
qed "hypnat_le_add_diff_inverse2"; |
|
503 |
||
504 |
(*--------------------------------------------------------------------------------- |
|
505 |
Hyper naturals as a linearly ordered field |
|
506 |
---------------------------------------------------------------------------------*) |
|
507 |
Goalw [hypnat_zero_def] |
|
508 |
"[| (0::hypnat) < x; 0 < y |] ==> 0 < x + y"; |
|
509 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
510 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
511 |
by (auto_tac (claset(),simpset() addsimps |
|
512 |
[hypnat_less_def,hypnat_add])); |
|
513 |
by (REPEAT(Step_tac 1)); |
|
514 |
by (Fuf_tac 1); |
|
515 |
qed "hypnat_add_order"; |
|
516 |
||
517 |
Goalw [hypnat_zero_def] |
|
518 |
"!!(x::hypnat). [| (0::hypnat) < x; 0 < y |] ==> 0 < x * y"; |
|
519 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
520 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
521 |
by (auto_tac (claset(),simpset() addsimps |
|
522 |
[hypnat_less_def,hypnat_mult])); |
|
523 |
by (REPEAT(Step_tac 1)); |
|
524 |
by (Fuf_tac 1); |
|
525 |
qed "hypnat_mult_order"; |
|
526 |
||
527 |
(*--------------------------------------------------------------------------------- |
|
528 |
Trichotomy of the hyper naturals |
|
529 |
--------------------------------------------------------------------------------*) |
|
10834 | 530 |
Goalw [hypnatrel_def] "EX x. x: hypnatrel `` {%n. 0}"; |
10751 | 531 |
by (res_inst_tac [("x","%n. 0")] exI 1); |
532 |
by (Step_tac 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
533 |
by Auto_tac; |
10751 | 534 |
qed "lemma_hypnatrel_0_mem"; |
535 |
||
536 |
(* linearity is actually proved further down! *) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
537 |
Goalw [hypnat_zero_def, hypnat_less_def] |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
538 |
"(0::hypnat) < x | x = 0 | x < 0"; |
10751 | 539 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
540 |
by (Auto_tac ); |
|
541 |
by (REPEAT(Step_tac 1)); |
|
542 |
by (REPEAT(dtac FreeUltrafilterNat_Compl_mem 1)); |
|
543 |
by (Fuf_tac 1); |
|
544 |
qed "hypnat_trichotomy"; |
|
545 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
546 |
Goal "!!P. [| (0::hypnat) < x ==> P; \ |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
547 |
\ x = 0 ==> P; \ |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
548 |
\ x < 0 ==> P |] ==> P"; |
10751 | 549 |
by (cut_inst_tac [("x","x")] hypnat_trichotomy 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
550 |
by Auto_tac; |
10751 | 551 |
qed "hypnat_trichotomyE"; |
552 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
553 |
(*---------------------------------------------------------------------------- |
10751 | 554 |
More properties of < |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
555 |
----------------------------------------------------------------------------*) |
10751 | 556 |
Goal "!!(A::hypnat). A < B ==> A + C < B + C"; |
557 |
by (res_inst_tac [("z","A")] eq_Abs_hypnat 1); |
|
558 |
by (res_inst_tac [("z","B")] eq_Abs_hypnat 1); |
|
559 |
by (res_inst_tac [("z","C")] eq_Abs_hypnat 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
560 |
by (auto_tac (claset(), simpset() addsimps [hypnat_less_def,hypnat_add])); |
10751 | 561 |
by (REPEAT(Step_tac 1)); |
562 |
by (Fuf_tac 1); |
|
563 |
qed "hypnat_add_less_mono1"; |
|
564 |
||
565 |
Goal "!!(A::hypnat). A < B ==> C + A < C + B"; |
|
566 |
by (auto_tac (claset() addIs [hypnat_add_less_mono1], |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
567 |
simpset() addsimps [hypnat_add_commute])); |
10751 | 568 |
qed "hypnat_add_less_mono2"; |
569 |
||
570 |
Goal "!!k l::hypnat. [|i<j; k<l |] ==> i + k < j + l"; |
|
571 |
by (etac (hypnat_add_less_mono1 RS hypnat_less_trans) 1); |
|
572 |
by (simp_tac (simpset() addsimps [hypnat_add_commute]) 1); |
|
573 |
(*j moves to the end because it is free while k, l are bound*) |
|
574 |
by (etac hypnat_add_less_mono1 1); |
|
575 |
qed "hypnat_add_less_mono"; |
|
576 |
||
577 |
(*--------------------------------------- |
|
578 |
hypnat_minus_less |
|
579 |
---------------------------------------*) |
|
580 |
Goalw [hypnat_less_def,hypnat_zero_def] |
|
581 |
"((x::hypnat) < y) = ((0::hypnat) < y - x)"; |
|
582 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
583 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
584 |
by (auto_tac (claset(),simpset() addsimps |
|
585 |
[hypnat_minus])); |
|
586 |
by (REPEAT(Step_tac 1)); |
|
587 |
by (REPEAT(Step_tac 2)); |
|
588 |
by (ALLGOALS(fuf_tac (claset() addDs [sym],simpset()))); |
|
589 |
||
590 |
(*** linearity ***) |
|
591 |
Goalw [hypnat_less_def] "(x::hypnat) < y | x = y | y < x"; |
|
592 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
593 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
594 |
by (Auto_tac ); |
|
595 |
by (REPEAT(Step_tac 1)); |
|
596 |
by (REPEAT(dtac FreeUltrafilterNat_Compl_mem 1)); |
|
597 |
by (Fuf_tac 1); |
|
598 |
qed "hypnat_linear"; |
|
599 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
600 |
Goal "!!(x::hypnat). [| x < y ==> P; x = y ==> P; \ |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
601 |
\ y < x ==> P |] ==> P"; |
10751 | 602 |
by (cut_inst_tac [("x","x"),("y","y")] hypnat_linear 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
603 |
by Auto_tac; |
10751 | 604 |
qed "hypnat_linear_less2"; |
605 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
606 |
Goal "((w::hypnat) ~= z) = (w<z | z<w)"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
607 |
by (cut_facts_tac [hypnat_linear] 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
608 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
609 |
qed "hypnat_neq_iff"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
610 |
|
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
611 |
(* Axiom 'order_less_le' of class 'order': *) |
11655 | 612 |
Goal "((w::hypnat) < z) = (w <= z & w ~= z)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
613 |
by (simp_tac (simpset() addsimps [hypnat_le_def, hypnat_neq_iff]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
614 |
by (blast_tac (claset() addIs [hypnat_less_asym]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
615 |
qed "hypnat_less_le"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
616 |
|
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
617 |
(*---------------------------------------------------------------------------- |
10751 | 618 |
Properties of <= |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
619 |
----------------------------------------------------------------------------*) |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
620 |
|
10751 | 621 |
(*------ hypnat le iff nat le a.e ------*) |
622 |
Goalw [hypnat_le_def,le_def] |
|
10834 | 623 |
"(Abs_hypnat(hypnatrel``{%n. X n}) <= \ |
624 |
\ Abs_hypnat(hypnatrel``{%n. Y n})) = \ |
|
10751 | 625 |
\ ({n. X n <= Y n} : FreeUltrafilterNat)"; |
626 |
by (auto_tac (claset() addSDs [FreeUltrafilterNat_Compl_mem], |
|
627 |
simpset() addsimps [hypnat_less])); |
|
628 |
by (Fuf_tac 1 THEN Fuf_empty_tac 1); |
|
629 |
qed "hypnat_le"; |
|
630 |
||
631 |
(*---------------------------------------------------------*) |
|
632 |
(*---------------------------------------------------------*) |
|
633 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
634 |
Goalw [hypnat_le_def] "z < w ==> z <= (w::hypnat)"; |
10751 | 635 |
by (fast_tac (claset() addEs [hypnat_less_asym]) 1); |
636 |
qed "hypnat_less_imp_le"; |
|
637 |
||
638 |
Goalw [hypnat_le_def] "!!(x::hypnat). x <= y ==> x < y | x = y"; |
|
639 |
by (cut_facts_tac [hypnat_linear] 1); |
|
640 |
by (fast_tac (claset() addEs [hypnat_less_irrefl,hypnat_less_asym]) 1); |
|
641 |
qed "hypnat_le_imp_less_or_eq"; |
|
642 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
643 |
Goalw [hypnat_le_def] "z<w | z=w ==> z <=(w::hypnat)"; |
10751 | 644 |
by (cut_facts_tac [hypnat_linear] 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
645 |
by (blast_tac (claset() addDs [hypnat_less_irrefl,hypnat_less_asym]) 1); |
10751 | 646 |
qed "hypnat_less_or_eq_imp_le"; |
647 |
||
648 |
Goal "(x <= (y::hypnat)) = (x < y | x=y)"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
649 |
by (REPEAT(ares_tac [iffI, hypnat_less_or_eq_imp_le, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
650 |
hypnat_le_imp_less_or_eq] 1)); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
651 |
qed "hypnat_le_less"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
652 |
|
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
653 |
(* Axiom 'linorder_linear' of class 'linorder': *) |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
654 |
Goal "(z::hypnat) <= w | w <= z"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
655 |
by (simp_tac (simpset() addsimps [hypnat_le_less]) 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
656 |
by (cut_facts_tac [hypnat_linear] 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
657 |
by (Blast_tac 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
658 |
qed "hypnat_le_linear"; |
10751 | 659 |
|
660 |
Goal "w <= (w::hypnat)"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
661 |
by (simp_tac (simpset() addsimps [hypnat_le_less]) 1); |
10751 | 662 |
qed "hypnat_le_refl"; |
663 |
Addsimps [hypnat_le_refl]; |
|
664 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
665 |
Goal "[| i <= j; j <= k |] ==> i <= (k::hypnat)"; |
10751 | 666 |
by (EVERY1 [dtac hypnat_le_imp_less_or_eq, dtac hypnat_le_imp_less_or_eq, |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
667 |
rtac hypnat_less_or_eq_imp_le, |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
668 |
fast_tac (claset() addIs [hypnat_less_trans])]); |
10751 | 669 |
qed "hypnat_le_trans"; |
670 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
671 |
Goal "[| z <= w; w <= z |] ==> z = (w::hypnat)"; |
10751 | 672 |
by (EVERY1 [dtac hypnat_le_imp_less_or_eq, dtac hypnat_le_imp_less_or_eq, |
673 |
fast_tac (claset() addEs [hypnat_less_irrefl,hypnat_less_asym])]); |
|
674 |
qed "hypnat_le_anti_sym"; |
|
675 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
676 |
Goal "[| (0::hypnat) <= x; 0 <= y |] ==> 0 <= x * y"; |
10751 | 677 |
by (REPEAT(dtac hypnat_le_imp_less_or_eq 1)); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
678 |
by (auto_tac (claset() addIs [hypnat_mult_order, hypnat_less_imp_le], |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
679 |
simpset() addsimps [hypnat_le_refl])); |
10751 | 680 |
qed "hypnat_le_mult_order"; |
681 |
||
682 |
Goalw [hypnat_one_def,hypnat_zero_def,hypnat_less_def] |
|
683 |
"(0::hypnat) < 1hn"; |
|
684 |
by (res_inst_tac [("x","%n. 0")] exI 1); |
|
11468 | 685 |
by (res_inst_tac [("x","%n. 1'")] exI 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
686 |
by Auto_tac; |
10751 | 687 |
qed "hypnat_zero_less_one"; |
688 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
689 |
Goal "[| (0::hypnat) <= x; 0 <= y |] ==> 0 <= x + y"; |
10751 | 690 |
by (REPEAT(dtac hypnat_le_imp_less_or_eq 1)); |
691 |
by (auto_tac (claset() addIs [hypnat_add_order, |
|
692 |
hypnat_less_imp_le],simpset() addsimps [hypnat_le_refl])); |
|
693 |
qed "hypnat_le_add_order"; |
|
694 |
||
695 |
Goal "!!(q1::hypnat). q1 <= q2 ==> x + q1 <= x + q2"; |
|
696 |
by (dtac hypnat_le_imp_less_or_eq 1); |
|
697 |
by (Step_tac 1); |
|
698 |
by (auto_tac (claset() addSIs [hypnat_le_refl, |
|
699 |
hypnat_less_imp_le,hypnat_add_less_mono1], |
|
700 |
simpset() addsimps [hypnat_add_commute])); |
|
701 |
qed "hypnat_add_le_mono2"; |
|
702 |
||
703 |
Goal "!!(q1::hypnat). q1 <= q2 ==> q1 + x <= q2 + x"; |
|
704 |
by (auto_tac (claset() addDs [hypnat_add_le_mono2], |
|
705 |
simpset() addsimps [hypnat_add_commute])); |
|
706 |
qed "hypnat_add_le_mono1"; |
|
707 |
||
708 |
Goal "!!k l::hypnat. [|i<=j; k<=l |] ==> i + k <= j + l"; |
|
709 |
by (etac (hypnat_add_le_mono1 RS hypnat_le_trans) 1); |
|
710 |
by (simp_tac (simpset() addsimps [hypnat_add_commute]) 1); |
|
711 |
(*j moves to the end because it is free while k, l are bound*) |
|
712 |
by (etac hypnat_add_le_mono1 1); |
|
713 |
qed "hypnat_add_le_mono"; |
|
714 |
||
715 |
Goalw [hypnat_zero_def] |
|
716 |
"!!x::hypnat. [| (0::hypnat) < z; x < y |] ==> x * z < y * z"; |
|
717 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
718 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
719 |
by (res_inst_tac [("z","z")] eq_Abs_hypnat 1); |
|
720 |
by (auto_tac (claset(),simpset() addsimps |
|
721 |
[hypnat_less,hypnat_mult])); |
|
722 |
by (Fuf_tac 1); |
|
723 |
qed "hypnat_mult_less_mono1"; |
|
724 |
||
725 |
Goal "!!x::hypnat. [| 0 < z; x < y |] ==> z * x < z * y"; |
|
726 |
by (auto_tac (claset() addIs [hypnat_mult_less_mono1], |
|
727 |
simpset() addsimps [hypnat_mult_commute])); |
|
728 |
qed "hypnat_mult_less_mono2"; |
|
729 |
||
730 |
Addsimps [hypnat_mult_less_mono2,hypnat_mult_less_mono1]; |
|
731 |
||
732 |
Goal "(x::hypnat) <= n + x"; |
|
733 |
by (res_inst_tac [("x","n")] hypnat_trichotomyE 1); |
|
734 |
by (auto_tac (claset() addDs [(hypnat_less_imp_le RS |
|
735 |
hypnat_add_le_mono1)],simpset() addsimps [hypnat_le_refl])); |
|
736 |
qed "hypnat_add_self_le"; |
|
737 |
Addsimps [hypnat_add_self_le]; |
|
738 |
||
739 |
Goal "(x::hypnat) < x + 1hn"; |
|
740 |
by (cut_facts_tac [hypnat_zero_less_one |
|
741 |
RS hypnat_add_less_mono2] 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
742 |
by Auto_tac; |
10751 | 743 |
qed "hypnat_add_one_self_less"; |
744 |
Addsimps [hypnat_add_one_self_less]; |
|
745 |
||
746 |
Goalw [hypnat_le_def] "~ x + 1hn <= x"; |
|
747 |
by (Simp_tac 1); |
|
748 |
qed "not_hypnat_add_one_le_self"; |
|
749 |
Addsimps [not_hypnat_add_one_le_self]; |
|
750 |
||
751 |
Goal "((0::hypnat) < n) = (1hn <= n)"; |
|
752 |
by (res_inst_tac [("x","n")] hypnat_trichotomyE 1); |
|
753 |
by (auto_tac (claset(),simpset() addsimps [hypnat_le_def])); |
|
754 |
qed "hypnat_gt_zero_iff"; |
|
755 |
||
756 |
Addsimps [hypnat_le_add_diff_inverse, hypnat_le_add_diff_inverse2, |
|
757 |
hypnat_less_imp_le RS hypnat_le_add_diff_inverse2]; |
|
758 |
||
759 |
Goal "(0 < n) = (EX m. n = m + 1hn)"; |
|
760 |
by (Step_tac 1); |
|
761 |
by (res_inst_tac [("x","m")] hypnat_trichotomyE 2); |
|
762 |
by (rtac hypnat_less_trans 2); |
|
763 |
by (res_inst_tac [("x","n - 1hn")] exI 1); |
|
764 |
by (auto_tac (claset(),simpset() addsimps |
|
765 |
[hypnat_gt_zero_iff,hypnat_add_commute])); |
|
766 |
qed "hypnat_gt_zero_iff2"; |
|
767 |
||
768 |
Goalw [hypnat_zero_def] "(0::hypnat) <= n"; |
|
769 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
770 |
by (asm_simp_tac (simpset() addsimps [hypnat_le]) 1); |
|
771 |
qed "hypnat_le_zero"; |
|
772 |
Addsimps [hypnat_le_zero]; |
|
773 |
||
774 |
(*------------------------------------------------------------------ |
|
775 |
hypnat_of_nat: properties embedding of naturals in hypernaturals |
|
776 |
-----------------------------------------------------------------*) |
|
777 |
(** hypnat_of_nat preserves field and order properties **) |
|
778 |
||
779 |
Goalw [hypnat_of_nat_def] |
|
780 |
"hypnat_of_nat ((z1::nat) + z2) = \ |
|
781 |
\ hypnat_of_nat z1 + hypnat_of_nat z2"; |
|
782 |
by (asm_simp_tac (simpset() addsimps [hypnat_add]) 1); |
|
783 |
qed "hypnat_of_nat_add"; |
|
784 |
||
785 |
Goalw [hypnat_of_nat_def] |
|
786 |
"hypnat_of_nat ((z1::nat) - z2) = \ |
|
787 |
\ hypnat_of_nat z1 - hypnat_of_nat z2"; |
|
788 |
by (asm_simp_tac (simpset() addsimps [hypnat_minus]) 1); |
|
789 |
qed "hypnat_of_nat_minus"; |
|
790 |
||
791 |
Goalw [hypnat_of_nat_def] |
|
792 |
"hypnat_of_nat (z1 * z2) = hypnat_of_nat z1 * hypnat_of_nat z2"; |
|
793 |
by (full_simp_tac (simpset() addsimps [hypnat_mult]) 1); |
|
794 |
qed "hypnat_of_nat_mult"; |
|
795 |
||
796 |
Goalw [hypnat_less_def,hypnat_of_nat_def] |
|
797 |
"(z1 < z2) = (hypnat_of_nat z1 < hypnat_of_nat z2)"; |
|
798 |
by (auto_tac (claset() addSIs [exI] addIs |
|
799 |
[FreeUltrafilterNat_all],simpset())); |
|
800 |
by (rtac FreeUltrafilterNat_P 1 THEN Fuf_tac 1); |
|
801 |
qed "hypnat_of_nat_less_iff"; |
|
802 |
Addsimps [hypnat_of_nat_less_iff RS sym]; |
|
803 |
||
804 |
Goalw [hypnat_le_def,le_def] |
|
805 |
"(z1 <= z2) = (hypnat_of_nat z1 <= hypnat_of_nat z2)"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
806 |
by Auto_tac; |
10751 | 807 |
qed "hypnat_of_nat_le_iff"; |
808 |
||
11468 | 809 |
Goalw [hypnat_of_nat_def,hypnat_one_def] "hypnat_of_nat 1' = 1hn"; |
10751 | 810 |
by (Simp_tac 1); |
811 |
qed "hypnat_of_nat_one"; |
|
812 |
||
11468 | 813 |
Goalw [hypnat_of_nat_def,hypnat_zero_def] "hypnat_of_nat 0 = 0"; |
10751 | 814 |
by (Simp_tac 1); |
815 |
qed "hypnat_of_nat_zero"; |
|
816 |
||
817 |
Goal "(hypnat_of_nat n = 0) = (n = 0)"; |
|
818 |
by (auto_tac (claset() addIs [FreeUltrafilterNat_P], |
|
819 |
simpset() addsimps [hypnat_of_nat_def, |
|
820 |
hypnat_zero_def])); |
|
821 |
qed "hypnat_of_nat_zero_iff"; |
|
822 |
||
823 |
Goal "(hypnat_of_nat n ~= 0) = (n ~= 0)"; |
|
824 |
by (full_simp_tac (simpset() addsimps [hypnat_of_nat_zero_iff]) 1); |
|
825 |
qed "hypnat_of_nat_not_zero_iff"; |
|
826 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
827 |
Goalw [hypnat_of_nat_def,hypnat_one_def] |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
828 |
"hypnat_of_nat (Suc n) = hypnat_of_nat n + 1hn"; |
10751 | 829 |
by (auto_tac (claset(),simpset() addsimps [hypnat_add])); |
830 |
qed "hypnat_of_nat_Suc"; |
|
831 |
||
832 |
(*--------------------------------------------------------------------------------- |
|
833 |
Existence of infinite hypernatural number |
|
834 |
---------------------------------------------------------------------------------*) |
|
835 |
||
10834 | 836 |
Goal "hypnatrel``{%n::nat. n} : hypnat"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
837 |
by Auto_tac; |
10751 | 838 |
qed "hypnat_omega"; |
839 |
||
840 |
Goalw [hypnat_omega_def] "Rep_hypnat(whn) : hypnat"; |
|
841 |
by (rtac Rep_hypnat 1); |
|
842 |
qed "Rep_hypnat_omega"; |
|
843 |
||
844 |
(* See Hyper.thy for similar argument*) |
|
845 |
(* existence of infinite number not corresponding to any natural number *) |
|
846 |
(* use assumption that member FreeUltrafilterNat is not finite *) |
|
847 |
(* a few lemmas first *) |
|
848 |
||
849 |
Goalw [hypnat_omega_def,hypnat_of_nat_def] |
|
850 |
"~ (EX x. hypnat_of_nat x = whn)"; |
|
851 |
by (auto_tac (claset() addDs [FreeUltrafilterNat_not_finite], |
|
852 |
simpset())); |
|
853 |
qed "not_ex_hypnat_of_nat_eq_omega"; |
|
854 |
||
855 |
Goal "hypnat_of_nat x ~= whn"; |
|
856 |
by (cut_facts_tac [not_ex_hypnat_of_nat_eq_omega] 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
857 |
by Auto_tac; |
10751 | 858 |
qed "hypnat_of_nat_not_eq_omega"; |
859 |
Addsimps [hypnat_of_nat_not_eq_omega RS not_sym]; |
|
860 |
||
861 |
(*----------------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
862 |
Properties of the set Nats of embedded natural numbers |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
863 |
(cf. set Reals in NSA.thy/NSA.ML) |
10751 | 864 |
----------------------------------------------------------*) |
865 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
866 |
(* Infinite hypernatural not in embedded Nats *) |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
867 |
Goalw [SHNat_def] "whn ~: Nats"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
868 |
by Auto_tac; |
10751 | 869 |
qed "SHNAT_omega_not_mem"; |
870 |
Addsimps [SHNAT_omega_not_mem]; |
|
871 |
||
872 |
(*----------------------------------------------------------------------- |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
873 |
Closure laws for members of (embedded) set standard naturals Nats |
10751 | 874 |
-----------------------------------------------------------------------*) |
875 |
Goalw [SHNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
876 |
"!!x::hypnat. [| x: Nats; y: Nats |] ==> x + y: Nats"; |
10751 | 877 |
by (Step_tac 1); |
878 |
by (res_inst_tac [("x","N + Na")] exI 1); |
|
879 |
by (simp_tac (simpset() addsimps [hypnat_of_nat_add]) 1); |
|
880 |
qed "SHNat_add"; |
|
881 |
||
882 |
Goalw [SHNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
883 |
"!!x::hypnat. [| x: Nats; y: Nats |] ==> x - y: Nats"; |
10751 | 884 |
by (Step_tac 1); |
885 |
by (res_inst_tac [("x","N - Na")] exI 1); |
|
886 |
by (simp_tac (simpset() addsimps [hypnat_of_nat_minus]) 1); |
|
887 |
qed "SHNat_minus"; |
|
888 |
||
889 |
Goalw [SHNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
890 |
"!!x::hypnat. [| x: Nats; y: Nats |] ==> x * y: Nats"; |
10751 | 891 |
by (Step_tac 1); |
892 |
by (res_inst_tac [("x","N * Na")] exI 1); |
|
893 |
by (simp_tac (simpset() addsimps [hypnat_of_nat_mult]) 1); |
|
894 |
qed "SHNat_mult"; |
|
895 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
896 |
Goal"!!x::hypnat. [| x + y : Nats; y: Nats |] ==> x: Nats"; |
10751 | 897 |
by (dres_inst_tac [("x","x+y")] SHNat_minus 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
898 |
by Auto_tac; |
10751 | 899 |
qed "SHNat_add_cancel"; |
900 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
901 |
Goalw [SHNat_def] "hypnat_of_nat x : Nats"; |
10751 | 902 |
by (Blast_tac 1); |
903 |
qed "SHNat_hypnat_of_nat"; |
|
904 |
Addsimps [SHNat_hypnat_of_nat]; |
|
905 |
||
11468 | 906 |
Goal "hypnat_of_nat 1' : Nats"; |
10751 | 907 |
by (Simp_tac 1); |
908 |
qed "SHNat_hypnat_of_nat_one"; |
|
909 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
910 |
Goal "hypnat_of_nat 0 : Nats"; |
10751 | 911 |
by (Simp_tac 1); |
912 |
qed "SHNat_hypnat_of_nat_zero"; |
|
913 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
914 |
Goal "1hn : Nats"; |
10751 | 915 |
by (simp_tac (simpset() addsimps [SHNat_hypnat_of_nat_one, |
916 |
hypnat_of_nat_one RS sym]) 1); |
|
917 |
qed "SHNat_one"; |
|
918 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
919 |
Goal "(0::hypnat) : Nats"; |
10751 | 920 |
by (simp_tac (simpset() addsimps [SHNat_hypnat_of_nat_zero, |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
921 |
hypnat_of_nat_zero RS sym]) 1); |
10751 | 922 |
qed "SHNat_zero"; |
923 |
||
924 |
Addsimps [SHNat_hypnat_of_nat_one,SHNat_hypnat_of_nat_zero, |
|
925 |
SHNat_one,SHNat_zero]; |
|
926 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
927 |
Goal "1hn + 1hn : Nats"; |
10751 | 928 |
by (rtac ([SHNat_one,SHNat_one] MRS SHNat_add) 1); |
929 |
qed "SHNat_two"; |
|
930 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
931 |
Goalw [SHNat_def] "{x. hypnat_of_nat x : Nats} = (UNIV::nat set)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
932 |
by Auto_tac; |
10751 | 933 |
qed "SHNat_UNIV_nat"; |
934 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
935 |
Goalw [SHNat_def] "(x: Nats) = (EX y. x = hypnat_of_nat y)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
936 |
by Auto_tac; |
10751 | 937 |
qed "SHNat_iff"; |
938 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
939 |
Goalw [SHNat_def] "hypnat_of_nat `(UNIV::nat set) = Nats"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
940 |
by Auto_tac; |
10751 | 941 |
qed "hypnat_of_nat_image"; |
942 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
943 |
Goalw [SHNat_def] "inv hypnat_of_nat `Nats = (UNIV::nat set)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
944 |
by Auto_tac; |
10751 | 945 |
by (rtac (inj_hypnat_of_nat RS inv_f_f RS subst) 1); |
946 |
by (Blast_tac 1); |
|
947 |
qed "inv_hypnat_of_nat_image"; |
|
948 |
||
949 |
Goalw [SHNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
950 |
"[| EX x. x: P; P <= Nats |] ==> EX Q. P = hypnat_of_nat ` Q"; |
10751 | 951 |
by (Best_tac 1); |
952 |
qed "SHNat_hypnat_of_nat_image"; |
|
953 |
||
954 |
Goalw [SHNat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
955 |
"Nats = hypnat_of_nat ` (UNIV::nat set)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
956 |
by Auto_tac; |
10751 | 957 |
qed "SHNat_hypnat_of_nat_iff"; |
958 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
959 |
Goalw [SHNat_def] "Nats <= (UNIV::hypnat set)"; |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
960 |
by Auto_tac; |
10751 | 961 |
qed "SHNat_subset_UNIV"; |
962 |
||
963 |
Goal "{n. n <= Suc m} = {n. n <= m} Un {n. n = Suc m}"; |
|
964 |
by (auto_tac (claset(),simpset() addsimps [le_Suc_eq])); |
|
965 |
qed "leSuc_Un_eq"; |
|
966 |
||
967 |
Goal "finite {n::nat. n <= m}"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
968 |
by (induct_tac "m" 1); |
10751 | 969 |
by (auto_tac (claset(),simpset() addsimps [leSuc_Un_eq])); |
970 |
qed "finite_nat_le_segment"; |
|
971 |
||
972 |
Goal "{n::nat. m < n} : FreeUltrafilterNat"; |
|
973 |
by (cut_inst_tac [("m2","m")] (finite_nat_le_segment RS |
|
974 |
FreeUltrafilterNat_finite RS FreeUltrafilterNat_Compl_mem) 1); |
|
975 |
by (Fuf_tac 1); |
|
976 |
qed "lemma_unbounded_set"; |
|
977 |
Addsimps [lemma_unbounded_set]; |
|
978 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
979 |
Goalw [SHNat_def,hypnat_of_nat_def, hypnat_less_def,hypnat_omega_def] |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
980 |
"ALL n: Nats. n < whn"; |
10751 | 981 |
by (Clarify_tac 1); |
982 |
by (auto_tac (claset() addSIs [exI],simpset())); |
|
983 |
qed "hypnat_omega_gt_SHNat"; |
|
984 |
||
985 |
Goal "hypnat_of_nat n < whn"; |
|
986 |
by (cut_facts_tac [hypnat_omega_gt_SHNat] 1); |
|
987 |
by (dres_inst_tac [("x","hypnat_of_nat n")] bspec 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
988 |
by Auto_tac; |
10751 | 989 |
qed "hypnat_of_nat_less_whn"; |
990 |
Addsimps [hypnat_of_nat_less_whn]; |
|
991 |
||
992 |
Goal "hypnat_of_nat n <= whn"; |
|
993 |
by (rtac (hypnat_of_nat_less_whn RS hypnat_less_imp_le) 1); |
|
994 |
qed "hypnat_of_nat_le_whn"; |
|
995 |
Addsimps [hypnat_of_nat_le_whn]; |
|
996 |
||
997 |
Goal "0 < whn"; |
|
998 |
by (rtac (hypnat_omega_gt_SHNat RS ballE) 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
999 |
by Auto_tac; |
10751 | 1000 |
qed "hypnat_zero_less_hypnat_omega"; |
1001 |
Addsimps [hypnat_zero_less_hypnat_omega]; |
|
1002 |
||
1003 |
Goal "1hn < whn"; |
|
1004 |
by (rtac (hypnat_omega_gt_SHNat RS ballE) 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1005 |
by Auto_tac; |
10751 | 1006 |
qed "hypnat_one_less_hypnat_omega"; |
1007 |
Addsimps [hypnat_one_less_hypnat_omega]; |
|
1008 |
||
1009 |
(*-------------------------------------------------------------------------- |
|
1010 |
Theorems about infinite hypernatural numbers -- HNatInfinite |
|
1011 |
-------------------------------------------------------------------------*) |
|
1012 |
Goalw [HNatInfinite_def,SHNat_def] "whn : HNatInfinite"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1013 |
by Auto_tac; |
10751 | 1014 |
qed "HNatInfinite_whn"; |
1015 |
Addsimps [HNatInfinite_whn]; |
|
1016 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1017 |
Goalw [HNatInfinite_def] "x: Nats ==> x ~: HNatInfinite"; |
10751 | 1018 |
by (Simp_tac 1); |
1019 |
qed "SHNat_not_HNatInfinite"; |
|
1020 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1021 |
Goalw [HNatInfinite_def] "x ~: HNatInfinite ==> x: Nats"; |
10751 | 1022 |
by (Asm_full_simp_tac 1); |
1023 |
qed "not_HNatInfinite_SHNat"; |
|
1024 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1025 |
Goalw [HNatInfinite_def] "x ~: Nats ==> x: HNatInfinite"; |
10751 | 1026 |
by (Simp_tac 1); |
1027 |
qed "not_SHNat_HNatInfinite"; |
|
1028 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1029 |
Goalw [HNatInfinite_def] "x: HNatInfinite ==> x ~: Nats"; |
10751 | 1030 |
by (Asm_full_simp_tac 1); |
1031 |
qed "HNatInfinite_not_SHNat"; |
|
1032 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1033 |
Goal "(x: Nats) = (x ~: HNatInfinite)"; |
10751 | 1034 |
by (blast_tac (claset() addSIs [SHNat_not_HNatInfinite, |
1035 |
not_HNatInfinite_SHNat]) 1); |
|
1036 |
qed "SHNat_not_HNatInfinite_iff"; |
|
1037 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1038 |
Goal "(x ~: Nats) = (x: HNatInfinite)"; |
10751 | 1039 |
by (blast_tac (claset() addSIs [not_SHNat_HNatInfinite, |
1040 |
HNatInfinite_not_SHNat]) 1); |
|
1041 |
qed "not_SHNat_HNatInfinite_iff"; |
|
1042 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1043 |
Goal "x : Nats | x : HNatInfinite"; |
10751 | 1044 |
by (simp_tac (simpset() addsimps [SHNat_not_HNatInfinite_iff]) 1); |
1045 |
qed "SHNat_HNatInfinite_disj"; |
|
1046 |
||
1047 |
(*------------------------------------------------------------------- |
|
1048 |
Proof of alternative definition for set of Infinite hypernatural |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1049 |
numbers --- HNatInfinite = {N. ALL n: Nats. n < N} |
10751 | 1050 |
-------------------------------------------------------------------*) |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1051 |
Goal "ALL N::nat. {n. f n ~= N} : FreeUltrafilterNat \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1052 |
\ ==> {n. N < f n} : FreeUltrafilterNat"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1053 |
by (induct_tac "N" 1); |
10751 | 1054 |
by (dres_inst_tac [("x","0")] spec 1); |
1055 |
by (rtac ccontr 1 THEN dtac FreeUltrafilterNat_Compl_mem 1 |
|
1056 |
THEN dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1); |
|
1057 |
by (Asm_full_simp_tac 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1058 |
by (dres_inst_tac [("x","Suc n")] spec 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1059 |
by (fuf_tac (claset() addSDs [Suc_leI], |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1060 |
simpset() addsimps [le_eq_less_or_eq]) 1); |
10751 | 1061 |
qed "HNatInfinite_FreeUltrafilterNat_lemma"; |
1062 |
||
1063 |
(*** alternative definition ***) |
|
1064 |
Goalw [HNatInfinite_def,SHNat_def,hypnat_of_nat_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1065 |
"HNatInfinite = {N. ALL n:Nats. n < N}"; |
10751 | 1066 |
by (Step_tac 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1067 |
by (dres_inst_tac [("x","Abs_hypnat (hypnatrel `` {%n. N})")] bspec 2); |
10751 | 1068 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
1069 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
1070 |
by (auto_tac (claset(),simpset() addsimps [hypnat_less_iff])); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1071 |
by (auto_tac (claset() addSIs [exI] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1072 |
addEs [HNatInfinite_FreeUltrafilterNat_lemma], |
10751 | 1073 |
simpset() addsimps [FreeUltrafilterNat_Compl_iff1, |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1074 |
CLAIM "- {n. xa n = N} = {n. xa n ~= N}"])); |
10751 | 1075 |
qed "HNatInfinite_iff"; |
1076 |
||
1077 |
(*-------------------------------------------------------------------- |
|
1078 |
Alternative definition for HNatInfinite using Free ultrafilter |
|
1079 |
--------------------------------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1080 |
Goal "x : HNatInfinite ==> EX X: Rep_hypnat x. \ |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1081 |
\ ALL u. {n. u < X n}: FreeUltrafilterNat"; |
10751 | 1082 |
by (auto_tac (claset(),simpset() addsimps [hypnat_less_def, |
1083 |
HNatInfinite_iff,SHNat_iff,hypnat_of_nat_def])); |
|
1084 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
1085 |
by (EVERY[Auto_tac, rtac bexI 1, |
|
1086 |
rtac lemma_hypnatrel_refl 2, Step_tac 1]); |
|
1087 |
by (dres_inst_tac [("x","hypnat_of_nat u")] bspec 1); |
|
1088 |
by (Simp_tac 1); |
|
1089 |
by (auto_tac (claset(), |
|
1090 |
simpset() addsimps [hypnat_of_nat_def])); |
|
1091 |
by (Fuf_tac 1); |
|
1092 |
qed "HNatInfinite_FreeUltrafilterNat"; |
|
1093 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1094 |
Goal "EX X: Rep_hypnat x. ALL u. {n. u < X n}: FreeUltrafilterNat \ |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1095 |
\ ==> x: HNatInfinite"; |
10751 | 1096 |
by (auto_tac (claset(),simpset() addsimps [hypnat_less_def, |
1097 |
HNatInfinite_iff,SHNat_iff,hypnat_of_nat_def])); |
|
1098 |
by (rtac exI 1 THEN Auto_tac); |
|
1099 |
qed "FreeUltrafilterNat_HNatInfinite"; |
|
1100 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1101 |
Goal "(x : HNatInfinite) = (EX X: Rep_hypnat x. \ |
10751 | 1102 |
\ ALL u. {n. u < X n}: FreeUltrafilterNat)"; |
1103 |
by (blast_tac (claset() addIs [HNatInfinite_FreeUltrafilterNat, |
|
1104 |
FreeUltrafilterNat_HNatInfinite]) 1); |
|
1105 |
qed "HNatInfinite_FreeUltrafilterNat_iff"; |
|
1106 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1107 |
Goal "x : HNatInfinite ==> 1hn < x"; |
10751 | 1108 |
by (auto_tac (claset(),simpset() addsimps [HNatInfinite_iff])); |
1109 |
qed "HNatInfinite_gt_one"; |
|
1110 |
Addsimps [HNatInfinite_gt_one]; |
|
1111 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1112 |
Goal "0 ~: HNatInfinite"; |
10751 | 1113 |
by (auto_tac (claset(),simpset() |
1114 |
addsimps [HNatInfinite_iff])); |
|
1115 |
by (dres_inst_tac [("a","1hn")] equals0D 1); |
|
1116 |
by (Asm_full_simp_tac 1); |
|
1117 |
qed "zero_not_mem_HNatInfinite"; |
|
1118 |
Addsimps [zero_not_mem_HNatInfinite]; |
|
1119 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1120 |
Goal "x : HNatInfinite ==> x ~= 0"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1121 |
by Auto_tac; |
10751 | 1122 |
qed "HNatInfinite_not_eq_zero"; |
1123 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1124 |
Goal "x : HNatInfinite ==> 1hn <= x"; |
10751 | 1125 |
by (blast_tac (claset() addIs [hypnat_less_imp_le, |
1126 |
HNatInfinite_gt_one]) 1); |
|
1127 |
qed "HNatInfinite_ge_one"; |
|
1128 |
Addsimps [HNatInfinite_ge_one]; |
|
1129 |
||
1130 |
(*-------------------------------------------------- |
|
1131 |
Closure Rules |
|
1132 |
--------------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1133 |
Goal "[| x: HNatInfinite; y: HNatInfinite |] \ |
10751 | 1134 |
\ ==> x + y: HNatInfinite"; |
1135 |
by (auto_tac (claset(),simpset() addsimps [HNatInfinite_iff])); |
|
1136 |
by (dtac bspec 1 THEN assume_tac 1); |
|
1137 |
by (dtac (SHNat_zero RSN (2,bspec)) 1); |
|
1138 |
by (dtac hypnat_add_less_mono 1 THEN assume_tac 1); |
|
1139 |
by (Asm_full_simp_tac 1); |
|
1140 |
qed "HNatInfinite_add"; |
|
1141 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1142 |
Goal "[| x: HNatInfinite; y: Nats |] ==> x + y: HNatInfinite"; |
10751 | 1143 |
by (rtac ccontr 1 THEN dtac not_HNatInfinite_SHNat 1); |
1144 |
by (dres_inst_tac [("x","x + y")] SHNat_minus 1); |
|
1145 |
by (auto_tac (claset(),simpset() addsimps |
|
1146 |
[SHNat_not_HNatInfinite_iff])); |
|
1147 |
qed "HNatInfinite_SHNat_add"; |
|
1148 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1149 |
Goal "[| x: HNatInfinite; y: Nats |] ==> x - y: HNatInfinite"; |
10751 | 1150 |
by (rtac ccontr 1 THEN dtac not_HNatInfinite_SHNat 1); |
1151 |
by (dres_inst_tac [("x","x - y")] SHNat_add 1); |
|
1152 |
by (subgoal_tac "y <= x" 2); |
|
1153 |
by (auto_tac (claset() addSDs [hypnat_le_add_diff_inverse2], |
|
1154 |
simpset() addsimps [not_SHNat_HNatInfinite_iff RS sym])); |
|
1155 |
by (auto_tac (claset() addSIs [hypnat_less_imp_le], |
|
1156 |
simpset() addsimps [not_SHNat_HNatInfinite_iff,HNatInfinite_iff])); |
|
1157 |
qed "HNatInfinite_SHNat_diff"; |
|
1158 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1159 |
Goal "x: HNatInfinite ==> x + 1hn: HNatInfinite"; |
10751 | 1160 |
by (auto_tac (claset() addIs [HNatInfinite_SHNat_add], |
1161 |
simpset())); |
|
1162 |
qed "HNatInfinite_add_one"; |
|
1163 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1164 |
Goal "x: HNatInfinite ==> x - 1hn: HNatInfinite"; |
10751 | 1165 |
by (rtac ccontr 1 THEN dtac not_HNatInfinite_SHNat 1); |
1166 |
by (dres_inst_tac [("x","x - 1hn"),("y","1hn")] SHNat_add 1); |
|
1167 |
by (auto_tac (claset(),simpset() addsimps |
|
1168 |
[not_SHNat_HNatInfinite_iff RS sym])); |
|
1169 |
qed "HNatInfinite_minus_one"; |
|
1170 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1171 |
Goal "x : HNatInfinite ==> EX y. x = y + 1hn"; |
10751 | 1172 |
by (res_inst_tac [("x","x - 1hn")] exI 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1173 |
by Auto_tac; |
10751 | 1174 |
qed "HNatInfinite_is_Suc"; |
1175 |
||
1176 |
(*--------------------------------------------------------------- |
|
1177 |
HNat : the hypernaturals embedded in the hyperreals |
|
1178 |
Obtained using the NS extension of the naturals |
|
1179 |
--------------------------------------------------------------*) |
|
1180 |
||
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1181 |
Goalw [HNat_def,starset_def, hypreal_of_nat_def,hypreal_of_real_def] |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1182 |
"hypreal_of_nat N : HNat"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1183 |
by Auto_tac; |
10751 | 1184 |
by (Ultra_tac 1); |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1185 |
by (res_inst_tac [("x","N")] exI 1); |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1186 |
by Auto_tac; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1187 |
qed "HNat_hypreal_of_nat"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1188 |
Addsimps [HNat_hypreal_of_nat]; |
10751 | 1189 |
|
1190 |
Goalw [HNat_def,starset_def] |
|
1191 |
"[| x: HNat; y: HNat |] ==> x + y: HNat"; |
|
1192 |
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
1193 |
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
1194 |
by (auto_tac (claset() addSDs [bspec] addIs [lemma_hyprel_refl], |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1195 |
simpset() addsimps [hypreal_add])); |
10751 | 1196 |
by (Ultra_tac 1); |
10784 | 1197 |
by (res_inst_tac [("x","no+noa")] exI 1); |
1198 |
by Auto_tac; |
|
10751 | 1199 |
qed "HNat_add"; |
1200 |
||
1201 |
Goalw [HNat_def,starset_def] |
|
1202 |
"[| x: HNat; y: HNat |] ==> x * y: HNat"; |
|
1203 |
by (res_inst_tac [("z","x")] eq_Abs_hypreal 1); |
|
1204 |
by (res_inst_tac [("z","y")] eq_Abs_hypreal 1); |
|
1205 |
by (auto_tac (claset() addSDs [bspec] addIs [lemma_hyprel_refl], |
|
10784 | 1206 |
simpset() addsimps [hypreal_mult])); |
10751 | 1207 |
by (Ultra_tac 1); |
10784 | 1208 |
by (res_inst_tac [("x","no*noa")] exI 1); |
1209 |
by Auto_tac; |
|
10751 | 1210 |
qed "HNat_mult"; |
1211 |
||
1212 |
(*--------------------------------------------------------------- |
|
1213 |
Embedding of the hypernaturals into the hyperreal |
|
1214 |
--------------------------------------------------------------*) |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1215 |
|
10834 | 1216 |
Goal "(Ya : hyprel ``{%n. f(n)}) = \ |
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1217 |
\ ({n. f n = Ya n} : FreeUltrafilterNat)"; |
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1218 |
by Auto_tac; |
10751 | 1219 |
qed "lemma_hyprel_FUFN"; |
1220 |
||
1221 |
Goalw [hypreal_of_hypnat_def] |
|
10834 | 1222 |
"hypreal_of_hypnat (Abs_hypnat(hypnatrel``{%n. X n})) = \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
1223 |
\ Abs_hypreal(hyprel `` {%n. real (X n)})"; |
10751 | 1224 |
by (res_inst_tac [("f","Abs_hypreal")] arg_cong 1); |
10784 | 1225 |
by (auto_tac (claset() |
1226 |
addEs [FreeUltrafilterNat_Int RS FreeUltrafilterNat_subset], |
|
1227 |
simpset() addsimps [lemma_hyprel_FUFN])); |
|
10751 | 1228 |
qed "hypreal_of_hypnat"; |
1229 |
||
1230 |
Goal "inj(hypreal_of_hypnat)"; |
|
1231 |
by (rtac injI 1); |
|
1232 |
by (res_inst_tac [("z","x")] eq_Abs_hypnat 1); |
|
1233 |
by (res_inst_tac [("z","y")] eq_Abs_hypnat 1); |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1234 |
by (auto_tac (claset(), simpset() addsimps [hypreal_of_hypnat])); |
10751 | 1235 |
qed "inj_hypreal_of_hypnat"; |
1236 |
||
1237 |
Goal "(hypreal_of_hypnat n = hypreal_of_hypnat m) = (n = m)"; |
|
1238 |
by (auto_tac (claset(),simpset() addsimps [inj_hypreal_of_hypnat RS injD])); |
|
1239 |
qed "hypreal_of_hypnat_eq_cancel"; |
|
1240 |
Addsimps [hypreal_of_hypnat_eq_cancel]; |
|
1241 |
||
1242 |
Goal "(hypnat_of_nat n = hypnat_of_nat m) = (n = m)"; |
|
1243 |
by (auto_tac (claset() addDs [inj_hypnat_of_nat RS injD], |
|
1244 |
simpset())); |
|
1245 |
qed "hypnat_of_nat_eq_cancel"; |
|
1246 |
Addsimps [hypnat_of_nat_eq_cancel]; |
|
1247 |
||
1248 |
Goalw [hypnat_zero_def] |
|
1249 |
"hypreal_of_hypnat 0 = #0"; |
|
1250 |
by (simp_tac (HOL_ss addsimps |
|
1251 |
[zero_eq_numeral_0 RS sym, hypreal_zero_def]) 1); |
|
1252 |
by (simp_tac (simpset() addsimps [hypreal_of_hypnat, real_of_nat_zero]) 1); |
|
1253 |
qed "hypreal_of_hypnat_zero"; |
|
1254 |
||
1255 |
Goalw [hypnat_one_def] |
|
1256 |
"hypreal_of_hypnat 1hn = #1"; |
|
1257 |
by (simp_tac (HOL_ss addsimps |
|
1258 |
[one_eq_numeral_1 RS sym, hypreal_one_def]) 1); |
|
1259 |
by (simp_tac (simpset() addsimps [hypreal_of_hypnat, real_of_nat_one]) 1); |
|
1260 |
qed "hypreal_of_hypnat_one"; |
|
1261 |
||
10784 | 1262 |
Goal "hypreal_of_hypnat (m + n) = hypreal_of_hypnat m + hypreal_of_hypnat n"; |
1263 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
1264 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
1265 |
by (asm_simp_tac (simpset() addsimps |
|
1266 |
[hypreal_of_hypnat, hypreal_add,hypnat_add,real_of_nat_add]) 1); |
|
10751 | 1267 |
qed "hypreal_of_hypnat_add"; |
10784 | 1268 |
Addsimps [hypreal_of_hypnat_add]; |
10751 | 1269 |
|
10784 | 1270 |
Goal "hypreal_of_hypnat (m * n) = hypreal_of_hypnat m * hypreal_of_hypnat n"; |
1271 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
1272 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
1273 |
by (asm_simp_tac (simpset() addsimps |
|
1274 |
[hypreal_of_hypnat, hypreal_mult,hypnat_mult,real_of_nat_mult]) 1); |
|
10751 | 1275 |
qed "hypreal_of_hypnat_mult"; |
10784 | 1276 |
Addsimps [hypreal_of_hypnat_mult]; |
10751 | 1277 |
|
1278 |
Goal "(hypreal_of_hypnat n < hypreal_of_hypnat m) = (n < m)"; |
|
1279 |
by (res_inst_tac [("z","n")] eq_Abs_hypnat 1); |
|
1280 |
by (res_inst_tac [("z","m")] eq_Abs_hypnat 1); |
|
1281 |
by (asm_simp_tac (simpset() addsimps |
|
1282 |
[hypreal_of_hypnat,hypreal_less,hypnat_less]) 1); |
|
1283 |
qed "hypreal_of_hypnat_less_iff"; |
|
1284 |
Addsimps [hypreal_of_hypnat_less_iff]; |
|
1285 |
||
1286 |
Goal "(hypreal_of_hypnat N = #0) = (N = 0)"; |
|
1287 |
by (simp_tac (simpset() addsimps [hypreal_of_hypnat_zero RS sym]) 1); |
|
1288 |
qed "hypreal_of_hypnat_eq_zero_iff"; |
|
1289 |
Addsimps [hypreal_of_hypnat_eq_zero_iff]; |
|
1290 |
||
1291 |
Goal "ALL n. N <= n ==> N = (0::hypnat)"; |
|
1292 |
by (dres_inst_tac [("x","0")] spec 1); |
|
1293 |
by (res_inst_tac [("z","N")] eq_Abs_hypnat 1); |
|
1294 |
by (auto_tac (claset(),simpset() addsimps [hypnat_le,hypnat_zero_def])); |
|
1295 |
qed "hypnat_eq_zero"; |
|
1296 |
Addsimps [hypnat_eq_zero]; |
|
1297 |
||
1298 |
Goal "~ (ALL n. n = (0::hypnat))"; |
|
1299 |
by Auto_tac; |
|
1300 |
by (res_inst_tac [("x","1hn")] exI 1); |
|
1301 |
by (Simp_tac 1); |
|
1302 |
qed "hypnat_not_all_eq_zero"; |
|
1303 |
Addsimps [hypnat_not_all_eq_zero]; |
|
1304 |
||
1305 |
Goal "n ~= 0 ==> (n <= 1hn) = (n = 1hn)"; |
|
10778
2c6605049646
more tidying, especially to remove real_of_posnat
paulson
parents:
10751
diff
changeset
|
1306 |
by (auto_tac (claset(), simpset() addsimps [hypnat_le_less])); |
10751 | 1307 |
qed "hypnat_le_one_eq_one"; |
1308 |
Addsimps [hypnat_le_one_eq_one]; |
|
1309 |
||
1310 |
||
1311 |
||
1312 |