src/HOL/Analysis/Derivative.thy
changeset 73928 3b76524f5a85
parent 73885 26171a89466a
child 73933 fa92bc604c59
equal deleted inserted replaced
73927:5b5e015189a4 73928:3b76524f5a85
  1790   shows "vector_derivative f (at x within S) = y"
  1790   shows "vector_derivative f (at x within S) = y"
  1791   using y
  1791   using y
  1792   by (intro vector_derivative_unique_within[OF not_bot vector_derivative_works[THEN iffD1] y])
  1792   by (intro vector_derivative_unique_within[OF not_bot vector_derivative_works[THEN iffD1] y])
  1793      (auto simp: differentiable_def has_vector_derivative_def)
  1793      (auto simp: differentiable_def has_vector_derivative_def)
  1794 
  1794 
       
  1795 lemma deriv_of_real [simp]: 
       
  1796   "at x within A \<noteq> bot \<Longrightarrow> vector_derivative of_real (at x within A) = 1"
       
  1797   by (auto intro!: vector_derivative_within derivative_eq_intros)
       
  1798 
  1795 lemma frechet_derivative_eq_vector_derivative:
  1799 lemma frechet_derivative_eq_vector_derivative:
  1796   assumes "f differentiable (at x)"
  1800   assumes "f differentiable (at x)"
  1797     shows  "(frechet_derivative f (at x)) = (\<lambda>r. r *\<^sub>R vector_derivative f (at x))"
  1801     shows  "(frechet_derivative f (at x)) = (\<lambda>r. r *\<^sub>R vector_derivative f (at x))"
  1798 using assms
  1802 using assms
  1799 by (auto simp: differentiable_iff_scaleR vector_derivative_def has_vector_derivative_def
  1803 by (auto simp: differentiable_iff_scaleR vector_derivative_def has_vector_derivative_def
  1823   apply (cases "at x within S \<noteq> bot")
  1827   apply (cases "at x within S \<noteq> bot")
  1824   apply (intro refl conj_cong filterlim_cong)
  1828   apply (intro refl conj_cong filterlim_cong)
  1825   apply (auto simp: Lim_ident_at eventually_at_filter elim: eventually_mono)
  1829   apply (auto simp: Lim_ident_at eventually_at_filter elim: eventually_mono)
  1826   done
  1830   done
  1827 
  1831 
       
  1832 lemma vector_derivative_cong_eq:
       
  1833   assumes "eventually (\<lambda>x. x \<in> A \<longrightarrow> f x = g x) (nhds x)" "x = y" "A = B" "x \<in> A"
       
  1834   shows   "vector_derivative f (at x within A) = vector_derivative g (at y within B)"
       
  1835 proof -
       
  1836   have "f x = g x"
       
  1837     using assms eventually_nhds_x_imp_x by blast
       
  1838   hence "(\<lambda>D. (f has_vector_derivative D) (at x within A)) = 
       
  1839            (\<lambda>D. (g has_vector_derivative D) (at x within A))" using assms
       
  1840     by (intro ext has_vector_derivative_cong_ev refl assms) simp_all
       
  1841   thus ?thesis by (simp add: vector_derivative_def assms)
       
  1842 qed
       
  1843   
  1828 lemma islimpt_closure_open:
  1844 lemma islimpt_closure_open:
  1829   fixes s :: "'a::perfect_space set"
  1845   fixes s :: "'a::perfect_space set"
  1830   assumes "open s" and t: "t = closure s" "x \<in> t"
  1846   assumes "open s" and t: "t = closure s" "x \<in> t"
  1831   shows "x islimpt t"
  1847   shows "x islimpt t"
  1832 proof cases
  1848 proof cases
  2252 lemma DERIV_deriv_iff_real_differentiable:
  2268 lemma DERIV_deriv_iff_real_differentiable:
  2253   fixes x :: real
  2269   fixes x :: real
  2254   shows "DERIV f x :> deriv f x \<longleftrightarrow> f differentiable at x"
  2270   shows "DERIV f x :> deriv f x \<longleftrightarrow> f differentiable at x"
  2255   unfolding differentiable_def by (metis DERIV_imp_deriv has_real_derivative_iff)
  2271   unfolding differentiable_def by (metis DERIV_imp_deriv has_real_derivative_iff)
  2256 
  2272 
       
  2273 lemma DERIV_deriv_iff_field_differentiable:
       
  2274   "DERIV f x :> deriv f x \<longleftrightarrow> f field_differentiable at x"
       
  2275   unfolding field_differentiable_def by (metis DERIV_imp_deriv)
       
  2276 
       
  2277 lemma vector_derivative_of_real_left:
       
  2278   assumes "f differentiable at x"
       
  2279   shows   "vector_derivative (\<lambda>x. of_real (f x)) (at x) = of_real (deriv f x)"
       
  2280   by (metis DERIV_deriv_iff_real_differentiable assms has_vector_derivative_of_real vector_derivative_at)
       
  2281   
       
  2282 lemma vector_derivative_of_real_right:
       
  2283   assumes "f field_differentiable at (of_real x)"
       
  2284   shows   "vector_derivative (\<lambda>x. f (of_real x)) (at x) = deriv f (of_real x)"
       
  2285   by (metis DERIV_deriv_iff_field_differentiable assms has_vector_derivative_real_field vector_derivative_at)
       
  2286   
  2257 lemma deriv_cong_ev:
  2287 lemma deriv_cong_ev:
  2258   assumes "eventually (\<lambda>x. f x = g x) (nhds x)" "x = y"
  2288   assumes "eventually (\<lambda>x. f x = g x) (nhds x)" "x = y"
  2259   shows   "deriv f x = deriv g y"
  2289   shows   "deriv f x = deriv g y"
  2260 proof -
  2290 proof -
  2261   have "(\<lambda>D. (f has_field_derivative D) (at x)) = (\<lambda>D. (g has_field_derivative D) (at y))"
  2291   have "(\<lambda>D. (f has_field_derivative D) (at x)) = (\<lambda>D. (g has_field_derivative D) (at y))"
  2274       by (simp add: eventually_eventually)
  2304       by (simp add: eventually_eventually)
  2275     hence "eventually (\<lambda>x. deriv f x = deriv g x) (nhds x)"
  2305     hence "eventually (\<lambda>x. deriv f x = deriv g x) (nhds x)"
  2276       by eventually_elim (rule deriv_cong_ev, simp_all)
  2306       by eventually_elim (rule deriv_cong_ev, simp_all)
  2277     thus ?case by (auto intro!: deriv_cong_ev Suc simp: funpow_Suc_right simp del: funpow.simps)
  2307     thus ?case by (auto intro!: deriv_cong_ev Suc simp: funpow_Suc_right simp del: funpow.simps)
  2278   qed auto
  2308   qed auto
  2279   from eventually_nhds_x_imp_x[OF this] assms(2) show ?thesis by simp
  2309   with \<open>x = y\<close> eventually_nhds_x_imp_x show ?thesis by blast 
  2280 qed
  2310 qed
  2281 
  2311 
  2282 lemma real_derivative_chain:
  2312 lemma real_derivative_chain:
  2283   fixes x :: real
  2313   fixes x :: real
  2284   shows "f differentiable at x \<Longrightarrow> g differentiable at (f x)
  2314   shows "f differentiable at x \<Longrightarrow> g differentiable at (f x)
  2295 lemma vector_derivative_chain_at_general:
  2325 lemma vector_derivative_chain_at_general:
  2296   assumes "f differentiable at x" "g field_differentiable at (f x)"
  2326   assumes "f differentiable at x" "g field_differentiable at (f x)"
  2297   shows "vector_derivative (g \<circ> f) (at x) = vector_derivative f (at x) * deriv g (f x)"
  2327   shows "vector_derivative (g \<circ> f) (at x) = vector_derivative f (at x) * deriv g (f x)"
  2298   apply (rule vector_derivative_at [OF field_vector_diff_chain_at])
  2328   apply (rule vector_derivative_at [OF field_vector_diff_chain_at])
  2299   using assms vector_derivative_works by (auto simp: field_differentiable_derivI)
  2329   using assms vector_derivative_works by (auto simp: field_differentiable_derivI)
  2300 
       
  2301 lemma DERIV_deriv_iff_field_differentiable:
       
  2302   "DERIV f x :> deriv f x \<longleftrightarrow> f field_differentiable at x"
       
  2303   unfolding field_differentiable_def by (metis DERIV_imp_deriv)
       
  2304 
  2330 
  2305 lemma deriv_chain:
  2331 lemma deriv_chain:
  2306   "f field_differentiable at x \<Longrightarrow> g field_differentiable at (f x)
  2332   "f field_differentiable at x \<Longrightarrow> g field_differentiable at (f x)
  2307     \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
  2333     \<Longrightarrow> deriv (g o f) x = deriv g (f x) * deriv f x"
  2308   by (metis DERIV_deriv_iff_field_differentiable DERIV_chain DERIV_imp_deriv)
  2334   by (metis DERIV_deriv_iff_field_differentiable DERIV_chain DERIV_imp_deriv)