equal
deleted
inserted
replaced
777 qed |
777 qed |
778 also have "\<dots> = real (Suc n) * R' ^ n" unfolding setsum_constant card_atLeastLessThan real_of_nat_def by auto |
778 also have "\<dots> = real (Suc n) * R' ^ n" unfolding setsum_constant card_atLeastLessThan real_of_nat_def by auto |
779 finally show "\<bar>\<Sum>p = 0..<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> \<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>" unfolding abs_real_of_nat_cancel abs_of_nonneg[OF zero_le_power[OF less_imp_le[OF `0 < R'`]]] . |
779 finally show "\<bar>\<Sum>p = 0..<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> \<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>" unfolding abs_real_of_nat_cancel abs_of_nonneg[OF zero_le_power[OF less_imp_le[OF `0 < R'`]]] . |
780 show "0 \<le> \<bar>f n\<bar> * \<bar>x - y\<bar>" unfolding abs_mult[symmetric] by auto |
780 show "0 \<le> \<bar>f n\<bar> * \<bar>x - y\<bar>" unfolding abs_mult[symmetric] by auto |
781 qed |
781 qed |
782 also have "\<dots> = \<bar>f n * real (Suc n) * R' ^ n\<bar> * \<bar>x - y\<bar>" unfolding abs_mult real_mult_assoc[symmetric] by algebra |
782 also have "\<dots> = \<bar>f n * real (Suc n) * R' ^ n\<bar> * \<bar>x - y\<bar>" unfolding abs_mult mult_assoc[symmetric] by algebra |
783 finally show ?thesis . |
783 finally show ?thesis . |
784 qed } |
784 qed } |
785 { fix n show "DERIV (\<lambda> x. ?f x n) x0 :> (?f' x0 n)" |
785 { fix n show "DERIV (\<lambda> x. ?f x n) x0 :> (?f' x0 n)" |
786 by (auto intro!: DERIV_intros simp del: power_Suc) } |
786 by (auto intro!: DERIV_intros simp del: power_Suc) } |
787 { fix x assume "x \<in> {-R' <..< R'}" hence "R' \<in> {-R <..< R}" and "norm x < norm R'" using assms `R' < R` by auto |
787 { fix x assume "x \<in> {-R' <..< R'}" hence "R' \<in> {-R <..< R}" and "norm x < norm R'" using assms `R' < R` by auto |
790 fix n |
790 fix n |
791 have le: "\<bar>f n\<bar> * 1 \<le> \<bar>f n\<bar> * real (Suc n)" by (rule mult_left_mono, auto) |
791 have le: "\<bar>f n\<bar> * 1 \<le> \<bar>f n\<bar> * real (Suc n)" by (rule mult_left_mono, auto) |
792 show "\<bar>f n * x ^ n\<bar> \<le> norm (f n * real (Suc n) * x ^ n)" unfolding real_norm_def abs_mult |
792 show "\<bar>f n * x ^ n\<bar> \<le> norm (f n * real (Suc n) * x ^ n)" unfolding real_norm_def abs_mult |
793 by (rule mult_right_mono, auto simp add: le[unfolded mult_1_right]) |
793 by (rule mult_right_mono, auto simp add: le[unfolded mult_1_right]) |
794 qed |
794 qed |
795 from this[THEN summable_mult2[where c=x], unfolded real_mult_assoc, unfolded real_mult_commute] |
795 from this[THEN summable_mult2[where c=x], unfolded mult_assoc, unfolded mult_commute] |
796 show "summable (?f x)" by auto } |
796 show "summable (?f x)" by auto } |
797 show "summable (?f' x0)" using converges[OF `x0 \<in> {-R <..< R}`] . |
797 show "summable (?f' x0)" using converges[OF `x0 \<in> {-R <..< R}`] . |
798 show "x0 \<in> {-R' <..< R'}" using `x0 \<in> {-R' <..< R'}` . |
798 show "x0 \<in> {-R' <..< R'}" using `x0 \<in> {-R' <..< R'}` . |
799 qed |
799 qed |
800 } note for_subinterval = this |
800 } note for_subinterval = this |
1020 text {* Strict monotonicity of exponential. *} |
1020 text {* Strict monotonicity of exponential. *} |
1021 |
1021 |
1022 lemma exp_ge_add_one_self_aux: "0 \<le> (x::real) ==> (1 + x) \<le> exp(x)" |
1022 lemma exp_ge_add_one_self_aux: "0 \<le> (x::real) ==> (1 + x) \<le> exp(x)" |
1023 apply (drule order_le_imp_less_or_eq, auto) |
1023 apply (drule order_le_imp_less_or_eq, auto) |
1024 apply (simp add: exp_def) |
1024 apply (simp add: exp_def) |
1025 apply (rule real_le_trans) |
1025 apply (rule order_trans) |
1026 apply (rule_tac [2] n = 2 and f = "(%n. inverse (real (fact n)) * x ^ n)" in series_pos_le) |
1026 apply (rule_tac [2] n = 2 and f = "(%n. inverse (real (fact n)) * x ^ n)" in series_pos_le) |
1027 apply (auto intro: summable_exp simp add: numeral_2_eq_2 zero_le_mult_iff) |
1027 apply (auto intro: summable_exp simp add: numeral_2_eq_2 zero_le_mult_iff) |
1028 done |
1028 done |
1029 |
1029 |
1030 lemma exp_gt_one: "0 < (x::real) \<Longrightarrow> 1 < exp x" |
1030 lemma exp_gt_one: "0 < (x::real) \<Longrightarrow> 1 < exp x" |
1226 fix x :: real assume "x \<in> {0 <..< 2}" hence "0 < x" and "x < 2" by auto |
1226 fix x :: real assume "x \<in> {0 <..< 2}" hence "0 < x" and "x < 2" by auto |
1227 have "norm (1 - x) < 1" using `0 < x` and `x < 2` by auto |
1227 have "norm (1 - x) < 1" using `0 < x` and `x < 2` by auto |
1228 have "1 / x = 1 / (1 - (1 - x))" by auto |
1228 have "1 / x = 1 / (1 - (1 - x))" by auto |
1229 also have "\<dots> = (\<Sum> n. (1 - x)^n)" using geometric_sums[OF `norm (1 - x) < 1`] by (rule sums_unique) |
1229 also have "\<dots> = (\<Sum> n. (1 - x)^n)" using geometric_sums[OF `norm (1 - x) < 1`] by (rule sums_unique) |
1230 also have "\<dots> = suminf (?f' x)" unfolding power_mult_distrib[symmetric] by (rule arg_cong[where f=suminf], rule arg_cong[where f="op ^"], auto) |
1230 also have "\<dots> = suminf (?f' x)" unfolding power_mult_distrib[symmetric] by (rule arg_cong[where f=suminf], rule arg_cong[where f="op ^"], auto) |
1231 finally have "DERIV ln x :> suminf (?f' x)" using DERIV_ln[OF `0 < x`] unfolding real_divide_def by auto |
1231 finally have "DERIV ln x :> suminf (?f' x)" using DERIV_ln[OF `0 < x`] unfolding divide_inverse by auto |
1232 moreover |
1232 moreover |
1233 have repos: "\<And> h x :: real. h - 1 + x = h + x - 1" by auto |
1233 have repos: "\<And> h x :: real. h - 1 + x = h + x - 1" by auto |
1234 have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> (\<Sum>n. (-1)^n * (1 / real (n + 1)) * real (Suc n) * (x - 1) ^ n)" |
1234 have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> (\<Sum>n. (-1)^n * (1 / real (n + 1)) * real (Suc n) * (x - 1) ^ n)" |
1235 proof (rule DERIV_power_series') |
1235 proof (rule DERIV_power_series') |
1236 show "x - 1 \<in> {- 1<..<1}" and "(0 :: real) < 1" using `0 < x` `x < 2` by auto |
1236 show "x - 1 \<in> {- 1<..<1}" and "(0 :: real) < 1" using `0 < x` `x < 2` by auto |
1386 apply (auto simp add: mult_assoc) |
1386 apply (auto simp add: mult_assoc) |
1387 done |
1387 done |
1388 |
1388 |
1389 lemma DERIV_sin_realpow2 [simp]: |
1389 lemma DERIV_sin_realpow2 [simp]: |
1390 "DERIV (%x. (sin x)\<twosuperior>) x :> cos(x) * sin(x) + cos(x) * sin(x)" |
1390 "DERIV (%x. (sin x)\<twosuperior>) x :> cos(x) * sin(x) + cos(x) * sin(x)" |
1391 by (auto simp add: numeral_2_eq_2 real_mult_assoc [symmetric]) |
1391 by (auto simp add: numeral_2_eq_2 mult_assoc [symmetric]) |
1392 |
1392 |
1393 lemma DERIV_sin_realpow2a [simp]: |
1393 lemma DERIV_sin_realpow2a [simp]: |
1394 "DERIV (%x. (sin x)\<twosuperior>) x :> 2 * cos(x) * sin(x)" |
1394 "DERIV (%x. (sin x)\<twosuperior>) x :> 2 * cos(x) * sin(x)" |
1395 by (auto simp add: numeral_2_eq_2) |
1395 by (auto simp add: numeral_2_eq_2) |
1396 |
1396 |
1404 apply (auto simp add: mult_ac) |
1404 apply (auto simp add: mult_ac) |
1405 done |
1405 done |
1406 |
1406 |
1407 lemma DERIV_cos_realpow2 [simp]: |
1407 lemma DERIV_cos_realpow2 [simp]: |
1408 "DERIV (%x. (cos x)\<twosuperior>) x :> -sin(x) * cos(x) + -sin(x) * cos(x)" |
1408 "DERIV (%x. (cos x)\<twosuperior>) x :> -sin(x) * cos(x) + -sin(x) * cos(x)" |
1409 by (auto simp add: numeral_2_eq_2 real_mult_assoc [symmetric]) |
1409 by (auto simp add: numeral_2_eq_2 mult_assoc [symmetric]) |
1410 |
1410 |
1411 lemma DERIV_cos_realpow2a [simp]: |
1411 lemma DERIV_cos_realpow2a [simp]: |
1412 "DERIV (%x. (cos x)\<twosuperior>) x :> -2 * cos(x) * sin(x)" |
1412 "DERIV (%x. (cos x)\<twosuperior>) x :> -2 * cos(x) * sin(x)" |
1413 by (auto simp add: numeral_2_eq_2) |
1413 by (auto simp add: numeral_2_eq_2) |
1414 |
1414 |
1703 apply (subgoal_tac " (\<forall>x. cos differentiable x) & (\<forall>x. isCont cos x) ") |
1703 apply (subgoal_tac " (\<forall>x. cos differentiable x) & (\<forall>x. isCont cos x) ") |
1704 apply (auto intro: DERIV_cos DERIV_isCont simp add: differentiable_def) |
1704 apply (auto intro: DERIV_cos DERIV_isCont simp add: differentiable_def) |
1705 apply (drule_tac f = cos in Rolle) |
1705 apply (drule_tac f = cos in Rolle) |
1706 apply (drule_tac [5] f = cos in Rolle) |
1706 apply (drule_tac [5] f = cos in Rolle) |
1707 apply (auto dest!: DERIV_cos [THEN DERIV_unique] simp add: differentiable_def) |
1707 apply (auto dest!: DERIV_cos [THEN DERIV_unique] simp add: differentiable_def) |
1708 apply (metis order_less_le_trans real_less_def sin_gt_zero) |
1708 apply (metis order_less_le_trans less_le sin_gt_zero) |
1709 apply (metis order_less_le_trans real_less_def sin_gt_zero) |
1709 apply (metis order_less_le_trans less_le sin_gt_zero) |
1710 done |
1710 done |
1711 |
1711 |
1712 lemma pi_half: "pi/2 = (THE x. 0 \<le> x & x \<le> 2 & cos x = 0)" |
1712 lemma pi_half: "pi/2 = (THE x. 0 \<le> x & x \<le> 2 & cos x = 0)" |
1713 by (simp add: pi_def) |
1713 by (simp add: pi_def) |
1714 |
1714 |
2136 apply (simp (no_asm_simp)) |
2136 apply (simp (no_asm_simp)) |
2137 apply (drule_tac x = "(pi/2) - e" in spec) |
2137 apply (drule_tac x = "(pi/2) - e" in spec) |
2138 apply (auto simp add: tan_def) |
2138 apply (auto simp add: tan_def) |
2139 apply (rule inverse_less_iff_less [THEN iffD1]) |
2139 apply (rule inverse_less_iff_less [THEN iffD1]) |
2140 apply (auto simp add: divide_inverse) |
2140 apply (auto simp add: divide_inverse) |
2141 apply (rule real_mult_order) |
2141 apply (rule mult_pos_pos) |
2142 apply (subgoal_tac [3] "0 < sin e & 0 < cos e") |
2142 apply (subgoal_tac [3] "0 < sin e & 0 < cos e") |
2143 apply (auto intro: cos_gt_zero sin_gt_zero2 simp add: mult_commute) |
2143 apply (auto intro: cos_gt_zero sin_gt_zero2 simp add: mult_commute) |
2144 done |
2144 done |
2145 |
2145 |
2146 lemma tan_total_pos: "0 \<le> y ==> \<exists>x. 0 \<le> x & x < pi/2 & tan x = y" |
2146 lemma tan_total_pos: "0 \<le> y ==> \<exists>x. 0 \<le> x & x < pi/2 & tan x = y" |
2147 apply (frule order_le_imp_less_or_eq, safe) |
2147 apply (frule order_le_imp_less_or_eq, safe) |
2148 prefer 2 apply force |
2148 prefer 2 apply force |
2191 obtain z where "y < z" and "z < x" and tan_diff: "tan x - tan y = (x - y) * inverse ((cos z)\<twosuperior>)" by auto |
2191 obtain z where "y < z" and "z < x" and tan_diff: "tan x - tan y = (x - y) * inverse ((cos z)\<twosuperior>)" by auto |
2192 hence "- (pi / 2) < z" and "z < pi / 2" using assms by auto |
2192 hence "- (pi / 2) < z" and "z < pi / 2" using assms by auto |
2193 hence "0 < cos z" using cos_gt_zero_pi by auto |
2193 hence "0 < cos z" using cos_gt_zero_pi by auto |
2194 hence inv_pos: "0 < inverse ((cos z)\<twosuperior>)" by auto |
2194 hence inv_pos: "0 < inverse ((cos z)\<twosuperior>)" by auto |
2195 have "0 < x - y" using `y < x` by auto |
2195 have "0 < x - y" using `y < x` by auto |
2196 from real_mult_order[OF this inv_pos] |
2196 from mult_pos_pos [OF this inv_pos] |
2197 have "0 < tan x - tan y" unfolding tan_diff by auto |
2197 have "0 < tan x - tan y" unfolding tan_diff by auto |
2198 thus ?thesis by auto |
2198 thus ?thesis by auto |
2199 qed |
2199 qed |
2200 |
2200 |
2201 lemma tan_monotone': assumes "- (pi / 2) < y" and "y < pi / 2" and "- (pi / 2) < x" and "x < pi / 2" |
2201 lemma tan_monotone': assumes "- (pi / 2) < y" and "y < pi / 2" and "- (pi / 2) < x" and "x < pi / 2" |
2224 by (simp add: tan_def) |
2224 by (simp add: tan_def) |
2225 |
2225 |
2226 lemma tan_periodic_nat[simp]: fixes n :: nat shows "tan (x + real n * pi) = tan x" |
2226 lemma tan_periodic_nat[simp]: fixes n :: nat shows "tan (x + real n * pi) = tan x" |
2227 proof (induct n arbitrary: x) |
2227 proof (induct n arbitrary: x) |
2228 case (Suc n) |
2228 case (Suc n) |
2229 have split_pi_off: "x + real (Suc n) * pi = (x + real n * pi) + pi" unfolding Suc_eq_plus1 real_of_nat_add real_of_one real_add_mult_distrib by auto |
2229 have split_pi_off: "x + real (Suc n) * pi = (x + real n * pi) + pi" unfolding Suc_eq_plus1 real_of_nat_add real_of_one left_distrib by auto |
2230 show ?case unfolding split_pi_off using Suc by auto |
2230 show ?case unfolding split_pi_off using Suc by auto |
2231 qed auto |
2231 qed auto |
2232 |
2232 |
2233 lemma tan_periodic_int[simp]: fixes i :: int shows "tan (x + real i * pi) = tan x" |
2233 lemma tan_periodic_int[simp]: fixes i :: int shows "tan (x + real i * pi) = tan x" |
2234 proof (cases "0 \<le> i") |
2234 proof (cases "0 \<le> i") |
2437 apply (rule arctan_lbound [of x, THEN dense, THEN exE], clarify) |
2437 apply (rule arctan_lbound [of x, THEN dense, THEN exE], clarify) |
2438 apply (rule arctan_ubound [of x, THEN dense, THEN exE], clarify) |
2438 apply (rule arctan_ubound [of x, THEN dense, THEN exE], clarify) |
2439 apply (subgoal_tac "isCont arctan (tan (arctan x))", simp) |
2439 apply (subgoal_tac "isCont arctan (tan (arctan x))", simp) |
2440 apply (erule (1) isCont_inverse_function2 [where f=tan]) |
2440 apply (erule (1) isCont_inverse_function2 [where f=tan]) |
2441 apply (metis arctan_tan order_le_less_trans order_less_le_trans) |
2441 apply (metis arctan_tan order_le_less_trans order_less_le_trans) |
2442 apply (metis cos_gt_zero_pi isCont_tan order_less_le_trans real_less_def) |
2442 apply (metis cos_gt_zero_pi isCont_tan order_less_le_trans less_le) |
2443 done |
2443 done |
2444 |
2444 |
2445 lemma DERIV_arcsin: |
2445 lemma DERIV_arcsin: |
2446 "\<lbrakk>-1 < x; x < 1\<rbrakk> \<Longrightarrow> DERIV arcsin x :> inverse (sqrt (1 - x\<twosuperior>))" |
2446 "\<lbrakk>-1 < x; x < 1\<rbrakk> \<Longrightarrow> DERIV arcsin x :> inverse (sqrt (1 - x\<twosuperior>))" |
2447 apply (rule DERIV_inverse_function [where f=sin and a="-1" and b="1"]) |
2447 apply (rule DERIV_inverse_function [where f=sin and a="-1" and b="1"]) |
2951 qed |
2951 qed |
2952 hence "0 \<le> ?a x n - ?diff x n" by auto |
2952 hence "0 \<le> ?a x n - ?diff x n" by auto |
2953 } |
2953 } |
2954 hence "\<forall> x \<in> { 0 <..< 1 }. 0 \<le> ?a x n - ?diff x n" by auto |
2954 hence "\<forall> x \<in> { 0 <..< 1 }. 0 \<le> ?a x n - ?diff x n" by auto |
2955 moreover have "\<And>x. isCont (\<lambda> x. ?a x n - ?diff x n) x" |
2955 moreover have "\<And>x. isCont (\<lambda> x. ?a x n - ?diff x n) x" |
2956 unfolding real_diff_def divide_inverse |
2956 unfolding diff_def divide_inverse |
2957 by (auto intro!: isCont_add isCont_rabs isCont_ident isCont_minus isCont_arctan isCont_inverse isCont_mult isCont_power isCont_const isCont_setsum) |
2957 by (auto intro!: isCont_add isCont_rabs isCont_ident isCont_minus isCont_arctan isCont_inverse isCont_mult isCont_power isCont_const isCont_setsum) |
2958 ultimately have "0 \<le> ?a 1 n - ?diff 1 n" by (rule LIM_less_bound) |
2958 ultimately have "0 \<le> ?a 1 n - ?diff 1 n" by (rule LIM_less_bound) |
2959 hence "?diff 1 n \<le> ?a 1 n" by auto |
2959 hence "?diff 1 n \<le> ?a 1 n" by auto |
2960 } |
2960 } |
2961 have "?a 1 ----> 0" |
2961 have "?a 1 ----> 0" |
2967 obtain N :: nat where N_I: "\<And> n. N \<le> n \<Longrightarrow> ?a 1 n < r" using LIMSEQ_D[OF `?a 1 ----> 0` `0 < r`] by auto |
2967 obtain N :: nat where N_I: "\<And> n. N \<le> n \<Longrightarrow> ?a 1 n < r" using LIMSEQ_D[OF `?a 1 ----> 0` `0 < r`] by auto |
2968 { fix n assume "N \<le> n" from `?diff 1 n \<le> ?a 1 n` N_I[OF this] |
2968 { fix n assume "N \<le> n" from `?diff 1 n \<le> ?a 1 n` N_I[OF this] |
2969 have "norm (?diff 1 n - 0) < r" by auto } |
2969 have "norm (?diff 1 n - 0) < r" by auto } |
2970 thus "\<exists> N. \<forall> n \<ge> N. norm (?diff 1 n - 0) < r" by blast |
2970 thus "\<exists> N. \<forall> n \<ge> N. norm (?diff 1 n - 0) < r" by blast |
2971 qed |
2971 qed |
2972 from this[unfolded LIMSEQ_rabs_zero real_diff_def add_commute[of "arctan 1"], THEN LIMSEQ_add_const, of "- arctan 1", THEN LIMSEQ_minus] |
2972 from this[unfolded LIMSEQ_rabs_zero diff_def add_commute[of "arctan 1"], THEN LIMSEQ_add_const, of "- arctan 1", THEN LIMSEQ_minus] |
2973 have "(?c 1) sums (arctan 1)" unfolding sums_def by auto |
2973 have "(?c 1) sums (arctan 1)" unfolding sums_def by auto |
2974 hence "arctan 1 = (\<Sum> i. ?c 1 i)" by (rule sums_unique) |
2974 hence "arctan 1 = (\<Sum> i. ?c 1 i)" by (rule sums_unique) |
2975 |
2975 |
2976 show ?thesis |
2976 show ?thesis |
2977 proof (cases "x = 1", simp add: `arctan 1 = (\<Sum> i. ?c 1 i)`) |
2977 proof (cases "x = 1", simp add: `arctan 1 = (\<Sum> i. ?c 1 i)`) |