| author | haftmann | 
| Mon, 07 Jun 2010 13:42:38 +0200 | |
| changeset 37384 | 5aba26803073 | 
| parent 36626 | 72d2cb5c3db9 | 
| child 37729 | daea77769276 | 
| permissions | -rw-r--r-- | 
| 21776 | 1 | (* Title : FrechetDeriv.thy | 
| 2 | Author : Brian Huffman | |
| 3 | *) | |
| 4 | ||
| 5 | header {* Frechet Derivative *}
 | |
| 6 | ||
| 7 | theory FrechetDeriv | |
| 30663 
0b6aff7451b2
Main is (Complex_Main) base entry point in library theories
 haftmann parents: 
30273diff
changeset | 8 | imports Lim Complex_Main | 
| 21776 | 9 | begin | 
| 10 | ||
| 11 | definition | |
| 12 | fderiv :: | |
| 13 | "['a::real_normed_vector \<Rightarrow> 'b::real_normed_vector, 'a, 'a \<Rightarrow> 'b] \<Rightarrow> bool" | |
| 14 |     -- {* Frechet derivative: D is derivative of function f at x *}
 | |
| 15 |           ("(FDERIV (_)/ (_)/ :> (_))" [1000, 1000, 60] 60) where
 | |
| 16 | "FDERIV f x :> D = (bounded_linear D \<and> | |
| 17 | (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0)" | |
| 18 | ||
| 19 | lemma FDERIV_I: | |
| 20 | "\<lbrakk>bounded_linear D; (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0\<rbrakk> | |
| 21 | \<Longrightarrow> FDERIV f x :> D" | |
| 22 | by (simp add: fderiv_def) | |
| 23 | ||
| 24 | lemma FDERIV_D: | |
| 25 | "FDERIV f x :> D \<Longrightarrow> (\<lambda>h. norm (f (x + h) - f x - D h) / norm h) -- 0 --> 0" | |
| 26 | by (simp add: fderiv_def) | |
| 27 | ||
| 28 | lemma FDERIV_bounded_linear: "FDERIV f x :> D \<Longrightarrow> bounded_linear D" | |
| 29 | by (simp add: fderiv_def) | |
| 30 | ||
| 31 | lemma bounded_linear_zero: | |
| 32 | "bounded_linear (\<lambda>x::'a::real_normed_vector. 0::'b::real_normed_vector)" | |
| 28823 | 33 | proof | 
| 21776 | 34 | show "(0::'b) = 0 + 0" by simp | 
| 35 | fix r show "(0::'b) = scaleR r 0" by simp | |
| 36 | have "\<forall>x::'a. norm (0::'b) \<le> norm x * 0" by simp | |
| 37 | thus "\<exists>K. \<forall>x::'a. norm (0::'b) \<le> norm x * K" .. | |
| 38 | qed | |
| 39 | ||
| 40 | lemma FDERIV_const: "FDERIV (\<lambda>x. k) x :> (\<lambda>h. 0)" | |
| 41 | by (simp add: fderiv_def bounded_linear_zero) | |
| 42 | ||
| 43 | lemma bounded_linear_ident: | |
| 44 | "bounded_linear (\<lambda>x::'a::real_normed_vector. x)" | |
| 28823 | 45 | proof | 
| 21776 | 46 | fix x y :: 'a show "x + y = x + y" by simp | 
| 47 | fix r and x :: 'a show "scaleR r x = scaleR r x" by simp | |
| 48 | have "\<forall>x::'a. norm x \<le> norm x * 1" by simp | |
| 49 | thus "\<exists>K. \<forall>x::'a. norm x \<le> norm x * K" .. | |
| 50 | qed | |
| 51 | ||
| 52 | lemma FDERIV_ident: "FDERIV (\<lambda>x. x) x :> (\<lambda>h. h)" | |
| 53 | by (simp add: fderiv_def bounded_linear_ident) | |
| 54 | ||
| 55 | subsection {* Addition *}
 | |
| 56 | ||
| 57 | lemma bounded_linear_add: | |
| 27611 | 58 | assumes "bounded_linear f" | 
| 59 | assumes "bounded_linear g" | |
| 21776 | 60 | shows "bounded_linear (\<lambda>x. f x + g x)" | 
| 27611 | 61 | proof - | 
| 29233 | 62 | interpret f: bounded_linear f by fact | 
| 63 | interpret g: bounded_linear g by fact | |
| 27611 | 64 | show ?thesis apply (unfold_locales) | 
| 65 | apply (simp only: f.add g.add add_ac) | |
| 66 | apply (simp only: f.scaleR g.scaleR scaleR_right_distrib) | |
| 67 | apply (rule f.pos_bounded [THEN exE], rename_tac Kf) | |
| 68 | apply (rule g.pos_bounded [THEN exE], rename_tac Kg) | |
| 69 | apply (rule_tac x="Kf + Kg" in exI, safe) | |
| 70 | apply (subst right_distrib) | |
| 71 | apply (rule order_trans [OF norm_triangle_ineq]) | |
| 72 | apply (rule add_mono, erule spec, erule spec) | |
| 73 | done | |
| 74 | qed | |
| 21776 | 75 | |
| 76 | lemma norm_ratio_ineq: | |
| 77 | fixes x y :: "'a::real_normed_vector" | |
| 78 | fixes h :: "'b::real_normed_vector" | |
| 79 | shows "norm (x + y) / norm h \<le> norm x / norm h + norm y / norm h" | |
| 80 | apply (rule ord_le_eq_trans) | |
| 81 | apply (rule divide_right_mono) | |
| 82 | apply (rule norm_triangle_ineq) | |
| 83 | apply (rule norm_ge_zero) | |
| 84 | apply (rule add_divide_distrib) | |
| 85 | done | |
| 86 | ||
| 87 | lemma FDERIV_add: | |
| 88 | assumes f: "FDERIV f x :> F" | |
| 89 | assumes g: "FDERIV g x :> G" | |
| 90 | shows "FDERIV (\<lambda>x. f x + g x) x :> (\<lambda>h. F h + G h)" | |
| 91 | proof (rule FDERIV_I) | |
| 92 | show "bounded_linear (\<lambda>h. F h + G h)" | |
| 93 | apply (rule bounded_linear_add) | |
| 94 | apply (rule FDERIV_bounded_linear [OF f]) | |
| 95 | apply (rule FDERIV_bounded_linear [OF g]) | |
| 96 | done | |
| 97 | next | |
| 98 | have f': "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h) -- 0 --> 0" | |
| 99 | using f by (rule FDERIV_D) | |
| 100 | have g': "(\<lambda>h. norm (g (x + h) - g x - G h) / norm h) -- 0 --> 0" | |
| 101 | using g by (rule FDERIV_D) | |
| 102 | from f' g' | |
| 103 | have "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h | |
| 104 | + norm (g (x + h) - g x - G h) / norm h) -- 0 --> 0" | |
| 105 | by (rule LIM_add_zero) | |
| 106 | thus "(\<lambda>h. norm (f (x + h) + g (x + h) - (f x + g x) - (F h + G h)) | |
| 107 | / norm h) -- 0 --> 0" | |
| 108 | apply (rule real_LIM_sandwich_zero) | |
| 109 | apply (simp add: divide_nonneg_pos) | |
| 110 | apply (simp only: add_diff_add) | |
| 111 | apply (rule norm_ratio_ineq) | |
| 112 | done | |
| 113 | qed | |
| 114 | ||
| 115 | subsection {* Subtraction *}
 | |
| 116 | ||
| 117 | lemma bounded_linear_minus: | |
| 27611 | 118 | assumes "bounded_linear f" | 
| 21776 | 119 | shows "bounded_linear (\<lambda>x. - f x)" | 
| 27611 | 120 | proof - | 
| 29233 | 121 | interpret f: bounded_linear f by fact | 
| 27611 | 122 | show ?thesis apply (unfold_locales) | 
| 123 | apply (simp add: f.add) | |
| 124 | apply (simp add: f.scaleR) | |
| 125 | apply (simp add: f.bounded) | |
| 126 | done | |
| 127 | qed | |
| 21776 | 128 | |
| 129 | lemma FDERIV_minus: | |
| 130 | "FDERIV f x :> F \<Longrightarrow> FDERIV (\<lambda>x. - f x) x :> (\<lambda>h. - F h)" | |
| 131 | apply (rule FDERIV_I) | |
| 132 | apply (rule bounded_linear_minus) | |
| 133 | apply (erule FDERIV_bounded_linear) | |
| 134 | apply (simp only: fderiv_def minus_diff_minus norm_minus_cancel) | |
| 135 | done | |
| 136 | ||
| 137 | lemma FDERIV_diff: | |
| 138 | "\<lbrakk>FDERIV f x :> F; FDERIV g x :> G\<rbrakk> | |
| 139 | \<Longrightarrow> FDERIV (\<lambda>x. f x - g x) x :> (\<lambda>h. F h - G h)" | |
| 140 | by (simp only: diff_minus FDERIV_add FDERIV_minus) | |
| 141 | ||
| 142 | subsection {* Continuity *}
 | |
| 143 | ||
| 144 | lemma FDERIV_isCont: | |
| 145 | assumes f: "FDERIV f x :> F" | |
| 146 | shows "isCont f x" | |
| 147 | proof - | |
| 29233 | 148 | from f interpret F: bounded_linear "F" by (rule FDERIV_bounded_linear) | 
| 21776 | 149 | have "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h) -- 0 --> 0" | 
| 150 | by (rule FDERIV_D [OF f]) | |
| 151 | hence "(\<lambda>h. norm (f (x + h) - f x - F h) / norm h * norm h) -- 0 --> 0" | |
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 152 | by (intro LIM_mult_zero LIM_norm_zero LIM_ident) | 
| 21776 | 153 | hence "(\<lambda>h. norm (f (x + h) - f x - F h)) -- 0 --> 0" | 
| 154 | by (simp cong: LIM_cong) | |
| 155 | hence "(\<lambda>h. f (x + h) - f x - F h) -- 0 --> 0" | |
| 156 | by (rule LIM_norm_zero_cancel) | |
| 157 | hence "(\<lambda>h. f (x + h) - f x - F h + F h) -- 0 --> 0" | |
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 158 | by (intro LIM_add_zero F.LIM_zero LIM_ident) | 
| 21776 | 159 | hence "(\<lambda>h. f (x + h) - f x) -- 0 --> 0" | 
| 160 | by simp | |
| 161 | thus "isCont f x" | |
| 162 | unfolding isCont_iff by (rule LIM_zero_cancel) | |
| 163 | qed | |
| 164 | ||
| 165 | subsection {* Composition *}
 | |
| 166 | ||
| 167 | lemma real_divide_cancel_lemma: | |
| 168 | fixes a b c :: real | |
| 169 | shows "(b = 0 \<Longrightarrow> a = 0) \<Longrightarrow> (a / b) * (b / c) = a / c" | |
| 170 | by simp | |
| 171 | ||
| 172 | lemma bounded_linear_compose: | |
| 27611 | 173 | assumes "bounded_linear f" | 
| 174 | assumes "bounded_linear g" | |
| 21776 | 175 | shows "bounded_linear (\<lambda>x. f (g x))" | 
| 27611 | 176 | proof - | 
| 29233 | 177 | interpret f: bounded_linear f by fact | 
| 178 | interpret g: bounded_linear g by fact | |
| 27611 | 179 | show ?thesis proof (unfold_locales) | 
| 180 | fix x y show "f (g (x + y)) = f (g x) + f (g y)" | |
| 181 | by (simp only: f.add g.add) | |
| 182 | next | |
| 183 | fix r x show "f (g (scaleR r x)) = scaleR r (f (g x))" | |
| 184 | by (simp only: f.scaleR g.scaleR) | |
| 185 | next | |
| 186 | from f.pos_bounded | |
| 187 | obtain Kf where f: "\<And>x. norm (f x) \<le> norm x * Kf" and Kf: "0 < Kf" by fast | |
| 188 | from g.pos_bounded | |
| 189 | obtain Kg where g: "\<And>x. norm (g x) \<le> norm x * Kg" by fast | |
| 190 | show "\<exists>K. \<forall>x. norm (f (g x)) \<le> norm x * K" | |
| 191 | proof (intro exI allI) | |
| 192 | fix x | |
| 193 | have "norm (f (g x)) \<le> norm (g x) * Kf" | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
31021diff
changeset | 194 | using f . | 
| 27611 | 195 | also have "\<dots> \<le> (norm x * Kg) * Kf" | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
31021diff
changeset | 196 | using g Kf [THEN order_less_imp_le] by (rule mult_right_mono) | 
| 27611 | 197 | also have "(norm x * Kg) * Kf = norm x * (Kg * Kf)" | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
31021diff
changeset | 198 | by (rule mult_assoc) | 
| 27611 | 199 | finally show "norm (f (g x)) \<le> norm x * (Kg * Kf)" . | 
| 200 | qed | |
| 21776 | 201 | qed | 
| 202 | qed | |
| 203 | ||
| 204 | lemma FDERIV_compose: | |
| 205 | fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" | |
| 206 | fixes g :: "'b::real_normed_vector \<Rightarrow> 'c::real_normed_vector" | |
| 207 | assumes f: "FDERIV f x :> F" | |
| 208 | assumes g: "FDERIV g (f x) :> G" | |
| 209 | shows "FDERIV (\<lambda>x. g (f x)) x :> (\<lambda>h. G (F h))" | |
| 210 | proof (rule FDERIV_I) | |
| 211 | from FDERIV_bounded_linear [OF g] FDERIV_bounded_linear [OF f] | |
| 212 | show "bounded_linear (\<lambda>h. G (F h))" | |
| 213 | by (rule bounded_linear_compose) | |
| 214 | next | |
| 215 | let ?Rf = "\<lambda>h. f (x + h) - f x - F h" | |
| 216 | let ?Rg = "\<lambda>k. g (f x + k) - g (f x) - G k" | |
| 217 | let ?k = "\<lambda>h. f (x + h) - f x" | |
| 218 | let ?Nf = "\<lambda>h. norm (?Rf h) / norm h" | |
| 219 | let ?Ng = "\<lambda>h. norm (?Rg (?k h)) / norm (?k h)" | |
| 30729 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
30663diff
changeset | 220 | from f interpret F: bounded_linear "F" by (rule FDERIV_bounded_linear) | 
| 
461ee3e49ad3
interpretation/interpret: prefixes are mandatory by default;
 wenzelm parents: 
30663diff
changeset | 221 | from g interpret G: bounded_linear "G" by (rule FDERIV_bounded_linear) | 
| 21776 | 222 | from F.bounded obtain kF where kF: "\<And>x. norm (F x) \<le> norm x * kF" by fast | 
| 223 | from G.bounded obtain kG where kG: "\<And>x. norm (G x) \<le> norm x * kG" by fast | |
| 224 | ||
| 225 | let ?fun2 = "\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF)" | |
| 226 | ||
| 227 | show "(\<lambda>h. norm (g (f (x + h)) - g (f x) - G (F h)) / norm h) -- 0 --> 0" | |
| 228 | proof (rule real_LIM_sandwich_zero) | |
| 229 | have Nf: "?Nf -- 0 --> 0" | |
| 230 | using FDERIV_D [OF f] . | |
| 231 | ||
| 232 | have Ng1: "isCont (\<lambda>k. norm (?Rg k) / norm k) 0" | |
| 233 | by (simp add: isCont_def FDERIV_D [OF g]) | |
| 234 | have Ng2: "?k -- 0 --> 0" | |
| 235 | apply (rule LIM_zero) | |
| 236 | apply (fold isCont_iff) | |
| 237 | apply (rule FDERIV_isCont [OF f]) | |
| 238 | done | |
| 239 | have Ng: "?Ng -- 0 --> 0" | |
| 240 | using isCont_LIM_compose [OF Ng1 Ng2] by simp | |
| 241 | ||
| 242 | have "(\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF)) | |
| 243 | -- 0 --> 0 * kG + 0 * (0 + kF)" | |
| 244 | by (intro LIM_add LIM_mult LIM_const Nf Ng) | |
| 245 | thus "(\<lambda>h. ?Nf h * kG + ?Ng h * (?Nf h + kF)) -- 0 --> 0" | |
| 246 | by simp | |
| 247 | next | |
| 248 | fix h::'a assume h: "h \<noteq> 0" | |
| 249 | thus "0 \<le> norm (g (f (x + h)) - g (f x) - G (F h)) / norm h" | |
| 250 | by (simp add: divide_nonneg_pos) | |
| 251 | next | |
| 252 | fix h::'a assume h: "h \<noteq> 0" | |
| 253 | have "g (f (x + h)) - g (f x) - G (F h) = G (?Rf h) + ?Rg (?k h)" | |
| 254 | by (simp add: G.diff) | |
| 255 | hence "norm (g (f (x + h)) - g (f x) - G (F h)) / norm h | |
| 256 | = norm (G (?Rf h) + ?Rg (?k h)) / norm h" | |
| 257 | by (rule arg_cong) | |
| 258 | also have "\<dots> \<le> norm (G (?Rf h)) / norm h + norm (?Rg (?k h)) / norm h" | |
| 259 | by (rule norm_ratio_ineq) | |
| 260 | also have "\<dots> \<le> ?Nf h * kG + ?Ng h * (?Nf h + kF)" | |
| 261 | proof (rule add_mono) | |
| 262 | show "norm (G (?Rf h)) / norm h \<le> ?Nf h * kG" | |
| 263 | apply (rule ord_le_eq_trans) | |
| 264 | apply (rule divide_right_mono [OF kG norm_ge_zero]) | |
| 265 | apply simp | |
| 266 | done | |
| 267 | next | |
| 268 | have "norm (?Rg (?k h)) / norm h = ?Ng h * (norm (?k h) / norm h)" | |
| 269 | apply (rule real_divide_cancel_lemma [symmetric]) | |
| 270 | apply (simp add: G.zero) | |
| 271 | done | |
| 272 | also have "\<dots> \<le> ?Ng h * (?Nf h + kF)" | |
| 273 | proof (rule mult_left_mono) | |
| 274 | have "norm (?k h) / norm h = norm (?Rf h + F h) / norm h" | |
| 275 | by simp | |
| 276 | also have "\<dots> \<le> ?Nf h + norm (F h) / norm h" | |
| 277 | by (rule norm_ratio_ineq) | |
| 278 | also have "\<dots> \<le> ?Nf h + kF" | |
| 279 | apply (rule add_left_mono) | |
| 280 | apply (subst pos_divide_le_eq, simp add: h) | |
| 281 | apply (subst mult_commute) | |
| 282 | apply (rule kF) | |
| 283 | done | |
| 284 | finally show "norm (?k h) / norm h \<le> ?Nf h + kF" . | |
| 285 | next | |
| 286 | show "0 \<le> ?Ng h" | |
| 287 | apply (case_tac "f (x + h) - f x = 0", simp) | |
| 288 | apply (rule divide_nonneg_pos [OF norm_ge_zero]) | |
| 289 | apply simp | |
| 290 | done | |
| 291 | qed | |
| 292 | finally show "norm (?Rg (?k h)) / norm h \<le> ?Ng h * (?Nf h + kF)" . | |
| 293 | qed | |
| 294 | finally show "norm (g (f (x + h)) - g (f x) - G (F h)) / norm h | |
| 295 | \<le> ?Nf h * kG + ?Ng h * (?Nf h + kF)" . | |
| 296 | qed | |
| 297 | qed | |
| 298 | ||
| 299 | subsection {* Product Rule *}
 | |
| 300 | ||
| 301 | lemma (in bounded_bilinear) FDERIV_lemma: | |
| 302 | "a' ** b' - a ** b - (a ** B + A ** b) | |
| 303 | = a ** (b' - b - B) + (a' - a - A) ** b' + A ** (b' - b)" | |
| 304 | by (simp add: diff_left diff_right) | |
| 305 | ||
| 306 | lemma (in bounded_bilinear) FDERIV: | |
| 307 | fixes x :: "'d::real_normed_vector" | |
| 308 | assumes f: "FDERIV f x :> F" | |
| 309 | assumes g: "FDERIV g x :> G" | |
| 310 | shows "FDERIV (\<lambda>x. f x ** g x) x :> (\<lambda>h. f x ** G h + F h ** g x)" | |
| 311 | proof (rule FDERIV_I) | |
| 312 | show "bounded_linear (\<lambda>h. f x ** G h + F h ** g x)" | |
| 313 | apply (rule bounded_linear_add) | |
| 314 | apply (rule bounded_linear_compose [OF bounded_linear_right]) | |
| 315 | apply (rule FDERIV_bounded_linear [OF g]) | |
| 316 | apply (rule bounded_linear_compose [OF bounded_linear_left]) | |
| 317 | apply (rule FDERIV_bounded_linear [OF f]) | |
| 318 | done | |
| 319 | next | |
| 320 | from bounded_linear.bounded [OF FDERIV_bounded_linear [OF f]] | |
| 321 | obtain KF where norm_F: "\<And>x. norm (F x) \<le> norm x * KF" by fast | |
| 322 | ||
| 323 | from pos_bounded obtain K where K: "0 < K" and norm_prod: | |
| 324 | "\<And>a b. norm (a ** b) \<le> norm a * norm b * K" by fast | |
| 325 | ||
| 326 | let ?Rf = "\<lambda>h. f (x + h) - f x - F h" | |
| 327 | let ?Rg = "\<lambda>h. g (x + h) - g x - G h" | |
| 328 | ||
| 329 | let ?fun1 = "\<lambda>h. | |
| 330 | norm (f x ** ?Rg h + ?Rf h ** g (x + h) + F h ** (g (x + h) - g x)) / | |
| 331 | norm h" | |
| 332 | ||
| 333 | let ?fun2 = "\<lambda>h. | |
| 334 | norm (f x) * (norm (?Rg h) / norm h) * K + | |
| 335 | norm (?Rf h) / norm h * norm (g (x + h)) * K + | |
| 336 | KF * norm (g (x + h) - g x) * K" | |
| 337 | ||
| 338 | have "?fun1 -- 0 --> 0" | |
| 339 | proof (rule real_LIM_sandwich_zero) | |
| 340 | from f g isCont_iff [THEN iffD1, OF FDERIV_isCont [OF g]] | |
| 341 | have "?fun2 -- 0 --> | |
| 342 | norm (f x) * 0 * K + 0 * norm (g x) * K + KF * norm (0::'b) * K" | |
| 343 | by (intro LIM_add LIM_mult LIM_const LIM_norm LIM_zero FDERIV_D) | |
| 344 | thus "?fun2 -- 0 --> 0" | |
| 345 | by simp | |
| 346 | next | |
| 347 | fix h::'d assume "h \<noteq> 0" | |
| 348 | thus "0 \<le> ?fun1 h" | |
| 349 | by (simp add: divide_nonneg_pos) | |
| 350 | next | |
| 351 | fix h::'d assume "h \<noteq> 0" | |
| 352 | have "?fun1 h \<le> (norm (f x) * norm (?Rg h) * K + | |
| 353 | norm (?Rf h) * norm (g (x + h)) * K + | |
| 354 | norm h * KF * norm (g (x + h) - g x) * K) / norm h" | |
| 355 | by (intro | |
| 356 | divide_right_mono mult_mono' | |
| 357 | order_trans [OF norm_triangle_ineq add_mono] | |
| 358 | order_trans [OF norm_prod mult_right_mono] | |
| 359 | mult_nonneg_nonneg order_refl norm_ge_zero norm_F | |
| 360 | K [THEN order_less_imp_le] | |
| 361 | ) | |
| 362 | also have "\<dots> = ?fun2 h" | |
| 363 | by (simp add: add_divide_distrib) | |
| 364 | finally show "?fun1 h \<le> ?fun2 h" . | |
| 365 | qed | |
| 366 | thus "(\<lambda>h. | |
| 367 | norm (f (x + h) ** g (x + h) - f x ** g x - (f x ** G h + F h ** g x)) | |
| 368 | / norm h) -- 0 --> 0" | |
| 369 | by (simp only: FDERIV_lemma) | |
| 370 | qed | |
| 371 | ||
| 29233 | 372 | lemmas FDERIV_mult = mult.FDERIV | 
| 21776 | 373 | |
| 29233 | 374 | lemmas FDERIV_scaleR = scaleR.FDERIV | 
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 375 | |
| 21776 | 376 | |
| 377 | subsection {* Powers *}
 | |
| 378 | ||
| 379 | lemma FDERIV_power_Suc: | |
| 31021 | 380 |   fixes x :: "'a::{real_normed_algebra,comm_ring_1}"
 | 
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 381 | shows "FDERIV (\<lambda>x. x ^ Suc n) x :> (\<lambda>h. (1 + of_nat n) * x ^ n * h)" | 
| 21776 | 382 | apply (induct n) | 
| 36361 | 383 | apply (simp add: FDERIV_ident) | 
| 21776 | 384 | apply (drule FDERIV_mult [OF FDERIV_ident]) | 
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 385 | apply (simp only: of_nat_Suc left_distrib mult_1_left) | 
| 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 386 | apply (simp only: power_Suc right_distrib add_ac mult_ac) | 
| 21776 | 387 | done | 
| 388 | ||
| 389 | lemma FDERIV_power: | |
| 31021 | 390 |   fixes x :: "'a::{real_normed_algebra,comm_ring_1}"
 | 
| 21776 | 391 | shows "FDERIV (\<lambda>x. x ^ n) x :> (\<lambda>h. of_nat n * x ^ (n - 1) * h)" | 
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 392 | apply (cases n) | 
| 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 393 | apply (simp add: FDERIV_const) | 
| 30273 
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
 huffman parents: 
29986diff
changeset | 394 | apply (simp add: FDERIV_power_Suc del: power_Suc) | 
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 395 | done | 
| 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 396 | |
| 21776 | 397 | |
| 398 | subsection {* Inverse *}
 | |
| 399 | ||
| 400 | lemmas bounded_linear_mult_const = | |
| 29233 | 401 | mult.bounded_linear_left [THEN bounded_linear_compose] | 
| 21776 | 402 | |
| 403 | lemmas bounded_linear_const_mult = | |
| 29233 | 404 | mult.bounded_linear_right [THEN bounded_linear_compose] | 
| 21776 | 405 | |
| 406 | lemma FDERIV_inverse: | |
| 407 | fixes x :: "'a::real_normed_div_algebra" | |
| 408 | assumes x: "x \<noteq> 0" | |
| 409 | shows "FDERIV inverse x :> (\<lambda>h. - (inverse x * h * inverse x))" | |
| 410 | (is "FDERIV ?inv _ :> _") | |
| 411 | proof (rule FDERIV_I) | |
| 412 | show "bounded_linear (\<lambda>h. - (?inv x * h * ?inv x))" | |
| 413 | apply (rule bounded_linear_minus) | |
| 414 | apply (rule bounded_linear_mult_const) | |
| 415 | apply (rule bounded_linear_const_mult) | |
| 416 | apply (rule bounded_linear_ident) | |
| 417 | done | |
| 418 | next | |
| 419 | show "(\<lambda>h. norm (?inv (x + h) - ?inv x - - (?inv x * h * ?inv x)) / norm h) | |
| 420 | -- 0 --> 0" | |
| 421 | proof (rule LIM_equal2) | |
| 422 | show "0 < norm x" using x by simp | |
| 423 | next | |
| 424 | fix h::'a | |
| 425 | assume 1: "h \<noteq> 0" | |
| 426 | assume "norm (h - 0) < norm x" | |
| 427 | hence "h \<noteq> -x" by clarsimp | |
| 428 | hence 2: "x + h \<noteq> 0" | |
| 429 | apply (rule contrapos_nn) | |
| 430 | apply (rule sym) | |
| 34146 
14595e0c27e8
rename equals_zero_I to minus_unique (keep old name too)
 huffman parents: 
32960diff
changeset | 431 | apply (erule minus_unique) | 
| 21776 | 432 | done | 
| 433 | show "norm (?inv (x + h) - ?inv x - - (?inv x * h * ?inv x)) / norm h | |
| 434 | = norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h" | |
| 435 | apply (subst inverse_diff_inverse [OF 2 x]) | |
| 436 | apply (subst minus_diff_minus) | |
| 437 | apply (subst norm_minus_cancel) | |
| 438 | apply (simp add: left_diff_distrib) | |
| 439 | done | |
| 440 | next | |
| 441 | show "(\<lambda>h. norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h) | |
| 442 | -- 0 --> 0" | |
| 443 | proof (rule real_LIM_sandwich_zero) | |
| 444 | show "(\<lambda>h. norm (?inv (x + h) - ?inv x) * norm (?inv x)) | |
| 445 | -- 0 --> 0" | |
| 446 | apply (rule LIM_mult_left_zero) | |
| 447 | apply (rule LIM_norm_zero) | |
| 448 | apply (rule LIM_zero) | |
| 449 | apply (rule LIM_offset_zero) | |
| 450 | apply (rule LIM_inverse) | |
| 28866 
30cd9d89a0fb
reactivated some dead theories (based on hints by Mark Hillebrand);
 wenzelm parents: 
28823diff
changeset | 451 | apply (rule LIM_ident) | 
| 21776 | 452 | apply (rule x) | 
| 453 | done | |
| 454 | next | |
| 455 | fix h::'a assume h: "h \<noteq> 0" | |
| 456 | show "0 \<le> norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h" | |
| 457 | apply (rule divide_nonneg_pos) | |
| 458 | apply (rule norm_ge_zero) | |
| 459 | apply (simp add: h) | |
| 460 | done | |
| 461 | next | |
| 462 | fix h::'a assume h: "h \<noteq> 0" | |
| 463 | have "norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h | |
| 464 | \<le> norm (?inv (x + h) - ?inv x) * norm h * norm (?inv x) / norm h" | |
| 465 | apply (rule divide_right_mono [OF _ norm_ge_zero]) | |
| 466 | apply (rule order_trans [OF norm_mult_ineq]) | |
| 467 | apply (rule mult_right_mono [OF _ norm_ge_zero]) | |
| 468 | apply (rule norm_mult_ineq) | |
| 469 | done | |
| 470 | also have "\<dots> = norm (?inv (x + h) - ?inv x) * norm (?inv x)" | |
| 471 | by simp | |
| 472 | finally show "norm ((?inv (x + h) - ?inv x) * h * ?inv x) / norm h | |
| 473 | \<le> norm (?inv (x + h) - ?inv x) * norm (?inv x)" . | |
| 474 | qed | |
| 475 | qed | |
| 476 | qed | |
| 477 | ||
| 478 | subsection {* Alternate definition *}
 | |
| 479 | ||
| 480 | lemma field_fderiv_def: | |
| 481 | fixes x :: "'a::real_normed_field" shows | |
| 482 | "FDERIV f x :> (\<lambda>h. h * D) = (\<lambda>h. (f (x + h) - f x) / h) -- 0 --> D" | |
| 483 | apply (unfold fderiv_def) | |
| 29233 | 484 | apply (simp add: mult.bounded_linear_left) | 
| 21776 | 485 | apply (simp cong: LIM_cong add: nonzero_norm_divide [symmetric]) | 
| 486 | apply (subst diff_divide_distrib) | |
| 487 | apply (subst times_divide_eq_left [symmetric]) | |
| 23398 | 488 | apply (simp cong: LIM_cong) | 
| 21776 | 489 | apply (simp add: LIM_norm_zero_iff LIM_zero_iff) | 
| 490 | done | |
| 491 | ||
| 492 | end |