# HG changeset patch # User huffman # Date 1179896418 -7200 # Node ID ffef77eed382a5eeef37b7b42274b68e6b2bb870 # Parent 636cda81978aa87c2dfe4507587da9e29fe38913 generalize powerseries and termdiffs lemmas using axclasses diff -r 636cda81978a -r ffef77eed382 src/HOL/Hyperreal/Transcendental.thy --- a/src/HOL/Hyperreal/Transcendental.thy Wed May 23 02:50:19 2007 +0200 +++ b/src/HOL/Hyperreal/Transcendental.thy Wed May 23 07:00:18 2007 +0200 @@ -13,51 +13,53 @@ subsection{*Properties of Power Series*} -lemma lemma_realpow_diff [rule_format (no_asm)]: - "p \ n --> y ^ (Suc n - p) = ((y::real) ^ (n - p)) * y" -apply (induct "n", auto) -apply (subgoal_tac "p = Suc n") -apply (simp (no_asm_simp), auto) -apply (drule sym) -apply (simp add: Suc_diff_le mult_commute realpow_Suc [symmetric] - del: realpow_Suc) -done +lemma lemma_realpow_diff: + fixes y :: "'a::recpower" + shows "p \ n \ y ^ (Suc n - p) = (y ^ (n - p)) * y" +proof - + assume "p \ n" + hence "Suc n - p = Suc (n - p)" by (rule Suc_diff_le) + thus ?thesis by (simp add: power_Suc power_commutes) +qed lemma lemma_realpow_diff_sumr: - "(\p=0..p=0..p=0..p=0..p=0..p=0..p=0..p=0..p=0..z\ < \x\"}.*} lemma powser_insidea: - fixes x z :: real + fixes x z :: "'a::{real_normed_field,banach,recpower}" assumes 1: "summable (\n. f n * x ^ n)" - assumes 2: "\z\ < \x\" - shows "summable (\n. \f n\ * z ^ n)" + assumes 2: "norm z < norm x" + shows "summable (\n. norm (f n * z ^ n))" proof - from 2 have x_neq_0: "x \ 0" by clarsimp from 1 have "(\n. f n * x ^ n) ----> 0" @@ -68,53 +70,55 @@ by (simp add: Cauchy_convergent_iff) hence "Bseq (\n. f n * x ^ n)" by (rule Cauchy_Bseq) - then obtain K where 3: "0 < K" and 4: "\n. \f n * x ^ n\ \ K" + then obtain K where 3: "0 < K" and 4: "\n. norm (f n * x ^ n) \ K" by (simp add: Bseq_def, safe) - have "\N. \n\N. norm (\f n\ * z ^ n) \ K * \z ^ n\ * inverse \x ^ n\" + have "\N. \n\N. norm (norm (f n * z ^ n)) \ + K * norm (z ^ n) * inverse (norm (x ^ n))" proof (intro exI allI impI) fix n::nat assume "0 \ n" - have "norm (\f n\ * z ^ n) * \x ^ n\ = \f n * x ^ n\ * \z ^ n\" - by (simp add: abs_mult) - also have "\ \ K * \z ^ n\" - by (simp only: mult_right_mono 4 abs_ge_zero) - also have "\ = K * \z ^ n\ * (inverse \x ^ n\ * \x ^ n\)" + have "norm (norm (f n * z ^ n)) * norm (x ^ n) = + norm (f n * x ^ n) * norm (z ^ n)" + by (simp add: norm_mult abs_mult) + also have "\ \ K * norm (z ^ n)" + by (simp only: mult_right_mono 4 norm_ge_zero) + also have "\ = K * norm (z ^ n) * (inverse (norm (x ^ n)) * norm (x ^ n))" by (simp add: x_neq_0) - also have "\ = K * \z ^ n\ * inverse \x ^ n\ * \x ^ n\" + also have "\ = K * norm (z ^ n) * inverse (norm (x ^ n)) * norm (x ^ n)" by (simp only: mult_assoc) - finally show "norm (\f n\ * z ^ n) \ K * \z ^ n\ * inverse \x ^ n\" + finally show "norm (norm (f n * z ^ n)) \ + K * norm (z ^ n) * inverse (norm (x ^ n))" by (simp add: mult_le_cancel_right x_neq_0) qed - moreover have "summable (\n. K * \z ^ n\ * inverse \x ^ n\)" + moreover have "summable (\n. K * norm (z ^ n) * inverse (norm (x ^ n)))" proof - - from 2 have "norm \z * inverse x\ < 1" - by (simp add: abs_mult divide_inverse [symmetric]) - hence "summable (\n. \z * inverse x\ ^ n)" + from 2 have "norm (norm (z * inverse x)) < 1" + using x_neq_0 + by (simp add: nonzero_norm_divide divide_inverse [symmetric]) + hence "summable (\n. norm (z * inverse x) ^ n)" by (rule summable_geometric) - hence "summable (\n. K * \z * inverse x\ ^ n)" + hence "summable (\n. K * norm (z * inverse x) ^ n)" by (rule summable_mult) - thus "summable (\n. K * \z ^ n\ * inverse \x ^ n\)" - by (simp add: abs_mult power_mult_distrib power_abs - power_inverse mult_assoc) + thus "summable (\n. K * norm (z ^ n) * inverse (norm (x ^ n)))" + using x_neq_0 + by (simp add: norm_mult nonzero_norm_inverse power_mult_distrib + power_inverse norm_power mult_assoc) qed - ultimately show "summable (\n. \f n\ * z ^ n)" + ultimately show "summable (\n. norm (f n * z ^ n))" by (rule summable_comparison_test) qed lemma powser_inside: - fixes f :: "nat \ real" shows - "[| summable (%n. f(n) * (x ^ n)); \z\ < \x\ |] + fixes f :: "nat \ 'a::{real_normed_field,banach,recpower}" shows + "[| summable (%n. f(n) * (x ^ n)); norm z < norm x |] ==> summable (%n. f(n) * (z ^ n))" -apply (drule_tac z = "\z\" in powser_insidea, simp) -apply (rule summable_rabs_cancel) -apply (simp add: abs_mult power_abs [symmetric]) -done +by (rule powser_insidea [THEN summable_norm_cancel]) subsection{*Term-by-Term Differentiability of Power Series*} definition - diffs :: "(nat => real) => nat => real" where - "diffs c = (%n. real (Suc n) * c(Suc n))" + diffs :: "(nat => 'a::ring_1) => nat => 'a" where + "diffs c = (%n. of_nat (Suc n) * c(Suc n))" text{*Lemma about distributing negation over it*} lemma diffs_minus: "diffs (%n. - c n) = (%n. - diffs c n)" @@ -123,24 +127,24 @@ text{*Show that we can shift the terms down one*} lemma lemma_diffs: "(\n=0..n=0..n=0..n=0..n=0..n=0.. - (%n. real n * c(n) * (x ^ (n - Suc 0))) sums + (%n. of_nat n * c(n) * (x ^ (n - Suc 0))) sums (\n. (diffs c)(n) * (x ^ n))" -apply (subgoal_tac " (%n. real n * c (n) * (x ^ (n - Suc 0))) ----> 0") +apply (subgoal_tac " (%n. of_nat n * c (n) * (x ^ (n - Suc 0))) ----> 0") apply (rule_tac [2] LIMSEQ_imp_Suc) apply (drule summable_sums) apply (auto simp add: sums_def) @@ -150,8 +154,9 @@ done lemma lemma_termdiff1: + fixes z :: "'a :: {recpower,comm_ring}" shows "(\p=0..p=0..p=0..i = 0.. 0" shows - "((z + h) ^ n - z ^ n) / h - real n * z ^ (n - Suc 0) = + "((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0) = h * (\p=0..< n - Suc 0. \q=0..< n - Suc 0 - p. - (z + h) ^ q * z ^ (n - 2 - q))" -apply (rule real_mult_left_cancel [OF h, THEN iffD1]) + (z + h) ^ q * z ^ (n - 2 - q))" (is "?lhs = ?rhs") +apply (subgoal_tac "h * ?lhs = h * ?rhs", simp add: h) apply (simp add: right_diff_distrib diff_divide_distrib h) apply (simp add: mult_assoc [symmetric]) apply (cases "n", simp) apply (simp add: lemma_realpow_diff_sumr2 h right_diff_distrib [symmetric] mult_assoc - del: realpow_Suc setsum_op_ivl_Suc) + del: realpow_Suc setsum_op_ivl_Suc of_nat_Suc) apply (subst lemma_realpow_rev_sumr) -apply (subst sumr_diff_mult_const) +apply (subst sumr_diff_mult_const2) apply simp apply (simp only: lemma_termdiff1 setsum_right_distrib) apply (rule setsum_cong [OF refl]) @@ -187,174 +197,185 @@ done lemma real_setsum_nat_ivl_bounded2: - "\\p::nat. p < n \ f p \ K; 0 \ K\ - \ setsum f {0.. real n * K" -apply (rule order_trans [OF real_setsum_nat_ivl_bounded mult_right_mono]) -apply simp_all + fixes K :: "'a::ordered_semidom" + assumes f: "\p::nat. p < n \ f p \ K" + assumes K: "0 \ K" + shows "setsum f {0.. of_nat n * K" +apply (rule order_trans [OF setsum_mono]) +apply (rule f, simp) +apply (simp add: mult_right_mono K) done lemma lemma_termdiff3: + fixes h z :: "'a::{real_normed_field,recpower,division_by_zero}" assumes 1: "h \ 0" - assumes 2: "\z\ \ K" - assumes 3: "\z + h\ \ K" - shows "\((z + h) ^ n - z ^ n) / h - real n * z ^ (n - Suc 0)\ - \ real n * real (n - Suc 0) * K ^ (n - 2) * \h\" + assumes 2: "norm z \ K" + assumes 3: "norm (z + h) \ K" + shows "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) + \ of_nat n * of_nat (n - Suc 0) * K ^ (n - 2) * norm h" proof - - have "\((z + h) ^ n - z ^ n) / h - real n * z ^ (n - Suc 0)\ = - \\p = 0..q = 0.. * \h\" + have "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) = + norm (\p = 0..q = 0.. \ real n * (real (n - Suc 0) * K ^ (n - 2)) * \h\" - proof (rule mult_right_mono [OF _ abs_ge_zero]) - from abs_ge_zero 2 have K: "0 \ K" by (rule order_trans) - have le_Kn: "\i j n. i + j = n \ \(z + h) ^ i * z ^ j\ \ K ^ n" + also have "\ \ of_nat n * (of_nat (n - Suc 0) * K ^ (n - 2)) * norm h" + proof (rule mult_right_mono [OF _ norm_ge_zero]) + from norm_ge_zero 2 have K: "0 \ K" by (rule order_trans) + have le_Kn: "\i j n. i + j = n \ norm ((z + h) ^ i * z ^ j) \ K ^ n" apply (erule subst) - apply (simp only: abs_mult power_abs power_add) - apply (intro mult_mono power_mono 2 3 abs_ge_zero zero_le_power K) + apply (simp only: norm_mult norm_power power_add) + apply (intro mult_mono power_mono 2 3 norm_ge_zero zero_le_power K) done - show "\\p = 0..q = 0.. - \ real n * (real (n - Suc 0) * K ^ (n - 2))" + show "norm (\p = 0..q = 0.. of_nat n * (of_nat (n - Suc 0) * K ^ (n - 2))" apply (intro - order_trans [OF setsum_abs] + order_trans [OF norm_setsum] real_setsum_nat_ivl_bounded2 mult_nonneg_nonneg - real_of_nat_ge_zero + zero_le_imp_of_nat zero_le_power K) apply (rule le_Kn, simp) done qed - also have "\ = real n * real (n - Suc 0) * K ^ (n - 2) * \h\" + also have "\ = of_nat n * of_nat (n - Suc 0) * K ^ (n - 2) * norm h" by (simp only: mult_assoc) finally show ?thesis . qed lemma lemma_termdiff4: + fixes f :: "'a::{real_normed_field,recpower,division_by_zero} \ + 'b::real_normed_vector" assumes k: "0 < (k::real)" - assumes le: "\h. \h \ 0; \h\ < k\ \ \f h\ \ K * \h\" + assumes le: "\h. \h \ 0; norm h < k\ \ norm (f h) \ K * norm h" shows "f -- 0 --> 0" proof (simp add: LIM_def, safe) fix r::real assume r: "0 < r" have zero_le_K: "0 \ K" apply (cut_tac k) - apply (cut_tac h="k/2" in le, simp, simp) - apply (subgoal_tac "0 \ K*k", simp add: zero_le_mult_iff) - apply (force intro: order_trans [of _ "\f (k / 2)\ * 2"]) + apply (cut_tac h="of_real (k/2)" in le, simp) + apply (simp del: of_real_divide) + apply (drule order_trans [OF norm_ge_zero]) + apply (simp add: zero_le_mult_iff) done - show "\s. 0 < s \ (\x. x \ 0 \ \x\ < s \ \f x\ < r)" + show "\s. 0 < s \ (\x. x \ 0 \ norm x < s \ norm (f x) < r)" proof (cases) assume "K = 0" - with k r le have "0 < k \ (\x. x \ 0 \ \x\ < k \ \f x\ < r)" + with k r le have "0 < k \ (\x. x \ 0 \ norm x < k \ norm (f x) < r)" by simp - thus "\s. 0 < s \ (\x. x \ 0 \ \x\ < s \ \f x\ < r)" .. + thus "\s. 0 < s \ (\x. x \ 0 \ norm x < s \ norm (f x) < r)" .. next assume K_neq_zero: "K \ 0" with zero_le_K have K: "0 < K" by simp - show "\s. 0 < s \ (\x. x \ 0 \ \x\ < s \ \f x\ < r)" + show "\s. 0 < s \ (\x. x \ 0 \ norm x < s \ norm (f x) < r)" proof (rule exI, safe) from k r K show "0 < min k (r * inverse K / 2)" by (simp add: mult_pos_pos positive_imp_inverse_positive) next - fix x::real - assume x1: "x \ 0" and x2: "\x\ < min k (r * inverse K / 2)" - from x2 have x3: "\x\ < k" and x4: "\x\ < r * inverse K / 2" + fix x::'a + assume x1: "x \ 0" and x2: "norm x < min k (r * inverse K / 2)" + from x2 have x3: "norm x < k" and x4: "norm x < r * inverse K / 2" by simp_all - from x1 x3 le have "\f x\ \ K * \x\" by simp - also from x4 K have "K * \x\ < K * (r * inverse K / 2)" + from x1 x3 le have "norm (f x) \ K * norm x" by simp + also from x4 K have "K * norm x < K * (r * inverse K / 2)" by (rule mult_strict_left_mono) also have "\ = r / 2" using K_neq_zero by simp also have "r / 2 < r" using r by simp - finally show "\f x\ < r" . + finally show "norm (f x) < r" . qed qed qed lemma lemma_termdiff5: + fixes g :: "'a::{recpower,real_normed_field,division_by_zero} \ + nat \ 'b::banach" assumes k: "0 < (k::real)" assumes f: "summable f" - assumes le: "\h n. \h \ 0; \h\ < k\ \ \g h n\ \ f n * \h\" + assumes le: "\h n. \h \ 0; norm h < k\ \ norm (g h n) \ f n * norm h" shows "(\h. suminf (g h)) -- 0 --> 0" proof (rule lemma_termdiff4 [OF k]) - fix h assume "h \ 0" and "\h\ < k" - hence A: "\n. \g h n\ \ f n * \h\" + fix h::'a assume "h \ 0" and "norm h < k" + hence A: "\n. norm (g h n) \ f n * norm h" by (simp add: le) - hence "\N. \n\N. norm \g h n\ \ f n * \h\" + hence "\N. \n\N. norm (norm (g h n)) \ f n * norm h" by simp - moreover from f have B: "summable (\n. f n * \h\)" + moreover from f have B: "summable (\n. f n * norm h)" by (rule summable_mult2) - ultimately have C: "summable (\n. \g h n\)" + ultimately have C: "summable (\n. norm (g h n))" by (rule summable_comparison_test) - hence "\suminf (g h)\ \ (\n. \g h n\)" - by (rule summable_rabs) - also from A C B have "(\n. \g h n\) \ (\n. f n * \h\)" + hence "norm (suminf (g h)) \ (\n. norm (g h n))" + by (rule summable_norm) + also from A C B have "(\n. norm (g h n)) \ (\n. f n * norm h)" by (rule summable_le) - also from f have "(\n. f n * \h\) = suminf f * \h\" + also from f have "(\n. f n * norm h) = suminf f * norm h" by (rule suminf_mult2 [symmetric]) - finally show "\suminf (g h)\ \ suminf f * \h\" . + finally show "norm (suminf (g h)) \ suminf f * norm h" . qed text{* FIXME: Long proofs*} lemma termdiffs_aux: + fixes x :: "'a::{recpower,real_normed_field,division_by_zero,banach}" assumes 1: "summable (\n. diffs (diffs c) n * K ^ n)" - assumes 2: "\x\ < \K\" + assumes 2: "norm x < norm K" shows "(\h. \n. c n * (((x + h) ^ n - x ^ n) / h - - real n * x ^ (n - Suc 0))) -- 0 --> 0" + - of_nat n * x ^ (n - Suc 0))) -- 0 --> 0" proof - from dense [OF 2] - obtain r where r1: "\x\ < r" and r2: "r < \K\" by fast - from abs_ge_zero r1 have r: "0 < r" + obtain r where r1: "norm x < r" and r2: "r < norm K" by fast + from norm_ge_zero r1 have r: "0 < r" by (rule order_le_less_trans) hence r_neq_0: "r \ 0" by simp show ?thesis proof (rule lemma_termdiff5) - show "0 < r - \x\" using r1 by simp + show "0 < r - norm x" using r1 by simp next - from r r2 have "\r\ < \K\" - by (simp only: abs_of_nonneg order_less_imp_le) - with 1 have "summable (\n. \diffs (diffs c) n\ * (r ^ n))" + from r r2 have "norm (of_real r::'a) < norm K" + by simp + with 1 have "summable (\n. norm (diffs (diffs c) n * (of_real r ^ n)))" by (rule powser_insidea) - hence "summable (\n. diffs (diffs (\n. \c n\)) n * r ^ n)" - by (simp only: diffs_def abs_mult abs_real_of_nat_cancel) - hence "summable (\n. real n * diffs (\n. \c n\) n * r ^ (n - Suc 0))" + hence "summable (\n. diffs (diffs (\n. norm (c n))) n * r ^ n)" + using r + by (simp add: diffs_def norm_mult norm_power del: of_nat_Suc) + hence "summable (\n. of_nat n * diffs (\n. norm (c n)) n * r ^ (n - Suc 0))" by (rule diffs_equiv [THEN sums_summable]) - also have "(\n. real n * diffs (\n. \c n\) n * r ^ (n - Suc 0)) - = (\n. diffs (%m. real (m - Suc 0) * \c m\ * inverse r) n * (r ^ n))" + also have "(\n. of_nat n * diffs (\n. norm (c n)) n * r ^ (n - Suc 0)) + = (\n. diffs (%m. of_nat (m - Suc 0) * norm (c m) * inverse r) n * (r ^ n))" apply (rule ext) apply (simp add: diffs_def) apply (case_tac n, simp_all add: r_neq_0) done finally have "summable - (\n. real n * (real (n - Suc 0) * \c n\ * inverse r) * r ^ (n - Suc 0))" + (\n. of_nat n * (of_nat (n - Suc 0) * norm (c n) * inverse r) * r ^ (n - Suc 0))" by (rule diffs_equiv [THEN sums_summable]) also have - "(\n. real n * (real (n - Suc 0) * \c n\ * inverse r) * + "(\n. of_nat n * (of_nat (n - Suc 0) * norm (c n) * inverse r) * r ^ (n - Suc 0)) = - (\n. \c n\ * real n * real (n - Suc 0) * r ^ (n - 2))" + (\n. norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2))" apply (rule ext) apply (case_tac "n", simp) apply (case_tac "nat", simp) apply (simp add: r_neq_0) done finally show - "summable (\n. \c n\ * real n * real (n - Suc 0) * r ^ (n - 2))" . + "summable (\n. norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2))" . next - fix h::real and n::nat + fix h::'a and n::nat assume h: "h \ 0" - assume "\h\ < r - \x\" - hence "\x\ + \h\ < r" by simp - with abs_triangle_ineq have xh: "\x + h\ < r" + assume "norm h < r - norm x" + hence "norm x + norm h < r" by simp + with norm_triangle_ineq have xh: "norm (x + h) < r" by (rule order_le_less_trans) - show "\c n * (((x + h) ^ n - x ^ n) / h - real n * x ^ (n - Suc 0))\ - \ \c n\ * real n * real (n - Suc 0) * r ^ (n - 2) * \h\" - apply (simp only: abs_mult mult_assoc) - apply (rule mult_left_mono [OF _ abs_ge_zero]) + show "norm (c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0))) + \ norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2) * norm h" + apply (simp only: norm_mult mult_assoc) + apply (rule mult_left_mono [OF _ norm_ge_zero]) apply (simp (no_asm) add: mult_assoc [symmetric]) apply (rule lemma_termdiff3) apply (rule h) @@ -365,23 +386,24 @@ qed lemma termdiffs: + fixes K x :: "'a::{recpower,real_normed_field,division_by_zero,banach}" assumes 1: "summable (\n. c n * K ^ n)" assumes 2: "summable (\n. (diffs c) n * K ^ n)" assumes 3: "summable (\n. (diffs (diffs c)) n * K ^ n)" - assumes 4: "\x\ < \K\" + assumes 4: "norm x < norm K" shows "DERIV (\x. \n. c n * x ^ n) x :> (\n. (diffs c) n * x ^ n)" proof (simp add: deriv_def, rule LIM_zero_cancel) show "(\h. (suminf (\n. c n * (x + h) ^ n) - suminf (\n. c n * x ^ n)) / h - suminf (\n. diffs c n * x ^ n)) -- 0 --> 0" proof (rule LIM_equal2) - show "0 < \K\ - \x\" by (simp add: less_diff_eq 4) + show "0 < norm K - norm x" by (simp add: less_diff_eq 4) next - fix h :: real + fix h :: 'a assume "h \ 0" - assume "norm (h - 0) < \K\ - \x\" - hence "\x\ + \h\ < \K\" by simp - hence 5: "\x + h\ < \K\" - by (rule abs_triangle_ineq [THEN order_le_less_trans]) + assume "norm (h - 0) < norm K - norm x" + hence "norm x + norm h < norm K" by simp + hence 5: "norm (x + h) < norm K" + by (rule norm_triangle_ineq [THEN order_le_less_trans]) have A: "summable (\n. c n * x ^ n)" by (rule powser_inside [OF 1 4]) have B: "summable (\n. c n * (x + h) ^ n)" @@ -390,7 +412,7 @@ by (rule powser_inside [OF 2 4]) show "((\n. c n * (x + h) ^ n) - (\n. c n * x ^ n)) / h - (\n. diffs c n * x ^ n) = - (\n. c n * (((x + h) ^ n - x ^ n) / h - real n * x ^ (n - Suc 0)))" + (\n. c n * (((x + h) ^ n - x ^ n) / h - of_nat n * x ^ (n - Suc 0)))" apply (subst sums_unique [OF diffs_equiv [OF C]]) apply (subst suminf_diff [OF B A]) apply (subst suminf_divide [symmetric]) @@ -405,7 +427,7 @@ done next show "(\h. \n. c n * (((x + h) ^ n - x ^ n) / h - - real n * x ^ (n - Suc 0))) -- 0 --> 0" + of_nat n * x ^ (n - Suc 0))) -- 0 --> 0" by (rule termdiffs_aux [OF 3 4]) qed qed @@ -515,7 +537,8 @@ lemma exp_fdiffs: "diffs (%n. inverse(real (fact n))) = (%n. inverse(real (fact n)))" -by (simp add: diffs_def mult_assoc [symmetric] del: mult_Suc) +by (simp add: diffs_def mult_assoc [symmetric] real_of_nat_def + del: mult_Suc of_nat_Suc) lemma sin_fdiffs: "diffs(%n. if even n then 0 @@ -524,7 +547,8 @@ (- 1) ^ (n div 2)/(real (fact n)) else 0)" by (auto intro!: ext - simp add: diffs_def divide_inverse simp del: mult_Suc) + simp add: diffs_def divide_inverse real_of_nat_def + simp del: mult_Suc of_nat_Suc) lemma sin_fdiffs2: "diffs(%n. if even n then 0 @@ -533,7 +557,8 @@ (- 1) ^ (n div 2)/(real (fact n)) else 0)" by (auto intro!: ext - simp add: diffs_def divide_inverse simp del: mult_Suc) + simp add: diffs_def divide_inverse real_of_nat_def + simp del: mult_Suc of_nat_Suc) lemma cos_fdiffs: "diffs(%n. if even n then @@ -541,8 +566,8 @@ = (%n. - (if even n then 0 else (- 1) ^ ((n - Suc 0)div 2)/(real (fact n))))" by (auto intro!: ext - simp add: diffs_def divide_inverse odd_Suc_mult_two_ex - simp del: mult_Suc) + simp add: diffs_def divide_inverse odd_Suc_mult_two_ex real_of_nat_def + simp del: mult_Suc of_nat_Suc) lemma cos_fdiffs2: @@ -551,8 +576,8 @@ = - (if even n then 0 else (- 1) ^ ((n - Suc 0)div 2)/(real (fact n)))" by (auto intro!: ext - simp add: diffs_def divide_inverse odd_Suc_mult_two_ex - simp del: mult_Suc) + simp add: diffs_def divide_inverse odd_Suc_mult_two_ex real_of_nat_def + simp del: mult_Suc of_nat_Suc) text{*Now at last we can get the derivatives of exp, sin and cos*}