src/HOL/Analysis/Derivative.thy
changeset 68095 4fa3e63ecc7e
parent 68073 fad29d2a17a5
child 68239 0764ee22a4d1
equal deleted inserted replaced
68082:b25ccd85b1fd 68095:4fa3e63ecc7e
    70   "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
    70   "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f') (at x within s)"
    71   unfolding has_derivative_within' has_derivative_at'
    71   unfolding has_derivative_within' has_derivative_at'
    72   by blast
    72   by blast
    73 
    73 
    74 lemma has_derivative_within_open:
    74 lemma has_derivative_within_open:
    75   "a \<in> s \<Longrightarrow> open s \<Longrightarrow>
    75   "a \<in> S \<Longrightarrow> open S \<Longrightarrow>
    76     (f has_derivative f') (at a within s) \<longleftrightarrow> (f has_derivative f') (at a)"
    76     (f has_derivative f') (at a within S) \<longleftrightarrow> (f has_derivative f') (at a)"
    77   by (simp only: at_within_interior interior_open)
    77   by (simp only: at_within_interior interior_open)
    78 
    78 
    79 lemma has_derivative_right:
    79 lemma has_derivative_right:
    80   fixes f :: "real \<Rightarrow> real"
    80   fixes f :: "real \<Rightarrow> real"
    81     and y :: "real"
    81     and y :: "real"
    96 subsubsection \<open>Caratheodory characterization\<close>
    96 subsubsection \<open>Caratheodory characterization\<close>
    97 
    97 
    98 lemmas DERIV_within_iff = has_field_derivative_iff
    98 lemmas DERIV_within_iff = has_field_derivative_iff
    99 
    99 
   100 lemma DERIV_caratheodory_within:
   100 lemma DERIV_caratheodory_within:
   101   "(f has_field_derivative l) (at x within s) \<longleftrightarrow>
   101   "(f has_field_derivative l) (at x within S) \<longleftrightarrow>
   102    (\<exists>g. (\<forall>z. f z - f x = g z * (z - x)) \<and> continuous (at x within s) g \<and> g x = l)"
   102    (\<exists>g. (\<forall>z. f z - f x = g z * (z - x)) \<and> continuous (at x within S) g \<and> g x = l)"
   103       (is "?lhs = ?rhs")
   103       (is "?lhs = ?rhs")
   104 proof
   104 proof
   105   assume ?lhs
   105   assume ?lhs
   106   show ?rhs
   106   show ?rhs
   107   proof (intro exI conjI)
   107   proof (intro exI conjI)
   108     let ?g = "(%z. if z = x then l else (f z - f x) / (z-x))"
   108     let ?g = "(%z. if z = x then l else (f z - f x) / (z-x))"
   109     show "\<forall>z. f z - f x = ?g z * (z-x)" by simp
   109     show "\<forall>z. f z - f x = ?g z * (z-x)" by simp
   110     show "continuous (at x within s) ?g" using \<open>?lhs\<close>
   110     show "continuous (at x within S) ?g" using \<open>?lhs\<close>
   111       by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
   111       by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
   112     show "?g x = l" by simp
   112     show "?g x = l" by simp
   113   qed
   113   qed
   114 next
   114 next
   115   assume ?rhs
   115   assume ?rhs
   116   then obtain g where
   116   then obtain g where
   117     "(\<forall>z. f z - f x = g z * (z-x))" and "continuous (at x within s) g" and "g x = l" by blast
   117     "(\<forall>z. f z - f x = g z * (z-x))" and "continuous (at x within S) g" and "g x = l" by blast
   118   thus ?lhs
   118   thus ?lhs
   119     by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
   119     by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within)
   120 qed
   120 qed
   121 
   121 
   122 subsection \<open>Differentiability\<close>
   122 subsection \<open>Differentiability\<close>
   328   "(f has_derivative f') (at x) \<Longrightarrow>
   328   "(f has_derivative f') (at x) \<Longrightarrow>
   329     (g has_derivative g') (at (f x)) \<Longrightarrow> ((g \<circ> f) has_derivative (g' \<circ> f')) (at x)"
   329     (g has_derivative g') (at (f x)) \<Longrightarrow> ((g \<circ> f) has_derivative (g' \<circ> f')) (at x)"
   330   using has_derivative_compose[of f f' x UNIV g g']
   330   using has_derivative_compose[of f f' x UNIV g g']
   331   by (simp add: comp_def)
   331   by (simp add: comp_def)
   332 
   332 
       
   333 lemma has_vector_derivative_within_open:
       
   334   "a \<in> S \<Longrightarrow> open S \<Longrightarrow>
       
   335     (f has_vector_derivative f') (at a within S) \<longleftrightarrow> (f has_vector_derivative f') (at a)"
       
   336   by (simp only: at_within_interior interior_open)
       
   337 
   333 lemma field_vector_diff_chain_within:
   338 lemma field_vector_diff_chain_within:
   334  assumes Df: "(f has_vector_derivative f') (at x within s)"
   339  assumes Df: "(f has_vector_derivative f') (at x within S)"
   335      and Dg: "(g has_field_derivative g') (at (f x) within f`s)"
   340      and Dg: "(g has_field_derivative g') (at (f x) within f ` S)"
   336  shows "((g \<circ> f) has_vector_derivative (f' * g')) (at x within s)"
   341  shows "((g \<circ> f) has_vector_derivative (f' * g')) (at x within S)"
   337 using diff_chain_within[OF Df[unfolded has_vector_derivative_def]
   342 using diff_chain_within[OF Df[unfolded has_vector_derivative_def]
   338                        Dg [unfolded has_field_derivative_def]]
   343                        Dg [unfolded has_field_derivative_def]]
   339  by (auto simp: o_def mult.commute has_vector_derivative_def)
   344  by (auto simp: o_def mult.commute has_vector_derivative_def)
   340 
   345 
   341 lemma vector_derivative_diff_chain_within:
   346 lemma vector_derivative_diff_chain_within:
   342   assumes Df: "(f has_vector_derivative f') (at x within s)"
   347   assumes Df: "(f has_vector_derivative f') (at x within S)"
   343      and Dg: "(g has_derivative g') (at (f x) within f`s)"
   348      and Dg: "(g has_derivative g') (at (f x) within f`S)"
   344   shows "((g \<circ> f) has_vector_derivative (g' f')) (at x within s)"
   349   shows "((g \<circ> f) has_vector_derivative (g' f')) (at x within S)"
   345 using diff_chain_within[OF Df[unfolded has_vector_derivative_def] Dg]
   350 using diff_chain_within[OF Df[unfolded has_vector_derivative_def] Dg]
   346   linear.scaleR[OF has_derivative_linear[OF Dg]]
   351   linear.scaleR[OF has_derivative_linear[OF Dg]]
   347   unfolding has_vector_derivative_def o_def
   352   unfolding has_vector_derivative_def o_def
   348   by (auto simp: o_def mult.commute has_vector_derivative_def)
   353   by (auto simp: o_def mult.commute has_vector_derivative_def)
   349 
   354 
   355     g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
   360     g differentiable (at (f x)) \<Longrightarrow> (g \<circ> f) differentiable (at x)"
   356   unfolding differentiable_def
   361   unfolding differentiable_def
   357   by (meson diff_chain_at)
   362   by (meson diff_chain_at)
   358 
   363 
   359 lemma differentiable_chain_within:
   364 lemma differentiable_chain_within:
   360   "f differentiable (at x within s) \<Longrightarrow>
   365   "f differentiable (at x within S) \<Longrightarrow>
   361     g differentiable (at(f x) within (f ` s)) \<Longrightarrow> (g \<circ> f) differentiable (at x within s)"
   366     g differentiable (at(f x) within (f ` S)) \<Longrightarrow> (g \<circ> f) differentiable (at x within S)"
   362   unfolding differentiable_def
   367   unfolding differentiable_def
   363   by (meson diff_chain_within)
   368   by (meson diff_chain_within)
   364 
   369 
   365 
   370 
   366 subsection \<open>Uniqueness of derivative\<close>
   371 subsection \<open>Uniqueness of derivative\<close>