| author | paulson | 
| Sun, 15 Feb 2004 10:46:37 +0100 | |
| changeset 14387 | e96d5c42c4b0 | 
| parent 14378 | 69c4d5997669 | 
| child 14420 | 4e72cd222e0b | 
| permissions | -rw-r--r-- | 
| 10751 | 1  | 
(* Title : NSA.thy  | 
2  | 
Author : Jacques D. Fleuriot  | 
|
3  | 
Copyright : 1998 University of Cambridge  | 
|
| 14370 | 4  | 
*)  | 
| 10751 | 5  | 
|
| 14370 | 6  | 
header{*Infinite Numbers, Infinitesimals, Infinitely Close Relation*}
 | 
7  | 
||
| 
14371
 
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
 
paulson 
parents: 
14370 
diff
changeset
 | 
8  | 
theory NSA = HyperArith + RComplete:  | 
| 10751 | 9  | 
|
10  | 
constdefs  | 
|
11  | 
||
12  | 
Infinitesimal :: "hypreal set"  | 
|
| 14370 | 13  | 
   "Infinitesimal == {x. \<forall>r \<in> Reals. 0 < r --> abs x < r}"
 | 
| 10751 | 14  | 
|
15  | 
HFinite :: "hypreal set"  | 
|
| 14370 | 16  | 
   "HFinite == {x. \<exists>r \<in> Reals. abs x < r}"
 | 
| 10751 | 17  | 
|
18  | 
HInfinite :: "hypreal set"  | 
|
| 14370 | 19  | 
   "HInfinite == {x. \<forall>r \<in> Reals. r < abs x}"
 | 
| 10751 | 20  | 
|
21  | 
(* standard part map *)  | 
|
| 14370 | 22  | 
st :: "hypreal => hypreal"  | 
23  | 
"st == (%x. @r. x \<in> HFinite & r \<in> Reals & r @= x)"  | 
|
| 10751 | 24  | 
|
| 14370 | 25  | 
monad :: "hypreal => hypreal set"  | 
| 10751 | 26  | 
   "monad x      == {y. x @= y}"
 | 
27  | 
||
| 14370 | 28  | 
galaxy :: "hypreal => hypreal set"  | 
29  | 
   "galaxy x     == {y. (x + -y) \<in> HFinite}"
 | 
|
30  | 
||
| 10751 | 31  | 
(* infinitely close *)  | 
| 
10919
 
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
 
paulson 
parents: 
10751 
diff
changeset
 | 
32  | 
approx :: "[hypreal, hypreal] => bool" (infixl "@=" 50)  | 
| 14370 | 33  | 
"x @= y == (x + -y) \<in> Infinitesimal"  | 
34  | 
||
35  | 
||
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
36  | 
defs (overloaded)  | 
| 14370 | 37  | 
|
38  | 
(*standard real numbers as a subset of the hyperreals*)  | 
|
39  | 
   SReal_def:      "Reals == {x. \<exists>r. x = hypreal_of_real r}"
 | 
|
40  | 
||
41  | 
syntax (xsymbols)  | 
|
42  | 
approx :: "[hypreal, hypreal] => bool" (infixl "\<approx>" 50)  | 
|
43  | 
||
44  | 
||
45  | 
||
46  | 
(*--------------------------------------------------------------------  | 
|
47  | 
Closure laws for members of (embedded) set standard real Reals  | 
|
48  | 
--------------------------------------------------------------------*)  | 
|
49  | 
||
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
50  | 
lemma SReal_add [simp]:  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
51  | 
"[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x + y \<in> Reals"  | 
| 14370 | 52  | 
apply (auto simp add: SReal_def)  | 
53  | 
apply (rule_tac x = "r + ra" in exI, simp)  | 
|
54  | 
done  | 
|
55  | 
||
56  | 
lemma SReal_mult: "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x * y \<in> Reals"  | 
|
57  | 
apply (simp add: SReal_def, safe)  | 
|
58  | 
apply (rule_tac x = "r * ra" in exI)  | 
|
59  | 
apply (simp (no_asm) add: hypreal_of_real_mult)  | 
|
60  | 
done  | 
|
61  | 
||
62  | 
lemma SReal_inverse: "(x::hypreal) \<in> Reals ==> inverse x \<in> Reals"  | 
|
63  | 
apply (simp add: SReal_def)  | 
|
64  | 
apply (blast intro: hypreal_of_real_inverse [symmetric])  | 
|
65  | 
done  | 
|
66  | 
||
67  | 
lemma SReal_divide: "[| (x::hypreal) \<in> Reals; y \<in> Reals |] ==> x/y \<in> Reals"  | 
|
68  | 
apply (simp (no_asm_simp) add: SReal_mult SReal_inverse hypreal_divide_def)  | 
|
69  | 
done  | 
|
70  | 
||
71  | 
lemma SReal_minus: "(x::hypreal) \<in> Reals ==> -x \<in> Reals"  | 
|
72  | 
apply (simp add: SReal_def)  | 
|
73  | 
apply (blast intro: hypreal_of_real_minus [symmetric])  | 
|
74  | 
done  | 
|
75  | 
||
76  | 
lemma SReal_minus_iff: "(-x \<in> Reals) = ((x::hypreal) \<in> Reals)"  | 
|
77  | 
apply auto  | 
|
78  | 
apply (erule_tac [2] SReal_minus)  | 
|
79  | 
apply (drule SReal_minus, auto)  | 
|
80  | 
done  | 
|
81  | 
declare SReal_minus_iff [simp]  | 
|
82  | 
||
83  | 
lemma SReal_add_cancel: "[| (x::hypreal) + y \<in> Reals; y \<in> Reals |] ==> x \<in> Reals"  | 
|
84  | 
apply (drule_tac x = y in SReal_minus)  | 
|
85  | 
apply (drule SReal_add, assumption, auto)  | 
|
86  | 
done  | 
|
87  | 
||
88  | 
lemma SReal_hrabs: "(x::hypreal) \<in> Reals ==> abs x \<in> Reals"  | 
|
89  | 
apply (simp add: SReal_def)  | 
|
90  | 
apply (auto simp add: hypreal_of_real_hrabs)  | 
|
91  | 
done  | 
|
92  | 
||
93  | 
lemma SReal_hypreal_of_real: "hypreal_of_real x \<in> Reals"  | 
|
94  | 
by (simp add: SReal_def)  | 
|
95  | 
declare SReal_hypreal_of_real [simp]  | 
|
96  | 
||
97  | 
lemma SReal_number_of: "(number_of w ::hypreal) \<in> Reals"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
98  | 
apply (simp only: hypreal_number_of [symmetric])  | 
| 14370 | 99  | 
apply (rule SReal_hypreal_of_real)  | 
100  | 
done  | 
|
101  | 
declare SReal_number_of [simp]  | 
|
102  | 
||
103  | 
(** As always with numerals, 0 and 1 are special cases **)  | 
|
104  | 
||
105  | 
lemma Reals_0: "(0::hypreal) \<in> Reals"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
106  | 
apply (subst numeral_0_eq_0 [symmetric])  | 
| 14370 | 107  | 
apply (rule SReal_number_of)  | 
108  | 
done  | 
|
109  | 
declare Reals_0 [simp]  | 
|
110  | 
||
111  | 
lemma Reals_1: "(1::hypreal) \<in> Reals"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
112  | 
apply (subst numeral_1_eq_1 [symmetric])  | 
| 14370 | 113  | 
apply (rule SReal_number_of)  | 
114  | 
done  | 
|
115  | 
declare Reals_1 [simp]  | 
|
116  | 
||
117  | 
lemma SReal_divide_number_of: "r \<in> Reals ==> r/(number_of w::hypreal) \<in> Reals"  | 
|
118  | 
apply (unfold hypreal_divide_def)  | 
|
119  | 
apply (blast intro!: SReal_number_of SReal_mult SReal_inverse)  | 
|
120  | 
done  | 
|
121  | 
||
122  | 
(* Infinitesimal epsilon not in Reals *)  | 
|
123  | 
||
124  | 
lemma SReal_epsilon_not_mem: "epsilon \<notin> Reals"  | 
|
125  | 
apply (simp add: SReal_def)  | 
|
126  | 
apply (auto simp add: hypreal_of_real_not_eq_epsilon [THEN not_sym])  | 
|
127  | 
done  | 
|
128  | 
||
129  | 
lemma SReal_omega_not_mem: "omega \<notin> Reals"  | 
|
130  | 
apply (simp add: SReal_def)  | 
|
131  | 
apply (auto simp add: hypreal_of_real_not_eq_omega [THEN not_sym])  | 
|
132  | 
done  | 
|
133  | 
||
134  | 
lemma SReal_UNIV_real: "{x. hypreal_of_real x \<in> Reals} = (UNIV::real set)"
 | 
|
135  | 
by (simp add: SReal_def)  | 
|
136  | 
||
137  | 
lemma SReal_iff: "(x \<in> Reals) = (\<exists>y. x = hypreal_of_real y)"  | 
|
138  | 
by (simp add: SReal_def)  | 
|
139  | 
||
140  | 
lemma hypreal_of_real_image: "hypreal_of_real `(UNIV::real set) = Reals"  | 
|
141  | 
by (auto simp add: SReal_def)  | 
|
142  | 
||
143  | 
lemma inv_hypreal_of_real_image: "inv hypreal_of_real ` Reals = UNIV"  | 
|
144  | 
apply (auto simp add: SReal_def)  | 
|
145  | 
apply (rule inj_hypreal_of_real [THEN inv_f_f, THEN subst], blast)  | 
|
146  | 
done  | 
|
147  | 
||
148  | 
lemma SReal_hypreal_of_real_image:  | 
|
149  | 
"[| \<exists>x. x: P; P <= Reals |] ==> \<exists>Q. P = hypreal_of_real ` Q"  | 
|
150  | 
apply (simp add: SReal_def, blast)  | 
|
151  | 
done  | 
|
152  | 
||
153  | 
lemma SReal_dense: "[| (x::hypreal) \<in> Reals; y \<in> Reals; x<y |] ==> \<exists>r \<in> Reals. x<r & r<y"  | 
|
154  | 
apply (auto simp add: SReal_iff)  | 
|
155  | 
apply (drule real_dense, safe)  | 
|
156  | 
apply (rule_tac x = "hypreal_of_real r" in bexI, auto)  | 
|
157  | 
done  | 
|
158  | 
||
159  | 
(*------------------------------------------------------------------  | 
|
160  | 
Completeness of Reals  | 
|
161  | 
------------------------------------------------------------------*)  | 
|
162  | 
lemma SReal_sup_lemma: "P <= Reals ==> ((\<exists>x \<in> P. y < x) =  | 
|
163  | 
(\<exists>X. hypreal_of_real X \<in> P & y < hypreal_of_real X))"  | 
|
164  | 
by (blast dest!: SReal_iff [THEN iffD1])  | 
|
165  | 
||
166  | 
lemma SReal_sup_lemma2:  | 
|
167  | 
"[| P <= Reals; \<exists>x. x \<in> P; \<exists>y \<in> Reals. \<forall>x \<in> P. x < y |]  | 
|
168  | 
      ==> (\<exists>X. X \<in> {w. hypreal_of_real w \<in> P}) &
 | 
|
169  | 
          (\<exists>Y. \<forall>X \<in> {w. hypreal_of_real w \<in> P}. X < Y)"
 | 
|
170  | 
apply (rule conjI)  | 
|
171  | 
apply (fast dest!: SReal_iff [THEN iffD1])  | 
|
172  | 
apply (auto, frule subsetD, assumption)  | 
|
173  | 
apply (drule SReal_iff [THEN iffD1])  | 
|
174  | 
apply (auto, rule_tac x = ya in exI, auto)  | 
|
175  | 
done  | 
|
176  | 
||
177  | 
(*------------------------------------------------------  | 
|
178  | 
lifting of ub and property of lub  | 
|
179  | 
-------------------------------------------------------*)  | 
|
180  | 
lemma hypreal_of_real_isUb_iff:  | 
|
181  | 
"(isUb (Reals) (hypreal_of_real ` Q) (hypreal_of_real Y)) =  | 
|
182  | 
(isUb (UNIV :: real set) Q Y)"  | 
|
183  | 
apply (simp add: isUb_def setle_def)  | 
|
184  | 
done  | 
|
185  | 
||
186  | 
lemma hypreal_of_real_isLub1:  | 
|
187  | 
"isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)  | 
|
188  | 
==> isLub (UNIV :: real set) Q Y"  | 
|
189  | 
apply (simp add: isLub_def leastP_def)  | 
|
190  | 
apply (auto intro: hypreal_of_real_isUb_iff [THEN iffD2]  | 
|
191  | 
simp add: hypreal_of_real_isUb_iff setge_def)  | 
|
192  | 
done  | 
|
193  | 
||
194  | 
lemma hypreal_of_real_isLub2:  | 
|
195  | 
"isLub (UNIV :: real set) Q Y  | 
|
196  | 
==> isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)"  | 
|
197  | 
apply (simp add: isLub_def leastP_def)  | 
|
198  | 
apply (auto simp add: hypreal_of_real_isUb_iff setge_def)  | 
|
199  | 
apply (frule_tac x2 = x in isUbD2a [THEN SReal_iff [THEN iffD1], THEN exE])  | 
|
200  | 
prefer 2 apply assumption  | 
|
201  | 
apply (drule_tac x = xa in spec)  | 
|
202  | 
apply (auto simp add: hypreal_of_real_isUb_iff)  | 
|
203  | 
done  | 
|
204  | 
||
205  | 
lemma hypreal_of_real_isLub_iff: "(isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)) =  | 
|
206  | 
(isLub (UNIV :: real set) Q Y)"  | 
|
207  | 
apply (blast intro: hypreal_of_real_isLub1 hypreal_of_real_isLub2)  | 
|
208  | 
done  | 
|
209  | 
||
210  | 
(* lemmas *)  | 
|
211  | 
lemma lemma_isUb_hypreal_of_real:  | 
|
212  | 
"isUb Reals P Y ==> \<exists>Yo. isUb Reals P (hypreal_of_real Yo)"  | 
|
213  | 
by (auto simp add: SReal_iff isUb_def)  | 
|
214  | 
||
215  | 
lemma lemma_isLub_hypreal_of_real:  | 
|
216  | 
"isLub Reals P Y ==> \<exists>Yo. isLub Reals P (hypreal_of_real Yo)"  | 
|
217  | 
by (auto simp add: isLub_def leastP_def isUb_def SReal_iff)  | 
|
218  | 
||
219  | 
lemma lemma_isLub_hypreal_of_real2:  | 
|
220  | 
"\<exists>Yo. isLub Reals P (hypreal_of_real Yo) ==> \<exists>Y. isLub Reals P Y"  | 
|
221  | 
by (auto simp add: isLub_def leastP_def isUb_def)  | 
|
222  | 
||
223  | 
lemma SReal_complete: "[| P <= Reals; \<exists>x. x \<in> P; \<exists>Y. isUb Reals P Y |]  | 
|
224  | 
==> \<exists>t::hypreal. isLub Reals P t"  | 
|
225  | 
apply (frule SReal_hypreal_of_real_image)  | 
|
226  | 
apply (auto, drule lemma_isUb_hypreal_of_real)  | 
|
227  | 
apply (auto intro!: reals_complete lemma_isLub_hypreal_of_real2 simp add: hypreal_of_real_isLub_iff hypreal_of_real_isUb_iff)  | 
|
228  | 
done  | 
|
229  | 
||
230  | 
(*--------------------------------------------------------------------  | 
|
231  | 
Set of finite elements is a subring of the extended reals  | 
|
232  | 
--------------------------------------------------------------------*)  | 
|
233  | 
lemma HFinite_add: "[|x \<in> HFinite; y \<in> HFinite|] ==> (x+y) \<in> HFinite"  | 
|
234  | 
apply (simp add: HFinite_def)  | 
|
235  | 
apply (blast intro!: SReal_add hrabs_add_less)  | 
|
236  | 
done  | 
|
237  | 
||
238  | 
lemma HFinite_mult: "[|x \<in> HFinite; y \<in> HFinite|] ==> x*y \<in> HFinite"  | 
|
239  | 
apply (simp add: HFinite_def)  | 
|
240  | 
apply (blast intro!: SReal_mult abs_mult_less)  | 
|
241  | 
done  | 
|
242  | 
||
243  | 
lemma HFinite_minus_iff: "(-x \<in> HFinite) = (x \<in> HFinite)"  | 
|
244  | 
by (simp add: HFinite_def)  | 
|
245  | 
||
246  | 
lemma SReal_subset_HFinite: "Reals <= HFinite"  | 
|
247  | 
apply (auto simp add: SReal_def HFinite_def)  | 
|
248  | 
apply (rule_tac x = "1 + abs (hypreal_of_real r) " in exI)  | 
|
249  | 
apply (auto simp add: hypreal_of_real_hrabs)  | 
|
250  | 
apply (rule_tac x = "1 + abs r" in exI, simp)  | 
|
251  | 
done  | 
|
252  | 
||
253  | 
lemma HFinite_hypreal_of_real [simp]: "hypreal_of_real x \<in> HFinite"  | 
|
254  | 
by (auto intro: SReal_subset_HFinite [THEN subsetD])  | 
|
255  | 
||
256  | 
lemma HFiniteD: "x \<in> HFinite ==> \<exists>t \<in> Reals. abs x < t"  | 
|
257  | 
by (simp add: HFinite_def)  | 
|
258  | 
||
259  | 
lemma HFinite_hrabs_iff: "(abs x \<in> HFinite) = (x \<in> HFinite)"  | 
|
260  | 
by (simp add: HFinite_def)  | 
|
261  | 
declare HFinite_hrabs_iff [iff]  | 
|
262  | 
||
263  | 
lemma HFinite_number_of: "number_of w \<in> HFinite"  | 
|
264  | 
by (rule SReal_number_of [THEN SReal_subset_HFinite [THEN subsetD]])  | 
|
265  | 
declare HFinite_number_of [simp]  | 
|
266  | 
||
267  | 
(** As always with numerals, 0 and 1 are special cases **)  | 
|
268  | 
||
269  | 
lemma HFinite_0: "0 \<in> HFinite"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
270  | 
apply (subst numeral_0_eq_0 [symmetric])  | 
| 14370 | 271  | 
apply (rule HFinite_number_of)  | 
272  | 
done  | 
|
273  | 
declare HFinite_0 [simp]  | 
|
274  | 
||
275  | 
lemma HFinite_1: "1 \<in> HFinite"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
276  | 
apply (subst numeral_1_eq_1 [symmetric])  | 
| 14370 | 277  | 
apply (rule HFinite_number_of)  | 
278  | 
done  | 
|
279  | 
declare HFinite_1 [simp]  | 
|
280  | 
||
281  | 
lemma HFinite_bounded: "[|x \<in> HFinite; y <= x; 0 <= y |] ==> y \<in> HFinite"  | 
|
282  | 
apply (case_tac "x <= 0")  | 
|
283  | 
apply (drule_tac y = x in order_trans)  | 
|
284  | 
apply (drule_tac [2] hypreal_le_anti_sym)  | 
|
285  | 
apply (auto simp add: linorder_not_le)  | 
|
286  | 
apply (auto intro: order_le_less_trans simp add: abs_if HFinite_def)  | 
|
287  | 
done  | 
|
288  | 
||
289  | 
(*------------------------------------------------------------------  | 
|
290  | 
Set of infinitesimals is a subring of the hyperreals  | 
|
291  | 
------------------------------------------------------------------*)  | 
|
292  | 
lemma InfinitesimalD:  | 
|
293  | 
"x \<in> Infinitesimal ==> \<forall>r \<in> Reals. 0 < r --> abs x < r"  | 
|
294  | 
apply (simp add: Infinitesimal_def)  | 
|
295  | 
done  | 
|
296  | 
||
297  | 
lemma Infinitesimal_zero: "0 \<in> Infinitesimal"  | 
|
298  | 
by (simp add: Infinitesimal_def)  | 
|
299  | 
declare Infinitesimal_zero [iff]  | 
|
300  | 
||
301  | 
lemma hypreal_sum_of_halves: "x/(2::hypreal) + x/(2::hypreal) = x"  | 
|
302  | 
by auto  | 
|
303  | 
||
304  | 
lemma hypreal_half_gt_zero: "0 < r ==> 0 < r/(2::hypreal)"  | 
|
305  | 
by auto  | 
|
306  | 
||
307  | 
lemma Infinitesimal_add:  | 
|
308  | 
"[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> (x+y) \<in> Infinitesimal"  | 
|
309  | 
apply (auto simp add: Infinitesimal_def)  | 
|
310  | 
apply (rule hypreal_sum_of_halves [THEN subst])  | 
|
311  | 
apply (drule hypreal_half_gt_zero)  | 
|
312  | 
apply (blast intro: hrabs_add_less hrabs_add_less SReal_divide_number_of)  | 
|
313  | 
done  | 
|
314  | 
||
315  | 
lemma Infinitesimal_minus_iff: "(-x:Infinitesimal) = (x:Infinitesimal)"  | 
|
316  | 
by (simp add: Infinitesimal_def)  | 
|
317  | 
declare Infinitesimal_minus_iff [simp]  | 
|
318  | 
||
319  | 
lemma Infinitesimal_diff: "[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> x-y \<in> Infinitesimal"  | 
|
320  | 
by (simp add: hypreal_diff_def Infinitesimal_add)  | 
|
321  | 
||
322  | 
lemma Infinitesimal_mult:  | 
|
323  | 
"[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> (x * y) \<in> Infinitesimal"  | 
|
324  | 
apply (auto simp add: Infinitesimal_def)  | 
|
325  | 
apply (case_tac "y=0")  | 
|
326  | 
apply (cut_tac [2] a = "abs x" and b = 1 and c = "abs y" and d = r in mult_strict_mono, auto)  | 
|
327  | 
done  | 
|
328  | 
||
329  | 
lemma Infinitesimal_HFinite_mult: "[| x \<in> Infinitesimal; y \<in> HFinite |] ==> (x * y) \<in> Infinitesimal"  | 
|
330  | 
apply (auto dest!: HFiniteD simp add: Infinitesimal_def)  | 
|
331  | 
apply (frule hrabs_less_gt_zero)  | 
|
332  | 
apply (drule_tac x = "r/t" in bspec)  | 
|
333  | 
apply (blast intro: SReal_divide)  | 
|
334  | 
apply (simp add: zero_less_divide_iff)  | 
|
335  | 
apply (case_tac "x=0 | y=0")  | 
|
336  | 
apply (cut_tac [2] a = "abs x" and b = "r/t" and c = "abs y" in mult_strict_mono)  | 
|
337  | 
apply (auto simp add: zero_less_divide_iff)  | 
|
338  | 
done  | 
|
339  | 
||
340  | 
lemma Infinitesimal_HFinite_mult2: "[| x \<in> Infinitesimal; y \<in> HFinite |] ==> (y * x) \<in> Infinitesimal"  | 
|
341  | 
by (auto dest: Infinitesimal_HFinite_mult simp add: hypreal_mult_commute)  | 
|
342  | 
||
343  | 
(*** rather long proof ***)  | 
|
344  | 
lemma HInfinite_inverse_Infinitesimal:  | 
|
345  | 
"x \<in> HInfinite ==> inverse x: Infinitesimal"  | 
|
346  | 
apply (auto simp add: HInfinite_def Infinitesimal_def)  | 
|
347  | 
apply (erule_tac x = "inverse r" in ballE)  | 
|
348  | 
apply (frule_tac a1 = r and z = "abs x" in positive_imp_inverse_positive [THEN order_less_trans], assumption)  | 
|
349  | 
apply (drule inverse_inverse_eq [symmetric, THEN subst])  | 
|
350  | 
apply (rule inverse_less_iff_less [THEN iffD1])  | 
|
351  | 
apply (auto simp add: SReal_inverse)  | 
|
352  | 
done  | 
|
353  | 
||
354  | 
||
355  | 
||
356  | 
lemma HInfinite_mult: "[|x \<in> HInfinite;y \<in> HInfinite|] ==> (x*y) \<in> HInfinite"  | 
|
357  | 
apply (simp add: HInfinite_def, auto)  | 
|
358  | 
apply (erule_tac x = 1 in ballE)  | 
|
359  | 
apply (erule_tac x = r in ballE)  | 
|
360  | 
apply (case_tac "y=0")  | 
|
361  | 
apply (cut_tac [2] c = 1 and d = "abs x" and a = r and b = "abs y" in mult_strict_mono)  | 
|
362  | 
apply (auto simp add: mult_ac)  | 
|
363  | 
done  | 
|
364  | 
||
365  | 
lemma HInfinite_add_ge_zero:  | 
|
366  | 
"[|x \<in> HInfinite; 0 <= y; 0 <= x|] ==> (x + y): HInfinite"  | 
|
367  | 
by (auto intro!: hypreal_add_zero_less_le_mono  | 
|
368  | 
simp add: abs_if hypreal_add_commute hypreal_le_add_order HInfinite_def)  | 
|
369  | 
||
370  | 
lemma HInfinite_add_ge_zero2: "[|x \<in> HInfinite; 0 <= y; 0 <= x|] ==> (y + x): HInfinite"  | 
|
371  | 
by (auto intro!: HInfinite_add_ge_zero simp add: hypreal_add_commute)  | 
|
372  | 
||
373  | 
lemma HInfinite_add_gt_zero: "[|x \<in> HInfinite; 0 < y; 0 < x|] ==> (x + y): HInfinite"  | 
|
374  | 
by (blast intro: HInfinite_add_ge_zero order_less_imp_le)  | 
|
375  | 
||
376  | 
lemma HInfinite_minus_iff: "(-x \<in> HInfinite) = (x \<in> HInfinite)"  | 
|
377  | 
by (simp add: HInfinite_def)  | 
|
378  | 
||
379  | 
lemma HInfinite_add_le_zero: "[|x \<in> HInfinite; y <= 0; x <= 0|] ==> (x + y): HInfinite"  | 
|
380  | 
apply (drule HInfinite_minus_iff [THEN iffD2])  | 
|
381  | 
apply (rule HInfinite_minus_iff [THEN iffD1])  | 
|
382  | 
apply (auto intro: HInfinite_add_ge_zero)  | 
|
383  | 
done  | 
|
384  | 
||
385  | 
lemma HInfinite_add_lt_zero: "[|x \<in> HInfinite; y < 0; x < 0|] ==> (x + y): HInfinite"  | 
|
386  | 
by (blast intro: HInfinite_add_le_zero order_less_imp_le)  | 
|
387  | 
||
388  | 
lemma HFinite_sum_squares: "[|a: HFinite; b: HFinite; c: HFinite|]  | 
|
389  | 
==> a*a + b*b + c*c \<in> HFinite"  | 
|
390  | 
apply (auto intro: HFinite_mult HFinite_add)  | 
|
391  | 
done  | 
|
392  | 
||
393  | 
lemma not_Infinitesimal_not_zero: "x \<notin> Infinitesimal ==> x \<noteq> 0"  | 
|
394  | 
by auto  | 
|
395  | 
||
396  | 
lemma not_Infinitesimal_not_zero2: "x \<in> HFinite - Infinitesimal ==> x \<noteq> 0"  | 
|
397  | 
by auto  | 
|
398  | 
||
399  | 
lemma Infinitesimal_hrabs_iff: "(abs x \<in> Infinitesimal) = (x \<in> Infinitesimal)"  | 
|
400  | 
by (auto simp add: hrabs_def)  | 
|
401  | 
declare Infinitesimal_hrabs_iff [iff]  | 
|
402  | 
||
403  | 
lemma HFinite_diff_Infinitesimal_hrabs: "x \<in> HFinite - Infinitesimal ==> abs x \<in> HFinite - Infinitesimal"  | 
|
404  | 
by blast  | 
|
405  | 
||
406  | 
lemma hrabs_less_Infinitesimal:  | 
|
407  | 
"[| e \<in> Infinitesimal; abs x < e |] ==> x \<in> Infinitesimal"  | 
|
408  | 
apply (auto simp add: Infinitesimal_def abs_less_iff)  | 
|
409  | 
done  | 
|
410  | 
||
411  | 
lemma hrabs_le_Infinitesimal: "[| e \<in> Infinitesimal; abs x <= e |] ==> x \<in> Infinitesimal"  | 
|
412  | 
by (blast dest: order_le_imp_less_or_eq intro: hrabs_less_Infinitesimal)  | 
|
413  | 
||
414  | 
lemma Infinitesimal_interval:  | 
|
415  | 
"[| e \<in> Infinitesimal; e' \<in> Infinitesimal; e' < x ; x < e |]  | 
|
416  | 
==> x \<in> Infinitesimal"  | 
|
417  | 
apply (auto simp add: Infinitesimal_def abs_less_iff)  | 
|
418  | 
done  | 
|
419  | 
||
420  | 
lemma Infinitesimal_interval2: "[| e \<in> Infinitesimal; e' \<in> Infinitesimal;  | 
|
421  | 
e' <= x ; x <= e |] ==> x \<in> Infinitesimal"  | 
|
422  | 
apply (auto intro: Infinitesimal_interval simp add: order_le_less)  | 
|
423  | 
done  | 
|
424  | 
||
425  | 
lemma not_Infinitesimal_mult:  | 
|
426  | 
"[| x \<notin> Infinitesimal; y \<notin> Infinitesimal|] ==> (x*y) \<notin>Infinitesimal"  | 
|
427  | 
apply (unfold Infinitesimal_def, clarify)  | 
|
428  | 
apply (simp add: linorder_not_less)  | 
|
429  | 
apply (erule_tac x = "r*ra" in ballE)  | 
|
430  | 
prefer 2 apply (fast intro: SReal_mult)  | 
|
431  | 
apply (auto simp add: zero_less_mult_iff)  | 
|
432  | 
apply (cut_tac c = ra and d = "abs y" and a = r and b = "abs x" in mult_mono, auto)  | 
|
433  | 
done  | 
|
434  | 
||
435  | 
lemma Infinitesimal_mult_disj: "x*y \<in> Infinitesimal ==> x \<in> Infinitesimal | y \<in> Infinitesimal"  | 
|
436  | 
apply (rule ccontr)  | 
|
437  | 
apply (drule de_Morgan_disj [THEN iffD1])  | 
|
438  | 
apply (fast dest: not_Infinitesimal_mult)  | 
|
439  | 
done  | 
|
440  | 
||
441  | 
lemma HFinite_Infinitesimal_not_zero: "x \<in> HFinite-Infinitesimal ==> x \<noteq> 0"  | 
|
442  | 
by blast  | 
|
443  | 
||
444  | 
lemma HFinite_Infinitesimal_diff_mult: "[| x \<in> HFinite - Infinitesimal;  | 
|
445  | 
y \<in> HFinite - Infinitesimal  | 
|
446  | 
|] ==> (x*y) \<in> HFinite - Infinitesimal"  | 
|
447  | 
apply clarify  | 
|
448  | 
apply (blast dest: HFinite_mult not_Infinitesimal_mult)  | 
|
449  | 
done  | 
|
450  | 
||
451  | 
lemma Infinitesimal_subset_HFinite:  | 
|
452  | 
"Infinitesimal <= HFinite"  | 
|
453  | 
apply (simp add: Infinitesimal_def HFinite_def, auto)  | 
|
454  | 
apply (rule_tac x = 1 in bexI, auto)  | 
|
455  | 
done  | 
|
456  | 
||
457  | 
lemma Infinitesimal_hypreal_of_real_mult: "x \<in> Infinitesimal ==> x * hypreal_of_real r \<in> Infinitesimal"  | 
|
458  | 
by (erule HFinite_hypreal_of_real [THEN [2] Infinitesimal_HFinite_mult])  | 
|
459  | 
||
460  | 
lemma Infinitesimal_hypreal_of_real_mult2: "x \<in> Infinitesimal ==> hypreal_of_real r * x \<in> Infinitesimal"  | 
|
461  | 
by (erule HFinite_hypreal_of_real [THEN [2] Infinitesimal_HFinite_mult2])  | 
|
462  | 
||
463  | 
(*----------------------------------------------------------------------  | 
|
464  | 
Infinitely close relation @=  | 
|
465  | 
----------------------------------------------------------------------*)  | 
|
466  | 
||
467  | 
lemma mem_infmal_iff: "(x \<in> Infinitesimal) = (x @= 0)"  | 
|
468  | 
by (simp add: Infinitesimal_def approx_def)  | 
|
469  | 
||
470  | 
lemma approx_minus_iff: " (x @= y) = (x + -y @= 0)"  | 
|
471  | 
by (simp add: approx_def)  | 
|
472  | 
||
473  | 
lemma approx_minus_iff2: " (x @= y) = (-y + x @= 0)"  | 
|
474  | 
by (simp add: approx_def hypreal_add_commute)  | 
|
475  | 
||
476  | 
lemma approx_refl: "x @= x"  | 
|
477  | 
by (simp add: approx_def Infinitesimal_def)  | 
|
478  | 
declare approx_refl [iff]  | 
|
479  | 
||
480  | 
lemma approx_sym: "x @= y ==> y @= x"  | 
|
481  | 
apply (simp add: approx_def)  | 
|
482  | 
apply (rule hypreal_minus_distrib1 [THEN subst])  | 
|
483  | 
apply (erule Infinitesimal_minus_iff [THEN iffD2])  | 
|
484  | 
done  | 
|
485  | 
||
486  | 
lemma approx_trans: "[| x @= y; y @= z |] ==> x @= z"  | 
|
487  | 
apply (simp add: approx_def)  | 
|
488  | 
apply (drule Infinitesimal_add, assumption, auto)  | 
|
489  | 
done  | 
|
490  | 
||
491  | 
lemma approx_trans2: "[| r @= x; s @= x |] ==> r @= s"  | 
|
492  | 
by (blast intro: approx_sym approx_trans)  | 
|
493  | 
||
494  | 
lemma approx_trans3: "[| x @= r; x @= s|] ==> r @= s"  | 
|
495  | 
by (blast intro: approx_sym approx_trans)  | 
|
496  | 
||
497  | 
lemma number_of_approx_reorient: "(number_of w @= x) = (x @= number_of w)"  | 
|
498  | 
by (blast intro: approx_sym)  | 
|
499  | 
||
500  | 
lemma zero_approx_reorient: "(0 @= x) = (x @= 0)"  | 
|
501  | 
by (blast intro: approx_sym)  | 
|
502  | 
||
503  | 
lemma one_approx_reorient: "(1 @= x) = (x @= 1)"  | 
|
504  | 
by (blast intro: approx_sym)  | 
|
| 10751 | 505  | 
|
506  | 
||
| 14370 | 507  | 
ML  | 
508  | 
{*
 | 
|
509  | 
val SReal_add = thm "SReal_add";  | 
|
510  | 
val SReal_mult = thm "SReal_mult";  | 
|
511  | 
val SReal_inverse = thm "SReal_inverse";  | 
|
512  | 
val SReal_divide = thm "SReal_divide";  | 
|
513  | 
val SReal_minus = thm "SReal_minus";  | 
|
514  | 
val SReal_minus_iff = thm "SReal_minus_iff";  | 
|
515  | 
val SReal_add_cancel = thm "SReal_add_cancel";  | 
|
516  | 
val SReal_hrabs = thm "SReal_hrabs";  | 
|
517  | 
val SReal_hypreal_of_real = thm "SReal_hypreal_of_real";  | 
|
518  | 
val SReal_number_of = thm "SReal_number_of";  | 
|
519  | 
val Reals_0 = thm "Reals_0";  | 
|
520  | 
val Reals_1 = thm "Reals_1";  | 
|
521  | 
val SReal_divide_number_of = thm "SReal_divide_number_of";  | 
|
522  | 
val SReal_epsilon_not_mem = thm "SReal_epsilon_not_mem";  | 
|
523  | 
val SReal_omega_not_mem = thm "SReal_omega_not_mem";  | 
|
524  | 
val SReal_UNIV_real = thm "SReal_UNIV_real";  | 
|
525  | 
val SReal_iff = thm "SReal_iff";  | 
|
526  | 
val hypreal_of_real_image = thm "hypreal_of_real_image";  | 
|
527  | 
val inv_hypreal_of_real_image = thm "inv_hypreal_of_real_image";  | 
|
528  | 
val SReal_hypreal_of_real_image = thm "SReal_hypreal_of_real_image";  | 
|
529  | 
val SReal_dense = thm "SReal_dense";  | 
|
530  | 
val SReal_sup_lemma = thm "SReal_sup_lemma";  | 
|
531  | 
val SReal_sup_lemma2 = thm "SReal_sup_lemma2";  | 
|
532  | 
val hypreal_of_real_isUb_iff = thm "hypreal_of_real_isUb_iff";  | 
|
533  | 
val hypreal_of_real_isLub1 = thm "hypreal_of_real_isLub1";  | 
|
534  | 
val hypreal_of_real_isLub2 = thm "hypreal_of_real_isLub2";  | 
|
535  | 
val hypreal_of_real_isLub_iff = thm "hypreal_of_real_isLub_iff";  | 
|
536  | 
val lemma_isUb_hypreal_of_real = thm "lemma_isUb_hypreal_of_real";  | 
|
537  | 
val lemma_isLub_hypreal_of_real = thm "lemma_isLub_hypreal_of_real";  | 
|
538  | 
val lemma_isLub_hypreal_of_real2 = thm "lemma_isLub_hypreal_of_real2";  | 
|
539  | 
val SReal_complete = thm "SReal_complete";  | 
|
540  | 
val HFinite_add = thm "HFinite_add";  | 
|
541  | 
val HFinite_mult = thm "HFinite_mult";  | 
|
542  | 
val HFinite_minus_iff = thm "HFinite_minus_iff";  | 
|
543  | 
val SReal_subset_HFinite = thm "SReal_subset_HFinite";  | 
|
544  | 
val HFinite_hypreal_of_real = thm "HFinite_hypreal_of_real";  | 
|
545  | 
val HFiniteD = thm "HFiniteD";  | 
|
546  | 
val HFinite_hrabs_iff = thm "HFinite_hrabs_iff";  | 
|
547  | 
val HFinite_number_of = thm "HFinite_number_of";  | 
|
548  | 
val HFinite_0 = thm "HFinite_0";  | 
|
549  | 
val HFinite_1 = thm "HFinite_1";  | 
|
550  | 
val HFinite_bounded = thm "HFinite_bounded";  | 
|
551  | 
val InfinitesimalD = thm "InfinitesimalD";  | 
|
552  | 
val Infinitesimal_zero = thm "Infinitesimal_zero";  | 
|
553  | 
val hypreal_sum_of_halves = thm "hypreal_sum_of_halves";  | 
|
554  | 
val hypreal_half_gt_zero = thm "hypreal_half_gt_zero";  | 
|
555  | 
val Infinitesimal_add = thm "Infinitesimal_add";  | 
|
556  | 
val Infinitesimal_minus_iff = thm "Infinitesimal_minus_iff";  | 
|
557  | 
val Infinitesimal_diff = thm "Infinitesimal_diff";  | 
|
558  | 
val Infinitesimal_mult = thm "Infinitesimal_mult";  | 
|
559  | 
val Infinitesimal_HFinite_mult = thm "Infinitesimal_HFinite_mult";  | 
|
560  | 
val Infinitesimal_HFinite_mult2 = thm "Infinitesimal_HFinite_mult2";  | 
|
561  | 
val HInfinite_inverse_Infinitesimal = thm "HInfinite_inverse_Infinitesimal";  | 
|
562  | 
val HInfinite_mult = thm "HInfinite_mult";  | 
|
563  | 
val HInfinite_add_ge_zero = thm "HInfinite_add_ge_zero";  | 
|
564  | 
val HInfinite_add_ge_zero2 = thm "HInfinite_add_ge_zero2";  | 
|
565  | 
val HInfinite_add_gt_zero = thm "HInfinite_add_gt_zero";  | 
|
566  | 
val HInfinite_minus_iff = thm "HInfinite_minus_iff";  | 
|
567  | 
val HInfinite_add_le_zero = thm "HInfinite_add_le_zero";  | 
|
568  | 
val HInfinite_add_lt_zero = thm "HInfinite_add_lt_zero";  | 
|
569  | 
val HFinite_sum_squares = thm "HFinite_sum_squares";  | 
|
570  | 
val not_Infinitesimal_not_zero = thm "not_Infinitesimal_not_zero";  | 
|
571  | 
val not_Infinitesimal_not_zero2 = thm "not_Infinitesimal_not_zero2";  | 
|
572  | 
val Infinitesimal_hrabs_iff = thm "Infinitesimal_hrabs_iff";  | 
|
573  | 
val HFinite_diff_Infinitesimal_hrabs = thm "HFinite_diff_Infinitesimal_hrabs";  | 
|
574  | 
val hrabs_less_Infinitesimal = thm "hrabs_less_Infinitesimal";  | 
|
575  | 
val hrabs_le_Infinitesimal = thm "hrabs_le_Infinitesimal";  | 
|
576  | 
val Infinitesimal_interval = thm "Infinitesimal_interval";  | 
|
577  | 
val Infinitesimal_interval2 = thm "Infinitesimal_interval2";  | 
|
578  | 
val not_Infinitesimal_mult = thm "not_Infinitesimal_mult";  | 
|
579  | 
val Infinitesimal_mult_disj = thm "Infinitesimal_mult_disj";  | 
|
580  | 
val HFinite_Infinitesimal_not_zero = thm "HFinite_Infinitesimal_not_zero";  | 
|
581  | 
val HFinite_Infinitesimal_diff_mult = thm "HFinite_Infinitesimal_diff_mult";  | 
|
582  | 
val Infinitesimal_subset_HFinite = thm "Infinitesimal_subset_HFinite";  | 
|
583  | 
val Infinitesimal_hypreal_of_real_mult = thm "Infinitesimal_hypreal_of_real_mult";  | 
|
584  | 
val Infinitesimal_hypreal_of_real_mult2 = thm "Infinitesimal_hypreal_of_real_mult2";  | 
|
585  | 
val mem_infmal_iff = thm "mem_infmal_iff";  | 
|
586  | 
val approx_minus_iff = thm "approx_minus_iff";  | 
|
587  | 
val approx_minus_iff2 = thm "approx_minus_iff2";  | 
|
588  | 
val approx_refl = thm "approx_refl";  | 
|
589  | 
val approx_sym = thm "approx_sym";  | 
|
590  | 
val approx_trans = thm "approx_trans";  | 
|
591  | 
val approx_trans2 = thm "approx_trans2";  | 
|
592  | 
val approx_trans3 = thm "approx_trans3";  | 
|
593  | 
val number_of_approx_reorient = thm "number_of_approx_reorient";  | 
|
594  | 
val zero_approx_reorient = thm "zero_approx_reorient";  | 
|
595  | 
val one_approx_reorient = thm "one_approx_reorient";  | 
|
596  | 
||
597  | 
(*** re-orientation, following HOL/Integ/Bin.ML  | 
|
598  | 
We re-orient x @=y where x is 0, 1 or a numeral, unless y is as well!  | 
|
599  | 
***)  | 
|
600  | 
||
601  | 
(*reorientation simprules using ==, for the following simproc*)  | 
|
602  | 
val meta_zero_approx_reorient = zero_approx_reorient RS eq_reflection;  | 
|
603  | 
val meta_one_approx_reorient = one_approx_reorient RS eq_reflection;  | 
|
604  | 
val meta_number_of_approx_reorient = number_of_approx_reorient RS eq_reflection  | 
|
605  | 
||
606  | 
(*reorientation simplification procedure: reorients (polymorphic)  | 
|
607  | 
0 = x, 1 = x, nnn = x provided x isn't 0, 1 or a numeral.*)  | 
|
608  | 
fun reorient_proc sg _ (_ $ t $ u) =  | 
|
609  | 
case u of  | 
|
610  | 
      Const("0", _) => None
 | 
|
611  | 
    | Const("1", _) => None
 | 
|
612  | 
    | Const("Numeral.number_of", _) $ _ => None
 | 
|
613  | 
| _ => Some (case t of  | 
|
614  | 
                Const("0", _) => meta_zero_approx_reorient
 | 
|
615  | 
              | Const("1", _) => meta_one_approx_reorient
 | 
|
616  | 
              | Const("Numeral.number_of", _) $ _ =>
 | 
|
617  | 
meta_number_of_approx_reorient);  | 
|
618  | 
||
619  | 
val approx_reorient_simproc =  | 
|
620  | 
Bin_Simprocs.prep_simproc  | 
|
621  | 
    ("reorient_simproc", ["0@=x", "1@=x", "number_of w @= x"], reorient_proc);
 | 
|
622  | 
||
623  | 
Addsimprocs [approx_reorient_simproc];  | 
|
624  | 
*}  | 
|
625  | 
||
626  | 
lemma Infinitesimal_approx_minus: "(x-y \<in> Infinitesimal) = (x @= y)"  | 
|
627  | 
by (auto simp add: hypreal_diff_def approx_minus_iff [symmetric] mem_infmal_iff)  | 
|
628  | 
||
629  | 
lemma approx_monad_iff: "(x @= y) = (monad(x)=monad(y))"  | 
|
630  | 
apply (simp add: monad_def)  | 
|
631  | 
apply (auto dest: approx_sym elim!: approx_trans equalityCE)  | 
|
632  | 
done  | 
|
633  | 
||
634  | 
lemma Infinitesimal_approx: "[| x \<in> Infinitesimal; y \<in> Infinitesimal |] ==> x @= y"  | 
|
635  | 
apply (simp add: mem_infmal_iff)  | 
|
636  | 
apply (blast intro: approx_trans approx_sym)  | 
|
637  | 
done  | 
|
638  | 
||
639  | 
lemma approx_add: "[| a @= b; c @= d |] ==> a+c @= b+d"  | 
|
640  | 
proof (unfold approx_def)  | 
|
641  | 
assume inf: "a + - b \<in> Infinitesimal" "c + - d \<in> Infinitesimal"  | 
|
642  | 
have "a + c + - (b + d) = (a + - b) + (c + - d)" by arith  | 
|
643  | 
also have "... \<in> Infinitesimal" using inf by (rule Infinitesimal_add)  | 
|
644  | 
finally show "a + c + - (b + d) \<in> Infinitesimal" .  | 
|
645  | 
qed  | 
|
646  | 
||
647  | 
lemma approx_minus: "a @= b ==> -a @= -b"  | 
|
648  | 
apply (rule approx_minus_iff [THEN iffD2, THEN approx_sym])  | 
|
649  | 
apply (drule approx_minus_iff [THEN iffD1])  | 
|
650  | 
apply (simp (no_asm) add: hypreal_add_commute)  | 
|
651  | 
done  | 
|
652  | 
||
653  | 
lemma approx_minus2: "-a @= -b ==> a @= b"  | 
|
654  | 
by (auto dest: approx_minus)  | 
|
655  | 
||
656  | 
lemma approx_minus_cancel: "(-a @= -b) = (a @= b)"  | 
|
657  | 
by (blast intro: approx_minus approx_minus2)  | 
|
658  | 
||
659  | 
declare approx_minus_cancel [simp]  | 
|
660  | 
||
661  | 
lemma approx_add_minus: "[| a @= b; c @= d |] ==> a + -c @= b + -d"  | 
|
662  | 
by (blast intro!: approx_add approx_minus)  | 
|
663  | 
||
664  | 
lemma approx_mult1: "[| a @= b; c: HFinite|] ==> a*c @= b*c"  | 
|
665  | 
by (simp add: approx_def Infinitesimal_HFinite_mult minus_mult_left  | 
|
666  | 
left_distrib [symmetric]  | 
|
667  | 
del: minus_mult_left [symmetric])  | 
|
668  | 
||
669  | 
lemma approx_mult2: "[|a @= b; c: HFinite|] ==> c*a @= c*b"  | 
|
670  | 
apply (simp (no_asm_simp) add: approx_mult1 hypreal_mult_commute)  | 
|
671  | 
done  | 
|
672  | 
||
673  | 
lemma approx_mult_subst: "[|u @= v*x; x @= y; v \<in> HFinite|] ==> u @= v*y"  | 
|
674  | 
by (blast intro: approx_mult2 approx_trans)  | 
|
675  | 
||
676  | 
lemma approx_mult_subst2: "[| u @= x*v; x @= y; v \<in> HFinite |] ==> u @= y*v"  | 
|
677  | 
by (blast intro: approx_mult1 approx_trans)  | 
|
678  | 
||
679  | 
lemma approx_mult_subst_SReal: "[| u @= x*hypreal_of_real v; x @= y |] ==> u @= y*hypreal_of_real v"  | 
|
680  | 
by (auto intro: approx_mult_subst2)  | 
|
681  | 
||
682  | 
lemma approx_eq_imp: "a = b ==> a @= b"  | 
|
683  | 
by (simp add: approx_def)  | 
|
684  | 
||
685  | 
lemma Infinitesimal_minus_approx: "x \<in> Infinitesimal ==> -x @= x"  | 
|
686  | 
by (blast intro: Infinitesimal_minus_iff [THEN iffD2]  | 
|
687  | 
mem_infmal_iff [THEN iffD1] approx_trans2)  | 
|
688  | 
||
689  | 
lemma bex_Infinitesimal_iff: "(\<exists>y \<in> Infinitesimal. x + -z = y) = (x @= z)"  | 
|
690  | 
by (simp add: approx_def)  | 
|
691  | 
||
692  | 
lemma bex_Infinitesimal_iff2: "(\<exists>y \<in> Infinitesimal. x = z + y) = (x @= z)"  | 
|
693  | 
by (force simp add: bex_Infinitesimal_iff [symmetric])  | 
|
694  | 
||
695  | 
lemma Infinitesimal_add_approx: "[| y \<in> Infinitesimal; x + y = z |] ==> x @= z"  | 
|
696  | 
apply (rule bex_Infinitesimal_iff [THEN iffD1])  | 
|
697  | 
apply (drule Infinitesimal_minus_iff [THEN iffD2])  | 
|
698  | 
apply (auto simp add: minus_add_distrib hypreal_add_assoc [symmetric])  | 
|
699  | 
done  | 
|
700  | 
||
701  | 
lemma Infinitesimal_add_approx_self: "y \<in> Infinitesimal ==> x @= x + y"  | 
|
702  | 
apply (rule bex_Infinitesimal_iff [THEN iffD1])  | 
|
703  | 
apply (drule Infinitesimal_minus_iff [THEN iffD2])  | 
|
704  | 
apply (auto simp add: minus_add_distrib hypreal_add_assoc [symmetric])  | 
|
705  | 
done  | 
|
706  | 
||
707  | 
lemma Infinitesimal_add_approx_self2: "y \<in> Infinitesimal ==> x @= y + x"  | 
|
708  | 
by (auto dest: Infinitesimal_add_approx_self simp add: hypreal_add_commute)  | 
|
709  | 
||
710  | 
lemma Infinitesimal_add_minus_approx_self: "y \<in> Infinitesimal ==> x @= x + -y"  | 
|
711  | 
by (blast intro!: Infinitesimal_add_approx_self Infinitesimal_minus_iff [THEN iffD2])  | 
|
712  | 
||
713  | 
lemma Infinitesimal_add_cancel: "[| y \<in> Infinitesimal; x+y @= z|] ==> x @= z"  | 
|
714  | 
apply (drule_tac x = x in Infinitesimal_add_approx_self [THEN approx_sym])  | 
|
715  | 
apply (erule approx_trans3 [THEN approx_sym], assumption)  | 
|
716  | 
done  | 
|
717  | 
||
718  | 
lemma Infinitesimal_add_right_cancel: "[| y \<in> Infinitesimal; x @= z + y|] ==> x @= z"  | 
|
719  | 
apply (drule_tac x = z in Infinitesimal_add_approx_self2 [THEN approx_sym])  | 
|
720  | 
apply (erule approx_trans3 [THEN approx_sym])  | 
|
721  | 
apply (simp add: hypreal_add_commute)  | 
|
722  | 
apply (erule approx_sym)  | 
|
723  | 
done  | 
|
724  | 
||
725  | 
lemma approx_add_left_cancel: "d + b @= d + c ==> b @= c"  | 
|
726  | 
apply (drule approx_minus_iff [THEN iffD1])  | 
|
727  | 
apply (simp add: minus_add_distrib approx_minus_iff [symmetric] add_ac)  | 
|
728  | 
done  | 
|
729  | 
||
730  | 
lemma approx_add_right_cancel: "b + d @= c + d ==> b @= c"  | 
|
731  | 
apply (rule approx_add_left_cancel)  | 
|
732  | 
apply (simp add: hypreal_add_commute)  | 
|
733  | 
done  | 
|
734  | 
||
735  | 
lemma approx_add_mono1: "b @= c ==> d + b @= d + c"  | 
|
736  | 
apply (rule approx_minus_iff [THEN iffD2])  | 
|
737  | 
apply (simp add: minus_add_distrib approx_minus_iff [symmetric] add_ac)  | 
|
738  | 
done  | 
|
739  | 
||
740  | 
lemma approx_add_mono2: "b @= c ==> b + a @= c + a"  | 
|
741  | 
apply (simp (no_asm_simp) add: hypreal_add_commute approx_add_mono1)  | 
|
742  | 
done  | 
|
743  | 
||
744  | 
lemma approx_add_left_iff: "(a + b @= a + c) = (b @= c)"  | 
|
745  | 
by (fast elim: approx_add_left_cancel approx_add_mono1)  | 
|
746  | 
||
747  | 
declare approx_add_left_iff [simp]  | 
|
748  | 
||
749  | 
lemma approx_add_right_iff: "(b + a @= c + a) = (b @= c)"  | 
|
750  | 
apply (simp (no_asm) add: hypreal_add_commute)  | 
|
751  | 
done  | 
|
752  | 
||
753  | 
declare approx_add_right_iff [simp]  | 
|
754  | 
||
755  | 
lemma approx_HFinite: "[| x \<in> HFinite; x @= y |] ==> y \<in> HFinite"  | 
|
756  | 
apply (drule bex_Infinitesimal_iff2 [THEN iffD2], safe)  | 
|
757  | 
apply (drule Infinitesimal_subset_HFinite [THEN subsetD, THEN HFinite_minus_iff [THEN iffD2]])  | 
|
758  | 
apply (drule HFinite_add)  | 
|
759  | 
apply (auto simp add: hypreal_add_assoc)  | 
|
760  | 
done  | 
|
761  | 
||
762  | 
lemma approx_hypreal_of_real_HFinite: "x @= hypreal_of_real D ==> x \<in> HFinite"  | 
|
763  | 
by (rule approx_sym [THEN [2] approx_HFinite], auto)  | 
|
764  | 
||
765  | 
lemma approx_mult_HFinite: "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d"  | 
|
766  | 
apply (rule approx_trans)  | 
|
767  | 
apply (rule_tac [2] approx_mult2)  | 
|
768  | 
apply (rule approx_mult1)  | 
|
769  | 
prefer 2 apply (blast intro: approx_HFinite approx_sym, auto)  | 
|
770  | 
done  | 
|
771  | 
||
772  | 
lemma approx_mult_hypreal_of_real: "[|a @= hypreal_of_real b; c @= hypreal_of_real d |]  | 
|
773  | 
==> a*c @= hypreal_of_real b*hypreal_of_real d"  | 
|
774  | 
apply (blast intro!: approx_mult_HFinite approx_hypreal_of_real_HFinite HFinite_hypreal_of_real)  | 
|
775  | 
done  | 
|
776  | 
||
777  | 
lemma approx_SReal_mult_cancel_zero: "[| a \<in> Reals; a \<noteq> 0; a*x @= 0 |] ==> x @= 0"  | 
|
778  | 
apply (drule SReal_inverse [THEN SReal_subset_HFinite [THEN subsetD]])  | 
|
779  | 
apply (auto dest: approx_mult2 simp add: hypreal_mult_assoc [symmetric])  | 
|
780  | 
done  | 
|
781  | 
||
782  | 
(* REM comments: newly added *)  | 
|
783  | 
lemma approx_mult_SReal1: "[| a \<in> Reals; x @= 0 |] ==> x*a @= 0"  | 
|
784  | 
by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult1)  | 
|
785  | 
||
786  | 
lemma approx_mult_SReal2: "[| a \<in> Reals; x @= 0 |] ==> a*x @= 0"  | 
|
787  | 
by (auto dest: SReal_subset_HFinite [THEN subsetD] approx_mult2)  | 
|
788  | 
||
789  | 
lemma approx_mult_SReal_zero_cancel_iff: "[|a \<in> Reals; a \<noteq> 0 |] ==> (a*x @= 0) = (x @= 0)"  | 
|
790  | 
by (blast intro: approx_SReal_mult_cancel_zero approx_mult_SReal2)  | 
|
791  | 
declare approx_mult_SReal_zero_cancel_iff [simp]  | 
|
792  | 
||
793  | 
lemma approx_SReal_mult_cancel: "[| a \<in> Reals; a \<noteq> 0; a* w @= a*z |] ==> w @= z"  | 
|
794  | 
apply (drule SReal_inverse [THEN SReal_subset_HFinite [THEN subsetD]])  | 
|
795  | 
apply (auto dest: approx_mult2 simp add: hypreal_mult_assoc [symmetric])  | 
|
796  | 
done  | 
|
797  | 
||
798  | 
lemma approx_SReal_mult_cancel_iff1: "[| a \<in> Reals; a \<noteq> 0|] ==> (a* w @= a*z) = (w @= z)"  | 
|
799  | 
by (auto intro!: approx_mult2 SReal_subset_HFinite [THEN subsetD] intro: approx_SReal_mult_cancel)  | 
|
800  | 
declare approx_SReal_mult_cancel_iff1 [simp]  | 
|
801  | 
||
802  | 
lemma approx_le_bound: "[| z <= f; f @= g; g <= z |] ==> f @= z"  | 
|
803  | 
apply (simp add: bex_Infinitesimal_iff2 [symmetric], auto)  | 
|
804  | 
apply (rule_tac x = "g+y-z" in bexI)  | 
|
805  | 
apply (simp (no_asm))  | 
|
806  | 
apply (rule Infinitesimal_interval2)  | 
|
807  | 
apply (rule_tac [2] Infinitesimal_zero, auto)  | 
|
808  | 
done  | 
|
809  | 
||
810  | 
(*-----------------------------------------------------------------  | 
|
811  | 
Zero is the only infinitesimal that is also a real  | 
|
812  | 
-----------------------------------------------------------------*)  | 
|
813  | 
||
814  | 
lemma Infinitesimal_less_SReal:  | 
|
815  | 
"[| x \<in> Reals; y \<in> Infinitesimal; 0 < x |] ==> y < x"  | 
|
816  | 
apply (simp add: Infinitesimal_def)  | 
|
817  | 
apply (rule abs_ge_self [THEN order_le_less_trans], auto)  | 
|
818  | 
done  | 
|
819  | 
||
820  | 
lemma Infinitesimal_less_SReal2: "y \<in> Infinitesimal ==> \<forall>r \<in> Reals. 0 < r --> y < r"  | 
|
821  | 
by (blast intro: Infinitesimal_less_SReal)  | 
|
822  | 
||
823  | 
lemma SReal_not_Infinitesimal:  | 
|
824  | 
"[| 0 < y; y \<in> Reals|] ==> y \<notin> Infinitesimal"  | 
|
825  | 
apply (simp add: Infinitesimal_def)  | 
|
826  | 
apply (auto simp add: hrabs_def)  | 
|
827  | 
done  | 
|
828  | 
||
829  | 
lemma SReal_minus_not_Infinitesimal: "[| y < 0; y \<in> Reals |] ==> y \<notin> Infinitesimal"  | 
|
830  | 
apply (subst Infinitesimal_minus_iff [symmetric])  | 
|
831  | 
apply (rule SReal_not_Infinitesimal, auto)  | 
|
832  | 
done  | 
|
833  | 
||
834  | 
lemma SReal_Int_Infinitesimal_zero: "Reals Int Infinitesimal = {0}"
 | 
|
835  | 
apply auto  | 
|
836  | 
apply (cut_tac x = x and y = 0 in linorder_less_linear)  | 
|
837  | 
apply (blast dest: SReal_not_Infinitesimal SReal_minus_not_Infinitesimal)  | 
|
838  | 
done  | 
|
839  | 
||
840  | 
lemma SReal_Infinitesimal_zero: "[| x \<in> Reals; x \<in> Infinitesimal|] ==> x = 0"  | 
|
841  | 
by (cut_tac SReal_Int_Infinitesimal_zero, blast)  | 
|
842  | 
||
843  | 
lemma SReal_HFinite_diff_Infinitesimal: "[| x \<in> Reals; x \<noteq> 0 |] ==> x \<in> HFinite - Infinitesimal"  | 
|
844  | 
by (auto dest: SReal_Infinitesimal_zero SReal_subset_HFinite [THEN subsetD])  | 
|
845  | 
||
846  | 
lemma hypreal_of_real_HFinite_diff_Infinitesimal: "hypreal_of_real x \<noteq> 0 ==> hypreal_of_real x \<in> HFinite - Infinitesimal"  | 
|
847  | 
by (rule SReal_HFinite_diff_Infinitesimal, auto)  | 
|
848  | 
||
849  | 
lemma hypreal_of_real_Infinitesimal_iff_0: "(hypreal_of_real x \<in> Infinitesimal) = (x=0)"  | 
|
850  | 
apply auto  | 
|
851  | 
apply (rule ccontr)  | 
|
852  | 
apply (rule hypreal_of_real_HFinite_diff_Infinitesimal [THEN DiffD2], auto)  | 
|
853  | 
done  | 
|
854  | 
declare hypreal_of_real_Infinitesimal_iff_0 [iff]  | 
|
855  | 
||
856  | 
lemma number_of_not_Infinitesimal: "number_of w \<noteq> (0::hypreal) ==> number_of w \<notin> Infinitesimal"  | 
|
857  | 
by (fast dest: SReal_number_of [THEN SReal_Infinitesimal_zero])  | 
|
858  | 
declare number_of_not_Infinitesimal [simp]  | 
|
859  | 
||
860  | 
(*again: 1 is a special case, but not 0 this time*)  | 
|
861  | 
lemma one_not_Infinitesimal: "1 \<notin> Infinitesimal"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
862  | 
apply (subst numeral_1_eq_1 [symmetric])  | 
| 14370 | 863  | 
apply (rule number_of_not_Infinitesimal)  | 
864  | 
apply (simp (no_asm))  | 
|
865  | 
done  | 
|
866  | 
declare one_not_Infinitesimal [simp]  | 
|
867  | 
||
868  | 
lemma approx_SReal_not_zero: "[| y \<in> Reals; x @= y; y\<noteq> 0 |] ==> x \<noteq> 0"  | 
|
869  | 
apply (cut_tac x = 0 and y = y in linorder_less_linear, simp)  | 
|
870  | 
apply (blast dest: approx_sym [THEN mem_infmal_iff [THEN iffD2]] SReal_not_Infinitesimal SReal_minus_not_Infinitesimal)  | 
|
871  | 
done  | 
|
872  | 
||
873  | 
lemma HFinite_diff_Infinitesimal_approx: "[| x @= y; y \<in> HFinite - Infinitesimal |]  | 
|
874  | 
==> x \<in> HFinite - Infinitesimal"  | 
|
875  | 
apply (auto intro: approx_sym [THEN [2] approx_HFinite]  | 
|
876  | 
simp add: mem_infmal_iff)  | 
|
877  | 
apply (drule approx_trans3, assumption)  | 
|
878  | 
apply (blast dest: approx_sym)  | 
|
879  | 
done  | 
|
880  | 
||
881  | 
(*The premise y\<noteq>0 is essential; otherwise x/y =0 and we lose the  | 
|
882  | 
HFinite premise.*)  | 
|
883  | 
lemma Infinitesimal_ratio: "[| y \<noteq> 0; y \<in> Infinitesimal; x/y \<in> HFinite |] ==> x \<in> Infinitesimal"  | 
|
884  | 
apply (drule Infinitesimal_HFinite_mult2, assumption)  | 
|
885  | 
apply (simp add: hypreal_divide_def hypreal_mult_assoc)  | 
|
886  | 
done  | 
|
887  | 
||
888  | 
(*------------------------------------------------------------------  | 
|
889  | 
Standard Part Theorem: Every finite x: R* is infinitely  | 
|
890  | 
close to a unique real number (i.e a member of Reals)  | 
|
891  | 
------------------------------------------------------------------*)  | 
|
892  | 
(*------------------------------------------------------------------  | 
|
893  | 
Uniqueness: Two infinitely close reals are equal  | 
|
894  | 
------------------------------------------------------------------*)  | 
|
895  | 
||
896  | 
lemma SReal_approx_iff: "[|x \<in> Reals; y \<in> Reals|] ==> (x @= y) = (x = y)"  | 
|
897  | 
apply auto  | 
|
898  | 
apply (simp add: approx_def)  | 
|
899  | 
apply (drule_tac x = y in SReal_minus)  | 
|
900  | 
apply (drule SReal_add, assumption)  | 
|
901  | 
apply (drule SReal_Infinitesimal_zero, assumption)  | 
|
902  | 
apply (drule sym)  | 
|
903  | 
apply (simp add: hypreal_eq_minus_iff [symmetric])  | 
|
904  | 
done  | 
|
905  | 
||
906  | 
lemma number_of_approx_iff: "(number_of v @= number_of w) = (number_of v = (number_of w :: hypreal))"  | 
|
907  | 
by (auto simp add: SReal_approx_iff)  | 
|
908  | 
declare number_of_approx_iff [simp]  | 
|
909  | 
||
910  | 
(*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*)  | 
|
911  | 
lemma [simp]: "(0 @= number_of w) = ((number_of w :: hypreal) = 0)"  | 
|
912  | 
"(number_of w @= 0) = ((number_of w :: hypreal) = 0)"  | 
|
913  | 
"(1 @= number_of w) = ((number_of w :: hypreal) = 1)"  | 
|
914  | 
"(number_of w @= 1) = ((number_of w :: hypreal) = 1)"  | 
|
915  | 
"~ (0 @= 1)" "~ (1 @= 0)"  | 
|
916  | 
by (auto simp only: SReal_number_of SReal_approx_iff Reals_0 Reals_1)  | 
|
917  | 
||
918  | 
lemma hypreal_of_real_approx_iff: "(hypreal_of_real k @= hypreal_of_real m) = (k = m)"  | 
|
919  | 
apply auto  | 
|
920  | 
apply (rule inj_hypreal_of_real [THEN injD])  | 
|
921  | 
apply (rule SReal_approx_iff [THEN iffD1], auto)  | 
|
922  | 
done  | 
|
923  | 
declare hypreal_of_real_approx_iff [simp]  | 
|
924  | 
||
925  | 
lemma hypreal_of_real_approx_number_of_iff: "(hypreal_of_real k @= number_of w) = (k = number_of w)"  | 
|
926  | 
by (subst hypreal_of_real_approx_iff [symmetric], auto)  | 
|
927  | 
declare hypreal_of_real_approx_number_of_iff [simp]  | 
|
928  | 
||
929  | 
(*And also for 0 and 1.*)  | 
|
930  | 
(*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*)  | 
|
931  | 
lemma [simp]: "(hypreal_of_real k @= 0) = (k = 0)"  | 
|
932  | 
"(hypreal_of_real k @= 1) = (k = 1)"  | 
|
933  | 
by (simp_all add: hypreal_of_real_approx_iff [symmetric])  | 
|
934  | 
||
935  | 
lemma approx_unique_real: "[| r \<in> Reals; s \<in> Reals; r @= x; s @= x|] ==> r = s"  | 
|
936  | 
by (blast intro: SReal_approx_iff [THEN iffD1] approx_trans2)  | 
|
937  | 
||
938  | 
(*------------------------------------------------------------------  | 
|
939  | 
Existence of unique real infinitely close  | 
|
940  | 
------------------------------------------------------------------*)  | 
|
941  | 
(* lemma about lubs *)  | 
|
942  | 
lemma hypreal_isLub_unique:  | 
|
943  | 
"[| isLub R S x; isLub R S y |] ==> x = (y::hypreal)"  | 
|
944  | 
apply (frule isLub_isUb)  | 
|
945  | 
apply (frule_tac x = y in isLub_isUb)  | 
|
946  | 
apply (blast intro!: hypreal_le_anti_sym dest!: isLub_le_isUb)  | 
|
947  | 
done  | 
|
948  | 
||
949  | 
lemma lemma_st_part_ub: "x \<in> HFinite ==> \<exists>u. isUb Reals {s. s \<in> Reals & s < x} u"
 | 
|
950  | 
apply (drule HFiniteD, safe)  | 
|
951  | 
apply (rule exI, rule isUbI)  | 
|
952  | 
apply (auto intro: setleI isUbI simp add: abs_less_iff)  | 
|
953  | 
done  | 
|
954  | 
||
955  | 
lemma lemma_st_part_nonempty: "x \<in> HFinite ==> \<exists>y. y \<in> {s. s \<in> Reals & s < x}"
 | 
|
956  | 
apply (drule HFiniteD, safe)  | 
|
957  | 
apply (drule SReal_minus)  | 
|
958  | 
apply (rule_tac x = "-t" in exI)  | 
|
959  | 
apply (auto simp add: abs_less_iff)  | 
|
960  | 
done  | 
|
961  | 
||
962  | 
lemma lemma_st_part_subset: "{s. s \<in> Reals & s < x} <= Reals"
 | 
|
963  | 
by auto  | 
|
964  | 
||
965  | 
lemma lemma_st_part_lub: "x \<in> HFinite ==> \<exists>t. isLub Reals {s. s \<in> Reals & s < x} t"
 | 
|
966  | 
by (blast intro!: SReal_complete lemma_st_part_ub lemma_st_part_nonempty lemma_st_part_subset)  | 
|
967  | 
||
968  | 
lemma lemma_hypreal_le_left_cancel: "((t::hypreal) + r <= t) = (r <= 0)"  | 
|
969  | 
apply safe  | 
|
970  | 
apply (drule_tac c = "-t" in add_left_mono)  | 
|
971  | 
apply (drule_tac [2] c = t in add_left_mono)  | 
|
972  | 
apply (auto simp add: hypreal_add_assoc [symmetric])  | 
|
973  | 
done  | 
|
974  | 
||
975  | 
lemma lemma_st_part_le1: "[| x \<in> HFinite;  isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
976  | 
r \<in> Reals; 0 < r |] ==> x <= t + r"  | 
|
977  | 
apply (frule isLubD1a)  | 
|
978  | 
apply (rule ccontr, drule linorder_not_le [THEN iffD2])  | 
|
979  | 
apply (drule_tac x = t in SReal_add, assumption)  | 
|
980  | 
apply (drule_tac y = "t + r" in isLubD1 [THEN setleD], auto)  | 
|
981  | 
done  | 
|
982  | 
||
983  | 
lemma hypreal_setle_less_trans: "!!x::hypreal. [| S *<= x; x < y |] ==> S *<= y"  | 
|
984  | 
apply (simp add: setle_def)  | 
|
985  | 
apply (auto dest!: bspec order_le_less_trans intro: order_less_imp_le)  | 
|
986  | 
done  | 
|
987  | 
||
988  | 
lemma hypreal_gt_isUb:  | 
|
989  | 
"!!x::hypreal. [| isUb R S x; x < y; y \<in> R |] ==> isUb R S y"  | 
|
990  | 
apply (simp add: isUb_def)  | 
|
991  | 
apply (blast intro: hypreal_setle_less_trans)  | 
|
992  | 
done  | 
|
993  | 
||
994  | 
lemma lemma_st_part_gt_ub: "[| x \<in> HFinite; x < y; y \<in> Reals |]  | 
|
995  | 
               ==> isUb Reals {s. s \<in> Reals & s < x} y"
 | 
|
996  | 
apply (auto dest: order_less_trans intro: order_less_imp_le intro!: isUbI setleI)  | 
|
997  | 
done  | 
|
998  | 
||
999  | 
lemma lemma_minus_le_zero: "t <= t + -r ==> r <= (0::hypreal)"  | 
|
1000  | 
apply (drule_tac c = "-t" in add_left_mono)  | 
|
1001  | 
apply (auto simp add: hypreal_add_assoc [symmetric])  | 
|
1002  | 
done  | 
|
1003  | 
||
1004  | 
lemma lemma_st_part_le2: "[| x \<in> HFinite;  | 
|
1005  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1006  | 
r \<in> Reals; 0 < r |]  | 
|
1007  | 
==> t + -r <= x"  | 
|
1008  | 
apply (frule isLubD1a)  | 
|
1009  | 
apply (rule ccontr, drule linorder_not_le [THEN iffD1])  | 
|
1010  | 
apply (drule SReal_minus, drule_tac x = t in SReal_add, assumption)  | 
|
1011  | 
apply (drule lemma_st_part_gt_ub, assumption+)  | 
|
1012  | 
apply (drule isLub_le_isUb, assumption)  | 
|
1013  | 
apply (drule lemma_minus_le_zero)  | 
|
1014  | 
apply (auto dest: order_less_le_trans)  | 
|
1015  | 
done  | 
|
1016  | 
||
1017  | 
lemma lemma_hypreal_le_swap: "((x::hypreal) <= t + r) = (x + -t <= r)"  | 
|
1018  | 
by auto  | 
|
1019  | 
||
1020  | 
lemma lemma_st_part1a: "[| x \<in> HFinite;  | 
|
1021  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1022  | 
r \<in> Reals; 0 < r |]  | 
|
1023  | 
==> x + -t <= r"  | 
|
1024  | 
apply (blast intro!: lemma_hypreal_le_swap [THEN iffD1] lemma_st_part_le1)  | 
|
1025  | 
done  | 
|
1026  | 
||
1027  | 
lemma lemma_hypreal_le_swap2: "(t + -r <= x) = (-(x + -t) <= (r::hypreal))"  | 
|
1028  | 
by auto  | 
|
1029  | 
||
1030  | 
lemma lemma_st_part2a: "[| x \<in> HFinite;  | 
|
1031  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1032  | 
r \<in> Reals; 0 < r |]  | 
|
1033  | 
==> -(x + -t) <= r"  | 
|
1034  | 
apply (blast intro!: lemma_hypreal_le_swap2 [THEN iffD1] lemma_st_part_le2)  | 
|
1035  | 
done  | 
|
1036  | 
||
1037  | 
lemma lemma_SReal_ub: "(x::hypreal) \<in> Reals ==> isUb Reals {s. s \<in> Reals & s < x} x"
 | 
|
1038  | 
by (auto intro: isUbI setleI order_less_imp_le)  | 
|
1039  | 
||
1040  | 
lemma lemma_SReal_lub: "(x::hypreal) \<in> Reals ==> isLub Reals {s. s \<in> Reals & s < x} x"
 | 
|
1041  | 
apply (auto intro!: isLubI2 lemma_SReal_ub setgeI)  | 
|
1042  | 
apply (frule isUbD2a)  | 
|
1043  | 
apply (rule_tac x = x and y = y in linorder_cases)  | 
|
1044  | 
apply (auto intro!: order_less_imp_le)  | 
|
1045  | 
apply (drule SReal_dense, assumption, assumption, safe)  | 
|
1046  | 
apply (drule_tac y = r in isUbD)  | 
|
1047  | 
apply (auto dest: order_less_le_trans)  | 
|
1048  | 
done  | 
|
1049  | 
||
1050  | 
lemma lemma_st_part_not_eq1: "[| x \<in> HFinite;  | 
|
1051  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1052  | 
r \<in> Reals; 0 < r |]  | 
|
1053  | 
==> x + -t \<noteq> r"  | 
|
1054  | 
apply auto  | 
|
1055  | 
apply (frule isLubD1a [THEN SReal_minus])  | 
|
1056  | 
apply (drule SReal_add_cancel, assumption)  | 
|
1057  | 
apply (drule_tac x = x in lemma_SReal_lub)  | 
|
1058  | 
apply (drule hypreal_isLub_unique, assumption, auto)  | 
|
1059  | 
done  | 
|
1060  | 
||
1061  | 
lemma lemma_st_part_not_eq2: "[| x \<in> HFinite;  | 
|
1062  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1063  | 
r \<in> Reals; 0 < r |]  | 
|
1064  | 
==> -(x + -t) \<noteq> r"  | 
|
1065  | 
apply (auto simp add: minus_add_distrib)  | 
|
1066  | 
apply (frule isLubD1a)  | 
|
1067  | 
apply (drule SReal_add_cancel, assumption)  | 
|
1068  | 
apply (drule_tac x = "-x" in SReal_minus, simp)  | 
|
1069  | 
apply (drule_tac x = x in lemma_SReal_lub)  | 
|
1070  | 
apply (drule hypreal_isLub_unique, assumption, auto)  | 
|
1071  | 
done  | 
|
1072  | 
||
1073  | 
lemma lemma_st_part_major: "[| x \<in> HFinite;  | 
|
1074  | 
         isLub Reals {s. s \<in> Reals & s < x} t;
 | 
|
1075  | 
r \<in> Reals; 0 < r |]  | 
|
1076  | 
==> abs (x + -t) < r"  | 
|
1077  | 
apply (frule lemma_st_part1a)  | 
|
1078  | 
apply (frule_tac [4] lemma_st_part2a, auto)  | 
|
1079  | 
apply (drule order_le_imp_less_or_eq)+  | 
|
1080  | 
apply (auto dest: lemma_st_part_not_eq1 lemma_st_part_not_eq2 simp add: abs_less_iff)  | 
|
1081  | 
done  | 
|
1082  | 
||
1083  | 
lemma lemma_st_part_major2: "[| x \<in> HFinite;  | 
|
1084  | 
         isLub Reals {s. s \<in> Reals & s < x} t |]
 | 
|
1085  | 
==> \<forall>r \<in> Reals. 0 < r --> abs (x + -t) < r"  | 
|
1086  | 
apply (blast dest!: lemma_st_part_major)  | 
|
1087  | 
done  | 
|
1088  | 
||
1089  | 
(*----------------------------------------------  | 
|
1090  | 
Existence of real and Standard Part Theorem  | 
|
1091  | 
----------------------------------------------*)  | 
|
1092  | 
lemma lemma_st_part_Ex: "x \<in> HFinite ==>  | 
|
1093  | 
\<exists>t \<in> Reals. \<forall>r \<in> Reals. 0 < r --> abs (x + -t) < r"  | 
|
1094  | 
apply (frule lemma_st_part_lub, safe)  | 
|
1095  | 
apply (frule isLubD1a)  | 
|
1096  | 
apply (blast dest: lemma_st_part_major2)  | 
|
1097  | 
done  | 
|
1098  | 
||
1099  | 
lemma st_part_Ex:  | 
|
1100  | 
"x \<in> HFinite ==> \<exists>t \<in> Reals. x @= t"  | 
|
1101  | 
apply (simp add: approx_def Infinitesimal_def)  | 
|
1102  | 
apply (drule lemma_st_part_Ex, auto)  | 
|
1103  | 
done  | 
|
1104  | 
||
1105  | 
(*--------------------------------  | 
|
1106  | 
Unique real infinitely close  | 
|
1107  | 
-------------------------------*)  | 
|
1108  | 
lemma st_part_Ex1: "x \<in> HFinite ==> EX! t. t \<in> Reals & x @= t"  | 
|
1109  | 
apply (drule st_part_Ex, safe)  | 
|
1110  | 
apply (drule_tac [2] approx_sym, drule_tac [2] approx_sym, drule_tac [2] approx_sym)  | 
|
1111  | 
apply (auto intro!: approx_unique_real)  | 
|
1112  | 
done  | 
|
1113  | 
||
1114  | 
(*------------------------------------------------------------------  | 
|
1115  | 
Finite and Infinite --- more theorems  | 
|
1116  | 
------------------------------------------------------------------*)  | 
|
1117  | 
||
1118  | 
lemma HFinite_Int_HInfinite_empty: "HFinite Int HInfinite = {}"
 | 
|
1119  | 
||
1120  | 
apply (simp add: HFinite_def HInfinite_def)  | 
|
1121  | 
apply (auto dest: order_less_trans)  | 
|
1122  | 
done  | 
|
1123  | 
declare HFinite_Int_HInfinite_empty [simp]  | 
|
1124  | 
||
1125  | 
lemma HFinite_not_HInfinite:  | 
|
1126  | 
assumes x: "x \<in> HFinite" shows "x \<notin> HInfinite"  | 
|
1127  | 
proof  | 
|
1128  | 
assume x': "x \<in> HInfinite"  | 
|
1129  | 
with x have "x \<in> HFinite \<inter> HInfinite" by blast  | 
|
1130  | 
thus False by auto  | 
|
1131  | 
qed  | 
|
1132  | 
||
1133  | 
lemma not_HFinite_HInfinite: "x\<notin> HFinite ==> x \<in> HInfinite"  | 
|
1134  | 
apply (simp add: HInfinite_def HFinite_def, auto)  | 
|
1135  | 
apply (drule_tac x = "r + 1" in bspec)  | 
|
1136  | 
apply (auto simp add: SReal_add)  | 
|
1137  | 
done  | 
|
1138  | 
||
1139  | 
lemma HInfinite_HFinite_disj: "x \<in> HInfinite | x \<in> HFinite"  | 
|
1140  | 
by (blast intro: not_HFinite_HInfinite)  | 
|
1141  | 
||
1142  | 
lemma HInfinite_HFinite_iff: "(x \<in> HInfinite) = (x \<notin> HFinite)"  | 
|
1143  | 
by (blast dest: HFinite_not_HInfinite not_HFinite_HInfinite)  | 
|
1144  | 
||
1145  | 
lemma HFinite_HInfinite_iff: "(x \<in> HFinite) = (x \<notin> HInfinite)"  | 
|
1146  | 
apply (simp (no_asm) add: HInfinite_HFinite_iff)  | 
|
1147  | 
done  | 
|
1148  | 
||
1149  | 
(*------------------------------------------------------------------  | 
|
1150  | 
Finite, Infinite and Infinitesimal --- more theorems  | 
|
1151  | 
------------------------------------------------------------------*)  | 
|
1152  | 
||
1153  | 
lemma HInfinite_diff_HFinite_Infinitesimal_disj: "x \<notin> Infinitesimal ==> x \<in> HInfinite | x \<in> HFinite - Infinitesimal"  | 
|
1154  | 
by (fast intro: not_HFinite_HInfinite)  | 
|
1155  | 
||
1156  | 
lemma HFinite_inverse: "[| x \<in> HFinite; x \<notin> Infinitesimal |] ==> inverse x \<in> HFinite"  | 
|
1157  | 
apply (cut_tac x = "inverse x" in HInfinite_HFinite_disj)  | 
|
1158  | 
apply (auto dest!: HInfinite_inverse_Infinitesimal)  | 
|
1159  | 
done  | 
|
1160  | 
||
1161  | 
lemma HFinite_inverse2: "x \<in> HFinite - Infinitesimal ==> inverse x \<in> HFinite"  | 
|
1162  | 
by (blast intro: HFinite_inverse)  | 
|
1163  | 
||
1164  | 
(* stronger statement possible in fact *)  | 
|
1165  | 
lemma Infinitesimal_inverse_HFinite: "x \<notin> Infinitesimal ==> inverse(x) \<in> HFinite"  | 
|
1166  | 
apply (drule HInfinite_diff_HFinite_Infinitesimal_disj)  | 
|
1167  | 
apply (blast intro: HFinite_inverse HInfinite_inverse_Infinitesimal Infinitesimal_subset_HFinite [THEN subsetD])  | 
|
1168  | 
done  | 
|
1169  | 
||
1170  | 
lemma HFinite_not_Infinitesimal_inverse: "x \<in> HFinite - Infinitesimal ==> inverse x \<in> HFinite - Infinitesimal"  | 
|
1171  | 
apply (auto intro: Infinitesimal_inverse_HFinite)  | 
|
1172  | 
apply (drule Infinitesimal_HFinite_mult2, assumption)  | 
|
1173  | 
apply (simp add: not_Infinitesimal_not_zero hypreal_mult_inverse)  | 
|
1174  | 
done  | 
|
1175  | 
||
1176  | 
lemma approx_inverse: "[| x @= y; y \<in> HFinite - Infinitesimal |]  | 
|
1177  | 
==> inverse x @= inverse y"  | 
|
1178  | 
apply (frule HFinite_diff_Infinitesimal_approx, assumption)  | 
|
1179  | 
apply (frule not_Infinitesimal_not_zero2)  | 
|
1180  | 
apply (frule_tac x = x in not_Infinitesimal_not_zero2)  | 
|
1181  | 
apply (drule HFinite_inverse2)+  | 
|
1182  | 
apply (drule approx_mult2, assumption, auto)  | 
|
1183  | 
apply (drule_tac c = "inverse x" in approx_mult1, assumption)  | 
|
1184  | 
apply (auto intro: approx_sym simp add: hypreal_mult_assoc)  | 
|
1185  | 
done  | 
|
1186  | 
||
1187  | 
(*Used for NSLIM_inverse, NSLIMSEQ_inverse*)  | 
|
1188  | 
lemmas hypreal_of_real_approx_inverse = hypreal_of_real_HFinite_diff_Infinitesimal [THEN [2] approx_inverse]  | 
|
1189  | 
||
1190  | 
lemma inverse_add_Infinitesimal_approx: "[| x \<in> HFinite - Infinitesimal;  | 
|
1191  | 
h \<in> Infinitesimal |] ==> inverse(x + h) @= inverse x"  | 
|
1192  | 
apply (auto intro: approx_inverse approx_sym Infinitesimal_add_approx_self)  | 
|
1193  | 
done  | 
|
1194  | 
||
1195  | 
lemma inverse_add_Infinitesimal_approx2: "[| x \<in> HFinite - Infinitesimal;  | 
|
1196  | 
h \<in> Infinitesimal |] ==> inverse(h + x) @= inverse x"  | 
|
1197  | 
apply (rule hypreal_add_commute [THEN subst])  | 
|
1198  | 
apply (blast intro: inverse_add_Infinitesimal_approx)  | 
|
1199  | 
done  | 
|
1200  | 
||
1201  | 
lemma inverse_add_Infinitesimal_approx_Infinitesimal: "[| x \<in> HFinite - Infinitesimal;  | 
|
1202  | 
h \<in> Infinitesimal |] ==> inverse(x + h) + -inverse x @= h"  | 
|
1203  | 
apply (rule approx_trans2)  | 
|
1204  | 
apply (auto intro: inverse_add_Infinitesimal_approx simp add: mem_infmal_iff approx_minus_iff [symmetric])  | 
|
1205  | 
done  | 
|
1206  | 
||
1207  | 
lemma Infinitesimal_square_iff: "(x \<in> Infinitesimal) = (x*x \<in> Infinitesimal)"  | 
|
1208  | 
apply (auto intro: Infinitesimal_mult)  | 
|
1209  | 
apply (rule ccontr, frule Infinitesimal_inverse_HFinite)  | 
|
1210  | 
apply (frule not_Infinitesimal_not_zero)  | 
|
1211  | 
apply (auto dest: Infinitesimal_HFinite_mult simp add: hypreal_mult_assoc)  | 
|
1212  | 
done  | 
|
1213  | 
declare Infinitesimal_square_iff [symmetric, simp]  | 
|
1214  | 
||
1215  | 
lemma HFinite_square_iff: "(x*x \<in> HFinite) = (x \<in> HFinite)"  | 
|
1216  | 
apply (auto intro: HFinite_mult)  | 
|
1217  | 
apply (auto dest: HInfinite_mult simp add: HFinite_HInfinite_iff)  | 
|
1218  | 
done  | 
|
1219  | 
declare HFinite_square_iff [simp]  | 
|
1220  | 
||
1221  | 
lemma HInfinite_square_iff: "(x*x \<in> HInfinite) = (x \<in> HInfinite)"  | 
|
1222  | 
by (auto simp add: HInfinite_HFinite_iff)  | 
|
1223  | 
declare HInfinite_square_iff [simp]  | 
|
1224  | 
||
1225  | 
lemma approx_HFinite_mult_cancel: "[| a: HFinite-Infinitesimal; a* w @= a*z |] ==> w @= z"  | 
|
1226  | 
apply safe  | 
|
1227  | 
apply (frule HFinite_inverse, assumption)  | 
|
1228  | 
apply (drule not_Infinitesimal_not_zero)  | 
|
1229  | 
apply (auto dest: approx_mult2 simp add: hypreal_mult_assoc [symmetric])  | 
|
1230  | 
done  | 
|
1231  | 
||
1232  | 
lemma approx_HFinite_mult_cancel_iff1: "a: HFinite-Infinitesimal ==> (a * w @= a * z) = (w @= z)"  | 
|
1233  | 
by (auto intro: approx_mult2 approx_HFinite_mult_cancel)  | 
|
1234  | 
||
1235  | 
lemma HInfinite_HFinite_add_cancel: "[| x + y \<in> HInfinite; y \<in> HFinite |] ==> x \<in> HInfinite"  | 
|
1236  | 
apply (rule ccontr)  | 
|
1237  | 
apply (drule HFinite_HInfinite_iff [THEN iffD2])  | 
|
1238  | 
apply (auto dest: HFinite_add simp add: HInfinite_HFinite_iff)  | 
|
1239  | 
done  | 
|
1240  | 
||
1241  | 
lemma HInfinite_HFinite_add: "[| x \<in> HInfinite; y \<in> HFinite |] ==> x + y \<in> HInfinite"  | 
|
1242  | 
apply (rule_tac y = "-y" in HInfinite_HFinite_add_cancel)  | 
|
1243  | 
apply (auto simp add: hypreal_add_assoc HFinite_minus_iff)  | 
|
1244  | 
done  | 
|
1245  | 
||
1246  | 
lemma HInfinite_ge_HInfinite: "[| x \<in> HInfinite; x <= y; 0 <= x |] ==> y \<in> HInfinite"  | 
|
1247  | 
by (auto intro: HFinite_bounded simp add: HInfinite_HFinite_iff)  | 
|
1248  | 
||
1249  | 
lemma Infinitesimal_inverse_HInfinite: "[| x \<in> Infinitesimal; x \<noteq> 0 |] ==> inverse x \<in> HInfinite"  | 
|
1250  | 
apply (rule ccontr, drule HFinite_HInfinite_iff [THEN iffD2])  | 
|
1251  | 
apply (auto dest: Infinitesimal_HFinite_mult2)  | 
|
1252  | 
done  | 
|
1253  | 
||
1254  | 
lemma HInfinite_HFinite_not_Infinitesimal_mult: "[| x \<in> HInfinite; y \<in> HFinite - Infinitesimal |]  | 
|
1255  | 
==> x * y \<in> HInfinite"  | 
|
1256  | 
apply (rule ccontr, drule HFinite_HInfinite_iff [THEN iffD2])  | 
|
1257  | 
apply (frule HFinite_Infinitesimal_not_zero)  | 
|
1258  | 
apply (drule HFinite_not_Infinitesimal_inverse)  | 
|
1259  | 
apply (safe, drule HFinite_mult)  | 
|
1260  | 
apply (auto simp add: hypreal_mult_assoc HFinite_HInfinite_iff)  | 
|
1261  | 
done  | 
|
1262  | 
||
1263  | 
lemma HInfinite_HFinite_not_Infinitesimal_mult2: "[| x \<in> HInfinite; y \<in> HFinite - Infinitesimal |]  | 
|
1264  | 
==> y * x \<in> HInfinite"  | 
|
1265  | 
apply (auto simp add: hypreal_mult_commute HInfinite_HFinite_not_Infinitesimal_mult)  | 
|
1266  | 
done  | 
|
1267  | 
||
1268  | 
lemma HInfinite_gt_SReal: "[| x \<in> HInfinite; 0 < x; y \<in> Reals |] ==> y < x"  | 
|
1269  | 
by (auto dest!: bspec simp add: HInfinite_def hrabs_def order_less_imp_le)  | 
|
1270  | 
||
1271  | 
lemma HInfinite_gt_zero_gt_one: "[| x \<in> HInfinite; 0 < x |] ==> 1 < x"  | 
|
1272  | 
by (auto intro: HInfinite_gt_SReal)  | 
|
1273  | 
||
1274  | 
||
1275  | 
lemma not_HInfinite_one: "1 \<notin> HInfinite"  | 
|
1276  | 
apply (simp (no_asm) add: HInfinite_HFinite_iff)  | 
|
1277  | 
done  | 
|
1278  | 
declare not_HInfinite_one [simp]  | 
|
1279  | 
||
1280  | 
(*------------------------------------------------------------------  | 
|
1281  | 
more about absolute value (hrabs)  | 
|
1282  | 
------------------------------------------------------------------*)  | 
|
1283  | 
||
1284  | 
lemma approx_hrabs_disj: "abs x @= x | abs x @= -x"  | 
|
1285  | 
by (cut_tac x = x in hrabs_disj, auto)  | 
|
1286  | 
||
1287  | 
(*------------------------------------------------------------------  | 
|
1288  | 
Theorems about monads  | 
|
1289  | 
------------------------------------------------------------------*)  | 
|
1290  | 
||
1291  | 
lemma monad_hrabs_Un_subset: "monad (abs x) <= monad(x) Un monad(-x)"  | 
|
1292  | 
by (rule_tac x1 = x in hrabs_disj [THEN disjE], auto)  | 
|
1293  | 
||
1294  | 
lemma Infinitesimal_monad_eq: "e \<in> Infinitesimal ==> monad (x+e) = monad x"  | 
|
1295  | 
by (fast intro!: Infinitesimal_add_approx_self [THEN approx_sym] approx_monad_iff [THEN iffD1])  | 
|
1296  | 
||
1297  | 
lemma mem_monad_iff: "(u \<in> monad x) = (-u \<in> monad (-x))"  | 
|
1298  | 
by (simp add: monad_def)  | 
|
1299  | 
||
1300  | 
lemma Infinitesimal_monad_zero_iff: "(x \<in> Infinitesimal) = (x \<in> monad 0)"  | 
|
1301  | 
by (auto intro: approx_sym simp add: monad_def mem_infmal_iff)  | 
|
1302  | 
||
1303  | 
lemma monad_zero_minus_iff: "(x \<in> monad 0) = (-x \<in> monad 0)"  | 
|
1304  | 
apply (simp (no_asm) add: Infinitesimal_monad_zero_iff [symmetric])  | 
|
1305  | 
done  | 
|
1306  | 
||
1307  | 
lemma monad_zero_hrabs_iff: "(x \<in> monad 0) = (abs x \<in> monad 0)"  | 
|
1308  | 
apply (rule_tac x1 = x in hrabs_disj [THEN disjE])  | 
|
1309  | 
apply (auto simp add: monad_zero_minus_iff [symmetric])  | 
|
1310  | 
done  | 
|
1311  | 
||
1312  | 
lemma mem_monad_self: "x \<in> monad x"  | 
|
1313  | 
by (simp add: monad_def)  | 
|
1314  | 
declare mem_monad_self [simp]  | 
|
1315  | 
||
1316  | 
(*------------------------------------------------------------------  | 
|
1317  | 
Proof that x @= y ==> abs x @= abs y  | 
|
1318  | 
------------------------------------------------------------------*)  | 
|
1319  | 
lemma approx_subset_monad: "x @= y ==> {x,y}<=monad x"
 | 
|
1320  | 
apply (simp (no_asm))  | 
|
1321  | 
apply (simp add: approx_monad_iff)  | 
|
1322  | 
done  | 
|
1323  | 
||
1324  | 
lemma approx_subset_monad2: "x @= y ==> {x,y}<=monad y"
 | 
|
1325  | 
apply (drule approx_sym)  | 
|
1326  | 
apply (fast dest: approx_subset_monad)  | 
|
1327  | 
done  | 
|
1328  | 
||
1329  | 
lemma mem_monad_approx: "u \<in> monad x ==> x @= u"  | 
|
1330  | 
by (simp add: monad_def)  | 
|
1331  | 
||
1332  | 
lemma approx_mem_monad: "x @= u ==> u \<in> monad x"  | 
|
1333  | 
by (simp add: monad_def)  | 
|
1334  | 
||
1335  | 
lemma approx_mem_monad2: "x @= u ==> x \<in> monad u"  | 
|
1336  | 
apply (simp add: monad_def)  | 
|
1337  | 
apply (blast intro!: approx_sym)  | 
|
1338  | 
done  | 
|
1339  | 
||
1340  | 
lemma approx_mem_monad_zero: "[| x @= y;x \<in> monad 0 |] ==> y \<in> monad 0"  | 
|
1341  | 
apply (drule mem_monad_approx)  | 
|
1342  | 
apply (fast intro: approx_mem_monad approx_trans)  | 
|
1343  | 
done  | 
|
1344  | 
||
1345  | 
lemma Infinitesimal_approx_hrabs: "[| x @= y; x \<in> Infinitesimal |] ==> abs x @= abs y"  | 
|
1346  | 
apply (drule Infinitesimal_monad_zero_iff [THEN iffD1])  | 
|
1347  | 
apply (blast intro: approx_mem_monad_zero monad_zero_hrabs_iff [THEN iffD1] mem_monad_approx approx_trans3)  | 
|
1348  | 
done  | 
|
1349  | 
||
1350  | 
lemma less_Infinitesimal_less: "[| 0 < x; x \<notin>Infinitesimal; e :Infinitesimal |] ==> e < x"  | 
|
1351  | 
apply (rule ccontr)  | 
|
1352  | 
apply (auto intro: Infinitesimal_zero [THEN [2] Infinitesimal_interval]  | 
|
1353  | 
dest!: order_le_imp_less_or_eq simp add: linorder_not_less)  | 
|
1354  | 
done  | 
|
1355  | 
||
1356  | 
lemma Ball_mem_monad_gt_zero: "[| 0 < x; x \<notin> Infinitesimal; u \<in> monad x |] ==> 0 < u"  | 
|
1357  | 
apply (drule mem_monad_approx [THEN approx_sym])  | 
|
1358  | 
apply (erule bex_Infinitesimal_iff2 [THEN iffD2, THEN bexE])  | 
|
1359  | 
apply (drule_tac e = "-xa" in less_Infinitesimal_less, auto)  | 
|
1360  | 
done  | 
|
1361  | 
||
1362  | 
lemma Ball_mem_monad_less_zero: "[| x < 0; x \<notin> Infinitesimal; u \<in> monad x |] ==> u < 0"  | 
|
1363  | 
apply (drule mem_monad_approx [THEN approx_sym])  | 
|
1364  | 
apply (erule bex_Infinitesimal_iff [THEN iffD2, THEN bexE])  | 
|
1365  | 
apply (cut_tac x = "-x" and e = xa in less_Infinitesimal_less, auto)  | 
|
1366  | 
done  | 
|
1367  | 
||
1368  | 
lemma lemma_approx_gt_zero: "[|0 < x; x \<notin> Infinitesimal; x @= y|] ==> 0 < y"  | 
|
1369  | 
by (blast dest: Ball_mem_monad_gt_zero approx_subset_monad)  | 
|
1370  | 
||
1371  | 
lemma lemma_approx_less_zero: "[|x < 0; x \<notin> Infinitesimal; x @= y|] ==> y < 0"  | 
|
1372  | 
by (blast dest: Ball_mem_monad_less_zero approx_subset_monad)  | 
|
1373  | 
||
1374  | 
lemma approx_hrabs1: "[| x @= y; x < 0; x \<notin> Infinitesimal |] ==> abs x @= abs y"  | 
|
1375  | 
apply (frule lemma_approx_less_zero)  | 
|
1376  | 
apply (assumption+)  | 
|
1377  | 
apply (simp add: abs_if)  | 
|
1378  | 
done  | 
|
1379  | 
||
1380  | 
lemma approx_hrabs2: "[| x @= y; 0 < x; x \<notin> Infinitesimal |] ==> abs x @= abs y"  | 
|
1381  | 
apply (frule lemma_approx_gt_zero)  | 
|
1382  | 
apply (assumption+)  | 
|
1383  | 
apply (simp add: abs_if)  | 
|
1384  | 
done  | 
|
1385  | 
||
1386  | 
lemma approx_hrabs: "x @= y ==> abs x @= abs y"  | 
|
1387  | 
apply (rule_tac Q = "x \<in> Infinitesimal" in excluded_middle [THEN disjE])  | 
|
1388  | 
apply (rule_tac x1 = x and y1 = 0 in linorder_less_linear [THEN disjE])  | 
|
1389  | 
apply (auto intro: approx_hrabs1 approx_hrabs2 Infinitesimal_approx_hrabs)  | 
|
1390  | 
done  | 
|
1391  | 
||
1392  | 
lemma approx_hrabs_zero_cancel: "abs(x) @= 0 ==> x @= 0"  | 
|
1393  | 
apply (cut_tac x = x in hrabs_disj)  | 
|
1394  | 
apply (auto dest: approx_minus)  | 
|
1395  | 
done  | 
|
1396  | 
||
1397  | 
lemma approx_hrabs_add_Infinitesimal: "e \<in> Infinitesimal ==> abs x @= abs(x+e)"  | 
|
1398  | 
by (fast intro: approx_hrabs Infinitesimal_add_approx_self)  | 
|
1399  | 
||
1400  | 
lemma approx_hrabs_add_minus_Infinitesimal: "e \<in> Infinitesimal ==> abs x @= abs(x + -e)"  | 
|
1401  | 
by (fast intro: approx_hrabs Infinitesimal_add_minus_approx_self)  | 
|
1402  | 
||
1403  | 
lemma hrabs_add_Infinitesimal_cancel: "[| e \<in> Infinitesimal; e' \<in> Infinitesimal;  | 
|
1404  | 
abs(x+e) = abs(y+e')|] ==> abs x @= abs y"  | 
|
1405  | 
apply (drule_tac x = x in approx_hrabs_add_Infinitesimal)  | 
|
1406  | 
apply (drule_tac x = y in approx_hrabs_add_Infinitesimal)  | 
|
1407  | 
apply (auto intro: approx_trans2)  | 
|
1408  | 
done  | 
|
1409  | 
||
1410  | 
lemma hrabs_add_minus_Infinitesimal_cancel: "[| e \<in> Infinitesimal; e' \<in> Infinitesimal;  | 
|
1411  | 
abs(x + -e) = abs(y + -e')|] ==> abs x @= abs y"  | 
|
1412  | 
apply (drule_tac x = x in approx_hrabs_add_minus_Infinitesimal)  | 
|
1413  | 
apply (drule_tac x = y in approx_hrabs_add_minus_Infinitesimal)  | 
|
1414  | 
apply (auto intro: approx_trans2)  | 
|
1415  | 
done  | 
|
1416  | 
||
1417  | 
lemma hypreal_less_minus_iff: "((x::hypreal) < y) = (0 < y + -x)"  | 
|
1418  | 
by arith  | 
|
| 10751 | 1419  | 
|
| 14370 | 1420  | 
(* interesting slightly counterintuitive theorem: necessary  | 
1421  | 
for proving that an open interval is an NS open set  | 
|
1422  | 
*)  | 
|
1423  | 
lemma Infinitesimal_add_hypreal_of_real_less:  | 
|
1424  | 
"[| x < y; u \<in> Infinitesimal |]  | 
|
1425  | 
==> hypreal_of_real x + u < hypreal_of_real y"  | 
|
1426  | 
apply (simp add: Infinitesimal_def)  | 
|
1427  | 
apply (drule_tac x = "hypreal_of_real y + -hypreal_of_real x" in bspec)  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1428  | 
apply (simp add: );  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1429  | 
apply (auto simp add: add_commute abs_less_iff SReal_add SReal_minus)  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1430  | 
apply (simp add: compare_rls)  | 
| 14370 | 1431  | 
done  | 
1432  | 
||
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1433  | 
lemma Infinitesimal_add_hrabs_hypreal_of_real_less:  | 
| 
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1434  | 
"[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |]  | 
| 14370 | 1435  | 
==> abs (hypreal_of_real r + x) < hypreal_of_real y"  | 
1436  | 
apply (drule_tac x = "hypreal_of_real r" in approx_hrabs_add_Infinitesimal)  | 
|
1437  | 
apply (drule approx_sym [THEN bex_Infinitesimal_iff2 [THEN iffD2]])  | 
|
1438  | 
apply (auto intro!: Infinitesimal_add_hypreal_of_real_less simp add: hypreal_of_real_hrabs)  | 
|
1439  | 
done  | 
|
1440  | 
||
1441  | 
lemma Infinitesimal_add_hrabs_hypreal_of_real_less2: "[| x \<in> Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |]  | 
|
1442  | 
==> abs (x + hypreal_of_real r) < hypreal_of_real y"  | 
|
1443  | 
apply (rule hypreal_add_commute [THEN subst])  | 
|
1444  | 
apply (erule Infinitesimal_add_hrabs_hypreal_of_real_less, assumption)  | 
|
1445  | 
done  | 
|
1446  | 
||
1447  | 
lemma hypreal_of_real_le_add_Infininitesimal_cancel: "[| u \<in> Infinitesimal; v \<in> Infinitesimal;  | 
|
1448  | 
hypreal_of_real x + u <= hypreal_of_real y + v |]  | 
|
1449  | 
==> hypreal_of_real x <= hypreal_of_real y"  | 
|
1450  | 
apply (simp add: linorder_not_less [symmetric], auto)  | 
|
1451  | 
apply (drule_tac u = "v-u" in Infinitesimal_add_hypreal_of_real_less)  | 
|
1452  | 
apply (auto simp add: Infinitesimal_diff)  | 
|
1453  | 
done  | 
|
1454  | 
||
1455  | 
lemma hypreal_of_real_le_add_Infininitesimal_cancel2: "[| u \<in> Infinitesimal; v \<in> Infinitesimal;  | 
|
1456  | 
hypreal_of_real x + u <= hypreal_of_real y + v |]  | 
|
1457  | 
==> x <= y"  | 
|
1458  | 
apply (blast intro!: hypreal_of_real_le_iff [THEN iffD1] hypreal_of_real_le_add_Infininitesimal_cancel)  | 
|
1459  | 
done  | 
|
1460  | 
||
1461  | 
lemma hypreal_of_real_less_Infinitesimal_le_zero: "[| hypreal_of_real x < e; e \<in> Infinitesimal |] ==> hypreal_of_real x <= 0"  | 
|
1462  | 
apply (rule linorder_not_less [THEN iffD1], safe)  | 
|
1463  | 
apply (drule Infinitesimal_interval)  | 
|
1464  | 
apply (drule_tac [4] SReal_hypreal_of_real [THEN SReal_Infinitesimal_zero], auto)  | 
|
1465  | 
done  | 
|
1466  | 
||
1467  | 
(*used once, in Lim/NSDERIV_inverse*)  | 
|
1468  | 
lemma Infinitesimal_add_not_zero: "[| h \<in> Infinitesimal; x \<noteq> 0 |] ==> hypreal_of_real x + h \<noteq> 0"  | 
|
1469  | 
apply auto  | 
|
1470  | 
apply (subgoal_tac "h = - hypreal_of_real x", auto)  | 
|
1471  | 
done  | 
|
1472  | 
||
1473  | 
lemma Infinitesimal_square_cancel: "x*x + y*y \<in> Infinitesimal ==> x*x \<in> Infinitesimal"  | 
|
1474  | 
apply (rule Infinitesimal_interval2)  | 
|
1475  | 
apply (rule_tac [3] zero_le_square, assumption)  | 
|
1476  | 
apply (auto simp add: zero_le_square)  | 
|
1477  | 
done  | 
|
1478  | 
declare Infinitesimal_square_cancel [simp]  | 
|
1479  | 
||
1480  | 
lemma HFinite_square_cancel: "x*x + y*y \<in> HFinite ==> x*x \<in> HFinite"  | 
|
1481  | 
apply (rule HFinite_bounded, assumption)  | 
|
1482  | 
apply (auto simp add: zero_le_square)  | 
|
1483  | 
done  | 
|
1484  | 
declare HFinite_square_cancel [simp]  | 
|
1485  | 
||
1486  | 
lemma Infinitesimal_square_cancel2: "x*x + y*y \<in> Infinitesimal ==> y*y \<in> Infinitesimal"  | 
|
1487  | 
apply (rule Infinitesimal_square_cancel)  | 
|
1488  | 
apply (rule hypreal_add_commute [THEN subst])  | 
|
1489  | 
apply (simp (no_asm))  | 
|
1490  | 
done  | 
|
1491  | 
declare Infinitesimal_square_cancel2 [simp]  | 
|
1492  | 
||
1493  | 
lemma HFinite_square_cancel2: "x*x + y*y \<in> HFinite ==> y*y \<in> HFinite"  | 
|
1494  | 
apply (rule HFinite_square_cancel)  | 
|
1495  | 
apply (rule hypreal_add_commute [THEN subst])  | 
|
1496  | 
apply (simp (no_asm))  | 
|
1497  | 
done  | 
|
1498  | 
declare HFinite_square_cancel2 [simp]  | 
|
1499  | 
||
1500  | 
lemma Infinitesimal_sum_square_cancel: "x*x + y*y + z*z \<in> Infinitesimal ==> x*x \<in> Infinitesimal"  | 
|
1501  | 
apply (rule Infinitesimal_interval2, assumption)  | 
|
1502  | 
apply (rule_tac [2] zero_le_square, simp)  | 
|
1503  | 
apply (insert zero_le_square [of y])  | 
|
1504  | 
apply (insert zero_le_square [of z], simp)  | 
|
1505  | 
done  | 
|
1506  | 
declare Infinitesimal_sum_square_cancel [simp]  | 
|
1507  | 
||
1508  | 
lemma HFinite_sum_square_cancel: "x*x + y*y + z*z \<in> HFinite ==> x*x \<in> HFinite"  | 
|
1509  | 
apply (rule HFinite_bounded, assumption)  | 
|
1510  | 
apply (rule_tac [2] zero_le_square)  | 
|
1511  | 
apply (insert zero_le_square [of y])  | 
|
1512  | 
apply (insert zero_le_square [of z], simp)  | 
|
1513  | 
done  | 
|
1514  | 
declare HFinite_sum_square_cancel [simp]  | 
|
1515  | 
||
1516  | 
lemma Infinitesimal_sum_square_cancel2: "y*y + x*x + z*z \<in> Infinitesimal ==> x*x \<in> Infinitesimal"  | 
|
1517  | 
apply (rule Infinitesimal_sum_square_cancel)  | 
|
1518  | 
apply (simp add: add_ac)  | 
|
1519  | 
done  | 
|
1520  | 
declare Infinitesimal_sum_square_cancel2 [simp]  | 
|
1521  | 
||
1522  | 
lemma HFinite_sum_square_cancel2: "y*y + x*x + z*z \<in> HFinite ==> x*x \<in> HFinite"  | 
|
1523  | 
apply (rule HFinite_sum_square_cancel)  | 
|
1524  | 
apply (simp add: add_ac)  | 
|
1525  | 
done  | 
|
1526  | 
declare HFinite_sum_square_cancel2 [simp]  | 
|
1527  | 
||
1528  | 
lemma Infinitesimal_sum_square_cancel3: "z*z + y*y + x*x \<in> Infinitesimal ==> x*x \<in> Infinitesimal"  | 
|
1529  | 
apply (rule Infinitesimal_sum_square_cancel)  | 
|
1530  | 
apply (simp add: add_ac)  | 
|
1531  | 
done  | 
|
1532  | 
declare Infinitesimal_sum_square_cancel3 [simp]  | 
|
1533  | 
||
1534  | 
lemma HFinite_sum_square_cancel3: "z*z + y*y + x*x \<in> HFinite ==> x*x \<in> HFinite"  | 
|
1535  | 
apply (rule HFinite_sum_square_cancel)  | 
|
1536  | 
apply (simp add: add_ac)  | 
|
1537  | 
done  | 
|
1538  | 
declare HFinite_sum_square_cancel3 [simp]  | 
|
1539  | 
||
1540  | 
lemma monad_hrabs_less: "[| y \<in> monad x; 0 < hypreal_of_real e |]  | 
|
1541  | 
==> abs (y + -x) < hypreal_of_real e"  | 
|
1542  | 
apply (drule mem_monad_approx [THEN approx_sym])  | 
|
1543  | 
apply (drule bex_Infinitesimal_iff [THEN iffD2])  | 
|
1544  | 
apply (auto dest!: InfinitesimalD)  | 
|
1545  | 
done  | 
|
1546  | 
||
1547  | 
lemma mem_monad_SReal_HFinite: "x \<in> monad (hypreal_of_real a) ==> x \<in> HFinite"  | 
|
1548  | 
apply (drule mem_monad_approx [THEN approx_sym])  | 
|
1549  | 
apply (drule bex_Infinitesimal_iff2 [THEN iffD2])  | 
|
1550  | 
apply (safe dest!: Infinitesimal_subset_HFinite [THEN subsetD])  | 
|
1551  | 
apply (erule SReal_hypreal_of_real [THEN SReal_subset_HFinite [THEN subsetD], THEN HFinite_add])  | 
|
1552  | 
done  | 
|
1553  | 
||
1554  | 
(*------------------------------------------------------------------  | 
|
1555  | 
Theorems about standard part  | 
|
1556  | 
------------------------------------------------------------------*)  | 
|
1557  | 
||
1558  | 
lemma st_approx_self: "x \<in> HFinite ==> st x @= x"  | 
|
1559  | 
apply (simp add: st_def)  | 
|
1560  | 
apply (frule st_part_Ex, safe)  | 
|
1561  | 
apply (rule someI2)  | 
|
1562  | 
apply (auto intro: approx_sym)  | 
|
1563  | 
done  | 
|
1564  | 
||
1565  | 
lemma st_SReal: "x \<in> HFinite ==> st x \<in> Reals"  | 
|
1566  | 
apply (simp add: st_def)  | 
|
1567  | 
apply (frule st_part_Ex, safe)  | 
|
1568  | 
apply (rule someI2)  | 
|
1569  | 
apply (auto intro: approx_sym)  | 
|
1570  | 
done  | 
|
1571  | 
||
1572  | 
lemma st_HFinite: "x \<in> HFinite ==> st x \<in> HFinite"  | 
|
1573  | 
by (erule st_SReal [THEN SReal_subset_HFinite [THEN subsetD]])  | 
|
1574  | 
||
1575  | 
lemma st_SReal_eq: "x \<in> Reals ==> st x = x"  | 
|
1576  | 
apply (simp add: st_def)  | 
|
1577  | 
apply (rule some_equality)  | 
|
1578  | 
apply (fast intro: SReal_subset_HFinite [THEN subsetD])  | 
|
1579  | 
apply (blast dest: SReal_approx_iff [THEN iffD1])  | 
|
1580  | 
done  | 
|
1581  | 
||
1582  | 
(* ???should be added to simpset *)  | 
|
1583  | 
lemma st_hypreal_of_real: "st (hypreal_of_real x) = hypreal_of_real x"  | 
|
1584  | 
by (rule SReal_hypreal_of_real [THEN st_SReal_eq])  | 
|
1585  | 
||
1586  | 
lemma st_eq_approx: "[| x \<in> HFinite; y \<in> HFinite; st x = st y |] ==> x @= y"  | 
|
1587  | 
by (auto dest!: st_approx_self elim!: approx_trans3)  | 
|
1588  | 
||
1589  | 
lemma approx_st_eq:  | 
|
1590  | 
assumes "x \<in> HFinite" and "y \<in> HFinite" and "x @= y"  | 
|
1591  | 
shows "st x = st y"  | 
|
1592  | 
proof -  | 
|
1593  | 
have "st x @= x" "st y @= y" "st x \<in> Reals" "st y \<in> Reals"  | 
|
1594  | 
by (simp_all add: st_approx_self st_SReal prems)  | 
|
1595  | 
with prems show ?thesis  | 
|
1596  | 
by (fast elim: approx_trans approx_trans2 SReal_approx_iff [THEN iffD1])  | 
|
1597  | 
qed  | 
|
1598  | 
||
1599  | 
lemma st_eq_approx_iff: "[| x \<in> HFinite; y \<in> HFinite|]  | 
|
1600  | 
==> (x @= y) = (st x = st y)"  | 
|
1601  | 
by (blast intro: approx_st_eq st_eq_approx)  | 
|
1602  | 
||
1603  | 
lemma st_Infinitesimal_add_SReal: "[| x \<in> Reals; e \<in> Infinitesimal |] ==> st(x + e) = x"  | 
|
1604  | 
apply (frule st_SReal_eq [THEN subst])  | 
|
1605  | 
prefer 2 apply assumption  | 
|
1606  | 
apply (frule SReal_subset_HFinite [THEN subsetD])  | 
|
1607  | 
apply (frule Infinitesimal_subset_HFinite [THEN subsetD])  | 
|
1608  | 
apply (drule st_SReal_eq)  | 
|
1609  | 
apply (rule approx_st_eq)  | 
|
1610  | 
apply (auto intro: HFinite_add simp add: Infinitesimal_add_approx_self [THEN approx_sym])  | 
|
1611  | 
done  | 
|
1612  | 
||
1613  | 
lemma st_Infinitesimal_add_SReal2: "[| x \<in> Reals; e \<in> Infinitesimal |]  | 
|
1614  | 
==> st(e + x) = x"  | 
|
1615  | 
apply (rule hypreal_add_commute [THEN subst])  | 
|
1616  | 
apply (blast intro!: st_Infinitesimal_add_SReal)  | 
|
1617  | 
done  | 
|
1618  | 
||
1619  | 
lemma HFinite_st_Infinitesimal_add: "x \<in> HFinite ==>  | 
|
1620  | 
\<exists>e \<in> Infinitesimal. x = st(x) + e"  | 
|
1621  | 
apply (blast dest!: st_approx_self [THEN approx_sym] bex_Infinitesimal_iff2 [THEN iffD2])  | 
|
1622  | 
done  | 
|
1623  | 
||
1624  | 
lemma st_add:  | 
|
1625  | 
assumes x: "x \<in> HFinite" and y: "y \<in> HFinite"  | 
|
1626  | 
shows "st (x + y) = st(x) + st(y)"  | 
|
1627  | 
proof -  | 
|
1628  | 
from HFinite_st_Infinitesimal_add [OF x]  | 
|
1629  | 
obtain ex where ex: "ex \<in> Infinitesimal" "st x + ex = x"  | 
|
1630  | 
by (blast intro: sym)  | 
|
1631  | 
from HFinite_st_Infinitesimal_add [OF y]  | 
|
1632  | 
obtain ey where ey: "ey \<in> Infinitesimal" "st y + ey = y"  | 
|
1633  | 
by (blast intro: sym)  | 
|
1634  | 
have "st (x + y) = st ((st x + ex) + (st y + ey))"  | 
|
1635  | 
by (simp add: ex ey)  | 
|
1636  | 
also have "... = st ((ex + ey) + (st x + st y))" by (simp add: add_ac)  | 
|
1637  | 
also have "... = st x + st y"  | 
|
1638  | 
by (simp add: prems st_SReal SReal_add Infinitesimal_add  | 
|
1639  | 
st_Infinitesimal_add_SReal2)  | 
|
1640  | 
finally show ?thesis .  | 
|
1641  | 
qed  | 
|
1642  | 
||
1643  | 
lemma st_number_of: "st (number_of w) = number_of w"  | 
|
1644  | 
by (rule SReal_number_of [THEN st_SReal_eq])  | 
|
1645  | 
declare st_number_of [simp]  | 
|
1646  | 
||
1647  | 
(*the theorem above for the special cases of zero and one*)  | 
|
1648  | 
lemma [simp]: "st 0 = 0" "st 1 = 1"  | 
|
1649  | 
by (simp_all add: st_SReal_eq)  | 
|
1650  | 
||
1651  | 
lemma st_minus: assumes "y \<in> HFinite" shows "st(-y) = -st(y)"  | 
|
1652  | 
proof -  | 
|
1653  | 
have "st (- y) + st y = 0"  | 
|
1654  | 
by (simp add: prems st_add [symmetric] HFinite_minus_iff)  | 
|
1655  | 
thus ?thesis by arith  | 
|
1656  | 
qed  | 
|
1657  | 
||
1658  | 
lemma st_diff:  | 
|
1659  | 
"[| x \<in> HFinite; y \<in> HFinite |] ==> st (x-y) = st(x) - st(y)"  | 
|
1660  | 
apply (simp add: hypreal_diff_def)  | 
|
1661  | 
apply (frule_tac y1 = y in st_minus [symmetric])  | 
|
1662  | 
apply (drule_tac x1 = y in HFinite_minus_iff [THEN iffD2])  | 
|
1663  | 
apply (simp (no_asm_simp) add: st_add)  | 
|
1664  | 
done  | 
|
1665  | 
||
1666  | 
(* lemma *)  | 
|
1667  | 
lemma lemma_st_mult: "[| x \<in> HFinite; y \<in> HFinite;  | 
|
1668  | 
e \<in> Infinitesimal;  | 
|
1669  | 
ea \<in> Infinitesimal |]  | 
|
1670  | 
==> e*y + x*ea + e*ea \<in> Infinitesimal"  | 
|
1671  | 
apply (frule_tac x = e and y = y in Infinitesimal_HFinite_mult)  | 
|
1672  | 
apply (frule_tac [2] x = ea and y = x in Infinitesimal_HFinite_mult)  | 
|
1673  | 
apply (drule_tac [3] Infinitesimal_mult)  | 
|
1674  | 
apply (auto intro: Infinitesimal_add simp add: add_ac mult_ac)  | 
|
1675  | 
done  | 
|
1676  | 
||
1677  | 
lemma st_mult: "[| x \<in> HFinite; y \<in> HFinite |]  | 
|
1678  | 
==> st (x * y) = st(x) * st(y)"  | 
|
1679  | 
apply (frule HFinite_st_Infinitesimal_add)  | 
|
1680  | 
apply (frule_tac x = y in HFinite_st_Infinitesimal_add, safe)  | 
|
1681  | 
apply (subgoal_tac "st (x * y) = st ((st x + e) * (st y + ea))")  | 
|
1682  | 
apply (drule_tac [2] sym, drule_tac [2] sym)  | 
|
1683  | 
prefer 2 apply simp  | 
|
1684  | 
apply (erule_tac V = "x = st x + e" in thin_rl)  | 
|
1685  | 
apply (erule_tac V = "y = st y + ea" in thin_rl)  | 
|
1686  | 
apply (simp add: left_distrib right_distrib)  | 
|
1687  | 
apply (drule st_SReal)+  | 
|
1688  | 
apply (simp (no_asm_use) add: hypreal_add_assoc)  | 
|
1689  | 
apply (rule st_Infinitesimal_add_SReal)  | 
|
1690  | 
apply (blast intro!: SReal_mult)  | 
|
1691  | 
apply (drule SReal_subset_HFinite [THEN subsetD])+  | 
|
1692  | 
apply (rule hypreal_add_assoc [THEN subst])  | 
|
1693  | 
apply (blast intro!: lemma_st_mult)  | 
|
1694  | 
done  | 
|
1695  | 
||
1696  | 
lemma st_Infinitesimal: "x \<in> Infinitesimal ==> st x = 0"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1697  | 
apply (subst numeral_0_eq_0 [symmetric])  | 
| 14370 | 1698  | 
apply (rule st_number_of [THEN subst])  | 
1699  | 
apply (rule approx_st_eq)  | 
|
1700  | 
apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] simp add: mem_infmal_iff [symmetric])  | 
|
1701  | 
done  | 
|
1702  | 
||
1703  | 
lemma st_not_Infinitesimal: "st(x) \<noteq> 0 ==> x \<notin> Infinitesimal"  | 
|
1704  | 
by (fast intro: st_Infinitesimal)  | 
|
1705  | 
||
1706  | 
lemma st_inverse: "[| x \<in> HFinite; st x \<noteq> 0 |]  | 
|
1707  | 
==> st(inverse x) = inverse (st x)"  | 
|
1708  | 
apply (rule_tac c1 = "st x" in hypreal_mult_left_cancel [THEN iffD1])  | 
|
1709  | 
apply (auto simp add: st_mult [symmetric] st_not_Infinitesimal HFinite_inverse)  | 
|
1710  | 
apply (subst hypreal_mult_inverse, auto)  | 
|
1711  | 
done  | 
|
1712  | 
||
1713  | 
lemma st_divide: "[| x \<in> HFinite; y \<in> HFinite; st y \<noteq> 0 |]  | 
|
1714  | 
==> st(x/y) = (st x) / (st y)"  | 
|
1715  | 
apply (auto simp add: hypreal_divide_def st_mult st_not_Infinitesimal HFinite_inverse st_inverse)  | 
|
1716  | 
done  | 
|
1717  | 
declare st_divide [simp]  | 
|
1718  | 
||
1719  | 
lemma st_idempotent: "x \<in> HFinite ==> st(st(x)) = st(x)"  | 
|
1720  | 
by (blast intro: st_HFinite st_approx_self approx_st_eq)  | 
|
1721  | 
declare st_idempotent [simp]  | 
|
1722  | 
||
1723  | 
(*** lemmas ***)  | 
|
1724  | 
lemma Infinitesimal_add_st_less: "[| x \<in> HFinite; y \<in> HFinite;  | 
|
1725  | 
u \<in> Infinitesimal; st x < st y  | 
|
1726  | 
|] ==> st x + u < st y"  | 
|
1727  | 
apply (drule st_SReal)+  | 
|
1728  | 
apply (auto intro!: Infinitesimal_add_hypreal_of_real_less simp add: SReal_iff)  | 
|
1729  | 
done  | 
|
1730  | 
||
1731  | 
lemma Infinitesimal_add_st_le_cancel: "[| x \<in> HFinite; y \<in> HFinite;  | 
|
1732  | 
u \<in> Infinitesimal; st x <= st y + u  | 
|
1733  | 
|] ==> st x <= st y"  | 
|
1734  | 
apply (simp add: linorder_not_less [symmetric])  | 
|
1735  | 
apply (auto dest: Infinitesimal_add_st_less)  | 
|
1736  | 
done  | 
|
1737  | 
||
1738  | 
lemma st_le: "[| x \<in> HFinite; y \<in> HFinite; x <= y |] ==> st(x) <= st(y)"  | 
|
1739  | 
apply (frule HFinite_st_Infinitesimal_add)  | 
|
1740  | 
apply (rotate_tac 1)  | 
|
1741  | 
apply (frule HFinite_st_Infinitesimal_add, safe)  | 
|
1742  | 
apply (rule Infinitesimal_add_st_le_cancel)  | 
|
1743  | 
apply (rule_tac [3] x = ea and y = e in Infinitesimal_diff)  | 
|
1744  | 
apply (auto simp add: hypreal_add_assoc [symmetric])  | 
|
1745  | 
done  | 
|
1746  | 
||
1747  | 
lemma st_zero_le: "[| 0 <= x; x \<in> HFinite |] ==> 0 <= st x"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1748  | 
apply (subst numeral_0_eq_0 [symmetric])  | 
| 14370 | 1749  | 
apply (rule st_number_of [THEN subst])  | 
1750  | 
apply (rule st_le, auto)  | 
|
1751  | 
done  | 
|
1752  | 
||
1753  | 
lemma st_zero_ge: "[| x <= 0; x \<in> HFinite |] ==> st x <= 0"  | 
|
| 
14387
 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
 
paulson 
parents: 
14378 
diff
changeset
 | 
1754  | 
apply (subst numeral_0_eq_0 [symmetric])  | 
| 14370 | 1755  | 
apply (rule st_number_of [THEN subst])  | 
1756  | 
apply (rule st_le, auto)  | 
|
1757  | 
done  | 
|
1758  | 
||
1759  | 
lemma st_hrabs: "x \<in> HFinite ==> abs(st x) = st(abs x)"  | 
|
1760  | 
apply (simp add: linorder_not_le st_zero_le abs_if st_minus  | 
|
1761  | 
linorder_not_less)  | 
|
1762  | 
apply (auto dest!: st_zero_ge [OF order_less_imp_le])  | 
|
1763  | 
done  | 
|
1764  | 
||
1765  | 
||
1766  | 
||
1767  | 
(*--------------------------------------------------------------------  | 
|
1768  | 
Alternative definitions for HFinite using Free ultrafilter  | 
|
1769  | 
--------------------------------------------------------------------*)  | 
|
1770  | 
||
1771  | 
lemma FreeUltrafilterNat_Rep_hypreal: "[| X \<in> Rep_hypreal x; Y \<in> Rep_hypreal x |]  | 
|
1772  | 
      ==> {n. X n = Y n} \<in> FreeUltrafilterNat"
 | 
|
1773  | 
apply (rule_tac z = x in eq_Abs_hypreal, auto, ultra)  | 
|
1774  | 
done  | 
|
1775  | 
||
1776  | 
lemma HFinite_FreeUltrafilterNat:  | 
|
1777  | 
"x \<in> HFinite  | 
|
1778  | 
     ==> \<exists>X \<in> Rep_hypreal x. \<exists>u. {n. abs (X n) < u} \<in> FreeUltrafilterNat"
 | 
|
1779  | 
apply (rule eq_Abs_hypreal [of x])  | 
|
1780  | 
apply (auto simp add: HFinite_def abs_less_iff minus_less_iff [of x]  | 
|
1781  | 
hypreal_less SReal_iff hypreal_minus hypreal_of_real_def)  | 
|
1782  | 
apply (rule_tac x=x in bexI)  | 
|
1783  | 
apply (rule_tac x=y in exI, auto, ultra)  | 
|
1784  | 
done  | 
|
1785  | 
||
1786  | 
lemma FreeUltrafilterNat_HFinite:  | 
|
1787  | 
"\<exists>X \<in> Rep_hypreal x.  | 
|
1788  | 
       \<exists>u. {n. abs (X n) < u} \<in> FreeUltrafilterNat
 | 
|
1789  | 
==> x \<in> HFinite"  | 
|
1790  | 
apply (rule eq_Abs_hypreal [of x])  | 
|
1791  | 
apply (auto simp add: HFinite_def abs_less_iff minus_less_iff [of x])  | 
|
1792  | 
apply (rule_tac x = "hypreal_of_real u" in bexI)  | 
|
1793  | 
apply (auto simp add: hypreal_less SReal_iff hypreal_minus hypreal_of_real_def, ultra+)  | 
|
1794  | 
done  | 
|
1795  | 
||
1796  | 
lemma HFinite_FreeUltrafilterNat_iff: "(x \<in> HFinite) = (\<exists>X \<in> Rep_hypreal x.  | 
|
1797  | 
           \<exists>u. {n. abs (X n) < u} \<in> FreeUltrafilterNat)"
 | 
|
1798  | 
apply (blast intro!: HFinite_FreeUltrafilterNat FreeUltrafilterNat_HFinite)  | 
|
1799  | 
done  | 
|
1800  | 
||
1801  | 
(*--------------------------------------------------------------------  | 
|
1802  | 
Alternative definitions for HInfinite using Free ultrafilter  | 
|
1803  | 
--------------------------------------------------------------------*)  | 
|
1804  | 
lemma lemma_Compl_eq: "- {n. (u::real) < abs (xa n)} = {n. abs (xa n) <= u}"
 | 
|
1805  | 
by auto  | 
|
1806  | 
||
1807  | 
lemma lemma_Compl_eq2: "- {n. abs (xa n) < (u::real)} = {n. u <= abs (xa n)}"
 | 
|
1808  | 
by auto  | 
|
1809  | 
||
1810  | 
lemma lemma_Int_eq1: "{n. abs (xa n) <= (u::real)} Int {n. u <= abs (xa n)}
 | 
|
1811  | 
          = {n. abs(xa n) = u}"
 | 
|
1812  | 
apply auto  | 
|
1813  | 
done  | 
|
1814  | 
||
1815  | 
lemma lemma_FreeUltrafilterNat_one: "{n. abs (xa n) = u} <= {n. abs (xa n) < u + (1::real)}"
 | 
|
1816  | 
by auto  | 
|
1817  | 
||
1818  | 
(*-------------------------------------  | 
|
1819  | 
Exclude this type of sets from free  | 
|
1820  | 
ultrafilter for Infinite numbers!  | 
|
1821  | 
-------------------------------------*)  | 
|
1822  | 
lemma FreeUltrafilterNat_const_Finite: "[| xa: Rep_hypreal x;  | 
|
1823  | 
                  {n. abs (xa n) = u} \<in> FreeUltrafilterNat
 | 
|
1824  | 
|] ==> x \<in> HFinite"  | 
|
1825  | 
apply (rule FreeUltrafilterNat_HFinite)  | 
|
1826  | 
apply (rule_tac x = xa in bexI)  | 
|
1827  | 
apply (rule_tac x = "u + 1" in exI)  | 
|
1828  | 
apply (ultra, assumption)  | 
|
1829  | 
done  | 
|
1830  | 
||
1831  | 
lemma HInfinite_FreeUltrafilterNat:  | 
|
1832  | 
"x \<in> HInfinite ==> \<exists>X \<in> Rep_hypreal x.  | 
|
1833  | 
           \<forall>u. {n. u < abs (X n)} \<in> FreeUltrafilterNat"
 | 
|
1834  | 
apply (frule HInfinite_HFinite_iff [THEN iffD1])  | 
|
1835  | 
apply (cut_tac x = x in Rep_hypreal_nonempty)  | 
|
1836  | 
apply (auto simp del: Rep_hypreal_nonempty simp add: HFinite_FreeUltrafilterNat_iff Bex_def)  | 
|
1837  | 
apply (drule spec)+  | 
|
1838  | 
apply auto  | 
|
1839  | 
apply (drule_tac x = u in spec)  | 
|
1840  | 
apply (drule FreeUltrafilterNat_Compl_mem)+  | 
|
1841  | 
apply (drule FreeUltrafilterNat_Int, assumption)  | 
|
1842  | 
apply (simp add: lemma_Compl_eq lemma_Compl_eq2 lemma_Int_eq1)  | 
|
1843  | 
apply (auto dest: FreeUltrafilterNat_const_Finite simp  | 
|
1844  | 
add: HInfinite_HFinite_iff [THEN iffD1])  | 
|
1845  | 
done  | 
|
1846  | 
||
1847  | 
(* yet more lemmas! *)  | 
|
1848  | 
lemma lemma_Int_HI: "{n. abs (Xa n) < u} Int {n. X n = Xa n}
 | 
|
1849  | 
          <= {n. abs (X n) < (u::real)}"
 | 
|
1850  | 
apply auto  | 
|
1851  | 
done  | 
|
1852  | 
||
1853  | 
lemma lemma_Int_HIa: "{n. u < abs (X n)} Int {n. abs (X n) < (u::real)} = {}"
 | 
|
1854  | 
by (auto intro: order_less_asym)  | 
|
1855  | 
||
1856  | 
lemma FreeUltrafilterNat_HInfinite: "\<exists>X \<in> Rep_hypreal x. \<forall>u.  | 
|
1857  | 
               {n. u < abs (X n)} \<in> FreeUltrafilterNat
 | 
|
1858  | 
==> x \<in> HInfinite"  | 
|
1859  | 
apply (rule HInfinite_HFinite_iff [THEN iffD2])  | 
|
1860  | 
apply (safe, drule HFinite_FreeUltrafilterNat, auto)  | 
|
1861  | 
apply (drule_tac x = u in spec)  | 
|
1862  | 
apply (drule FreeUltrafilterNat_Rep_hypreal, assumption)  | 
|
1863  | 
apply (drule_tac Y = "{n. X n = Xa n}" in FreeUltrafilterNat_Int, simp) 
 | 
|
1864  | 
apply (drule lemma_Int_HI [THEN [2] FreeUltrafilterNat_subset])  | 
|
1865  | 
apply (drule_tac Y = "{n. abs (X n) < u}" in FreeUltrafilterNat_Int)
 | 
|
1866  | 
apply (auto simp add: lemma_Int_HIa FreeUltrafilterNat_empty)  | 
|
1867  | 
done  | 
|
1868  | 
||
1869  | 
lemma HInfinite_FreeUltrafilterNat_iff: "(x \<in> HInfinite) = (\<exists>X \<in> Rep_hypreal x.  | 
|
1870  | 
           \<forall>u. {n. u < abs (X n)} \<in> FreeUltrafilterNat)"
 | 
|
1871  | 
apply (blast intro!: HInfinite_FreeUltrafilterNat FreeUltrafilterNat_HInfinite)  | 
|
1872  | 
done  | 
|
1873  | 
||
1874  | 
(*--------------------------------------------------------------------  | 
|
1875  | 
Alternative definitions for Infinitesimal using Free ultrafilter  | 
|
1876  | 
--------------------------------------------------------------------*)  | 
|
1877  | 
||
| 10751 | 1878  | 
|
| 14370 | 1879  | 
lemma Infinitesimal_FreeUltrafilterNat:  | 
1880  | 
"x \<in> Infinitesimal ==> \<exists>X \<in> Rep_hypreal x.  | 
|
1881  | 
           \<forall>u. 0 < u --> {n. abs (X n) < u} \<in> FreeUltrafilterNat"
 | 
|
1882  | 
apply (simp add: Infinitesimal_def)  | 
|
1883  | 
apply (auto simp add: abs_less_iff minus_less_iff [of x])  | 
|
1884  | 
apply (rule eq_Abs_hypreal [of x])  | 
|
1885  | 
apply (auto, rule bexI [OF _ lemma_hyprel_refl], safe)  | 
|
1886  | 
apply (drule hypreal_of_real_less_iff [THEN iffD2])  | 
|
1887  | 
apply (drule_tac x = "hypreal_of_real u" in bspec, auto)  | 
|
1888  | 
apply (auto simp add: hypreal_less hypreal_minus hypreal_of_real_def, ultra)  | 
|
1889  | 
done  | 
|
1890  | 
||
1891  | 
lemma FreeUltrafilterNat_Infinitesimal:  | 
|
1892  | 
"\<exists>X \<in> Rep_hypreal x.  | 
|
1893  | 
            \<forall>u. 0 < u --> {n. abs (X n) < u} \<in> FreeUltrafilterNat
 | 
|
1894  | 
==> x \<in> Infinitesimal"  | 
|
1895  | 
apply (simp add: Infinitesimal_def)  | 
|
1896  | 
apply (rule eq_Abs_hypreal [of x])  | 
|
1897  | 
apply (auto simp add: abs_less_iff abs_interval_iff minus_less_iff [of x])  | 
|
1898  | 
apply (auto simp add: SReal_iff)  | 
|
1899  | 
apply (drule_tac [!] x=y in spec)  | 
|
1900  | 
apply (auto simp add: hypreal_less hypreal_minus hypreal_of_real_def, ultra+)  | 
|
1901  | 
done  | 
|
1902  | 
||
1903  | 
lemma Infinitesimal_FreeUltrafilterNat_iff: "(x \<in> Infinitesimal) = (\<exists>X \<in> Rep_hypreal x.  | 
|
1904  | 
           \<forall>u. 0 < u --> {n. abs (X n) < u} \<in> FreeUltrafilterNat)"
 | 
|
1905  | 
apply (blast intro!: Infinitesimal_FreeUltrafilterNat FreeUltrafilterNat_Infinitesimal)  | 
|
1906  | 
done  | 
|
1907  | 
||
1908  | 
(*------------------------------------------------------------------------  | 
|
1909  | 
Infinitesimals as smaller than 1/n for all n::nat (> 0)  | 
|
1910  | 
------------------------------------------------------------------------*)  | 
|
1911  | 
||
1912  | 
lemma lemma_Infinitesimal: "(\<forall>r. 0 < r --> x < r) = (\<forall>n. x < inverse(real (Suc n)))"  | 
|
1913  | 
apply (auto simp add: real_of_nat_Suc_gt_zero)  | 
|
1914  | 
apply (blast dest!: reals_Archimedean intro: order_less_trans)  | 
|
1915  | 
done  | 
|
1916  | 
||
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1917  | 
lemma of_nat_in_Reals [simp]: "(of_nat n::hypreal) \<in> \<real>"  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1918  | 
apply (induct n)  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1919  | 
apply (simp_all add: SReal_add);  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1920  | 
done  | 
| 
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1921  | 
|
| 14370 | 1922  | 
lemma lemma_Infinitesimal2: "(\<forall>r \<in> Reals. 0 < r --> x < r) =  | 
1923  | 
(\<forall>n. x < inverse(hypreal_of_nat (Suc n)))"  | 
|
1924  | 
apply safe  | 
|
1925  | 
apply (drule_tac x = "inverse (hypreal_of_real (real (Suc n))) " in bspec)  | 
|
1926  | 
apply (simp (no_asm_use) add: SReal_inverse)  | 
|
1927  | 
apply (rule real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive, THEN hypreal_of_real_less_iff [THEN iffD2], THEN [2] impE])  | 
|
1928  | 
prefer 2 apply assumption  | 
|
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1929  | 
apply (simp add: real_of_nat_Suc_gt_zero hypreal_of_nat_eq)  | 
| 14370 | 1930  | 
apply (auto dest!: reals_Archimedean simp add: SReal_iff)  | 
1931  | 
apply (drule hypreal_of_real_less_iff [THEN iffD2])  | 
|
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1932  | 
apply (simp add: real_of_nat_Suc_gt_zero hypreal_of_nat_eq)  | 
| 14370 | 1933  | 
apply (blast intro: order_less_trans)  | 
1934  | 
done  | 
|
1935  | 
||
| 
14378
 
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
 
paulson 
parents: 
14371 
diff
changeset
 | 
1936  | 
|
| 14370 | 1937  | 
lemma Infinitesimal_hypreal_of_nat_iff:  | 
1938  | 
     "Infinitesimal = {x. \<forall>n. abs x < inverse (hypreal_of_nat (Suc n))}"
 | 
|
1939  | 
apply (simp add: Infinitesimal_def)  | 
|
1940  | 
apply (auto simp add: lemma_Infinitesimal2)  | 
|
1941  | 
done  | 
|
1942  | 
||
1943  | 
||
1944  | 
(*-------------------------------------------------------------------------  | 
|
1945  | 
Proof that omega is an infinite number and  | 
|
1946  | 
hence that epsilon is an infinitesimal number.  | 
|
1947  | 
-------------------------------------------------------------------------*)  | 
|
1948  | 
lemma Suc_Un_eq: "{n. n < Suc m} = {n. n < m} Un {n. n = m}"
 | 
|
1949  | 
by (auto simp add: less_Suc_eq)  | 
|
1950  | 
||
1951  | 
(*-------------------------------------------  | 
|
1952  | 
Prove that any segment is finite and  | 
|
1953  | 
hence cannot belong to FreeUltrafilterNat  | 
|
1954  | 
-------------------------------------------*)  | 
|
1955  | 
lemma finite_nat_segment: "finite {n::nat. n < m}"
 | 
|
1956  | 
apply (induct_tac "m")  | 
|
1957  | 
apply (auto simp add: Suc_Un_eq)  | 
|
1958  | 
done  | 
|
1959  | 
||
1960  | 
lemma finite_real_of_nat_segment: "finite {n::nat. real n < real (m::nat)}"
 | 
|
1961  | 
by (auto intro: finite_nat_segment)  | 
|
1962  | 
||
1963  | 
lemma finite_real_of_nat_less_real: "finite {n::nat. real n < u}"
 | 
|
1964  | 
apply (cut_tac x = u in reals_Archimedean2, safe)  | 
|
1965  | 
apply (rule finite_real_of_nat_segment [THEN [2] finite_subset])  | 
|
1966  | 
apply (auto dest: order_less_trans)  | 
|
1967  | 
done  | 
|
1968  | 
||
1969  | 
lemma lemma_real_le_Un_eq: "{n. f n <= u} = {n. f n < u} Un {n. u = (f n :: real)}"
 | 
|
1970  | 
by (auto dest: order_le_imp_less_or_eq simp add: order_less_imp_le)  | 
|
1971  | 
||
1972  | 
lemma finite_real_of_nat_le_real: "finite {n::nat. real n <= u}"
 | 
|
1973  | 
by (auto simp add: lemma_real_le_Un_eq lemma_finite_omega_set finite_real_of_nat_less_real)  | 
|
1974  | 
||
1975  | 
lemma finite_rabs_real_of_nat_le_real: "finite {n::nat. abs(real n) <= u}"
 | 
|
1976  | 
apply (simp (no_asm) add: real_of_nat_Suc_gt_zero finite_real_of_nat_le_real)  | 
|
1977  | 
done  | 
|
1978  | 
||
1979  | 
lemma rabs_real_of_nat_le_real_FreeUltrafilterNat: "{n. abs(real n) <= u} \<notin> FreeUltrafilterNat"
 | 
|
1980  | 
by (blast intro!: FreeUltrafilterNat_finite finite_rabs_real_of_nat_le_real)  | 
|
1981  | 
||
1982  | 
lemma FreeUltrafilterNat_nat_gt_real: "{n. u < real n} \<in> FreeUltrafilterNat"
 | 
|
1983  | 
apply (rule ccontr, drule FreeUltrafilterNat_Compl_mem)  | 
|
1984  | 
apply (subgoal_tac "- {n::nat. u < real n} = {n. real n <= u}")
 | 
|
1985  | 
prefer 2 apply force  | 
|
1986  | 
apply (simp add: finite_real_of_nat_le_real [THEN FreeUltrafilterNat_finite])  | 
|
1987  | 
done  | 
|
1988  | 
||
1989  | 
(*--------------------------------------------------------------  | 
|
1990  | 
 The complement of {n. abs(real n) <= u} =
 | 
|
1991  | 
 {n. u < abs (real n)} is in FreeUltrafilterNat
 | 
|
1992  | 
by property of (free) ultrafilters  | 
|
1993  | 
--------------------------------------------------------------*)  | 
|
1994  | 
||
1995  | 
lemma Compl_real_le_eq: "- {n::nat. real n <= u} = {n. u < real n}"
 | 
|
1996  | 
by (auto dest!: order_le_less_trans simp add: linorder_not_le)  | 
|
1997  | 
||
1998  | 
(*-----------------------------------------------  | 
|
1999  | 
Omega is a member of HInfinite  | 
|
2000  | 
-----------------------------------------------*)  | 
|
2001  | 
||
2002  | 
lemma hypreal_omega: "hyprel``{%n::nat. real (Suc n)} \<in> hypreal"
 | 
|
2003  | 
by auto  | 
|
2004  | 
||
2005  | 
lemma FreeUltrafilterNat_omega: "{n. u < real n} \<in> FreeUltrafilterNat"
 | 
|
2006  | 
apply (cut_tac u = u in rabs_real_of_nat_le_real_FreeUltrafilterNat)  | 
|
2007  | 
apply (auto dest: FreeUltrafilterNat_Compl_mem simp add: Compl_real_le_eq)  | 
|
2008  | 
done  | 
|
2009  | 
||
2010  | 
lemma HInfinite_omega: "omega: HInfinite"  | 
|
2011  | 
apply (simp add: omega_def)  | 
|
2012  | 
apply (auto intro!: FreeUltrafilterNat_HInfinite)  | 
|
2013  | 
apply (rule bexI)  | 
|
2014  | 
apply (rule_tac [2] lemma_hyprel_refl, auto)  | 
|
2015  | 
apply (simp (no_asm) add: real_of_nat_Suc diff_less_eq [symmetric] FreeUltrafilterNat_omega)  | 
|
2016  | 
done  | 
|
2017  | 
declare HInfinite_omega [simp]  | 
|
2018  | 
||
2019  | 
(*-----------------------------------------------  | 
|
2020  | 
Epsilon is a member of Infinitesimal  | 
|
2021  | 
-----------------------------------------------*)  | 
|
2022  | 
||
2023  | 
lemma Infinitesimal_epsilon: "epsilon \<in> Infinitesimal"  | 
|
2024  | 
by (auto intro!: HInfinite_inverse_Infinitesimal HInfinite_omega simp add: hypreal_epsilon_inverse_omega)  | 
|
2025  | 
declare Infinitesimal_epsilon [simp]  | 
|
2026  | 
||
2027  | 
lemma HFinite_epsilon: "epsilon \<in> HFinite"  | 
|
2028  | 
by (auto intro: Infinitesimal_subset_HFinite [THEN subsetD])  | 
|
2029  | 
declare HFinite_epsilon [simp]  | 
|
2030  | 
||
2031  | 
lemma epsilon_approx_zero: "epsilon @= 0"  | 
|
2032  | 
apply (simp (no_asm) add: mem_infmal_iff [symmetric])  | 
|
2033  | 
done  | 
|
2034  | 
declare epsilon_approx_zero [simp]  | 
|
2035  | 
||
2036  | 
(*------------------------------------------------------------------------  | 
|
2037  | 
Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given  | 
|
2038  | 
that \<forall>n. |X n - a| < 1/n. Used in proof of NSLIM => LIM.  | 
|
2039  | 
-----------------------------------------------------------------------*)  | 
|
2040  | 
||
2041  | 
lemma real_of_nat_less_inverse_iff: "0 < u ==>  | 
|
2042  | 
(u < inverse (real(Suc n))) = (real(Suc n) < inverse u)"  | 
|
2043  | 
apply (simp add: inverse_eq_divide)  | 
|
2044  | 
apply (subst pos_less_divide_eq, assumption)  | 
|
2045  | 
apply (subst pos_less_divide_eq)  | 
|
2046  | 
apply (simp add: real_of_nat_Suc_gt_zero)  | 
|
2047  | 
apply (simp add: real_mult_commute)  | 
|
2048  | 
done  | 
|
2049  | 
||
2050  | 
lemma finite_inverse_real_of_posnat_gt_real: "0 < u ==> finite {n. u < inverse(real(Suc n))}"
 | 
|
2051  | 
apply (simp (no_asm_simp) add: real_of_nat_less_inverse_iff)  | 
|
2052  | 
apply (simp (no_asm_simp) add: real_of_nat_Suc less_diff_eq [symmetric])  | 
|
2053  | 
apply (rule finite_real_of_nat_less_real)  | 
|
2054  | 
done  | 
|
2055  | 
||
2056  | 
lemma lemma_real_le_Un_eq2: "{n. u <= inverse(real(Suc n))} =
 | 
|
2057  | 
     {n. u < inverse(real(Suc n))} Un {n. u = inverse(real(Suc n))}"
 | 
|
2058  | 
apply (auto dest: order_le_imp_less_or_eq simp add: order_less_imp_le)  | 
|
2059  | 
done  | 
|
2060  | 
||
2061  | 
lemma real_of_nat_inverse_le_iff: "(inverse (real(Suc n)) <= r) = (1 <= r * real(Suc n))"  | 
|
2062  | 
apply (simp (no_asm) add: linorder_not_less [symmetric])  | 
|
2063  | 
apply (simp (no_asm) add: inverse_eq_divide)  | 
|
2064  | 
apply (subst pos_less_divide_eq)  | 
|
2065  | 
apply (simp (no_asm) add: real_of_nat_Suc_gt_zero)  | 
|
2066  | 
apply (simp (no_asm) add: real_mult_commute)  | 
|
2067  | 
done  | 
|
2068  | 
||
2069  | 
lemma real_of_nat_inverse_eq_iff: "(u = inverse (real(Suc n))) = (real(Suc n) = inverse u)"  | 
|
2070  | 
by (auto simp add: inverse_inverse_eq real_of_nat_Suc_gt_zero real_not_refl2 [THEN not_sym])  | 
|
2071  | 
||
2072  | 
lemma lemma_finite_omega_set2: "finite {n::nat. u = inverse(real(Suc n))}"
 | 
|
2073  | 
apply (simp (no_asm_simp) add: real_of_nat_inverse_eq_iff)  | 
|
2074  | 
apply (cut_tac x = "inverse u - 1" in lemma_finite_omega_set)  | 
|
2075  | 
apply (simp add: real_of_nat_Suc diff_eq_eq [symmetric] eq_commute)  | 
|
2076  | 
done  | 
|
2077  | 
||
2078  | 
lemma finite_inverse_real_of_posnat_ge_real: "0 < u ==> finite {n. u <= inverse(real(Suc n))}"
 | 
|
2079  | 
by (auto simp add: lemma_real_le_Un_eq2 lemma_finite_omega_set2 finite_inverse_real_of_posnat_gt_real)  | 
|
2080  | 
||
2081  | 
lemma inverse_real_of_posnat_ge_real_FreeUltrafilterNat: "0 < u ==>  | 
|
2082  | 
       {n. u <= inverse(real(Suc n))} \<notin> FreeUltrafilterNat"
 | 
|
2083  | 
apply (blast intro!: FreeUltrafilterNat_finite finite_inverse_real_of_posnat_ge_real)  | 
|
2084  | 
done  | 
|
2085  | 
||
2086  | 
(*--------------------------------------------------------------  | 
|
2087  | 
    The complement of  {n. u <= inverse(real(Suc n))} =
 | 
|
2088  | 
    {n. inverse(real(Suc n)) < u} is in FreeUltrafilterNat
 | 
|
2089  | 
by property of (free) ultrafilters  | 
|
2090  | 
--------------------------------------------------------------*)  | 
|
2091  | 
lemma Compl_le_inverse_eq: "- {n. u <= inverse(real(Suc n))} =
 | 
|
2092  | 
      {n. inverse(real(Suc n)) < u}"
 | 
|
2093  | 
apply (auto dest!: order_le_less_trans simp add: linorder_not_le)  | 
|
2094  | 
done  | 
|
2095  | 
||
2096  | 
lemma FreeUltrafilterNat_inverse_real_of_posnat: "0 < u ==>  | 
|
2097  | 
      {n. inverse(real(Suc n)) < u} \<in> FreeUltrafilterNat"
 | 
|
2098  | 
apply (cut_tac u = u in inverse_real_of_posnat_ge_real_FreeUltrafilterNat)  | 
|
2099  | 
apply (auto dest: FreeUltrafilterNat_Compl_mem simp add: Compl_le_inverse_eq)  | 
|
2100  | 
done  | 
|
2101  | 
||
2102  | 
(*--------------------------------------------------------------  | 
|
2103  | 
Example where we get a hyperreal from a real sequence  | 
|
2104  | 
for which a particular property holds. The theorem is  | 
|
2105  | 
used in proofs about equivalence of nonstandard and  | 
|
2106  | 
standard neighbourhoods. Also used for equivalence of  | 
|
2107  | 
nonstandard ans standard definitions of pointwise  | 
|
2108  | 
limit (the theorem was previously in REALTOPOS.thy).  | 
|
2109  | 
-------------------------------------------------------------*)  | 
|
2110  | 
(*-----------------------------------------------------  | 
|
2111  | 
|X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x| \<in> Infinitesimal  | 
|
2112  | 
-----------------------------------------------------*)  | 
|
2113  | 
lemma real_seq_to_hypreal_Infinitesimal: "\<forall>n. abs(X n + -x) < inverse(real(Suc n))  | 
|
2114  | 
     ==> Abs_hypreal(hyprel``{X}) + -hypreal_of_real x \<in> Infinitesimal"
 | 
|
2115  | 
apply (auto intro!: bexI dest: FreeUltrafilterNat_inverse_real_of_posnat FreeUltrafilterNat_all FreeUltrafilterNat_Int intro: order_less_trans FreeUltrafilterNat_subset simp add: hypreal_minus hypreal_of_real_def hypreal_add Infinitesimal_FreeUltrafilterNat_iff hypreal_inverse)  | 
|
2116  | 
done  | 
|
2117  | 
||
2118  | 
lemma real_seq_to_hypreal_approx: "\<forall>n. abs(X n + -x) < inverse(real(Suc n))  | 
|
2119  | 
      ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x"
 | 
|
2120  | 
apply (subst approx_minus_iff)  | 
|
2121  | 
apply (rule mem_infmal_iff [THEN subst])  | 
|
2122  | 
apply (erule real_seq_to_hypreal_Infinitesimal)  | 
|
2123  | 
done  | 
|
2124  | 
||
2125  | 
lemma real_seq_to_hypreal_approx2: "\<forall>n. abs(x + -X n) < inverse(real(Suc n))  | 
|
2126  | 
               ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x"
 | 
|
2127  | 
apply (simp add: abs_minus_add_cancel real_seq_to_hypreal_approx)  | 
|
2128  | 
done  | 
|
2129  | 
||
2130  | 
lemma real_seq_to_hypreal_Infinitesimal2: "\<forall>n. abs(X n + -Y n) < inverse(real(Suc n))  | 
|
2131  | 
      ==> Abs_hypreal(hyprel``{X}) +
 | 
|
2132  | 
          -Abs_hypreal(hyprel``{Y}) \<in> Infinitesimal"
 | 
|
2133  | 
by (auto intro!: bexI  | 
|
2134  | 
dest: FreeUltrafilterNat_inverse_real_of_posnat  | 
|
2135  | 
FreeUltrafilterNat_all FreeUltrafilterNat_Int  | 
|
2136  | 
intro: order_less_trans FreeUltrafilterNat_subset  | 
|
2137  | 
simp add: Infinitesimal_FreeUltrafilterNat_iff hypreal_minus  | 
|
2138  | 
hypreal_add hypreal_inverse)  | 
|
2139  | 
||
2140  | 
||
2141  | 
ML  | 
|
2142  | 
{*
 | 
|
2143  | 
val Infinitesimal_def = thm"Infinitesimal_def";  | 
|
2144  | 
val HFinite_def = thm"HFinite_def";  | 
|
2145  | 
val HInfinite_def = thm"HInfinite_def";  | 
|
2146  | 
val st_def = thm"st_def";  | 
|
2147  | 
val monad_def = thm"monad_def";  | 
|
2148  | 
val galaxy_def = thm"galaxy_def";  | 
|
2149  | 
val approx_def = thm"approx_def";  | 
|
2150  | 
val SReal_def = thm"SReal_def";  | 
|
2151  | 
||
2152  | 
val Infinitesimal_approx_minus = thm "Infinitesimal_approx_minus";  | 
|
2153  | 
val approx_monad_iff = thm "approx_monad_iff";  | 
|
2154  | 
val Infinitesimal_approx = thm "Infinitesimal_approx";  | 
|
2155  | 
val approx_add = thm "approx_add";  | 
|
2156  | 
val approx_minus = thm "approx_minus";  | 
|
2157  | 
val approx_minus2 = thm "approx_minus2";  | 
|
2158  | 
val approx_minus_cancel = thm "approx_minus_cancel";  | 
|
2159  | 
val approx_add_minus = thm "approx_add_minus";  | 
|
2160  | 
val approx_mult1 = thm "approx_mult1";  | 
|
2161  | 
val approx_mult2 = thm "approx_mult2";  | 
|
2162  | 
val approx_mult_subst = thm "approx_mult_subst";  | 
|
2163  | 
val approx_mult_subst2 = thm "approx_mult_subst2";  | 
|
2164  | 
val approx_mult_subst_SReal = thm "approx_mult_subst_SReal";  | 
|
2165  | 
val approx_eq_imp = thm "approx_eq_imp";  | 
|
2166  | 
val Infinitesimal_minus_approx = thm "Infinitesimal_minus_approx";  | 
|
2167  | 
val bex_Infinitesimal_iff = thm "bex_Infinitesimal_iff";  | 
|
2168  | 
val bex_Infinitesimal_iff2 = thm "bex_Infinitesimal_iff2";  | 
|
2169  | 
val Infinitesimal_add_approx = thm "Infinitesimal_add_approx";  | 
|
2170  | 
val Infinitesimal_add_approx_self = thm "Infinitesimal_add_approx_self";  | 
|
2171  | 
val Infinitesimal_add_approx_self2 = thm "Infinitesimal_add_approx_self2";  | 
|
2172  | 
val Infinitesimal_add_minus_approx_self = thm "Infinitesimal_add_minus_approx_self";  | 
|
2173  | 
val Infinitesimal_add_cancel = thm "Infinitesimal_add_cancel";  | 
|
2174  | 
val Infinitesimal_add_right_cancel = thm "Infinitesimal_add_right_cancel";  | 
|
2175  | 
val approx_add_left_cancel = thm "approx_add_left_cancel";  | 
|
2176  | 
val approx_add_right_cancel = thm "approx_add_right_cancel";  | 
|
2177  | 
val approx_add_mono1 = thm "approx_add_mono1";  | 
|
2178  | 
val approx_add_mono2 = thm "approx_add_mono2";  | 
|
2179  | 
val approx_add_left_iff = thm "approx_add_left_iff";  | 
|
2180  | 
val approx_add_right_iff = thm "approx_add_right_iff";  | 
|
2181  | 
val approx_HFinite = thm "approx_HFinite";  | 
|
2182  | 
val approx_hypreal_of_real_HFinite = thm "approx_hypreal_of_real_HFinite";  | 
|
2183  | 
val approx_mult_HFinite = thm "approx_mult_HFinite";  | 
|
2184  | 
val approx_mult_hypreal_of_real = thm "approx_mult_hypreal_of_real";  | 
|
2185  | 
val approx_SReal_mult_cancel_zero = thm "approx_SReal_mult_cancel_zero";  | 
|
2186  | 
val approx_mult_SReal1 = thm "approx_mult_SReal1";  | 
|
2187  | 
val approx_mult_SReal2 = thm "approx_mult_SReal2";  | 
|
2188  | 
val approx_mult_SReal_zero_cancel_iff = thm "approx_mult_SReal_zero_cancel_iff";  | 
|
2189  | 
val approx_SReal_mult_cancel = thm "approx_SReal_mult_cancel";  | 
|
2190  | 
val approx_SReal_mult_cancel_iff1 = thm "approx_SReal_mult_cancel_iff1";  | 
|
2191  | 
val approx_le_bound = thm "approx_le_bound";  | 
|
2192  | 
val Infinitesimal_less_SReal = thm "Infinitesimal_less_SReal";  | 
|
2193  | 
val Infinitesimal_less_SReal2 = thm "Infinitesimal_less_SReal2";  | 
|
2194  | 
val SReal_not_Infinitesimal = thm "SReal_not_Infinitesimal";  | 
|
2195  | 
val SReal_minus_not_Infinitesimal = thm "SReal_minus_not_Infinitesimal";  | 
|
2196  | 
val SReal_Int_Infinitesimal_zero = thm "SReal_Int_Infinitesimal_zero";  | 
|
2197  | 
val SReal_Infinitesimal_zero = thm "SReal_Infinitesimal_zero";  | 
|
2198  | 
val SReal_HFinite_diff_Infinitesimal = thm "SReal_HFinite_diff_Infinitesimal";  | 
|
2199  | 
val hypreal_of_real_HFinite_diff_Infinitesimal = thm "hypreal_of_real_HFinite_diff_Infinitesimal";  | 
|
2200  | 
val hypreal_of_real_Infinitesimal_iff_0 = thm "hypreal_of_real_Infinitesimal_iff_0";  | 
|
2201  | 
val number_of_not_Infinitesimal = thm "number_of_not_Infinitesimal";  | 
|
2202  | 
val one_not_Infinitesimal = thm "one_not_Infinitesimal";  | 
|
2203  | 
val approx_SReal_not_zero = thm "approx_SReal_not_zero";  | 
|
2204  | 
val HFinite_diff_Infinitesimal_approx = thm "HFinite_diff_Infinitesimal_approx";  | 
|
2205  | 
val Infinitesimal_ratio = thm "Infinitesimal_ratio";  | 
|
2206  | 
val SReal_approx_iff = thm "SReal_approx_iff";  | 
|
2207  | 
val number_of_approx_iff = thm "number_of_approx_iff";  | 
|
2208  | 
val hypreal_of_real_approx_iff = thm "hypreal_of_real_approx_iff";  | 
|
2209  | 
val hypreal_of_real_approx_number_of_iff = thm "hypreal_of_real_approx_number_of_iff";  | 
|
2210  | 
val approx_unique_real = thm "approx_unique_real";  | 
|
2211  | 
val hypreal_isLub_unique = thm "hypreal_isLub_unique";  | 
|
2212  | 
val hypreal_setle_less_trans = thm "hypreal_setle_less_trans";  | 
|
2213  | 
val hypreal_gt_isUb = thm "hypreal_gt_isUb";  | 
|
2214  | 
val st_part_Ex = thm "st_part_Ex";  | 
|
2215  | 
val st_part_Ex1 = thm "st_part_Ex1";  | 
|
2216  | 
val HFinite_Int_HInfinite_empty = thm "HFinite_Int_HInfinite_empty";  | 
|
2217  | 
val HFinite_not_HInfinite = thm "HFinite_not_HInfinite";  | 
|
2218  | 
val not_HFinite_HInfinite = thm "not_HFinite_HInfinite";  | 
|
2219  | 
val HInfinite_HFinite_disj = thm "HInfinite_HFinite_disj";  | 
|
2220  | 
val HInfinite_HFinite_iff = thm "HInfinite_HFinite_iff";  | 
|
2221  | 
val HFinite_HInfinite_iff = thm "HFinite_HInfinite_iff";  | 
|
2222  | 
val HInfinite_diff_HFinite_Infinitesimal_disj = thm "HInfinite_diff_HFinite_Infinitesimal_disj";  | 
|
2223  | 
val HFinite_inverse = thm "HFinite_inverse";  | 
|
2224  | 
val HFinite_inverse2 = thm "HFinite_inverse2";  | 
|
2225  | 
val Infinitesimal_inverse_HFinite = thm "Infinitesimal_inverse_HFinite";  | 
|
2226  | 
val HFinite_not_Infinitesimal_inverse = thm "HFinite_not_Infinitesimal_inverse";  | 
|
2227  | 
val approx_inverse = thm "approx_inverse";  | 
|
2228  | 
val hypreal_of_real_approx_inverse = thm "hypreal_of_real_approx_inverse";  | 
|
2229  | 
val inverse_add_Infinitesimal_approx = thm "inverse_add_Infinitesimal_approx";  | 
|
2230  | 
val inverse_add_Infinitesimal_approx2 = thm "inverse_add_Infinitesimal_approx2";  | 
|
2231  | 
val inverse_add_Infinitesimal_approx_Infinitesimal = thm "inverse_add_Infinitesimal_approx_Infinitesimal";  | 
|
2232  | 
val Infinitesimal_square_iff = thm "Infinitesimal_square_iff";  | 
|
2233  | 
val HFinite_square_iff = thm "HFinite_square_iff";  | 
|
2234  | 
val HInfinite_square_iff = thm "HInfinite_square_iff";  | 
|
2235  | 
val approx_HFinite_mult_cancel = thm "approx_HFinite_mult_cancel";  | 
|
2236  | 
val approx_HFinite_mult_cancel_iff1 = thm "approx_HFinite_mult_cancel_iff1";  | 
|
2237  | 
val approx_hrabs_disj = thm "approx_hrabs_disj";  | 
|
2238  | 
val monad_hrabs_Un_subset = thm "monad_hrabs_Un_subset";  | 
|
2239  | 
val Infinitesimal_monad_eq = thm "Infinitesimal_monad_eq";  | 
|
2240  | 
val mem_monad_iff = thm "mem_monad_iff";  | 
|
2241  | 
val Infinitesimal_monad_zero_iff = thm "Infinitesimal_monad_zero_iff";  | 
|
2242  | 
val monad_zero_minus_iff = thm "monad_zero_minus_iff";  | 
|
2243  | 
val monad_zero_hrabs_iff = thm "monad_zero_hrabs_iff";  | 
|
2244  | 
val mem_monad_self = thm "mem_monad_self";  | 
|
2245  | 
val approx_subset_monad = thm "approx_subset_monad";  | 
|
2246  | 
val approx_subset_monad2 = thm "approx_subset_monad2";  | 
|
2247  | 
val mem_monad_approx = thm "mem_monad_approx";  | 
|
2248  | 
val approx_mem_monad = thm "approx_mem_monad";  | 
|
2249  | 
val approx_mem_monad2 = thm "approx_mem_monad2";  | 
|
2250  | 
val approx_mem_monad_zero = thm "approx_mem_monad_zero";  | 
|
2251  | 
val Infinitesimal_approx_hrabs = thm "Infinitesimal_approx_hrabs";  | 
|
2252  | 
val less_Infinitesimal_less = thm "less_Infinitesimal_less";  | 
|
2253  | 
val Ball_mem_monad_gt_zero = thm "Ball_mem_monad_gt_zero";  | 
|
2254  | 
val Ball_mem_monad_less_zero = thm "Ball_mem_monad_less_zero";  | 
|
2255  | 
val approx_hrabs1 = thm "approx_hrabs1";  | 
|
2256  | 
val approx_hrabs2 = thm "approx_hrabs2";  | 
|
2257  | 
val approx_hrabs = thm "approx_hrabs";  | 
|
2258  | 
val approx_hrabs_zero_cancel = thm "approx_hrabs_zero_cancel";  | 
|
2259  | 
val approx_hrabs_add_Infinitesimal = thm "approx_hrabs_add_Infinitesimal";  | 
|
2260  | 
val approx_hrabs_add_minus_Infinitesimal = thm "approx_hrabs_add_minus_Infinitesimal";  | 
|
2261  | 
val hrabs_add_Infinitesimal_cancel = thm "hrabs_add_Infinitesimal_cancel";  | 
|
2262  | 
val hrabs_add_minus_Infinitesimal_cancel = thm "hrabs_add_minus_Infinitesimal_cancel";  | 
|
2263  | 
val hypreal_less_minus_iff = thm "hypreal_less_minus_iff";  | 
|
2264  | 
val Infinitesimal_add_hypreal_of_real_less = thm "Infinitesimal_add_hypreal_of_real_less";  | 
|
2265  | 
val Infinitesimal_add_hrabs_hypreal_of_real_less = thm "Infinitesimal_add_hrabs_hypreal_of_real_less";  | 
|
2266  | 
val Infinitesimal_add_hrabs_hypreal_of_real_less2 = thm "Infinitesimal_add_hrabs_hypreal_of_real_less2";  | 
|
2267  | 
val hypreal_of_real_le_add_Infininitesimal_cancel2 = thm"hypreal_of_real_le_add_Infininitesimal_cancel2";  | 
|
2268  | 
val hypreal_of_real_less_Infinitesimal_le_zero = thm "hypreal_of_real_less_Infinitesimal_le_zero";  | 
|
2269  | 
val Infinitesimal_add_not_zero = thm "Infinitesimal_add_not_zero";  | 
|
2270  | 
val Infinitesimal_square_cancel = thm "Infinitesimal_square_cancel";  | 
|
2271  | 
val HFinite_square_cancel = thm "HFinite_square_cancel";  | 
|
2272  | 
val Infinitesimal_square_cancel2 = thm "Infinitesimal_square_cancel2";  | 
|
2273  | 
val HFinite_square_cancel2 = thm "HFinite_square_cancel2";  | 
|
2274  | 
val Infinitesimal_sum_square_cancel = thm "Infinitesimal_sum_square_cancel";  | 
|
2275  | 
val HFinite_sum_square_cancel = thm "HFinite_sum_square_cancel";  | 
|
2276  | 
val Infinitesimal_sum_square_cancel2 = thm "Infinitesimal_sum_square_cancel2";  | 
|
2277  | 
val HFinite_sum_square_cancel2 = thm "HFinite_sum_square_cancel2";  | 
|
2278  | 
val Infinitesimal_sum_square_cancel3 = thm "Infinitesimal_sum_square_cancel3";  | 
|
2279  | 
val HFinite_sum_square_cancel3 = thm "HFinite_sum_square_cancel3";  | 
|
2280  | 
val monad_hrabs_less = thm "monad_hrabs_less";  | 
|
2281  | 
val mem_monad_SReal_HFinite = thm "mem_monad_SReal_HFinite";  | 
|
2282  | 
val st_approx_self = thm "st_approx_self";  | 
|
2283  | 
val st_SReal = thm "st_SReal";  | 
|
2284  | 
val st_HFinite = thm "st_HFinite";  | 
|
2285  | 
val st_SReal_eq = thm "st_SReal_eq";  | 
|
2286  | 
val st_hypreal_of_real = thm "st_hypreal_of_real";  | 
|
2287  | 
val st_eq_approx = thm "st_eq_approx";  | 
|
2288  | 
val approx_st_eq = thm "approx_st_eq";  | 
|
2289  | 
val st_eq_approx_iff = thm "st_eq_approx_iff";  | 
|
2290  | 
val st_Infinitesimal_add_SReal = thm "st_Infinitesimal_add_SReal";  | 
|
2291  | 
val st_Infinitesimal_add_SReal2 = thm "st_Infinitesimal_add_SReal2";  | 
|
2292  | 
val HFinite_st_Infinitesimal_add = thm "HFinite_st_Infinitesimal_add";  | 
|
2293  | 
val st_add = thm "st_add";  | 
|
2294  | 
val st_number_of = thm "st_number_of";  | 
|
2295  | 
val st_minus = thm "st_minus";  | 
|
2296  | 
val st_diff = thm "st_diff";  | 
|
2297  | 
val st_mult = thm "st_mult";  | 
|
2298  | 
val st_Infinitesimal = thm "st_Infinitesimal";  | 
|
2299  | 
val st_not_Infinitesimal = thm "st_not_Infinitesimal";  | 
|
2300  | 
val st_inverse = thm "st_inverse";  | 
|
2301  | 
val st_divide = thm "st_divide";  | 
|
2302  | 
val st_idempotent = thm "st_idempotent";  | 
|
2303  | 
val Infinitesimal_add_st_less = thm "Infinitesimal_add_st_less";  | 
|
2304  | 
val Infinitesimal_add_st_le_cancel = thm "Infinitesimal_add_st_le_cancel";  | 
|
2305  | 
val st_le = thm "st_le";  | 
|
2306  | 
val st_zero_le = thm "st_zero_le";  | 
|
2307  | 
val st_zero_ge = thm "st_zero_ge";  | 
|
2308  | 
val st_hrabs = thm "st_hrabs";  | 
|
2309  | 
val FreeUltrafilterNat_HFinite = thm "FreeUltrafilterNat_HFinite";  | 
|
2310  | 
val HFinite_FreeUltrafilterNat_iff = thm "HFinite_FreeUltrafilterNat_iff";  | 
|
2311  | 
val FreeUltrafilterNat_const_Finite = thm "FreeUltrafilterNat_const_Finite";  | 
|
2312  | 
val FreeUltrafilterNat_HInfinite = thm "FreeUltrafilterNat_HInfinite";  | 
|
2313  | 
val HInfinite_FreeUltrafilterNat_iff = thm "HInfinite_FreeUltrafilterNat_iff";  | 
|
2314  | 
val Infinitesimal_FreeUltrafilterNat = thm "Infinitesimal_FreeUltrafilterNat";  | 
|
2315  | 
val FreeUltrafilterNat_Infinitesimal = thm "FreeUltrafilterNat_Infinitesimal";  | 
|
2316  | 
val Infinitesimal_FreeUltrafilterNat_iff = thm "Infinitesimal_FreeUltrafilterNat_iff";  | 
|
2317  | 
val Infinitesimal_hypreal_of_nat_iff = thm "Infinitesimal_hypreal_of_nat_iff";  | 
|
2318  | 
val Suc_Un_eq = thm "Suc_Un_eq";  | 
|
2319  | 
val finite_nat_segment = thm "finite_nat_segment";  | 
|
2320  | 
val finite_real_of_nat_segment = thm "finite_real_of_nat_segment";  | 
|
2321  | 
val finite_real_of_nat_less_real = thm "finite_real_of_nat_less_real";  | 
|
2322  | 
val finite_real_of_nat_le_real = thm "finite_real_of_nat_le_real";  | 
|
2323  | 
val finite_rabs_real_of_nat_le_real = thm "finite_rabs_real_of_nat_le_real";  | 
|
2324  | 
val rabs_real_of_nat_le_real_FreeUltrafilterNat = thm "rabs_real_of_nat_le_real_FreeUltrafilterNat";  | 
|
2325  | 
val FreeUltrafilterNat_nat_gt_real = thm "FreeUltrafilterNat_nat_gt_real";  | 
|
2326  | 
val hypreal_omega = thm "hypreal_omega";  | 
|
2327  | 
val FreeUltrafilterNat_omega = thm "FreeUltrafilterNat_omega";  | 
|
2328  | 
val HInfinite_omega = thm "HInfinite_omega";  | 
|
2329  | 
val Infinitesimal_epsilon = thm "Infinitesimal_epsilon";  | 
|
2330  | 
val HFinite_epsilon = thm "HFinite_epsilon";  | 
|
2331  | 
val epsilon_approx_zero = thm "epsilon_approx_zero";  | 
|
2332  | 
val real_of_nat_less_inverse_iff = thm "real_of_nat_less_inverse_iff";  | 
|
2333  | 
val finite_inverse_real_of_posnat_gt_real = thm "finite_inverse_real_of_posnat_gt_real";  | 
|
2334  | 
val real_of_nat_inverse_le_iff = thm "real_of_nat_inverse_le_iff";  | 
|
2335  | 
val real_of_nat_inverse_eq_iff = thm "real_of_nat_inverse_eq_iff";  | 
|
2336  | 
val finite_inverse_real_of_posnat_ge_real = thm "finite_inverse_real_of_posnat_ge_real";  | 
|
2337  | 
val inverse_real_of_posnat_ge_real_FreeUltrafilterNat = thm "inverse_real_of_posnat_ge_real_FreeUltrafilterNat";  | 
|
2338  | 
val FreeUltrafilterNat_inverse_real_of_posnat = thm "FreeUltrafilterNat_inverse_real_of_posnat";  | 
|
2339  | 
val real_seq_to_hypreal_Infinitesimal = thm "real_seq_to_hypreal_Infinitesimal";  | 
|
2340  | 
val real_seq_to_hypreal_approx = thm "real_seq_to_hypreal_approx";  | 
|
2341  | 
val real_seq_to_hypreal_approx2 = thm "real_seq_to_hypreal_approx2";  | 
|
2342  | 
val real_seq_to_hypreal_Infinitesimal2 = thm "real_seq_to_hypreal_Infinitesimal2";  | 
|
2343  | 
val HInfinite_HFinite_add = thm "HInfinite_HFinite_add";  | 
|
2344  | 
val HInfinite_ge_HInfinite = thm "HInfinite_ge_HInfinite";  | 
|
2345  | 
val Infinitesimal_inverse_HInfinite = thm "Infinitesimal_inverse_HInfinite";  | 
|
2346  | 
val HInfinite_HFinite_not_Infinitesimal_mult = thm "HInfinite_HFinite_not_Infinitesimal_mult";  | 
|
2347  | 
val HInfinite_HFinite_not_Infinitesimal_mult2 = thm "HInfinite_HFinite_not_Infinitesimal_mult2";  | 
|
2348  | 
val HInfinite_gt_SReal = thm "HInfinite_gt_SReal";  | 
|
2349  | 
val HInfinite_gt_zero_gt_one = thm "HInfinite_gt_zero_gt_one";  | 
|
2350  | 
val not_HInfinite_one = thm "not_HInfinite_one";  | 
|
2351  | 
*}  | 
|
2352  | 
||
| 10751 | 2353  | 
end  | 
2354  | 
||
2355  | 
||
2356  | 
||
2357  |