70 "X \<in> InternalSets ==> UNIV - X \<in> InternalSets" |
70 "X \<in> InternalSets ==> UNIV - X \<in> InternalSets" |
71 apply (subgoal_tac "UNIV - X = - X") |
71 apply (subgoal_tac "UNIV - X = - X") |
72 by (auto intro: InternalSets_Compl) |
72 by (auto intro: InternalSets_Compl) |
73 |
73 |
74 |
74 |
75 subsection{*Nonstandard Extensions of Functions*} |
75 subsection\<open>Nonstandard Extensions of Functions\<close> |
76 |
76 |
77 text{* Example of transfer of a property from reals to hyperreals |
77 text\<open>Example of transfer of a property from reals to hyperreals |
78 --- used for limit comparison of sequences*} |
78 --- used for limit comparison of sequences\<close> |
79 |
79 |
80 lemma starfun_le_mono: |
80 lemma starfun_le_mono: |
81 "\<forall>n. N \<le> n --> f n \<le> g n |
81 "\<forall>n. N \<le> n --> f n \<le> g n |
82 ==> \<forall>n. hypnat_of_nat N \<le> n --> ( *f* f) n \<le> ( *f* g) n" |
82 ==> \<forall>n. hypnat_of_nat N \<le> n --> ( *f* f) n \<le> ( *f* g) n" |
83 by transfer |
83 by transfer |
86 lemma starfun_less_mono: |
86 lemma starfun_less_mono: |
87 "\<forall>n. N \<le> n --> f n < g n |
87 "\<forall>n. N \<le> n --> f n < g n |
88 ==> \<forall>n. hypnat_of_nat N \<le> n --> ( *f* f) n < ( *f* g) n" |
88 ==> \<forall>n. hypnat_of_nat N \<le> n --> ( *f* f) n < ( *f* g) n" |
89 by transfer |
89 by transfer |
90 |
90 |
91 text{*Nonstandard extension when we increment the argument by one*} |
91 text\<open>Nonstandard extension when we increment the argument by one\<close> |
92 |
92 |
93 lemma starfun_shift_one: |
93 lemma starfun_shift_one: |
94 "!!N. ( *f* (%n. f (Suc n))) N = ( *f* f) (N + (1::hypnat))" |
94 "!!N. ( *f* (%n. f (Suc n))) N = ( *f* f) (N + (1::hypnat))" |
95 by (transfer, simp) |
95 by (transfer, simp) |
96 |
96 |
97 text{*Nonstandard extension with absolute value*} |
97 text\<open>Nonstandard extension with absolute value\<close> |
98 |
98 |
99 lemma starfun_abs: "!!N. ( *f* (%n. \<bar>f n\<bar>)) N = \<bar>( *f* f) N\<bar>" |
99 lemma starfun_abs: "!!N. ( *f* (%n. \<bar>f n\<bar>)) N = \<bar>( *f* f) N\<bar>" |
100 by (transfer, rule refl) |
100 by (transfer, rule refl) |
101 |
101 |
102 text{*The hyperpow function as a nonstandard extension of realpow*} |
102 text\<open>The hyperpow function as a nonstandard extension of realpow\<close> |
103 |
103 |
104 lemma starfun_pow: "!!N. ( *f* (%n. r ^ n)) N = (hypreal_of_real r) pow N" |
104 lemma starfun_pow: "!!N. ( *f* (%n. r ^ n)) N = (hypreal_of_real r) pow N" |
105 by (transfer, rule refl) |
105 by (transfer, rule refl) |
106 |
106 |
107 lemma starfun_pow2: |
107 lemma starfun_pow2: |
109 by (transfer, rule refl) |
109 by (transfer, rule refl) |
110 |
110 |
111 lemma starfun_pow3: "!!R. ( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n" |
111 lemma starfun_pow3: "!!R. ( *f* (%r. r ^ n)) R = (R) pow hypnat_of_nat n" |
112 by (transfer, rule refl) |
112 by (transfer, rule refl) |
113 |
113 |
114 text{*The @{term hypreal_of_hypnat} function as a nonstandard extension of |
114 text\<open>The @{term hypreal_of_hypnat} function as a nonstandard extension of |
115 @{term real_of_nat} *} |
115 @{term real_of_nat}\<close> |
116 |
116 |
117 lemma starfunNat_real_of_nat: "( *f* real) = hypreal_of_hypnat" |
117 lemma starfunNat_real_of_nat: "( *f* real) = hypreal_of_hypnat" |
118 by transfer (simp add: fun_eq_iff) |
118 by transfer (simp add: fun_eq_iff) |
119 |
119 |
120 lemma starfun_inverse_real_of_nat_eq: |
120 lemma starfun_inverse_real_of_nat_eq: |
123 apply (rule_tac f1 = inverse in starfun_o2 [THEN subst]) |
123 apply (rule_tac f1 = inverse in starfun_o2 [THEN subst]) |
124 apply (subgoal_tac "hypreal_of_hypnat N ~= 0") |
124 apply (subgoal_tac "hypreal_of_hypnat N ~= 0") |
125 apply (simp_all add: zero_less_HNatInfinite starfunNat_real_of_nat starfun_inverse_inverse) |
125 apply (simp_all add: zero_less_HNatInfinite starfunNat_real_of_nat starfun_inverse_inverse) |
126 done |
126 done |
127 |
127 |
128 text{*Internal functions - some redundancy with *f* now*} |
128 text\<open>Internal functions - some redundancy with *f* now\<close> |
129 |
129 |
130 lemma starfun_n: "( *fn* f) (star_n X) = star_n (%n. f n (X n))" |
130 lemma starfun_n: "( *fn* f) (star_n X) = star_n (%n. f n (X n))" |
131 by (simp add: starfun_n_def Ifun_star_n) |
131 by (simp add: starfun_n_def Ifun_star_n) |
132 |
132 |
133 text{*Multiplication: @{text "( *fn) x ( *gn) = *(fn x gn)"}*} |
133 text\<open>Multiplication: \<open>( *fn) x ( *gn) = *(fn x gn)\<close>\<close> |
134 |
134 |
135 lemma starfun_n_mult: |
135 lemma starfun_n_mult: |
136 "( *fn* f) z * ( *fn* g) z = ( *fn* (% i x. f i x * g i x)) z" |
136 "( *fn* f) z * ( *fn* g) z = ( *fn* (% i x. f i x * g i x)) z" |
137 apply (cases z) |
137 apply (cases z) |
138 apply (simp add: starfun_n star_n_mult) |
138 apply (simp add: starfun_n star_n_mult) |
139 done |
139 done |
140 |
140 |
141 text{*Addition: @{text "( *fn) + ( *gn) = *(fn + gn)"}*} |
141 text\<open>Addition: \<open>( *fn) + ( *gn) = *(fn + gn)\<close>\<close> |
142 |
142 |
143 lemma starfun_n_add: |
143 lemma starfun_n_add: |
144 "( *fn* f) z + ( *fn* g) z = ( *fn* (%i x. f i x + g i x)) z" |
144 "( *fn* f) z + ( *fn* g) z = ( *fn* (%i x. f i x + g i x)) z" |
145 apply (cases z) |
145 apply (cases z) |
146 apply (simp add: starfun_n star_n_add) |
146 apply (simp add: starfun_n star_n_add) |
147 done |
147 done |
148 |
148 |
149 text{*Subtraction: @{text "( *fn) - ( *gn) = *(fn + - gn)"}*} |
149 text\<open>Subtraction: \<open>( *fn) - ( *gn) = *(fn + - gn)\<close>\<close> |
150 |
150 |
151 lemma starfun_n_add_minus: |
151 lemma starfun_n_add_minus: |
152 "( *fn* f) z + -( *fn* g) z = ( *fn* (%i x. f i x + -g i x)) z" |
152 "( *fn* f) z + -( *fn* g) z = ( *fn* (%i x. f i x + -g i x)) z" |
153 apply (cases z) |
153 apply (cases z) |
154 apply (simp add: starfun_n star_n_minus star_n_add) |
154 apply (simp add: starfun_n star_n_minus star_n_add) |
155 done |
155 done |
156 |
156 |
157 |
157 |
158 text{*Composition: @{text "( *fn) o ( *gn) = *(fn o gn)"}*} |
158 text\<open>Composition: \<open>( *fn) o ( *gn) = *(fn o gn)\<close>\<close> |
159 |
159 |
160 lemma starfun_n_const_fun [simp]: |
160 lemma starfun_n_const_fun [simp]: |
161 "( *fn* (%i x. k)) z = star_of k" |
161 "( *fn* (%i x. k)) z = star_of k" |
162 apply (cases z) |
162 apply (cases z) |
163 apply (simp add: starfun_n star_of_def) |
163 apply (simp add: starfun_n star_of_def) |
181 apply (subgoal_tac "hypreal_of_hypnat N ~= 0") |
181 apply (subgoal_tac "hypreal_of_hypnat N ~= 0") |
182 apply (simp_all add: zero_less_HNatInfinite starfunNat_real_of_nat) |
182 apply (simp_all add: zero_less_HNatInfinite starfunNat_real_of_nat) |
183 done |
183 done |
184 |
184 |
185 |
185 |
186 subsection{*Nonstandard Characterization of Induction*} |
186 subsection\<open>Nonstandard Characterization of Induction\<close> |
187 |
187 |
188 lemma hypnat_induct_obj: |
188 lemma hypnat_induct_obj: |
189 "!!n. (( *p* P) (0::hypnat) & |
189 "!!n. (( *p* P) (0::hypnat) & |
190 (\<forall>n. ( *p* P)(n) --> ( *p* P)(n + 1))) |
190 (\<forall>n. ( *p* P)(n) --> ( *p* P)(n + 1))) |
191 --> ( *p* P)(n)" |
191 --> ( *p* P)(n)" |
219 "[| (S::hypnat set) \<in> InternalSets; S \<noteq> {} |] ==> \<exists>n \<in> S. \<forall>m \<in> S. n \<le> m" |
219 "[| (S::hypnat set) \<in> InternalSets; S \<noteq> {} |] ==> \<exists>n \<in> S. \<forall>m \<in> S. n \<le> m" |
220 apply (clarsimp simp add: InternalSets_def starset_n_def) |
220 apply (clarsimp simp add: InternalSets_def starset_n_def) |
221 apply (erule nonempty_set_star_has_least) |
221 apply (erule nonempty_set_star_has_least) |
222 done |
222 done |
223 |
223 |
224 text{* Goldblatt page 129 Thm 11.3.2*} |
224 text\<open>Goldblatt page 129 Thm 11.3.2\<close> |
225 lemma internal_induct_lemma: |
225 lemma internal_induct_lemma: |
226 "!!X::nat set star. [| (0::hypnat) \<in> Iset X; \<forall>n. n \<in> Iset X --> n + 1 \<in> Iset X |] |
226 "!!X::nat set star. [| (0::hypnat) \<in> Iset X; \<forall>n. n \<in> Iset X --> n + 1 \<in> Iset X |] |
227 ==> Iset X = (UNIV:: hypnat set)" |
227 ==> Iset X = (UNIV:: hypnat set)" |
228 apply (transfer UNIV_def) |
228 apply (transfer UNIV_def) |
229 apply (rule equalityI [OF subset_UNIV subsetI]) |
229 apply (rule equalityI [OF subset_UNIV subsetI]) |