author | kleing |
Sun, 12 Feb 2006 12:29:01 +0100 | |
changeset 19023 | 5652a536b7e8 |
parent 17318 | bc1c75855f3d |
child 19765 | dfe940911617 |
permissions | -rw-r--r-- |
10751 | 1 |
(* Title : Lim.thy |
14477 | 2 |
ID : $Id$ |
10751 | 3 |
Author : Jacques D. Fleuriot |
4 |
Copyright : 1998 University of Cambridge |
|
14477 | 5 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
6 |
GMVT by Benjamin Porter, 2005 |
10751 | 7 |
*) |
8 |
||
14477 | 9 |
header{*Limits, Continuity and Differentiation*} |
10751 | 10 |
|
15131 | 11 |
theory Lim |
15360 | 12 |
imports SEQ |
15131 | 13 |
begin |
14477 | 14 |
|
15 |
text{*Standard and Nonstandard Definitions*} |
|
10751 | 16 |
|
17 |
constdefs |
|
14477 | 18 |
LIM :: "[real=>real,real,real] => bool" |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
19 |
("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) |
10751 | 20 |
"f -- a --> L == |
15360 | 21 |
\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
22 |
--> \<bar>f x + -L\<bar> < r" |
10751 | 23 |
|
14477 | 24 |
NSLIM :: "[real=>real,real,real] => bool" |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
25 |
("((_)/ -- (_)/ --NS> (_))" [60, 0, 60] 60) |
14477 | 26 |
"f -- a --NS> L == (\<forall>x. (x \<noteq> hypreal_of_real a & |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
27 |
x @= hypreal_of_real a --> |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
28 |
( *f* f) x @= hypreal_of_real L))" |
10751 | 29 |
|
14477 | 30 |
isCont :: "[real=>real,real] => bool" |
31 |
"isCont f a == (f -- a --> (f a))" |
|
10751 | 32 |
|
14477 | 33 |
isNSCont :: "[real=>real,real] => bool" |
15228 | 34 |
--{*NS definition dispenses with limit notions*} |
14477 | 35 |
"isNSCont f a == (\<forall>y. y @= hypreal_of_real a --> |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
36 |
( *f* f) y @= hypreal_of_real (f a))" |
10751 | 37 |
|
14477 | 38 |
deriv:: "[real=>real,real,real] => bool" |
15228 | 39 |
--{*Differentiation: D is derivative of function f at x*} |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
40 |
("(DERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
14477 | 41 |
"DERIV f x :> D == ((%h. (f(x + h) + -f x)/h) -- 0 --> D)" |
10751 | 42 |
|
14477 | 43 |
nsderiv :: "[real=>real,real,real] => bool" |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
44 |
("(NSDERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) |
14477 | 45 |
"NSDERIV f x :> D == (\<forall>h \<in> Infinitesimal - {0}. |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
46 |
(( *f* f)(hypreal_of_real x + h) + |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
47 |
- hypreal_of_real (f x))/h @= hypreal_of_real D)" |
10751 | 48 |
|
14477 | 49 |
differentiable :: "[real=>real,real] => bool" (infixl "differentiable" 60) |
50 |
"f differentiable x == (\<exists>D. DERIV f x :> D)" |
|
10751 | 51 |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
52 |
NSdifferentiable :: "[real=>real,real] => bool" |
14477 | 53 |
(infixl "NSdifferentiable" 60) |
54 |
"f NSdifferentiable x == (\<exists>D. NSDERIV f x :> D)" |
|
10751 | 55 |
|
14477 | 56 |
increment :: "[real=>real,real,hypreal] => hypreal" |
57 |
"increment f x h == (@inc. f NSdifferentiable x & |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
58 |
inc = ( *f* f)(hypreal_of_real x + h) + -hypreal_of_real (f x))" |
10751 | 59 |
|
14477 | 60 |
isUCont :: "(real=>real) => bool" |
15360 | 61 |
"isUCont f == \<forall>r > 0. \<exists>s > 0. \<forall>x y. \<bar>x + -y\<bar> < s --> \<bar>f x + -f y\<bar> < r" |
10751 | 62 |
|
14477 | 63 |
isNSUCont :: "(real=>real) => bool" |
64 |
"isNSUCont f == (\<forall>x y. x @= y --> ( *f* f) x @= ( *f* f) y)" |
|
10751 | 65 |
|
66 |
||
67 |
consts |
|
68 |
Bolzano_bisect :: "[real*real=>bool, real, real, nat] => (real*real)" |
|
15228 | 69 |
--{*Used in the proof of the Bolzano theorem*} |
70 |
||
10751 | 71 |
|
72 |
primrec |
|
73 |
"Bolzano_bisect P a b 0 = (a,b)" |
|
74 |
"Bolzano_bisect P a b (Suc n) = |
|
75 |
(let (x,y) = Bolzano_bisect P a b n |
|
11704
3c50a2cd6f00
* sane numerals (stage 2): plain "num" syntax (removed "#");
wenzelm
parents:
11701
diff
changeset
|
76 |
in if P(x, (x+y)/2) then ((x+y)/2, y) |
14477 | 77 |
else (x, (x+y)/2))" |
78 |
||
79 |
||
80 |
||
81 |
section{*Some Purely Standard Proofs*} |
|
82 |
||
83 |
lemma LIM_eq: |
|
84 |
"f -- a --> L = |
|
15360 | 85 |
(\<forall>r>0.\<exists>s>0.\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < s --> \<bar>f x - L\<bar> < r)" |
14477 | 86 |
by (simp add: LIM_def diff_minus) |
87 |
||
88 |
lemma LIM_D: |
|
89 |
"[| f -- a --> L; 0<r |] |
|
15360 | 90 |
==> \<exists>s>0.\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < s --> \<bar>f x - L\<bar> < r" |
14477 | 91 |
by (simp add: LIM_eq) |
92 |
||
15228 | 93 |
lemma LIM_const [simp]: "(%x. k) -- x --> k" |
14477 | 94 |
by (simp add: LIM_def) |
95 |
||
96 |
lemma LIM_add: |
|
97 |
assumes f: "f -- a --> L" and g: "g -- a --> M" |
|
98 |
shows "(%x. f x + g(x)) -- a --> (L + M)" |
|
99 |
proof (simp add: LIM_eq, clarify) |
|
100 |
fix r :: real |
|
101 |
assume r: "0<r" |
|
102 |
from LIM_D [OF f half_gt_zero [OF r]] |
|
103 |
obtain fs |
|
104 |
where fs: "0 < fs" |
|
105 |
and fs_lt: "\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < fs --> \<bar>f x - L\<bar> < r/2" |
|
106 |
by blast |
|
107 |
from LIM_D [OF g half_gt_zero [OF r]] |
|
108 |
obtain gs |
|
109 |
where gs: "0 < gs" |
|
110 |
and gs_lt: "\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < gs --> \<bar>g x - M\<bar> < r/2" |
|
111 |
by blast |
|
15360 | 112 |
show "\<exists>s>0.\<forall>x. x \<noteq> a \<and> \<bar>x-a\<bar> < s \<longrightarrow> \<bar>f x + g x - (L + M)\<bar> < r" |
14477 | 113 |
proof (intro exI conjI strip) |
114 |
show "0 < min fs gs" by (simp add: fs gs) |
|
115 |
fix x :: real |
|
116 |
assume "x \<noteq> a \<and> \<bar>x-a\<bar> < min fs gs" |
|
117 |
with fs_lt gs_lt |
|
118 |
have "\<bar>f x - L\<bar> < r/2" and "\<bar>g x - M\<bar> < r/2" by (auto simp add: fs_lt) |
|
119 |
hence "\<bar>f x - L\<bar> + \<bar>g x - M\<bar> < r" by arith |
|
120 |
thus "\<bar>f x + g x - (L + M)\<bar> < r" |
|
121 |
by (blast intro: abs_diff_triangle_ineq order_le_less_trans) |
|
122 |
qed |
|
123 |
qed |
|
124 |
||
125 |
lemma LIM_minus: "f -- a --> L ==> (%x. -f(x)) -- a --> -L" |
|
126 |
apply (simp add: LIM_eq) |
|
127 |
apply (subgoal_tac "\<forall>x. \<bar>- f x + L\<bar> = \<bar>f x - L\<bar>") |
|
128 |
apply (simp_all add: abs_if) |
|
129 |
done |
|
130 |
||
131 |
lemma LIM_add_minus: |
|
132 |
"[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)" |
|
133 |
by (blast dest: LIM_add LIM_minus) |
|
134 |
||
135 |
lemma LIM_diff: |
|
136 |
"[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) - g(x)) -- x --> l-m" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
137 |
by (simp add: diff_minus LIM_add_minus) |
14477 | 138 |
|
139 |
||
140 |
lemma LIM_const_not_eq: "k \<noteq> L ==> ~ ((%x. k) -- a --> L)" |
|
141 |
proof (simp add: linorder_neq_iff LIM_eq, elim disjE) |
|
142 |
assume k: "k < L" |
|
15360 | 143 |
show "\<exists>r>0. \<forall>s>0. (\<exists>x. (x < a \<or> a < x) \<and> \<bar>x-a\<bar> < s) \<and> \<not> \<bar>k-L\<bar> < r" |
14477 | 144 |
proof (intro exI conjI strip) |
15086 | 145 |
show "0 < L-k" by (simp add: k compare_rls) |
14477 | 146 |
fix s :: real |
147 |
assume s: "0<s" |
|
148 |
{ from s show "s/2 + a < a \<or> a < s/2 + a" by arith |
|
149 |
next |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
150 |
from s show "\<bar>s / 2 + a - a\<bar> < s" by (simp add: abs_if) |
14477 | 151 |
next |
152 |
from s show "~ \<bar>k-L\<bar> < L-k" by (simp add: abs_if) } |
|
153 |
qed |
|
154 |
next |
|
155 |
assume k: "L < k" |
|
15360 | 156 |
show "\<exists>r>0.\<forall>s>0. (\<exists>x. (x < a \<or> a < x) \<and> \<bar>x-a\<bar> < s) \<and> \<not> \<bar>k-L\<bar> < r" |
14477 | 157 |
proof (intro exI conjI strip) |
15086 | 158 |
show "0 < k-L" by (simp add: k compare_rls) |
14477 | 159 |
fix s :: real |
160 |
assume s: "0<s" |
|
161 |
{ from s show "s/2 + a < a \<or> a < s/2 + a" by arith |
|
162 |
next |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
163 |
from s show "\<bar>s / 2 + a - a\<bar> < s" by (simp add: abs_if) |
14477 | 164 |
next |
165 |
from s show "~ \<bar>k-L\<bar> < k-L" by (simp add: abs_if) } |
|
166 |
qed |
|
167 |
qed |
|
168 |
||
169 |
lemma LIM_const_eq: "(%x. k) -- x --> L ==> k = L" |
|
170 |
apply (rule ccontr) |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
171 |
apply (blast dest: LIM_const_not_eq) |
14477 | 172 |
done |
173 |
||
174 |
lemma LIM_unique: "[| f -- a --> L; f -- a --> M |] ==> L = M" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
175 |
apply (drule LIM_diff, assumption) |
14477 | 176 |
apply (auto dest!: LIM_const_eq) |
177 |
done |
|
178 |
||
179 |
lemma LIM_mult_zero: |
|
180 |
assumes f: "f -- a --> 0" and g: "g -- a --> 0" |
|
181 |
shows "(%x. f(x) * g(x)) -- a --> 0" |
|
16924 | 182 |
proof (simp add: LIM_eq abs_mult, clarify) |
14477 | 183 |
fix r :: real |
184 |
assume r: "0<r" |
|
185 |
from LIM_D [OF f zero_less_one] |
|
186 |
obtain fs |
|
187 |
where fs: "0 < fs" |
|
188 |
and fs_lt: "\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < fs --> \<bar>f x\<bar> < 1" |
|
189 |
by auto |
|
190 |
from LIM_D [OF g r] |
|
191 |
obtain gs |
|
192 |
where gs: "0 < gs" |
|
193 |
and gs_lt: "\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < gs --> \<bar>g x\<bar> < r" |
|
194 |
by auto |
|
195 |
show "\<exists>s. 0 < s \<and> (\<forall>x. x \<noteq> a \<and> \<bar>x-a\<bar> < s \<longrightarrow> \<bar>f x\<bar> * \<bar>g x\<bar> < r)" |
|
196 |
proof (intro exI conjI strip) |
|
197 |
show "0 < min fs gs" by (simp add: fs gs) |
|
198 |
fix x :: real |
|
199 |
assume "x \<noteq> a \<and> \<bar>x-a\<bar> < min fs gs" |
|
200 |
with fs_lt gs_lt |
|
201 |
have "\<bar>f x\<bar> < 1" and "\<bar>g x\<bar> < r" by (auto simp add: fs_lt) |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
202 |
hence "\<bar>f x\<bar> * \<bar>g x\<bar> < 1*r" by (rule abs_mult_less) |
14477 | 203 |
thus "\<bar>f x\<bar> * \<bar>g x\<bar> < r" by simp |
204 |
qed |
|
205 |
qed |
|
206 |
||
207 |
lemma LIM_self: "(%x. x) -- a --> a" |
|
208 |
by (auto simp add: LIM_def) |
|
209 |
||
210 |
text{*Limits are equal for functions equal except at limit point*} |
|
211 |
lemma LIM_equal: |
|
212 |
"[| \<forall>x. x \<noteq> a --> (f x = g x) |] ==> (f -- a --> l) = (g -- a --> l)" |
|
213 |
by (simp add: LIM_def) |
|
214 |
||
215 |
text{*Two uses in Hyperreal/Transcendental.ML*} |
|
216 |
lemma LIM_trans: |
|
217 |
"[| (%x. f(x) + -g(x)) -- a --> 0; g -- a --> l |] ==> f -- a --> l" |
|
218 |
apply (drule LIM_add, assumption) |
|
219 |
apply (auto simp add: add_assoc) |
|
220 |
done |
|
221 |
||
222 |
||
223 |
subsection{*Relationships Between Standard and Nonstandard Concepts*} |
|
224 |
||
225 |
text{*Standard and NS definitions of Limit*} (*NEEDS STRUCTURING*) |
|
226 |
lemma LIM_NSLIM: |
|
227 |
"f -- x --> L ==> f -- x --NS> L" |
|
228 |
apply (simp add: LIM_def NSLIM_def approx_def) |
|
229 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
230 |
apply (rule_tac x = xa in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
231 |
apply (auto simp add: real_add_minus_iff starfun star_n_minus star_of_def star_n_add star_n_eq_iff) |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
232 |
apply (rule bexI [OF _ Rep_star_star_n], clarify) |
14477 | 233 |
apply (drule_tac x = u in spec, clarify) |
234 |
apply (drule_tac x = s in spec, clarify) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
235 |
apply (subgoal_tac "\<forall>n::nat. (Xa n) \<noteq> x & \<bar>(Xa n) + - x\<bar> < s --> \<bar>f (Xa n) + - L\<bar> < u") |
14477 | 236 |
prefer 2 apply blast |
237 |
apply (drule FreeUltrafilterNat_all, ultra) |
|
238 |
done |
|
239 |
||
15228 | 240 |
|
241 |
subsubsection{*Limit: The NS definition implies the standard definition.*} |
|
14477 | 242 |
|
15360 | 243 |
lemma lemma_LIM: "\<forall>s>0.\<exists>xa. xa \<noteq> x & |
244 |
\<bar>xa + - x\<bar> < s & r \<le> \<bar>f xa + -L\<bar> |
|
14477 | 245 |
==> \<forall>n::nat. \<exists>xa. xa \<noteq> x & |
246 |
\<bar>xa + -x\<bar> < inverse(real(Suc n)) & r \<le> \<bar>f xa + -L\<bar>" |
|
247 |
apply clarify |
|
248 |
apply (cut_tac n1 = n in real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive], auto) |
|
249 |
done |
|
250 |
||
251 |
lemma lemma_skolemize_LIM2: |
|
15360 | 252 |
"\<forall>s>0.\<exists>xa. xa \<noteq> x & \<bar>xa + - x\<bar> < s & r \<le> \<bar>f xa + -L\<bar> |
14477 | 253 |
==> \<exists>X. \<forall>n::nat. X n \<noteq> x & |
254 |
\<bar>X n + -x\<bar> < inverse(real(Suc n)) & r \<le> abs(f (X n) + -L)" |
|
255 |
apply (drule lemma_LIM) |
|
256 |
apply (drule choice, blast) |
|
257 |
done |
|
258 |
||
259 |
lemma lemma_simp: "\<forall>n. X n \<noteq> x & |
|
260 |
\<bar>X n + - x\<bar> < inverse (real(Suc n)) & |
|
261 |
r \<le> abs (f (X n) + - L) ==> |
|
262 |
\<forall>n. \<bar>X n + - x\<bar> < inverse (real(Suc n))" |
|
263 |
by auto |
|
264 |
||
265 |
||
15228 | 266 |
text{*NSLIM => LIM*} |
14477 | 267 |
|
268 |
lemma NSLIM_LIM: "f -- x --NS> L ==> f -- x --> L" |
|
269 |
apply (simp add: LIM_def NSLIM_def approx_def) |
|
270 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff, clarify) |
|
15228 | 271 |
apply (rule ccontr, simp) |
14477 | 272 |
apply (simp add: linorder_not_less) |
273 |
apply (drule lemma_skolemize_LIM2, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
274 |
apply (drule_tac x = "star_n X" in spec) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
275 |
apply (auto simp add: starfun star_n_minus star_of_def star_n_add star_n_eq_iff) |
14477 | 276 |
apply (drule lemma_simp [THEN real_seq_to_hypreal_Infinitesimal]) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
277 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff star_of_def star_n_minus star_n_add star_n_eq_iff, blast) |
14477 | 278 |
apply (drule spec, drule mp, assumption) |
279 |
apply (drule FreeUltrafilterNat_all, ultra) |
|
280 |
done |
|
281 |
||
282 |
||
15228 | 283 |
theorem LIM_NSLIM_iff: "(f -- x --> L) = (f -- x --NS> L)" |
14477 | 284 |
by (blast intro: LIM_NSLIM NSLIM_LIM) |
285 |
||
15228 | 286 |
text{*Proving properties of limits using nonstandard definition. |
287 |
The properties hold for standard limits as well!*} |
|
14477 | 288 |
|
289 |
lemma NSLIM_mult: |
|
290 |
"[| f -- x --NS> l; g -- x --NS> m |] |
|
291 |
==> (%x. f(x) * g(x)) -- x --NS> (l * m)" |
|
15228 | 292 |
by (auto simp add: NSLIM_def intro!: approx_mult_HFinite) |
14477 | 293 |
|
15228 | 294 |
lemma LIM_mult2: |
295 |
"[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) * g(x)) -- x --> (l * m)" |
|
14477 | 296 |
by (simp add: LIM_NSLIM_iff NSLIM_mult) |
297 |
||
298 |
lemma NSLIM_add: |
|
299 |
"[| f -- x --NS> l; g -- x --NS> m |] |
|
300 |
==> (%x. f(x) + g(x)) -- x --NS> (l + m)" |
|
15228 | 301 |
by (auto simp add: NSLIM_def intro!: approx_add) |
14477 | 302 |
|
15228 | 303 |
lemma LIM_add2: |
304 |
"[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + g(x)) -- x --> (l + m)" |
|
14477 | 305 |
by (simp add: LIM_NSLIM_iff NSLIM_add) |
306 |
||
307 |
||
15228 | 308 |
lemma NSLIM_const [simp]: "(%x. k) -- x --NS> k" |
14477 | 309 |
by (simp add: NSLIM_def) |
310 |
||
311 |
lemma LIM_const2: "(%x. k) -- x --> k" |
|
312 |
by (simp add: LIM_NSLIM_iff) |
|
313 |
||
314 |
lemma NSLIM_minus: "f -- a --NS> L ==> (%x. -f(x)) -- a --NS> -L" |
|
315 |
by (simp add: NSLIM_def) |
|
316 |
||
317 |
lemma LIM_minus2: "f -- a --> L ==> (%x. -f(x)) -- a --> -L" |
|
318 |
by (simp add: LIM_NSLIM_iff NSLIM_minus) |
|
319 |
||
320 |
||
321 |
lemma NSLIM_add_minus: "[| f -- x --NS> l; g -- x --NS> m |] ==> (%x. f(x) + -g(x)) -- x --NS> (l + -m)" |
|
322 |
by (blast dest: NSLIM_add NSLIM_minus) |
|
323 |
||
324 |
lemma LIM_add_minus2: "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)" |
|
325 |
by (simp add: LIM_NSLIM_iff NSLIM_add_minus) |
|
326 |
||
327 |
||
328 |
lemma NSLIM_inverse: |
|
329 |
"[| f -- a --NS> L; L \<noteq> 0 |] |
|
330 |
==> (%x. inverse(f(x))) -- a --NS> (inverse L)" |
|
331 |
apply (simp add: NSLIM_def, clarify) |
|
332 |
apply (drule spec) |
|
333 |
apply (auto simp add: hypreal_of_real_approx_inverse) |
|
334 |
done |
|
335 |
||
336 |
lemma LIM_inverse: "[| f -- a --> L; L \<noteq> 0 |] ==> (%x. inverse(f(x))) -- a --> (inverse L)" |
|
337 |
by (simp add: LIM_NSLIM_iff NSLIM_inverse) |
|
338 |
||
339 |
||
340 |
lemma NSLIM_zero: |
|
341 |
assumes f: "f -- a --NS> l" shows "(%x. f(x) + -l) -- a --NS> 0" |
|
15228 | 342 |
proof - |
14477 | 343 |
have "(\<lambda>x. f x + - l) -- a --NS> l + -l" |
15228 | 344 |
by (rule NSLIM_add_minus [OF f NSLIM_const]) |
14477 | 345 |
thus ?thesis by simp |
346 |
qed |
|
347 |
||
348 |
lemma LIM_zero2: "f -- a --> l ==> (%x. f(x) + -l) -- a --> 0" |
|
349 |
by (simp add: LIM_NSLIM_iff NSLIM_zero) |
|
350 |
||
351 |
lemma NSLIM_zero_cancel: "(%x. f(x) - l) -- x --NS> 0 ==> f -- x --NS> l" |
|
352 |
apply (drule_tac g = "%x. l" and m = l in NSLIM_add) |
|
353 |
apply (auto simp add: diff_minus add_assoc) |
|
354 |
done |
|
355 |
||
356 |
lemma LIM_zero_cancel: "(%x. f(x) - l) -- x --> 0 ==> f -- x --> l" |
|
357 |
apply (drule_tac g = "%x. l" and M = l in LIM_add) |
|
358 |
apply (auto simp add: diff_minus add_assoc) |
|
359 |
done |
|
360 |
||
361 |
lemma NSLIM_not_zero: "k \<noteq> 0 ==> ~ ((%x. k) -- x --NS> 0)" |
|
362 |
apply (simp add: NSLIM_def) |
|
363 |
apply (rule_tac x = "hypreal_of_real x + epsilon" in exI) |
|
364 |
apply (auto intro: Infinitesimal_add_approx_self [THEN approx_sym] |
|
365 |
simp add: hypreal_epsilon_not_zero) |
|
366 |
done |
|
367 |
||
368 |
lemma NSLIM_const_not_eq: "k \<noteq> L ==> ~ ((%x. k) -- x --NS> L)" |
|
369 |
apply (simp add: NSLIM_def) |
|
370 |
apply (rule_tac x = "hypreal_of_real x + epsilon" in exI) |
|
371 |
apply (auto intro: Infinitesimal_add_approx_self [THEN approx_sym] |
|
372 |
simp add: hypreal_epsilon_not_zero) |
|
373 |
done |
|
374 |
||
375 |
lemma NSLIM_const_eq: "(%x. k) -- x --NS> L ==> k = L" |
|
376 |
apply (rule ccontr) |
|
15228 | 377 |
apply (blast dest: NSLIM_const_not_eq) |
14477 | 378 |
done |
379 |
||
15228 | 380 |
text{* can actually be proved more easily by unfolding the definition!*} |
14477 | 381 |
lemma NSLIM_unique: "[| f -- x --NS> L; f -- x --NS> M |] ==> L = M" |
382 |
apply (drule NSLIM_minus) |
|
383 |
apply (drule NSLIM_add, assumption) |
|
384 |
apply (auto dest!: NSLIM_const_eq [symmetric]) |
|
385 |
done |
|
386 |
||
387 |
lemma LIM_unique2: "[| f -- x --> L; f -- x --> M |] ==> L = M" |
|
388 |
by (simp add: LIM_NSLIM_iff NSLIM_unique) |
|
389 |
||
390 |
||
391 |
lemma NSLIM_mult_zero: "[| f -- x --NS> 0; g -- x --NS> 0 |] ==> (%x. f(x)*g(x)) -- x --NS> 0" |
|
392 |
by (drule NSLIM_mult, auto) |
|
393 |
||
394 |
(* we can use the corresponding thm LIM_mult2 *) |
|
395 |
(* for standard definition of limit *) |
|
396 |
||
397 |
lemma LIM_mult_zero2: "[| f -- x --> 0; g -- x --> 0 |] ==> (%x. f(x)*g(x)) -- x --> 0" |
|
398 |
by (drule LIM_mult2, auto) |
|
399 |
||
400 |
||
401 |
lemma NSLIM_self: "(%x. x) -- a --NS> a" |
|
402 |
by (simp add: NSLIM_def) |
|
403 |
||
404 |
||
15228 | 405 |
subsection{* Derivatives and Continuity: NS and Standard properties*} |
406 |
||
407 |
subsubsection{*Continuity*} |
|
14477 | 408 |
|
409 |
lemma isNSContD: "[| isNSCont f a; y \<approx> hypreal_of_real a |] ==> ( *f* f) y \<approx> hypreal_of_real (f a)" |
|
410 |
by (simp add: isNSCont_def) |
|
411 |
||
412 |
lemma isNSCont_NSLIM: "isNSCont f a ==> f -- a --NS> (f a) " |
|
413 |
by (simp add: isNSCont_def NSLIM_def) |
|
414 |
||
415 |
lemma NSLIM_isNSCont: "f -- a --NS> (f a) ==> isNSCont f a" |
|
416 |
apply (simp add: isNSCont_def NSLIM_def, auto) |
|
417 |
apply (rule_tac Q = "y = hypreal_of_real a" in excluded_middle [THEN disjE], auto) |
|
418 |
done |
|
419 |
||
15228 | 420 |
text{*NS continuity can be defined using NS Limit in |
421 |
similar fashion to standard def of continuity*} |
|
14477 | 422 |
lemma isNSCont_NSLIM_iff: "(isNSCont f a) = (f -- a --NS> (f a))" |
423 |
by (blast intro: isNSCont_NSLIM NSLIM_isNSCont) |
|
424 |
||
15228 | 425 |
text{*Hence, NS continuity can be given |
426 |
in terms of standard limit*} |
|
14477 | 427 |
lemma isNSCont_LIM_iff: "(isNSCont f a) = (f -- a --> (f a))" |
428 |
by (simp add: LIM_NSLIM_iff isNSCont_NSLIM_iff) |
|
429 |
||
15228 | 430 |
text{*Moreover, it's trivial now that NS continuity |
431 |
is equivalent to standard continuity*} |
|
14477 | 432 |
lemma isNSCont_isCont_iff: "(isNSCont f a) = (isCont f a)" |
433 |
apply (simp add: isCont_def) |
|
434 |
apply (rule isNSCont_LIM_iff) |
|
435 |
done |
|
436 |
||
15228 | 437 |
text{*Standard continuity ==> NS continuity*} |
14477 | 438 |
lemma isCont_isNSCont: "isCont f a ==> isNSCont f a" |
439 |
by (erule isNSCont_isCont_iff [THEN iffD2]) |
|
440 |
||
15228 | 441 |
text{*NS continuity ==> Standard continuity*} |
14477 | 442 |
lemma isNSCont_isCont: "isNSCont f a ==> isCont f a" |
443 |
by (erule isNSCont_isCont_iff [THEN iffD1]) |
|
444 |
||
445 |
text{*Alternative definition of continuity*} |
|
446 |
(* Prove equivalence between NS limits - *) |
|
447 |
(* seems easier than using standard def *) |
|
448 |
lemma NSLIM_h_iff: "(f -- a --NS> L) = ((%h. f(a + h)) -- 0 --NS> L)" |
|
449 |
apply (simp add: NSLIM_def, auto) |
|
450 |
apply (drule_tac x = "hypreal_of_real a + x" in spec) |
|
451 |
apply (drule_tac [2] x = "-hypreal_of_real a + x" in spec, safe, simp) |
|
452 |
apply (rule mem_infmal_iff [THEN iffD2, THEN Infinitesimal_add_approx_self [THEN approx_sym]]) |
|
453 |
apply (rule_tac [4] approx_minus_iff2 [THEN iffD1]) |
|
15228 | 454 |
prefer 3 apply (simp add: add_commute) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
455 |
apply (rule_tac [2] x = x in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
456 |
apply (rule_tac [4] x = x in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
457 |
apply (auto simp add: starfun star_of_def star_n_minus star_n_add add_assoc approx_refl star_n_zero_num) |
14477 | 458 |
done |
459 |
||
460 |
lemma NSLIM_isCont_iff: "(f -- a --NS> f a) = ((%h. f(a + h)) -- 0 --NS> f a)" |
|
461 |
by (rule NSLIM_h_iff) |
|
462 |
||
463 |
lemma LIM_isCont_iff: "(f -- a --> f a) = ((%h. f(a + h)) -- 0 --> f(a))" |
|
464 |
by (simp add: LIM_NSLIM_iff NSLIM_isCont_iff) |
|
465 |
||
466 |
lemma isCont_iff: "(isCont f x) = ((%h. f(x + h)) -- 0 --> f(x))" |
|
467 |
by (simp add: isCont_def LIM_isCont_iff) |
|
468 |
||
15228 | 469 |
text{*Immediate application of nonstandard criterion for continuity can offer |
470 |
very simple proofs of some standard property of continuous functions*} |
|
14477 | 471 |
text{*sum continuous*} |
472 |
lemma isCont_add: "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a" |
|
473 |
by (auto intro: approx_add simp add: isNSCont_isCont_iff [symmetric] isNSCont_def) |
|
474 |
||
475 |
text{*mult continuous*} |
|
476 |
lemma isCont_mult: "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a" |
|
15228 | 477 |
by (auto intro!: starfun_mult_HFinite_approx |
478 |
simp del: starfun_mult [symmetric] |
|
14477 | 479 |
simp add: isNSCont_isCont_iff [symmetric] isNSCont_def) |
480 |
||
15228 | 481 |
text{*composition of continuous functions |
482 |
Note very short straightforard proof!*} |
|
14477 | 483 |
lemma isCont_o: "[| isCont f a; isCont g (f a) |] ==> isCont (g o f) a" |
484 |
by (auto simp add: isNSCont_isCont_iff [symmetric] isNSCont_def starfun_o [symmetric]) |
|
485 |
||
486 |
lemma isCont_o2: "[| isCont f a; isCont g (f a) |] ==> isCont (%x. g (f x)) a" |
|
487 |
by (auto dest: isCont_o simp add: o_def) |
|
488 |
||
489 |
lemma isNSCont_minus: "isNSCont f a ==> isNSCont (%x. - f x) a" |
|
490 |
by (simp add: isNSCont_def) |
|
491 |
||
492 |
lemma isCont_minus: "isCont f a ==> isCont (%x. - f x) a" |
|
493 |
by (auto simp add: isNSCont_isCont_iff [symmetric] isNSCont_minus) |
|
494 |
||
495 |
lemma isCont_inverse: |
|
496 |
"[| isCont f x; f x \<noteq> 0 |] ==> isCont (%x. inverse (f x)) x" |
|
497 |
apply (simp add: isCont_def) |
|
498 |
apply (blast intro: LIM_inverse) |
|
499 |
done |
|
500 |
||
501 |
lemma isNSCont_inverse: "[| isNSCont f x; f x \<noteq> 0 |] ==> isNSCont (%x. inverse (f x)) x" |
|
502 |
by (auto intro: isCont_inverse simp add: isNSCont_isCont_iff) |
|
503 |
||
504 |
lemma isCont_diff: |
|
505 |
"[| isCont f a; isCont g a |] ==> isCont (%x. f(x) - g(x)) a" |
|
506 |
apply (simp add: diff_minus) |
|
507 |
apply (auto intro: isCont_add isCont_minus) |
|
508 |
done |
|
509 |
||
15228 | 510 |
lemma isCont_const [simp]: "isCont (%x. k) a" |
14477 | 511 |
by (simp add: isCont_def) |
512 |
||
15228 | 513 |
lemma isNSCont_const [simp]: "isNSCont (%x. k) a" |
14477 | 514 |
by (simp add: isNSCont_def) |
515 |
||
15228 | 516 |
lemma isNSCont_abs [simp]: "isNSCont abs a" |
14477 | 517 |
apply (simp add: isNSCont_def) |
518 |
apply (auto intro: approx_hrabs simp add: hypreal_of_real_hrabs [symmetric] starfun_rabs_hrabs) |
|
519 |
done |
|
520 |
||
15228 | 521 |
lemma isCont_abs [simp]: "isCont abs a" |
14477 | 522 |
by (auto simp add: isNSCont_isCont_iff [symmetric]) |
15228 | 523 |
|
14477 | 524 |
|
525 |
(**************************************************************** |
|
526 |
(%* Leave as commented until I add topology theory or remove? *%) |
|
527 |
(%*------------------------------------------------------------ |
|
528 |
Elementary topology proof for a characterisation of |
|
529 |
continuity now: a function f is continuous if and only |
|
530 |
if the inverse image, {x. f(x) \<in> A}, of any open set A |
|
531 |
is always an open set |
|
532 |
------------------------------------------------------------*%) |
|
533 |
Goal "[| isNSopen A; \<forall>x. isNSCont f x |] |
|
534 |
==> isNSopen {x. f x \<in> A}" |
|
535 |
by (auto_tac (claset(),simpset() addsimps [isNSopen_iff1])); |
|
536 |
by (dtac (mem_monad_approx RS approx_sym); |
|
537 |
by (dres_inst_tac [("x","a")] spec 1); |
|
538 |
by (dtac isNSContD 1 THEN assume_tac 1) |
|
539 |
by (dtac bspec 1 THEN assume_tac 1) |
|
540 |
by (dres_inst_tac [("x","( *f* f) x")] approx_mem_monad2 1); |
|
541 |
by (blast_tac (claset() addIs [starfun_mem_starset]); |
|
542 |
qed "isNSCont_isNSopen"; |
|
543 |
||
544 |
Goalw [isNSCont_def] |
|
545 |
"\<forall>A. isNSopen A --> isNSopen {x. f x \<in> A} \ |
|
546 |
\ ==> isNSCont f x"; |
|
547 |
by (auto_tac (claset() addSIs [(mem_infmal_iff RS iffD1) RS |
|
548 |
(approx_minus_iff RS iffD2)],simpset() addsimps |
|
549 |
[Infinitesimal_def,SReal_iff])); |
|
550 |
by (dres_inst_tac [("x","{z. abs(z + -f(x)) < ya}")] spec 1); |
|
551 |
by (etac (isNSopen_open_interval RSN (2,impE)); |
|
552 |
by (auto_tac (claset(),simpset() addsimps [isNSopen_def,isNSnbhd_def])); |
|
553 |
by (dres_inst_tac [("x","x")] spec 1); |
|
554 |
by (auto_tac (claset() addDs [approx_sym RS approx_mem_monad], |
|
555 |
simpset() addsimps [hypreal_of_real_zero RS sym,STAR_starfun_rabs_add_minus])); |
|
556 |
qed "isNSopen_isNSCont"; |
|
557 |
||
558 |
Goal "(\<forall>x. isNSCont f x) = \ |
|
559 |
\ (\<forall>A. isNSopen A --> isNSopen {x. f(x) \<in> A})"; |
|
560 |
by (blast_tac (claset() addIs [isNSCont_isNSopen, |
|
561 |
isNSopen_isNSCont]); |
|
562 |
qed "isNSCont_isNSopen_iff"; |
|
563 |
||
564 |
(%*------- Standard version of same theorem --------*%) |
|
565 |
Goal "(\<forall>x. isCont f x) = \ |
|
566 |
\ (\<forall>A. isopen A --> isopen {x. f(x) \<in> A})"; |
|
567 |
by (auto_tac (claset() addSIs [isNSCont_isNSopen_iff], |
|
568 |
simpset() addsimps [isNSopen_isopen_iff RS sym, |
|
569 |
isNSCont_isCont_iff RS sym])); |
|
570 |
qed "isCont_isopen_iff"; |
|
571 |
*******************************************************************) |
|
572 |
||
573 |
text{*Uniform continuity*} |
|
574 |
lemma isNSUContD: "[| isNSUCont f; x \<approx> y|] ==> ( *f* f) x \<approx> ( *f* f) y" |
|
575 |
by (simp add: isNSUCont_def) |
|
576 |
||
577 |
lemma isUCont_isCont: "isUCont f ==> isCont f x" |
|
578 |
by (simp add: isUCont_def isCont_def LIM_def, meson) |
|
579 |
||
580 |
lemma isUCont_isNSUCont: "isUCont f ==> isNSUCont f" |
|
581 |
apply (simp add: isNSUCont_def isUCont_def approx_def) |
|
582 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
583 |
apply (rule_tac x = x in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
584 |
apply (rule_tac x = y in star_cases) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
585 |
apply (auto simp add: starfun star_n_minus star_n_add) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
586 |
apply (rule bexI [OF _ Rep_star_star_n], safe) |
14477 | 587 |
apply (drule_tac x = u in spec, clarify) |
588 |
apply (drule_tac x = s in spec, clarify) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
589 |
apply (subgoal_tac "\<forall>n::nat. abs ((Xa n) + - (Xb n)) < s --> abs (f (Xa n) + - f (Xb n)) < u") |
14477 | 590 |
prefer 2 apply blast |
591 |
apply (erule_tac V = "\<forall>x y. \<bar>x + - y\<bar> < s --> \<bar>f x + - f y\<bar> < u" in thin_rl) |
|
592 |
apply (drule FreeUltrafilterNat_all, ultra) |
|
593 |
done |
|
594 |
||
15360 | 595 |
lemma lemma_LIMu: "\<forall>s>0.\<exists>z y. \<bar>z + - y\<bar> < s & r \<le> \<bar>f z + -f y\<bar> |
596 |
==> \<forall>n::nat. \<exists>z y. \<bar>z + -y\<bar> < inverse(real(Suc n)) & r \<le> \<bar>f z + -f y\<bar>" |
|
14477 | 597 |
apply clarify |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
598 |
apply (cut_tac n1 = n |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
599 |
in real_of_nat_Suc_gt_zero [THEN positive_imp_inverse_positive], auto) |
14477 | 600 |
done |
601 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
602 |
lemma lemma_skolemize_LIM2u: |
15360 | 603 |
"\<forall>s>0.\<exists>z y. \<bar>z + - y\<bar> < s & r \<le> \<bar>f z + -f y\<bar> |
14477 | 604 |
==> \<exists>X Y. \<forall>n::nat. |
605 |
abs(X n + -(Y n)) < inverse(real(Suc n)) & |
|
606 |
r \<le> abs(f (X n) + -f (Y n))" |
|
607 |
apply (drule lemma_LIMu) |
|
608 |
apply (drule choice, safe) |
|
609 |
apply (drule choice, blast) |
|
610 |
done |
|
611 |
||
612 |
lemma lemma_simpu: "\<forall>n. \<bar>X n + -Y n\<bar> < inverse (real(Suc n)) & |
|
613 |
r \<le> abs (f (X n) + - f(Y n)) ==> |
|
614 |
\<forall>n. \<bar>X n + - Y n\<bar> < inverse (real(Suc n))" |
|
15228 | 615 |
by auto |
14477 | 616 |
|
617 |
lemma isNSUCont_isUCont: |
|
618 |
"isNSUCont f ==> isUCont f" |
|
619 |
apply (simp add: isNSUCont_def isUCont_def approx_def) |
|
620 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff, safe) |
|
15228 | 621 |
apply (rule ccontr, simp) |
14477 | 622 |
apply (simp add: linorder_not_less) |
623 |
apply (drule lemma_skolemize_LIM2u, safe) |
|
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
624 |
apply (drule_tac x = "star_n X" in spec) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
625 |
apply (drule_tac x = "star_n Y" in spec) |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
626 |
apply (simp add: starfun star_n_minus star_n_add, auto) |
14477 | 627 |
apply (drule lemma_simpu [THEN real_seq_to_hypreal_Infinitesimal2]) |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
628 |
apply (simp add: Infinitesimal_FreeUltrafilterNat_iff star_n_minus star_n_add, blast) |
14477 | 629 |
apply (drule_tac x = r in spec, clarify) |
630 |
apply (drule FreeUltrafilterNat_all, ultra) |
|
631 |
done |
|
632 |
||
633 |
text{*Derivatives*} |
|
634 |
lemma DERIV_iff: "(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- 0 --> D)" |
|
635 |
by (simp add: deriv_def) |
|
636 |
||
637 |
lemma DERIV_NS_iff: |
|
638 |
"(DERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- 0 --NS> D)" |
|
639 |
by (simp add: deriv_def LIM_NSLIM_iff) |
|
640 |
||
641 |
lemma DERIV_D: "DERIV f x :> D ==> (%h. (f(x + h) + - f(x))/h) -- 0 --> D" |
|
642 |
by (simp add: deriv_def) |
|
643 |
||
15228 | 644 |
lemma NS_DERIV_D: "DERIV f x :> D ==> (%h. (f(x + h) + - f(x))/h) -- 0 --NS> D" |
14477 | 645 |
by (simp add: deriv_def LIM_NSLIM_iff) |
646 |
||
15228 | 647 |
|
14477 | 648 |
subsubsection{*Uniqueness*} |
649 |
||
650 |
lemma DERIV_unique: |
|
651 |
"[| DERIV f x :> D; DERIV f x :> E |] ==> D = E" |
|
652 |
apply (simp add: deriv_def) |
|
653 |
apply (blast intro: LIM_unique) |
|
654 |
done |
|
655 |
||
656 |
lemma NSDeriv_unique: |
|
657 |
"[| NSDERIV f x :> D; NSDERIV f x :> E |] ==> D = E" |
|
658 |
apply (simp add: nsderiv_def) |
|
659 |
apply (cut_tac Infinitesimal_epsilon hypreal_epsilon_not_zero) |
|
15228 | 660 |
apply (auto dest!: bspec [where x=epsilon] |
661 |
intro!: inj_hypreal_of_real [THEN injD] |
|
14477 | 662 |
dest: approx_trans3) |
663 |
done |
|
664 |
||
665 |
subsubsection{*Differentiable*} |
|
666 |
||
667 |
lemma differentiableD: "f differentiable x ==> \<exists>D. DERIV f x :> D" |
|
668 |
by (simp add: differentiable_def) |
|
669 |
||
670 |
lemma differentiableI: "DERIV f x :> D ==> f differentiable x" |
|
671 |
by (force simp add: differentiable_def) |
|
672 |
||
673 |
lemma NSdifferentiableD: "f NSdifferentiable x ==> \<exists>D. NSDERIV f x :> D" |
|
674 |
by (simp add: NSdifferentiable_def) |
|
675 |
||
676 |
lemma NSdifferentiableI: "NSDERIV f x :> D ==> f NSdifferentiable x" |
|
677 |
by (force simp add: NSdifferentiable_def) |
|
678 |
||
679 |
subsubsection{*Alternative definition for differentiability*} |
|
680 |
||
681 |
lemma LIM_I: |
|
15360 | 682 |
"(!!r. 0<r ==> \<exists>s>0.\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < s --> \<bar>f x - L\<bar> < r) |
14477 | 683 |
==> f -- a --> L" |
684 |
by (simp add: LIM_eq) |
|
685 |
||
686 |
lemma DERIV_LIM_iff: |
|
687 |
"((%h. (f(a + h) - f(a)) / h) -- 0 --> D) = |
|
688 |
((%x. (f(x)-f(a)) / (x-a)) -- a --> D)" |
|
689 |
proof (intro iffI LIM_I) |
|
690 |
fix r::real |
|
691 |
assume r: "0<r" |
|
692 |
assume "(\<lambda>h. (f (a + h) - f a) / h) -- 0 --> D" |
|
693 |
from LIM_D [OF this r] |
|
694 |
obtain s |
|
695 |
where s: "0 < s" |
|
696 |
and s_lt: "\<forall>x. x \<noteq> 0 & \<bar>x\<bar> < s --> \<bar>(f (a + x) - f a) / x - D\<bar> < r" |
|
697 |
by auto |
|
698 |
show "\<exists>s. 0 < s \<and> |
|
699 |
(\<forall>x. x \<noteq> a \<and> \<bar>x-a\<bar> < s \<longrightarrow> \<bar>(f x - f a) / (x-a) - D\<bar> < r)" |
|
700 |
proof (intro exI conjI strip) |
|
701 |
show "0 < s" by (rule s) |
|
702 |
next |
|
703 |
fix x::real |
|
704 |
assume "x \<noteq> a \<and> \<bar>x-a\<bar> < s" |
|
705 |
with s_lt [THEN spec [where x="x-a"]] |
|
706 |
show "\<bar>(f x - f a) / (x-a) - D\<bar> < r" by auto |
|
707 |
qed |
|
708 |
next |
|
709 |
fix r::real |
|
710 |
assume r: "0<r" |
|
711 |
assume "(\<lambda>x. (f x - f a) / (x-a)) -- a --> D" |
|
712 |
from LIM_D [OF this r] |
|
713 |
obtain s |
|
714 |
where s: "0 < s" |
|
715 |
and s_lt: "\<forall>x. x \<noteq> a & \<bar>x-a\<bar> < s --> \<bar>(f x - f a)/(x-a) - D\<bar> < r" |
|
716 |
by auto |
|
717 |
show "\<exists>s. 0 < s \<and> |
|
718 |
(\<forall>x. x \<noteq> 0 & \<bar>x - 0\<bar> < s --> \<bar>(f (a + x) - f a) / x - D\<bar> < r)" |
|
719 |
proof (intro exI conjI strip) |
|
720 |
show "0 < s" by (rule s) |
|
721 |
next |
|
722 |
fix x::real |
|
723 |
assume "x \<noteq> 0 \<and> \<bar>x - 0\<bar> < s" |
|
724 |
with s_lt [THEN spec [where x="x+a"]] |
|
725 |
show "\<bar>(f (a + x) - f a) / x - D\<bar> < r" by (auto simp add: add_ac) |
|
726 |
qed |
|
727 |
qed |
|
728 |
||
729 |
lemma DERIV_iff2: "(DERIV f x :> D) = ((%z. (f(z) - f(x)) / (z-x)) -- x --> D)" |
|
730 |
by (simp add: deriv_def diff_minus [symmetric] DERIV_LIM_iff) |
|
731 |
||
732 |
||
733 |
subsection{*Equivalence of NS and standard definitions of differentiation*} |
|
734 |
||
15228 | 735 |
subsubsection{*First NSDERIV in terms of NSLIM*} |
14477 | 736 |
|
15228 | 737 |
text{*first equivalence *} |
14477 | 738 |
lemma NSDERIV_NSLIM_iff: |
739 |
"(NSDERIV f x :> D) = ((%h. (f(x + h) + - f(x))/h) -- 0 --NS> D)" |
|
740 |
apply (simp add: nsderiv_def NSLIM_def, auto) |
|
741 |
apply (drule_tac x = xa in bspec) |
|
742 |
apply (rule_tac [3] ccontr) |
|
743 |
apply (drule_tac [3] x = h in spec) |
|
744 |
apply (auto simp add: mem_infmal_iff starfun_lambda_cancel) |
|
745 |
done |
|
746 |
||
15228 | 747 |
text{*second equivalence *} |
14477 | 748 |
lemma NSDERIV_NSLIM_iff2: |
749 |
"(NSDERIV f x :> D) = ((%z. (f(z) - f(x)) / (z-x)) -- x --NS> D)" |
|
15228 | 750 |
by (simp add: NSDERIV_NSLIM_iff DERIV_LIM_iff diff_minus [symmetric] |
14477 | 751 |
LIM_NSLIM_iff [symmetric]) |
752 |
||
753 |
(* while we're at it! *) |
|
754 |
lemma NSDERIV_iff2: |
|
755 |
"(NSDERIV f x :> D) = |
|
756 |
(\<forall>w. |
|
757 |
w \<noteq> hypreal_of_real x & w \<approx> hypreal_of_real x --> |
|
758 |
( *f* (%z. (f z - f x) / (z-x))) w \<approx> hypreal_of_real D)" |
|
759 |
by (simp add: NSDERIV_NSLIM_iff2 NSLIM_def) |
|
760 |
||
761 |
(*FIXME DELETE*) |
|
762 |
lemma hypreal_not_eq_minus_iff: "(x \<noteq> a) = (x + -a \<noteq> (0::hypreal))" |
|
763 |
by (auto dest: hypreal_eq_minus_iff [THEN iffD2]) |
|
764 |
||
765 |
lemma NSDERIVD5: |
|
766 |
"(NSDERIV f x :> D) ==> |
|
767 |
(\<forall>u. u \<approx> hypreal_of_real x --> |
|
768 |
( *f* (%z. f z - f x)) u \<approx> hypreal_of_real D * (u - hypreal_of_real x))" |
|
769 |
apply (auto simp add: NSDERIV_iff2) |
|
770 |
apply (case_tac "u = hypreal_of_real x", auto) |
|
771 |
apply (drule_tac x = u in spec, auto) |
|
772 |
apply (drule_tac c = "u - hypreal_of_real x" and b = "hypreal_of_real D" in approx_mult1) |
|
773 |
apply (drule_tac [!] hypreal_not_eq_minus_iff [THEN iffD1]) |
|
774 |
apply (subgoal_tac [2] "( *f* (%z. z-x)) u \<noteq> (0::hypreal) ") |
|
15539 | 775 |
apply (auto simp add: diff_minus |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
776 |
approx_minus_iff [THEN iffD1, THEN mem_infmal_iff [THEN iffD2]] |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
777 |
Infinitesimal_subset_HFinite [THEN subsetD]) |
14477 | 778 |
done |
779 |
||
780 |
lemma NSDERIVD4: |
|
781 |
"(NSDERIV f x :> D) ==> |
|
782 |
(\<forall>h \<in> Infinitesimal. |
|
783 |
(( *f* f)(hypreal_of_real x + h) - |
|
784 |
hypreal_of_real (f x))\<approx> (hypreal_of_real D) * h)" |
|
785 |
apply (auto simp add: nsderiv_def) |
|
786 |
apply (case_tac "h = (0::hypreal) ") |
|
787 |
apply (auto simp add: diff_minus) |
|
788 |
apply (drule_tac x = h in bspec) |
|
789 |
apply (drule_tac [2] c = h in approx_mult1) |
|
790 |
apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
|
15539 | 791 |
simp add: diff_minus) |
14477 | 792 |
done |
793 |
||
794 |
lemma NSDERIVD3: |
|
795 |
"(NSDERIV f x :> D) ==> |
|
796 |
(\<forall>h \<in> Infinitesimal - {0}. |
|
797 |
(( *f* f)(hypreal_of_real x + h) - |
|
798 |
hypreal_of_real (f x))\<approx> (hypreal_of_real D) * h)" |
|
799 |
apply (auto simp add: nsderiv_def) |
|
800 |
apply (rule ccontr, drule_tac x = h in bspec) |
|
801 |
apply (drule_tac [2] c = h in approx_mult1) |
|
802 |
apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
|
15539 | 803 |
simp add: mult_assoc diff_minus) |
14477 | 804 |
done |
805 |
||
806 |
text{*Now equivalence between NSDERIV and DERIV*} |
|
807 |
lemma NSDERIV_DERIV_iff: "(NSDERIV f x :> D) = (DERIV f x :> D)" |
|
808 |
by (simp add: deriv_def NSDERIV_NSLIM_iff LIM_NSLIM_iff) |
|
809 |
||
15228 | 810 |
text{*Differentiability implies continuity |
811 |
nice and simple "algebraic" proof*} |
|
14477 | 812 |
lemma NSDERIV_isNSCont: "NSDERIV f x :> D ==> isNSCont f x" |
813 |
apply (auto simp add: nsderiv_def isNSCont_NSLIM_iff NSLIM_def) |
|
814 |
apply (drule approx_minus_iff [THEN iffD1]) |
|
815 |
apply (drule hypreal_not_eq_minus_iff [THEN iffD1]) |
|
816 |
apply (drule_tac x = "-hypreal_of_real x + xa" in bspec) |
|
15228 | 817 |
prefer 2 apply (simp add: add_assoc [symmetric]) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
818 |
apply (auto simp add: mem_infmal_iff [symmetric] add_commute) |
14477 | 819 |
apply (drule_tac c = "xa + -hypreal_of_real x" in approx_mult1) |
820 |
apply (auto intro: Infinitesimal_subset_HFinite [THEN subsetD] |
|
821 |
simp add: mult_assoc) |
|
822 |
apply (drule_tac x3=D in |
|
823 |
HFinite_hypreal_of_real [THEN [2] Infinitesimal_HFinite_mult, |
|
824 |
THEN mem_infmal_iff [THEN iffD1]]) |
|
15539 | 825 |
apply (auto simp add: mult_commute |
14477 | 826 |
intro: approx_trans approx_minus_iff [THEN iffD2]) |
827 |
done |
|
828 |
||
829 |
text{*Now Sandard proof*} |
|
830 |
lemma DERIV_isCont: "DERIV f x :> D ==> isCont f x" |
|
15228 | 831 |
by (simp add: NSDERIV_DERIV_iff [symmetric] isNSCont_isCont_iff [symmetric] |
14477 | 832 |
NSDERIV_isNSCont) |
833 |
||
834 |
||
15228 | 835 |
text{*Differentiation rules for combinations of functions |
14477 | 836 |
follow from clear, straightforard, algebraic |
15228 | 837 |
manipulations*} |
14477 | 838 |
text{*Constant function*} |
839 |
||
840 |
(* use simple constant nslimit theorem *) |
|
15228 | 841 |
lemma NSDERIV_const [simp]: "(NSDERIV (%x. k) x :> 0)" |
14477 | 842 |
by (simp add: NSDERIV_NSLIM_iff) |
843 |
||
15228 | 844 |
lemma DERIV_const [simp]: "(DERIV (%x. k) x :> 0)" |
14477 | 845 |
by (simp add: NSDERIV_DERIV_iff [symmetric]) |
846 |
||
15228 | 847 |
text{*Sum of functions- proved easily*} |
14477 | 848 |
|
849 |
||
850 |
lemma NSDERIV_add: "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] |
|
851 |
==> NSDERIV (%x. f x + g x) x :> Da + Db" |
|
852 |
apply (auto simp add: NSDERIV_NSLIM_iff NSLIM_def) |
|
853 |
apply (auto simp add: add_divide_distrib dest!: spec) |
|
854 |
apply (drule_tac b = "hypreal_of_real Da" and d = "hypreal_of_real Db" in approx_add) |
|
855 |
apply (auto simp add: add_ac) |
|
856 |
done |
|
857 |
||
858 |
(* Standard theorem *) |
|
859 |
lemma DERIV_add: "[| DERIV f x :> Da; DERIV g x :> Db |] |
|
860 |
==> DERIV (%x. f x + g x) x :> Da + Db" |
|
861 |
apply (simp add: NSDERIV_add NSDERIV_DERIV_iff [symmetric]) |
|
862 |
done |
|
863 |
||
15228 | 864 |
text{*Product of functions - Proof is trivial but tedious |
865 |
and long due to rearrangement of terms*} |
|
14477 | 866 |
|
867 |
lemma lemma_nsderiv1: "((a::hypreal)*b) + -(c*d) = (b*(a + -c)) + (c*(b + -d))" |
|
868 |
by (simp add: right_distrib) |
|
869 |
||
870 |
lemma lemma_nsderiv2: "[| (x + y) / z = hypreal_of_real D + yb; z \<noteq> 0; |
|
871 |
z \<in> Infinitesimal; yb \<in> Infinitesimal |] |
|
872 |
==> x + y \<approx> 0" |
|
873 |
apply (frule_tac c1 = z in hypreal_mult_right_cancel [THEN iffD2], assumption) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
874 |
apply (erule_tac V = "(x + y) / z = hypreal_of_real D + yb" in thin_rl) |
14477 | 875 |
apply (auto intro!: Infinitesimal_HFinite_mult2 HFinite_add |
15539 | 876 |
simp add: mult_assoc mem_infmal_iff [symmetric]) |
14477 | 877 |
apply (erule Infinitesimal_subset_HFinite [THEN subsetD]) |
878 |
done |
|
879 |
||
880 |
||
881 |
lemma NSDERIV_mult: "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] |
|
882 |
==> NSDERIV (%x. f x * g x) x :> (Da * g(x)) + (Db * f(x))" |
|
883 |
apply (auto simp add: NSDERIV_NSLIM_iff NSLIM_def) |
|
884 |
apply (auto dest!: spec |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
885 |
simp add: starfun_lambda_cancel lemma_nsderiv1) |
14477 | 886 |
apply (simp (no_asm) add: add_divide_distrib) |
887 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2])+ |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
888 |
apply (auto simp add: times_divide_eq_right [symmetric] |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
889 |
simp del: times_divide_eq) |
14477 | 890 |
apply (drule_tac D = Db in lemma_nsderiv2) |
891 |
apply (drule_tac [4] |
|
15228 | 892 |
approx_minus_iff [THEN iffD2, THEN bex_Infinitesimal_iff2 [THEN iffD2]]) |
893 |
apply (auto intro!: approx_add_mono1 |
|
14477 | 894 |
simp add: left_distrib right_distrib mult_commute add_assoc) |
15228 | 895 |
apply (rule_tac b1 = "hypreal_of_real Db * hypreal_of_real (f x)" |
14477 | 896 |
in add_commute [THEN subst]) |
15228 | 897 |
apply (auto intro!: Infinitesimal_add_approx_self2 [THEN approx_sym] |
898 |
Infinitesimal_add Infinitesimal_mult |
|
899 |
Infinitesimal_hypreal_of_real_mult |
|
14477 | 900 |
Infinitesimal_hypreal_of_real_mult2 |
901 |
simp add: add_assoc [symmetric]) |
|
902 |
done |
|
903 |
||
904 |
lemma DERIV_mult: |
|
15228 | 905 |
"[| DERIV f x :> Da; DERIV g x :> Db |] |
14477 | 906 |
==> DERIV (%x. f x * g x) x :> (Da * g(x)) + (Db * f(x))" |
907 |
by (simp add: NSDERIV_mult NSDERIV_DERIV_iff [symmetric]) |
|
908 |
||
909 |
text{*Multiplying by a constant*} |
|
910 |
lemma NSDERIV_cmult: "NSDERIV f x :> D |
|
911 |
==> NSDERIV (%x. c * f x) x :> c*D" |
|
15228 | 912 |
apply (simp only: times_divide_eq_right [symmetric] NSDERIV_NSLIM_iff |
14477 | 913 |
minus_mult_right right_distrib [symmetric]) |
914 |
apply (erule NSLIM_const [THEN NSLIM_mult]) |
|
915 |
done |
|
916 |
||
917 |
(* let's do the standard proof though theorem *) |
|
918 |
(* LIM_mult2 follows from a NS proof *) |
|
919 |
||
920 |
lemma DERIV_cmult: |
|
921 |
"DERIV f x :> D ==> DERIV (%x. c * f x) x :> c*D" |
|
15228 | 922 |
apply (simp only: deriv_def times_divide_eq_right [symmetric] |
14477 | 923 |
NSDERIV_NSLIM_iff minus_mult_right right_distrib [symmetric]) |
924 |
apply (erule LIM_const [THEN LIM_mult2]) |
|
925 |
done |
|
926 |
||
927 |
text{*Negation of function*} |
|
928 |
lemma NSDERIV_minus: "NSDERIV f x :> D ==> NSDERIV (%x. -(f x)) x :> -D" |
|
929 |
proof (simp add: NSDERIV_NSLIM_iff) |
|
930 |
assume "(\<lambda>h. (f (x + h) + - f x) / h) -- 0 --NS> D" |
|
15228 | 931 |
hence deriv: "(\<lambda>h. - ((f(x+h) + - f x) / h)) -- 0 --NS> - D" |
14477 | 932 |
by (rule NSLIM_minus) |
933 |
have "\<forall>h. - ((f (x + h) + - f x) / h) = (- f (x + h) + f x) / h" |
|
15228 | 934 |
by (simp add: minus_divide_left) |
14477 | 935 |
with deriv |
936 |
show "(\<lambda>h. (- f (x + h) + f x) / h) -- 0 --NS> - D" by simp |
|
937 |
qed |
|
938 |
||
939 |
||
940 |
lemma DERIV_minus: "DERIV f x :> D ==> DERIV (%x. -(f x)) x :> -D" |
|
941 |
by (simp add: NSDERIV_minus NSDERIV_DERIV_iff [symmetric]) |
|
942 |
||
943 |
text{*Subtraction*} |
|
944 |
lemma NSDERIV_add_minus: "[| NSDERIV f x :> Da; NSDERIV g x :> Db |] ==> NSDERIV (%x. f x + -g x) x :> Da + -Db" |
|
945 |
by (blast dest: NSDERIV_add NSDERIV_minus) |
|
946 |
||
947 |
lemma DERIV_add_minus: "[| DERIV f x :> Da; DERIV g x :> Db |] ==> DERIV (%x. f x + -g x) x :> Da + -Db" |
|
948 |
by (blast dest: DERIV_add DERIV_minus) |
|
949 |
||
950 |
lemma NSDERIV_diff: |
|
951 |
"[| NSDERIV f x :> Da; NSDERIV g x :> Db |] |
|
952 |
==> NSDERIV (%x. f x - g x) x :> Da-Db" |
|
953 |
apply (simp add: diff_minus) |
|
954 |
apply (blast intro: NSDERIV_add_minus) |
|
955 |
done |
|
956 |
||
957 |
lemma DERIV_diff: |
|
958 |
"[| DERIV f x :> Da; DERIV g x :> Db |] |
|
959 |
==> DERIV (%x. f x - g x) x :> Da-Db" |
|
960 |
apply (simp add: diff_minus) |
|
961 |
apply (blast intro: DERIV_add_minus) |
|
962 |
done |
|
963 |
||
15228 | 964 |
text{*(NS) Increment*} |
14477 | 965 |
lemma incrementI: |
966 |
"f NSdifferentiable x ==> |
|
967 |
increment f x h = ( *f* f) (hypreal_of_real(x) + h) + |
|
968 |
-hypreal_of_real (f x)" |
|
969 |
by (simp add: increment_def) |
|
970 |
||
971 |
lemma incrementI2: "NSDERIV f x :> D ==> |
|
972 |
increment f x h = ( *f* f) (hypreal_of_real(x) + h) + |
|
973 |
-hypreal_of_real (f x)" |
|
974 |
apply (erule NSdifferentiableI [THEN incrementI]) |
|
975 |
done |
|
976 |
||
977 |
(* The Increment theorem -- Keisler p. 65 *) |
|
978 |
lemma increment_thm: "[| NSDERIV f x :> D; h \<in> Infinitesimal; h \<noteq> 0 |] |
|
979 |
==> \<exists>e \<in> Infinitesimal. increment f x h = hypreal_of_real(D)*h + e*h" |
|
980 |
apply (frule_tac h = h in incrementI2, simp add: nsderiv_def) |
|
981 |
apply (drule bspec, auto) |
|
15228 | 982 |
apply (drule bex_Infinitesimal_iff2 [THEN iffD2], clarify) |
983 |
apply (frule_tac b1 = "hypreal_of_real (D) + y" |
|
14477 | 984 |
in hypreal_mult_right_cancel [THEN iffD2]) |
985 |
apply (erule_tac [2] V = "(( *f* f) (hypreal_of_real (x) + h) + - hypreal_of_real (f x)) / h = hypreal_of_real (D) + y" in thin_rl) |
|
986 |
apply assumption |
|
15539 | 987 |
apply (simp add: times_divide_eq_right [symmetric]) |
14477 | 988 |
apply (auto simp add: left_distrib) |
989 |
done |
|
15228 | 990 |
|
14477 | 991 |
lemma increment_thm2: |
992 |
"[| NSDERIV f x :> D; h \<approx> 0; h \<noteq> 0 |] |
|
993 |
==> \<exists>e \<in> Infinitesimal. increment f x h = |
|
994 |
hypreal_of_real(D)*h + e*h" |
|
995 |
by (blast dest!: mem_infmal_iff [THEN iffD2] intro!: increment_thm) |
|
996 |
||
997 |
||
998 |
lemma increment_approx_zero: "[| NSDERIV f x :> D; h \<approx> 0; h \<noteq> 0 |] |
|
999 |
==> increment f x h \<approx> 0" |
|
15228 | 1000 |
apply (drule increment_thm2, |
14477 | 1001 |
auto intro!: Infinitesimal_HFinite_mult2 HFinite_add simp add: left_distrib [symmetric] mem_infmal_iff [symmetric]) |
1002 |
apply (erule Infinitesimal_subset_HFinite [THEN subsetD]) |
|
1003 |
done |
|
1004 |
||
1005 |
text{* Similarly to the above, the chain rule admits an entirely |
|
1006 |
straightforward derivation. Compare this with Harrison's |
|
1007 |
HOL proof of the chain rule, which proved to be trickier and |
|
1008 |
required an alternative characterisation of differentiability- |
|
1009 |
the so-called Carathedory derivative. Our main problem is |
|
1010 |
manipulation of terms.*} |
|
1011 |
||
1012 |
||
1013 |
(* lemmas *) |
|
1014 |
lemma NSDERIV_zero: |
|
1015 |
"[| NSDERIV g x :> D; |
|
1016 |
( *f* g) (hypreal_of_real(x) + xa) = hypreal_of_real(g x); |
|
1017 |
xa \<in> Infinitesimal; |
|
1018 |
xa \<noteq> 0 |
|
1019 |
|] ==> D = 0" |
|
1020 |
apply (simp add: nsderiv_def) |
|
1021 |
apply (drule bspec, auto) |
|
1022 |
done |
|
1023 |
||
1024 |
(* can be proved differently using NSLIM_isCont_iff *) |
|
1025 |
lemma NSDERIV_approx: |
|
1026 |
"[| NSDERIV f x :> D; h \<in> Infinitesimal; h \<noteq> 0 |] |
|
1027 |
==> ( *f* f) (hypreal_of_real(x) + h) + -hypreal_of_real(f x) \<approx> 0" |
|
1028 |
apply (simp add: nsderiv_def) |
|
1029 |
apply (simp add: mem_infmal_iff [symmetric]) |
|
1030 |
apply (rule Infinitesimal_ratio) |
|
1031 |
apply (rule_tac [3] approx_hypreal_of_real_HFinite, auto) |
|
1032 |
done |
|
1033 |
||
1034 |
(*--------------------------------------------------------------- |
|
1035 |
from one version of differentiability |
|
1036 |
||
1037 |
f(x) - f(a) |
|
1038 |
--------------- \<approx> Db |
|
1039 |
x - a |
|
1040 |
---------------------------------------------------------------*) |
|
1041 |
lemma NSDERIVD1: "[| NSDERIV f (g x) :> Da; |
|
1042 |
( *f* g) (hypreal_of_real(x) + xa) \<noteq> hypreal_of_real (g x); |
|
1043 |
( *f* g) (hypreal_of_real(x) + xa) \<approx> hypreal_of_real (g x) |
|
1044 |
|] ==> (( *f* f) (( *f* g) (hypreal_of_real(x) + xa)) |
|
1045 |
+ - hypreal_of_real (f (g x))) |
|
1046 |
/ (( *f* g) (hypreal_of_real(x) + xa) + - hypreal_of_real (g x)) |
|
1047 |
\<approx> hypreal_of_real(Da)" |
|
1048 |
by (auto simp add: NSDERIV_NSLIM_iff2 NSLIM_def diff_minus [symmetric]) |
|
1049 |
||
1050 |
(*-------------------------------------------------------------- |
|
1051 |
from other version of differentiability |
|
1052 |
||
1053 |
f(x + h) - f(x) |
|
1054 |
----------------- \<approx> Db |
|
1055 |
h |
|
1056 |
--------------------------------------------------------------*) |
|
1057 |
lemma NSDERIVD2: "[| NSDERIV g x :> Db; xa \<in> Infinitesimal; xa \<noteq> 0 |] |
|
1058 |
==> (( *f* g) (hypreal_of_real(x) + xa) + - hypreal_of_real(g x)) / xa |
|
1059 |
\<approx> hypreal_of_real(Db)" |
|
1060 |
by (auto simp add: NSDERIV_NSLIM_iff NSLIM_def mem_infmal_iff starfun_lambda_cancel) |
|
1061 |
||
1062 |
lemma lemma_chain: "(z::hypreal) \<noteq> 0 ==> x*y = (x*inverse(z))*(z*y)" |
|
1063 |
by auto |
|
1064 |
||
15228 | 1065 |
text{*This proof uses both definitions of differentiability.*} |
14477 | 1066 |
lemma NSDERIV_chain: "[| NSDERIV f (g x) :> Da; NSDERIV g x :> Db |] |
1067 |
==> NSDERIV (f o g) x :> Da * Db" |
|
1068 |
apply (simp (no_asm_simp) add: NSDERIV_NSLIM_iff NSLIM_def |
|
1069 |
mem_infmal_iff [symmetric]) |
|
1070 |
apply clarify |
|
1071 |
apply (frule_tac f = g in NSDERIV_approx) |
|
1072 |
apply (auto simp add: starfun_lambda_cancel2 starfun_o [symmetric]) |
|
1073 |
apply (case_tac "( *f* g) (hypreal_of_real (x) + xa) = hypreal_of_real (g x) ") |
|
1074 |
apply (drule_tac g = g in NSDERIV_zero) |
|
1075 |
apply (auto simp add: divide_inverse) |
|
1076 |
apply (rule_tac z1 = "( *f* g) (hypreal_of_real (x) + xa) + -hypreal_of_real (g x) " and y1 = "inverse xa" in lemma_chain [THEN ssubst]) |
|
1077 |
apply (erule hypreal_not_eq_minus_iff [THEN iffD1]) |
|
1078 |
apply (rule approx_mult_hypreal_of_real) |
|
1079 |
apply (simp_all add: divide_inverse [symmetric]) |
|
1080 |
apply (blast intro: NSDERIVD1 approx_minus_iff [THEN iffD2]) |
|
1081 |
apply (blast intro: NSDERIVD2) |
|
1082 |
done |
|
1083 |
||
1084 |
(* standard version *) |
|
1085 |
lemma DERIV_chain: "[| DERIV f (g x) :> Da; DERIV g x :> Db |] ==> DERIV (f o g) x :> Da * Db" |
|
1086 |
by (simp add: NSDERIV_DERIV_iff [symmetric] NSDERIV_chain) |
|
1087 |
||
1088 |
lemma DERIV_chain2: "[| DERIV f (g x) :> Da; DERIV g x :> Db |] ==> DERIV (%x. f (g x)) x :> Da * Db" |
|
1089 |
by (auto dest: DERIV_chain simp add: o_def) |
|
1090 |
||
1091 |
text{*Differentiation of natural number powers*} |
|
15228 | 1092 |
lemma NSDERIV_Id [simp]: "NSDERIV (%x. x) x :> 1" |
1093 |
by (simp add: NSDERIV_NSLIM_iff NSLIM_def divide_self del: divide_self_if) |
|
14477 | 1094 |
|
1095 |
(*derivative of the identity function*) |
|
15228 | 1096 |
lemma DERIV_Id [simp]: "DERIV (%x. x) x :> 1" |
14477 | 1097 |
by (simp add: NSDERIV_DERIV_iff [symmetric]) |
1098 |
||
1099 |
lemmas isCont_Id = DERIV_Id [THEN DERIV_isCont, standard] |
|
1100 |
||
1101 |
(*derivative of linear multiplication*) |
|
15228 | 1102 |
lemma DERIV_cmult_Id [simp]: "DERIV (op * c) x :> c" |
14477 | 1103 |
by (cut_tac c = c and x = x in DERIV_Id [THEN DERIV_cmult], simp) |
1104 |
||
15228 | 1105 |
lemma NSDERIV_cmult_Id [simp]: "NSDERIV (op * c) x :> c" |
14477 | 1106 |
by (simp add: NSDERIV_DERIV_iff) |
1107 |
||
1108 |
lemma DERIV_pow: "DERIV (%x. x ^ n) x :> real n * (x ^ (n - Suc 0))" |
|
15251 | 1109 |
apply (induct "n") |
14477 | 1110 |
apply (drule_tac [2] DERIV_Id [THEN DERIV_mult]) |
1111 |
apply (auto simp add: real_of_nat_Suc left_distrib) |
|
1112 |
apply (case_tac "0 < n") |
|
1113 |
apply (drule_tac x = x in realpow_minus_mult) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1114 |
apply (auto simp add: mult_assoc add_commute) |
14477 | 1115 |
done |
1116 |
||
1117 |
(* NS version *) |
|
1118 |
lemma NSDERIV_pow: "NSDERIV (%x. x ^ n) x :> real n * (x ^ (n - Suc 0))" |
|
1119 |
by (simp add: NSDERIV_DERIV_iff DERIV_pow) |
|
1120 |
||
15228 | 1121 |
text{*Power of -1*} |
14477 | 1122 |
|
1123 |
(*Can't get rid of x \<noteq> 0 because it isn't continuous at zero*) |
|
1124 |
lemma NSDERIV_inverse: |
|
1125 |
"x \<noteq> 0 ==> NSDERIV (%x. inverse(x)) x :> (- (inverse x ^ Suc (Suc 0)))" |
|
1126 |
apply (simp add: nsderiv_def) |
|
15228 | 1127 |
apply (rule ballI, simp, clarify) |
14477 | 1128 |
apply (frule Infinitesimal_add_not_zero) |
15228 | 1129 |
prefer 2 apply (simp add: add_commute) |
1130 |
apply (auto simp add: starfun_inverse_inverse realpow_two |
|
14477 | 1131 |
simp del: minus_mult_left [symmetric] minus_mult_right [symmetric]) |
1132 |
apply (simp add: inverse_add inverse_mult_distrib [symmetric] |
|
1133 |
inverse_minus_eq [symmetric] add_ac mult_ac |
|
15228 | 1134 |
del: inverse_mult_distrib inverse_minus_eq |
14477 | 1135 |
minus_mult_left [symmetric] minus_mult_right [symmetric]) |
1136 |
apply (simp (no_asm_simp) add: mult_assoc [symmetric] right_distrib |
|
1137 |
del: minus_mult_left [symmetric] minus_mult_right [symmetric]) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1138 |
apply (rule_tac y = "inverse (- hypreal_of_real x * hypreal_of_real x)" in approx_trans) |
14477 | 1139 |
apply (rule inverse_add_Infinitesimal_approx2) |
15228 | 1140 |
apply (auto dest!: hypreal_of_real_HFinite_diff_Infinitesimal |
14477 | 1141 |
simp add: inverse_minus_eq [symmetric] HFinite_minus_iff) |
1142 |
apply (rule Infinitesimal_HFinite_mult2, auto) |
|
1143 |
done |
|
1144 |
||
1145 |
||
1146 |
||
1147 |
||
1148 |
lemma DERIV_inverse: "x \<noteq> 0 ==> DERIV (%x. inverse(x)) x :> (-(inverse x ^ Suc (Suc 0)))" |
|
1149 |
by (simp add: NSDERIV_inverse NSDERIV_DERIV_iff [symmetric] del: realpow_Suc) |
|
1150 |
||
1151 |
text{*Derivative of inverse*} |
|
1152 |
lemma DERIV_inverse_fun: "[| DERIV f x :> d; f(x) \<noteq> 0 |] |
|
1153 |
==> DERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ Suc (Suc 0))))" |
|
1154 |
apply (simp only: mult_commute [of d] minus_mult_left power_inverse) |
|
1155 |
apply (fold o_def) |
|
1156 |
apply (blast intro!: DERIV_chain DERIV_inverse) |
|
1157 |
done |
|
1158 |
||
1159 |
lemma NSDERIV_inverse_fun: "[| NSDERIV f x :> d; f(x) \<noteq> 0 |] |
|
1160 |
==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse(f(x) ^ Suc (Suc 0))))" |
|
1161 |
by (simp add: NSDERIV_DERIV_iff DERIV_inverse_fun del: realpow_Suc) |
|
1162 |
||
1163 |
text{*Derivative of quotient*} |
|
1164 |
lemma DERIV_quotient: "[| DERIV f x :> d; DERIV g x :> e; g(x) \<noteq> 0 |] |
|
1165 |
==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) + -(e*f(x))) / (g(x) ^ Suc (Suc 0))" |
|
1166 |
apply (drule_tac f = g in DERIV_inverse_fun) |
|
1167 |
apply (drule_tac [2] DERIV_mult) |
|
1168 |
apply (assumption+) |
|
1169 |
apply (simp add: divide_inverse right_distrib power_inverse minus_mult_left |
|
15228 | 1170 |
mult_ac |
14477 | 1171 |
del: realpow_Suc minus_mult_right [symmetric] minus_mult_left [symmetric]) |
1172 |
done |
|
1173 |
||
1174 |
lemma NSDERIV_quotient: "[| NSDERIV f x :> d; DERIV g x :> e; g(x) \<noteq> 0 |] |
|
1175 |
==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) |
|
1176 |
+ -(e*f(x))) / (g(x) ^ Suc (Suc 0))" |
|
1177 |
by (simp add: NSDERIV_DERIV_iff DERIV_quotient del: realpow_Suc) |
|
1178 |
||
1179 |
(* ------------------------------------------------------------------------ *) |
|
1180 |
(* Caratheodory formulation of derivative at a point: standard proof *) |
|
1181 |
(* ------------------------------------------------------------------------ *) |
|
1182 |
||
1183 |
lemma CARAT_DERIV: |
|
1184 |
"(DERIV f x :> l) = |
|
1185 |
(\<exists>g. (\<forall>z. f z - f x = g z * (z-x)) & isCont g x & g x = l)" |
|
1186 |
(is "?lhs = ?rhs") |
|
1187 |
proof |
|
1188 |
assume der: "DERIV f x :> l" |
|
1189 |
show "\<exists>g. (\<forall>z. f z - f x = g z * (z-x)) \<and> isCont g x \<and> g x = l" |
|
1190 |
proof (intro exI conjI) |
|
1191 |
let ?g = "(%z. if z = x then l else (f z - f x) / (z-x))" |
|
15539 | 1192 |
show "\<forall>z. f z - f x = ?g z * (z-x)" by (simp) |
15228 | 1193 |
show "isCont ?g x" using der |
1194 |
by (simp add: isCont_iff DERIV_iff diff_minus |
|
14477 | 1195 |
cong: LIM_equal [rule_format]) |
1196 |
show "?g x = l" by simp |
|
1197 |
qed |
|
1198 |
next |
|
1199 |
assume "?rhs" |
|
15228 | 1200 |
then obtain g where |
14477 | 1201 |
"(\<forall>z. f z - f x = g z * (z-x))" and "isCont g x" and "g x = l" by blast |
15228 | 1202 |
thus "(DERIV f x :> l)" |
1203 |
by (auto simp add: isCont_iff DERIV_iff diff_minus |
|
14477 | 1204 |
cong: LIM_equal [rule_format]) |
1205 |
qed |
|
1206 |
||
1207 |
||
1208 |
lemma CARAT_NSDERIV: "NSDERIV f x :> l ==> |
|
1209 |
\<exists>g. (\<forall>z. f z - f x = g z * (z-x)) & isNSCont g x & g x = l" |
|
1210 |
by (auto simp add: NSDERIV_DERIV_iff isNSCont_isCont_iff CARAT_DERIV) |
|
1211 |
||
1212 |
lemma hypreal_eq_minus_iff3: "(x = y + z) = (x + -z = (y::hypreal))" |
|
1213 |
by auto |
|
1214 |
||
1215 |
lemma CARAT_DERIVD: |
|
1216 |
assumes all: "\<forall>z. f z - f x = g z * (z-x)" |
|
1217 |
and nsc: "isNSCont g x" |
|
1218 |
shows "NSDERIV f x :> g x" |
|
1219 |
proof - |
|
1220 |
from nsc |
|
1221 |
have "\<forall>w. w \<noteq> hypreal_of_real x \<and> w \<approx> hypreal_of_real x \<longrightarrow> |
|
1222 |
( *f* g) w * (w - hypreal_of_real x) / (w - hypreal_of_real x) \<approx> |
|
15228 | 1223 |
hypreal_of_real (g x)" |
14477 | 1224 |
by (simp add: diff_minus isNSCont_def) |
1225 |
thus ?thesis using all |
|
15228 | 1226 |
by (simp add: NSDERIV_iff2 starfun_if_eq cong: if_cong) |
14477 | 1227 |
qed |
1228 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1229 |
text{*Lemmas about nested intervals and proof by bisection (cf.Harrison). |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1230 |
All considerably tidied by lcp.*} |
14477 | 1231 |
|
1232 |
lemma lemma_f_mono_add [rule_format (no_asm)]: "(\<forall>n. (f::nat=>real) n \<le> f (Suc n)) --> f m \<le> f(m + no)" |
|
15251 | 1233 |
apply (induct "no") |
14477 | 1234 |
apply (auto intro: order_trans) |
1235 |
done |
|
1236 |
||
1237 |
lemma f_inc_g_dec_Beq_f: "[| \<forall>n. f(n) \<le> f(Suc n); |
|
1238 |
\<forall>n. g(Suc n) \<le> g(n); |
|
1239 |
\<forall>n. f(n) \<le> g(n) |] |
|
1240 |
==> Bseq f" |
|
1241 |
apply (rule_tac k = "f 0" and K = "g 0" in BseqI2, rule allI) |
|
1242 |
apply (induct_tac "n") |
|
1243 |
apply (auto intro: order_trans) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1244 |
apply (rule_tac y = "g (Suc na)" in order_trans) |
14477 | 1245 |
apply (induct_tac [2] "na") |
1246 |
apply (auto intro: order_trans) |
|
1247 |
done |
|
1248 |
||
1249 |
lemma f_inc_g_dec_Beq_g: "[| \<forall>n. f(n) \<le> f(Suc n); |
|
1250 |
\<forall>n. g(Suc n) \<le> g(n); |
|
1251 |
\<forall>n. f(n) \<le> g(n) |] |
|
1252 |
==> Bseq g" |
|
1253 |
apply (subst Bseq_minus_iff [symmetric]) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1254 |
apply (rule_tac g = "%x. - (f x)" in f_inc_g_dec_Beq_f) |
14477 | 1255 |
apply auto |
1256 |
done |
|
1257 |
||
1258 |
lemma f_inc_imp_le_lim: "[| \<forall>n. f n \<le> f (Suc n); convergent f |] ==> f n \<le> lim f" |
|
1259 |
apply (rule linorder_not_less [THEN iffD1]) |
|
1260 |
apply (auto simp add: convergent_LIMSEQ_iff LIMSEQ_iff monoseq_Suc) |
|
1261 |
apply (drule real_less_sum_gt_zero) |
|
1262 |
apply (drule_tac x = "f n + - lim f" in spec, safe) |
|
1263 |
apply (drule_tac P = "%na. no\<le>na --> ?Q na" and x = "no + n" in spec, auto) |
|
1264 |
apply (subgoal_tac "lim f \<le> f (no + n) ") |
|
1265 |
apply (induct_tac [2] "no") |
|
15003 | 1266 |
apply (auto intro: order_trans simp add: diff_minus abs_if) |
14477 | 1267 |
apply (drule_tac no=no and m=n in lemma_f_mono_add) |
1268 |
apply (auto simp add: add_commute) |
|
1269 |
done |
|
1270 |
||
1271 |
lemma lim_uminus: "convergent g ==> lim (%x. - g x) = - (lim g)" |
|
1272 |
apply (rule LIMSEQ_minus [THEN limI]) |
|
1273 |
apply (simp add: convergent_LIMSEQ_iff) |
|
1274 |
done |
|
1275 |
||
1276 |
lemma g_dec_imp_lim_le: "[| \<forall>n. g(Suc n) \<le> g(n); convergent g |] ==> lim g \<le> g n" |
|
1277 |
apply (subgoal_tac "- (g n) \<le> - (lim g) ") |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1278 |
apply (cut_tac [2] f = "%x. - (g x)" in f_inc_imp_le_lim) |
14477 | 1279 |
apply (auto simp add: lim_uminus convergent_minus_iff [symmetric]) |
1280 |
done |
|
1281 |
||
1282 |
lemma lemma_nest: "[| \<forall>n. f(n) \<le> f(Suc n); |
|
1283 |
\<forall>n. g(Suc n) \<le> g(n); |
|
1284 |
\<forall>n. f(n) \<le> g(n) |] |
|
1285 |
==> \<exists>l m. l \<le> m & ((\<forall>n. f(n) \<le> l) & f ----> l) & |
|
1286 |
((\<forall>n. m \<le> g(n)) & g ----> m)" |
|
1287 |
apply (subgoal_tac "monoseq f & monoseq g") |
|
1288 |
prefer 2 apply (force simp add: LIMSEQ_iff monoseq_Suc) |
|
1289 |
apply (subgoal_tac "Bseq f & Bseq g") |
|
1290 |
prefer 2 apply (blast intro: f_inc_g_dec_Beq_f f_inc_g_dec_Beq_g) |
|
1291 |
apply (auto dest!: Bseq_monoseq_convergent simp add: convergent_LIMSEQ_iff) |
|
1292 |
apply (rule_tac x = "lim f" in exI) |
|
1293 |
apply (rule_tac x = "lim g" in exI) |
|
1294 |
apply (auto intro: LIMSEQ_le) |
|
1295 |
apply (auto simp add: f_inc_imp_le_lim g_dec_imp_lim_le convergent_LIMSEQ_iff) |
|
1296 |
done |
|
1297 |
||
1298 |
lemma lemma_nest_unique: "[| \<forall>n. f(n) \<le> f(Suc n); |
|
1299 |
\<forall>n. g(Suc n) \<le> g(n); |
|
1300 |
\<forall>n. f(n) \<le> g(n); |
|
1301 |
(%n. f(n) - g(n)) ----> 0 |] |
|
1302 |
==> \<exists>l. ((\<forall>n. f(n) \<le> l) & f ----> l) & |
|
1303 |
((\<forall>n. l \<le> g(n)) & g ----> l)" |
|
1304 |
apply (drule lemma_nest, auto) |
|
1305 |
apply (subgoal_tac "l = m") |
|
1306 |
apply (drule_tac [2] X = f in LIMSEQ_diff) |
|
1307 |
apply (auto intro: LIMSEQ_unique) |
|
1308 |
done |
|
1309 |
||
1310 |
text{*The universal quantifiers below are required for the declaration |
|
1311 |
of @{text Bolzano_nest_unique} below.*} |
|
1312 |
||
1313 |
lemma Bolzano_bisect_le: |
|
1314 |
"a \<le> b ==> \<forall>n. fst (Bolzano_bisect P a b n) \<le> snd (Bolzano_bisect P a b n)" |
|
1315 |
apply (rule allI) |
|
1316 |
apply (induct_tac "n") |
|
1317 |
apply (auto simp add: Let_def split_def) |
|
1318 |
done |
|
1319 |
||
1320 |
lemma Bolzano_bisect_fst_le_Suc: "a \<le> b ==> |
|
1321 |
\<forall>n. fst(Bolzano_bisect P a b n) \<le> fst (Bolzano_bisect P a b (Suc n))" |
|
1322 |
apply (rule allI) |
|
1323 |
apply (induct_tac "n") |
|
1324 |
apply (auto simp add: Bolzano_bisect_le Let_def split_def) |
|
1325 |
done |
|
1326 |
||
1327 |
lemma Bolzano_bisect_Suc_le_snd: "a \<le> b ==> |
|
1328 |
\<forall>n. snd(Bolzano_bisect P a b (Suc n)) \<le> snd (Bolzano_bisect P a b n)" |
|
1329 |
apply (rule allI) |
|
1330 |
apply (induct_tac "n") |
|
15539 | 1331 |
apply (auto simp add: Bolzano_bisect_le Let_def split_def) |
14477 | 1332 |
done |
1333 |
||
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1334 |
lemma eq_divide_2_times_iff: "((x::real) = y / (2 * z)) = (2 * x = y/z)" |
15539 | 1335 |
apply (auto) |
14477 | 1336 |
apply (drule_tac f = "%u. (1/2) *u" in arg_cong) |
15539 | 1337 |
apply (simp) |
14477 | 1338 |
done |
1339 |
||
1340 |
lemma Bolzano_bisect_diff: |
|
1341 |
"a \<le> b ==> |
|
1342 |
snd(Bolzano_bisect P a b n) - fst(Bolzano_bisect P a b n) = |
|
1343 |
(b-a) / (2 ^ n)" |
|
15251 | 1344 |
apply (induct "n") |
14477 | 1345 |
apply (auto simp add: eq_divide_2_times_iff add_divide_distrib Let_def split_def) |
1346 |
done |
|
1347 |
||
1348 |
lemmas Bolzano_nest_unique = |
|
1349 |
lemma_nest_unique |
|
1350 |
[OF Bolzano_bisect_fst_le_Suc Bolzano_bisect_Suc_le_snd Bolzano_bisect_le] |
|
1351 |
||
1352 |
||
1353 |
lemma not_P_Bolzano_bisect: |
|
1354 |
assumes P: "!!a b c. [| P(a,b); P(b,c); a \<le> b; b \<le> c|] ==> P(a,c)" |
|
1355 |
and notP: "~ P(a,b)" |
|
1356 |
and le: "a \<le> b" |
|
1357 |
shows "~ P(fst(Bolzano_bisect P a b n), snd(Bolzano_bisect P a b n))" |
|
1358 |
proof (induct n) |
|
1359 |
case 0 thus ?case by simp |
|
1360 |
next |
|
1361 |
case (Suc n) |
|
1362 |
thus ?case |
|
15228 | 1363 |
by (auto simp del: surjective_pairing [symmetric] |
1364 |
simp add: Let_def split_def Bolzano_bisect_le [OF le] |
|
1365 |
P [of "fst (Bolzano_bisect P a b n)" _ "snd (Bolzano_bisect P a b n)"]) |
|
14477 | 1366 |
qed |
1367 |
||
1368 |
(*Now we re-package P_prem as a formula*) |
|
1369 |
lemma not_P_Bolzano_bisect': |
|
1370 |
"[| \<forall>a b c. P(a,b) & P(b,c) & a \<le> b & b \<le> c --> P(a,c); |
|
1371 |
~ P(a,b); a \<le> b |] ==> |
|
1372 |
\<forall>n. ~ P(fst(Bolzano_bisect P a b n), snd(Bolzano_bisect P a b n))" |
|
1373 |
by (blast elim!: not_P_Bolzano_bisect [THEN [2] rev_notE]) |
|
1374 |
||
1375 |
||
1376 |
||
1377 |
lemma lemma_BOLZANO: |
|
1378 |
"[| \<forall>a b c. P(a,b) & P(b,c) & a \<le> b & b \<le> c --> P(a,c); |
|
1379 |
\<forall>x. \<exists>d::real. 0 < d & |
|
1380 |
(\<forall>a b. a \<le> x & x \<le> b & (b-a) < d --> P(a,b)); |
|
1381 |
a \<le> b |] |
|
1382 |
==> P(a,b)" |
|
1383 |
apply (rule Bolzano_nest_unique [where P1=P, THEN exE], assumption+) |
|
1384 |
apply (rule LIMSEQ_minus_cancel) |
|
1385 |
apply (simp (no_asm_simp) add: Bolzano_bisect_diff LIMSEQ_divide_realpow_zero) |
|
1386 |
apply (rule ccontr) |
|
1387 |
apply (drule not_P_Bolzano_bisect', assumption+) |
|
1388 |
apply (rename_tac "l") |
|
1389 |
apply (drule_tac x = l in spec, clarify) |
|
1390 |
apply (simp add: LIMSEQ_def) |
|
1391 |
apply (drule_tac P = "%r. 0<r --> ?Q r" and x = "d/2" in spec) |
|
1392 |
apply (drule_tac P = "%r. 0<r --> ?Q r" and x = "d/2" in spec) |
|
15228 | 1393 |
apply (drule real_less_half_sum, auto) |
14477 | 1394 |
apply (drule_tac x = "fst (Bolzano_bisect P a b (no + noa))" in spec) |
1395 |
apply (drule_tac x = "snd (Bolzano_bisect P a b (no + noa))" in spec) |
|
1396 |
apply safe |
|
1397 |
apply (simp_all (no_asm_simp)) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1398 |
apply (rule_tac y = "abs (fst (Bolzano_bisect P a b (no + noa)) - l) + abs (snd (Bolzano_bisect P a b (no + noa)) - l)" in order_le_less_trans) |
14477 | 1399 |
apply (simp (no_asm_simp) add: abs_if) |
1400 |
apply (rule real_sum_of_halves [THEN subst]) |
|
1401 |
apply (rule add_strict_mono) |
|
1402 |
apply (simp_all add: diff_minus [symmetric]) |
|
1403 |
done |
|
1404 |
||
1405 |
||
1406 |
lemma lemma_BOLZANO2: "((\<forall>a b c. (a \<le> b & b \<le> c & P(a,b) & P(b,c)) --> P(a,c)) & |
|
1407 |
(\<forall>x. \<exists>d::real. 0 < d & |
|
1408 |
(\<forall>a b. a \<le> x & x \<le> b & (b-a) < d --> P(a,b)))) |
|
1409 |
--> (\<forall>a b. a \<le> b --> P(a,b))" |
|
1410 |
apply clarify |
|
1411 |
apply (blast intro: lemma_BOLZANO) |
|
1412 |
done |
|
1413 |
||
1414 |
||
1415 |
subsection{*Intermediate Value Theorem: Prove Contrapositive by Bisection*} |
|
1416 |
||
1417 |
lemma IVT: "[| f(a) \<le> y; y \<le> f(b); |
|
1418 |
a \<le> b; |
|
1419 |
(\<forall>x. a \<le> x & x \<le> b --> isCont f x) |] |
|
1420 |
==> \<exists>x. a \<le> x & x \<le> b & f(x) = y" |
|
1421 |
apply (rule contrapos_pp, assumption) |
|
1422 |
apply (cut_tac P = "% (u,v) . a \<le> u & u \<le> v & v \<le> b --> ~ (f (u) \<le> y & y \<le> f (v))" in lemma_BOLZANO2) |
|
1423 |
apply safe |
|
1424 |
apply simp_all |
|
1425 |
apply (simp add: isCont_iff LIM_def) |
|
1426 |
apply (rule ccontr) |
|
1427 |
apply (subgoal_tac "a \<le> x & x \<le> b") |
|
1428 |
prefer 2 |
|
15228 | 1429 |
apply simp |
14477 | 1430 |
apply (drule_tac P = "%d. 0<d --> ?P d" and x = 1 in spec, arith) |
1431 |
apply (drule_tac x = x in spec)+ |
|
1432 |
apply simp |
|
15360 | 1433 |
apply (drule_tac P = "%r. ?P r --> (\<exists>s>0. ?Q r s) " and x = "\<bar>y - f x\<bar>" in spec) |
14477 | 1434 |
apply safe |
1435 |
apply simp |
|
1436 |
apply (drule_tac x = s in spec, clarify) |
|
1437 |
apply (cut_tac x = "f x" and y = y in linorder_less_linear, safe) |
|
1438 |
apply (drule_tac x = "ba-x" in spec) |
|
1439 |
apply (simp_all add: abs_if) |
|
1440 |
apply (drule_tac x = "aa-x" in spec) |
|
1441 |
apply (case_tac "x \<le> aa", simp_all) |
|
1442 |
done |
|
1443 |
||
1444 |
lemma IVT2: "[| f(b) \<le> y; y \<le> f(a); |
|
1445 |
a \<le> b; |
|
1446 |
(\<forall>x. a \<le> x & x \<le> b --> isCont f x) |
|
1447 |
|] ==> \<exists>x. a \<le> x & x \<le> b & f(x) = y" |
|
15228 | 1448 |
apply (subgoal_tac "- f a \<le> -y & -y \<le> - f b", clarify) |
14477 | 1449 |
apply (drule IVT [where f = "%x. - f x"], assumption) |
1450 |
apply (auto intro: isCont_minus) |
|
1451 |
done |
|
1452 |
||
1453 |
(*HOL style here: object-level formulations*) |
|
1454 |
lemma IVT_objl: "(f(a) \<le> y & y \<le> f(b) & a \<le> b & |
|
1455 |
(\<forall>x. a \<le> x & x \<le> b --> isCont f x)) |
|
1456 |
--> (\<exists>x. a \<le> x & x \<le> b & f(x) = y)" |
|
1457 |
apply (blast intro: IVT) |
|
1458 |
done |
|
1459 |
||
1460 |
lemma IVT2_objl: "(f(b) \<le> y & y \<le> f(a) & a \<le> b & |
|
1461 |
(\<forall>x. a \<le> x & x \<le> b --> isCont f x)) |
|
1462 |
--> (\<exists>x. a \<le> x & x \<le> b & f(x) = y)" |
|
1463 |
apply (blast intro: IVT2) |
|
1464 |
done |
|
1465 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1466 |
subsection{*By bisection, function continuous on closed interval is bounded above*} |
14477 | 1467 |
|
1468 |
lemma isCont_bounded: |
|
1469 |
"[| a \<le> b; \<forall>x. a \<le> x & x \<le> b --> isCont f x |] |
|
1470 |
==> \<exists>M. \<forall>x. a \<le> x & x \<le> b --> f(x) \<le> M" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1471 |
apply (cut_tac P = "% (u,v) . a \<le> u & u \<le> v & v \<le> b --> (\<exists>M. \<forall>x. u \<le> x & x \<le> v --> f x \<le> M)" in lemma_BOLZANO2) |
14477 | 1472 |
apply safe |
1473 |
apply simp_all |
|
1474 |
apply (rename_tac x xa ya M Ma) |
|
1475 |
apply (cut_tac x = M and y = Ma in linorder_linear, safe) |
|
1476 |
apply (rule_tac x = Ma in exI, clarify) |
|
1477 |
apply (cut_tac x = xb and y = xa in linorder_linear, force) |
|
1478 |
apply (rule_tac x = M in exI, clarify) |
|
1479 |
apply (cut_tac x = xb and y = xa in linorder_linear, force) |
|
1480 |
apply (case_tac "a \<le> x & x \<le> b") |
|
1481 |
apply (rule_tac [2] x = 1 in exI) |
|
1482 |
prefer 2 apply force |
|
1483 |
apply (simp add: LIM_def isCont_iff) |
|
1484 |
apply (drule_tac x = x in spec, auto) |
|
1485 |
apply (erule_tac V = "\<forall>M. \<exists>x. a \<le> x & x \<le> b & ~ f x \<le> M" in thin_rl) |
|
1486 |
apply (drule_tac x = 1 in spec, auto) |
|
1487 |
apply (rule_tac x = s in exI, clarify) |
|
1488 |
apply (rule_tac x = "\<bar>f x\<bar> + 1" in exI, clarify) |
|
1489 |
apply (drule_tac x = "xa-x" in spec) |
|
1490 |
apply (auto simp add: abs_ge_self, arith+) |
|
1491 |
done |
|
1492 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1493 |
text{*Refine the above to existence of least upper bound*} |
14477 | 1494 |
|
1495 |
lemma lemma_reals_complete: "((\<exists>x. x \<in> S) & (\<exists>y. isUb UNIV S (y::real))) --> |
|
1496 |
(\<exists>t. isLub UNIV S t)" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1497 |
by (blast intro: reals_complete) |
14477 | 1498 |
|
1499 |
lemma isCont_has_Ub: "[| a \<le> b; \<forall>x. a \<le> x & x \<le> b --> isCont f x |] |
|
1500 |
==> \<exists>M. (\<forall>x. a \<le> x & x \<le> b --> f(x) \<le> M) & |
|
1501 |
(\<forall>N. N < M --> (\<exists>x. a \<le> x & x \<le> b & N < f(x)))" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1502 |
apply (cut_tac S = "Collect (%y. \<exists>x. a \<le> x & x \<le> b & y = f x)" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1503 |
in lemma_reals_complete) |
14477 | 1504 |
apply auto |
1505 |
apply (drule isCont_bounded, assumption) |
|
1506 |
apply (auto simp add: isUb_def leastP_def isLub_def setge_def setle_def) |
|
1507 |
apply (rule exI, auto) |
|
15228 | 1508 |
apply (auto dest!: spec simp add: linorder_not_less) |
14477 | 1509 |
done |
1510 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1511 |
text{*Now show that it attains its upper bound*} |
14477 | 1512 |
|
1513 |
lemma isCont_eq_Ub: |
|
1514 |
assumes le: "a \<le> b" |
|
1515 |
and con: "\<forall>x. a \<le> x & x \<le> b --> isCont f x" |
|
1516 |
shows "\<exists>M. (\<forall>x. a \<le> x & x \<le> b --> f(x) \<le> M) & |
|
1517 |
(\<exists>x. a \<le> x & x \<le> b & f(x) = M)" |
|
1518 |
proof - |
|
1519 |
from isCont_has_Ub [OF le con] |
|
1520 |
obtain M where M1: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M" |
|
1521 |
and M2: "!!N. N<M ==> \<exists>x. a \<le> x \<and> x \<le> b \<and> N < f x" by blast |
|
1522 |
show ?thesis |
|
1523 |
proof (intro exI, intro conjI) |
|
1524 |
show " \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M" by (rule M1) |
|
15228 | 1525 |
show "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = M" |
14477 | 1526 |
proof (rule ccontr) |
1527 |
assume "\<not> (\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = M)" |
|
1528 |
with M1 have M3: "\<forall>x. a \<le> x & x \<le> b --> f x < M" |
|
15195 | 1529 |
by (fastsimp simp add: linorder_not_le [symmetric]) |
14477 | 1530 |
hence "\<forall>x. a \<le> x & x \<le> b --> isCont (%x. inverse (M - f x)) x" |
1531 |
by (auto simp add: isCont_inverse isCont_diff con) |
|
1532 |
from isCont_bounded [OF le this] |
|
1533 |
obtain k where k: "!!x. a \<le> x & x \<le> b --> inverse (M - f x) \<le> k" by auto |
|
1534 |
have Minv: "!!x. a \<le> x & x \<le> b --> 0 < inverse (M - f (x))" |
|
15228 | 1535 |
by (simp add: M3 compare_rls) |
1536 |
have "!!x. a \<le> x & x \<le> b --> inverse (M - f x) < k+1" using k |
|
1537 |
by (auto intro: order_le_less_trans [of _ k]) |
|
1538 |
with Minv |
|
1539 |
have "!!x. a \<le> x & x \<le> b --> inverse(k+1) < inverse(inverse(M - f x))" |
|
14477 | 1540 |
by (intro strip less_imp_inverse_less, simp_all) |
15228 | 1541 |
hence invlt: "!!x. a \<le> x & x \<le> b --> inverse(k+1) < M - f x" |
14477 | 1542 |
by simp |
15228 | 1543 |
have "M - inverse (k+1) < M" using k [of a] Minv [of a] le |
14477 | 1544 |
by (simp, arith) |
1545 |
from M2 [OF this] |
|
1546 |
obtain x where ax: "a \<le> x & x \<le> b & M - inverse(k+1) < f x" .. |
|
1547 |
thus False using invlt [of x] by force |
|
1548 |
qed |
|
1549 |
qed |
|
1550 |
qed |
|
1551 |
||
1552 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1553 |
text{*Same theorem for lower bound*} |
14477 | 1554 |
|
1555 |
lemma isCont_eq_Lb: "[| a \<le> b; \<forall>x. a \<le> x & x \<le> b --> isCont f x |] |
|
1556 |
==> \<exists>M. (\<forall>x. a \<le> x & x \<le> b --> M \<le> f(x)) & |
|
1557 |
(\<exists>x. a \<le> x & x \<le> b & f(x) = M)" |
|
1558 |
apply (subgoal_tac "\<forall>x. a \<le> x & x \<le> b --> isCont (%x. - (f x)) x") |
|
1559 |
prefer 2 apply (blast intro: isCont_minus) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1560 |
apply (drule_tac f = "(%x. - (f x))" in isCont_eq_Ub) |
14477 | 1561 |
apply safe |
1562 |
apply auto |
|
1563 |
done |
|
1564 |
||
1565 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1566 |
text{*Another version.*} |
14477 | 1567 |
|
1568 |
lemma isCont_Lb_Ub: "[|a \<le> b; \<forall>x. a \<le> x & x \<le> b --> isCont f x |] |
|
1569 |
==> \<exists>L M. (\<forall>x. a \<le> x & x \<le> b --> L \<le> f(x) & f(x) \<le> M) & |
|
1570 |
(\<forall>y. L \<le> y & y \<le> M --> (\<exists>x. a \<le> x & x \<le> b & (f(x) = y)))" |
|
1571 |
apply (frule isCont_eq_Lb) |
|
1572 |
apply (frule_tac [2] isCont_eq_Ub) |
|
1573 |
apply (assumption+, safe) |
|
1574 |
apply (rule_tac x = "f x" in exI) |
|
1575 |
apply (rule_tac x = "f xa" in exI, simp, safe) |
|
1576 |
apply (cut_tac x = x and y = xa in linorder_linear, safe) |
|
1577 |
apply (cut_tac f = f and a = x and b = xa and y = y in IVT_objl) |
|
1578 |
apply (cut_tac [2] f = f and a = xa and b = x and y = y in IVT2_objl, safe) |
|
1579 |
apply (rule_tac [2] x = xb in exI) |
|
1580 |
apply (rule_tac [4] x = xb in exI, simp_all) |
|
1581 |
done |
|
1582 |
||
15003 | 1583 |
|
1584 |
subsection{*If @{term "0 < f'(x)"} then @{term x} is Locally Strictly Increasing At The Right*} |
|
14477 | 1585 |
|
1586 |
lemma DERIV_left_inc: |
|
15003 | 1587 |
assumes der: "DERIV f x :> l" |
1588 |
and l: "0 < l" |
|
15360 | 1589 |
shows "\<exists>d > 0. \<forall>h > 0. h < d --> f(x) < f(x + h)" |
15003 | 1590 |
proof - |
1591 |
from l der [THEN DERIV_D, THEN LIM_D [where r = "l"]] |
|
15360 | 1592 |
have "\<exists>s > 0. (\<forall>z. z \<noteq> 0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>(f(x+z) - f x) / z - l\<bar> < l)" |
15003 | 1593 |
by (simp add: diff_minus) |
1594 |
then obtain s |
|
15228 | 1595 |
where s: "0 < s" |
15003 | 1596 |
and all: "!!z. z \<noteq> 0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>(f(x+z) - f x) / z - l\<bar> < l" |
1597 |
by auto |
|
1598 |
thus ?thesis |
|
1599 |
proof (intro exI conjI strip) |
|
1600 |
show "0<s" . |
|
1601 |
fix h::real |
|
15360 | 1602 |
assume "0 < h" "h < s" |
15228 | 1603 |
with all [of h] show "f x < f (x+h)" |
1604 |
proof (simp add: abs_if pos_less_divide_eq diff_minus [symmetric] |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1605 |
split add: split_if_asm) |
15228 | 1606 |
assume "~ (f (x+h) - f x) / h < l" and h: "0 < h" |
1607 |
with l |
|
15003 | 1608 |
have "0 < (f (x+h) - f x) / h" by arith |
1609 |
thus "f x < f (x+h)" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1610 |
by (simp add: pos_less_divide_eq h) |
15003 | 1611 |
qed |
1612 |
qed |
|
1613 |
qed |
|
14477 | 1614 |
|
1615 |
lemma DERIV_left_dec: |
|
1616 |
assumes der: "DERIV f x :> l" |
|
1617 |
and l: "l < 0" |
|
15360 | 1618 |
shows "\<exists>d > 0. \<forall>h > 0. h < d --> f(x) < f(x-h)" |
14477 | 1619 |
proof - |
1620 |
from l der [THEN DERIV_D, THEN LIM_D [where r = "-l"]] |
|
15360 | 1621 |
have "\<exists>s > 0. (\<forall>z. z \<noteq> 0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>(f(x+z) - f x) / z - l\<bar> < -l)" |
14477 | 1622 |
by (simp add: diff_minus) |
1623 |
then obtain s |
|
15228 | 1624 |
where s: "0 < s" |
14477 | 1625 |
and all: "!!z. z \<noteq> 0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>(f(x+z) - f x) / z - l\<bar> < -l" |
1626 |
by auto |
|
1627 |
thus ?thesis |
|
1628 |
proof (intro exI conjI strip) |
|
1629 |
show "0<s" . |
|
1630 |
fix h::real |
|
15360 | 1631 |
assume "0 < h" "h < s" |
15228 | 1632 |
with all [of "-h"] show "f x < f (x-h)" |
1633 |
proof (simp add: abs_if pos_less_divide_eq diff_minus [symmetric] |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1634 |
split add: split_if_asm) |
15228 | 1635 |
assume " - ((f (x-h) - f x) / h) < l" and h: "0 < h" |
1636 |
with l |
|
14477 | 1637 |
have "0 < (f (x-h) - f x) / h" by arith |
1638 |
thus "f x < f (x-h)" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1639 |
by (simp add: pos_less_divide_eq h) |
14477 | 1640 |
qed |
1641 |
qed |
|
1642 |
qed |
|
1643 |
||
15228 | 1644 |
lemma DERIV_local_max: |
14477 | 1645 |
assumes der: "DERIV f x :> l" |
1646 |
and d: "0 < d" |
|
1647 |
and le: "\<forall>y. \<bar>x-y\<bar> < d --> f(y) \<le> f(x)" |
|
1648 |
shows "l = 0" |
|
1649 |
proof (cases rule: linorder_cases [of l 0]) |
|
1650 |
case equal show ?thesis . |
|
1651 |
next |
|
1652 |
case less |
|
1653 |
from DERIV_left_dec [OF der less] |
|
1654 |
obtain d' where d': "0 < d'" |
|
15360 | 1655 |
and lt: "\<forall>h > 0. h < d' \<longrightarrow> f x < f (x-h)" by blast |
14477 | 1656 |
from real_lbound_gt_zero [OF d d'] |
1657 |
obtain e where "0 < e \<and> e < d \<and> e < d'" .. |
|
15228 | 1658 |
with lt le [THEN spec [where x="x-e"]] |
14477 | 1659 |
show ?thesis by (auto simp add: abs_if) |
1660 |
next |
|
1661 |
case greater |
|
1662 |
from DERIV_left_inc [OF der greater] |
|
1663 |
obtain d' where d': "0 < d'" |
|
15360 | 1664 |
and lt: "\<forall>h > 0. h < d' \<longrightarrow> f x < f (x + h)" by blast |
14477 | 1665 |
from real_lbound_gt_zero [OF d d'] |
1666 |
obtain e where "0 < e \<and> e < d \<and> e < d'" .. |
|
1667 |
with lt le [THEN spec [where x="x+e"]] |
|
1668 |
show ?thesis by (auto simp add: abs_if) |
|
1669 |
qed |
|
1670 |
||
1671 |
||
1672 |
text{*Similar theorem for a local minimum*} |
|
1673 |
lemma DERIV_local_min: |
|
1674 |
"[| DERIV f x :> l; 0 < d; \<forall>y. \<bar>x-y\<bar> < d --> f(x) \<le> f(y) |] ==> l = 0" |
|
1675 |
by (drule DERIV_minus [THEN DERIV_local_max], auto) |
|
1676 |
||
1677 |
||
1678 |
text{*In particular, if a function is locally flat*} |
|
1679 |
lemma DERIV_local_const: |
|
1680 |
"[| DERIV f x :> l; 0 < d; \<forall>y. \<bar>x-y\<bar> < d --> f(x) = f(y) |] ==> l = 0" |
|
1681 |
by (auto dest!: DERIV_local_max) |
|
1682 |
||
1683 |
text{*Lemma about introducing open ball in open interval*} |
|
1684 |
lemma lemma_interval_lt: |
|
15228 | 1685 |
"[| a < x; x < b |] |
14477 | 1686 |
==> \<exists>d::real. 0 < d & (\<forall>y. \<bar>x-y\<bar> < d --> a < y & y < b)" |
1687 |
apply (simp add: abs_interval_iff) |
|
1688 |
apply (insert linorder_linear [of "x-a" "b-x"], safe) |
|
1689 |
apply (rule_tac x = "x-a" in exI) |
|
1690 |
apply (rule_tac [2] x = "b-x" in exI, auto) |
|
1691 |
done |
|
1692 |
||
1693 |
lemma lemma_interval: "[| a < x; x < b |] ==> |
|
1694 |
\<exists>d::real. 0 < d & (\<forall>y. \<bar>x-y\<bar> < d --> a \<le> y & y \<le> b)" |
|
1695 |
apply (drule lemma_interval_lt, auto) |
|
1696 |
apply (auto intro!: exI) |
|
1697 |
done |
|
1698 |
||
1699 |
text{*Rolle's Theorem. |
|
15228 | 1700 |
If @{term f} is defined and continuous on the closed interval |
1701 |
@{text "[a,b]"} and differentiable on the open interval @{text "(a,b)"}, |
|
14477 | 1702 |
and @{term "f(a) = f(b)"}, |
1703 |
then there exists @{text "x0 \<in> (a,b)"} such that @{term "f'(x0) = 0"}*} |
|
15228 | 1704 |
theorem Rolle: |
14477 | 1705 |
assumes lt: "a < b" |
1706 |
and eq: "f(a) = f(b)" |
|
1707 |
and con: "\<forall>x. a \<le> x & x \<le> b --> isCont f x" |
|
1708 |
and dif [rule_format]: "\<forall>x. a < x & x < b --> f differentiable x" |
|
1709 |
shows "\<exists>z. a < z & z < b & DERIV f z :> 0" |
|
1710 |
proof - |
|
1711 |
have le: "a \<le> b" using lt by simp |
|
1712 |
from isCont_eq_Ub [OF le con] |
|
15228 | 1713 |
obtain x where x_max: "\<forall>z. a \<le> z \<and> z \<le> b \<longrightarrow> f z \<le> f x" |
1714 |
and alex: "a \<le> x" and xleb: "x \<le> b" |
|
14477 | 1715 |
by blast |
1716 |
from isCont_eq_Lb [OF le con] |
|
15228 | 1717 |
obtain x' where x'_min: "\<forall>z. a \<le> z \<and> z \<le> b \<longrightarrow> f x' \<le> f z" |
1718 |
and alex': "a \<le> x'" and x'leb: "x' \<le> b" |
|
14477 | 1719 |
by blast |
1720 |
show ?thesis |
|
1721 |
proof cases |
|
1722 |
assume axb: "a < x & x < b" |
|
1723 |
--{*@{term f} attains its maximum within the interval*} |
|
1724 |
hence ax: "a<x" and xb: "x<b" by auto |
|
1725 |
from lemma_interval [OF ax xb] |
|
1726 |
obtain d where d: "0<d" and bound: "\<forall>y. \<bar>x-y\<bar> < d \<longrightarrow> a \<le> y \<and> y \<le> b" |
|
1727 |
by blast |
|
1728 |
hence bound': "\<forall>y. \<bar>x-y\<bar> < d \<longrightarrow> f y \<le> f x" using x_max |
|
1729 |
by blast |
|
1730 |
from differentiableD [OF dif [OF axb]] |
|
1731 |
obtain l where der: "DERIV f x :> l" .. |
|
15228 | 1732 |
have "l=0" by (rule DERIV_local_max [OF der d bound']) |
14477 | 1733 |
--{*the derivative at a local maximum is zero*} |
1734 |
thus ?thesis using ax xb der by auto |
|
1735 |
next |
|
1736 |
assume notaxb: "~ (a < x & x < b)" |
|
1737 |
hence xeqab: "x=a | x=b" using alex xleb by arith |
|
15228 | 1738 |
hence fb_eq_fx: "f b = f x" by (auto simp add: eq) |
14477 | 1739 |
show ?thesis |
1740 |
proof cases |
|
1741 |
assume ax'b: "a < x' & x' < b" |
|
1742 |
--{*@{term f} attains its minimum within the interval*} |
|
1743 |
hence ax': "a<x'" and x'b: "x'<b" by auto |
|
1744 |
from lemma_interval [OF ax' x'b] |
|
1745 |
obtain d where d: "0<d" and bound: "\<forall>y. \<bar>x'-y\<bar> < d \<longrightarrow> a \<le> y \<and> y \<le> b" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1746 |
by blast |
14477 | 1747 |
hence bound': "\<forall>y. \<bar>x'-y\<bar> < d \<longrightarrow> f x' \<le> f y" using x'_min |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1748 |
by blast |
14477 | 1749 |
from differentiableD [OF dif [OF ax'b]] |
1750 |
obtain l where der: "DERIV f x' :> l" .. |
|
15228 | 1751 |
have "l=0" by (rule DERIV_local_min [OF der d bound']) |
14477 | 1752 |
--{*the derivative at a local minimum is zero*} |
1753 |
thus ?thesis using ax' x'b der by auto |
|
1754 |
next |
|
1755 |
assume notax'b: "~ (a < x' & x' < b)" |
|
1756 |
--{*@{term f} is constant througout the interval*} |
|
1757 |
hence x'eqab: "x'=a | x'=b" using alex' x'leb by arith |
|
15228 | 1758 |
hence fb_eq_fx': "f b = f x'" by (auto simp add: eq) |
14477 | 1759 |
from dense [OF lt] |
1760 |
obtain r where ar: "a < r" and rb: "r < b" by blast |
|
1761 |
from lemma_interval [OF ar rb] |
|
1762 |
obtain d where d: "0<d" and bound: "\<forall>y. \<bar>r-y\<bar> < d \<longrightarrow> a \<le> y \<and> y \<le> b" |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1763 |
by blast |
15228 | 1764 |
have eq_fb: "\<forall>z. a \<le> z --> z \<le> b --> f z = f b" |
1765 |
proof (clarify) |
|
14477 | 1766 |
fix z::real |
1767 |
assume az: "a \<le> z" and zb: "z \<le> b" |
|
1768 |
show "f z = f b" |
|
1769 |
proof (rule order_antisym) |
|
15195 | 1770 |
show "f z \<le> f b" by (simp add: fb_eq_fx x_max az zb) |
1771 |
show "f b \<le> f z" by (simp add: fb_eq_fx' x'_min az zb) |
|
14477 | 1772 |
qed |
1773 |
qed |
|
1774 |
have bound': "\<forall>y. \<bar>r-y\<bar> < d \<longrightarrow> f r = f y" |
|
1775 |
proof (intro strip) |
|
1776 |
fix y::real |
|
1777 |
assume lt: "\<bar>r-y\<bar> < d" |
|
15228 | 1778 |
hence "f y = f b" by (simp add: eq_fb bound) |
14477 | 1779 |
thus "f r = f y" by (simp add: eq_fb ar rb order_less_imp_le) |
1780 |
qed |
|
1781 |
from differentiableD [OF dif [OF conjI [OF ar rb]]] |
|
1782 |
obtain l where der: "DERIV f r :> l" .. |
|
15228 | 1783 |
have "l=0" by (rule DERIV_local_const [OF der d bound']) |
14477 | 1784 |
--{*the derivative of a constant function is zero*} |
1785 |
thus ?thesis using ar rb der by auto |
|
1786 |
qed |
|
1787 |
qed |
|
1788 |
qed |
|
1789 |
||
1790 |
||
1791 |
subsection{*Mean Value Theorem*} |
|
1792 |
||
1793 |
lemma lemma_MVT: |
|
1794 |
"f a - (f b - f a)/(b-a) * a = f b - (f b - f a)/(b-a) * (b::real)" |
|
1795 |
proof cases |
|
1796 |
assume "a=b" thus ?thesis by simp |
|
1797 |
next |
|
15228 | 1798 |
assume "a\<noteq>b" |
14477 | 1799 |
hence ba: "b-a \<noteq> 0" by arith |
1800 |
show ?thesis |
|
1801 |
by (rule real_mult_left_cancel [OF ba, THEN iffD1], |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1802 |
simp add: right_diff_distrib, |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15228
diff
changeset
|
1803 |
simp add: left_diff_distrib) |
14477 | 1804 |
qed |
1805 |
||
15228 | 1806 |
theorem MVT: |
14477 | 1807 |
assumes lt: "a < b" |
1808 |
and con: "\<forall>x. a \<le> x & x \<le> b --> isCont f x" |
|
1809 |
and dif [rule_format]: "\<forall>x. a < x & x < b --> f differentiable x" |
|
1810 |
shows "\<exists>l z. a < z & z < b & DERIV f z :> l & |
|
1811 |
(f(b) - f(a) = (b-a) * l)" |
|
1812 |
proof - |
|
1813 |
let ?F = "%x. f x - ((f b - f a) / (b-a)) * x" |
|
1814 |
have contF: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont ?F x" using con |
|
15228 | 1815 |
by (fast intro: isCont_diff isCont_const isCont_mult isCont_Id) |
14477 | 1816 |
have difF: "\<forall>x. a < x \<and> x < b \<longrightarrow> ?F differentiable x" |
1817 |
proof (clarify) |
|
1818 |
fix x::real |
|
1819 |
assume ax: "a < x" and xb: "x < b" |
|
1820 |
from differentiableD [OF dif [OF conjI [OF ax xb]]] |
|
1821 |
obtain l where der: "DERIV f x :> l" .. |
|
1822 |
show "?F differentiable x" |
|
1823 |
by (rule differentiableI [where D = "l - (f b - f a)/(b-a)"], |
|
15228 | 1824 |
blast intro: DERIV_diff DERIV_cmult_Id der) |
1825 |
qed |
|
14477 | 1826 |
from Rolle [where f = ?F, OF lt lemma_MVT contF difF] |
15228 | 1827 |
obtain z where az: "a < z" and zb: "z < b" and der: "DERIV ?F z :> 0" |
14477 | 1828 |
by blast |
1829 |
have "DERIV (%x. ((f b - f a)/(b-a)) * x) z :> (f b - f a)/(b-a)" |
|
1830 |
by (rule DERIV_cmult_Id) |
|
15228 | 1831 |
hence derF: "DERIV (\<lambda>x. ?F x + (f b - f a) / (b - a) * x) z |
14477 | 1832 |
:> 0 + (f b - f a) / (b - a)" |
1833 |
by (rule DERIV_add [OF der]) |
|
15228 | 1834 |
show ?thesis |
14477 | 1835 |
proof (intro exI conjI) |
1836 |
show "a < z" . |
|
1837 |
show "z < b" . |
|
15539 | 1838 |
show "f b - f a = (b - a) * ((f b - f a)/(b-a))" by (simp) |
14477 | 1839 |
show "DERIV f z :> ((f b - f a)/(b-a))" using derF by simp |
1840 |
qed |
|
1841 |
qed |
|
1842 |
||
1843 |
||
1844 |
text{*A function is constant if its derivative is 0 over an interval.*} |
|
1845 |
||
1846 |
lemma DERIV_isconst_end: "[| a < b; |
|
1847 |
\<forall>x. a \<le> x & x \<le> b --> isCont f x; |
|
1848 |
\<forall>x. a < x & x < b --> DERIV f x :> 0 |] |
|
15360 | 1849 |
==> f b = f a" |
14477 | 1850 |
apply (drule MVT, assumption) |
1851 |
apply (blast intro: differentiableI) |
|
1852 |
apply (auto dest!: DERIV_unique simp add: diff_eq_eq) |
|
1853 |
done |
|
1854 |
||
1855 |
lemma DERIV_isconst1: "[| a < b; |
|
1856 |
\<forall>x. a \<le> x & x \<le> b --> isCont f x; |
|
1857 |
\<forall>x. a < x & x < b --> DERIV f x :> 0 |] |
|
1858 |
==> \<forall>x. a \<le> x & x \<le> b --> f x = f a" |
|
1859 |
apply safe |
|
1860 |
apply (drule_tac x = a in order_le_imp_less_or_eq, safe) |
|
1861 |
apply (drule_tac b = x in DERIV_isconst_end, auto) |
|
1862 |
done |
|
1863 |
||
1864 |
lemma DERIV_isconst2: "[| a < b; |
|
1865 |
\<forall>x. a \<le> x & x \<le> b --> isCont f x; |
|
1866 |
\<forall>x. a < x & x < b --> DERIV f x :> 0; |
|
1867 |
a \<le> x; x \<le> b |] |
|
1868 |
==> f x = f a" |
|
1869 |
apply (blast dest: DERIV_isconst1) |
|
1870 |
done |
|
1871 |
||
1872 |
lemma DERIV_isconst_all: "\<forall>x. DERIV f x :> 0 ==> f(x) = f(y)" |
|
1873 |
apply (rule linorder_cases [of x y]) |
|
1874 |
apply (blast intro: sym DERIV_isCont DERIV_isconst_end)+ |
|
1875 |
done |
|
1876 |
||
1877 |
lemma DERIV_const_ratio_const: |
|
1878 |
"[|a \<noteq> b; \<forall>x. DERIV f x :> k |] ==> (f(b) - f(a)) = (b-a) * k" |
|
1879 |
apply (rule linorder_cases [of a b], auto) |
|
1880 |
apply (drule_tac [!] f = f in MVT) |
|
1881 |
apply (auto dest: DERIV_isCont DERIV_unique simp add: differentiable_def) |
|
1882 |
apply (auto dest: DERIV_unique simp add: left_distrib diff_minus) |
|
1883 |
done |
|
1884 |
||
1885 |
lemma DERIV_const_ratio_const2: |
|
1886 |
"[|a \<noteq> b; \<forall>x. DERIV f x :> k |] ==> (f(b) - f(a))/(b-a) = k" |
|
1887 |
apply (rule_tac c1 = "b-a" in real_mult_right_cancel [THEN iffD1]) |
|
15539 | 1888 |
apply (auto dest!: DERIV_const_ratio_const simp add: mult_assoc) |
14477 | 1889 |
done |
1890 |
||
15228 | 1891 |
lemma real_average_minus_first [simp]: "((a + b) /2 - a) = (b-a)/(2::real)" |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1892 |
by (simp) |
14477 | 1893 |
|
15228 | 1894 |
lemma real_average_minus_second [simp]: "((b + a)/2 - a) = (b-a)/(2::real)" |
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
1895 |
by (simp) |
14477 | 1896 |
|
1897 |
text{*Gallileo's "trick": average velocity = av. of end velocities*} |
|
1898 |
||
1899 |
lemma DERIV_const_average: |
|
1900 |
assumes neq: "a \<noteq> (b::real)" |
|
1901 |
and der: "\<forall>x. DERIV v x :> k" |
|
1902 |
shows "v ((a + b)/2) = (v a + v b)/2" |
|
1903 |
proof (cases rule: linorder_cases [of a b]) |
|
1904 |
case equal with neq show ?thesis by simp |
|
1905 |
next |
|
1906 |
case less |
|
1907 |
have "(v b - v a) / (b - a) = k" |
|
1908 |
by (rule DERIV_const_ratio_const2 [OF neq der]) |
|
15228 | 1909 |
hence "(b-a) * ((v b - v a) / (b-a)) = (b-a) * k" by simp |
14477 | 1910 |
moreover have "(v ((a + b) / 2) - v a) / ((a + b) / 2 - a) = k" |
1911 |
by (rule DERIV_const_ratio_const2 [OF _ der], simp add: neq) |
|
1912 |
ultimately show ?thesis using neq by force |
|
1913 |
next |
|
1914 |
case greater |
|
1915 |
have "(v b - v a) / (b - a) = k" |
|
1916 |
by (rule DERIV_const_ratio_const2 [OF neq der]) |
|
15228 | 1917 |
hence "(b-a) * ((v b - v a) / (b-a)) = (b-a) * k" by simp |
14477 | 1918 |
moreover have " (v ((b + a) / 2) - v a) / ((b + a) / 2 - a) = k" |
1919 |
by (rule DERIV_const_ratio_const2 [OF _ der], simp add: neq) |
|
15228 | 1920 |
ultimately show ?thesis using neq by (force simp add: add_commute) |
14477 | 1921 |
qed |
1922 |
||
1923 |
||
1924 |
text{*Dull lemma: an continuous injection on an interval must have a |
|
1925 |
strict maximum at an end point, not in the middle.*} |
|
1926 |
||
1927 |
lemma lemma_isCont_inj: |
|
1928 |
assumes d: "0 < d" |
|
1929 |
and inj [rule_format]: "\<forall>z. \<bar>z-x\<bar> \<le> d --> g(f z) = z" |
|
1930 |
and cont: "\<forall>z. \<bar>z-x\<bar> \<le> d --> isCont f z" |
|
1931 |
shows "\<exists>z. \<bar>z-x\<bar> \<le> d & f x < f z" |
|
1932 |
proof (rule ccontr) |
|
1933 |
assume "~ (\<exists>z. \<bar>z-x\<bar> \<le> d & f x < f z)" |
|
15228 | 1934 |
hence all [rule_format]: "\<forall>z. \<bar>z - x\<bar> \<le> d --> f z \<le> f x" by auto |
14477 | 1935 |
show False |
1936 |
proof (cases rule: linorder_le_cases [of "f(x-d)" "f(x+d)"]) |
|
1937 |
case le |
|
1938 |
from d cont all [of "x+d"] |
|
15228 | 1939 |
have flef: "f(x+d) \<le> f x" |
1940 |
and xlex: "x - d \<le> x" |
|
1941 |
and cont': "\<forall>z. x - d \<le> z \<and> z \<le> x \<longrightarrow> isCont f z" |
|
14477 | 1942 |
by (auto simp add: abs_if) |
1943 |
from IVT [OF le flef xlex cont'] |
|
1944 |
obtain x' where "x-d \<le> x'" "x' \<le> x" "f x' = f(x+d)" by blast |
|
1945 |
moreover |
|
1946 |
hence "g(f x') = g (f(x+d))" by simp |
|
1947 |
ultimately show False using d inj [of x'] inj [of "x+d"] |
|
1948 |
by (simp add: abs_le_interval_iff) |
|
1949 |
next |
|
1950 |
case ge |
|
1951 |
from d cont all [of "x-d"] |
|
15228 | 1952 |
have flef: "f(x-d) \<le> f x" |
1953 |
and xlex: "x \<le> x+d" |
|
1954 |
and cont': "\<forall>z. x \<le> z \<and> z \<le> x+d \<longrightarrow> isCont f z" |
|
14477 | 1955 |
by (auto simp add: abs_if) |
1956 |
from IVT2 [OF ge flef xlex cont'] |
|
1957 |
obtain x' where "x \<le> x'" "x' \<le> x+d" "f x' = f(x-d)" by blast |
|
1958 |
moreover |
|
1959 |
hence "g(f x') = g (f(x-d))" by simp |
|
1960 |
ultimately show False using d inj [of x'] inj [of "x-d"] |
|
1961 |
by (simp add: abs_le_interval_iff) |
|
1962 |
qed |
|
1963 |
qed |
|
1964 |
||
1965 |
||
1966 |
text{*Similar version for lower bound.*} |
|
1967 |
||
1968 |
lemma lemma_isCont_inj2: |
|
1969 |
"[|0 < d; \<forall>z. \<bar>z-x\<bar> \<le> d --> g(f z) = z; |
|
1970 |
\<forall>z. \<bar>z-x\<bar> \<le> d --> isCont f z |] |
|
1971 |
==> \<exists>z. \<bar>z-x\<bar> \<le> d & f z < f x" |
|
1972 |
apply (insert lemma_isCont_inj |
|
1973 |
[where f = "%x. - f x" and g = "%y. g(-y)" and x = x and d = d]) |
|
15228 | 1974 |
apply (simp add: isCont_minus linorder_not_le) |
14477 | 1975 |
done |
1976 |
||
15228 | 1977 |
text{*Show there's an interval surrounding @{term "f(x)"} in |
14477 | 1978 |
@{text "f[[x - d, x + d]]"} .*} |
1979 |
||
15228 | 1980 |
lemma isCont_inj_range: |
14477 | 1981 |
assumes d: "0 < d" |
1982 |
and inj: "\<forall>z. \<bar>z-x\<bar> \<le> d --> g(f z) = z" |
|
1983 |
and cont: "\<forall>z. \<bar>z-x\<bar> \<le> d --> isCont f z" |
|
15360 | 1984 |
shows "\<exists>e>0. \<forall>y. \<bar>y - f x\<bar> \<le> e --> (\<exists>z. \<bar>z-x\<bar> \<le> d & f z = y)" |
14477 | 1985 |
proof - |
1986 |
have "x-d \<le> x+d" "\<forall>z. x-d \<le> z \<and> z \<le> x+d \<longrightarrow> isCont f z" using cont d |
|
1987 |
by (auto simp add: abs_le_interval_iff) |
|
1988 |
from isCont_Lb_Ub [OF this] |
|
15228 | 1989 |
obtain L M |
14477 | 1990 |
where all1 [rule_format]: "\<forall>z. x-d \<le> z \<and> z \<le> x+d \<longrightarrow> L \<le> f z \<and> f z \<le> M" |
1991 |
and all2 [rule_format]: |
|
1992 |
"\<forall>y. L \<le> y \<and> y \<le> M \<longrightarrow> (\<exists>z. x-d \<le> z \<and> z \<le> x+d \<and> f z = y)" |
|
1993 |
by auto |
|
1994 |
with d have "L \<le> f x & f x \<le> M" by simp |
|
1995 |
moreover have "L \<noteq> f x" |
|
1996 |
proof - |
|
1997 |
from lemma_isCont_inj2 [OF d inj cont] |
|
1998 |
obtain u where "\<bar>u - x\<bar> \<le> d" "f u < f x" by auto |
|
1999 |
thus ?thesis using all1 [of u] by arith |
|
2000 |
qed |
|
2001 |
moreover have "f x \<noteq> M" |
|
2002 |
proof - |
|
2003 |
from lemma_isCont_inj [OF d inj cont] |
|
2004 |
obtain u where "\<bar>u - x\<bar> \<le> d" "f x < f u" by auto |
|
2005 |
thus ?thesis using all1 [of u] by arith |
|
2006 |
qed |
|
2007 |
ultimately have "L < f x & f x < M" by arith |
|
2008 |
hence "0 < f x - L" "0 < M - f x" by arith+ |
|
2009 |
from real_lbound_gt_zero [OF this] |
|
2010 |
obtain e where e: "0 < e" "e < f x - L" "e < M - f x" by auto |
|
2011 |
thus ?thesis |
|
2012 |
proof (intro exI conjI) |
|
2013 |
show "0<e" . |
|
2014 |
show "\<forall>y. \<bar>y - f x\<bar> \<le> e \<longrightarrow> (\<exists>z. \<bar>z - x\<bar> \<le> d \<and> f z = y)" |
|
2015 |
proof (intro strip) |
|
2016 |
fix y::real |
|
2017 |
assume "\<bar>y - f x\<bar> \<le> e" |
|
2018 |
with e have "L \<le> y \<and> y \<le> M" by arith |
|
2019 |
from all2 [OF this] |
|
2020 |
obtain z where "x - d \<le> z" "z \<le> x + d" "f z = y" by blast |
|
15228 | 2021 |
thus "\<exists>z. \<bar>z - x\<bar> \<le> d \<and> f z = y" |
14477 | 2022 |
by (force simp add: abs_le_interval_iff) |
2023 |
qed |
|
2024 |
qed |
|
2025 |
qed |
|
2026 |
||
2027 |
||
2028 |
text{*Continuity of inverse function*} |
|
2029 |
||
2030 |
lemma isCont_inverse_function: |
|
2031 |
assumes d: "0 < d" |
|
2032 |
and inj: "\<forall>z. \<bar>z-x\<bar> \<le> d --> g(f z) = z" |
|
2033 |
and cont: "\<forall>z. \<bar>z-x\<bar> \<le> d --> isCont f z" |
|
2034 |
shows "isCont g (f x)" |
|
2035 |
proof (simp add: isCont_iff LIM_eq) |
|
2036 |
show "\<forall>r. 0 < r \<longrightarrow> |
|
15360 | 2037 |
(\<exists>s>0. \<forall>z. z\<noteq>0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>g(f x + z) - g(f x)\<bar> < r)" |
14477 | 2038 |
proof (intro strip) |
2039 |
fix r::real |
|
2040 |
assume r: "0<r" |
|
2041 |
from real_lbound_gt_zero [OF r d] |
|
2042 |
obtain e where e: "0 < e" and e_lt: "e < r \<and> e < d" by blast |
|
2043 |
with inj cont |
|
15228 | 2044 |
have e_simps: "\<forall>z. \<bar>z-x\<bar> \<le> e --> g (f z) = z" |
14477 | 2045 |
"\<forall>z. \<bar>z-x\<bar> \<le> e --> isCont f z" by auto |
2046 |
from isCont_inj_range [OF e this] |
|
15228 | 2047 |
obtain e' where e': "0 < e'" |
14477 | 2048 |
and all: "\<forall>y. \<bar>y - f x\<bar> \<le> e' \<longrightarrow> (\<exists>z. \<bar>z - x\<bar> \<le> e \<and> f z = y)" |
2049 |
by blast |
|
15360 | 2050 |
show "\<exists>s>0. \<forall>z. z\<noteq>0 \<and> \<bar>z\<bar> < s \<longrightarrow> \<bar>g(f x + z) - g(f x)\<bar> < r" |
14477 | 2051 |
proof (intro exI conjI) |
2052 |
show "0<e'" . |
|
2053 |
show "\<forall>z. z \<noteq> 0 \<and> \<bar>z\<bar> < e' \<longrightarrow> \<bar>g (f x + z) - g (f x)\<bar> < r" |
|
2054 |
proof (intro strip) |
|
2055 |
fix z::real |
|
2056 |
assume z: "z \<noteq> 0 \<and> \<bar>z\<bar> < e'" |
|
2057 |
with e e_lt e_simps all [rule_format, of "f x + z"] |
|
2058 |
show "\<bar>g (f x + z) - g (f x)\<bar> < r" by force |
|
2059 |
qed |
|
2060 |
qed |
|
2061 |
qed |
|
15228 | 2062 |
qed |
14477 | 2063 |
|
19023
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2064 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2065 |
lemma differentiable_const: "(\<lambda>z. a) differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2066 |
apply (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2067 |
apply (rule_tac x=0 in exI) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2068 |
apply simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2069 |
done |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2070 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2071 |
lemma differentiable_sum: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2072 |
assumes "f differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2073 |
and "g differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2074 |
shows "(\<lambda>x. f x + g x) differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2075 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2076 |
from prems have "\<exists>D. DERIV f x :> D" by (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2077 |
then obtain df where "DERIV f x :> df" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2078 |
moreover from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2079 |
then obtain dg where "DERIV g x :> dg" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2080 |
ultimately have "DERIV (\<lambda>x. f x + g x) x :> df + dg" by (rule DERIV_add) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2081 |
hence "\<exists>D. DERIV (\<lambda>x. f x + g x) x :> D" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2082 |
thus ?thesis by (fold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2083 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2084 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2085 |
lemma differentiable_diff: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2086 |
assumes "f differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2087 |
and "g differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2088 |
shows "(\<lambda>x. f x - g x) differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2089 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2090 |
from prems have "f differentiable x" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2091 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2092 |
from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2093 |
then obtain dg where "DERIV g x :> dg" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2094 |
then have "DERIV (\<lambda>x. - g x) x :> -dg" by (rule DERIV_minus) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2095 |
hence "\<exists>D. DERIV (\<lambda>x. - g x) x :> D" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2096 |
hence "(\<lambda>x. - g x) differentiable x" by (fold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2097 |
ultimately |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2098 |
show ?thesis |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2099 |
by (auto simp: real_diff_def dest: differentiable_sum) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2100 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2101 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2102 |
lemma differentiable_mult: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2103 |
assumes "f differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2104 |
and "g differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2105 |
shows "(\<lambda>x. f x * g x) differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2106 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2107 |
from prems have "\<exists>D. DERIV f x :> D" by (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2108 |
then obtain df where "DERIV f x :> df" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2109 |
moreover from prems have "\<exists>D. DERIV g x :> D" by (unfold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2110 |
then obtain dg where "DERIV g x :> dg" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2111 |
ultimately have "DERIV (\<lambda>x. f x * g x) x :> df * g x + dg * f x" by (simp add: DERIV_mult) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2112 |
hence "\<exists>D. DERIV (\<lambda>x. f x * g x) x :> D" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2113 |
thus ?thesis by (fold differentiable_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2114 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2115 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2116 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2117 |
theorem GMVT: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2118 |
assumes alb: "a < b" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2119 |
and fc: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2120 |
and fd: "\<forall>x. a < x \<and> x < b \<longrightarrow> f differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2121 |
and gc: "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont g x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2122 |
and gd: "\<forall>x. a < x \<and> x < b \<longrightarrow> g differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2123 |
shows "\<exists>g'c f'c c. DERIV g c :> g'c \<and> DERIV f c :> f'c \<and> a < c \<and> c < b \<and> ((f b - f a) * g'c) = ((g b - g a) * f'c)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2124 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2125 |
let ?h = "\<lambda>x. (f b - f a)*(g x) - (g b - g a)*(f x)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2126 |
from prems have "a < b" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2127 |
moreover have "\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont ?h x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2128 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2129 |
have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. f b - f a) x" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2130 |
with gc have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. (f b - f a) * g x) x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2131 |
by (auto intro: isCont_mult) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2132 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2133 |
have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. g b - g a) x" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2134 |
with fc have "\<forall>x. a <= x \<and> x <= b \<longrightarrow> isCont (\<lambda>x. (g b - g a) * f x) x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2135 |
by (auto intro: isCont_mult) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2136 |
ultimately show ?thesis |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2137 |
by (fastsimp intro: isCont_diff) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2138 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2139 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2140 |
have "\<forall>x. a < x \<and> x < b \<longrightarrow> ?h differentiable x" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2141 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2142 |
have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. f b - f a) differentiable x" by (simp add: differentiable_const) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2143 |
with gd have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. (f b - f a) * g x) differentiable x" by (simp add: differentiable_mult) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2144 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2145 |
have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. g b - g a) differentiable x" by (simp add: differentiable_const) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2146 |
with fd have "\<forall>x. a < x \<and> x < b \<longrightarrow> (\<lambda>x. (g b - g a) * f x) differentiable x" by (simp add: differentiable_mult) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2147 |
ultimately show ?thesis by (simp add: differentiable_diff) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2148 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2149 |
ultimately have "\<exists>l z. a < z \<and> z < b \<and> DERIV ?h z :> l \<and> ?h b - ?h a = (b - a) * l" by (rule MVT) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2150 |
then obtain l where ldef: "\<exists>z. a < z \<and> z < b \<and> DERIV ?h z :> l \<and> ?h b - ?h a = (b - a) * l" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2151 |
then obtain c where cdef: "a < c \<and> c < b \<and> DERIV ?h c :> l \<and> ?h b - ?h a = (b - a) * l" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2152 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2153 |
from cdef have cint: "a < c \<and> c < b" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2154 |
with gd have "g differentiable c" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2155 |
hence "\<exists>D. DERIV g c :> D" by (rule differentiableD) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2156 |
then obtain g'c where g'cdef: "DERIV g c :> g'c" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2157 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2158 |
from cdef have "a < c \<and> c < b" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2159 |
with fd have "f differentiable c" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2160 |
hence "\<exists>D. DERIV f c :> D" by (rule differentiableD) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2161 |
then obtain f'c where f'cdef: "DERIV f c :> f'c" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2162 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2163 |
from cdef have "DERIV ?h c :> l" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2164 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2165 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2166 |
from g'cdef have "DERIV (\<lambda>x. (f b - f a) * g x) c :> g'c * (f b - f a)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2167 |
apply (insert DERIV_const [where k="f b - f a"]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2168 |
apply (drule meta_spec [of _ c]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2169 |
apply (drule DERIV_mult [where f="(\<lambda>x. f b - f a)" and g=g]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2170 |
by simp_all |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2171 |
moreover from f'cdef have "DERIV (\<lambda>x. (g b - g a) * f x) c :> f'c * (g b - g a)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2172 |
apply (insert DERIV_const [where k="g b - g a"]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2173 |
apply (drule meta_spec [of _ c]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2174 |
apply (drule DERIV_mult [where f="(\<lambda>x. g b - g a)" and g=f]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2175 |
by simp_all |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2176 |
ultimately have "DERIV ?h c :> g'c * (f b - f a) - f'c * (g b - g a)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2177 |
by (simp add: DERIV_diff) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2178 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2179 |
ultimately have leq: "l = g'c * (f b - f a) - f'c * (g b - g a)" by (rule DERIV_unique) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2180 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2181 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2182 |
from cdef have "?h b - ?h a = (b - a) * l" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2183 |
also with leq have "\<dots> = (b - a) * (g'c * (f b - f a) - f'c * (g b - g a))" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2184 |
finally have "?h b - ?h a = (b - a) * (g'c * (f b - f a) - f'c * (g b - g a))" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2185 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2186 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2187 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2188 |
have "?h b - ?h a = |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2189 |
((f b)*(g b) - (f a)*(g b) - (g b)*(f b) + (g a)*(f b)) - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2190 |
((f b)*(g a) - (f a)*(g a) - (g b)*(f a) + (g a)*(f a))" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2191 |
by (simp add: mult_ac add_ac real_diff_mult_distrib) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2192 |
hence "?h b - ?h a = 0" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2193 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2194 |
ultimately have "(b - a) * (g'c * (f b - f a) - f'c * (g b - g a)) = 0" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2195 |
with alb have "g'c * (f b - f a) - f'c * (g b - g a) = 0" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2196 |
hence "g'c * (f b - f a) = f'c * (g b - g a)" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2197 |
hence "(f b - f a) * g'c = (g b - g a) * f'c" by (simp add: mult_ac) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2198 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2199 |
with g'cdef f'cdef cint show ?thesis by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2200 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2201 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2202 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2203 |
lemma LIMSEQ_SEQ_conv1: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2204 |
assumes "X -- a --> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2205 |
shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2206 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2207 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2208 |
from prems have Xdef: "\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r" by (unfold LIM_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2209 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2210 |
fix S |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2211 |
assume as: "(\<forall>n. S n \<noteq> a) \<and> S ----> a" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2212 |
then have "S ----> a" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2213 |
then have Sdef: "(\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < r))" by (unfold LIMSEQ_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2214 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2215 |
fix r |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2216 |
from Xdef have Xdef2: "0 < r --> (\<exists>s > 0. \<forall>x. x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2217 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2218 |
assume rgz: "0 < r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2219 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2220 |
from Xdef2 rgz have "\<exists>s > 0. \<forall>x. x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2221 |
then obtain s where sdef: "s > 0 \<and> (\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>X x + -L\<bar> < r)" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2222 |
then have aux: "\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>X x + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2223 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2224 |
fix n |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2225 |
from aux have "S n \<noteq> a \<and> \<bar>S n + -a\<bar> < s \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2226 |
with as have imp2: "\<bar>S n + -a\<bar> < s --> \<bar>X (S n) + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2227 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2228 |
hence "\<forall>n. \<bar>S n + -a\<bar> < s --> \<bar>X (S n) + -L\<bar> < r" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2229 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2230 |
from Sdef sdef have imp1: "\<exists>no. \<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < s" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2231 |
then obtain no where "\<forall>n. no \<le> n --> \<bar>S n + -a\<bar> < s" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2232 |
ultimately have "\<forall>n. no \<le> n \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2233 |
hence "\<exists>no. \<forall>n. no \<le> n \<longrightarrow> \<bar>X (S n) + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2234 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2235 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2236 |
hence "(\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>X (S n) + -L\<bar> < r))" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2237 |
hence "(\<lambda>n. X (S n)) ----> L" by (fold LIMSEQ_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2238 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2239 |
thus ?thesis by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2240 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2241 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2242 |
lemma LIMSEQ_SEQ_conv2: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2243 |
assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2244 |
shows "X -- a --> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2245 |
proof (rule ccontr) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2246 |
assume "\<not> (X -- a --> L)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2247 |
hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by (unfold LIM_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2248 |
hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. \<not>(x \<noteq> a \<and> \<bar>x + -a\<bar> < s --> \<bar>X x + -L\<bar> < r)" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2249 |
hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r)" by (simp add: linorder_not_less) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2250 |
then obtain r where rdef: "r > 0 \<and> (\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r))" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2251 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2252 |
let ?F = "\<lambda>n::nat. SOME x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2253 |
have "?F ----> a" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2254 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2255 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2256 |
fix e::real |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2257 |
assume "0 < e" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2258 |
(* choose no such that inverse (real (Suc n)) < e *) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2259 |
have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2260 |
then obtain m where nodef: "inverse (real (Suc m)) < e" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2261 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2262 |
fix n |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2263 |
assume mlen: "m \<le> n" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2264 |
then have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2265 |
"inverse (real (Suc n)) \<le> inverse (real (Suc m))" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2266 |
by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2267 |
moreover have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2268 |
"\<bar>?F n + -a\<bar> < inverse (real (Suc n))" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2269 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2270 |
from rdef have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2271 |
"\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2272 |
by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2273 |
hence |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2274 |
"(?F n)\<noteq>a \<and> \<bar>(?F n) + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X (?F n) + -L\<bar> \<ge> r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2275 |
by (simp add: some_eq_ex [symmetric]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2276 |
thus ?thesis by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2277 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2278 |
moreover from nodef have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2279 |
"inverse (real (Suc m)) < e" . |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2280 |
ultimately have "\<bar>?F n + -a\<bar> < e" by arith |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2281 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2282 |
then have "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n + -a\<bar> < e" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2283 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2284 |
thus ?thesis by (unfold LIMSEQ_def, simp) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2285 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2286 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2287 |
moreover have "\<forall>n. ?F n \<noteq> a" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2288 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2289 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2290 |
fix n |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2291 |
from rdef have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2292 |
"\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2293 |
by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2294 |
hence "?F n \<noteq> a" by (simp add: some_eq_ex [symmetric]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2295 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2296 |
thus ?thesis .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2297 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2298 |
moreover from prems have "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2299 |
ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2300 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2301 |
moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2302 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2303 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2304 |
fix no::nat |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2305 |
obtain n where "n = no + 1" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2306 |
then have nolen: "no \<le> n" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2307 |
(* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2308 |
from rdef have "\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x + -a\<bar> < s \<and> \<bar>X x + -L\<bar> \<ge> r)" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2309 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2310 |
then have "\<exists>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < inverse (real (Suc n)) \<and> \<bar>X x + -L\<bar> \<ge> r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2311 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2312 |
hence "\<bar>X (?F n) + -L\<bar> \<ge> r" by (simp add: some_eq_ex [symmetric]) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2313 |
with nolen have "\<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2314 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2315 |
then have "(\<forall>no. \<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> r)" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2316 |
with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> \<bar>X (?F n) + -L\<bar> \<ge> e)" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2317 |
thus ?thesis by (unfold LIMSEQ_def, auto simp add: linorder_not_less) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2318 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2319 |
ultimately show False by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2320 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2321 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2322 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2323 |
lemma LIMSEQ_SEQ_conv: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2324 |
"(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L) = (X -- a --> L)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2325 |
proof |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2326 |
assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2327 |
show "X -- a --> L" by (rule LIMSEQ_SEQ_conv2) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2328 |
next |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2329 |
assume "(X -- a --> L)" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2330 |
show "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2331 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2332 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2333 |
lemma real_sqz: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2334 |
fixes a::real |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2335 |
assumes "a < c" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2336 |
shows "\<exists>b. a < b \<and> b < c" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2337 |
proof |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2338 |
let ?b = "(a + c) / 2" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2339 |
have "a < ?b" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2340 |
moreover |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2341 |
have "?b < c" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2342 |
ultimately |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2343 |
show "a < ?b \<and> ?b < c" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2344 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2345 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2346 |
lemma LIM_offset: |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2347 |
assumes "(\<lambda>x. f x) -- a --> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2348 |
shows "(\<lambda>x. f (x+c)) -- (a-c) --> L" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2349 |
proof - |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2350 |
have "f -- a --> L" . |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2351 |
hence |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2352 |
fd: "\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & \<bar>x + -a\<bar> < s --> \<bar>f x + -L\<bar> < r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2353 |
by (unfold LIM_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2354 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2355 |
fix r::real |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2356 |
assume rgz: "0 < r" |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2357 |
with fd have "\<exists>s > 0. \<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s --> \<bar>f x + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2358 |
then obtain s where sgz: "s > 0" and ax: "\<forall>x. x\<noteq>a \<and> \<bar>x + -a\<bar> < s \<longrightarrow> \<bar>f x + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2359 |
from ax have ax2: "\<forall>x. (x+c)\<noteq>a \<and> \<bar>(x+c) + -a\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2360 |
{ |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2361 |
fix x::real |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2362 |
from ax2 have nt: "(x+c)\<noteq>a \<and> \<bar>(x+c) + -a\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2363 |
moreover have "((x+c)\<noteq>a) = (x\<noteq>(a-c))" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2364 |
moreover have "((x+c) + -a) = (x + -(a-c))" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2365 |
ultimately have "x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2366 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2367 |
then have "\<forall>x. x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" .. |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2368 |
with sgz have "\<exists>s > 0. \<forall>x. x\<noteq>(a-c) \<and> \<bar>x + -(a-c)\<bar> < s \<longrightarrow> \<bar>f (x+c) + -L\<bar> < r" by auto |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2369 |
} |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2370 |
then have |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2371 |
"\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> (a-c) & \<bar>x + -(a-c)\<bar> < s --> \<bar>f (x+c) + -L\<bar> < r" by simp |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2372 |
thus ?thesis by (fold LIM_def) |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2373 |
qed |
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2374 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2375 |
|
5652a536b7e8
* include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents:
17318
diff
changeset
|
2376 |
|
14477 | 2377 |
ML |
2378 |
{* |
|
2379 |
val LIM_def = thm"LIM_def"; |
|
2380 |
val NSLIM_def = thm"NSLIM_def"; |
|
2381 |
val isCont_def = thm"isCont_def"; |
|
2382 |
val isNSCont_def = thm"isNSCont_def"; |
|
2383 |
val deriv_def = thm"deriv_def"; |
|
2384 |
val nsderiv_def = thm"nsderiv_def"; |
|
2385 |
val differentiable_def = thm"differentiable_def"; |
|
2386 |
val NSdifferentiable_def = thm"NSdifferentiable_def"; |
|
2387 |
val increment_def = thm"increment_def"; |
|
2388 |
val isUCont_def = thm"isUCont_def"; |
|
2389 |
val isNSUCont_def = thm"isNSUCont_def"; |
|
2390 |
||
2391 |
val half_gt_zero_iff = thm "half_gt_zero_iff"; |
|
2392 |
val half_gt_zero = thms "half_gt_zero"; |
|
2393 |
val abs_diff_triangle_ineq = thm "abs_diff_triangle_ineq"; |
|
2394 |
val LIM_eq = thm "LIM_eq"; |
|
2395 |
val LIM_D = thm "LIM_D"; |
|
2396 |
val LIM_const = thm "LIM_const"; |
|
2397 |
val LIM_add = thm "LIM_add"; |
|
2398 |
val LIM_minus = thm "LIM_minus"; |
|
2399 |
val LIM_add_minus = thm "LIM_add_minus"; |
|
2400 |
val LIM_diff = thm "LIM_diff"; |
|
2401 |
val LIM_const_not_eq = thm "LIM_const_not_eq"; |
|
2402 |
val LIM_const_eq = thm "LIM_const_eq"; |
|
2403 |
val LIM_unique = thm "LIM_unique"; |
|
2404 |
val LIM_mult_zero = thm "LIM_mult_zero"; |
|
2405 |
val LIM_self = thm "LIM_self"; |
|
2406 |
val LIM_equal = thm "LIM_equal"; |
|
2407 |
val LIM_trans = thm "LIM_trans"; |
|
2408 |
val LIM_NSLIM = thm "LIM_NSLIM"; |
|
2409 |
val NSLIM_LIM = thm "NSLIM_LIM"; |
|
2410 |
val LIM_NSLIM_iff = thm "LIM_NSLIM_iff"; |
|
2411 |
val NSLIM_mult = thm "NSLIM_mult"; |
|
2412 |
val LIM_mult2 = thm "LIM_mult2"; |
|
2413 |
val NSLIM_add = thm "NSLIM_add"; |
|
2414 |
val LIM_add2 = thm "LIM_add2"; |
|
2415 |
val NSLIM_const = thm "NSLIM_const"; |
|
2416 |
val LIM_const2 = thm "LIM_const2"; |
|
2417 |
val NSLIM_minus = thm "NSLIM_minus"; |
|
2418 |
val LIM_minus2 = thm "LIM_minus2"; |
|
2419 |
val NSLIM_add_minus = thm "NSLIM_add_minus"; |
|
2420 |
val LIM_add_minus2 = thm "LIM_add_minus2"; |
|
2421 |
val NSLIM_inverse = thm "NSLIM_inverse"; |
|
2422 |
val LIM_inverse = thm "LIM_inverse"; |
|
2423 |
val NSLIM_zero = thm "NSLIM_zero"; |
|
2424 |
val LIM_zero2 = thm "LIM_zero2"; |
|
2425 |
val NSLIM_zero_cancel = thm "NSLIM_zero_cancel"; |
|
2426 |
val LIM_zero_cancel = thm "LIM_zero_cancel"; |
|
2427 |
val NSLIM_not_zero = thm "NSLIM_not_zero"; |
|
2428 |
val NSLIM_const_not_eq = thm "NSLIM_const_not_eq"; |
|
2429 |
val NSLIM_const_eq = thm "NSLIM_const_eq"; |
|
2430 |
val NSLIM_unique = thm "NSLIM_unique"; |
|
2431 |
val LIM_unique2 = thm "LIM_unique2"; |
|
2432 |
val NSLIM_mult_zero = thm "NSLIM_mult_zero"; |
|
2433 |
val LIM_mult_zero2 = thm "LIM_mult_zero2"; |
|
2434 |
val NSLIM_self = thm "NSLIM_self"; |
|
2435 |
val isNSContD = thm "isNSContD"; |
|
2436 |
val isNSCont_NSLIM = thm "isNSCont_NSLIM"; |
|
2437 |
val NSLIM_isNSCont = thm "NSLIM_isNSCont"; |
|
2438 |
val isNSCont_NSLIM_iff = thm "isNSCont_NSLIM_iff"; |
|
2439 |
val isNSCont_LIM_iff = thm "isNSCont_LIM_iff"; |
|
2440 |
val isNSCont_isCont_iff = thm "isNSCont_isCont_iff"; |
|
2441 |
val isCont_isNSCont = thm "isCont_isNSCont"; |
|
2442 |
val isNSCont_isCont = thm "isNSCont_isCont"; |
|
2443 |
val NSLIM_h_iff = thm "NSLIM_h_iff"; |
|
2444 |
val NSLIM_isCont_iff = thm "NSLIM_isCont_iff"; |
|
2445 |
val LIM_isCont_iff = thm "LIM_isCont_iff"; |
|
2446 |
val isCont_iff = thm "isCont_iff"; |
|
2447 |
val isCont_add = thm "isCont_add"; |
|
2448 |
val isCont_mult = thm "isCont_mult"; |
|
2449 |
val isCont_o = thm "isCont_o"; |
|
2450 |
val isCont_o2 = thm "isCont_o2"; |
|
2451 |
val isNSCont_minus = thm "isNSCont_minus"; |
|
2452 |
val isCont_minus = thm "isCont_minus"; |
|
2453 |
val isCont_inverse = thm "isCont_inverse"; |
|
2454 |
val isNSCont_inverse = thm "isNSCont_inverse"; |
|
2455 |
val isCont_diff = thm "isCont_diff"; |
|
2456 |
val isCont_const = thm "isCont_const"; |
|
2457 |
val isNSCont_const = thm "isNSCont_const"; |
|
2458 |
val isNSUContD = thm "isNSUContD"; |
|
2459 |
val isUCont_isCont = thm "isUCont_isCont"; |
|
2460 |
val isUCont_isNSUCont = thm "isUCont_isNSUCont"; |
|
2461 |
val isNSUCont_isUCont = thm "isNSUCont_isUCont"; |
|
2462 |
val DERIV_iff = thm "DERIV_iff"; |
|
2463 |
val DERIV_NS_iff = thm "DERIV_NS_iff"; |
|
2464 |
val DERIV_D = thm "DERIV_D"; |
|
2465 |
val NS_DERIV_D = thm "NS_DERIV_D"; |
|
2466 |
val DERIV_unique = thm "DERIV_unique"; |
|
2467 |
val NSDeriv_unique = thm "NSDeriv_unique"; |
|
2468 |
val differentiableD = thm "differentiableD"; |
|
2469 |
val differentiableI = thm "differentiableI"; |
|
2470 |
val NSdifferentiableD = thm "NSdifferentiableD"; |
|
2471 |
val NSdifferentiableI = thm "NSdifferentiableI"; |
|
2472 |
val LIM_I = thm "LIM_I"; |
|
2473 |
val DERIV_LIM_iff = thm "DERIV_LIM_iff"; |
|
2474 |
val DERIV_iff2 = thm "DERIV_iff2"; |
|
2475 |
val NSDERIV_NSLIM_iff = thm "NSDERIV_NSLIM_iff"; |
|
2476 |
val NSDERIV_NSLIM_iff2 = thm "NSDERIV_NSLIM_iff2"; |
|
2477 |
val NSDERIV_iff2 = thm "NSDERIV_iff2"; |
|
2478 |
val hypreal_not_eq_minus_iff = thm "hypreal_not_eq_minus_iff"; |
|
2479 |
val NSDERIVD5 = thm "NSDERIVD5"; |
|
2480 |
val NSDERIVD4 = thm "NSDERIVD4"; |
|
2481 |
val NSDERIVD3 = thm "NSDERIVD3"; |
|
2482 |
val NSDERIV_DERIV_iff = thm "NSDERIV_DERIV_iff"; |
|
2483 |
val NSDERIV_isNSCont = thm "NSDERIV_isNSCont"; |
|
2484 |
val DERIV_isCont = thm "DERIV_isCont"; |
|
2485 |
val NSDERIV_const = thm "NSDERIV_const"; |
|
2486 |
val DERIV_const = thm "DERIV_const"; |
|
2487 |
val NSDERIV_add = thm "NSDERIV_add"; |
|
2488 |
val DERIV_add = thm "DERIV_add"; |
|
2489 |
val NSDERIV_mult = thm "NSDERIV_mult"; |
|
2490 |
val DERIV_mult = thm "DERIV_mult"; |
|
2491 |
val NSDERIV_cmult = thm "NSDERIV_cmult"; |
|
2492 |
val DERIV_cmult = thm "DERIV_cmult"; |
|
2493 |
val NSDERIV_minus = thm "NSDERIV_minus"; |
|
2494 |
val DERIV_minus = thm "DERIV_minus"; |
|
2495 |
val NSDERIV_add_minus = thm "NSDERIV_add_minus"; |
|
2496 |
val DERIV_add_minus = thm "DERIV_add_minus"; |
|
2497 |
val NSDERIV_diff = thm "NSDERIV_diff"; |
|
2498 |
val DERIV_diff = thm "DERIV_diff"; |
|
2499 |
val incrementI = thm "incrementI"; |
|
2500 |
val incrementI2 = thm "incrementI2"; |
|
2501 |
val increment_thm = thm "increment_thm"; |
|
2502 |
val increment_thm2 = thm "increment_thm2"; |
|
2503 |
val increment_approx_zero = thm "increment_approx_zero"; |
|
2504 |
val NSDERIV_zero = thm "NSDERIV_zero"; |
|
2505 |
val NSDERIV_approx = thm "NSDERIV_approx"; |
|
2506 |
val NSDERIVD1 = thm "NSDERIVD1"; |
|
2507 |
val NSDERIVD2 = thm "NSDERIVD2"; |
|
2508 |
val NSDERIV_chain = thm "NSDERIV_chain"; |
|
2509 |
val DERIV_chain = thm "DERIV_chain"; |
|
2510 |
val DERIV_chain2 = thm "DERIV_chain2"; |
|
2511 |
val NSDERIV_Id = thm "NSDERIV_Id"; |
|
2512 |
val DERIV_Id = thm "DERIV_Id"; |
|
2513 |
val isCont_Id = thms "isCont_Id"; |
|
2514 |
val DERIV_cmult_Id = thm "DERIV_cmult_Id"; |
|
2515 |
val NSDERIV_cmult_Id = thm "NSDERIV_cmult_Id"; |
|
2516 |
val DERIV_pow = thm "DERIV_pow"; |
|
2517 |
val NSDERIV_pow = thm "NSDERIV_pow"; |
|
2518 |
val NSDERIV_inverse = thm "NSDERIV_inverse"; |
|
2519 |
val DERIV_inverse = thm "DERIV_inverse"; |
|
2520 |
val DERIV_inverse_fun = thm "DERIV_inverse_fun"; |
|
2521 |
val NSDERIV_inverse_fun = thm "NSDERIV_inverse_fun"; |
|
2522 |
val DERIV_quotient = thm "DERIV_quotient"; |
|
2523 |
val NSDERIV_quotient = thm "NSDERIV_quotient"; |
|
2524 |
val CARAT_DERIV = thm "CARAT_DERIV"; |
|
2525 |
val CARAT_NSDERIV = thm "CARAT_NSDERIV"; |
|
2526 |
val hypreal_eq_minus_iff3 = thm "hypreal_eq_minus_iff3"; |
|
2527 |
val starfun_if_eq = thm "starfun_if_eq"; |
|
2528 |
val CARAT_DERIVD = thm "CARAT_DERIVD"; |
|
2529 |
val f_inc_g_dec_Beq_f = thm "f_inc_g_dec_Beq_f"; |
|
2530 |
val f_inc_g_dec_Beq_g = thm "f_inc_g_dec_Beq_g"; |
|
2531 |
val f_inc_imp_le_lim = thm "f_inc_imp_le_lim"; |
|
2532 |
val lim_uminus = thm "lim_uminus"; |
|
2533 |
val g_dec_imp_lim_le = thm "g_dec_imp_lim_le"; |
|
2534 |
val Bolzano_bisect_le = thm "Bolzano_bisect_le"; |
|
2535 |
val Bolzano_bisect_fst_le_Suc = thm "Bolzano_bisect_fst_le_Suc"; |
|
2536 |
val Bolzano_bisect_Suc_le_snd = thm "Bolzano_bisect_Suc_le_snd"; |
|
2537 |
val eq_divide_2_times_iff = thm "eq_divide_2_times_iff"; |
|
2538 |
val Bolzano_bisect_diff = thm "Bolzano_bisect_diff"; |
|
2539 |
val Bolzano_nest_unique = thms "Bolzano_nest_unique"; |
|
2540 |
val not_P_Bolzano_bisect = thm "not_P_Bolzano_bisect"; |
|
2541 |
val not_P_Bolzano_bisect = thm "not_P_Bolzano_bisect"; |
|
2542 |
val lemma_BOLZANO2 = thm "lemma_BOLZANO2"; |
|
2543 |
val IVT = thm "IVT"; |
|
2544 |
val IVT2 = thm "IVT2"; |
|
2545 |
val IVT_objl = thm "IVT_objl"; |
|
2546 |
val IVT2_objl = thm "IVT2_objl"; |
|
2547 |
val isCont_bounded = thm "isCont_bounded"; |
|
2548 |
val isCont_has_Ub = thm "isCont_has_Ub"; |
|
2549 |
val isCont_eq_Ub = thm "isCont_eq_Ub"; |
|
2550 |
val isCont_eq_Lb = thm "isCont_eq_Lb"; |
|
2551 |
val isCont_Lb_Ub = thm "isCont_Lb_Ub"; |
|
2552 |
val DERIV_left_inc = thm "DERIV_left_inc"; |
|
2553 |
val DERIV_left_dec = thm "DERIV_left_dec"; |
|
2554 |
val DERIV_local_max = thm "DERIV_local_max"; |
|
2555 |
val DERIV_local_min = thm "DERIV_local_min"; |
|
2556 |
val DERIV_local_const = thm "DERIV_local_const"; |
|
2557 |
val Rolle = thm "Rolle"; |
|
2558 |
val MVT = thm "MVT"; |
|
2559 |
val DERIV_isconst_end = thm "DERIV_isconst_end"; |
|
2560 |
val DERIV_isconst1 = thm "DERIV_isconst1"; |
|
2561 |
val DERIV_isconst2 = thm "DERIV_isconst2"; |
|
2562 |
val DERIV_isconst_all = thm "DERIV_isconst_all"; |
|
2563 |
val DERIV_const_ratio_const = thm "DERIV_const_ratio_const"; |
|
2564 |
val DERIV_const_ratio_const2 = thm "DERIV_const_ratio_const2"; |
|
2565 |
val real_average_minus_first = thm "real_average_minus_first"; |
|
2566 |
val real_average_minus_second = thm "real_average_minus_second"; |
|
2567 |
val DERIV_const_average = thm "DERIV_const_average"; |
|
2568 |
val isCont_inj_range = thm "isCont_inj_range"; |
|
2569 |
val isCont_inverse_function = thm "isCont_inverse_function"; |
|
2570 |
*} |
|
2571 |
||
10751 | 2572 |
|
2573 |
end |