src/HOL/Deriv.thy
changeset 61810 3c5040d5694a
parent 61799 4cf66f21b764
child 61973 0c7e865fa7cb
equal deleted inserted replaced
61809:81d34cf268d8 61810:3c5040d5694a
   216 
   216 
   217 subsection \<open>Composition\<close>
   217 subsection \<open>Composition\<close>
   218 
   218 
   219 lemma tendsto_at_iff_tendsto_nhds_within: "f x = y \<Longrightarrow> (f ---> y) (at x within s) \<longleftrightarrow> (f ---> y) (inf (nhds x) (principal s))"
   219 lemma tendsto_at_iff_tendsto_nhds_within: "f x = y \<Longrightarrow> (f ---> y) (at x within s) \<longleftrightarrow> (f ---> y) (inf (nhds x) (principal s))"
   220   unfolding tendsto_def eventually_inf_principal eventually_at_filter
   220   unfolding tendsto_def eventually_inf_principal eventually_at_filter
   221   by (intro ext all_cong imp_cong) (auto elim!: eventually_elim1)
   221   by (intro ext all_cong imp_cong) (auto elim!: eventually_mono)
   222 
   222 
   223 lemma has_derivative_in_compose:
   223 lemma has_derivative_in_compose:
   224   assumes f: "(f has_derivative f') (at x within s)"
   224   assumes f: "(f has_derivative f') (at x within s)"
   225   assumes g: "(g has_derivative g') (at (f x) within (f`s))"
   225   assumes g: "(g has_derivative g') (at (f x) within (f`s))"
   226   shows "((\<lambda>x. g (f x)) has_derivative (\<lambda>x. g' (f' x))) (at x within s)"
   226   shows "((\<lambda>x. g (f x)) has_derivative (\<lambda>x. g' (f' x))) (at x within s)"
   901 proof (rule filterlim_cong)
   901 proof (rule filterlim_cong)
   902   assume *: "eventually (\<lambda>x. f x = g x) (nhds x)"
   902   assume *: "eventually (\<lambda>x. f x = g x) (nhds x)"
   903   moreover from * have "f x = g x" by (auto simp: eventually_nhds)
   903   moreover from * have "f x = g x" by (auto simp: eventually_nhds)
   904   moreover assume "x = y" "u = v"
   904   moreover assume "x = y" "u = v"
   905   ultimately show "eventually (\<lambda>xa. (f xa - f x) / (xa - x) = (g xa - g y) / (xa - y)) (at x)"
   905   ultimately show "eventually (\<lambda>xa. (f xa - f x) / (xa - x) = (g xa - g y) / (xa - y)) (at x)"
   906     by (auto simp: eventually_at_filter elim: eventually_elim1)
   906     by (auto simp: eventually_at_filter elim: eventually_mono)
   907 qed simp_all
   907 qed simp_all
   908 
   908 
   909 lemma DERIV_shift:
   909 lemma DERIV_shift:
   910   "(DERIV f (x + z) :> y) \<longleftrightarrow> (DERIV (\<lambda>x. f (x + z)) x :> y)"
   910   "(DERIV f (x + z) :> y) \<longleftrightarrow> (DERIV (\<lambda>x. f (x + z)) x :> y)"
   911   by (simp add: DERIV_def field_simps)
   911   by (simp add: DERIV_def field_simps)
  1677   then have "((\<lambda>x. norm (\<zeta> x)) ---> 0) (at_right 0)"
  1677   then have "((\<lambda>x. norm (\<zeta> x)) ---> 0) (at_right 0)"
  1678     by (rule_tac real_tendsto_sandwich[where f="\<lambda>x. 0" and h="\<lambda>x. x"]) auto
  1678     by (rule_tac real_tendsto_sandwich[where f="\<lambda>x. 0" and h="\<lambda>x. x"]) auto
  1679   then have "(\<zeta> ---> 0) (at_right 0)"
  1679   then have "(\<zeta> ---> 0) (at_right 0)"
  1680     by (rule tendsto_norm_zero_cancel)
  1680     by (rule tendsto_norm_zero_cancel)
  1681   with \<zeta> have "filterlim \<zeta> (at_right 0) (at_right 0)"
  1681   with \<zeta> have "filterlim \<zeta> (at_right 0) (at_right 0)"
  1682     by (auto elim!: eventually_elim1 simp: filterlim_at)
  1682     by (auto elim!: eventually_mono simp: filterlim_at)
  1683   from this lim have "((\<lambda>t. f' (\<zeta> t) / g' (\<zeta> t)) ---> x) (at_right 0)"
  1683   from this lim have "((\<lambda>t. f' (\<zeta> t) / g' (\<zeta> t)) ---> x) (at_right 0)"
  1684     by (rule_tac filterlim_compose[of _ _ _ \<zeta>])
  1684     by (rule_tac filterlim_compose[of _ _ _ \<zeta>])
  1685   ultimately have "((\<lambda>t. f t / g t) ---> x) (at_right 0)" (is ?P)
  1685   ultimately have "((\<lambda>t. f t / g t) ---> x) (at_right 0)" (is ?P)
  1686     by (rule_tac filterlim_cong[THEN iffD1, OF refl refl])
  1686     by (rule_tac filterlim_cong[THEN iffD1, OF refl refl])
  1687        (auto elim: eventually_elim1)
  1687        (auto elim: eventually_mono)
  1688   also have "?P \<longleftrightarrow> ?thesis"
  1688   also have "?P \<longleftrightarrow> ?thesis"
  1689     by (rule filterlim_cong) (auto simp: f_def g_def eventually_at_filter)
  1689     by (rule filterlim_cong) (auto simp: f_def g_def eventually_at_filter)
  1690   finally show ?thesis .
  1690   finally show ?thesis .
  1691 qed
  1691 qed
  1692 
  1692 
  1751     "eventually (\<lambda>t. t < a) (at_right 0)" "eventually (\<lambda>t::real. 0 < t) (at_right 0)"
  1751     "eventually (\<lambda>t. t < a) (at_right 0)" "eventually (\<lambda>t::real. 0 < t) (at_right 0)"
  1752     unfolding eventually_at by (auto intro!: exI[of _ a] simp: dist_real_def)
  1752     unfolding eventually_at by (auto intro!: exI[of _ a] simp: dist_real_def)
  1753 
  1753 
  1754   moreover
  1754   moreover
  1755   have "eventually (\<lambda>t. 0 < g t) (at_right 0)" "eventually (\<lambda>t. g a < g t) (at_right 0)"
  1755   have "eventually (\<lambda>t. 0 < g t) (at_right 0)" "eventually (\<lambda>t. g a < g t) (at_right 0)"
  1756     using g_0 by (auto elim: eventually_elim1 simp: filterlim_at_top_dense)
  1756     using g_0 by (auto elim: eventually_mono simp: filterlim_at_top_dense)
  1757 
  1757 
  1758   moreover
  1758   moreover
  1759   have inv_g: "((\<lambda>x. inverse (g x)) ---> 0) (at_right 0)"
  1759   have inv_g: "((\<lambda>x. inverse (g x)) ---> 0) (at_right 0)"
  1760     using tendsto_inverse_0 filterlim_mono[OF g_0 at_top_le_at_infinity order_refl]
  1760     using tendsto_inverse_0 filterlim_mono[OF g_0 at_top_le_at_infinity order_refl]
  1761     by (rule filterlim_compose)
  1761     by (rule filterlim_compose)
  1763     by (intro tendsto_intros)
  1763     by (intro tendsto_intros)
  1764   then have "((\<lambda>x. norm (1 - g a / g x)) ---> 1) (at_right 0)"
  1764   then have "((\<lambda>x. norm (1 - g a / g x)) ---> 1) (at_right 0)"
  1765     by (simp add: inverse_eq_divide)
  1765     by (simp add: inverse_eq_divide)
  1766   from this[unfolded tendsto_iff, rule_format, of 1]
  1766   from this[unfolded tendsto_iff, rule_format, of 1]
  1767   have "eventually (\<lambda>x. norm (1 - g a / g x) < 2) (at_right 0)"
  1767   have "eventually (\<lambda>x. norm (1 - g a / g x) < 2) (at_right 0)"
  1768     by (auto elim!: eventually_elim1 simp: dist_real_def)
  1768     by (auto elim!: eventually_mono simp: dist_real_def)
  1769 
  1769 
  1770   moreover
  1770   moreover
  1771   from inv_g have "((\<lambda>t. norm ((f a - x * g a) * inverse (g t))) ---> norm ((f a - x * g a) * 0)) (at_right 0)"
  1771   from inv_g have "((\<lambda>t. norm ((f a - x * g a) * inverse (g t))) ---> norm ((f a - x * g a) * 0)) (at_right 0)"
  1772     by (intro tendsto_intros)
  1772     by (intro tendsto_intros)
  1773   then have "((\<lambda>t. norm (f a - x * g a) / norm (g t)) ---> 0) (at_right 0)"
  1773   then have "((\<lambda>t. norm (f a - x * g a) / norm (g t)) ---> 0) (at_right 0)"