src/HOL/Analysis/Derivative.thy
changeset 70136 f03a01a18c6e
parent 70065 cc89a395b5a3
child 70346 408e15cbd2a6
equal deleted inserted replaced
70135:ad6d4a14adb5 70136:f03a01a18c6e
    18 lemma has_derivative_add_const:
    18 lemma has_derivative_add_const:
    19   "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
    19   "(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net"
    20   by (intro derivative_eq_intros) auto
    20   by (intro derivative_eq_intros) auto
    21 
    21 
    22 
    22 
    23 subsection%unimportant \<open>Derivative with composed bilinear function\<close>
    23 subsection\<^marker>\<open>tag unimportant\<close> \<open>Derivative with composed bilinear function\<close>
    24 
    24 
    25 text \<open>More explicit epsilon-delta forms.\<close>
    25 text \<open>More explicit epsilon-delta forms.\<close>
    26 
    26 
    27 proposition has_derivative_within':
    27 proposition has_derivative_within':
    28   "(f has_derivative f')(at x within s) \<longleftrightarrow>
    28   "(f has_derivative f')(at x within s) \<longleftrightarrow>
    90     by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within)
    90     by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within)
    91 qed
    91 qed
    92 
    92 
    93 subsection \<open>Differentiability\<close>
    93 subsection \<open>Differentiability\<close>
    94 
    94 
    95 definition%important
    95 definition\<^marker>\<open>tag important\<close>
    96   differentiable_on :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a set \<Rightarrow> bool"
    96   differentiable_on :: "('a::real_normed_vector \<Rightarrow> 'b::real_normed_vector) \<Rightarrow> 'a set \<Rightarrow> bool"
    97     (infix "differentiable'_on" 50)
    97     (infix "differentiable'_on" 50)
    98   where "f differentiable_on s \<longleftrightarrow> (\<forall>x\<in>s. f differentiable (at x within s))"
    98   where "f differentiable_on s \<longleftrightarrow> (\<forall>x\<in>s. f differentiable (at x within s))"
    99 
    99 
   100 lemma differentiableI: "(f has_derivative f') net \<Longrightarrow> f differentiable net"
   100 lemma differentiableI: "(f has_derivative f') net \<Longrightarrow> f differentiable net"
   111 
   111 
   112 lemma differentiable_at_imp_differentiable_on:
   112 lemma differentiable_at_imp_differentiable_on:
   113   "(\<And>x. x \<in> s \<Longrightarrow> f differentiable at x) \<Longrightarrow> f differentiable_on s"
   113   "(\<And>x. x \<in> s \<Longrightarrow> f differentiable at x) \<Longrightarrow> f differentiable_on s"
   114   by (metis differentiable_at_withinI differentiable_on_def)
   114   by (metis differentiable_at_withinI differentiable_on_def)
   115 
   115 
   116 corollary%unimportant differentiable_iff_scaleR:
   116 corollary\<^marker>\<open>tag unimportant\<close> differentiable_iff_scaleR:
   117   fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
   117   fixes f :: "real \<Rightarrow> 'a::real_normed_vector"
   118   shows "f differentiable F \<longleftrightarrow> (\<exists>d. (f has_derivative (\<lambda>x. x *\<^sub>R d)) F)"
   118   shows "f differentiable F \<longleftrightarrow> (\<exists>d. (f has_derivative (\<lambda>x. x *\<^sub>R d)) F)"
   119   by (auto simp: differentiable_def dest: has_derivative_linear linear_imp_scaleR)
   119   by (auto simp: differentiable_def dest: has_derivative_linear linear_imp_scaleR)
   120 
   120 
   121 lemma differentiable_on_eq_differentiable_at:
   121 lemma differentiable_on_eq_differentiable_at:
   322   linear.scaleR[OF has_derivative_linear[OF Dg]]
   322   linear.scaleR[OF has_derivative_linear[OF Dg]]
   323   unfolding has_vector_derivative_def o_def
   323   unfolding has_vector_derivative_def o_def
   324   by (auto simp: o_def mult.commute has_vector_derivative_def)
   324   by (auto simp: o_def mult.commute has_vector_derivative_def)
   325 
   325 
   326 
   326 
   327 subsection%unimportant \<open>Composition rules stated just for differentiability\<close>
   327 subsection\<^marker>\<open>tag unimportant\<close> \<open>Composition rules stated just for differentiability\<close>
   328 
   328 
   329 lemma differentiable_chain_at:
   329 lemma differentiable_chain_at:
   330   "f differentiable (at x) \<Longrightarrow>
   330   "f differentiable (at x) \<Longrightarrow>
   331     g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
   331     g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
   332   unfolding differentiable_def
   332   unfolding differentiable_def
   340 
   340 
   341 
   341 
   342 subsection \<open>Uniqueness of derivative\<close>
   342 subsection \<open>Uniqueness of derivative\<close>
   343 
   343 
   344 
   344 
   345 text%important \<open>
   345 text\<^marker>\<open>tag important\<close> \<open>
   346  The general result is a bit messy because we need approachability of the
   346  The general result is a bit messy because we need approachability of the
   347  limit point from any direction. But OK for nontrivial intervals etc.
   347  limit point from any direction. But OK for nontrivial intervals etc.
   348 \<close>
   348 \<close>
   349 
   349 
   350 proposition frechet_derivative_unique_within:
   350 proposition frechet_derivative_unique_within:
  2193   using assms(2-3) vector_derivative_works
  2193   using assms(2-3) vector_derivative_works
  2194   by auto
  2194   by auto
  2195 
  2195 
  2196 subsection \<open>Field differentiability\<close>
  2196 subsection \<open>Field differentiability\<close>
  2197 
  2197 
  2198 definition%important field_differentiable :: "['a \<Rightarrow> 'a::real_normed_field, 'a filter] \<Rightarrow> bool"
  2198 definition\<^marker>\<open>tag important\<close> field_differentiable :: "['a \<Rightarrow> 'a::real_normed_field, 'a filter] \<Rightarrow> bool"
  2199            (infixr "(field'_differentiable)" 50)
  2199            (infixr "(field'_differentiable)" 50)
  2200   where "f field_differentiable F \<equiv> \<exists>f'. (f has_field_derivative f') F"
  2200   where "f field_differentiable F \<equiv> \<exists>f'. (f has_field_derivative f') F"
  2201 
  2201 
  2202 lemma field_differentiable_imp_differentiable:
  2202 lemma field_differentiable_imp_differentiable:
  2203   "f field_differentiable F \<Longrightarrow> f differentiable F"
  2203   "f field_differentiable F \<Longrightarrow> f differentiable F"
  2388   using exp_scaleR_has_vector_derivative_right[of A t]
  2388   using exp_scaleR_has_vector_derivative_right[of A t]
  2389   by (simp add: exp_times_scaleR_commute)
  2389   by (simp add: exp_times_scaleR_commute)
  2390 
  2390 
  2391 subsection \<open>Field derivative\<close>
  2391 subsection \<open>Field derivative\<close>
  2392 
  2392 
  2393 definition%important deriv :: "('a \<Rightarrow> 'a::real_normed_field) \<Rightarrow> 'a \<Rightarrow> 'a" where
  2393 definition\<^marker>\<open>tag important\<close> deriv :: "('a \<Rightarrow> 'a::real_normed_field) \<Rightarrow> 'a \<Rightarrow> 'a" where
  2394   "deriv f x \<equiv> SOME D. DERIV f x :> D"
  2394   "deriv f x \<equiv> SOME D. DERIV f x :> D"
  2395 
  2395 
  2396 lemma DERIV_imp_deriv: "DERIV f x :> f' \<Longrightarrow> deriv f x = f'"
  2396 lemma DERIV_imp_deriv: "DERIV f x :> f' \<Longrightarrow> deriv f x = f'"
  2397   unfolding deriv_def by (metis some_equality DERIV_unique)
  2397   unfolding deriv_def by (metis some_equality DERIV_unique)
  2398 
  2398 
  2699   then show "bounded_linear (\<lambda>(tx, ty). fx tx + blinfun_apply (fy x y) ty)"
  2699   then show "bounded_linear (\<lambda>(tx, ty). fx tx + blinfun_apply (fy x y) ty)"
  2700     by (auto intro!: bounded_linear_intros simp: split_beta')
  2700     by (auto intro!: bounded_linear_intros simp: split_beta')
  2701 qed
  2701 qed
  2702 
  2702 
  2703 
  2703 
  2704 subsection%unimportant \<open>Differentiable case distinction\<close>
  2704 subsection\<^marker>\<open>tag unimportant\<close> \<open>Differentiable case distinction\<close>
  2705 
  2705 
  2706 lemma has_derivative_within_If_eq:
  2706 lemma has_derivative_within_If_eq:
  2707   "((\<lambda>x. if P x then f x else g x) has_derivative f') (at x within S) =
  2707   "((\<lambda>x. if P x then f x else g x) has_derivative f') (at x within S) =
  2708     (bounded_linear f' \<and>
  2708     (bounded_linear f' \<and>
  2709      ((\<lambda>y.(if P y then (f y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x)
  2709      ((\<lambda>y.(if P y then (f y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x)