src/HOL/Transcendental.thy
changeset 67685 bdff8bf0a75b
parent 67574 4a3d657adc62
child 67727 ce3e87a51488
equal deleted inserted replaced
67682:00c436488398 67685:bdff8bf0a75b
  1387   done
  1387   done
  1388 
  1388 
  1389 declare DERIV_exp[THEN DERIV_chain2, derivative_intros]
  1389 declare DERIV_exp[THEN DERIV_chain2, derivative_intros]
  1390   and DERIV_exp[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  1390   and DERIV_exp[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  1391 
  1391 
       
  1392 lemmas has_derivative_exp[derivative_intros] = DERIV_exp[THEN DERIV_compose_FDERIV]
       
  1393 
  1392 lemma norm_exp: "norm (exp x) \<le> exp (norm x)"
  1394 lemma norm_exp: "norm (exp x) \<le> exp (norm x)"
  1393 proof -
  1395 proof -
  1394   from summable_norm[OF summable_norm_exp, of x]
  1396   from summable_norm[OF summable_norm_exp, of x]
  1395   have "norm (exp x) \<le> (\<Sum>n. inverse (fact n) * norm (x^n))"
  1397   have "norm (exp x) \<le> (\<Sum>n. inverse (fact n) * norm (x^n))"
  1396     by (simp add: exp_def)
  1398     by (simp add: exp_def)
  1880   for x :: real
  1882   for x :: real
  1881   by (rule DERIV_ln[THEN DERIV_cong]) (simp_all add: divide_inverse)
  1883   by (rule DERIV_ln[THEN DERIV_cong]) (simp_all add: divide_inverse)
  1882 
  1884 
  1883 declare DERIV_ln_divide[THEN DERIV_chain2, derivative_intros]
  1885 declare DERIV_ln_divide[THEN DERIV_chain2, derivative_intros]
  1884   and DERIV_ln_divide[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  1886   and DERIV_ln_divide[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
       
  1887 
       
  1888 lemmas has_derivative_ln[derivative_intros] = DERIV_ln[THEN DERIV_compose_FDERIV]
  1885 
  1889 
  1886 lemma ln_series:
  1890 lemma ln_series:
  1887   assumes "0 < x" and "x < 2"
  1891   assumes "0 < x" and "x < 2"
  1888   shows "ln x = (\<Sum> n. (-1)^n * (1 / real (n + 1)) * (x - 1)^(Suc n))"
  1892   shows "ln x = (\<Sum> n. (-1)^n * (1 / real (n + 1)) * (x - 1)^(Suc n))"
  1889     (is "ln x = suminf (?f (x - 1))")
  1893     (is "ln x = suminf (?f (x - 1))")
  3092     and "\<forall>\<^sub>F x in F. 0 \<le> f x"
  3096     and "\<forall>\<^sub>F x in F. 0 \<le> f x"
  3093     and b: "0 < b"
  3097     and b: "0 < b"
  3094   shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> a powr b) F"
  3098   shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> a powr b) F"
  3095   using tendsto_powr'[of f a F g b] assms by auto
  3099   using tendsto_powr'[of f a F g b] assms by auto
  3096 
  3100 
       
  3101 lemma has_derivative_powr[derivative_intros]:
       
  3102   assumes g[derivative_intros]: "(g has_derivative g') (at x within X)"
       
  3103     and f[derivative_intros]:"(f has_derivative f') (at x within X)"
       
  3104   assumes pos: "0 < g x" and "x \<in> X"
       
  3105   shows "((\<lambda>x. g x powr f x::real) has_derivative (\<lambda>h. (g x powr f x) * (f' h * ln (g x) + g' h * f x / g x))) (at x within X)"
       
  3106 proof -
       
  3107   have "\<forall>\<^sub>F x in at x within X. g x > 0"
       
  3108     by (rule order_tendstoD[OF _ pos])
       
  3109       (rule has_derivative_continuous[OF g, unfolded continuous_within])
       
  3110   then obtain d where "d > 0" and pos': "\<And>x'. x' \<in> X \<Longrightarrow> dist x' x < d \<Longrightarrow> 0 < g x'"
       
  3111     using pos unfolding eventually_at by force
       
  3112   have "((\<lambda>x. exp (f x * ln (g x))) has_derivative
       
  3113     (\<lambda>h. (g x powr f x) * (f' h * ln (g x) + g' h * f x / g x))) (at x within X)"
       
  3114     using pos
       
  3115     by (auto intro!: derivative_eq_intros simp: divide_simps powr_def)
       
  3116   then show ?thesis
       
  3117     by (rule has_derivative_transform_within[OF _ \<open>d > 0\<close> \<open>x \<in> X\<close>]) (auto simp: powr_def dest: pos')
       
  3118 qed
       
  3119 
  3097 lemma DERIV_powr:
  3120 lemma DERIV_powr:
  3098   fixes r :: real
  3121   fixes r :: real
  3099   assumes g: "DERIV g x :> m"
  3122   assumes g: "DERIV g x :> m"
  3100     and pos: "g x > 0"
  3123     and pos: "g x > 0"
  3101     and f: "DERIV f x :> r"
  3124     and f: "DERIV f x :> r"
  3102   shows "DERIV (\<lambda>x. g x powr f x) x :> (g x powr f x) * (r * ln (g x) + m * f x / g x)"
  3125   shows "DERIV (\<lambda>x. g x powr f x) x :> (g x powr f x) * (r * ln (g x) + m * f x / g x)"
  3103 proof -
  3126   using assms
  3104   have "DERIV (\<lambda>x. exp (f x * ln (g x))) x :> (g x powr f x) * (r * ln (g x) + m * f x / g x)"
  3127   by (auto intro!: derivative_eq_intros ext simp: has_field_derivative_def algebra_simps)
  3105     using pos
       
  3106     by (auto intro!: derivative_eq_intros g pos f simp: powr_def field_simps exp_diff)
       
  3107   then show ?thesis
       
  3108   proof (rule DERIV_cong_ev[OF refl _ refl, THEN iffD1, rotated])
       
  3109     from DERIV_isCont[OF g] pos have "\<forall>\<^sub>F x in at x. 0 < g x"
       
  3110       unfolding isCont_def by (rule order_tendstoD(1))
       
  3111     with pos show "\<forall>\<^sub>F x in nhds x. exp (f x * ln (g x)) = g x powr f x"
       
  3112       by (auto simp: eventually_at_filter powr_def elim: eventually_mono)
       
  3113   qed
       
  3114 qed
       
  3115 
  3128 
  3116 lemma DERIV_fun_powr:
  3129 lemma DERIV_fun_powr:
  3117   fixes r :: real
  3130   fixes r :: real
  3118   assumes g: "DERIV g x :> m"
  3131   assumes g: "DERIV g x :> m"
  3119     and pos: "g x > 0"
  3132     and pos: "g x > 0"
  3342   done
  3355   done
  3343 
  3356 
  3344 declare DERIV_sin[THEN DERIV_chain2, derivative_intros]
  3357 declare DERIV_sin[THEN DERIV_chain2, derivative_intros]
  3345   and DERIV_sin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  3358   and DERIV_sin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  3346 
  3359 
       
  3360 lemmas has_derivative_sin[derivative_intros] = DERIV_sin[THEN DERIV_compose_FDERIV]
       
  3361 
  3347 lemma DERIV_cos [simp]: "DERIV cos x :> - sin x"
  3362 lemma DERIV_cos [simp]: "DERIV cos x :> - sin x"
  3348   for x :: "'a::{real_normed_field,banach}"
  3363   for x :: "'a::{real_normed_field,banach}"
  3349   unfolding sin_def cos_def scaleR_conv_of_real
  3364   unfolding sin_def cos_def scaleR_conv_of_real
  3350   apply (rule DERIV_cong)
  3365   apply (rule DERIV_cong)
  3351    apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"])
  3366    apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"])
  3356               summable_norm_cos [THEN summable_norm_cancel])
  3371               summable_norm_cos [THEN summable_norm_cancel])
  3357   done
  3372   done
  3358 
  3373 
  3359 declare DERIV_cos[THEN DERIV_chain2, derivative_intros]
  3374 declare DERIV_cos[THEN DERIV_chain2, derivative_intros]
  3360   and DERIV_cos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  3375   and DERIV_cos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
       
  3376 
       
  3377 lemmas has_derivative_cos[derivative_intros] = DERIV_cos[THEN DERIV_compose_FDERIV]
  3361 
  3378 
  3362 lemma isCont_sin: "isCont sin x"
  3379 lemma isCont_sin: "isCont sin x"
  3363   for x :: "'a::{real_normed_field,banach}"
  3380   for x :: "'a::{real_normed_field,banach}"
  3364   by (rule DERIV_sin [THEN DERIV_isCont])
  3381   by (rule DERIV_sin [THEN DERIV_isCont])
  3365 
  3382 
  4596 lemma DERIV_tan [simp]: "cos x \<noteq> 0 \<Longrightarrow> DERIV tan x :> inverse ((cos x)\<^sup>2)"
  4613 lemma DERIV_tan [simp]: "cos x \<noteq> 0 \<Longrightarrow> DERIV tan x :> inverse ((cos x)\<^sup>2)"
  4597   for x :: "'a::{real_normed_field,banach}"
  4614   for x :: "'a::{real_normed_field,banach}"
  4598   unfolding tan_def
  4615   unfolding tan_def
  4599   by (auto intro!: derivative_eq_intros, simp add: divide_inverse power2_eq_square)
  4616   by (auto intro!: derivative_eq_intros, simp add: divide_inverse power2_eq_square)
  4600 
  4617 
       
  4618 lemmas has_derivative_tan[derivative_intros] = DERIV_tan[THEN DERIV_compose_FDERIV]
       
  4619 
  4601 lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x"
  4620 lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x"
  4602   for x :: "'a::{real_normed_field,banach}"
  4621   for x :: "'a::{real_normed_field,banach}"
  4603   by (rule DERIV_tan [THEN DERIV_isCont])
  4622   by (rule DERIV_tan [THEN DERIV_isCont])
  4604 
  4623 
  4605 lemma isCont_tan' [simp,continuous_intros]:
  4624 lemma isCont_tan' [simp,continuous_intros]:
  5262   DERIV_arcsin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  5281   DERIV_arcsin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  5263   DERIV_arccos[THEN DERIV_chain2, derivative_intros]
  5282   DERIV_arccos[THEN DERIV_chain2, derivative_intros]
  5264   DERIV_arccos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  5283   DERIV_arccos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  5265   DERIV_arctan[THEN DERIV_chain2, derivative_intros]
  5284   DERIV_arctan[THEN DERIV_chain2, derivative_intros]
  5266   DERIV_arctan[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
  5285   DERIV_arctan[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros]
       
  5286 
       
  5287 lemmas has_derivative_arctan[derivative_intros] = DERIV_arctan[THEN DERIV_compose_FDERIV]
       
  5288   and has_derivative_arccos[derivative_intros] = DERIV_arccos[THEN DERIV_compose_FDERIV]
       
  5289   and has_derivative_arcsin[derivative_intros] = DERIV_arcsin[THEN DERIV_compose_FDERIV]
  5267 
  5290 
  5268 lemma filterlim_tan_at_right: "filterlim tan at_bot (at_right (- (pi/2)))"
  5291 lemma filterlim_tan_at_right: "filterlim tan at_bot (at_right (- (pi/2)))"
  5269   by (rule filterlim_at_bot_at_right[where Q="\<lambda>x. - pi/2 < x \<and> x < pi/2" and P="\<lambda>x. True" and g=arctan])
  5292   by (rule filterlim_at_bot_at_right[where Q="\<lambda>x. - pi/2 < x \<and> x < pi/2" and P="\<lambda>x. True" and g=arctan])
  5270      (auto simp: arctan le_less eventually_at dist_real_def simp del: less_divide_eq_numeral1
  5293      (auto simp: arctan le_less eventually_at dist_real_def simp del: less_divide_eq_numeral1
  5271            intro!: tan_monotone exI[of _ "pi/2"])
  5294            intro!: tan_monotone exI[of _ "pi/2"])