equal
deleted
inserted
replaced
39 finally show ?thesis . |
39 finally show ?thesis . |
40 qed |
40 qed |
41 |
41 |
42 lemma root_test_convergence: |
42 lemma root_test_convergence: |
43 fixes f :: "nat \<Rightarrow> 'a::banach" |
43 fixes f :: "nat \<Rightarrow> 'a::banach" |
44 assumes f: "(\<lambda>n. root n (norm (f n))) ----> x" -- "could be weakened to lim sup" |
44 assumes f: "(\<lambda>n. root n (norm (f n))) ----> x" \<comment> "could be weakened to lim sup" |
45 assumes "x < 1" |
45 assumes "x < 1" |
46 shows "summable f" |
46 shows "summable f" |
47 proof - |
47 proof - |
48 have "0 \<le> x" |
48 have "0 \<le> x" |
49 by (rule LIMSEQ_le[OF tendsto_const f]) (auto intro!: exI[of _ 1]) |
49 by (rule LIMSEQ_le[OF tendsto_const f]) (auto intro!: exI[of _ 1]) |
1457 class ln = real_normed_algebra_1 + banach + |
1457 class ln = real_normed_algebra_1 + banach + |
1458 fixes ln :: "'a \<Rightarrow> 'a" |
1458 fixes ln :: "'a \<Rightarrow> 'a" |
1459 assumes ln_one [simp]: "ln 1 = 0" |
1459 assumes ln_one [simp]: "ln 1 = 0" |
1460 |
1460 |
1461 definition powr :: "['a,'a] => 'a::ln" (infixr "powr" 80) |
1461 definition powr :: "['a,'a] => 'a::ln" (infixr "powr" 80) |
1462 -- \<open>exponentation via ln and exp\<close> |
1462 \<comment> \<open>exponentation via ln and exp\<close> |
1463 where [code del]: "x powr a \<equiv> if x = 0 then 0 else exp(a * ln x)" |
1463 where [code del]: "x powr a \<equiv> if x = 0 then 0 else exp(a * ln x)" |
1464 |
1464 |
1465 lemma powr_0 [simp]: "0 powr z = 0" |
1465 lemma powr_0 [simp]: "0 powr z = 0" |
1466 by (simp add: powr_def) |
1466 by (simp add: powr_def) |
1467 |
1467 |
2082 qed (rule exp_at_top) |
2082 qed (rule exp_at_top) |
2083 qed |
2083 qed |
2084 |
2084 |
2085 |
2085 |
2086 definition log :: "[real,real] => real" |
2086 definition log :: "[real,real] => real" |
2087 -- \<open>logarithm of @{term x} to base @{term a}\<close> |
2087 \<comment> \<open>logarithm of @{term x} to base @{term a}\<close> |
2088 where "log a x = ln x / ln a" |
2088 where "log a x = ln x / ln a" |
2089 |
2089 |
2090 |
2090 |
2091 lemma tendsto_log [tendsto_intros]: |
2091 lemma tendsto_log [tendsto_intros]: |
2092 "\<lbrakk>(f ---> a) F; (g ---> b) F; 0 < a; a \<noteq> 1; 0 < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. log (f x) (g x)) ---> log a b) F" |
2092 "\<lbrakk>(f ---> a) F; (g ---> b) F; 0 < a; a \<noteq> 1; 0 < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. log (f x) (g x)) ---> log a b) F" |
3517 |
3517 |
3518 lemma sin_le_zero: "pi \<le> x \<Longrightarrow> x < 2*pi \<Longrightarrow> sin x \<le> 0" |
3518 lemma sin_le_zero: "pi \<le> x \<Longrightarrow> x < 2*pi \<Longrightarrow> sin x \<le> 0" |
3519 using sin_ge_zero [of "x-pi"] |
3519 using sin_ge_zero [of "x-pi"] |
3520 by (simp add: sin_diff) |
3520 by (simp add: sin_diff) |
3521 |
3521 |
3522 text \<open>FIXME: This proof is almost identical to lemma @{text cos_is_zero}. |
3522 text \<open>FIXME: This proof is almost identical to lemma \<open>cos_is_zero\<close>. |
3523 It should be possible to factor out some of the common parts.\<close> |
3523 It should be possible to factor out some of the common parts.\<close> |
3524 |
3524 |
3525 lemma cos_total: "\<lbrakk>-1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> EX! x. 0 \<le> x & x \<le> pi & (cos x = y)" |
3525 lemma cos_total: "\<lbrakk>-1 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> EX! x. 0 \<le> x & x \<le> pi & (cos x = y)" |
3526 proof (rule ex_ex1I) |
3526 proof (rule ex_ex1I) |
3527 assume y: "-1 \<le> y" "y \<le> 1" |
3527 assume y: "-1 \<le> y" "y \<le> 1" |
3853 then show "cos x = 1" |
3853 then show "cos x = 1" |
3854 by (metis cos_2npi cos_minus mult.assoc mult.left_commute) |
3854 by (metis cos_2npi cos_minus mult.assoc mult.left_commute) |
3855 qed |
3855 qed |
3856 |
3856 |
3857 lemma cos_one_2pi_int: "cos(x) = 1 \<longleftrightarrow> (\<exists>n::int. x = n * 2*pi)" |
3857 lemma cos_one_2pi_int: "cos(x) = 1 \<longleftrightarrow> (\<exists>n::int. x = n * 2*pi)" |
3858 apply auto --\<open>FIXME simproc bug\<close> |
3858 apply auto \<comment>\<open>FIXME simproc bug\<close> |
3859 apply (auto simp: cos_one_2pi) |
3859 apply (auto simp: cos_one_2pi) |
3860 apply (metis of_int_of_nat_eq) |
3860 apply (metis of_int_of_nat_eq) |
3861 apply (metis mult_minus_right of_int_minus of_int_of_nat_eq) |
3861 apply (metis mult_minus_right of_int_minus of_int_of_nat_eq) |
3862 by (metis mult_minus_right of_int_of_nat ) |
3862 by (metis mult_minus_right of_int_of_nat ) |
3863 |
3863 |
5571 finally have "(\<Sum>i\<le>Suc n. c i * w^i) = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" . |
5571 finally have "(\<Sum>i\<le>Suc n. c i * w^i) = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" . |
5572 } |
5572 } |
5573 then have wnz: "\<And>w. w \<noteq> 0 \<Longrightarrow> (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" |
5573 then have wnz: "\<And>w. w \<noteq> 0 \<Longrightarrow> (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" |
5574 using Suc by auto |
5574 using Suc by auto |
5575 then have "(\<lambda>h. \<Sum>i\<le>n. c (Suc i) * h^i) -- 0 --> 0" |
5575 then have "(\<lambda>h. \<Sum>i\<le>n. c (Suc i) * h^i) -- 0 --> 0" |
5576 by (simp cong: LIM_cong) --\<open>the case @{term"w=0"} by continuity\<close> |
5576 by (simp cong: LIM_cong) \<comment>\<open>the case @{term"w=0"} by continuity\<close> |
5577 then have "(\<Sum>i\<le>n. c (Suc i) * 0^i) = 0" |
5577 then have "(\<Sum>i\<le>n. c (Suc i) * 0^i) = 0" |
5578 using isCont_polynom [of 0 "\<lambda>i. c (Suc i)" n] LIM_unique |
5578 using isCont_polynom [of 0 "\<lambda>i. c (Suc i)" n] LIM_unique |
5579 by (force simp add: Limits.isCont_iff) |
5579 by (force simp add: Limits.isCont_iff) |
5580 then have "\<And>w. (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" using wnz |
5580 then have "\<And>w. (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" using wnz |
5581 by metis |
5581 by metis |