20 |
20 |
21 |
21 |
22 subsection\<open>Closure Laws for SComplex, the Standard Complex Numbers\<close> |
22 subsection\<open>Closure Laws for SComplex, the Standard Complex Numbers\<close> |
23 |
23 |
24 lemma SComplex_minus_iff [simp]: "(-x \<in> SComplex) = (x \<in> SComplex)" |
24 lemma SComplex_minus_iff [simp]: "(-x \<in> SComplex) = (x \<in> SComplex)" |
25 by (auto, drule Standard_minus, auto) |
25 using Standard_minus by fastforce |
26 |
26 |
27 lemma SComplex_add_cancel: |
27 lemma SComplex_add_cancel: |
28 "[| x + y \<in> SComplex; y \<in> SComplex |] ==> x \<in> SComplex" |
28 "\<lbrakk>x + y \<in> SComplex; y \<in> SComplex\<rbrakk> \<Longrightarrow> x \<in> SComplex" |
29 by (drule (1) Standard_diff, simp) |
29 using Standard_diff by fastforce |
30 |
30 |
31 lemma SReal_hcmod_hcomplex_of_complex [simp]: |
31 lemma SReal_hcmod_hcomplex_of_complex [simp]: |
32 "hcmod (hcomplex_of_complex r) \<in> \<real>" |
32 "hcmod (hcomplex_of_complex r) \<in> \<real>" |
33 by (simp add: Reals_eq_Standard) |
33 by (simp add: Reals_eq_Standard) |
34 |
34 |
35 lemma SReal_hcmod_numeral [simp]: "hcmod (numeral w ::hcomplex) \<in> \<real>" |
35 lemma SReal_hcmod_numeral: "hcmod (numeral w ::hcomplex) \<in> \<real>" |
36 by (simp add: Reals_eq_Standard) |
36 by simp |
37 |
37 |
38 lemma SReal_hcmod_SComplex: "x \<in> SComplex ==> hcmod x \<in> \<real>" |
38 lemma SReal_hcmod_SComplex: "x \<in> SComplex \<Longrightarrow> hcmod x \<in> \<real>" |
39 by (simp add: Reals_eq_Standard) |
39 by (simp add: Reals_eq_Standard) |
40 |
40 |
41 lemma SComplex_divide_numeral: |
41 lemma SComplex_divide_numeral: |
42 "r \<in> SComplex ==> r/(numeral w::hcomplex) \<in> SComplex" |
42 "r \<in> SComplex \<Longrightarrow> r/(numeral w::hcomplex) \<in> SComplex" |
43 by simp |
43 by simp |
44 |
44 |
45 lemma SComplex_UNIV_complex: |
45 lemma SComplex_UNIV_complex: |
46 "{x. hcomplex_of_complex x \<in> SComplex} = (UNIV::complex set)" |
46 "{x. hcomplex_of_complex x \<in> SComplex} = (UNIV::complex set)" |
47 by simp |
47 by simp |
48 |
48 |
49 lemma SComplex_iff: "(x \<in> SComplex) = (\<exists>y. x = hcomplex_of_complex y)" |
49 lemma SComplex_iff: "(x \<in> SComplex) = (\<exists>y. x = hcomplex_of_complex y)" |
50 by (simp add: Standard_def image_def) |
50 by (simp add: Standard_def image_def) |
51 |
51 |
52 lemma hcomplex_of_complex_image: |
52 lemma hcomplex_of_complex_image: |
53 "hcomplex_of_complex `(UNIV::complex set) = SComplex" |
53 "range hcomplex_of_complex = SComplex" |
54 by (simp add: Standard_def) |
54 by (simp add: Standard_def) |
55 |
55 |
56 lemma inv_hcomplex_of_complex_image: "inv hcomplex_of_complex `SComplex = UNIV" |
56 lemma inv_hcomplex_of_complex_image: "inv hcomplex_of_complex `SComplex = UNIV" |
57 by (auto simp add: Standard_def image_def) (metis inj_star_of inv_f_f) |
57 by (auto simp add: Standard_def image_def) (metis inj_star_of inv_f_f) |
58 |
58 |
59 lemma SComplex_hcomplex_of_complex_image: |
59 lemma SComplex_hcomplex_of_complex_image: |
60 "\<lbrakk>\<exists>x. x \<in> P; P \<le> SComplex\<rbrakk> \<Longrightarrow> \<exists>Q. P = hcomplex_of_complex ` Q" |
60 "\<lbrakk>\<exists>x. x \<in> P; P \<le> SComplex\<rbrakk> \<Longrightarrow> \<exists>Q. P = hcomplex_of_complex ` Q" |
61 apply (simp add: Standard_def, blast) |
61 by (metis Standard_def subset_imageE) |
62 done |
|
63 |
62 |
64 lemma SComplex_SReal_dense: |
63 lemma SComplex_SReal_dense: |
65 "\<lbrakk>x \<in> SComplex; y \<in> SComplex; hcmod x < hcmod y |
64 "\<lbrakk>x \<in> SComplex; y \<in> SComplex; hcmod x < hcmod y |
66 \<rbrakk> \<Longrightarrow> \<exists>r \<in> Reals. hcmod x< r \<and> r < hcmod y" |
65 \<rbrakk> \<Longrightarrow> \<exists>r \<in> Reals. hcmod x< r \<and> r < hcmod y" |
67 apply (auto intro: SReal_dense simp add: SReal_hcmod_SComplex) |
66 by (simp add: SReal_dense SReal_hcmod_SComplex) |
68 done |
|
69 |
67 |
70 |
68 |
71 subsection\<open>The Finite Elements form a Subring\<close> |
69 subsection\<open>The Finite Elements form a Subring\<close> |
72 |
70 |
73 lemma HFinite_hcmod_hcomplex_of_complex [simp]: |
71 lemma HFinite_hcmod_hcomplex_of_complex [simp]: |
74 "hcmod (hcomplex_of_complex r) \<in> HFinite" |
72 "hcmod (hcomplex_of_complex r) \<in> HFinite" |
75 by (auto intro!: SReal_subset_HFinite [THEN subsetD]) |
73 by (auto intro!: SReal_subset_HFinite [THEN subsetD]) |
76 |
74 |
77 lemma HFinite_hcmod_iff: "(x \<in> HFinite) = (hcmod x \<in> HFinite)" |
75 lemma HFinite_hcmod_iff: "(x \<in> HFinite) = (hcmod x \<in> HFinite)" |
78 by (simp add: HFinite_def) |
76 by (simp add: HFinite_def) |
79 |
77 |
80 lemma HFinite_bounded_hcmod: |
78 lemma HFinite_bounded_hcmod: |
81 "\<lbrakk>x \<in> HFinite; y \<le> hcmod x; 0 \<le> y\<rbrakk> \<Longrightarrow> y \<in> HFinite" |
79 "\<lbrakk>x \<in> HFinite; y \<le> hcmod x; 0 \<le> y\<rbrakk> \<Longrightarrow> y \<in> HFinite" |
82 by (auto intro: HFinite_bounded simp add: HFinite_hcmod_iff) |
80 by (auto intro: HFinite_bounded simp add: HFinite_hcmod_iff) |
83 |
81 |
84 |
82 |
85 subsection\<open>The Complex Infinitesimals form a Subring\<close> |
83 subsection\<open>The Complex Infinitesimals form a Subring\<close> |
86 |
84 |
87 lemma hcomplex_sum_of_halves: "x/(2::hcomplex) + x/(2::hcomplex) = x" |
|
88 by auto |
|
89 |
|
90 lemma Infinitesimal_hcmod_iff: |
85 lemma Infinitesimal_hcmod_iff: |
91 "(z \<in> Infinitesimal) = (hcmod z \<in> Infinitesimal)" |
86 "(z \<in> Infinitesimal) = (hcmod z \<in> Infinitesimal)" |
92 by (simp add: Infinitesimal_def) |
87 by (simp add: Infinitesimal_def) |
93 |
88 |
94 lemma HInfinite_hcmod_iff: "(z \<in> HInfinite) = (hcmod z \<in> HInfinite)" |
89 lemma HInfinite_hcmod_iff: "(z \<in> HInfinite) = (hcmod z \<in> HInfinite)" |
95 by (simp add: HInfinite_def) |
90 by (simp add: HInfinite_def) |
96 |
91 |
97 lemma HFinite_diff_Infinitesimal_hcmod: |
92 lemma HFinite_diff_Infinitesimal_hcmod: |
98 "x \<in> HFinite - Infinitesimal ==> hcmod x \<in> HFinite - Infinitesimal" |
93 "x \<in> HFinite - Infinitesimal \<Longrightarrow> hcmod x \<in> HFinite - Infinitesimal" |
99 by (simp add: HFinite_hcmod_iff Infinitesimal_hcmod_iff) |
94 by (simp add: HFinite_hcmod_iff Infinitesimal_hcmod_iff) |
100 |
95 |
101 lemma hcmod_less_Infinitesimal: |
96 lemma hcmod_less_Infinitesimal: |
102 "[| e \<in> Infinitesimal; hcmod x < hcmod e |] ==> x \<in> Infinitesimal" |
97 "\<lbrakk>e \<in> Infinitesimal; hcmod x < hcmod e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal" |
103 by (auto elim: hrabs_less_Infinitesimal simp add: Infinitesimal_hcmod_iff) |
98 by (auto elim: hrabs_less_Infinitesimal simp add: Infinitesimal_hcmod_iff) |
104 |
99 |
105 lemma hcmod_le_Infinitesimal: |
100 lemma hcmod_le_Infinitesimal: |
106 "[| e \<in> Infinitesimal; hcmod x \<le> hcmod e |] ==> x \<in> Infinitesimal" |
101 "\<lbrakk>e \<in> Infinitesimal; hcmod x \<le> hcmod e\<rbrakk> \<Longrightarrow> x \<in> Infinitesimal" |
107 by (auto elim: hrabs_le_Infinitesimal simp add: Infinitesimal_hcmod_iff) |
102 by (auto elim: hrabs_le_Infinitesimal simp add: Infinitesimal_hcmod_iff) |
108 |
|
109 lemma Infinitesimal_interval_hcmod: |
|
110 "[| e \<in> Infinitesimal; |
|
111 e' \<in> Infinitesimal; |
|
112 hcmod e' < hcmod x ; hcmod x < hcmod e |
|
113 |] ==> x \<in> Infinitesimal" |
|
114 by (auto intro: Infinitesimal_interval simp add: Infinitesimal_hcmod_iff) |
|
115 |
|
116 lemma Infinitesimal_interval2_hcmod: |
|
117 "[| e \<in> Infinitesimal; |
|
118 e' \<in> Infinitesimal; |
|
119 hcmod e' \<le> hcmod x ; hcmod x \<le> hcmod e |
|
120 |] ==> x \<in> Infinitesimal" |
|
121 by (auto intro: Infinitesimal_interval2 simp add: Infinitesimal_hcmod_iff) |
|
122 |
103 |
123 |
104 |
124 subsection\<open>The ``Infinitely Close'' Relation\<close> |
105 subsection\<open>The ``Infinitely Close'' Relation\<close> |
125 |
106 |
126 (* |
|
127 Goalw [capprox_def,approx_def] "(z @c= w) = (hcmod z \<approx> hcmod w)" |
|
128 by (auto_tac (claset(),simpset() addsimps [Infinitesimal_hcmod_iff])); |
|
129 *) |
|
130 |
|
131 lemma approx_SComplex_mult_cancel_zero: |
107 lemma approx_SComplex_mult_cancel_zero: |
132 "[| a \<in> SComplex; a \<noteq> 0; a*x \<approx> 0 |] ==> x \<approx> 0" |
108 "\<lbrakk>a \<in> SComplex; a \<noteq> 0; a*x \<approx> 0\<rbrakk> \<Longrightarrow> x \<approx> 0" |
133 apply (drule Standard_inverse [THEN Standard_subset_HFinite [THEN subsetD]]) |
109 by (metis Infinitesimal_mult_disj SComplex_iff mem_infmal_iff star_of_Infinitesimal_iff_0 star_zero_def) |
134 apply (auto dest: approx_mult2 simp add: mult.assoc [symmetric]) |
110 |
135 done |
111 lemma approx_mult_SComplex1: "\<lbrakk>a \<in> SComplex; x \<approx> 0\<rbrakk> \<Longrightarrow> x*a \<approx> 0" |
136 |
112 using SComplex_iff approx_mult_subst_star_of by fastforce |
137 lemma approx_mult_SComplex1: "[| a \<in> SComplex; x \<approx> 0 |] ==> x*a \<approx> 0" |
113 |
138 by (auto dest: Standard_subset_HFinite [THEN subsetD] approx_mult1) |
114 lemma approx_mult_SComplex2: "\<lbrakk>a \<in> SComplex; x \<approx> 0\<rbrakk> \<Longrightarrow> a*x \<approx> 0" |
139 |
115 by (metis approx_mult_SComplex1 mult.commute) |
140 lemma approx_mult_SComplex2: "[| a \<in> SComplex; x \<approx> 0 |] ==> a*x \<approx> 0" |
|
141 by (auto dest: Standard_subset_HFinite [THEN subsetD] approx_mult2) |
|
142 |
116 |
143 lemma approx_mult_SComplex_zero_cancel_iff [simp]: |
117 lemma approx_mult_SComplex_zero_cancel_iff [simp]: |
144 "[|a \<in> SComplex; a \<noteq> 0 |] ==> (a*x \<approx> 0) = (x \<approx> 0)" |
118 "\<lbrakk>a \<in> SComplex; a \<noteq> 0\<rbrakk> \<Longrightarrow> (a*x \<approx> 0) = (x \<approx> 0)" |
145 by (blast intro: approx_SComplex_mult_cancel_zero approx_mult_SComplex2) |
119 using approx_SComplex_mult_cancel_zero approx_mult_SComplex2 by blast |
146 |
120 |
147 lemma approx_SComplex_mult_cancel: |
121 lemma approx_SComplex_mult_cancel: |
148 "[| a \<in> SComplex; a \<noteq> 0; a* w \<approx> a*z |] ==> w \<approx> z" |
122 "\<lbrakk>a \<in> SComplex; a \<noteq> 0; a*w \<approx> a*z\<rbrakk> \<Longrightarrow> w \<approx> z" |
149 apply (drule Standard_inverse [THEN Standard_subset_HFinite [THEN subsetD]]) |
123 by (metis approx_SComplex_mult_cancel_zero approx_minus_iff right_diff_distrib) |
150 apply (auto dest: approx_mult2 simp add: mult.assoc [symmetric]) |
|
151 done |
|
152 |
124 |
153 lemma approx_SComplex_mult_cancel_iff1 [simp]: |
125 lemma approx_SComplex_mult_cancel_iff1 [simp]: |
154 "[| a \<in> SComplex; a \<noteq> 0|] ==> (a* w \<approx> a*z) = (w \<approx> z)" |
126 "\<lbrakk>a \<in> SComplex; a \<noteq> 0\<rbrakk> \<Longrightarrow> (a*w \<approx> a*z) = (w \<approx> z)" |
155 by (auto intro!: approx_mult2 Standard_subset_HFinite [THEN subsetD] |
127 by (metis HFinite_star_of SComplex_iff approx_SComplex_mult_cancel approx_mult2) |
156 intro: approx_SComplex_mult_cancel) |
|
157 |
128 |
158 (* TODO: generalize following theorems: hcmod -> hnorm *) |
129 (* TODO: generalize following theorems: hcmod -> hnorm *) |
159 |
130 |
160 lemma approx_hcmod_approx_zero: "(x \<approx> y) = (hcmod (y - x) \<approx> 0)" |
131 lemma approx_hcmod_approx_zero: "(x \<approx> y) = (hcmod (y - x) \<approx> 0)" |
161 apply (subst hnorm_minus_commute) |
132 by (simp add: Infinitesimal_hcmod_iff approx_def hnorm_minus_commute) |
162 apply (simp add: approx_def Infinitesimal_hcmod_iff) |
|
163 done |
|
164 |
133 |
165 lemma approx_approx_zero_iff: "(x \<approx> 0) = (hcmod x \<approx> 0)" |
134 lemma approx_approx_zero_iff: "(x \<approx> 0) = (hcmod x \<approx> 0)" |
166 by (simp add: approx_hcmod_approx_zero) |
135 by (simp add: approx_hcmod_approx_zero) |
167 |
136 |
168 lemma approx_minus_zero_cancel_iff [simp]: "(-x \<approx> 0) = (x \<approx> 0)" |
137 lemma approx_minus_zero_cancel_iff [simp]: "(-x \<approx> 0) = (x \<approx> 0)" |
169 by (simp add: approx_def) |
138 by (simp add: approx_def) |
170 |
139 |
171 lemma Infinitesimal_hcmod_add_diff: |
140 lemma Infinitesimal_hcmod_add_diff: |
172 "u \<approx> 0 ==> hcmod(x + u) - hcmod x \<in> Infinitesimal" |
141 "u \<approx> 0 \<Longrightarrow> hcmod(x + u) - hcmod x \<in> Infinitesimal" |
173 apply (drule approx_approx_zero_iff [THEN iffD1]) |
142 by (metis add.commute add.left_neutral approx_add_right_iff approx_def approx_hnorm) |
174 apply (rule_tac e = "hcmod u" and e' = "- hcmod u" in Infinitesimal_interval2) |
143 |
175 apply (auto simp add: mem_infmal_iff [symmetric]) |
144 lemma approx_hcmod_add_hcmod: "u \<approx> 0 \<Longrightarrow> hcmod(x + u) \<approx> hcmod x" |
176 apply (rule_tac c1 = "hcmod x" in add_le_cancel_left [THEN iffD1]) |
145 using Infinitesimal_hcmod_add_diff approx_def by blast |
177 apply auto |
|
178 done |
|
179 |
|
180 lemma approx_hcmod_add_hcmod: "u \<approx> 0 ==> hcmod(x + u) \<approx> hcmod x" |
|
181 apply (rule approx_minus_iff [THEN iffD2]) |
|
182 apply (auto intro: Infinitesimal_hcmod_add_diff simp add: mem_infmal_iff [symmetric]) |
|
183 done |
|
184 |
146 |
185 |
147 |
186 subsection\<open>Zero is the Only Infinitesimal Complex Number\<close> |
148 subsection\<open>Zero is the Only Infinitesimal Complex Number\<close> |
187 |
149 |
188 lemma Infinitesimal_less_SComplex: |
150 lemma Infinitesimal_less_SComplex: |
189 "[| x \<in> SComplex; y \<in> Infinitesimal; 0 < hcmod x |] ==> hcmod y < hcmod x" |
151 "\<lbrakk>x \<in> SComplex; y \<in> Infinitesimal; 0 < hcmod x\<rbrakk> \<Longrightarrow> hcmod y < hcmod x" |
190 by (auto intro: Infinitesimal_less_SReal SReal_hcmod_SComplex simp add: Infinitesimal_hcmod_iff) |
152 by (auto intro: Infinitesimal_less_SReal SReal_hcmod_SComplex simp add: Infinitesimal_hcmod_iff) |
191 |
153 |
192 lemma SComplex_Int_Infinitesimal_zero: "SComplex Int Infinitesimal = {0}" |
154 lemma SComplex_Int_Infinitesimal_zero: "SComplex Int Infinitesimal = {0}" |
193 by (auto simp add: Standard_def Infinitesimal_hcmod_iff) |
155 by (auto simp add: Standard_def Infinitesimal_hcmod_iff) |
194 |
156 |
195 lemma SComplex_Infinitesimal_zero: |
157 lemma SComplex_Infinitesimal_zero: |
196 "[| x \<in> SComplex; x \<in> Infinitesimal|] ==> x = 0" |
158 "\<lbrakk>x \<in> SComplex; x \<in> Infinitesimal\<rbrakk> \<Longrightarrow> x = 0" |
197 by (cut_tac SComplex_Int_Infinitesimal_zero, blast) |
159 using SComplex_iff by auto |
198 |
160 |
199 lemma SComplex_HFinite_diff_Infinitesimal: |
161 lemma SComplex_HFinite_diff_Infinitesimal: |
200 "[| x \<in> SComplex; x \<noteq> 0 |] ==> x \<in> HFinite - Infinitesimal" |
162 "\<lbrakk>x \<in> SComplex; x \<noteq> 0\<rbrakk> \<Longrightarrow> x \<in> HFinite - Infinitesimal" |
201 by (auto dest: SComplex_Infinitesimal_zero Standard_subset_HFinite [THEN subsetD]) |
163 using SComplex_iff by auto |
202 |
|
203 lemma hcomplex_of_complex_HFinite_diff_Infinitesimal: |
|
204 "hcomplex_of_complex x \<noteq> 0 |
|
205 ==> hcomplex_of_complex x \<in> HFinite - Infinitesimal" |
|
206 by (rule SComplex_HFinite_diff_Infinitesimal, auto) |
|
207 |
164 |
208 lemma numeral_not_Infinitesimal [simp]: |
165 lemma numeral_not_Infinitesimal [simp]: |
209 "numeral w \<noteq> (0::hcomplex) ==> (numeral w::hcomplex) \<notin> Infinitesimal" |
166 "numeral w \<noteq> (0::hcomplex) \<Longrightarrow> (numeral w::hcomplex) \<notin> Infinitesimal" |
210 by (fast dest: Standard_numeral [THEN SComplex_Infinitesimal_zero]) |
167 by (fast dest: Standard_numeral [THEN SComplex_Infinitesimal_zero]) |
211 |
168 |
212 lemma approx_SComplex_not_zero: |
169 lemma approx_SComplex_not_zero: |
213 "[| y \<in> SComplex; x \<approx> y; y\<noteq> 0 |] ==> x \<noteq> 0" |
170 "\<lbrakk>y \<in> SComplex; x \<approx> y; y\<noteq> 0\<rbrakk> \<Longrightarrow> x \<noteq> 0" |
214 by (auto dest: SComplex_Infinitesimal_zero approx_sym [THEN mem_infmal_iff [THEN iffD2]]) |
171 by (auto dest: SComplex_Infinitesimal_zero approx_sym [THEN mem_infmal_iff [THEN iffD2]]) |
215 |
172 |
216 lemma SComplex_approx_iff: |
173 lemma SComplex_approx_iff: |
217 "[|x \<in> SComplex; y \<in> SComplex|] ==> (x \<approx> y) = (x = y)" |
174 "\<lbrakk>x \<in> SComplex; y \<in> SComplex\<rbrakk> \<Longrightarrow> (x \<approx> y) = (x = y)" |
218 by (auto simp add: Standard_def) |
175 by (auto simp add: Standard_def) |
219 |
|
220 lemma numeral_Infinitesimal_iff [simp]: |
|
221 "((numeral w :: hcomplex) \<in> Infinitesimal) = |
|
222 (numeral w = (0::hcomplex))" |
|
223 apply (rule iffI) |
|
224 apply (fast dest: Standard_numeral [THEN SComplex_Infinitesimal_zero]) |
|
225 apply (simp (no_asm_simp)) |
|
226 done |
|
227 |
176 |
228 lemma approx_unique_complex: |
177 lemma approx_unique_complex: |
229 "[| r \<in> SComplex; s \<in> SComplex; r \<approx> x; s \<approx> x|] ==> r = s" |
178 "\<lbrakk>r \<in> SComplex; s \<in> SComplex; r \<approx> x; s \<approx> x\<rbrakk> \<Longrightarrow> r = s" |
230 by (blast intro: SComplex_approx_iff [THEN iffD1] approx_trans2) |
179 by (blast intro: SComplex_approx_iff [THEN iffD1] approx_trans2) |
231 |
180 |
232 subsection \<open>Properties of \<^term>\<open>hRe\<close>, \<^term>\<open>hIm\<close> and \<^term>\<open>HComplex\<close>\<close> |
181 subsection \<open>Properties of \<^term>\<open>hRe\<close>, \<^term>\<open>hIm\<close> and \<^term>\<open>HComplex\<close>\<close> |
233 |
182 |
234 |
|
235 lemma abs_hRe_le_hcmod: "\<And>x. \<bar>hRe x\<bar> \<le> hcmod x" |
183 lemma abs_hRe_le_hcmod: "\<And>x. \<bar>hRe x\<bar> \<le> hcmod x" |
236 by transfer (rule abs_Re_le_cmod) |
184 by transfer (rule abs_Re_le_cmod) |
237 |
185 |
238 lemma abs_hIm_le_hcmod: "\<And>x. \<bar>hIm x\<bar> \<le> hcmod x" |
186 lemma abs_hIm_le_hcmod: "\<And>x. \<bar>hIm x\<bar> \<le> hcmod x" |
239 by transfer (rule abs_Im_le_cmod) |
187 by transfer (rule abs_Im_le_cmod) |
240 |
188 |
241 lemma Infinitesimal_hRe: "x \<in> Infinitesimal \<Longrightarrow> hRe x \<in> Infinitesimal" |
189 lemma Infinitesimal_hRe: "x \<in> Infinitesimal \<Longrightarrow> hRe x \<in> Infinitesimal" |
242 apply (rule InfinitesimalI2, simp) |
190 using Infinitesimal_hcmod_iff abs_hRe_le_hcmod hrabs_le_Infinitesimal by blast |
243 apply (rule order_le_less_trans [OF abs_hRe_le_hcmod]) |
|
244 apply (erule (1) InfinitesimalD2) |
|
245 done |
|
246 |
191 |
247 lemma Infinitesimal_hIm: "x \<in> Infinitesimal \<Longrightarrow> hIm x \<in> Infinitesimal" |
192 lemma Infinitesimal_hIm: "x \<in> Infinitesimal \<Longrightarrow> hIm x \<in> Infinitesimal" |
248 apply (rule InfinitesimalI2, simp) |
193 using Infinitesimal_hcmod_iff abs_hIm_le_hcmod hrabs_le_Infinitesimal by blast |
249 apply (rule order_le_less_trans [OF abs_hIm_le_hcmod]) |
|
250 apply (erule (1) InfinitesimalD2) |
|
251 done |
|
252 |
|
253 lemma real_sqrt_lessI: "\<lbrakk>0 < u; x < u\<^sup>2\<rbrakk> \<Longrightarrow> sqrt x < u" |
|
254 (* TODO: this belongs somewhere else *) |
|
255 by (frule real_sqrt_less_mono) simp |
|
256 |
|
257 lemma hypreal_sqrt_lessI: |
|
258 "\<And>x u. \<lbrakk>0 < u; x < u\<^sup>2\<rbrakk> \<Longrightarrow> ( *f* sqrt) x < u" |
|
259 by transfer (rule real_sqrt_lessI) |
|
260 |
|
261 lemma hypreal_sqrt_ge_zero: "\<And>x. 0 \<le> x \<Longrightarrow> 0 \<le> ( *f* sqrt) x" |
|
262 by transfer (rule real_sqrt_ge_zero) |
|
263 |
|
264 lemma Infinitesimal_sqrt: |
|
265 "\<lbrakk>x \<in> Infinitesimal; 0 \<le> x\<rbrakk> \<Longrightarrow> ( *f* sqrt) x \<in> Infinitesimal" |
|
266 apply (rule InfinitesimalI2) |
|
267 apply (drule_tac r="r\<^sup>2" in InfinitesimalD2, simp) |
|
268 apply (simp add: hypreal_sqrt_ge_zero) |
|
269 apply (rule hypreal_sqrt_lessI, simp_all) |
|
270 done |
|
271 |
194 |
272 lemma Infinitesimal_HComplex: |
195 lemma Infinitesimal_HComplex: |
273 "\<lbrakk>x \<in> Infinitesimal; y \<in> Infinitesimal\<rbrakk> \<Longrightarrow> HComplex x y \<in> Infinitesimal" |
196 "\<lbrakk>x \<in> Infinitesimal; y \<in> Infinitesimal\<rbrakk> \<Longrightarrow> HComplex x y \<in> Infinitesimal" |
274 apply (rule Infinitesimal_hcmod_iff [THEN iffD2]) |
197 apply (rule Infinitesimal_hcmod_iff [THEN iffD2]) |
275 apply (simp add: hcmod_i) |
198 apply (simp add: hcmod_i) |
324 apply (simp add: HFinite_hcmod_iff hcmod_i) |
239 apply (simp add: HFinite_hcmod_iff hcmod_i) |
325 done |
240 done |
326 |
241 |
327 lemma hcomplex_HFinite_iff: |
242 lemma hcomplex_HFinite_iff: |
328 "(x \<in> HFinite) = (hRe x \<in> HFinite \<and> hIm x \<in> HFinite)" |
243 "(x \<in> HFinite) = (hRe x \<in> HFinite \<and> hIm x \<in> HFinite)" |
329 apply (safe intro!: HFinite_hRe HFinite_hIm) |
244 using HFinite_HComplex HFinite_hIm HFinite_hRe by fastforce |
330 apply (drule (1) HFinite_HComplex, simp) |
|
331 done |
|
332 |
245 |
333 lemma hcomplex_HInfinite_iff: |
246 lemma hcomplex_HInfinite_iff: |
334 "(x \<in> HInfinite) = (hRe x \<in> HInfinite \<or> hIm x \<in> HInfinite)" |
247 "(x \<in> HInfinite) = (hRe x \<in> HInfinite \<or> hIm x \<in> HInfinite)" |
335 by (simp add: HInfinite_HFinite_iff hcomplex_HFinite_iff) |
248 by (simp add: HInfinite_HFinite_iff hcomplex_HFinite_iff) |
336 |
249 |
337 lemma hcomplex_of_hypreal_approx_iff [simp]: |
250 lemma hcomplex_of_hypreal_approx_iff [simp]: |
338 "(hcomplex_of_hypreal x \<approx> hcomplex_of_hypreal z) = (x \<approx> z)" |
251 "(hcomplex_of_hypreal x \<approx> hcomplex_of_hypreal z) = (x \<approx> z)" |
339 by (simp add: hcomplex_approx_iff) |
252 by (simp add: hcomplex_approx_iff) |
340 |
|
341 lemma Standard_HComplex: |
|
342 "\<lbrakk>x \<in> Standard; y \<in> Standard\<rbrakk> \<Longrightarrow> HComplex x y \<in> Standard" |
|
343 by (simp add: HComplex_def) |
|
344 |
253 |
345 (* Here we go - easy proof now!! *) |
254 (* Here we go - easy proof now!! *) |
346 lemma stc_part_Ex: "x \<in> HFinite \<Longrightarrow> \<exists>t \<in> SComplex. x \<approx> t" |
255 lemma stc_part_Ex: "x \<in> HFinite \<Longrightarrow> \<exists>t \<in> SComplex. x \<approx> t" |
347 apply (simp add: hcomplex_HFinite_iff hcomplex_approx_iff) |
256 apply (simp add: hcomplex_HFinite_iff hcomplex_approx_iff) |
348 apply (rule_tac x="HComplex (st (hRe x)) (st (hIm x))" in bexI) |
257 apply (rule_tac x="HComplex (st (hRe x)) (st (hIm x))" in bexI) |
349 apply (simp add: st_approx_self [THEN approx_sym]) |
258 apply (simp add: st_approx_self [THEN approx_sym]) |
350 apply (simp add: Standard_HComplex st_SReal [unfolded Reals_eq_Standard]) |
259 apply (simp add: Standard_HComplex st_SReal [unfolded Reals_eq_Standard]) |
351 done |
260 done |
352 |
261 |
353 lemma stc_part_Ex1: "x \<in> HFinite \<Longrightarrow> \<exists>!t. t \<in> SComplex \<and> x \<approx> t" |
262 lemma stc_part_Ex1: "x \<in> HFinite \<Longrightarrow> \<exists>!t. t \<in> SComplex \<and> x \<approx> t" |
354 apply (drule stc_part_Ex, safe) |
263 using approx_sym approx_unique_complex stc_part_Ex by blast |
355 apply (drule_tac [2] approx_sym, drule_tac [2] approx_sym, drule_tac [2] approx_sym) |
|
356 apply (auto intro!: approx_unique_complex) |
|
357 done |
|
358 |
|
359 lemmas hcomplex_of_complex_approx_inverse = |
|
360 hcomplex_of_complex_HFinite_diff_Infinitesimal [THEN [2] approx_inverse] |
|
361 |
264 |
362 |
265 |
363 subsection\<open>Theorems About Monads\<close> |
266 subsection\<open>Theorems About Monads\<close> |
364 |
267 |
365 lemma monad_zero_hcmod_iff: "(x \<in> monad 0) = (hcmod x \<in> monad 0)" |
268 lemma monad_zero_hcmod_iff: "(x \<in> monad 0) = (hcmod x \<in> monad 0)" |
366 by (simp add: Infinitesimal_monad_zero_iff [symmetric] Infinitesimal_hcmod_iff) |
269 by (simp add: Infinitesimal_monad_zero_iff [symmetric] Infinitesimal_hcmod_iff) |
367 |
270 |
368 |
271 |
369 subsection\<open>Theorems About Standard Part\<close> |
272 subsection\<open>Theorems About Standard Part\<close> |
370 |
273 |
371 lemma stc_approx_self: "x \<in> HFinite ==> stc x \<approx> x" |
274 lemma stc_approx_self: "x \<in> HFinite \<Longrightarrow> stc x \<approx> x" |
372 apply (simp add: stc_def) |
275 unfolding stc_def |
373 apply (frule stc_part_Ex, safe) |
276 by (metis (no_types, lifting) approx_reorient someI_ex stc_part_Ex1) |
374 apply (rule someI2) |
277 |
375 apply (auto intro: approx_sym) |
278 lemma stc_SComplex: "x \<in> HFinite \<Longrightarrow> stc x \<in> SComplex" |
376 done |
279 unfolding stc_def |
377 |
280 by (metis (no_types, lifting) SComplex_iff approx_sym someI_ex stc_part_Ex) |
378 lemma stc_SComplex: "x \<in> HFinite ==> stc x \<in> SComplex" |
281 |
379 apply (simp add: stc_def) |
282 lemma stc_HFinite: "x \<in> HFinite \<Longrightarrow> stc x \<in> HFinite" |
380 apply (frule stc_part_Ex, safe) |
283 by (erule stc_SComplex [THEN Standard_subset_HFinite [THEN subsetD]]) |
381 apply (rule someI2) |
|
382 apply (auto intro: approx_sym) |
|
383 done |
|
384 |
|
385 lemma stc_HFinite: "x \<in> HFinite ==> stc x \<in> HFinite" |
|
386 by (erule stc_SComplex [THEN Standard_subset_HFinite [THEN subsetD]]) |
|
387 |
284 |
388 lemma stc_unique: "\<lbrakk>y \<in> SComplex; y \<approx> x\<rbrakk> \<Longrightarrow> stc x = y" |
285 lemma stc_unique: "\<lbrakk>y \<in> SComplex; y \<approx> x\<rbrakk> \<Longrightarrow> stc x = y" |
389 apply (frule Standard_subset_HFinite [THEN subsetD]) |
286 by (metis SComplex_approx_iff SComplex_iff approx_monad_iff approx_star_of_HFinite stc_SComplex stc_approx_self) |
390 apply (drule (1) approx_HFinite) |
287 |
391 apply (unfold stc_def) |
288 lemma stc_SComplex_eq [simp]: "x \<in> SComplex \<Longrightarrow> stc x = x" |
392 apply (rule some_equality) |
289 by (simp add: stc_unique) |
393 apply (auto intro: approx_unique_complex) |
|
394 done |
|
395 |
|
396 lemma stc_SComplex_eq [simp]: "x \<in> SComplex ==> stc x = x" |
|
397 apply (erule stc_unique) |
|
398 apply (rule approx_refl) |
|
399 done |
|
400 |
|
401 lemma stc_hcomplex_of_complex: |
|
402 "stc (hcomplex_of_complex x) = hcomplex_of_complex x" |
|
403 by auto |
|
404 |
290 |
405 lemma stc_eq_approx: |
291 lemma stc_eq_approx: |
406 "[| x \<in> HFinite; y \<in> HFinite; stc x = stc y |] ==> x \<approx> y" |
292 "\<lbrakk>x \<in> HFinite; y \<in> HFinite; stc x = stc y\<rbrakk> \<Longrightarrow> x \<approx> y" |
407 by (auto dest!: stc_approx_self elim!: approx_trans3) |
293 by (auto dest!: stc_approx_self elim!: approx_trans3) |
408 |
294 |
409 lemma approx_stc_eq: |
295 lemma approx_stc_eq: |
410 "[| x \<in> HFinite; y \<in> HFinite; x \<approx> y |] ==> stc x = stc y" |
296 "\<lbrakk>x \<in> HFinite; y \<in> HFinite; x \<approx> y\<rbrakk> \<Longrightarrow> stc x = stc y" |
411 by (blast intro: approx_trans approx_trans2 SComplex_approx_iff [THEN iffD1] |
297 by (metis approx_sym approx_trans3 stc_part_Ex1 stc_unique) |
412 dest: stc_approx_self stc_SComplex) |
|
413 |
298 |
414 lemma stc_eq_approx_iff: |
299 lemma stc_eq_approx_iff: |
415 "[| x \<in> HFinite; y \<in> HFinite|] ==> (x \<approx> y) = (stc x = stc y)" |
300 "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> (x \<approx> y) = (stc x = stc y)" |
416 by (blast intro: approx_stc_eq stc_eq_approx) |
301 by (blast intro: approx_stc_eq stc_eq_approx) |
417 |
302 |
418 lemma stc_Infinitesimal_add_SComplex: |
303 lemma stc_Infinitesimal_add_SComplex: |
419 "[| x \<in> SComplex; e \<in> Infinitesimal |] ==> stc(x + e) = x" |
304 "\<lbrakk>x \<in> SComplex; e \<in> Infinitesimal\<rbrakk> \<Longrightarrow> stc(x + e) = x" |
420 apply (erule stc_unique) |
305 using Infinitesimal_add_approx_self stc_unique by blast |
421 apply (erule Infinitesimal_add_approx_self) |
|
422 done |
|
423 |
306 |
424 lemma stc_Infinitesimal_add_SComplex2: |
307 lemma stc_Infinitesimal_add_SComplex2: |
425 "[| x \<in> SComplex; e \<in> Infinitesimal |] ==> stc(e + x) = x" |
308 "\<lbrakk>x \<in> SComplex; e \<in> Infinitesimal\<rbrakk> \<Longrightarrow> stc(e + x) = x" |
426 apply (erule stc_unique) |
309 using Infinitesimal_add_approx_self2 stc_unique by blast |
427 apply (erule Infinitesimal_add_approx_self2) |
|
428 done |
|
429 |
310 |
430 lemma HFinite_stc_Infinitesimal_add: |
311 lemma HFinite_stc_Infinitesimal_add: |
431 "x \<in> HFinite ==> \<exists>e \<in> Infinitesimal. x = stc(x) + e" |
312 "x \<in> HFinite \<Longrightarrow> \<exists>e \<in> Infinitesimal. x = stc(x) + e" |
432 by (blast dest!: stc_approx_self [THEN approx_sym] bex_Infinitesimal_iff2 [THEN iffD2]) |
313 by (blast dest!: stc_approx_self [THEN approx_sym] bex_Infinitesimal_iff2 [THEN iffD2]) |
433 |
314 |
434 lemma stc_add: |
315 lemma stc_add: |
435 "[| x \<in> HFinite; y \<in> HFinite |] ==> stc (x + y) = stc(x) + stc(y)" |
316 "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> stc (x + y) = stc(x) + stc(y)" |
436 by (simp add: stc_unique stc_SComplex stc_approx_self approx_add) |
317 by (simp add: stc_unique stc_SComplex stc_approx_self approx_add) |
437 |
318 |
438 lemma stc_numeral [simp]: "stc (numeral w) = numeral w" |
319 lemma stc_zero: "stc 0 = 0" |
439 by (rule Standard_numeral [THEN stc_SComplex_eq]) |
320 by simp |
440 |
321 |
441 lemma stc_zero [simp]: "stc 0 = 0" |
322 lemma stc_one: "stc 1 = 1" |
442 by simp |
323 by simp |
443 |
324 |
444 lemma stc_one [simp]: "stc 1 = 1" |
325 lemma stc_minus: "y \<in> HFinite \<Longrightarrow> stc(-y) = -stc(y)" |
445 by simp |
326 by (simp add: stc_unique stc_SComplex stc_approx_self approx_minus) |
446 |
|
447 lemma stc_minus: "y \<in> HFinite ==> stc(-y) = -stc(y)" |
|
448 by (simp add: stc_unique stc_SComplex stc_approx_self approx_minus) |
|
449 |
327 |
450 lemma stc_diff: |
328 lemma stc_diff: |
451 "[| x \<in> HFinite; y \<in> HFinite |] ==> stc (x-y) = stc(x) - stc(y)" |
329 "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> \<Longrightarrow> stc (x-y) = stc(x) - stc(y)" |
452 by (simp add: stc_unique stc_SComplex stc_approx_self approx_diff) |
330 by (simp add: stc_unique stc_SComplex stc_approx_self approx_diff) |
453 |
331 |
454 lemma stc_mult: |
332 lemma stc_mult: |
455 "[| x \<in> HFinite; y \<in> HFinite |] |
333 "\<lbrakk>x \<in> HFinite; y \<in> HFinite\<rbrakk> |
456 ==> stc (x * y) = stc(x) * stc(y)" |
334 \<Longrightarrow> stc (x * y) = stc(x) * stc(y)" |
457 by (simp add: stc_unique stc_SComplex stc_approx_self approx_mult_HFinite) |
335 by (simp add: stc_unique stc_SComplex stc_approx_self approx_mult_HFinite) |
458 |
336 |
459 lemma stc_Infinitesimal: "x \<in> Infinitesimal ==> stc x = 0" |
337 lemma stc_Infinitesimal: "x \<in> Infinitesimal \<Longrightarrow> stc x = 0" |
460 by (simp add: stc_unique mem_infmal_iff) |
338 by (simp add: stc_unique mem_infmal_iff) |
461 |
339 |
462 lemma stc_not_Infinitesimal: "stc(x) \<noteq> 0 ==> x \<notin> Infinitesimal" |
340 lemma stc_not_Infinitesimal: "stc(x) \<noteq> 0 \<Longrightarrow> x \<notin> Infinitesimal" |
463 by (fast intro: stc_Infinitesimal) |
341 by (fast intro: stc_Infinitesimal) |
464 |
342 |
465 lemma stc_inverse: |
343 lemma stc_inverse: |
466 "[| x \<in> HFinite; stc x \<noteq> 0 |] |
344 "\<lbrakk>x \<in> HFinite; stc x \<noteq> 0\<rbrakk> \<Longrightarrow> stc(inverse x) = inverse (stc x)" |
467 ==> stc(inverse x) = inverse (stc x)" |
345 apply (drule stc_not_Infinitesimal) |
468 apply (drule stc_not_Infinitesimal) |
346 apply (simp add: stc_unique stc_SComplex stc_approx_self approx_inverse) |
469 apply (simp add: stc_unique stc_SComplex stc_approx_self approx_inverse) |
347 done |
470 done |
|
471 |
348 |
472 lemma stc_divide [simp]: |
349 lemma stc_divide [simp]: |
473 "[| x \<in> HFinite; y \<in> HFinite; stc y \<noteq> 0 |] |
350 "\<lbrakk>x \<in> HFinite; y \<in> HFinite; stc y \<noteq> 0\<rbrakk> |
474 ==> stc(x/y) = (stc x) / (stc y)" |
351 \<Longrightarrow> stc(x/y) = (stc x) / (stc y)" |
475 by (simp add: divide_inverse stc_mult stc_not_Infinitesimal HFinite_inverse stc_inverse) |
352 by (simp add: divide_inverse stc_mult stc_not_Infinitesimal HFinite_inverse stc_inverse) |
476 |
353 |
477 lemma stc_idempotent [simp]: "x \<in> HFinite ==> stc(stc(x)) = stc(x)" |
354 lemma stc_idempotent [simp]: "x \<in> HFinite \<Longrightarrow> stc(stc(x)) = stc(x)" |
478 by (blast intro: stc_HFinite stc_approx_self approx_stc_eq) |
355 by (blast intro: stc_HFinite stc_approx_self approx_stc_eq) |
479 |
356 |
480 lemma HFinite_HFinite_hcomplex_of_hypreal: |
357 lemma HFinite_HFinite_hcomplex_of_hypreal: |
481 "z \<in> HFinite ==> hcomplex_of_hypreal z \<in> HFinite" |
358 "z \<in> HFinite \<Longrightarrow> hcomplex_of_hypreal z \<in> HFinite" |
482 by (simp add: hcomplex_HFinite_iff) |
359 by (simp add: hcomplex_HFinite_iff) |
483 |
360 |
484 lemma SComplex_SReal_hcomplex_of_hypreal: |
361 lemma SComplex_SReal_hcomplex_of_hypreal: |
485 "x \<in> \<real> ==> hcomplex_of_hypreal x \<in> SComplex" |
362 "x \<in> \<real> \<Longrightarrow> hcomplex_of_hypreal x \<in> SComplex" |
486 apply (rule Standard_of_hypreal) |
363 by (simp add: Reals_eq_Standard) |
487 apply (simp add: Reals_eq_Standard) |
|
488 done |
|
489 |
364 |
490 lemma stc_hcomplex_of_hypreal: |
365 lemma stc_hcomplex_of_hypreal: |
491 "z \<in> HFinite ==> stc(hcomplex_of_hypreal z) = hcomplex_of_hypreal (st z)" |
366 "z \<in> HFinite \<Longrightarrow> stc(hcomplex_of_hypreal z) = hcomplex_of_hypreal (st z)" |
492 apply (rule stc_unique) |
367 apply (rule stc_unique) |
493 apply (rule SComplex_SReal_hcomplex_of_hypreal) |
368 apply (rule SComplex_SReal_hcomplex_of_hypreal) |
494 apply (erule st_SReal) |
369 apply (erule st_SReal) |
495 apply (simp add: hcomplex_of_hypreal_approx_iff st_approx_self) |
370 apply (simp add: hcomplex_of_hypreal_approx_iff st_approx_self) |
496 done |
371 done |
497 |
372 |
498 (* |
373 (* |
499 Goal "x \<in> HFinite ==> hcmod(stc x) = st(hcmod x)" |
374 Goal "x \<in> HFinite \<Longrightarrow> hcmod(stc x) = st(hcmod x)" |
500 by (dtac stc_approx_self 1) |
375 by (dtac stc_approx_self 1) |
501 by (auto_tac (claset(),simpset() addsimps [bex_Infinitesimal_iff2 RS sym])); |
376 by (auto_tac (claset(),simpset() addsimps [bex_Infinitesimal_iff2 RS sym])); |
502 |
377 |
503 |
378 |
504 approx_hcmod_add_hcmod |
379 approx_hcmod_add_hcmod |