217 and "x \<in> s" |
217 and "x \<in> s" |
218 and "\<And>x'. \<lbrakk>x'\<in>s; dist x' x < d\<rbrakk> \<Longrightarrow> f x' = g x'" |
218 and "\<And>x'. \<lbrakk>x'\<in>s; dist x' x < d\<rbrakk> \<Longrightarrow> f x' = g x'" |
219 shows "g differentiable (at x within s)" |
219 shows "g differentiable (at x within s)" |
220 using assms has_derivative_transform_within unfolding differentiable_def |
220 using assms has_derivative_transform_within unfolding differentiable_def |
221 by blast |
221 by blast |
|
222 |
|
223 lemma differentiable_on_ident [simp, derivative_intros]: "(\<lambda>x. x) differentiable_on S" |
|
224 by (simp add: differentiable_at_imp_differentiable_on) |
|
225 |
|
226 lemma differentiable_on_id [simp, derivative_intros]: "id differentiable_on S" |
|
227 by (simp add: id_def) |
|
228 |
|
229 lemma differentiable_on_compose: |
|
230 "\<lbrakk>g differentiable_on S; f differentiable_on (g ` S)\<rbrakk> \<Longrightarrow> (\<lambda>x. f (g x)) differentiable_on S" |
|
231 by (simp add: differentiable_in_compose differentiable_on_def) |
|
232 |
|
233 lemma bounded_linear_imp_differentiable_on: "bounded_linear f \<Longrightarrow> f differentiable_on S" |
|
234 by (simp add: differentiable_on_def bounded_linear_imp_differentiable) |
|
235 |
|
236 lemma linear_imp_differentiable_on: |
|
237 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
|
238 shows "linear f \<Longrightarrow> f differentiable_on S" |
|
239 by (simp add: differentiable_on_def linear_imp_differentiable) |
|
240 |
|
241 lemma differentiable_on_minus [simp, derivative_intros]: |
|
242 "f differentiable_on S \<Longrightarrow> (\<lambda>z. -(f z)) differentiable_on S" |
|
243 by (simp add: differentiable_on_def) |
|
244 |
|
245 lemma differentiable_on_add [simp, derivative_intros]: |
|
246 "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z + g z) differentiable_on S" |
|
247 by (simp add: differentiable_on_def) |
|
248 |
|
249 lemma differentiable_on_diff [simp, derivative_intros]: |
|
250 "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>z. f z - g z) differentiable_on S" |
|
251 by (simp add: differentiable_on_def) |
|
252 |
|
253 lemma differentiable_on_inverse [simp, derivative_intros]: |
|
254 fixes f :: "'a :: real_normed_vector \<Rightarrow> 'b :: real_normed_field" |
|
255 shows "f differentiable_on S \<Longrightarrow> (\<And>x. x \<in> S \<Longrightarrow> f x \<noteq> 0) \<Longrightarrow> (\<lambda>x. inverse (f x)) differentiable_on S" |
|
256 by (simp add: differentiable_on_def) |
|
257 |
|
258 lemma differentiable_on_scaleR [derivative_intros, simp]: |
|
259 "\<lbrakk>f differentiable_on S; g differentiable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. f x *\<^sub>R g x) differentiable_on S" |
|
260 unfolding differentiable_on_def |
|
261 by (blast intro: differentiable_scaleR) |
|
262 |
|
263 lemma has_derivative_sqnorm_at [derivative_intros, simp]: |
|
264 "((\<lambda>x. (norm x)\<^sup>2) has_derivative (\<lambda>x. 2 *\<^sub>R (a \<bullet> x))) (at a)" |
|
265 using has_derivative_bilinear_at [of id id a id id "op \<bullet>"] |
|
266 by (auto simp: inner_commute dot_square_norm bounded_bilinear_inner) |
|
267 |
|
268 lemma differentiable_sqnorm_at [derivative_intros, simp]: |
|
269 fixes a :: "'a :: {real_normed_vector,real_inner}" |
|
270 shows "(\<lambda>x. (norm x)\<^sup>2) differentiable (at a)" |
|
271 by (force simp add: differentiable_def intro: has_derivative_sqnorm_at) |
|
272 |
|
273 lemma differentiable_on_sqnorm [derivative_intros, simp]: |
|
274 fixes S :: "'a :: {real_normed_vector,real_inner} set" |
|
275 shows "(\<lambda>x. (norm x)\<^sup>2) differentiable_on S" |
|
276 by (simp add: differentiable_at_imp_differentiable_on) |
|
277 |
|
278 lemma differentiable_norm_at [derivative_intros, simp]: |
|
279 fixes a :: "'a :: {real_normed_vector,real_inner}" |
|
280 shows "a \<noteq> 0 \<Longrightarrow> norm differentiable (at a)" |
|
281 using differentiableI has_derivative_norm by blast |
|
282 |
|
283 lemma differentiable_on_norm [derivative_intros, simp]: |
|
284 fixes S :: "'a :: {real_normed_vector,real_inner} set" |
|
285 shows "0 \<notin> S \<Longrightarrow> norm differentiable_on S" |
|
286 by (metis differentiable_at_imp_differentiable_on differentiable_norm_at) |
222 |
287 |
223 |
288 |
224 subsection \<open>Frechet derivative and Jacobian matrix\<close> |
289 subsection \<open>Frechet derivative and Jacobian matrix\<close> |
225 |
290 |
226 definition "frechet_derivative f net = (SOME f'. (f has_derivative f') net)" |
291 definition "frechet_derivative f net = (SOME f'. (f has_derivative f') net)" |
1073 bounded_linear.has_derivative[OF has_derivative_bounded_linear, OF f']) |
1138 bounded_linear.has_derivative[OF has_derivative_bounded_linear, OF f']) |
1074 from B have B: "\<forall>x\<in>{0..1}. onorm (\<lambda>i. f' (a + x *\<^sub>R (b - a)) i - f' x0 i) \<le> B" |
1139 from B have B: "\<forall>x\<in>{0..1}. onorm (\<lambda>i. f' (a + x *\<^sub>R (b - a)) i - f' x0 i) \<le> B" |
1075 using assms by (auto simp: fun_diff_def) |
1140 using assms by (auto simp: fun_diff_def) |
1076 from differentiable_bound_segment[OF assms(1) g B] \<open>x0 \<in> S\<close> |
1141 from differentiable_bound_segment[OF assms(1) g B] \<open>x0 \<in> S\<close> |
1077 show ?thesis |
1142 show ?thesis |
1078 by (simp add: g_def field_simps linear_sub[OF has_derivative_linear[OF f']]) |
1143 by (simp add: g_def field_simps linear_diff[OF has_derivative_linear[OF f']]) |
1079 qed |
1144 qed |
1080 |
1145 |
1081 text \<open>In particular.\<close> |
1146 text \<open>In particular.\<close> |
1082 |
1147 |
1083 lemma has_derivative_zero_constant: |
1148 lemma has_derivative_zero_constant: |