| author | wenzelm |
| Thu, 28 Jul 2016 20:39:46 +0200 | |
| changeset 63558 | 0aa33085c8b1 |
| parent 63540 | f8652d0534fa |
| child 63566 | e5abbdee461a |
| permissions | -rw-r--r-- |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
1 |
(* Title: HOL/Transcendental.thy |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
2 |
Author: Jacques D. Fleuriot, University of Cambridge, University of Edinburgh |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
3 |
Author: Lawrence C Paulson |
| 51527 | 4 |
Author: Jeremy Avigad |
| 12196 | 5 |
*) |
6 |
||
| 63558 | 7 |
section \<open>Power Series, Transcendental Functions etc.\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
8 |
|
| 15131 | 9 |
theory Transcendental |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
10 |
imports Binomial Series Deriv NthRoot |
| 15131 | 11 |
begin |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
12 |
|
| 62083 | 13 |
text \<open>A fact theorem on reals.\<close> |
14 |
||
| 63467 | 15 |
lemma square_fact_le_2_fact: "fact n * fact n \<le> (fact (2 * n) :: real)" |
| 62083 | 16 |
proof (induct n) |
| 63467 | 17 |
case 0 |
18 |
then show ?case by simp |
|
| 62083 | 19 |
next |
20 |
case (Suc n) |
|
21 |
have "(fact (Suc n)) * (fact (Suc n)) = of_nat (Suc n) * of_nat (Suc n) * (fact n * fact n :: real)" |
|
22 |
by (simp add: field_simps) |
|
23 |
also have "\<dots> \<le> of_nat (Suc n) * of_nat (Suc n) * fact (2 * n)" |
|
24 |
by (rule mult_left_mono [OF Suc]) simp |
|
25 |
also have "\<dots> \<le> of_nat (Suc (Suc (2 * n))) * of_nat (Suc (2 * n)) * fact (2 * n)" |
|
26 |
by (rule mult_right_mono)+ (auto simp: field_simps) |
|
27 |
also have "\<dots> = fact (2 * Suc n)" by (simp add: field_simps) |
|
28 |
finally show ?case . |
|
29 |
qed |
|
30 |
||
| 62347 | 31 |
lemma fact_in_Reals: "fact n \<in> \<real>" |
32 |
by (induction n) auto |
|
33 |
||
34 |
lemma of_real_fact [simp]: "of_real (fact n) = fact n" |
|
35 |
by (metis of_nat_fact of_real_of_nat_eq) |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
36 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
37 |
lemma pochhammer_of_real: "pochhammer (of_real x) n = of_real (pochhammer x n)" |
|
63417
c184ec919c70
more lemmas to emphasize {0::nat..(<)n} as canonical representation of intervals on nat
haftmann
parents:
63367
diff
changeset
|
38 |
by (simp add: pochhammer_setprod) |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
39 |
|
| 63467 | 40 |
lemma norm_fact [simp]: "norm (fact n :: 'a::real_normed_algebra_1) = fact n" |
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
41 |
proof - |
| 63467 | 42 |
have "(fact n :: 'a) = of_real (fact n)" |
43 |
by simp |
|
44 |
also have "norm \<dots> = fact n" |
|
45 |
by (subst norm_of_real) simp |
|
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
46 |
finally show ?thesis . |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
47 |
qed |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
48 |
|
| 57025 | 49 |
lemma root_test_convergence: |
50 |
fixes f :: "nat \<Rightarrow> 'a::banach" |
|
| 61969 | 51 |
assumes f: "(\<lambda>n. root n (norm (f n))) \<longlonglongrightarrow> x" \<comment> "could be weakened to lim sup" |
| 63467 | 52 |
and "x < 1" |
| 57025 | 53 |
shows "summable f" |
54 |
proof - |
|
55 |
have "0 \<le> x" |
|
56 |
by (rule LIMSEQ_le[OF tendsto_const f]) (auto intro!: exI[of _ 1]) |
|
| 60758 | 57 |
from \<open>x < 1\<close> obtain z where z: "x < z" "z < 1" |
| 57025 | 58 |
by (metis dense) |
| 63467 | 59 |
from f \<open>x < z\<close> have "eventually (\<lambda>n. root n (norm (f n)) < z) sequentially" |
| 57025 | 60 |
by (rule order_tendstoD) |
61 |
then have "eventually (\<lambda>n. norm (f n) \<le> z^n) sequentially" |
|
62 |
using eventually_ge_at_top |
|
63 |
proof eventually_elim |
|
| 63467 | 64 |
fix n |
65 |
assume less: "root n (norm (f n)) < z" and n: "1 \<le> n" |
|
66 |
from power_strict_mono[OF less, of n] n show "norm (f n) \<le> z ^ n" |
|
| 57025 | 67 |
by simp |
68 |
qed |
|
69 |
then show "summable f" |
|
70 |
unfolding eventually_sequentially |
|
| 60758 | 71 |
using z \<open>0 \<le> x\<close> by (auto intro!: summable_comparison_test[OF _ summable_geometric]) |
| 57025 | 72 |
qed |
73 |
||
| 63467 | 74 |
|
| 60758 | 75 |
subsection \<open>Properties of Power Series\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
76 |
|
| 63467 | 77 |
lemma powser_zero [simp]: "(\<Sum>n. f n * 0 ^ n) = f 0" |
78 |
for f :: "nat \<Rightarrow> 'a::real_normed_algebra_1" |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
79 |
proof - |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
80 |
have "(\<Sum>n<1. f n * 0 ^ n) = (\<Sum>n. f n * 0 ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
81 |
by (subst suminf_finite[where N="{0}"]) (auto simp: power_0_left)
|
| 63558 | 82 |
then show ?thesis by simp |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
83 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
84 |
|
| 63467 | 85 |
lemma powser_sums_zero: "(\<lambda>n. a n * 0^n) sums a 0" |
86 |
for a :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
|
87 |
using sums_finite [of "{0}" "\<lambda>n. a n * 0 ^ n"]
|
|
88 |
by simp |
|
89 |
||
90 |
lemma powser_sums_zero_iff [simp]: "(\<lambda>n. a n * 0^n) sums x \<longleftrightarrow> a 0 = x" |
|
91 |
for a :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
|
92 |
using powser_sums_zero sums_unique2 by blast |
|
93 |
||
94 |
text \<open> |
|
95 |
Power series has a circle or radius of convergence: if it sums for \<open>x\<close>, |
|
96 |
then it sums absolutely for \<open>z\<close> with @{term "\<bar>z\<bar> < \<bar>x\<bar>"}.\<close>
|
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
97 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
98 |
lemma powser_insidea: |
| 53599 | 99 |
fixes x z :: "'a::real_normed_div_algebra" |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
100 |
assumes 1: "summable (\<lambda>n. f n * x^n)" |
| 53079 | 101 |
and 2: "norm z < norm x" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
102 |
shows "summable (\<lambda>n. norm (f n * z ^ n))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
103 |
proof - |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
104 |
from 2 have x_neq_0: "x \<noteq> 0" by clarsimp |
| 61969 | 105 |
from 1 have "(\<lambda>n. f n * x^n) \<longlonglongrightarrow> 0" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
106 |
by (rule summable_LIMSEQ_zero) |
| 63558 | 107 |
then have "convergent (\<lambda>n. f n * x^n)" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
108 |
by (rule convergentI) |
| 63558 | 109 |
then have "Cauchy (\<lambda>n. f n * x^n)" |
| 44726 | 110 |
by (rule convergent_Cauchy) |
| 63558 | 111 |
then have "Bseq (\<lambda>n. f n * x^n)" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
112 |
by (rule Cauchy_Bseq) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
113 |
then obtain K where 3: "0 < K" and 4: "\<forall>n. norm (f n * x^n) \<le> K" |
| 63558 | 114 |
by (auto simp add: Bseq_def) |
115 |
have "\<exists>N. \<forall>n\<ge>N. norm (norm (f n * z ^ n)) \<le> K * norm (z ^ n) * inverse (norm (x^n))" |
|
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
116 |
proof (intro exI allI impI) |
| 63558 | 117 |
fix n :: nat |
| 53079 | 118 |
assume "0 \<le> n" |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
119 |
have "norm (norm (f n * z ^ n)) * norm (x^n) = |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
120 |
norm (f n * x^n) * norm (z ^ n)" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
121 |
by (simp add: norm_mult abs_mult) |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
122 |
also have "\<dots> \<le> K * norm (z ^ n)" |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
123 |
by (simp only: mult_right_mono 4 norm_ge_zero) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
124 |
also have "\<dots> = K * norm (z ^ n) * (inverse (norm (x^n)) * norm (x^n))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
125 |
by (simp add: x_neq_0) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
126 |
also have "\<dots> = K * norm (z ^ n) * inverse (norm (x^n)) * norm (x^n)" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
127 |
by (simp only: mult.assoc) |
| 63558 | 128 |
finally show "norm (norm (f n * z ^ n)) \<le> K * norm (z ^ n) * inverse (norm (x^n))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
129 |
by (simp add: mult_le_cancel_right x_neq_0) |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
130 |
qed |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
131 |
moreover have "summable (\<lambda>n. K * norm (z ^ n) * inverse (norm (x^n)))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
132 |
proof - |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
133 |
from 2 have "norm (norm (z * inverse x)) < 1" |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
134 |
using x_neq_0 |
| 53599 | 135 |
by (simp add: norm_mult nonzero_norm_inverse divide_inverse [where 'a=real, symmetric]) |
| 63558 | 136 |
then have "summable (\<lambda>n. norm (z * inverse x) ^ n)" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
137 |
by (rule summable_geometric) |
| 63558 | 138 |
then have "summable (\<lambda>n. K * norm (z * inverse x) ^ n)" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
139 |
by (rule summable_mult) |
| 63558 | 140 |
then show "summable (\<lambda>n. K * norm (z ^ n) * inverse (norm (x^n)))" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
141 |
using x_neq_0 |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
142 |
by (simp add: norm_mult nonzero_norm_inverse power_mult_distrib |
| 63558 | 143 |
power_inverse norm_power mult.assoc) |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
144 |
qed |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
145 |
ultimately show "summable (\<lambda>n. norm (f n * z ^ n))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
146 |
by (rule summable_comparison_test) |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
147 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
148 |
|
| 15229 | 149 |
lemma powser_inside: |
| 53599 | 150 |
fixes f :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
|
| 53079 | 151 |
shows |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
152 |
"summable (\<lambda>n. f n * (x^n)) \<Longrightarrow> norm z < norm x \<Longrightarrow> |
| 53079 | 153 |
summable (\<lambda>n. f n * (z ^ n))" |
154 |
by (rule powser_insidea [THEN summable_norm_cancel]) |
|
155 |
||
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
156 |
lemma powser_times_n_limit_0: |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
157 |
fixes x :: "'a::{real_normed_div_algebra,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
158 |
assumes "norm x < 1" |
| 61969 | 159 |
shows "(\<lambda>n. of_nat n * x ^ n) \<longlonglongrightarrow> 0" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
160 |
proof - |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
161 |
have "norm x / (1 - norm x) \<ge> 0" |
| 63558 | 162 |
using assms by (auto simp: divide_simps) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
163 |
moreover obtain N where N: "norm x / (1 - norm x) < of_int N" |
| 63558 | 164 |
using ex_le_of_int by (meson ex_less_of_int) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
165 |
ultimately have N0: "N>0" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
166 |
by auto |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
167 |
then have *: "real_of_int (N + 1) * norm x / real_of_int N < 1" |
| 63558 | 168 |
using N assms by (auto simp: field_simps) |
169 |
have **: "real_of_int N * (norm x * (real_of_nat (Suc n) * norm (x ^ n))) \<le> |
|
170 |
real_of_nat n * (norm x * ((1 + N) * norm (x ^ n)))" if "N \<le> int n" for n :: nat |
|
171 |
proof - |
|
172 |
from that have "real_of_int N * real_of_nat (Suc n) \<le> real_of_nat n * real_of_int (1 + N)" |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
173 |
by (simp add: algebra_simps) |
| 63558 | 174 |
then have "(real_of_int N * real_of_nat (Suc n)) * (norm x * norm (x ^ n)) \<le> |
175 |
(real_of_nat n * (1 + N)) * (norm x * norm (x ^ n))" |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
176 |
using N0 mult_mono by fastforce |
| 63558 | 177 |
then show ?thesis |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
178 |
by (simp add: algebra_simps) |
| 63558 | 179 |
qed |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
180 |
show ?thesis using * |
| 63558 | 181 |
by (rule summable_LIMSEQ_zero [OF summable_ratio_test, where N1="nat N"]) |
182 |
(simp add: N0 norm_mult field_simps ** del: of_nat_Suc of_int_add) |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
183 |
qed |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
184 |
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
185 |
corollary lim_n_over_pown: |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
186 |
fixes x :: "'a::{real_normed_field,banach}"
|
| 61973 | 187 |
shows "1 < norm x \<Longrightarrow> ((\<lambda>n. of_nat n / x^n) \<longlongrightarrow> 0) sequentially" |
| 63558 | 188 |
using powser_times_n_limit_0 [of "inverse x"] |
189 |
by (simp add: norm_divide divide_simps) |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
190 |
|
| 53079 | 191 |
lemma sum_split_even_odd: |
192 |
fixes f :: "nat \<Rightarrow> real" |
|
| 63558 | 193 |
shows "(\<Sum>i<2 * n. if even i then f i else g i) = (\<Sum>i<n. f (2 * i)) + (\<Sum>i<n. g (2 * i + 1))" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
194 |
proof (induct n) |
| 53079 | 195 |
case 0 |
196 |
then show ?case by simp |
|
197 |
next |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
198 |
case (Suc n) |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
199 |
have "(\<Sum>i<2 * Suc n. if even i then f i else g i) = |
|
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
200 |
(\<Sum>i<n. f (2 * i)) + (\<Sum>i<n. g (2 * i + 1)) + (f (2 * n) + g (2 * n + 1))" |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
201 |
using Suc.hyps unfolding One_nat_def by auto |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
202 |
also have "\<dots> = (\<Sum>i<Suc n. f (2 * i)) + (\<Sum>i<Suc n. g (2 * i + 1))" |
| 53079 | 203 |
by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
204 |
finally show ?case . |
| 53079 | 205 |
qed |
206 |
||
207 |
lemma sums_if': |
|
208 |
fixes g :: "nat \<Rightarrow> real" |
|
209 |
assumes "g sums x" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
210 |
shows "(\<lambda> n. if even n then 0 else g ((n - 1) div 2)) sums x" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
211 |
unfolding sums_def |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
212 |
proof (rule LIMSEQ_I) |
| 53079 | 213 |
fix r :: real |
214 |
assume "0 < r" |
|
| 60758 | 215 |
from \<open>g sums x\<close>[unfolded sums_def, THEN LIMSEQ_D, OF this] |
| 63558 | 216 |
obtain no where no_eq: "\<And>n. n \<ge> no \<Longrightarrow> (norm (setsum g {..<n} - x) < r)"
|
217 |
by blast |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
218 |
|
|
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
219 |
let ?SUM = "\<lambda> m. \<Sum>i<m. if even i then 0 else g ((i - 1) div 2)" |
| 63558 | 220 |
have "(norm (?SUM m - x) < r)" if "m \<ge> 2 * no" for m |
221 |
proof - |
|
222 |
from that have "m div 2 \<ge> no" by auto |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
223 |
have sum_eq: "?SUM (2 * (m div 2)) = setsum g {..< m div 2}"
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
224 |
using sum_split_even_odd by auto |
| 63558 | 225 |
then have "(norm (?SUM (2 * (m div 2)) - x) < r)" |
| 60758 | 226 |
using no_eq unfolding sum_eq using \<open>m div 2 \<ge> no\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
227 |
moreover |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
228 |
have "?SUM (2 * (m div 2)) = ?SUM m" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
229 |
proof (cases "even m") |
| 53079 | 230 |
case True |
| 63558 | 231 |
then show ?thesis |
232 |
by (auto simp add: even_two_times_div_two) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
233 |
next |
| 53079 | 234 |
case False |
| 58834 | 235 |
then have eq: "Suc (2 * (m div 2)) = m" by simp |
| 63558 | 236 |
then have "even (2 * (m div 2))" using \<open>odd m\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
237 |
have "?SUM m = ?SUM (Suc (2 * (m div 2)))" unfolding eq .. |
| 60758 | 238 |
also have "\<dots> = ?SUM (2 * (m div 2))" using \<open>even (2 * (m div 2))\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
239 |
finally show ?thesis by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
240 |
qed |
| 63558 | 241 |
ultimately show ?thesis by auto |
242 |
qed |
|
243 |
then show "\<exists>no. \<forall> m \<ge> no. norm (?SUM m - x) < r" |
|
244 |
by blast |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
245 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
246 |
|
| 53079 | 247 |
lemma sums_if: |
248 |
fixes g :: "nat \<Rightarrow> real" |
|
249 |
assumes "g sums x" and "f sums y" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
250 |
shows "(\<lambda> n. if even n then f (n div 2) else g ((n - 1) div 2)) sums (x + y)" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
251 |
proof - |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
252 |
let ?s = "\<lambda> n. if even n then 0 else f ((n - 1) div 2)" |
| 63558 | 253 |
have if_sum: "(if B then (0 :: real) else E) + (if B then T else 0) = (if B then T else E)" |
254 |
for B T E |
|
255 |
by (cases B) auto |
|
| 53079 | 256 |
have g_sums: "(\<lambda> n. if even n then 0 else g ((n - 1) div 2)) sums x" |
| 60758 | 257 |
using sums_if'[OF \<open>g sums x\<close>] . |
| 63558 | 258 |
have if_eq: "\<And>B T E. (if \<not> B then T else E) = (if B then E else T)" |
259 |
by auto |
|
260 |
have "?s sums y" using sums_if'[OF \<open>f sums y\<close>] . |
|
261 |
from this[unfolded sums_def, THEN LIMSEQ_Suc] |
|
262 |
have "(\<lambda>n. if even n then f (n div 2) else 0) sums y" |
|
263 |
by (simp add: lessThan_Suc_eq_insert_0 setsum_atLeast1_atMost_eq image_Suc_lessThan |
|
| 63365 | 264 |
if_eq sums_def cong del: if_cong) |
| 63558 | 265 |
from sums_add[OF g_sums this] show ?thesis |
266 |
by (simp only: if_sum) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
267 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
268 |
|
| 60758 | 269 |
subsection \<open>Alternating series test / Leibniz formula\<close> |
| 63558 | 270 |
(* FIXME: generalise these results from the reals via type classes? *) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
271 |
|
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
272 |
lemma sums_alternating_upper_lower: |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
273 |
fixes a :: "nat \<Rightarrow> real" |
| 63558 | 274 |
assumes mono: "\<And>n. a (Suc n) \<le> a n" |
275 |
and a_pos: "\<And>n. 0 \<le> a n" |
|
276 |
and "a \<longlonglongrightarrow> 0" |
|
| 61969 | 277 |
shows "\<exists>l. ((\<forall>n. (\<Sum>i<2*n. (- 1)^i*a i) \<le> l) \<and> (\<lambda> n. \<Sum>i<2*n. (- 1)^i*a i) \<longlonglongrightarrow> l) \<and> |
278 |
((\<forall>n. l \<le> (\<Sum>i<2*n + 1. (- 1)^i*a i)) \<and> (\<lambda> n. \<Sum>i<2*n + 1. (- 1)^i*a i) \<longlonglongrightarrow> l)" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
279 |
(is "\<exists>l. ((\<forall>n. ?f n \<le> l) \<and> _) \<and> ((\<forall>n. l \<le> ?g n) \<and> _)") |
| 53079 | 280 |
proof (rule nested_sequence_unique) |
| 63558 | 281 |
have fg_diff: "\<And>n. ?f n - ?g n = - a (2 * n)" by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
282 |
|
| 53079 | 283 |
show "\<forall>n. ?f n \<le> ?f (Suc n)" |
284 |
proof |
|
| 63558 | 285 |
show "?f n \<le> ?f (Suc n)" for n |
286 |
using mono[of "2*n"] by auto |
|
| 53079 | 287 |
qed |
288 |
show "\<forall>n. ?g (Suc n) \<le> ?g n" |
|
289 |
proof |
|
| 63558 | 290 |
show "?g (Suc n) \<le> ?g n" for n |
291 |
using mono[of "Suc (2*n)"] by auto |
|
| 53079 | 292 |
qed |
293 |
show "\<forall>n. ?f n \<le> ?g n" |
|
294 |
proof |
|
| 63558 | 295 |
show "?f n \<le> ?g n" for n |
296 |
using fg_diff a_pos by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
297 |
qed |
| 63558 | 298 |
show "(\<lambda>n. ?f n - ?g n) \<longlonglongrightarrow> 0" |
299 |
unfolding fg_diff |
|
| 53079 | 300 |
proof (rule LIMSEQ_I) |
301 |
fix r :: real |
|
302 |
assume "0 < r" |
|
| 61969 | 303 |
with \<open>a \<longlonglongrightarrow> 0\<close>[THEN LIMSEQ_D] obtain N where "\<And> n. n \<ge> N \<Longrightarrow> norm (a n - 0) < r" |
| 53079 | 304 |
by auto |
| 63558 | 305 |
then have "\<forall>n \<ge> N. norm (- a (2 * n) - 0) < r" |
306 |
by auto |
|
307 |
then show "\<exists>N. \<forall>n \<ge> N. norm (- a (2 * n) - 0) < r" |
|
308 |
by auto |
|
| 53079 | 309 |
qed |
| 41970 | 310 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
311 |
|
| 53079 | 312 |
lemma summable_Leibniz': |
313 |
fixes a :: "nat \<Rightarrow> real" |
|
| 61969 | 314 |
assumes a_zero: "a \<longlonglongrightarrow> 0" |
| 63558 | 315 |
and a_pos: "\<And>n. 0 \<le> a n" |
316 |
and a_monotone: "\<And>n. a (Suc n) \<le> a n" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
317 |
shows summable: "summable (\<lambda> n. (-1)^n * a n)" |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
318 |
and "\<And>n. (\<Sum>i<2*n. (-1)^i*a i) \<le> (\<Sum>i. (-1)^i*a i)" |
| 61969 | 319 |
and "(\<lambda>n. \<Sum>i<2*n. (-1)^i*a i) \<longlonglongrightarrow> (\<Sum>i. (-1)^i*a i)" |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
320 |
and "\<And>n. (\<Sum>i. (-1)^i*a i) \<le> (\<Sum>i<2*n+1. (-1)^i*a i)" |
| 61969 | 321 |
and "(\<lambda>n. \<Sum>i<2*n+1. (-1)^i*a i) \<longlonglongrightarrow> (\<Sum>i. (-1)^i*a i)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
322 |
proof - |
| 53079 | 323 |
let ?S = "\<lambda>n. (-1)^n * a n" |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
324 |
let ?P = "\<lambda>n. \<Sum>i<n. ?S i" |
| 53079 | 325 |
let ?f = "\<lambda>n. ?P (2 * n)" |
326 |
let ?g = "\<lambda>n. ?P (2 * n + 1)" |
|
327 |
obtain l :: real |
|
328 |
where below_l: "\<forall> n. ?f n \<le> l" |
|
| 61969 | 329 |
and "?f \<longlonglongrightarrow> l" |
| 53079 | 330 |
and above_l: "\<forall> n. l \<le> ?g n" |
| 61969 | 331 |
and "?g \<longlonglongrightarrow> l" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
332 |
using sums_alternating_upper_lower[OF a_monotone a_pos a_zero] by blast |
| 41970 | 333 |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
334 |
let ?Sa = "\<lambda>m. \<Sum>n<m. ?S n" |
| 61969 | 335 |
have "?Sa \<longlonglongrightarrow> l" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
336 |
proof (rule LIMSEQ_I) |
| 53079 | 337 |
fix r :: real |
338 |
assume "0 < r" |
|
| 61969 | 339 |
with \<open>?f \<longlonglongrightarrow> l\<close>[THEN LIMSEQ_D] |
| 63558 | 340 |
obtain f_no where f: "\<And>n. n \<ge> f_no \<Longrightarrow> norm (?f n - l) < r" |
341 |
by auto |
|
| 61969 | 342 |
from \<open>0 < r\<close> \<open>?g \<longlonglongrightarrow> l\<close>[THEN LIMSEQ_D] |
| 63558 | 343 |
obtain g_no where g: "\<And>n. n \<ge> g_no \<Longrightarrow> norm (?g n - l) < r" |
344 |
by auto |
|
345 |
have "norm (?Sa n - l) < r" if "n \<ge> (max (2 * f_no) (2 * g_no))" for n |
|
346 |
proof - |
|
347 |
from that have "n \<ge> 2 * f_no" and "n \<ge> 2 * g_no" by auto |
|
348 |
show ?thesis |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
349 |
proof (cases "even n") |
| 53079 | 350 |
case True |
| 63558 | 351 |
then have n_eq: "2 * (n div 2) = n" |
352 |
by (simp add: even_two_times_div_two) |
|
| 60758 | 353 |
with \<open>n \<ge> 2 * f_no\<close> have "n div 2 \<ge> f_no" |
| 53079 | 354 |
by auto |
355 |
from f[OF this] show ?thesis |
|
356 |
unfolding n_eq atLeastLessThanSuc_atLeastAtMost . |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
357 |
next |
| 53079 | 358 |
case False |
| 63558 | 359 |
then have "even (n - 1)" by simp |
|
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58709
diff
changeset
|
360 |
then have n_eq: "2 * ((n - 1) div 2) = n - 1" |
|
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58709
diff
changeset
|
361 |
by (simp add: even_two_times_div_two) |
| 63558 | 362 |
then have range_eq: "n - 1 + 1 = n" |
| 53079 | 363 |
using odd_pos[OF False] by auto |
| 60758 | 364 |
from n_eq \<open>n \<ge> 2 * g_no\<close> have "(n - 1) div 2 \<ge> g_no" |
| 53079 | 365 |
by auto |
366 |
from g[OF this] show ?thesis |
|
| 63558 | 367 |
by (simp only: n_eq range_eq) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
368 |
qed |
| 63558 | 369 |
qed |
370 |
then show "\<exists>no. \<forall>n \<ge> no. norm (?Sa n - l) < r" by blast |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
371 |
qed |
| 63558 | 372 |
then have sums_l: "(\<lambda>i. (-1)^i * a i) sums l" |
373 |
by (simp only: sums_def) |
|
374 |
then show "summable ?S" |
|
375 |
by (auto simp: summable_def) |
|
376 |
||
377 |
have "l = suminf ?S" by (rule sums_unique[OF sums_l]) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
378 |
|
| 53079 | 379 |
fix n |
380 |
show "suminf ?S \<le> ?g n" |
|
381 |
unfolding sums_unique[OF sums_l, symmetric] using above_l by auto |
|
382 |
show "?f n \<le> suminf ?S" |
|
383 |
unfolding sums_unique[OF sums_l, symmetric] using below_l by auto |
|
| 61969 | 384 |
show "?g \<longlonglongrightarrow> suminf ?S" |
385 |
using \<open>?g \<longlonglongrightarrow> l\<close> \<open>l = suminf ?S\<close> by auto |
|
386 |
show "?f \<longlonglongrightarrow> suminf ?S" |
|
387 |
using \<open>?f \<longlonglongrightarrow> l\<close> \<open>l = suminf ?S\<close> by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
388 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
389 |
|
| 53079 | 390 |
theorem summable_Leibniz: |
391 |
fixes a :: "nat \<Rightarrow> real" |
|
| 63558 | 392 |
assumes a_zero: "a \<longlonglongrightarrow> 0" |
393 |
and "monoseq a" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
394 |
shows "summable (\<lambda> n. (-1)^n * a n)" (is "?summable") |
| 53079 | 395 |
and "0 < a 0 \<longrightarrow> |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
396 |
(\<forall>n. (\<Sum>i. (- 1)^i*a i) \<in> { \<Sum>i<2*n. (- 1)^i * a i .. \<Sum>i<2*n+1. (- 1)^i * a i})" (is "?pos")
|
| 53079 | 397 |
and "a 0 < 0 \<longrightarrow> |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
398 |
(\<forall>n. (\<Sum>i. (- 1)^i*a i) \<in> { \<Sum>i<2*n+1. (- 1)^i * a i .. \<Sum>i<2*n. (- 1)^i * a i})" (is "?neg")
|
| 61969 | 399 |
and "(\<lambda>n. \<Sum>i<2*n. (- 1)^i*a i) \<longlonglongrightarrow> (\<Sum>i. (- 1)^i*a i)" (is "?f") |
400 |
and "(\<lambda>n. \<Sum>i<2*n+1. (- 1)^i*a i) \<longlonglongrightarrow> (\<Sum>i. (- 1)^i*a i)" (is "?g") |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
401 |
proof - |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
402 |
have "?summable \<and> ?pos \<and> ?neg \<and> ?f \<and> ?g" |
| 63558 | 403 |
proof (cases "(\<forall>n. 0 \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)") |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
404 |
case True |
| 63558 | 405 |
then have ord: "\<And>n m. m \<le> n \<Longrightarrow> a n \<le> a m" |
406 |
and ge0: "\<And>n. 0 \<le> a n" |
|
| 53079 | 407 |
by auto |
| 63558 | 408 |
have mono: "a (Suc n) \<le> a n" for n |
409 |
using ord[where n="Suc n" and m=n] by auto |
|
| 61969 | 410 |
note leibniz = summable_Leibniz'[OF \<open>a \<longlonglongrightarrow> 0\<close> ge0] |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
411 |
from leibniz[OF mono] |
| 60758 | 412 |
show ?thesis using \<open>0 \<le> a 0\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
413 |
next |
| 63558 | 414 |
let ?a = "\<lambda>n. - a n" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
415 |
case False |
| 61969 | 416 |
with monoseq_le[OF \<open>monoseq a\<close> \<open>a \<longlonglongrightarrow> 0\<close>] |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
417 |
have "(\<forall> n. a n \<le> 0) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n)" by auto |
| 63558 | 418 |
then have ord: "\<And>n m. m \<le> n \<Longrightarrow> ?a n \<le> ?a m" and ge0: "\<And> n. 0 \<le> ?a n" |
| 53079 | 419 |
by auto |
| 63558 | 420 |
have monotone: "?a (Suc n) \<le> ?a n" for n |
421 |
using ord[where n="Suc n" and m=n] by auto |
|
| 53079 | 422 |
note leibniz = |
423 |
summable_Leibniz'[OF _ ge0, of "\<lambda>x. x", |
|
| 61969 | 424 |
OF tendsto_minus[OF \<open>a \<longlonglongrightarrow> 0\<close>, unfolded minus_zero] monotone] |
| 53079 | 425 |
have "summable (\<lambda> n. (-1)^n * ?a n)" |
426 |
using leibniz(1) by auto |
|
427 |
then obtain l where "(\<lambda> n. (-1)^n * ?a n) sums l" |
|
428 |
unfolding summable_def by auto |
|
429 |
from this[THEN sums_minus] have "(\<lambda> n. (-1)^n * a n) sums -l" |
|
430 |
by auto |
|
| 63558 | 431 |
then have ?summable by (auto simp: summable_def) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
432 |
moreover |
| 63558 | 433 |
have "\<bar>- a - - b\<bar> = \<bar>a - b\<bar>" for a b :: real |
| 53079 | 434 |
unfolding minus_diff_minus by auto |
| 41970 | 435 |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
436 |
from suminf_minus[OF leibniz(1), unfolded mult_minus_right minus_minus] |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
437 |
have move_minus: "(\<Sum>n. - ((- 1) ^ n * a n)) = - (\<Sum>n. (- 1) ^ n * a n)" |
| 53079 | 438 |
by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
439 |
|
| 60758 | 440 |
have ?pos using \<open>0 \<le> ?a 0\<close> by auto |
| 53079 | 441 |
moreover have ?neg |
442 |
using leibniz(2,4) |
|
443 |
unfolding mult_minus_right setsum_negf move_minus neg_le_iff_le |
|
444 |
by auto |
|
445 |
moreover have ?f and ?g |
|
446 |
using leibniz(3,5)[unfolded mult_minus_right setsum_negf move_minus, THEN tendsto_minus_cancel] |
|
447 |
by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
448 |
ultimately show ?thesis by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
449 |
qed |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
450 |
then show ?summable and ?pos and ?neg and ?f and ?g |
| 54573 | 451 |
by safe |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
452 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
453 |
|
| 63558 | 454 |
|
| 60758 | 455 |
subsection \<open>Term-by-Term Differentiability of Power Series\<close> |
| 23043 | 456 |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
457 |
definition diffs :: "(nat \<Rightarrow> 'a::ring_1) \<Rightarrow> nat \<Rightarrow> 'a" |
|
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
458 |
where "diffs c = (\<lambda>n. of_nat (Suc n) * c (Suc n))" |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
459 |
|
| 63558 | 460 |
text \<open>Lemma about distributing negation over it.\<close> |
| 53079 | 461 |
lemma diffs_minus: "diffs (\<lambda>n. - c n) = (\<lambda>n. - diffs c n)" |
462 |
by (simp add: diffs_def) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
463 |
|
| 15229 | 464 |
lemma diffs_equiv: |
| 63558 | 465 |
fixes x :: "'a::{real_normed_vector,ring_1}"
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
466 |
shows "summable (\<lambda>n. diffs c n * x^n) \<Longrightarrow> |
| 63558 | 467 |
(\<lambda>n. of_nat n * c n * x^(n - Suc 0)) sums (\<Sum>n. diffs c n * x^n)" |
| 53079 | 468 |
unfolding diffs_def |
| 54573 | 469 |
by (simp add: summable_sums sums_Suc_imp) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
470 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
471 |
lemma lemma_termdiff1: |
| 63558 | 472 |
fixes z :: "'a :: {monoid_mult,comm_ring}"
|
473 |
shows "(\<Sum>p<m. (((z + h) ^ (m - p)) * (z ^ p)) - (z ^ m)) = |
|
474 |
(\<Sum>p<m. (z ^ p) * (((z + h) ^ (m - p)) - (z ^ (m - p))))" |
|
| 53079 | 475 |
by (auto simp add: algebra_simps power_add [symmetric]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
476 |
|
| 63558 | 477 |
lemma sumr_diff_mult_const2: "setsum f {..<n} - of_nat n * r = (\<Sum>i<n. f i - r)"
|
478 |
for r :: "'a::ring_1" |
|
| 53079 | 479 |
by (simp add: setsum_subtractf) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
480 |
|
| 60162 | 481 |
lemma lemma_realpow_rev_sumr: |
| 63558 | 482 |
"(\<Sum>p<Suc n. (x ^ p) * (y ^ (n - p))) = (\<Sum>p<Suc n. (x ^ (n - p)) * (y ^ p))" |
| 60162 | 483 |
by (subst nat_diff_setsum_reindex[symmetric]) simp |
484 |
||
| 15229 | 485 |
lemma lemma_termdiff2: |
| 63558 | 486 |
fixes h :: "'a::field" |
| 53079 | 487 |
assumes h: "h \<noteq> 0" |
| 63558 | 488 |
shows "((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0) = |
489 |
h * (\<Sum>p< n - Suc 0. \<Sum>q< n - Suc 0 - p. (z + h) ^ q * z ^ (n - 2 - q))" |
|
490 |
(is "?lhs = ?rhs") |
|
491 |
apply (subgoal_tac "h * ?lhs = h * ?rhs") |
|
492 |
apply (simp add: h) |
|
| 53079 | 493 |
apply (simp add: right_diff_distrib diff_divide_distrib h) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
494 |
apply (simp add: mult.assoc [symmetric]) |
| 63558 | 495 |
apply (cases n) |
496 |
apply simp |
|
497 |
apply (simp add: diff_power_eq_setsum h right_diff_distrib [symmetric] mult.assoc |
|
498 |
del: power_Suc setsum_lessThan_Suc of_nat_Suc) |
|
| 53079 | 499 |
apply (subst lemma_realpow_rev_sumr) |
500 |
apply (subst sumr_diff_mult_const2) |
|
501 |
apply simp |
|
502 |
apply (simp only: lemma_termdiff1 setsum_right_distrib) |
|
| 57418 | 503 |
apply (rule setsum.cong [OF refl]) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
504 |
apply (simp add: less_iff_Suc_add) |
| 63558 | 505 |
apply clarify |
| 60162 | 506 |
apply (simp add: setsum_right_distrib diff_power_eq_setsum ac_simps |
| 63558 | 507 |
del: setsum_lessThan_Suc power_Suc) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
508 |
apply (subst mult.assoc [symmetric], subst power_add [symmetric]) |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
509 |
apply (simp add: ac_simps) |
| 53079 | 510 |
done |
| 20860 | 511 |
|
512 |
lemma real_setsum_nat_ivl_bounded2: |
|
|
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34974
diff
changeset
|
513 |
fixes K :: "'a::linordered_semidom" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
514 |
assumes f: "\<And>p::nat. p < n \<Longrightarrow> f p \<le> K" |
| 53079 | 515 |
and K: "0 \<le> K" |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
516 |
shows "setsum f {..<n-k} \<le> of_nat n * K"
|
| 53079 | 517 |
apply (rule order_trans [OF setsum_mono]) |
| 63558 | 518 |
apply (rule f) |
519 |
apply simp |
|
| 53079 | 520 |
apply (simp add: mult_right_mono K) |
521 |
done |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
522 |
|
| 15229 | 523 |
lemma lemma_termdiff3: |
| 63558 | 524 |
fixes h z :: "'a::real_normed_field" |
| 20860 | 525 |
assumes 1: "h \<noteq> 0" |
| 53079 | 526 |
and 2: "norm z \<le> K" |
527 |
and 3: "norm (z + h) \<le> K" |
|
| 63558 | 528 |
shows "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) \<le> |
529 |
of_nat n * of_nat (n - Suc 0) * K ^ (n - 2) * norm h" |
|
| 20860 | 530 |
proof - |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
531 |
have "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) = |
| 63558 | 532 |
norm (\<Sum>p<n - Suc 0. \<Sum>q<n - Suc 0 - p. (z + h) ^ q * z ^ (n - 2 - q)) * norm h" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
533 |
by (metis (lifting, no_types) lemma_termdiff2 [OF 1] mult.commute norm_mult) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
534 |
also have "\<dots> \<le> of_nat n * (of_nat (n - Suc 0) * K ^ (n - 2)) * norm h" |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
535 |
proof (rule mult_right_mono [OF _ norm_ge_zero]) |
| 53079 | 536 |
from norm_ge_zero 2 have K: "0 \<le> K" |
537 |
by (rule order_trans) |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
538 |
have le_Kn: "\<And>i j n. i + j = n \<Longrightarrow> norm ((z + h) ^ i * z ^ j) \<le> K ^ n" |
| 20860 | 539 |
apply (erule subst) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
540 |
apply (simp only: norm_mult norm_power power_add) |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
541 |
apply (intro mult_mono power_mono 2 3 norm_ge_zero zero_le_power K) |
| 20860 | 542 |
done |
| 63558 | 543 |
show "norm (\<Sum>p<n - Suc 0. \<Sum>q<n - Suc 0 - p. (z + h) ^ q * z ^ (n - 2 - q)) \<le> |
544 |
of_nat n * (of_nat (n - Suc 0) * K ^ (n - 2))" |
|
| 20860 | 545 |
apply (intro |
| 63558 | 546 |
order_trans [OF norm_setsum] |
547 |
real_setsum_nat_ivl_bounded2 |
|
548 |
mult_nonneg_nonneg |
|
549 |
of_nat_0_le_iff |
|
550 |
zero_le_power K) |
|
551 |
apply (rule le_Kn) |
|
552 |
apply simp |
|
| 20860 | 553 |
done |
554 |
qed |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
555 |
also have "\<dots> = of_nat n * of_nat (n - Suc 0) * K ^ (n - 2) * norm h" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
556 |
by (simp only: mult.assoc) |
| 20860 | 557 |
finally show ?thesis . |
558 |
qed |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
559 |
|
| 20860 | 560 |
lemma lemma_termdiff4: |
| 56167 | 561 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" |
| 63558 | 562 |
and k :: real |
563 |
assumes k: "0 < k" |
|
564 |
and le: "\<And>h. h \<noteq> 0 \<Longrightarrow> norm h < k \<Longrightarrow> norm (f h) \<le> K * norm h" |
|
| 61976 | 565 |
shows "f \<midarrow>0\<rightarrow> 0" |
| 56167 | 566 |
proof (rule tendsto_norm_zero_cancel) |
| 61976 | 567 |
show "(\<lambda>h. norm (f h)) \<midarrow>0\<rightarrow> 0" |
| 56167 | 568 |
proof (rule real_tendsto_sandwich) |
569 |
show "eventually (\<lambda>h. 0 \<le> norm (f h)) (at 0)" |
|
| 20860 | 570 |
by simp |
| 56167 | 571 |
show "eventually (\<lambda>h. norm (f h) \<le> K * norm h) (at 0)" |
572 |
using k by (auto simp add: eventually_at dist_norm le) |
|
| 61976 | 573 |
show "(\<lambda>h. 0) \<midarrow>(0::'a)\<rightarrow> (0::real)" |
| 56167 | 574 |
by (rule tendsto_const) |
| 61976 | 575 |
have "(\<lambda>h. K * norm h) \<midarrow>(0::'a)\<rightarrow> K * norm (0::'a)" |
| 56167 | 576 |
by (intro tendsto_intros) |
| 61976 | 577 |
then show "(\<lambda>h. K * norm h) \<midarrow>(0::'a)\<rightarrow> 0" |
| 56167 | 578 |
by simp |
| 20860 | 579 |
qed |
580 |
qed |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
581 |
|
| 15229 | 582 |
lemma lemma_termdiff5: |
| 56167 | 583 |
fixes g :: "'a::real_normed_vector \<Rightarrow> nat \<Rightarrow> 'b::banach" |
| 63558 | 584 |
and k :: real |
585 |
assumes k: "0 < k" |
|
586 |
and f: "summable f" |
|
587 |
and le: "\<And>h n. h \<noteq> 0 \<Longrightarrow> norm h < k \<Longrightarrow> norm (g h n) \<le> f n * norm h" |
|
| 61976 | 588 |
shows "(\<lambda>h. suminf (g h)) \<midarrow>0\<rightarrow> 0" |
| 20860 | 589 |
proof (rule lemma_termdiff4 [OF k]) |
| 63558 | 590 |
fix h :: 'a |
| 53079 | 591 |
assume "h \<noteq> 0" and "norm h < k" |
| 63558 | 592 |
then have 1: "\<forall>n. norm (g h n) \<le> f n * norm h" |
| 20860 | 593 |
by (simp add: le) |
| 63558 | 594 |
then have "\<exists>N. \<forall>n\<ge>N. norm (norm (g h n)) \<le> f n * norm h" |
| 20860 | 595 |
by simp |
| 63558 | 596 |
moreover from f have 2: "summable (\<lambda>n. f n * norm h)" |
| 20860 | 597 |
by (rule summable_mult2) |
| 63558 | 598 |
ultimately have 3: "summable (\<lambda>n. norm (g h n))" |
| 20860 | 599 |
by (rule summable_comparison_test) |
| 63558 | 600 |
then have "norm (suminf (g h)) \<le> (\<Sum>n. norm (g h n))" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
601 |
by (rule summable_norm) |
| 63558 | 602 |
also from 1 3 2 have "(\<Sum>n. norm (g h n)) \<le> (\<Sum>n. f n * norm h)" |
| 56213 | 603 |
by (rule suminf_le) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
604 |
also from f have "(\<Sum>n. f n * norm h) = suminf f * norm h" |
| 20860 | 605 |
by (rule suminf_mult2 [symmetric]) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
606 |
finally show "norm (suminf (g h)) \<le> suminf f * norm h" . |
| 20860 | 607 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
608 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
609 |
|
| 63558 | 610 |
(* FIXME: Long proofs *) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
611 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
612 |
lemma termdiffs_aux: |
| 31017 | 613 |
fixes x :: "'a::{real_normed_field,banach}"
|
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
614 |
assumes 1: "summable (\<lambda>n. diffs (diffs c) n * K ^ n)" |
| 53079 | 615 |
and 2: "norm x < norm K" |
| 63558 | 616 |
shows "(\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0))) \<midarrow>0\<rightarrow> 0" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
617 |
proof - |
| 63558 | 618 |
from dense [OF 2] obtain r where r1: "norm x < r" and r2: "r < norm K" |
619 |
by fast |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
620 |
from norm_ge_zero r1 have r: "0 < r" |
| 20860 | 621 |
by (rule order_le_less_trans) |
| 63558 | 622 |
then have r_neq_0: "r \<noteq> 0" by simp |
| 20860 | 623 |
show ?thesis |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
624 |
proof (rule lemma_termdiff5) |
| 63558 | 625 |
show "0 < r - norm x" |
626 |
using r1 by simp |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
627 |
from r r2 have "norm (of_real r::'a) < norm K" |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
628 |
by simp |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
629 |
with 1 have "summable (\<lambda>n. norm (diffs (diffs c) n * (of_real r ^ n)))" |
| 20860 | 630 |
by (rule powser_insidea) |
| 63558 | 631 |
then have "summable (\<lambda>n. diffs (diffs (\<lambda>n. norm (c n))) n * r ^ n)" |
632 |
using r by (simp add: diffs_def norm_mult norm_power del: of_nat_Suc) |
|
633 |
then have "summable (\<lambda>n. of_nat n * diffs (\<lambda>n. norm (c n)) n * r ^ (n - Suc 0))" |
|
| 20860 | 634 |
by (rule diffs_equiv [THEN sums_summable]) |
| 53079 | 635 |
also have "(\<lambda>n. of_nat n * diffs (\<lambda>n. norm (c n)) n * r ^ (n - Suc 0)) = |
636 |
(\<lambda>n. diffs (\<lambda>m. of_nat (m - Suc 0) * norm (c m) * inverse r) n * (r ^ n))" |
|
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
637 |
apply (rule ext) |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
638 |
apply (simp add: diffs_def) |
| 63558 | 639 |
apply (case_tac n) |
640 |
apply (simp_all add: r_neq_0) |
|
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
641 |
done |
| 41970 | 642 |
finally have "summable |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
643 |
(\<lambda>n. of_nat n * (of_nat (n - Suc 0) * norm (c n) * inverse r) * r ^ (n - Suc 0))" |
| 20860 | 644 |
by (rule diffs_equiv [THEN sums_summable]) |
645 |
also have |
|
| 63558 | 646 |
"(\<lambda>n. of_nat n * (of_nat (n - Suc 0) * norm (c n) * inverse r) * r ^ (n - Suc 0)) = |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
647 |
(\<lambda>n. norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2))" |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
648 |
apply (rule ext) |
| 63558 | 649 |
apply (case_tac n) |
650 |
apply simp |
|
|
55417
01fbfb60c33e
adapted to 'xxx_{case,rec}' renaming, to new theorem names, and to new variable names in theorems
blanchet
parents:
54576
diff
changeset
|
651 |
apply (rename_tac nat) |
| 63558 | 652 |
apply (case_tac nat) |
653 |
apply simp |
|
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
654 |
apply (simp add: r_neq_0) |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
655 |
done |
| 63558 | 656 |
finally show "summable (\<lambda>n. norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2))" . |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
657 |
next |
| 63558 | 658 |
fix h :: 'a |
659 |
fix n :: nat |
|
| 20860 | 660 |
assume h: "h \<noteq> 0" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
661 |
assume "norm h < r - norm x" |
| 63558 | 662 |
then have "norm x + norm h < r" by simp |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
663 |
with norm_triangle_ineq have xh: "norm (x + h) < r" |
| 20860 | 664 |
by (rule order_le_less_trans) |
| 63558 | 665 |
show "norm (c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0))) \<le> |
666 |
norm (c n) * of_nat n * of_nat (n - Suc 0) * r ^ (n - 2) * norm h" |
|
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
667 |
apply (simp only: norm_mult mult.assoc) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
668 |
apply (rule mult_left_mono [OF _ norm_ge_zero]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
669 |
apply (simp add: mult.assoc [symmetric]) |
| 54575 | 670 |
apply (metis h lemma_termdiff3 less_eq_real_def r1 xh) |
| 20860 | 671 |
done |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
672 |
qed |
|
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
673 |
qed |
|
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
674 |
|
| 20860 | 675 |
lemma termdiffs: |
| 31017 | 676 |
fixes K x :: "'a::{real_normed_field,banach}"
|
| 20860 | 677 |
assumes 1: "summable (\<lambda>n. c n * K ^ n)" |
| 63558 | 678 |
and 2: "summable (\<lambda>n. (diffs c) n * K ^ n)" |
679 |
and 3: "summable (\<lambda>n. (diffs (diffs c)) n * K ^ n)" |
|
680 |
and 4: "norm x < norm K" |
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
681 |
shows "DERIV (\<lambda>x. \<Sum>n. c n * x^n) x :> (\<Sum>n. (diffs c) n * x^n)" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
682 |
unfolding DERIV_def |
| 29163 | 683 |
proof (rule LIM_zero_cancel) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
684 |
show "(\<lambda>h. (suminf (\<lambda>n. c n * (x + h) ^ n) - suminf (\<lambda>n. c n * x^n)) / h |
| 61976 | 685 |
- suminf (\<lambda>n. diffs c n * x^n)) \<midarrow>0\<rightarrow> 0" |
| 20860 | 686 |
proof (rule LIM_equal2) |
| 63558 | 687 |
show "0 < norm K - norm x" |
688 |
using 4 by (simp add: less_diff_eq) |
|
| 20860 | 689 |
next |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
690 |
fix h :: 'a |
|
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
691 |
assume "norm (h - 0) < norm K - norm x" |
| 63558 | 692 |
then have "norm x + norm h < norm K" by simp |
693 |
then have 5: "norm (x + h) < norm K" |
|
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
694 |
by (rule norm_triangle_ineq [THEN order_le_less_trans]) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
695 |
have "summable (\<lambda>n. c n * x^n)" |
| 56167 | 696 |
and "summable (\<lambda>n. c n * (x + h) ^ n)" |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
697 |
and "summable (\<lambda>n. diffs c n * x^n)" |
| 56167 | 698 |
using 1 2 4 5 by (auto elim: powser_inside) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
699 |
then have "((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x^n)) / h - (\<Sum>n. diffs c n * x^n) = |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
700 |
(\<Sum>n. (c n * (x + h) ^ n - c n * x^n) / h - of_nat n * c n * x ^ (n - Suc 0))" |
| 56167 | 701 |
by (intro sums_unique sums_diff sums_divide diffs_equiv summable_sums) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
702 |
then show "((\<Sum>n. c n * (x + h) ^ n) - (\<Sum>n. c n * x^n)) / h - (\<Sum>n. diffs c n * x^n) = |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
703 |
(\<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0)))" |
| 54575 | 704 |
by (simp add: algebra_simps) |
| 20860 | 705 |
next |
| 61976 | 706 |
show "(\<lambda>h. \<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0))) \<midarrow>0\<rightarrow> 0" |
| 53079 | 707 |
by (rule termdiffs_aux [OF 3 4]) |
| 20860 | 708 |
qed |
709 |
qed |
|
710 |
||
| 60758 | 711 |
subsection \<open>The Derivative of a Power Series Has the Same Radius of Convergence\<close> |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
712 |
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
713 |
lemma termdiff_converges: |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
714 |
fixes x :: "'a::{real_normed_field,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
715 |
assumes K: "norm x < K" |
| 63558 | 716 |
and sm: "\<And>x. norm x < K \<Longrightarrow> summable(\<lambda>n. c n * x ^ n)" |
717 |
shows "summable (\<lambda>n. diffs c n * x ^ n)" |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
718 |
proof (cases "x = 0") |
| 63558 | 719 |
case True |
720 |
then show ?thesis |
|
721 |
using powser_sums_zero sums_summable by auto |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
722 |
next |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
723 |
case False |
| 63558 | 724 |
then have "K > 0" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
725 |
using K less_trans zero_less_norm_iff by blast |
| 63558 | 726 |
then obtain r :: real where r: "norm x < norm r" "norm r < K" "r > 0" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
727 |
using K False |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
728 |
by (auto simp: field_simps abs_less_iff add_pos_pos intro: that [of "(norm x + K) / 2"]) |
| 61969 | 729 |
have "(\<lambda>n. of_nat n * (x / of_real r) ^ n) \<longlonglongrightarrow> 0" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
730 |
using r by (simp add: norm_divide powser_times_n_limit_0 [of "x / of_real r"]) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
731 |
then obtain N where N: "\<And>n. n\<ge>N \<Longrightarrow> real_of_nat n * norm x ^ n < r ^ n" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
732 |
using r unfolding LIMSEQ_iff |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
733 |
apply (drule_tac x=1 in spec) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
734 |
apply (auto simp: norm_divide norm_mult norm_power field_simps) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
735 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
736 |
have "summable (\<lambda>n. (of_nat n * c n) * x ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
737 |
apply (rule summable_comparison_test' [of "\<lambda>n. norm(c n * (of_real r) ^ n)" N]) |
| 63558 | 738 |
apply (rule powser_insidea [OF sm [of "of_real ((r+K)/2)"]]) |
739 |
using N r norm_of_real [of "r + K", where 'a = 'a] |
|
740 |
apply (auto simp add: norm_divide norm_mult norm_power field_simps) |
|
741 |
apply (fastforce simp: less_eq_real_def) |
|
742 |
done |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
743 |
then have "summable (\<lambda>n. (of_nat (Suc n) * c(Suc n)) * x ^ Suc n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
744 |
using summable_iff_shift [of "\<lambda>n. of_nat n * c n * x ^ n" 1] |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
745 |
by simp |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
746 |
then have "summable (\<lambda>n. (of_nat (Suc n) * c(Suc n)) * x ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
747 |
using False summable_mult2 [of "\<lambda>n. (of_nat (Suc n) * c(Suc n) * x ^ n) * x" "inverse x"] |
| 60867 | 748 |
by (simp add: mult.assoc) (auto simp: ac_simps) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
749 |
then show ?thesis |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
750 |
by (simp add: diffs_def) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
751 |
qed |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
752 |
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
753 |
lemma termdiff_converges_all: |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
754 |
fixes x :: "'a::{real_normed_field,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
755 |
assumes "\<And>x. summable (\<lambda>n. c n * x^n)" |
| 63558 | 756 |
shows "summable (\<lambda>n. diffs c n * x^n)" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
757 |
apply (rule termdiff_converges [where K = "1 + norm x"]) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
758 |
using assms |
| 63558 | 759 |
apply auto |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
760 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
761 |
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
762 |
lemma termdiffs_strong: |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
763 |
fixes K x :: "'a::{real_normed_field,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
764 |
assumes sm: "summable (\<lambda>n. c n * K ^ n)" |
| 63558 | 765 |
and K: "norm x < norm K" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
766 |
shows "DERIV (\<lambda>x. \<Sum>n. c n * x^n) x :> (\<Sum>n. diffs c n * x^n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
767 |
proof - |
| 60762 | 768 |
have K2: "norm ((of_real (norm K) + of_real (norm x)) / 2 :: 'a) < norm K" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
769 |
using K |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
770 |
apply (auto simp: norm_divide field_simps) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
771 |
apply (rule le_less_trans [of _ "of_real (norm K) + of_real (norm x)"]) |
| 63558 | 772 |
apply (auto simp: mult_2_right norm_triangle_mono) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
773 |
done |
| 60762 | 774 |
then have [simp]: "norm ((of_real (norm K) + of_real (norm x)) :: 'a) < norm K * 2" |
775 |
by simp |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
776 |
have "summable (\<lambda>n. c n * (of_real (norm x + norm K) / 2) ^ n)" |
| 60762 | 777 |
by (metis K2 summable_norm_cancel [OF powser_insidea [OF sm]] add.commute of_real_add) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
778 |
moreover have "\<And>x. norm x < norm K \<Longrightarrow> summable (\<lambda>n. diffs c n * x ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
779 |
by (blast intro: sm termdiff_converges powser_inside) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
780 |
moreover have "\<And>x. norm x < norm K \<Longrightarrow> summable (\<lambda>n. diffs(diffs c) n * x ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
781 |
by (blast intro: sm termdiff_converges powser_inside) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
782 |
ultimately show ?thesis |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
783 |
apply (rule termdiffs [where K = "of_real (norm x + norm K) / 2"]) |
| 63558 | 784 |
apply (auto simp: field_simps) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
785 |
using K |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
786 |
apply (simp_all add: of_real_add [symmetric] del: of_real_add) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
787 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
788 |
qed |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
789 |
|
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
790 |
lemma termdiffs_strong_converges_everywhere: |
| 63558 | 791 |
fixes K x :: "'a::{real_normed_field,banach}"
|
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
792 |
assumes "\<And>y. summable (\<lambda>n. c n * y ^ n)" |
| 63558 | 793 |
shows "((\<lambda>x. \<Sum>n. c n * x^n) has_field_derivative (\<Sum>n. diffs c n * x^n)) (at x)" |
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
794 |
using termdiffs_strong[OF assms[of "of_real (norm x + 1)"], of x] |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
795 |
by (force simp del: of_real_add) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
796 |
|
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
797 |
lemma isCont_powser: |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
798 |
fixes K x :: "'a::{real_normed_field,banach}"
|
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
799 |
assumes "summable (\<lambda>n. c n * K ^ n)" |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
800 |
assumes "norm x < norm K" |
| 63558 | 801 |
shows "isCont (\<lambda>x. \<Sum>n. c n * x^n) x" |
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
802 |
using termdiffs_strong[OF assms] by (blast intro!: DERIV_isCont) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
803 |
|
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
804 |
lemmas isCont_powser' = isCont_o2[OF _ isCont_powser] |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
805 |
|
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
806 |
lemma isCont_powser_converges_everywhere: |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
807 |
fixes K x :: "'a::{real_normed_field,banach}"
|
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
808 |
assumes "\<And>y. summable (\<lambda>n. c n * y ^ n)" |
| 63558 | 809 |
shows "isCont (\<lambda>x. \<Sum>n. c n * x^n) x" |
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
810 |
using termdiffs_strong[OF assms[of "of_real (norm x + 1)"], of x] |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
811 |
by (force intro!: DERIV_isCont simp del: of_real_add) |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
812 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
813 |
lemma powser_limit_0: |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
814 |
fixes a :: "nat \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
815 |
assumes s: "0 < s" |
| 63558 | 816 |
and sm: "\<And>x. norm x < s \<Longrightarrow> (\<lambda>n. a n * x ^ n) sums (f x)" |
817 |
shows "(f \<longlongrightarrow> a 0) (at 0)" |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
818 |
proof - |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
819 |
have "summable (\<lambda>n. a n * (of_real s / 2) ^ n)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
820 |
apply (rule sums_summable [where l = "f (of_real s / 2)", OF sm]) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
821 |
using s |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
822 |
apply (auto simp: norm_divide) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
823 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
824 |
then have "((\<lambda>x. \<Sum>n. a n * x ^ n) has_field_derivative (\<Sum>n. diffs a n * 0 ^ n)) (at 0)" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
825 |
apply (rule termdiffs_strong) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
826 |
using s |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
827 |
apply (auto simp: norm_divide) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
828 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
829 |
then have "isCont (\<lambda>x. \<Sum>n. a n * x ^ n) 0" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
830 |
by (blast intro: DERIV_continuous) |
| 61973 | 831 |
then have "((\<lambda>x. \<Sum>n. a n * x ^ n) \<longlongrightarrow> a 0) (at 0)" |
| 63558 | 832 |
by (simp add: continuous_within) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
833 |
then show ?thesis |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
834 |
apply (rule Lim_transform) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
835 |
apply (auto simp add: LIM_eq) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
836 |
apply (rule_tac x="s" in exI) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
837 |
using s |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
838 |
apply (auto simp: sm [THEN sums_unique]) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
839 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
840 |
qed |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
841 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
842 |
lemma powser_limit_0_strong: |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
843 |
fixes a :: "nat \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
844 |
assumes s: "0 < s" |
| 63558 | 845 |
and sm: "\<And>x. x \<noteq> 0 \<Longrightarrow> norm x < s \<Longrightarrow> (\<lambda>n. a n * x ^ n) sums (f x)" |
846 |
shows "(f \<longlongrightarrow> a 0) (at 0)" |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
847 |
proof - |
| 61973 | 848 |
have *: "((\<lambda>x. if x = 0 then a 0 else f x) \<longlongrightarrow> a 0) (at 0)" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
849 |
apply (rule powser_limit_0 [OF s]) |
| 63558 | 850 |
apply (case_tac "x = 0") |
851 |
apply (auto simp add: powser_sums_zero sm) |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
852 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
853 |
show ?thesis |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
854 |
apply (subst LIM_equal [where g = "(\<lambda>x. if x = 0 then a 0 else f x)"]) |
| 63558 | 855 |
apply (simp_all add: *) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
856 |
done |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
857 |
qed |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
858 |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
859 |
|
| 60758 | 860 |
subsection \<open>Derivability of power series\<close> |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
861 |
|
| 53079 | 862 |
lemma DERIV_series': |
863 |
fixes f :: "real \<Rightarrow> nat \<Rightarrow> real" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
864 |
assumes DERIV_f: "\<And> n. DERIV (\<lambda> x. f x n) x0 :> (f' x0 n)" |
| 63558 | 865 |
and allf_summable: "\<And> x. x \<in> {a <..< b} \<Longrightarrow> summable (f x)"
|
866 |
and x0_in_I: "x0 \<in> {a <..< b}"
|
|
| 53079 | 867 |
and "summable (f' x0)" |
868 |
and "summable L" |
|
| 63558 | 869 |
and L_def: "\<And>n x y. x \<in> {a <..< b} \<Longrightarrow> y \<in> {a <..< b} \<Longrightarrow> \<bar>f x n - f y n\<bar> \<le> L n * \<bar>x - y\<bar>"
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
870 |
shows "DERIV (\<lambda> x. suminf (f x)) x0 :> (suminf (f' x0))" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
871 |
unfolding DERIV_def |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
872 |
proof (rule LIM_I) |
| 53079 | 873 |
fix r :: real |
| 63558 | 874 |
assume "0 < r" then have "0 < r/3" by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
875 |
|
| 41970 | 876 |
obtain N_L where N_L: "\<And> n. N_L \<le> n \<Longrightarrow> \<bar> \<Sum> i. L (i + n) \<bar> < r/3" |
| 60758 | 877 |
using suminf_exist_split[OF \<open>0 < r/3\<close> \<open>summable L\<close>] by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
878 |
|
| 41970 | 879 |
obtain N_f' where N_f': "\<And> n. N_f' \<le> n \<Longrightarrow> \<bar> \<Sum> i. f' x0 (i + n) \<bar> < r/3" |
| 60758 | 880 |
using suminf_exist_split[OF \<open>0 < r/3\<close> \<open>summable (f' x0)\<close>] by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
881 |
|
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
882 |
let ?N = "Suc (max N_L N_f')" |
| 63558 | 883 |
have "\<bar> \<Sum> i. f' x0 (i + ?N) \<bar> < r/3" (is "?f'_part < r/3") |
884 |
and L_estimate: "\<bar> \<Sum> i. L (i + ?N) \<bar> < r/3" |
|
885 |
using N_L[of "?N"] and N_f' [of "?N"] by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
886 |
|
| 53079 | 887 |
let ?diff = "\<lambda>i x. (f (x0 + x) i - f x0 i) / x" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
888 |
|
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
889 |
let ?r = "r / (3 * real ?N)" |
| 60758 | 890 |
from \<open>0 < r\<close> have "0 < ?r" by simp |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
891 |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
892 |
let ?s = "\<lambda>n. SOME s. 0 < s \<and> (\<forall> x. x \<noteq> 0 \<and> \<bar> x \<bar> < s \<longrightarrow> \<bar> ?diff n x - f' x0 n \<bar> < ?r)" |
| 63040 | 893 |
define S' where "S' = Min (?s ` {..< ?N })"
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
894 |
|
| 63558 | 895 |
have "0 < S'" |
896 |
unfolding S'_def |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
897 |
proof (rule iffD2[OF Min_gr_iff]) |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
898 |
show "\<forall>x \<in> (?s ` {..< ?N }). 0 < x"
|
| 53079 | 899 |
proof |
900 |
fix x |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
901 |
assume "x \<in> ?s ` {..<?N}"
|
|
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
902 |
then obtain n where "x = ?s n" and "n \<in> {..<?N}"
|
| 53079 | 903 |
using image_iff[THEN iffD1] by blast |
| 60758 | 904 |
from DERIV_D[OF DERIV_f[where n=n], THEN LIM_D, OF \<open>0 < ?r\<close>, unfolded real_norm_def] |
| 53079 | 905 |
obtain s where s_bound: "0 < s \<and> (\<forall>x. x \<noteq> 0 \<and> \<bar>x\<bar> < s \<longrightarrow> \<bar>?diff n x - f' x0 n\<bar> < ?r)" |
906 |
by auto |
|
| 63558 | 907 |
have "0 < ?s n" |
908 |
by (rule someI2[where a=s]) (auto simp add: s_bound simp del: of_nat_Suc) |
|
909 |
then show "0 < x" by (simp only: \<open>x = ?s n\<close>) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
910 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
911 |
qed auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
912 |
|
| 63040 | 913 |
define S where "S = min (min (x0 - a) (b - x0)) S'" |
| 63558 | 914 |
then have "0 < S" and S_a: "S \<le> x0 - a" and S_b: "S \<le> b - x0" |
| 60758 | 915 |
and "S \<le> S'" using x0_in_I and \<open>0 < S'\<close> |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
916 |
by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
917 |
|
| 63558 | 918 |
have "\<bar>(suminf (f (x0 + x)) - suminf (f x0)) / x - suminf (f' x0)\<bar> < r" |
919 |
if "x \<noteq> 0" and "\<bar>x\<bar> < S" for x |
|
920 |
proof - |
|
921 |
from that have x_in_I: "x0 + x \<in> {a <..< b}"
|
|
| 53079 | 922 |
using S_a S_b by auto |
| 41970 | 923 |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
924 |
note diff_smbl = summable_diff[OF allf_summable[OF x_in_I] allf_summable[OF x0_in_I]] |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
925 |
note div_smbl = summable_divide[OF diff_smbl] |
| 60758 | 926 |
note all_smbl = summable_diff[OF div_smbl \<open>summable (f' x0)\<close>] |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
927 |
note ign = summable_ignore_initial_segment[where k="?N"] |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
928 |
note diff_shft_smbl = summable_diff[OF ign[OF allf_summable[OF x_in_I]] ign[OF allf_summable[OF x0_in_I]]] |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
929 |
note div_shft_smbl = summable_divide[OF diff_shft_smbl] |
| 60758 | 930 |
note all_shft_smbl = summable_diff[OF div_smbl ign[OF \<open>summable (f' x0)\<close>]] |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
931 |
|
| 63558 | 932 |
have 1: "\<bar>(\<bar>?diff (n + ?N) x\<bar>)\<bar> \<le> L (n + ?N)" for n |
933 |
proof - |
|
934 |
have "\<bar>?diff (n + ?N) x\<bar> \<le> L (n + ?N) * \<bar>(x0 + x) - x0\<bar> / \<bar>x\<bar>" |
|
| 53079 | 935 |
using divide_right_mono[OF L_def[OF x_in_I x0_in_I] abs_ge_zero] |
| 63558 | 936 |
by (simp only: abs_divide) |
937 |
with \<open>x \<noteq> 0\<close> show ?thesis by auto |
|
938 |
qed |
|
939 |
note 2 = summable_rabs_comparison_test[OF _ ign[OF \<open>summable L\<close>]] |
|
940 |
from 1 have "\<bar> \<Sum> i. ?diff (i + ?N) x \<bar> \<le> (\<Sum> i. L (i + ?N))" |
|
941 |
by (metis (lifting) abs_idempotent |
|
942 |
order_trans[OF summable_rabs[OF 2] suminf_le[OF _ 2 ign[OF \<open>summable L\<close>]]]) |
|
943 |
then have "\<bar>\<Sum>i. ?diff (i + ?N) x\<bar> \<le> r / 3" (is "?L_part \<le> r/3") |
|
| 53079 | 944 |
using L_estimate by auto |
945 |
||
| 63558 | 946 |
have "\<bar>\<Sum>n<?N. ?diff n x - f' x0 n\<bar> \<le> (\<Sum>n<?N. \<bar>?diff n x - f' x0 n\<bar>)" .. |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
947 |
also have "\<dots> < (\<Sum>n<?N. ?r)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
948 |
proof (rule setsum_strict_mono) |
| 53079 | 949 |
fix n |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
950 |
assume "n \<in> {..< ?N}"
|
| 60758 | 951 |
have "\<bar>x\<bar> < S" using \<open>\<bar>x\<bar> < S\<close> . |
952 |
also have "S \<le> S'" using \<open>S \<le> S'\<close> . |
|
| 63558 | 953 |
also have "S' \<le> ?s n" |
954 |
unfolding S'_def |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
955 |
proof (rule Min_le_iff[THEN iffD2]) |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
956 |
have "?s n \<in> (?s ` {..<?N}) \<and> ?s n \<le> ?s n"
|
| 60758 | 957 |
using \<open>n \<in> {..< ?N}\<close> by auto
|
| 63558 | 958 |
then show "\<exists> a \<in> (?s ` {..<?N}). a \<le> ?s n"
|
959 |
by blast |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
960 |
qed auto |
| 53079 | 961 |
finally have "\<bar>x\<bar> < ?s n" . |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
962 |
|
| 63558 | 963 |
from DERIV_D[OF DERIV_f[where n=n], THEN LIM_D, OF \<open>0 < ?r\<close>, |
964 |
unfolded real_norm_def diff_0_right, unfolded some_eq_ex[symmetric], THEN conjunct2] |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
965 |
have "\<forall>x. x \<noteq> 0 \<and> \<bar>x\<bar> < ?s n \<longrightarrow> \<bar>?diff n x - f' x0 n\<bar> < ?r" . |
| 60758 | 966 |
with \<open>x \<noteq> 0\<close> and \<open>\<bar>x\<bar> < ?s n\<close> show "\<bar>?diff n x - f' x0 n\<bar> < ?r" |
| 53079 | 967 |
by blast |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
968 |
qed auto |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
969 |
also have "\<dots> = of_nat (card {..<?N}) * ?r"
|
| 53079 | 970 |
by (rule setsum_constant) |
| 63558 | 971 |
also have "\<dots> = real ?N * ?r" |
972 |
by simp |
|
973 |
also have "\<dots> = r/3" |
|
974 |
by (auto simp del: of_nat_Suc) |
|
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
975 |
finally have "\<bar>\<Sum>n<?N. ?diff n x - f' x0 n \<bar> < r / 3" (is "?diff_part < r / 3") . |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
976 |
|
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
977 |
from suminf_diff[OF allf_summable[OF x_in_I] allf_summable[OF x0_in_I]] |
| 53079 | 978 |
have "\<bar>(suminf (f (x0 + x)) - (suminf (f x0))) / x - suminf (f' x0)\<bar> = |
979 |
\<bar>\<Sum>n. ?diff n x - f' x0 n\<bar>" |
|
| 60758 | 980 |
unfolding suminf_diff[OF div_smbl \<open>summable (f' x0)\<close>, symmetric] |
| 53079 | 981 |
using suminf_divide[OF diff_smbl, symmetric] by auto |
| 63558 | 982 |
also have "\<dots> \<le> ?diff_part + \<bar>(\<Sum>n. ?diff (n + ?N) x) - (\<Sum> n. f' x0 (n + ?N))\<bar>" |
| 53079 | 983 |
unfolding suminf_split_initial_segment[OF all_smbl, where k="?N"] |
| 60758 | 984 |
unfolding suminf_diff[OF div_shft_smbl ign[OF \<open>summable (f' x0)\<close>]] |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
985 |
apply (subst (5) add.commute) |
| 63558 | 986 |
apply (rule abs_triangle_ineq) |
987 |
done |
|
| 53079 | 988 |
also have "\<dots> \<le> ?diff_part + ?L_part + ?f'_part" |
989 |
using abs_triangle_ineq4 by auto |
|
| 41970 | 990 |
also have "\<dots> < r /3 + r/3 + r/3" |
| 60758 | 991 |
using \<open>?diff_part < r/3\<close> \<open>?L_part \<le> r/3\<close> and \<open>?f'_part < r/3\<close> |
| 36842 | 992 |
by (rule add_strict_mono [OF add_less_le_mono]) |
| 63558 | 993 |
finally show ?thesis |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
994 |
by auto |
| 63558 | 995 |
qed |
996 |
then show "\<exists>s > 0. \<forall> x. x \<noteq> 0 \<and> norm (x - 0) < s \<longrightarrow> |
|
| 53079 | 997 |
norm (((\<Sum>n. f (x0 + x) n) - (\<Sum>n. f x0 n)) / x - (\<Sum>n. f' x0 n)) < r" |
| 63558 | 998 |
using \<open>0 < S\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
999 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1000 |
|
| 53079 | 1001 |
lemma DERIV_power_series': |
1002 |
fixes f :: "nat \<Rightarrow> real" |
|
| 63558 | 1003 |
assumes converges: "\<And>x. x \<in> {-R <..< R} \<Longrightarrow> summable (\<lambda>n. f n * real (Suc n) * x^n)"
|
1004 |
and x0_in_I: "x0 \<in> {-R <..< R}"
|
|
1005 |
and "0 < R" |
|
1006 |
shows "DERIV (\<lambda>x. (\<Sum>n. f n * x^(Suc n))) x0 :> (\<Sum>n. f n * real (Suc n) * x0^n)" |
|
1007 |
(is "DERIV (\<lambda>x. suminf (?f x)) x0 :> suminf (?f' x0)") |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1008 |
proof - |
| 63558 | 1009 |
have for_subinterval: "DERIV (\<lambda>x. suminf (?f x)) x0 :> suminf (?f' x0)" |
1010 |
if "0 < R'" and "R' < R" and "-R' < x0" and "x0 < R'" for R' |
|
1011 |
proof - |
|
1012 |
from that have "x0 \<in> {-R' <..< R'}" and "R' \<in> {-R <..< R}" and "x0 \<in> {-R <..< R}"
|
|
| 53079 | 1013 |
by auto |
| 63558 | 1014 |
show ?thesis |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1015 |
proof (rule DERIV_series') |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1016 |
show "summable (\<lambda> n. \<bar>f n * real (Suc n) * R'^n\<bar>)" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1017 |
proof - |
| 53079 | 1018 |
have "(R' + R) / 2 < R" and "0 < (R' + R) / 2" |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
1019 |
using \<open>0 < R'\<close> \<open>0 < R\<close> \<open>R' < R\<close> by (auto simp: field_simps) |
| 63558 | 1020 |
then have in_Rball: "(R' + R) / 2 \<in> {-R <..< R}"
|
| 60758 | 1021 |
using \<open>R' < R\<close> by auto |
| 53079 | 1022 |
have "norm R' < norm ((R' + R) / 2)" |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
1023 |
using \<open>0 < R'\<close> \<open>0 < R\<close> \<open>R' < R\<close> by (auto simp: field_simps) |
| 53079 | 1024 |
from powser_insidea[OF converges[OF in_Rball] this] show ?thesis |
1025 |
by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1026 |
qed |
| 63558 | 1027 |
next |
1028 |
fix n x y |
|
1029 |
assume "x \<in> {-R' <..< R'}" and "y \<in> {-R' <..< R'}"
|
|
1030 |
show "\<bar>?f x n - ?f y n\<bar> \<le> \<bar>f n * real (Suc n) * R'^n\<bar> * \<bar>x-y\<bar>" |
|
1031 |
proof - |
|
1032 |
have "\<bar>f n * x ^ (Suc n) - f n * y ^ (Suc n)\<bar> = |
|
1033 |
(\<bar>f n\<bar> * \<bar>x-y\<bar>) * \<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar>" |
|
1034 |
unfolding right_diff_distrib[symmetric] diff_power_eq_setsum abs_mult |
|
1035 |
by auto |
|
1036 |
also have "\<dots> \<le> (\<bar>f n\<bar> * \<bar>x-y\<bar>) * (\<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>)" |
|
1037 |
proof (rule mult_left_mono) |
|
1038 |
have "\<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> (\<Sum>p<Suc n. \<bar>x ^ p * y ^ (n - p)\<bar>)" |
|
1039 |
by (rule setsum_abs) |
|
1040 |
also have "\<dots> \<le> (\<Sum>p<Suc n. R' ^ n)" |
|
1041 |
proof (rule setsum_mono) |
|
1042 |
fix p |
|
1043 |
assume "p \<in> {..<Suc n}"
|
|
1044 |
then have "p \<le> n" by auto |
|
1045 |
have "\<bar>x^n\<bar> \<le> R'^n" if "x \<in> {-R'<..<R'}" for n and x :: real
|
|
1046 |
proof - |
|
1047 |
from that have "\<bar>x\<bar> \<le> R'" by auto |
|
1048 |
then show ?thesis |
|
1049 |
unfolding power_abs by (rule power_mono) auto |
|
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
1050 |
qed |
| 63558 | 1051 |
from mult_mono[OF this[OF \<open>x \<in> {-R'<..<R'}\<close>, of p] this[OF \<open>y \<in> {-R'<..<R'}\<close>, of "n-p"]]
|
1052 |
and \<open>0 < R'\<close> |
|
1053 |
have "\<bar>x^p * y^(n - p)\<bar> \<le> R'^p * R'^(n - p)" |
|
1054 |
unfolding abs_mult by auto |
|
1055 |
then show "\<bar>x^p * y^(n - p)\<bar> \<le> R'^n" |
|
1056 |
unfolding power_add[symmetric] using \<open>p \<le> n\<close> by auto |
|
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
1057 |
qed |
| 63558 | 1058 |
also have "\<dots> = real (Suc n) * R' ^ n" |
1059 |
unfolding setsum_constant card_atLeastLessThan by auto |
|
1060 |
finally show "\<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> \<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>" |
|
1061 |
unfolding abs_of_nonneg[OF zero_le_power[OF less_imp_le[OF \<open>0 < R'\<close>]]] |
|
1062 |
by linarith |
|
1063 |
show "0 \<le> \<bar>f n\<bar> * \<bar>x - y\<bar>" |
|
1064 |
unfolding abs_mult[symmetric] by auto |
|
| 53079 | 1065 |
qed |
| 63558 | 1066 |
also have "\<dots> = \<bar>f n * real (Suc n) * R' ^ n\<bar> * \<bar>x - y\<bar>" |
1067 |
unfolding abs_mult mult.assoc[symmetric] by algebra |
|
1068 |
finally show ?thesis . |
|
1069 |
qed |
|
1070 |
next |
|
1071 |
show "DERIV (\<lambda>x. ?f x n) x0 :> ?f' x0 n" for n |
|
1072 |
by (auto intro!: derivative_eq_intros simp del: power_Suc) |
|
1073 |
next |
|
1074 |
fix x |
|
1075 |
assume "x \<in> {-R' <..< R'}"
|
|
1076 |
then have "R' \<in> {-R <..< R}" and "norm x < norm R'"
|
|
1077 |
using assms \<open>R' < R\<close> by auto |
|
1078 |
have "summable (\<lambda>n. f n * x^n)" |
|
1079 |
proof (rule summable_comparison_test, intro exI allI impI) |
|
| 53079 | 1080 |
fix n |
| 63558 | 1081 |
have le: "\<bar>f n\<bar> * 1 \<le> \<bar>f n\<bar> * real (Suc n)" |
1082 |
by (rule mult_left_mono) auto |
|
1083 |
show "norm (f n * x^n) \<le> norm (f n * real (Suc n) * x^n)" |
|
1084 |
unfolding real_norm_def abs_mult |
|
1085 |
using le mult_right_mono by fastforce |
|
1086 |
qed (rule powser_insidea[OF converges[OF \<open>R' \<in> {-R <..< R}\<close>] \<open>norm x < norm R'\<close>])
|
|
1087 |
from this[THEN summable_mult2[where c=x], simplified mult.assoc, simplified mult.commute] |
|
1088 |
show "summable (?f x)" by auto |
|
1089 |
next |
|
| 53079 | 1090 |
show "summable (?f' x0)" |
| 60758 | 1091 |
using converges[OF \<open>x0 \<in> {-R <..< R}\<close>] .
|
| 53079 | 1092 |
show "x0 \<in> {-R' <..< R'}"
|
| 60758 | 1093 |
using \<open>x0 \<in> {-R' <..< R'}\<close> .
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1094 |
qed |
| 63558 | 1095 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1096 |
let ?R = "(R + \<bar>x0\<bar>) / 2" |
| 63558 | 1097 |
have "\<bar>x0\<bar> < ?R" |
1098 |
using assms by (auto simp: field_simps) |
|
1099 |
then have "- ?R < x0" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1100 |
proof (cases "x0 < 0") |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1101 |
case True |
| 63558 | 1102 |
then have "- x0 < ?R" |
1103 |
using \<open>\<bar>x0\<bar> < ?R\<close> by auto |
|
1104 |
then show ?thesis |
|
1105 |
unfolding neg_less_iff_less[symmetric, of "- x0"] by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1106 |
next |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1107 |
case False |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1108 |
have "- ?R < 0" using assms by auto |
| 41970 | 1109 |
also have "\<dots> \<le> x0" using False by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1110 |
finally show ?thesis . |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1111 |
qed |
| 63558 | 1112 |
then have "0 < ?R" "?R < R" "- ?R < x0" and "x0 < ?R" |
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
1113 |
using assms by (auto simp: field_simps) |
| 63558 | 1114 |
from for_subinterval[OF this] show ?thesis . |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1115 |
qed |
| 29695 | 1116 |
|
| 53079 | 1117 |
|
| 63558 | 1118 |
lemma isCont_pochhammer [continuous_intros]: "isCont (\<lambda>z. pochhammer z n) z" |
1119 |
for z :: "'a::real_normed_field" |
|
1120 |
by (induct n) (auto simp: pochhammer_rec') |
|
1121 |
||
1122 |
lemma continuous_on_pochhammer [continuous_intros]: "continuous_on A (\<lambda>z. pochhammer z n)" |
|
1123 |
for A :: "'a::real_normed_field set" |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1124 |
by (intro continuous_at_imp_continuous_on ballI isCont_pochhammer) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1125 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1126 |
|
| 60758 | 1127 |
subsection \<open>Exponential Function\<close> |
| 23043 | 1128 |
|
| 58656 | 1129 |
definition exp :: "'a \<Rightarrow> 'a::{real_normed_algebra_1,banach}"
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1130 |
where "exp = (\<lambda>x. \<Sum>n. x^n /\<^sub>R fact n)" |
| 23043 | 1131 |
|
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1132 |
lemma summable_exp_generic: |
| 31017 | 1133 |
fixes x :: "'a::{real_normed_algebra_1,banach}"
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1134 |
defines S_def: "S \<equiv> \<lambda>n. x^n /\<^sub>R fact n" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1135 |
shows "summable S" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1136 |
proof - |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1137 |
have S_Suc: "\<And>n. S (Suc n) = (x * S n) /\<^sub>R (Suc n)" |
|
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
1138 |
unfolding S_def by (simp del: mult_Suc) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1139 |
obtain r :: real where r0: "0 < r" and r1: "r < 1" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1140 |
using dense [OF zero_less_one] by fast |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1141 |
obtain N :: nat where N: "norm x < real N * r" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1142 |
using ex_less_of_nat_mult r0 by auto |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1143 |
from r1 show ?thesis |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1144 |
proof (rule summable_ratio_test [rule_format]) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1145 |
fix n :: nat |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1146 |
assume n: "N \<le> n" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1147 |
have "norm x \<le> real N * r" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1148 |
using N by (rule order_less_imp_le) |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1149 |
also have "real N * r \<le> real (Suc n) * r" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1150 |
using r0 n by (simp add: mult_right_mono) |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1151 |
finally have "norm x * norm (S n) \<le> real (Suc n) * r * norm (S n)" |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1152 |
using norm_ge_zero by (rule mult_right_mono) |
| 63558 | 1153 |
then have "norm (x * S n) \<le> real (Suc n) * r * norm (S n)" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1154 |
by (rule order_trans [OF norm_mult_ineq]) |
| 63558 | 1155 |
then have "norm (x * S n) / real (Suc n) \<le> r * norm (S n)" |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
1156 |
by (simp add: pos_divide_le_eq ac_simps) |
| 63558 | 1157 |
then show "norm (S (Suc n)) \<le> r * norm (S n)" |
| 35216 | 1158 |
by (simp add: S_Suc inverse_eq_divide) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1159 |
qed |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1160 |
qed |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1161 |
|
| 63558 | 1162 |
lemma summable_norm_exp: "summable (\<lambda>n. norm (x^n /\<^sub>R fact n))" |
1163 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1164 |
proof (rule summable_norm_comparison_test [OF exI, rule_format]) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1165 |
show "summable (\<lambda>n. norm x^n /\<^sub>R fact n)" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1166 |
by (rule summable_exp_generic) |
| 63558 | 1167 |
show "norm (x^n /\<^sub>R fact n) \<le> norm x^n /\<^sub>R fact n" for n |
| 35216 | 1168 |
by (simp add: norm_power_ineq) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1169 |
qed |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1170 |
|
| 63558 | 1171 |
lemma summable_exp: "summable (\<lambda>n. inverse (fact n) * x^n)" |
1172 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1173 |
using summable_exp_generic [where x=x] |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1174 |
by (simp add: scaleR_conv_of_real nonzero_of_real_inverse) |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1175 |
|
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1176 |
lemma exp_converges: "(\<lambda>n. x^n /\<^sub>R fact n) sums exp x" |
| 53079 | 1177 |
unfolding exp_def by (rule summable_exp_generic [THEN summable_sums]) |
| 23043 | 1178 |
|
| 41970 | 1179 |
lemma exp_fdiffs: |
| 60241 | 1180 |
"diffs (\<lambda>n. inverse (fact n)) = (\<lambda>n. inverse (fact n :: 'a::{real_normed_field,banach}))"
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1181 |
by (simp add: diffs_def mult_ac nonzero_inverse_mult_distrib nonzero_of_real_inverse |
| 63558 | 1182 |
del: mult_Suc of_nat_Suc) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1183 |
|
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1184 |
lemma diffs_of_real: "diffs (\<lambda>n. of_real (f n)) = (\<lambda>n. of_real (diffs f n))" |
| 53079 | 1185 |
by (simp add: diffs_def) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1186 |
|
| 63558 | 1187 |
lemma DERIV_exp [simp]: "DERIV exp x :> exp x" |
| 53079 | 1188 |
unfolding exp_def scaleR_conv_of_real |
1189 |
apply (rule DERIV_cong) |
|
| 63558 | 1190 |
apply (rule termdiffs [where K="of_real (1 + norm x)"]) |
1191 |
apply (simp_all only: diffs_of_real scaleR_conv_of_real exp_fdiffs) |
|
1192 |
apply (rule exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real])+ |
|
| 53079 | 1193 |
apply (simp del: of_real_add) |
1194 |
done |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1195 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1196 |
declare DERIV_exp[THEN DERIV_chain2, derivative_intros] |
| 63558 | 1197 |
and DERIV_exp[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
| 51527 | 1198 |
|
| 58656 | 1199 |
lemma norm_exp: "norm (exp x) \<le> exp (norm x)" |
1200 |
proof - |
|
1201 |
from summable_norm[OF summable_norm_exp, of x] |
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1202 |
have "norm (exp x) \<le> (\<Sum>n. inverse (fact n) * norm (x^n))" |
| 58656 | 1203 |
by (simp add: exp_def) |
1204 |
also have "\<dots> \<le> exp (norm x)" |
|
1205 |
using summable_exp_generic[of "norm x"] summable_norm_exp[of x] |
|
1206 |
by (auto simp: exp_def intro!: suminf_le norm_power_ineq) |
|
1207 |
finally show ?thesis . |
|
1208 |
qed |
|
1209 |
||
| 63558 | 1210 |
lemma isCont_exp: "isCont exp x" |
1211 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 1212 |
by (rule DERIV_exp [THEN DERIV_isCont]) |
1213 |
||
| 63558 | 1214 |
lemma isCont_exp' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. exp (f x)) a" |
1215 |
for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
|
|
| 44311 | 1216 |
by (rule isCont_o2 [OF _ isCont_exp]) |
1217 |
||
| 63558 | 1218 |
lemma tendsto_exp [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. exp (f x)) \<longlongrightarrow> exp a) F" |
1219 |
for f:: "_ \<Rightarrow>'a::{real_normed_field,banach}"
|
|
| 44311 | 1220 |
by (rule isCont_tendsto_compose [OF isCont_exp]) |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
1221 |
|
| 63558 | 1222 |
lemma continuous_exp [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. exp (f x))" |
1223 |
for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1224 |
unfolding continuous_def by (rule tendsto_exp) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1225 |
|
| 63558 | 1226 |
lemma continuous_on_exp [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. exp (f x))" |
1227 |
for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1228 |
unfolding continuous_on_def by (auto intro: tendsto_exp) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1229 |
|
| 53079 | 1230 |
|
| 60758 | 1231 |
subsubsection \<open>Properties of the Exponential Function\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1232 |
|
| 23278 | 1233 |
lemma exp_zero [simp]: "exp 0 = 1" |
| 63558 | 1234 |
unfolding exp_def by (simp add: scaleR_conv_of_real) |
| 23278 | 1235 |
|
| 58656 | 1236 |
lemma exp_series_add_commuting: |
| 63558 | 1237 |
fixes x y :: "'a::{real_normed_algebra_1,banach}"
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1238 |
defines S_def: "S \<equiv> \<lambda>x n. x^n /\<^sub>R fact n" |
| 58656 | 1239 |
assumes comm: "x * y = y * x" |
| 56213 | 1240 |
shows "S (x + y) n = (\<Sum>i\<le>n. S x i * S y (n - i))" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1241 |
proof (induct n) |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1242 |
case 0 |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1243 |
show ?case |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1244 |
unfolding S_def by simp |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1245 |
next |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1246 |
case (Suc n) |
| 25062 | 1247 |
have S_Suc: "\<And>x n. S x (Suc n) = (x * S x n) /\<^sub>R real (Suc n)" |
|
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
1248 |
unfolding S_def by (simp del: mult_Suc) |
| 63558 | 1249 |
then have times_S: "\<And>x n. x * S x n = real (Suc n) *\<^sub>R S x (Suc n)" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1250 |
by simp |
| 58656 | 1251 |
have S_comm: "\<And>n. S x n * y = y * S x n" |
1252 |
by (simp add: power_commuting_commutes comm S_def) |
|
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1253 |
|
| 25062 | 1254 |
have "real (Suc n) *\<^sub>R S (x + y) (Suc n) = (x + y) * S (x + y) n" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1255 |
by (simp only: times_S) |
| 63558 | 1256 |
also have "\<dots> = (x + y) * (\<Sum>i\<le>n. S x i * S y (n - i))" |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1257 |
by (simp only: Suc) |
| 63558 | 1258 |
also have "\<dots> = x * (\<Sum>i\<le>n. S x i * S y (n - i)) + y * (\<Sum>i\<le>n. S x i * S y (n - i))" |
|
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
47489
diff
changeset
|
1259 |
by (rule distrib_right) |
| 63558 | 1260 |
also have "\<dots> = (\<Sum>i\<le>n. x * S x i * S y (n - i)) + (\<Sum>i\<le>n. S x i * y * S y (n - i))" |
| 58656 | 1261 |
by (simp add: setsum_right_distrib ac_simps S_comm) |
| 63558 | 1262 |
also have "\<dots> = (\<Sum>i\<le>n. x * S x i * S y (n - i)) + (\<Sum>i\<le>n. S x i * (y * S y (n - i)))" |
| 58656 | 1263 |
by (simp add: ac_simps) |
| 63558 | 1264 |
also have "\<dots> = (\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) + |
1265 |
(\<Sum>i\<le>n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i)))" |
|
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1266 |
by (simp add: times_S Suc_diff_le) |
| 63558 | 1267 |
also have "(\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) = |
1268 |
(\<Sum>i\<le>Suc n. real i *\<^sub>R (S x i * S y (Suc n - i)))" |
|
| 56213 | 1269 |
by (subst setsum_atMost_Suc_shift) simp |
| 63558 | 1270 |
also have "(\<Sum>i\<le>n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i))) = |
1271 |
(\<Sum>i\<le>Suc n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i)))" |
|
| 56213 | 1272 |
by simp |
| 63558 | 1273 |
also have "(\<Sum>i\<le>Suc n. real i *\<^sub>R (S x i * S y (Suc n - i))) + |
1274 |
(\<Sum>i\<le>Suc n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i))) = |
|
1275 |
(\<Sum>i\<le>Suc n. real (Suc n) *\<^sub>R (S x i * S y (Suc n - i)))" |
|
| 57418 | 1276 |
by (simp only: setsum.distrib [symmetric] scaleR_left_distrib [symmetric] |
| 63558 | 1277 |
of_nat_add [symmetric]) simp |
1278 |
also have "\<dots> = real (Suc n) *\<^sub>R (\<Sum>i\<le>Suc n. S x i * S y (Suc n - i))" |
|
| 23127 | 1279 |
by (simp only: scaleR_right.setsum) |
| 63558 | 1280 |
finally show "S (x + y) (Suc n) = (\<Sum>i\<le>Suc n. S x i * S y (Suc n - i))" |
| 35216 | 1281 |
by (simp del: setsum_cl_ivl_Suc) |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1282 |
qed |
|
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1283 |
|
| 58656 | 1284 |
lemma exp_add_commuting: "x * y = y * x \<Longrightarrow> exp (x + y) = exp x * exp y" |
| 63558 | 1285 |
by (simp only: exp_def Cauchy_product summable_norm_exp exp_series_add_commuting) |
| 58656 | 1286 |
|
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1287 |
lemma exp_times_arg_commute: "exp A * A = A * exp A" |
|
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1288 |
by (simp add: exp_def suminf_mult[symmetric] summable_exp_generic power_commutes suminf_mult2) |
|
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1289 |
|
| 63558 | 1290 |
lemma exp_add: "exp (x + y) = exp x * exp y" |
1291 |
for x y :: "'a::{real_normed_field,banach}"
|
|
| 58656 | 1292 |
by (rule exp_add_commuting) (simp add: ac_simps) |
1293 |
||
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1294 |
lemma exp_double: "exp(2 * z) = exp z ^ 2" |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1295 |
by (simp add: exp_add_commuting mult_2 power2_eq_square) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1296 |
|
| 58656 | 1297 |
lemmas mult_exp_exp = exp_add [symmetric] |
| 29170 | 1298 |
|
| 23241 | 1299 |
lemma exp_of_real: "exp (of_real x) = of_real (exp x)" |
| 53079 | 1300 |
unfolding exp_def |
1301 |
apply (subst suminf_of_real) |
|
| 63558 | 1302 |
apply (rule summable_exp_generic) |
| 53079 | 1303 |
apply (simp add: scaleR_conv_of_real) |
1304 |
done |
|
| 23241 | 1305 |
|
| 59862 | 1306 |
corollary exp_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> exp z \<in> \<real>" |
1307 |
by (metis Reals_cases Reals_of_real exp_of_real) |
|
1308 |
||
| 29170 | 1309 |
lemma exp_not_eq_zero [simp]: "exp x \<noteq> 0" |
1310 |
proof |
|
| 63558 | 1311 |
have "exp x * exp (- x) = 1" |
1312 |
by (simp add: exp_add_commuting[symmetric]) |
|
| 29170 | 1313 |
also assume "exp x = 0" |
| 63558 | 1314 |
finally show False by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1315 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1316 |
|
| 63558 | 1317 |
lemma exp_minus_inverse: "exp x * exp (- x) = 1" |
| 58656 | 1318 |
by (simp add: exp_add_commuting[symmetric]) |
1319 |
||
| 63558 | 1320 |
lemma exp_minus: "exp (- x) = inverse (exp x)" |
1321 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 58656 | 1322 |
by (intro inverse_unique [symmetric] exp_minus_inverse) |
1323 |
||
| 63558 | 1324 |
lemma exp_diff: "exp (x - y) = exp x / exp y" |
1325 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
1326 |
using exp_add [of x "- y"] by (simp add: exp_minus divide_inverse) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1327 |
|
| 63558 | 1328 |
lemma exp_of_nat_mult: "exp (of_nat n * x) = exp x ^ n" |
1329 |
for x :: "'a::{real_normed_field,banach}"
|
|
1330 |
by (induct n) (auto simp add: distrib_left exp_add mult.commute) |
|
1331 |
||
1332 |
corollary exp_real_of_nat_mult: "exp (real n * x) = exp x ^ n" |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1333 |
by (simp add: exp_of_nat_mult) |
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1334 |
|
| 63558 | 1335 |
lemma exp_setsum: "finite I \<Longrightarrow> exp (setsum f I) = setprod (\<lambda>x. exp (f x)) I" |
1336 |
by (induct I rule: finite_induct) (auto simp: exp_add_commuting mult.commute) |
|
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1337 |
|
|
62379
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1338 |
lemma exp_divide_power_eq: |
| 63558 | 1339 |
fixes x :: "'a::{real_normed_field,banach}"
|
1340 |
assumes "n > 0" |
|
1341 |
shows "exp (x / of_nat n) ^ n = exp x" |
|
1342 |
using assms |
|
|
62379
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1343 |
proof (induction n arbitrary: x) |
| 63558 | 1344 |
case 0 |
1345 |
then show ?case by simp |
|
|
62379
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1346 |
next |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1347 |
case (Suc n) |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1348 |
show ?case |
| 63558 | 1349 |
proof (cases "n = 0") |
1350 |
case True |
|
1351 |
then show ?thesis by simp |
|
|
62379
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1352 |
next |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1353 |
case False |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1354 |
then have [simp]: "x * of_nat n / (1 + of_nat n) / of_nat n = x / (1 + of_nat n)" |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1355 |
by simp |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1356 |
have [simp]: "x / (1 + of_nat n) + x * of_nat n / (1 + of_nat n) = x" |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1357 |
apply (simp add: divide_simps) |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1358 |
using of_nat_eq_0_iff apply (fastforce simp: distrib_left) |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1359 |
done |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1360 |
show ?thesis |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1361 |
using Suc.IH [of "x * of_nat n / (1 + of_nat n)"] False |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1362 |
by (simp add: exp_add [symmetric]) |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1363 |
qed |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1364 |
qed |
|
340738057c8c
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
paulson <lp15@cam.ac.uk>
parents:
62347
diff
changeset
|
1365 |
|
| 29167 | 1366 |
|
| 60758 | 1367 |
subsubsection \<open>Properties of the Exponential Function on Reals\<close> |
1368 |
||
1369 |
text \<open>Comparisons of @{term "exp x"} with zero.\<close>
|
|
1370 |
||
| 63558 | 1371 |
text \<open>Proof: because every exponential can be seen as a square.\<close> |
1372 |
lemma exp_ge_zero [simp]: "0 \<le> exp x" |
|
1373 |
for x :: real |
|
| 29167 | 1374 |
proof - |
| 63558 | 1375 |
have "0 \<le> exp (x/2) * exp (x/2)" |
1376 |
by simp |
|
1377 |
then show ?thesis |
|
1378 |
by (simp add: exp_add [symmetric]) |
|
| 29167 | 1379 |
qed |
1380 |
||
| 63558 | 1381 |
lemma exp_gt_zero [simp]: "0 < exp x" |
1382 |
for x :: real |
|
| 53079 | 1383 |
by (simp add: order_less_le) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1384 |
|
| 63558 | 1385 |
lemma not_exp_less_zero [simp]: "\<not> exp x < 0" |
1386 |
for x :: real |
|
| 53079 | 1387 |
by (simp add: not_less) |
| 29170 | 1388 |
|
| 63558 | 1389 |
lemma not_exp_le_zero [simp]: "\<not> exp x \<le> 0" |
1390 |
for x :: real |
|
| 53079 | 1391 |
by (simp add: not_le) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1392 |
|
| 63558 | 1393 |
lemma abs_exp_cancel [simp]: "\<bar>exp x\<bar> = exp x" |
1394 |
for x :: real |
|
| 53079 | 1395 |
by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1396 |
|
| 60758 | 1397 |
text \<open>Strict monotonicity of exponential.\<close> |
| 29170 | 1398 |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
1399 |
lemma exp_ge_add_one_self_aux: |
| 63558 | 1400 |
fixes x :: real |
1401 |
assumes "0 \<le> x" |
|
1402 |
shows "1 + x \<le> exp x" |
|
1403 |
using order_le_imp_less_or_eq [OF assms] |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
1404 |
proof |
| 54575 | 1405 |
assume "0 < x" |
| 63558 | 1406 |
have "1 + x \<le> (\<Sum>n<2. inverse (fact n) * x^n)" |
| 54575 | 1407 |
by (auto simp add: numeral_2_eq_2) |
| 63558 | 1408 |
also have "\<dots> \<le> (\<Sum>n. inverse (fact n) * x^n)" |
| 56213 | 1409 |
apply (rule setsum_le_suminf [OF summable_exp]) |
| 60758 | 1410 |
using \<open>0 < x\<close> |
| 54575 | 1411 |
apply (auto simp add: zero_le_mult_iff) |
1412 |
done |
|
| 63558 | 1413 |
finally show "1 + x \<le> exp x" |
| 54575 | 1414 |
by (simp add: exp_def) |
1415 |
next |
|
1416 |
assume "0 = x" |
|
1417 |
then show "1 + x \<le> exp x" |
|
1418 |
by auto |
|
1419 |
qed |
|
| 29170 | 1420 |
|
| 63558 | 1421 |
lemma exp_gt_one: "0 < x \<Longrightarrow> 1 < exp x" |
1422 |
for x :: real |
|
| 29170 | 1423 |
proof - |
1424 |
assume x: "0 < x" |
|
| 63558 | 1425 |
then have "1 < 1 + x" by simp |
| 29170 | 1426 |
also from x have "1 + x \<le> exp x" |
1427 |
by (simp add: exp_ge_add_one_self_aux) |
|
1428 |
finally show ?thesis . |
|
1429 |
qed |
|
1430 |
||
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1431 |
lemma exp_less_mono: |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1432 |
fixes x y :: real |
| 53079 | 1433 |
assumes "x < y" |
1434 |
shows "exp x < exp y" |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1435 |
proof - |
| 60758 | 1436 |
from \<open>x < y\<close> have "0 < y - x" by simp |
| 63558 | 1437 |
then have "1 < exp (y - x)" by (rule exp_gt_one) |
1438 |
then have "1 < exp y / exp x" by (simp only: exp_diff) |
|
1439 |
then show "exp x < exp y" by simp |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1440 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1441 |
|
| 63558 | 1442 |
lemma exp_less_cancel: "exp x < exp y \<Longrightarrow> x < y" |
1443 |
for x y :: real |
|
| 54575 | 1444 |
unfolding linorder_not_le [symmetric] |
1445 |
by (auto simp add: order_le_less exp_less_mono) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1446 |
|
| 63558 | 1447 |
lemma exp_less_cancel_iff [iff]: "exp x < exp y \<longleftrightarrow> x < y" |
1448 |
for x y :: real |
|
| 53079 | 1449 |
by (auto intro: exp_less_mono exp_less_cancel) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1450 |
|
| 63558 | 1451 |
lemma exp_le_cancel_iff [iff]: "exp x \<le> exp y \<longleftrightarrow> x \<le> y" |
1452 |
for x y :: real |
|
| 53079 | 1453 |
by (auto simp add: linorder_not_less [symmetric]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1454 |
|
| 63558 | 1455 |
lemma exp_inj_iff [iff]: "exp x = exp y \<longleftrightarrow> x = y" |
1456 |
for x y :: real |
|
| 53079 | 1457 |
by (simp add: order_eq_iff) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1458 |
|
| 60758 | 1459 |
text \<open>Comparisons of @{term "exp x"} with one.\<close>
|
| 29170 | 1460 |
|
| 63558 | 1461 |
lemma one_less_exp_iff [simp]: "1 < exp x \<longleftrightarrow> 0 < x" |
1462 |
for x :: real |
|
1463 |
using exp_less_cancel_iff [where x = 0 and y = x] by simp |
|
1464 |
||
1465 |
lemma exp_less_one_iff [simp]: "exp x < 1 \<longleftrightarrow> x < 0" |
|
1466 |
for x :: real |
|
1467 |
using exp_less_cancel_iff [where x = x and y = 0] by simp |
|
1468 |
||
1469 |
lemma one_le_exp_iff [simp]: "1 \<le> exp x \<longleftrightarrow> 0 \<le> x" |
|
1470 |
for x :: real |
|
1471 |
using exp_le_cancel_iff [where x = 0 and y = x] by simp |
|
1472 |
||
1473 |
lemma exp_le_one_iff [simp]: "exp x \<le> 1 \<longleftrightarrow> x \<le> 0" |
|
1474 |
for x :: real |
|
1475 |
using exp_le_cancel_iff [where x = x and y = 0] by simp |
|
1476 |
||
1477 |
lemma exp_eq_one_iff [simp]: "exp x = 1 \<longleftrightarrow> x = 0" |
|
1478 |
for x :: real |
|
1479 |
using exp_inj_iff [where x = x and y = 0] by simp |
|
1480 |
||
1481 |
lemma lemma_exp_total: "1 \<le> y \<Longrightarrow> \<exists>x. 0 \<le> x \<and> x \<le> y - 1 \<and> exp x = y" |
|
1482 |
for y :: real |
|
| 44755 | 1483 |
proof (rule IVT) |
1484 |
assume "1 \<le> y" |
|
| 63558 | 1485 |
then have "0 \<le> y - 1" by simp |
1486 |
then have "1 + (y - 1) \<le> exp (y - 1)" |
|
1487 |
by (rule exp_ge_add_one_self_aux) |
|
1488 |
then show "y \<le> exp (y - 1)" by simp |
|
| 44755 | 1489 |
qed (simp_all add: le_diff_eq) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1490 |
|
| 63558 | 1491 |
lemma exp_total: "0 < y \<Longrightarrow> \<exists>x. exp x = y" |
1492 |
for y :: real |
|
| 44755 | 1493 |
proof (rule linorder_le_cases [of 1 y]) |
| 53079 | 1494 |
assume "1 \<le> y" |
| 63558 | 1495 |
then show "\<exists>x. exp x = y" |
1496 |
by (fast dest: lemma_exp_total) |
|
| 44755 | 1497 |
next |
1498 |
assume "0 < y" and "y \<le> 1" |
|
| 63558 | 1499 |
then have "1 \<le> inverse y" |
1500 |
by (simp add: one_le_inverse_iff) |
|
1501 |
then obtain x where "exp x = inverse y" |
|
1502 |
by (fast dest: lemma_exp_total) |
|
1503 |
then have "exp (- x) = y" |
|
1504 |
by (simp add: exp_minus) |
|
1505 |
then show "\<exists>x. exp x = y" .. |
|
| 44755 | 1506 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1507 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1508 |
|
| 60758 | 1509 |
subsection \<open>Natural Logarithm\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1510 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1511 |
class ln = real_normed_algebra_1 + banach + |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1512 |
fixes ln :: "'a \<Rightarrow> 'a" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1513 |
assumes ln_one [simp]: "ln 1 = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1514 |
|
| 63558 | 1515 |
definition powr :: "'a \<Rightarrow> 'a \<Rightarrow> 'a::ln" (infixr "powr" 80) |
| 61799 | 1516 |
\<comment> \<open>exponentation via ln and exp\<close> |
| 63558 | 1517 |
where [code del]: "x powr a \<equiv> if x = 0 then 0 else exp (a * ln x)" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1518 |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1519 |
lemma powr_0 [simp]: "0 powr z = 0" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1520 |
by (simp add: powr_def) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1521 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1522 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1523 |
instantiation real :: ln |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1524 |
begin |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1525 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1526 |
definition ln_real :: "real \<Rightarrow> real" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1527 |
where "ln_real x = (THE u. exp u = x)" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1528 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1529 |
instance |
| 63558 | 1530 |
by intro_classes (simp add: ln_real_def) |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1531 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1532 |
end |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1533 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1534 |
lemma powr_eq_0_iff [simp]: "w powr z = 0 \<longleftrightarrow> w = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1535 |
by (simp add: powr_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1536 |
|
| 63558 | 1537 |
lemma ln_exp [simp]: "ln (exp x) = x" |
1538 |
for x :: real |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1539 |
by (simp add: ln_real_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1540 |
|
| 63558 | 1541 |
lemma exp_ln [simp]: "0 < x \<Longrightarrow> exp (ln x) = x" |
1542 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1543 |
by (auto dest: exp_total) |
|
22654
c2b6b5a9e136
new simp rule exp_ln; new standard proof of DERIV_exp_ln_one; changed imports
huffman
parents:
22653
diff
changeset
|
1544 |
|
| 63558 | 1545 |
lemma exp_ln_iff [simp]: "exp (ln x) = x \<longleftrightarrow> 0 < x" |
1546 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1547 |
by (metis exp_gt_zero exp_ln) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1548 |
|
| 63558 | 1549 |
lemma ln_unique: "exp y = x \<Longrightarrow> ln x = y" |
1550 |
for x :: real |
|
1551 |
by (erule subst) (rule ln_exp) |
|
1552 |
||
1553 |
lemma ln_mult: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln (x * y) = ln x + ln y" |
|
1554 |
for x :: real |
|
| 53079 | 1555 |
by (rule ln_unique) (simp add: exp_add) |
| 29171 | 1556 |
|
| 63558 | 1557 |
lemma ln_setprod: "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i > 0) \<Longrightarrow> ln (setprod f I) = setsum (\<lambda>x. ln(f x)) I" |
1558 |
for f :: "'a \<Rightarrow> real" |
|
1559 |
by (induct I rule: finite_induct) (auto simp: ln_mult setprod_pos) |
|
1560 |
||
1561 |
lemma ln_inverse: "0 < x \<Longrightarrow> ln (inverse x) = - ln x" |
|
1562 |
for x :: real |
|
| 53079 | 1563 |
by (rule ln_unique) (simp add: exp_minus) |
1564 |
||
| 63558 | 1565 |
lemma ln_div: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln (x / y) = ln x - ln y" |
1566 |
for x :: real |
|
| 53079 | 1567 |
by (rule ln_unique) (simp add: exp_diff) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1568 |
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1569 |
lemma ln_realpow: "0 < x \<Longrightarrow> ln (x^n) = real n * ln x" |
| 53079 | 1570 |
by (rule ln_unique) (simp add: exp_real_of_nat_mult) |
1571 |
||
| 63558 | 1572 |
lemma ln_less_cancel_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x < ln y \<longleftrightarrow> x < y" |
1573 |
for x :: real |
|
| 53079 | 1574 |
by (subst exp_less_cancel_iff [symmetric]) simp |
1575 |
||
| 63558 | 1576 |
lemma ln_le_cancel_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x \<le> ln y \<longleftrightarrow> x \<le> y" |
1577 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1578 |
by (simp add: linorder_not_less [symmetric]) |
| 29171 | 1579 |
|
| 63558 | 1580 |
lemma ln_inj_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x = ln y \<longleftrightarrow> x = y" |
1581 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1582 |
by (simp add: order_eq_iff) |
| 29171 | 1583 |
|
| 63558 | 1584 |
lemma ln_add_one_self_le_self [simp]: "0 \<le> x \<Longrightarrow> ln (1 + x) \<le> x" |
1585 |
for x :: real |
|
1586 |
by (rule exp_le_cancel_iff [THEN iffD1]) (simp add: exp_ge_add_one_self_aux) |
|
1587 |
||
1588 |
lemma ln_less_self [simp]: "0 < x \<Longrightarrow> ln x < x" |
|
1589 |
for x :: real |
|
1590 |
by (rule order_less_le_trans [where y = "ln (1 + x)"]) simp_all |
|
1591 |
||
1592 |
lemma ln_ge_zero [simp]: "1 \<le> x \<Longrightarrow> 0 \<le> ln x" |
|
1593 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1594 |
using ln_le_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1595 |
|
| 63558 | 1596 |
lemma ln_ge_zero_imp_ge_one: "0 \<le> ln x \<Longrightarrow> 0 < x \<Longrightarrow> 1 \<le> x" |
1597 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1598 |
using ln_le_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1599 |
|
| 63558 | 1600 |
lemma ln_ge_zero_iff [simp]: "0 < x \<Longrightarrow> 0 \<le> ln x \<longleftrightarrow> 1 \<le> x" |
1601 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1602 |
using ln_le_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1603 |
|
| 63558 | 1604 |
lemma ln_less_zero_iff [simp]: "0 < x \<Longrightarrow> ln x < 0 \<longleftrightarrow> x < 1" |
1605 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1606 |
using ln_less_cancel_iff [of x 1] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1607 |
|
| 63558 | 1608 |
lemma ln_gt_zero: "1 < x \<Longrightarrow> 0 < ln x" |
1609 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1610 |
using ln_less_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1611 |
|
| 63558 | 1612 |
lemma ln_gt_zero_imp_gt_one: "0 < ln x \<Longrightarrow> 0 < x \<Longrightarrow> 1 < x" |
1613 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1614 |
using ln_less_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1615 |
|
| 63558 | 1616 |
lemma ln_gt_zero_iff [simp]: "0 < x \<Longrightarrow> 0 < ln x \<longleftrightarrow> 1 < x" |
1617 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1618 |
using ln_less_cancel_iff [of 1 x] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1619 |
|
| 63558 | 1620 |
lemma ln_eq_zero_iff [simp]: "0 < x \<Longrightarrow> ln x = 0 \<longleftrightarrow> x = 1" |
1621 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1622 |
using ln_inj_iff [of x 1] by simp |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1623 |
|
| 63558 | 1624 |
lemma ln_less_zero: "0 < x \<Longrightarrow> x < 1 \<Longrightarrow> ln x < 0" |
1625 |
for x :: real |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1626 |
by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1627 |
|
| 63558 | 1628 |
lemma ln_neg_is_const: "x \<le> 0 \<Longrightarrow> ln x = (THE x. False)" |
1629 |
for x :: real |
|
1630 |
by (auto simp: ln_real_def intro!: arg_cong[where f = The]) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1631 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1632 |
lemma isCont_ln: |
| 63558 | 1633 |
fixes x :: real |
1634 |
assumes "x \<noteq> 0" |
|
1635 |
shows "isCont ln x" |
|
| 63540 | 1636 |
proof (cases "0 < x") |
1637 |
case True |
|
1638 |
then have "isCont ln (exp (ln x))" |
|
| 63558 | 1639 |
by (intro isCont_inv_fun[where d = "\<bar>x\<bar>" and f = exp]) auto |
| 63540 | 1640 |
with True show ?thesis |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1641 |
by simp |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1642 |
next |
| 63540 | 1643 |
case False |
1644 |
with \<open>x \<noteq> 0\<close> show "isCont ln x" |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1645 |
unfolding isCont_def |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1646 |
by (subst filterlim_cong[OF _ refl, of _ "nhds (ln 0)" _ "\<lambda>_. ln 0"]) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1647 |
(auto simp: ln_neg_is_const not_less eventually_at dist_real_def |
| 63558 | 1648 |
intro!: exI[of _ "\<bar>x\<bar>"]) |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1649 |
qed |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
1650 |
|
| 63558 | 1651 |
lemma tendsto_ln [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. ln (f x)) \<longlongrightarrow> ln a) F" |
1652 |
for a :: real |
|
| 45915 | 1653 |
by (rule isCont_tendsto_compose [OF isCont_ln]) |
1654 |
||
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1655 |
lemma continuous_ln: |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1656 |
"continuous F f \<Longrightarrow> f (Lim F (\<lambda>x. x)) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. ln (f x :: real))" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1657 |
unfolding continuous_def by (rule tendsto_ln) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1658 |
|
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1659 |
lemma isCont_ln' [continuous_intros]: |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1660 |
"continuous (at x) f \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> continuous (at x) (\<lambda>x. ln (f x :: real))" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1661 |
unfolding continuous_at by (rule tendsto_ln) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1662 |
|
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1663 |
lemma continuous_within_ln [continuous_intros]: |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1664 |
"continuous (at x within s) f \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow> continuous (at x within s) (\<lambda>x. ln (f x :: real))" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1665 |
unfolding continuous_within by (rule tendsto_ln) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1666 |
|
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
1667 |
lemma continuous_on_ln [continuous_intros]: |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1668 |
"continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. f x \<noteq> 0) \<Longrightarrow> continuous_on s (\<lambda>x. ln (f x :: real))" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1669 |
unfolding continuous_on_def by (auto intro: tendsto_ln) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
1670 |
|
| 63558 | 1671 |
lemma DERIV_ln: "0 < x \<Longrightarrow> DERIV ln x :> inverse x" |
1672 |
for x :: real |
|
1673 |
by (rule DERIV_inverse_function [where f=exp and a=0 and b="x+1"]) |
|
1674 |
(auto intro: DERIV_cong [OF DERIV_exp exp_ln] isCont_ln) |
|
1675 |
||
1676 |
lemma DERIV_ln_divide: "0 < x \<Longrightarrow> DERIV ln x :> 1 / x" |
|
1677 |
for x :: real |
|
1678 |
by (rule DERIV_ln[THEN DERIV_cong]) (simp_all add: divide_inverse) |
|
| 33667 | 1679 |
|
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
1680 |
declare DERIV_ln_divide[THEN DERIV_chain2, derivative_intros] |
| 63558 | 1681 |
and DERIV_ln_divide[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
| 51527 | 1682 |
|
| 53079 | 1683 |
lemma ln_series: |
1684 |
assumes "0 < x" and "x < 2" |
|
1685 |
shows "ln x = (\<Sum> n. (-1)^n * (1 / real (n + 1)) * (x - 1)^(Suc n))" |
|
| 63558 | 1686 |
(is "ln x = suminf (?f (x - 1))") |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1687 |
proof - |
| 53079 | 1688 |
let ?f' = "\<lambda>x n. (-1)^n * (x - 1)^n" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1689 |
|
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1690 |
have "ln x - suminf (?f (x - 1)) = ln 1 - suminf (?f (1 - 1))" |
| 63558 | 1691 |
proof (rule DERIV_isconst3 [where x = x]) |
| 53079 | 1692 |
fix x :: real |
1693 |
assume "x \<in> {0 <..< 2}"
|
|
| 63558 | 1694 |
then have "0 < x" and "x < 2" by auto |
| 53079 | 1695 |
have "norm (1 - x) < 1" |
| 60758 | 1696 |
using \<open>0 < x\<close> and \<open>x < 2\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1697 |
have "1 / x = 1 / (1 - (1 - x))" by auto |
| 53079 | 1698 |
also have "\<dots> = (\<Sum> n. (1 - x)^n)" |
| 60758 | 1699 |
using geometric_sums[OF \<open>norm (1 - x) < 1\<close>] by (rule sums_unique) |
| 53079 | 1700 |
also have "\<dots> = suminf (?f' x)" |
1701 |
unfolding power_mult_distrib[symmetric] |
|
1702 |
by (rule arg_cong[where f=suminf], rule arg_cong[where f="op ^"], auto) |
|
1703 |
finally have "DERIV ln x :> suminf (?f' x)" |
|
| 60758 | 1704 |
using DERIV_ln[OF \<open>0 < x\<close>] unfolding divide_inverse by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1705 |
moreover |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1706 |
have repos: "\<And> h x :: real. h - 1 + x = h + x - 1" by auto |
| 53079 | 1707 |
have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> |
1708 |
(\<Sum>n. (-1)^n * (1 / real (n + 1)) * real (Suc n) * (x - 1) ^ n)" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1709 |
proof (rule DERIV_power_series') |
| 53079 | 1710 |
show "x - 1 \<in> {- 1<..<1}" and "(0 :: real) < 1"
|
| 60758 | 1711 |
using \<open>0 < x\<close> \<open>x < 2\<close> by auto |
| 63558 | 1712 |
next |
| 53079 | 1713 |
fix x :: real |
1714 |
assume "x \<in> {- 1<..<1}"
|
|
| 63558 | 1715 |
then have "norm (-x) < 1" by auto |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1716 |
show "summable (\<lambda>n. (- 1) ^ n * (1 / real (n + 1)) * real (Suc n) * x^n)" |
| 53079 | 1717 |
unfolding One_nat_def |
| 60758 | 1718 |
by (auto simp add: power_mult_distrib[symmetric] summable_geometric[OF \<open>norm (-x) < 1\<close>]) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1719 |
qed |
| 63558 | 1720 |
then have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> suminf (?f' x)" |
| 53079 | 1721 |
unfolding One_nat_def by auto |
| 63558 | 1722 |
then have "DERIV (\<lambda>x. suminf (?f (x - 1))) x :> suminf (?f' x)" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
1723 |
unfolding DERIV_def repos . |
| 63558 | 1724 |
ultimately have "DERIV (\<lambda>x. ln x - suminf (?f (x - 1))) x :> suminf (?f' x) - suminf (?f' x)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1725 |
by (rule DERIV_diff) |
| 63558 | 1726 |
then show "DERIV (\<lambda>x. ln x - suminf (?f (x - 1))) x :> 0" by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1727 |
qed (auto simp add: assms) |
| 63558 | 1728 |
then show ?thesis by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1729 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1730 |
|
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1731 |
lemma exp_first_terms: |
|
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1732 |
fixes x :: "'a::{real_normed_algebra_1,banach}"
|
| 63558 | 1733 |
shows "exp x = (\<Sum>n<k. inverse(fact n) *\<^sub>R (x ^ n)) + (\<Sum>n. inverse(fact (n + k)) *\<^sub>R (x ^ (n + k)))" |
| 50326 | 1734 |
proof - |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1735 |
have "exp x = suminf (\<lambda>n. inverse(fact n) *\<^sub>R (x^n))" |
|
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1736 |
by (simp add: exp_def) |
| 63558 | 1737 |
also from summable_exp_generic have "\<dots> = (\<Sum> n. inverse(fact(n+k)) *\<^sub>R (x ^ (n + k))) + |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1738 |
(\<Sum> n::nat<k. inverse(fact n) *\<^sub>R (x^n))" (is "_ = _ + ?a") |
| 50326 | 1739 |
by (rule suminf_split_initial_segment) |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1740 |
finally show ?thesis by simp |
| 50326 | 1741 |
qed |
1742 |
||
| 63558 | 1743 |
lemma exp_first_term: "exp x = 1 + (\<Sum>n. inverse (fact (Suc n)) *\<^sub>R (x ^ Suc n))" |
1744 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1745 |
using exp_first_terms[of x 1] by simp |
|
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1746 |
|
| 63558 | 1747 |
lemma exp_first_two_terms: "exp x = 1 + x + (\<Sum>n. inverse (fact (n + 2)) *\<^sub>R (x ^ (n + 2)))" |
1748 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
1749 |
using exp_first_terms[of x 2] by (simp add: eval_nat_numeral) |
|
1750 |
||
1751 |
lemma exp_bound: |
|
1752 |
fixes x :: real |
|
1753 |
assumes a: "0 \<le> x" |
|
1754 |
and b: "x \<le> 1" |
|
1755 |
shows "exp x \<le> 1 + x + x\<^sup>2" |
|
| 50326 | 1756 |
proof - |
| 63558 | 1757 |
have aux1: "inverse (fact (n + 2)) * x ^ (n + 2) \<le> (x\<^sup>2/2) * ((1/2)^n)" for n :: nat |
1758 |
proof - |
|
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1759 |
have "(2::nat) * 2 ^ n \<le> fact (n + 2)" |
| 53079 | 1760 |
by (induct n) simp_all |
| 63558 | 1761 |
then have "real ((2::nat) * 2 ^ n) \<le> real_of_nat (fact (n + 2))" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
1762 |
by (simp only: of_nat_le_iff) |
| 63558 | 1763 |
then have "((2::real) * 2 ^ n) \<le> fact (n + 2)" |
1764 |
unfolding of_nat_fact by simp |
|
1765 |
then have "inverse (fact (n + 2)) \<le> inverse ((2::real) * 2 ^ n)" |
|
| 50326 | 1766 |
by (rule le_imp_inverse_le) simp |
| 63558 | 1767 |
then have "inverse (fact (n + 2)) \<le> 1/(2::real) * (1/2)^n" |
| 60867 | 1768 |
by (simp add: power_inverse [symmetric]) |
| 63558 | 1769 |
then have "inverse (fact (n + 2)) * (x^n * x\<^sup>2) \<le> 1/2 * (1/2)^n * (1 * x\<^sup>2)" |
1770 |
by (rule mult_mono) (rule mult_mono, simp_all add: power_le_one a b) |
|
1771 |
then show ?thesis |
|
1772 |
unfolding power_add by (simp add: ac_simps del: fact_Suc) |
|
1773 |
qed |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
1774 |
have "(\<lambda>n. x\<^sup>2 / 2 * (1 / 2) ^ n) sums (x\<^sup>2 / 2 * (1 / (1 - 1 / 2)))" |
| 63558 | 1775 |
by (intro sums_mult geometric_sums) simp |
1776 |
then have aux2: "(\<lambda>n. x\<^sup>2 / 2 * (1 / 2) ^ n) sums x\<^sup>2" |
|
| 50326 | 1777 |
by simp |
| 63558 | 1778 |
have "suminf (\<lambda>n. inverse(fact (n+2)) * (x ^ (n + 2))) \<le> x\<^sup>2" |
| 50326 | 1779 |
proof - |
| 63558 | 1780 |
have "suminf (\<lambda>n. inverse(fact (n+2)) * (x ^ (n + 2))) \<le> suminf (\<lambda>n. (x\<^sup>2/2) * ((1/2)^n))" |
| 56213 | 1781 |
apply (rule suminf_le) |
| 63558 | 1782 |
apply (rule allI) |
1783 |
apply (rule aux1) |
|
1784 |
apply (rule summable_exp [THEN summable_ignore_initial_segment]) |
|
1785 |
apply (rule sums_summable) |
|
1786 |
apply (rule aux2) |
|
1787 |
done |
|
1788 |
also have "\<dots> = x\<^sup>2" |
|
1789 |
by (rule sums_unique [THEN sym]) (rule aux2) |
|
| 50326 | 1790 |
finally show ?thesis . |
1791 |
qed |
|
| 63558 | 1792 |
then show ?thesis |
1793 |
unfolding exp_first_two_terms by auto |
|
| 50326 | 1794 |
qed |
1795 |
||
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1796 |
corollary exp_half_le2: "exp(1/2) \<le> (2::real)" |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1797 |
using exp_bound [of "1/2"] |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1798 |
by (simp add: field_simps) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1799 |
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
1800 |
corollary exp_le: "exp 1 \<le> (3::real)" |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
1801 |
using exp_bound [of 1] |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
1802 |
by (simp add: field_simps) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
1803 |
|
| 63558 | 1804 |
lemma exp_bound_half: "norm z \<le> 1/2 \<Longrightarrow> norm (exp z) \<le> 2" |
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1805 |
by (blast intro: order_trans intro!: exp_half_le2 norm_exp) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1806 |
|
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1807 |
lemma exp_bound_lemma: |
| 63558 | 1808 |
assumes "norm z \<le> 1/2" |
1809 |
shows "norm (exp z) \<le> 1 + 2 * norm z" |
|
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1810 |
proof - |
| 63558 | 1811 |
have *: "(norm z)\<^sup>2 \<le> norm z * 1" |
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1812 |
unfolding power2_eq_square |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1813 |
apply (rule mult_left_mono) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1814 |
using assms |
| 63558 | 1815 |
apply auto |
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1816 |
done |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1817 |
show ?thesis |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1818 |
apply (rule order_trans [OF norm_exp]) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1819 |
apply (rule order_trans [OF exp_bound]) |
| 63558 | 1820 |
using assms * |
1821 |
apply auto |
|
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1822 |
done |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1823 |
qed |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1824 |
|
| 63558 | 1825 |
lemma real_exp_bound_lemma: "0 \<le> x \<Longrightarrow> x \<le> 1/2 \<Longrightarrow> exp x \<le> 1 + 2 * x" |
1826 |
for x :: real |
|
1827 |
using exp_bound_lemma [of x] by simp |
|
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1828 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1829 |
lemma ln_one_minus_pos_upper_bound: |
| 63558 | 1830 |
fixes x :: real |
1831 |
assumes a: "0 \<le> x" and b: "x < 1" |
|
1832 |
shows "ln (1 - x) \<le> - x" |
|
| 50326 | 1833 |
proof - |
| 63558 | 1834 |
have "(1 - x) * (1 + x + x\<^sup>2) = 1 - x^3" |
| 50326 | 1835 |
by (simp add: algebra_simps power2_eq_square power3_eq_cube) |
| 63558 | 1836 |
also have "\<dots> \<le> 1" |
| 50326 | 1837 |
by (auto simp add: a) |
| 63558 | 1838 |
finally have "(1 - x) * (1 + x + x\<^sup>2) \<le> 1" . |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
1839 |
moreover have c: "0 < 1 + x + x\<^sup>2" |
| 50326 | 1840 |
by (simp add: add_pos_nonneg a) |
| 63558 | 1841 |
ultimately have "1 - x \<le> 1 / (1 + x + x\<^sup>2)" |
| 50326 | 1842 |
by (elim mult_imp_le_div_pos) |
| 63558 | 1843 |
also have "\<dots> \<le> 1 / exp x" |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
1844 |
by (metis a abs_one b exp_bound exp_gt_zero frac_le less_eq_real_def real_sqrt_abs |
| 63558 | 1845 |
real_sqrt_pow2_iff real_sqrt_power) |
1846 |
also have "\<dots> = exp (- x)" |
|
| 50326 | 1847 |
by (auto simp add: exp_minus divide_inverse) |
| 63558 | 1848 |
finally have "1 - x \<le> exp (- x)" . |
| 50326 | 1849 |
also have "1 - x = exp (ln (1 - x))" |
| 54576 | 1850 |
by (metis b diff_0 exp_ln_iff less_iff_diff_less_0 minus_diff_eq) |
| 63558 | 1851 |
finally have "exp (ln (1 - x)) \<le> exp (- x)" . |
1852 |
then show ?thesis |
|
1853 |
by (auto simp only: exp_le_cancel_iff) |
|
| 50326 | 1854 |
qed |
1855 |
||
| 63558 | 1856 |
lemma exp_ge_add_one_self [simp]: "1 + x \<le> exp x" |
1857 |
for x :: real |
|
1858 |
apply (cases "0 \<le> x") |
|
1859 |
apply (erule exp_ge_add_one_self_aux) |
|
1860 |
apply (cases "x \<le> -1") |
|
1861 |
apply (subgoal_tac "1 + x \<le> 0") |
|
1862 |
apply (erule order_trans) |
|
1863 |
apply simp |
|
1864 |
apply simp |
|
1865 |
apply (subgoal_tac "1 + x = exp (ln (1 + x))") |
|
1866 |
apply (erule ssubst) |
|
1867 |
apply (subst exp_le_cancel_iff) |
|
1868 |
apply (subgoal_tac "ln (1 - (- x)) \<le> - (- x)") |
|
1869 |
apply simp |
|
1870 |
apply (rule ln_one_minus_pos_upper_bound) |
|
1871 |
apply auto |
|
1872 |
done |
|
| 50326 | 1873 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1874 |
lemma ln_one_plus_pos_lower_bound: |
| 63558 | 1875 |
fixes x :: real |
1876 |
assumes a: "0 \<le> x" and b: "x \<le> 1" |
|
1877 |
shows "x - x\<^sup>2 \<le> ln (1 + x)" |
|
| 51527 | 1878 |
proof - |
| 53076 | 1879 |
have "exp (x - x\<^sup>2) = exp x / exp (x\<^sup>2)" |
| 51527 | 1880 |
by (rule exp_diff) |
| 63558 | 1881 |
also have "\<dots> \<le> (1 + x + x\<^sup>2) / exp (x \<^sup>2)" |
| 54576 | 1882 |
by (metis a b divide_right_mono exp_bound exp_ge_zero) |
| 63558 | 1883 |
also have "\<dots> \<le> (1 + x + x\<^sup>2) / (1 + x\<^sup>2)" |
| 56544 | 1884 |
by (simp add: a divide_left_mono add_pos_nonneg) |
| 63558 | 1885 |
also from a have "\<dots> \<le> 1 + x" |
| 51527 | 1886 |
by (simp add: field_simps add_strict_increasing zero_le_mult_iff) |
| 63558 | 1887 |
finally have "exp (x - x\<^sup>2) \<le> 1 + x" . |
1888 |
also have "\<dots> = exp (ln (1 + x))" |
|
| 51527 | 1889 |
proof - |
1890 |
from a have "0 < 1 + x" by auto |
|
| 63558 | 1891 |
then show ?thesis |
| 51527 | 1892 |
by (auto simp only: exp_ln_iff [THEN sym]) |
1893 |
qed |
|
| 63558 | 1894 |
finally have "exp (x - x\<^sup>2) \<le> exp (ln (1 + x))" . |
1895 |
then show ?thesis |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
1896 |
by (metis exp_le_cancel_iff) |
| 51527 | 1897 |
qed |
1898 |
||
| 53079 | 1899 |
lemma ln_one_minus_pos_lower_bound: |
| 63558 | 1900 |
fixes x :: real |
1901 |
assumes a: "0 \<le> x" and b: "x \<le> 1 / 2" |
|
1902 |
shows "- x - 2 * x\<^sup>2 \<le> ln (1 - x)" |
|
| 51527 | 1903 |
proof - |
| 53079 | 1904 |
from b have c: "x < 1" by auto |
| 51527 | 1905 |
then have "ln (1 - x) = - ln (1 + x / (1 - x))" |
| 54576 | 1906 |
apply (subst ln_inverse [symmetric]) |
| 63558 | 1907 |
apply (simp add: field_simps) |
| 54576 | 1908 |
apply (rule arg_cong [where f=ln]) |
1909 |
apply (simp add: field_simps) |
|
1910 |
done |
|
| 63558 | 1911 |
also have "- (x / (1 - x)) \<le> \<dots>" |
| 53079 | 1912 |
proof - |
| 63558 | 1913 |
have "ln (1 + x / (1 - x)) \<le> x / (1 - x)" |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
1914 |
using a c by (intro ln_add_one_self_le_self) auto |
| 63558 | 1915 |
then show ?thesis |
| 51527 | 1916 |
by auto |
1917 |
qed |
|
| 63558 | 1918 |
also have "- (x / (1 - x)) = - x / (1 - x)" |
| 51527 | 1919 |
by auto |
| 63558 | 1920 |
finally have d: "- x / (1 - x) \<le> ln (1 - x)" . |
| 51527 | 1921 |
have "0 < 1 - x" using a b by simp |
| 63558 | 1922 |
then have e: "- x - 2 * x\<^sup>2 \<le> - x / (1 - x)" |
1923 |
using mult_right_le_one_le[of "x * x" "2 * x"] a b |
|
| 53079 | 1924 |
by (simp add: field_simps power2_eq_square) |
| 63558 | 1925 |
from e d show "- x - 2 * x\<^sup>2 \<le> ln (1 - x)" |
| 51527 | 1926 |
by (rule order_trans) |
1927 |
qed |
|
1928 |
||
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1929 |
lemma ln_add_one_self_le_self2: |
| 63558 | 1930 |
fixes x :: real |
1931 |
shows "-1 < x \<Longrightarrow> ln (1 + x) \<le> x" |
|
1932 |
apply (subgoal_tac "ln (1 + x) \<le> ln (exp x)") |
|
1933 |
apply simp |
|
| 51527 | 1934 |
apply (subst ln_le_cancel_iff) |
| 63558 | 1935 |
apply auto |
| 53079 | 1936 |
done |
| 51527 | 1937 |
|
1938 |
lemma abs_ln_one_plus_x_minus_x_bound_nonneg: |
|
| 63558 | 1939 |
fixes x :: real |
1940 |
assumes x: "0 \<le> x" and x1: "x \<le> 1" |
|
1941 |
shows "\<bar>ln (1 + x) - x\<bar> \<le> x\<^sup>2" |
|
| 51527 | 1942 |
proof - |
| 63558 | 1943 |
from x have "ln (1 + x) \<le> x" |
| 51527 | 1944 |
by (rule ln_add_one_self_le_self) |
| 63558 | 1945 |
then have "ln (1 + x) - x \<le> 0" |
| 51527 | 1946 |
by simp |
| 61944 | 1947 |
then have "\<bar>ln(1 + x) - x\<bar> = - (ln(1 + x) - x)" |
| 51527 | 1948 |
by (rule abs_of_nonpos) |
| 63558 | 1949 |
also have "\<dots> = x - ln (1 + x)" |
| 51527 | 1950 |
by simp |
| 63558 | 1951 |
also have "\<dots> \<le> x\<^sup>2" |
| 51527 | 1952 |
proof - |
| 63558 | 1953 |
from x x1 have "x - x\<^sup>2 \<le> ln (1 + x)" |
| 51527 | 1954 |
by (intro ln_one_plus_pos_lower_bound) |
| 63558 | 1955 |
then show ?thesis |
| 51527 | 1956 |
by simp |
1957 |
qed |
|
1958 |
finally show ?thesis . |
|
1959 |
qed |
|
1960 |
||
1961 |
lemma abs_ln_one_plus_x_minus_x_bound_nonpos: |
|
| 63558 | 1962 |
fixes x :: real |
1963 |
assumes a: "-(1 / 2) \<le> x" and b: "x \<le> 0" |
|
1964 |
shows "\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2" |
|
| 51527 | 1965 |
proof - |
| 63558 | 1966 |
have "\<bar>ln (1 + x) - x\<bar> = x - ln (1 - (- x))" |
| 51527 | 1967 |
apply (subst abs_of_nonpos) |
| 63558 | 1968 |
apply simp |
1969 |
apply (rule ln_add_one_self_le_self2) |
|
| 51527 | 1970 |
using a apply auto |
1971 |
done |
|
| 63558 | 1972 |
also have "\<dots> \<le> 2 * x\<^sup>2" |
1973 |
apply (subgoal_tac "- (-x) - 2 * (-x)\<^sup>2 \<le> ln (1 - (- x))") |
|
1974 |
apply (simp add: algebra_simps) |
|
| 51527 | 1975 |
apply (rule ln_one_minus_pos_lower_bound) |
1976 |
using a b apply auto |
|
1977 |
done |
|
1978 |
finally show ?thesis . |
|
1979 |
qed |
|
1980 |
||
1981 |
lemma abs_ln_one_plus_x_minus_x_bound: |
|
| 63558 | 1982 |
fixes x :: real |
1983 |
shows "\<bar>x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2" |
|
1984 |
apply (cases "0 \<le> x") |
|
1985 |
apply (rule order_trans) |
|
1986 |
apply (rule abs_ln_one_plus_x_minus_x_bound_nonneg) |
|
1987 |
apply auto |
|
| 51527 | 1988 |
apply (rule abs_ln_one_plus_x_minus_x_bound_nonpos) |
| 63558 | 1989 |
apply auto |
| 53079 | 1990 |
done |
1991 |
||
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
1992 |
lemma ln_x_over_x_mono: |
| 63558 | 1993 |
fixes x :: real |
1994 |
assumes x: "exp 1 \<le> x" "x \<le> y" |
|
1995 |
shows "ln y / y \<le> ln x / x" |
|
| 51527 | 1996 |
proof - |
| 63558 | 1997 |
note x |
| 51527 | 1998 |
moreover have "0 < exp (1::real)" by simp |
1999 |
ultimately have a: "0 < x" and b: "0 < y" |
|
2000 |
by (fast intro: less_le_trans order_trans)+ |
|
2001 |
have "x * ln y - x * ln x = x * (ln y - ln x)" |
|
2002 |
by (simp add: algebra_simps) |
|
| 63558 | 2003 |
also have "\<dots> = x * ln (y / x)" |
| 51527 | 2004 |
by (simp only: ln_div a b) |
2005 |
also have "y / x = (x + (y - x)) / x" |
|
2006 |
by simp |
|
| 63558 | 2007 |
also have "\<dots> = 1 + (y - x) / x" |
| 51527 | 2008 |
using x a by (simp add: field_simps) |
| 63558 | 2009 |
also have "x * ln (1 + (y - x) / x) \<le> x * ((y - x) / x)" |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2010 |
using x a |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
2011 |
by (intro mult_left_mono ln_add_one_self_le_self) simp_all |
| 63558 | 2012 |
also have "\<dots> = y - x" |
2013 |
using a by simp |
|
2014 |
also have "\<dots> = (y - x) * ln (exp 1)" by simp |
|
2015 |
also have "\<dots> \<le> (y - x) * ln x" |
|
| 51527 | 2016 |
apply (rule mult_left_mono) |
| 63558 | 2017 |
apply (subst ln_le_cancel_iff) |
2018 |
apply fact |
|
2019 |
apply (rule a) |
|
2020 |
apply (rule x) |
|
| 51527 | 2021 |
using x apply simp |
2022 |
done |
|
| 63558 | 2023 |
also have "\<dots> = y * ln x - x * ln x" |
| 51527 | 2024 |
by (rule left_diff_distrib) |
| 63558 | 2025 |
finally have "x * ln y \<le> y * ln x" |
| 51527 | 2026 |
by arith |
| 63558 | 2027 |
then have "ln y \<le> (y * ln x) / x" |
2028 |
using a by (simp add: field_simps) |
|
2029 |
also have "\<dots> = y * (ln x / x)" by simp |
|
2030 |
finally show ?thesis |
|
2031 |
using b by (simp add: field_simps) |
|
| 51527 | 2032 |
qed |
2033 |
||
| 63558 | 2034 |
lemma ln_le_minus_one: "0 < x \<Longrightarrow> ln x \<le> x - 1" |
2035 |
for x :: real |
|
| 51527 | 2036 |
using exp_ge_add_one_self[of "ln x"] by simp |
2037 |
||
| 63558 | 2038 |
corollary ln_diff_le: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x - ln y \<le> (x - y) / y" |
2039 |
for x :: real |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2040 |
by (simp add: ln_div [symmetric] diff_divide_distrib ln_le_minus_one) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2041 |
|
| 51527 | 2042 |
lemma ln_eq_minus_one: |
| 63558 | 2043 |
fixes x :: real |
| 53079 | 2044 |
assumes "0 < x" "ln x = x - 1" |
2045 |
shows "x = 1" |
|
| 51527 | 2046 |
proof - |
| 53079 | 2047 |
let ?l = "\<lambda>y. ln y - y + 1" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2048 |
have D: "\<And>x::real. 0 < x \<Longrightarrow> DERIV ?l x :> (1 / x - 1)" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2049 |
by (auto intro!: derivative_eq_intros) |
| 51527 | 2050 |
|
2051 |
show ?thesis |
|
2052 |
proof (cases rule: linorder_cases) |
|
2053 |
assume "x < 1" |
|
| 60758 | 2054 |
from dense[OF \<open>x < 1\<close>] obtain a where "x < a" "a < 1" by blast |
2055 |
from \<open>x < a\<close> have "?l x < ?l a" |
|
| 51527 | 2056 |
proof (rule DERIV_pos_imp_increasing, safe) |
| 53079 | 2057 |
fix y |
2058 |
assume "x \<le> y" "y \<le> a" |
|
| 60758 | 2059 |
with \<open>0 < x\<close> \<open>a < 1\<close> have "0 < 1 / y - 1" "0 < y" |
| 51527 | 2060 |
by (auto simp: field_simps) |
|
61762
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61738
diff
changeset
|
2061 |
with D show "\<exists>z. DERIV ?l y :> z \<and> 0 < z" by blast |
| 51527 | 2062 |
qed |
2063 |
also have "\<dots> \<le> 0" |
|
| 60758 | 2064 |
using ln_le_minus_one \<open>0 < x\<close> \<open>x < a\<close> by (auto simp: field_simps) |
| 51527 | 2065 |
finally show "x = 1" using assms by auto |
2066 |
next |
|
2067 |
assume "1 < x" |
|
| 53079 | 2068 |
from dense[OF this] obtain a where "1 < a" "a < x" by blast |
| 60758 | 2069 |
from \<open>a < x\<close> have "?l x < ?l a" |
| 51527 | 2070 |
proof (rule DERIV_neg_imp_decreasing, safe) |
| 53079 | 2071 |
fix y |
2072 |
assume "a \<le> y" "y \<le> x" |
|
| 60758 | 2073 |
with \<open>1 < a\<close> have "1 / y - 1 < 0" "0 < y" |
| 51527 | 2074 |
by (auto simp: field_simps) |
2075 |
with D show "\<exists>z. DERIV ?l y :> z \<and> z < 0" |
|
2076 |
by blast |
|
2077 |
qed |
|
2078 |
also have "\<dots> \<le> 0" |
|
| 60758 | 2079 |
using ln_le_minus_one \<open>1 < a\<close> by (auto simp: field_simps) |
| 51527 | 2080 |
finally show "x = 1" using assms by auto |
| 53079 | 2081 |
next |
2082 |
assume "x = 1" |
|
2083 |
then show ?thesis by simp |
|
2084 |
qed |
|
| 51527 | 2085 |
qed |
2086 |
||
| 63558 | 2087 |
lemma ln_x_over_x_tendsto_0: "((\<lambda>x::real. ln x / x) \<longlongrightarrow> 0) at_top" |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2088 |
proof (rule lhospital_at_top_at_top[where f' = inverse and g' = "\<lambda>_. 1"]) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2089 |
from eventually_gt_at_top[of "0::real"] |
| 63558 | 2090 |
show "\<forall>\<^sub>F x in at_top. (ln has_real_derivative inverse x) (at x)" |
2091 |
by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps) |
|
2092 |
qed (use tendsto_inverse_0 in |
|
2093 |
\<open>auto simp: filterlim_ident dest!: tendsto_mono[OF at_top_le_at_infinity]\<close>) |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2094 |
|
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2095 |
lemma exp_ge_one_plus_x_over_n_power_n: |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2096 |
assumes "x \<ge> - real n" "n > 0" |
| 63558 | 2097 |
shows "(1 + x / of_nat n) ^ n \<le> exp x" |
2098 |
proof (cases "x = - of_nat n") |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2099 |
case False |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2100 |
from assms False have "(1 + x / of_nat n) ^ n = exp (of_nat n * ln (1 + x / of_nat n))" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2101 |
by (subst exp_of_nat_mult, subst exp_ln) (simp_all add: field_simps) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2102 |
also from assms False have "ln (1 + x / real n) \<le> x / real n" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2103 |
by (intro ln_add_one_self_le_self2) (simp_all add: field_simps) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2104 |
with assms have "exp (of_nat n * ln (1 + x / of_nat n)) \<le> exp x" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2105 |
by (simp add: field_simps) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2106 |
finally show ?thesis . |
| 63558 | 2107 |
next |
2108 |
case True |
|
2109 |
then show ?thesis by (simp add: zero_power) |
|
2110 |
qed |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2111 |
|
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2112 |
lemma exp_ge_one_minus_x_over_n_power_n: |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2113 |
assumes "x \<le> real n" "n > 0" |
| 63558 | 2114 |
shows "(1 - x / of_nat n) ^ n \<le> exp (-x)" |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2115 |
using exp_ge_one_plus_x_over_n_power_n[of n "-x"] assms by simp |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2116 |
|
| 61973 | 2117 |
lemma exp_at_bot: "(exp \<longlongrightarrow> (0::real)) at_bot" |
| 50326 | 2118 |
unfolding tendsto_Zfun_iff |
2119 |
proof (rule ZfunI, simp add: eventually_at_bot_dense) |
|
| 63558 | 2120 |
fix r :: real |
2121 |
assume "0 < r" |
|
2122 |
have "exp x < r" if "x < ln r" for x |
|
2123 |
proof - |
|
2124 |
from that have "exp x < exp (ln r)" |
|
| 50326 | 2125 |
by simp |
| 63558 | 2126 |
with \<open>0 < r\<close> show ?thesis |
| 53079 | 2127 |
by simp |
| 63558 | 2128 |
qed |
| 50326 | 2129 |
then show "\<exists>k. \<forall>n<k. exp n < r" by auto |
2130 |
qed |
|
2131 |
||
2132 |
lemma exp_at_top: "LIM x at_top. exp x :: real :> at_top" |
|
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
2133 |
by (rule filterlim_at_top_at_top[where Q="\<lambda>x. True" and P="\<lambda>x. 0 < x" and g="ln"]) |
| 63558 | 2134 |
(auto intro: eventually_gt_at_top) |
2135 |
||
2136 |
lemma lim_exp_minus_1: "((\<lambda>z::'a. (exp(z) - 1) / z) \<longlongrightarrow> 1) (at 0)" |
|
2137 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2138 |
proof - |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2139 |
have "((\<lambda>z::'a. exp(z) - 1) has_field_derivative 1) (at 0)" |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2140 |
by (intro derivative_eq_intros | simp)+ |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2141 |
then show ?thesis |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2142 |
by (simp add: Deriv.DERIV_iff2) |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2143 |
qed |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2144 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2145 |
lemma ln_at_0: "LIM x at_right 0. ln (x::real) :> at_bot" |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
2146 |
by (rule filterlim_at_bot_at_right[where Q="\<lambda>x. 0 < x" and P="\<lambda>x. True" and g="exp"]) |
|
51641
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents:
51527
diff
changeset
|
2147 |
(auto simp: eventually_at_filter) |
| 50326 | 2148 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2149 |
lemma ln_at_top: "LIM x at_top. ln (x::real) :> at_top" |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
2150 |
by (rule filterlim_at_top_at_top[where Q="\<lambda>x. 0 < x" and P="\<lambda>x. True" and g="exp"]) |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
2151 |
(auto intro: eventually_gt_at_top) |
| 50326 | 2152 |
|
|
60721
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2153 |
lemma filtermap_ln_at_top: "filtermap (ln::real \<Rightarrow> real) at_top = at_top" |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2154 |
by (intro filtermap_fun_inverse[of exp] exp_at_top ln_at_top) auto |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2155 |
|
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2156 |
lemma filtermap_exp_at_top: "filtermap (exp::real \<Rightarrow> real) at_top = at_top" |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2157 |
by (intro filtermap_fun_inverse[of ln] exp_at_top ln_at_top) |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2158 |
(auto simp: eventually_at_top_dense) |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2159 |
|
| 61973 | 2160 |
lemma tendsto_power_div_exp_0: "((\<lambda>x. x ^ k / exp x) \<longlongrightarrow> (0::real)) at_top" |
| 50347 | 2161 |
proof (induct k) |
| 53079 | 2162 |
case 0 |
| 61973 | 2163 |
show "((\<lambda>x. x ^ 0 / exp x) \<longlongrightarrow> (0::real)) at_top" |
| 50347 | 2164 |
by (simp add: inverse_eq_divide[symmetric]) |
2165 |
(metis filterlim_compose[OF tendsto_inverse_0] exp_at_top filterlim_mono |
|
| 63558 | 2166 |
at_top_le_at_infinity order_refl) |
| 50347 | 2167 |
next |
2168 |
case (Suc k) |
|
2169 |
show ?case |
|
2170 |
proof (rule lhospital_at_top_at_top) |
|
2171 |
show "eventually (\<lambda>x. DERIV (\<lambda>x. x ^ Suc k) x :> (real (Suc k) * x^k)) at_top" |
|
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2172 |
by eventually_elim (intro derivative_eq_intros, auto) |
| 50347 | 2173 |
show "eventually (\<lambda>x. DERIV exp x :> exp x) at_top" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2174 |
by eventually_elim auto |
| 50347 | 2175 |
show "eventually (\<lambda>x. exp x \<noteq> 0) at_top" |
2176 |
by auto |
|
2177 |
from tendsto_mult[OF tendsto_const Suc, of "real (Suc k)"] |
|
| 61973 | 2178 |
show "((\<lambda>x. real (Suc k) * x ^ k / exp x) \<longlongrightarrow> 0) at_top" |
| 50347 | 2179 |
by simp |
2180 |
qed (rule exp_at_top) |
|
2181 |
qed |
|
2182 |
||
| 63558 | 2183 |
definition log :: "real \<Rightarrow> real \<Rightarrow> real" |
| 61799 | 2184 |
\<comment> \<open>logarithm of @{term x} to base @{term a}\<close>
|
| 53079 | 2185 |
where "log a x = ln x / ln a" |
| 51527 | 2186 |
|
2187 |
lemma tendsto_log [tendsto_intros]: |
|
| 63558 | 2188 |
"(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> 0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < b \<Longrightarrow> |
2189 |
((\<lambda>x. log (f x) (g x)) \<longlongrightarrow> log a b) F" |
|
| 51527 | 2190 |
unfolding log_def by (intro tendsto_intros) auto |
2191 |
||
2192 |
lemma continuous_log: |
|
| 53079 | 2193 |
assumes "continuous F f" |
2194 |
and "continuous F g" |
|
2195 |
and "0 < f (Lim F (\<lambda>x. x))" |
|
2196 |
and "f (Lim F (\<lambda>x. x)) \<noteq> 1" |
|
2197 |
and "0 < g (Lim F (\<lambda>x. x))" |
|
| 51527 | 2198 |
shows "continuous F (\<lambda>x. log (f x) (g x))" |
2199 |
using assms unfolding continuous_def by (rule tendsto_log) |
|
2200 |
||
2201 |
lemma continuous_at_within_log[continuous_intros]: |
|
| 53079 | 2202 |
assumes "continuous (at a within s) f" |
2203 |
and "continuous (at a within s) g" |
|
2204 |
and "0 < f a" |
|
2205 |
and "f a \<noteq> 1" |
|
2206 |
and "0 < g a" |
|
| 51527 | 2207 |
shows "continuous (at a within s) (\<lambda>x. log (f x) (g x))" |
2208 |
using assms unfolding continuous_within by (rule tendsto_log) |
|
2209 |
||
2210 |
lemma isCont_log[continuous_intros, simp]: |
|
2211 |
assumes "isCont f a" "isCont g a" "0 < f a" "f a \<noteq> 1" "0 < g a" |
|
2212 |
shows "isCont (\<lambda>x. log (f x) (g x)) a" |
|
2213 |
using assms unfolding continuous_at by (rule tendsto_log) |
|
2214 |
||
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
2215 |
lemma continuous_on_log[continuous_intros]: |
| 53079 | 2216 |
assumes "continuous_on s f" "continuous_on s g" |
2217 |
and "\<forall>x\<in>s. 0 < f x" "\<forall>x\<in>s. f x \<noteq> 1" "\<forall>x\<in>s. 0 < g x" |
|
| 51527 | 2218 |
shows "continuous_on s (\<lambda>x. log (f x) (g x))" |
2219 |
using assms unfolding continuous_on_def by (fast intro: tendsto_log) |
|
2220 |
||
2221 |
lemma powr_one_eq_one [simp]: "1 powr a = 1" |
|
| 53079 | 2222 |
by (simp add: powr_def) |
| 51527 | 2223 |
|
| 63558 | 2224 |
lemma powr_zero_eq_one [simp]: "x powr 0 = (if x = 0 then 0 else 1)" |
| 53079 | 2225 |
by (simp add: powr_def) |
| 51527 | 2226 |
|
| 63558 | 2227 |
lemma powr_one_gt_zero_iff [simp]: "x powr 1 = x \<longleftrightarrow> 0 \<le> x" |
2228 |
for x :: real |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2229 |
by (auto simp: powr_def) |
| 51527 | 2230 |
declare powr_one_gt_zero_iff [THEN iffD2, simp] |
2231 |
||
| 63558 | 2232 |
lemma powr_mult: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> (x * y) powr a = (x powr a) * (y powr a)" |
2233 |
for a x y :: real |
|
| 53079 | 2234 |
by (simp add: powr_def exp_add [symmetric] ln_mult distrib_left) |
| 51527 | 2235 |
|
| 63558 | 2236 |
lemma powr_ge_pzero [simp]: "0 \<le> x powr y" |
2237 |
for x y :: real |
|
| 53079 | 2238 |
by (simp add: powr_def) |
| 51527 | 2239 |
|
| 63558 | 2240 |
lemma powr_divide: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> (x / y) powr a = (x powr a) / (y powr a)" |
2241 |
for a b x :: real |
|
| 53079 | 2242 |
apply (simp add: divide_inverse positive_imp_inverse_positive powr_mult) |
2243 |
apply (simp add: powr_def exp_minus [symmetric] exp_add [symmetric] ln_inverse) |
|
2244 |
done |
|
| 51527 | 2245 |
|
| 63558 | 2246 |
lemma powr_divide2: "x powr a / x powr b = x powr (a - b)" |
2247 |
for a b x :: real |
|
| 51527 | 2248 |
apply (simp add: powr_def) |
2249 |
apply (subst exp_diff [THEN sym]) |
|
2250 |
apply (simp add: left_diff_distrib) |
|
| 53079 | 2251 |
done |
| 51527 | 2252 |
|
| 63558 | 2253 |
lemma powr_add: "x powr (a + b) = (x powr a) * (x powr b)" |
2254 |
for a b x :: real |
|
| 53079 | 2255 |
by (simp add: powr_def exp_add [symmetric] distrib_right) |
2256 |
||
| 63558 | 2257 |
lemma powr_mult_base: "0 < x \<Longrightarrow>x * x powr y = x powr (1 + y)" |
2258 |
for x :: real |
|
| 63092 | 2259 |
by (auto simp: powr_add) |
| 51527 | 2260 |
|
| 63558 | 2261 |
lemma powr_powr: "(x powr a) powr b = x powr (a * b)" |
2262 |
for a b x :: real |
|
| 53079 | 2263 |
by (simp add: powr_def) |
| 51527 | 2264 |
|
| 63558 | 2265 |
lemma powr_powr_swap: "(x powr a) powr b = (x powr b) powr a" |
2266 |
for a b x :: real |
|
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
2267 |
by (simp add: powr_powr mult.commute) |
| 51527 | 2268 |
|
| 63558 | 2269 |
lemma powr_minus: "x powr (- a) = inverse (x powr a)" |
2270 |
for x a :: real |
|
| 53079 | 2271 |
by (simp add: powr_def exp_minus [symmetric]) |
| 51527 | 2272 |
|
| 63558 | 2273 |
lemma powr_minus_divide: "x powr (- a) = 1/(x powr a)" |
2274 |
for x a :: real |
|
| 53079 | 2275 |
by (simp add: divide_inverse powr_minus) |
2276 |
||
| 63558 | 2277 |
lemma divide_powr_uminus: "a / b powr c = a * b powr (- c)" |
2278 |
for a b c :: real |
|
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2279 |
by (simp add: powr_minus_divide) |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2280 |
|
| 63558 | 2281 |
lemma powr_less_mono: "a < b \<Longrightarrow> 1 < x \<Longrightarrow> x powr a < x powr b" |
2282 |
for a b x :: real |
|
| 53079 | 2283 |
by (simp add: powr_def) |
2284 |
||
| 63558 | 2285 |
lemma powr_less_cancel: "x powr a < x powr b \<Longrightarrow> 1 < x \<Longrightarrow> a < b" |
2286 |
for a b x :: real |
|
| 53079 | 2287 |
by (simp add: powr_def) |
2288 |
||
| 63558 | 2289 |
lemma powr_less_cancel_iff [simp]: "1 < x \<Longrightarrow> x powr a < x powr b \<longleftrightarrow> a < b" |
2290 |
for a b x :: real |
|
| 53079 | 2291 |
by (blast intro: powr_less_cancel powr_less_mono) |
2292 |
||
| 63558 | 2293 |
lemma powr_le_cancel_iff [simp]: "1 < x \<Longrightarrow> x powr a \<le> x powr b \<longleftrightarrow> a \<le> b" |
2294 |
for a b x :: real |
|
| 53079 | 2295 |
by (simp add: linorder_not_less [symmetric]) |
| 51527 | 2296 |
|
2297 |
lemma log_ln: "ln x = log (exp(1)) x" |
|
| 53079 | 2298 |
by (simp add: log_def) |
2299 |
||
2300 |
lemma DERIV_log: |
|
2301 |
assumes "x > 0" |
|
2302 |
shows "DERIV (\<lambda>y. log b y) x :> 1 / (ln b * x)" |
|
| 51527 | 2303 |
proof - |
| 63040 | 2304 |
define lb where "lb = 1 / ln b" |
| 51527 | 2305 |
moreover have "DERIV (\<lambda>y. lb * ln y) x :> lb / x" |
| 60758 | 2306 |
using \<open>x > 0\<close> by (auto intro!: derivative_eq_intros) |
| 51527 | 2307 |
ultimately show ?thesis |
2308 |
by (simp add: log_def) |
|
2309 |
qed |
|
2310 |
||
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2311 |
lemmas DERIV_log[THEN DERIV_chain2, derivative_intros] |
| 63558 | 2312 |
and DERIV_log[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
| 51527 | 2313 |
|
| 53079 | 2314 |
lemma powr_log_cancel [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> a powr (log a x) = x" |
2315 |
by (simp add: powr_def log_def) |
|
2316 |
||
2317 |
lemma log_powr_cancel [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log a (a powr y) = y" |
|
2318 |
by (simp add: log_def powr_def) |
|
2319 |
||
2320 |
lemma log_mult: |
|
2321 |
"0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> |
|
2322 |
log a (x * y) = log a x + log a y" |
|
2323 |
by (simp add: log_def ln_mult divide_inverse distrib_right) |
|
2324 |
||
2325 |
lemma log_eq_div_ln_mult_log: |
|
2326 |
"0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> |
|
2327 |
log a x = (ln b/ln a) * log b x" |
|
2328 |
by (simp add: log_def divide_inverse) |
|
| 51527 | 2329 |
|
| 60758 | 2330 |
text\<open>Base 10 logarithms\<close> |
| 53079 | 2331 |
lemma log_base_10_eq1: "0 < x \<Longrightarrow> log 10 x = (ln (exp 1) / ln 10) * ln x" |
2332 |
by (simp add: log_def) |
|
2333 |
||
2334 |
lemma log_base_10_eq2: "0 < x \<Longrightarrow> log 10 x = (log 10 (exp 1)) * ln x" |
|
2335 |
by (simp add: log_def) |
|
| 51527 | 2336 |
|
2337 |
lemma log_one [simp]: "log a 1 = 0" |
|
| 53079 | 2338 |
by (simp add: log_def) |
| 51527 | 2339 |
|
| 63558 | 2340 |
lemma log_eq_one [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log a a = 1" |
| 53079 | 2341 |
by (simp add: log_def) |
2342 |
||
2343 |
lemma log_inverse: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> log a (inverse x) = - log a x" |
|
| 63558 | 2344 |
apply (rule add_left_cancel [THEN iffD1, where a1 = "log a x"]) |
| 53079 | 2345 |
apply (simp add: log_mult [symmetric]) |
2346 |
done |
|
2347 |
||
2348 |
lemma log_divide: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> log a (x/y) = log a x - log a y" |
|
2349 |
by (simp add: log_mult divide_inverse log_inverse) |
|
| 51527 | 2350 |
|
| 63558 | 2351 |
lemma powr_gt_zero [simp]: "0 < x powr a \<longleftrightarrow> x \<noteq> 0" |
2352 |
for a x :: real |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2353 |
by (simp add: powr_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2354 |
|
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2355 |
lemma log_add_eq_powr: "0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> log b x + y = log b (x * b powr y)" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2356 |
and add_log_eq_powr: "0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> y + log b x = log b (b powr y * x)" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2357 |
and log_minus_eq_powr: "0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> log b x - y = log b (x * b powr -y)" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2358 |
and minus_log_eq_powr: "0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> y - log b x = log b (b powr y / x)" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2359 |
by (simp_all add: log_mult log_divide) |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2360 |
|
| 63558 | 2361 |
lemma log_less_cancel_iff [simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> log a x < log a y \<longleftrightarrow> x < y" |
| 53079 | 2362 |
apply safe |
| 63558 | 2363 |
apply (rule_tac [2] powr_less_cancel) |
2364 |
apply (drule_tac a = "log a x" in powr_less_mono) |
|
2365 |
apply auto |
|
| 53079 | 2366 |
done |
2367 |
||
2368 |
lemma log_inj: |
|
2369 |
assumes "1 < b" |
|
2370 |
shows "inj_on (log b) {0 <..}"
|
|
| 51527 | 2371 |
proof (rule inj_onI, simp) |
| 53079 | 2372 |
fix x y |
2373 |
assume pos: "0 < x" "0 < y" and *: "log b x = log b y" |
|
| 51527 | 2374 |
show "x = y" |
2375 |
proof (cases rule: linorder_cases) |
|
| 53079 | 2376 |
assume "x = y" |
2377 |
then show ?thesis by simp |
|
2378 |
next |
|
| 63558 | 2379 |
assume "x < y" |
2380 |
then have "log b x < log b y" |
|
| 60758 | 2381 |
using log_less_cancel_iff[OF \<open>1 < b\<close>] pos by simp |
| 53079 | 2382 |
then show ?thesis using * by simp |
| 51527 | 2383 |
next |
| 63558 | 2384 |
assume "y < x" |
2385 |
then have "log b y < log b x" |
|
| 60758 | 2386 |
using log_less_cancel_iff[OF \<open>1 < b\<close>] pos by simp |
| 53079 | 2387 |
then show ?thesis using * by simp |
2388 |
qed |
|
| 51527 | 2389 |
qed |
2390 |
||
| 63558 | 2391 |
lemma log_le_cancel_iff [simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> log a x \<le> log a y \<longleftrightarrow> x \<le> y" |
| 53079 | 2392 |
by (simp add: linorder_not_less [symmetric]) |
| 51527 | 2393 |
|
2394 |
lemma zero_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < log a x \<longleftrightarrow> 1 < x" |
|
2395 |
using log_less_cancel_iff[of a 1 x] by simp |
|
2396 |
||
2397 |
lemma zero_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 \<le> log a x \<longleftrightarrow> 1 \<le> x" |
|
2398 |
using log_le_cancel_iff[of a 1 x] by simp |
|
2399 |
||
2400 |
lemma log_less_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 0 \<longleftrightarrow> x < 1" |
|
2401 |
using log_less_cancel_iff[of a x 1] by simp |
|
2402 |
||
2403 |
lemma log_le_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 0 \<longleftrightarrow> x \<le> 1" |
|
2404 |
using log_le_cancel_iff[of a x 1] by simp |
|
2405 |
||
2406 |
lemma one_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 < log a x \<longleftrightarrow> a < x" |
|
2407 |
using log_less_cancel_iff[of a a x] by simp |
|
2408 |
||
2409 |
lemma one_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 \<le> log a x \<longleftrightarrow> a \<le> x" |
|
2410 |
using log_le_cancel_iff[of a a x] by simp |
|
2411 |
||
2412 |
lemma log_less_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 1 \<longleftrightarrow> x < a" |
|
2413 |
using log_less_cancel_iff[of a x a] by simp |
|
2414 |
||
2415 |
lemma log_le_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 1 \<longleftrightarrow> x \<le> a" |
|
2416 |
using log_le_cancel_iff[of a x a] by simp |
|
2417 |
||
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2418 |
lemma le_log_iff: |
| 63558 | 2419 |
fixes b x y :: real |
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2420 |
assumes "1 < b" "x > 0" |
| 63558 | 2421 |
shows "y \<le> log b x \<longleftrightarrow> b powr y \<le> x" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
2422 |
using assms |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2423 |
apply auto |
| 63558 | 2424 |
apply (metis (no_types, hide_lams) less_irrefl less_le_trans linear powr_le_cancel_iff |
2425 |
powr_log_cancel zero_less_one) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2426 |
apply (metis not_less order.trans order_refl powr_le_cancel_iff powr_log_cancel zero_le_one) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2427 |
done |
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2428 |
|
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2429 |
lemma less_log_iff: |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2430 |
assumes "1 < b" "x > 0" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2431 |
shows "y < log b x \<longleftrightarrow> b powr y < x" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2432 |
by (metis assms dual_order.strict_trans less_irrefl powr_less_cancel_iff |
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2433 |
powr_log_cancel zero_less_one) |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2434 |
|
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2435 |
lemma |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2436 |
assumes "1 < b" "x > 0" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2437 |
shows log_less_iff: "log b x < y \<longleftrightarrow> x < b powr y" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2438 |
and log_le_iff: "log b x \<le> y \<longleftrightarrow> x \<le> b powr y" |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2439 |
using le_log_iff[OF assms, of y] less_log_iff[OF assms, of y] |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2440 |
by auto |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2441 |
|
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2442 |
lemmas powr_le_iff = le_log_iff[symmetric] |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2443 |
and powr_less_iff = le_log_iff[symmetric] |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2444 |
and less_powr_iff = log_less_iff[symmetric] |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2445 |
and le_powr_iff = log_le_iff[symmetric] |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2446 |
|
| 63558 | 2447 |
lemma floor_log_eq_powr_iff: "x > 0 \<Longrightarrow> b > 1 \<Longrightarrow> \<lfloor>log b x\<rfloor> = k \<longleftrightarrow> b powr k \<le> x \<and> x < b powr (k + 1)" |
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2448 |
by (auto simp add: floor_eq_iff powr_le_iff less_powr_iff) |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2449 |
|
| 63558 | 2450 |
lemma powr_realpow: "0 < x \<Longrightarrow> x powr (real n) = x^n" |
2451 |
by (induct n) (simp_all add: ac_simps powr_add) |
|
| 51527 | 2452 |
|
|
61738
c4f6031f1310
New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents:
61694
diff
changeset
|
2453 |
lemma powr_numeral: "0 < x \<Longrightarrow> x powr (numeral n :: real) = x ^ (numeral n)" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
2454 |
by (metis of_nat_numeral powr_realpow) |
| 52139 | 2455 |
|
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2456 |
lemma powr_real_of_int: |
| 63558 | 2457 |
"x > 0 \<Longrightarrow> x powr real_of_int n = (if n \<ge> 0 then x ^ nat n else inverse (x ^ nat (- n)))" |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2458 |
using powr_realpow[of x "nat n"] powr_realpow[of x "nat (-n)"] |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2459 |
by (auto simp: field_simps powr_minus) |
|
62049
b0f941e207cf
Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents:
61976
diff
changeset
|
2460 |
|
| 57180 | 2461 |
lemma powr2_sqrt[simp]: "0 < x \<Longrightarrow> sqrt x powr 2 = x" |
| 63558 | 2462 |
by (simp add: powr_numeral) |
2463 |
||
2464 |
lemma powr_realpow2: "0 \<le> x \<Longrightarrow> 0 < n \<Longrightarrow> x^n = (if (x = 0) then 0 else x powr (real n))" |
|
2465 |
apply (cases "x = 0") |
|
2466 |
apply simp_all |
|
2467 |
apply (rule powr_realpow [THEN sym]) |
|
2468 |
apply simp |
|
| 53079 | 2469 |
done |
| 51527 | 2470 |
|
2471 |
lemma powr_int: |
|
2472 |
assumes "x > 0" |
|
2473 |
shows "x powr i = (if i \<ge> 0 then x ^ nat i else 1 / x ^ nat (-i))" |
|
| 53079 | 2474 |
proof (cases "i < 0") |
2475 |
case True |
|
| 63558 | 2476 |
have r: "x powr i = 1 / x powr (- i)" |
2477 |
by (simp add: powr_minus field_simps) |
|
2478 |
show ?thesis using \<open>i < 0\<close> \<open>x > 0\<close> |
|
2479 |
by (simp add: r field_simps powr_realpow[symmetric]) |
|
| 53079 | 2480 |
next |
2481 |
case False |
|
| 63558 | 2482 |
then show ?thesis |
2483 |
by (simp add: assms powr_realpow[symmetric]) |
|
| 53079 | 2484 |
qed |
| 51527 | 2485 |
|
| 58981 | 2486 |
lemma compute_powr[code]: |
| 63558 | 2487 |
fixes i :: real |
| 58981 | 2488 |
shows "b powr i = |
2489 |
(if b \<le> 0 then Code.abort (STR ''op powr with nonpositive base'') (\<lambda>_. b powr i) |
|
| 63558 | 2490 |
else if \<lfloor>i\<rfloor> = i then (if 0 \<le> i then b ^ nat \<lfloor>i\<rfloor> else 1 / b ^ nat \<lfloor>- i\<rfloor>) |
2491 |
else Code.abort (STR ''op powr with non-integer exponent'') (\<lambda>_. b powr i))" |
|
|
59587
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
nipkow
parents:
58984
diff
changeset
|
2492 |
by (auto simp: powr_int) |
| 58981 | 2493 |
|
| 63558 | 2494 |
lemma powr_one: "0 \<le> x \<Longrightarrow> x powr 1 = x" |
2495 |
for x :: real |
|
2496 |
using powr_realpow [of x 1] by simp |
|
2497 |
||
2498 |
lemma powr_neg_one: "0 < x \<Longrightarrow> x powr - 1 = 1 / x" |
|
2499 |
for x :: real |
|
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2500 |
using powr_int [of x "- 1"] by simp |
|
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2501 |
|
| 63558 | 2502 |
lemma powr_neg_numeral: "0 < x \<Longrightarrow> x powr - numeral n = 1 / x ^ numeral n" |
2503 |
for x :: real |
|
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2504 |
using powr_int [of x "- numeral n"] by simp |
| 51527 | 2505 |
|
| 53079 | 2506 |
lemma root_powr_inverse: "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> root n x = x powr (1/n)" |
| 51527 | 2507 |
by (rule real_root_pos_unique) (auto simp: powr_realpow[symmetric] powr_powr) |
2508 |
||
| 63558 | 2509 |
lemma ln_powr: "x \<noteq> 0 \<Longrightarrow> ln (x powr y) = y * ln x" |
2510 |
for x :: real |
|
| 56483 | 2511 |
by (simp add: powr_def) |
2512 |
||
| 63558 | 2513 |
lemma ln_root: "n > 0 \<Longrightarrow> b > 0 \<Longrightarrow> ln (root n b) = ln b / n" |
2514 |
by (simp add: root_powr_inverse ln_powr) |
|
| 56952 | 2515 |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2516 |
lemma ln_sqrt: "0 < x \<Longrightarrow> ln (sqrt x) = ln x / 2" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
2517 |
by (simp add: ln_powr powr_numeral ln_powr[symmetric] mult.commute) |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2518 |
|
| 63558 | 2519 |
lemma log_root: "n > 0 \<Longrightarrow> a > 0 \<Longrightarrow> log b (root n a) = log b a / n" |
2520 |
by (simp add: log_def ln_root) |
|
| 56952 | 2521 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2522 |
lemma log_powr: "x \<noteq> 0 \<Longrightarrow> log b (x powr y) = y * log b x" |
| 56483 | 2523 |
by (simp add: log_def ln_powr) |
2524 |
||
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
2525 |
lemma log_nat_power: "0 < x \<Longrightarrow> log b (x^n) = real n * log b x" |
| 56483 | 2526 |
by (simp add: log_powr powr_realpow [symmetric]) |
2527 |
||
| 63558 | 2528 |
lemma le_log_of_power: |
2529 |
assumes "1 < b" "b ^ n \<le> m" |
|
2530 |
shows "n \<le> log b m" |
|
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2531 |
proof - |
|
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2532 |
from assms have "0 < m" |
|
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2533 |
by (metis less_trans zero_less_power less_le_trans zero_less_one) |
| 63558 | 2534 |
have "n = log b (b ^ n)" |
2535 |
using assms(1) by (simp add: log_nat_power) |
|
2536 |
also have "\<dots> \<le> log b m" |
|
2537 |
using assms \<open>0 < m\<close> by simp |
|
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2538 |
finally show ?thesis . |
|
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2539 |
qed |
|
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2540 |
|
| 63558 | 2541 |
lemma le_log2_of_power: "2 ^ n \<le> m \<Longrightarrow> n \<le> log 2 m" |
2542 |
for m n :: nat |
|
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2543 |
using le_log_of_power[of 2] by simp |
|
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2544 |
|
| 56483 | 2545 |
lemma log_base_change: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log b x = log a x / log a b" |
2546 |
by (simp add: log_def) |
|
2547 |
||
2548 |
lemma log_base_pow: "0 < a \<Longrightarrow> log (a ^ n) x = log a x / n" |
|
2549 |
by (simp add: log_def ln_realpow) |
|
2550 |
||
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2551 |
lemma log_base_powr: "a \<noteq> 0 \<Longrightarrow> log (a powr b) x = log a x / b" |
| 56483 | 2552 |
by (simp add: log_def ln_powr) |
| 51527 | 2553 |
|
| 63558 | 2554 |
lemma log_base_root: "n > 0 \<Longrightarrow> b > 0 \<Longrightarrow> log (root n b) x = n * (log b x)" |
2555 |
by (simp add: log_def ln_root) |
|
2556 |
||
2557 |
lemma ln_bound: "1 \<le> x \<Longrightarrow> ln x \<le> x" |
|
2558 |
for x :: real |
|
2559 |
apply (subgoal_tac "ln (1 + (x - 1)) \<le> x - 1") |
|
2560 |
apply simp |
|
2561 |
apply (rule ln_add_one_self_le_self) |
|
| 51527 | 2562 |
apply simp |
| 53079 | 2563 |
done |
| 51527 | 2564 |
|
| 63558 | 2565 |
lemma powr_mono: "a \<le> b \<Longrightarrow> 1 \<le> x \<Longrightarrow> x powr a \<le> x powr b" |
2566 |
for x :: real |
|
2567 |
apply (cases "x = 1") |
|
2568 |
apply simp |
|
2569 |
apply (cases "a = b") |
|
2570 |
apply simp |
|
2571 |
apply (rule order_less_imp_le) |
|
2572 |
apply (rule powr_less_mono) |
|
2573 |
apply auto |
|
2574 |
done |
|
2575 |
||
2576 |
lemma ge_one_powr_ge_zero: "1 \<le> x \<Longrightarrow> 0 \<le> a \<Longrightarrow> 1 \<le> x powr a" |
|
2577 |
for x :: real |
|
2578 |
using powr_mono by fastforce |
|
2579 |
||
2580 |
lemma powr_less_mono2: "0 < a \<Longrightarrow> 0 \<le> x \<Longrightarrow> x < y \<Longrightarrow> x powr a < y powr a" |
|
2581 |
for x :: real |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2582 |
by (simp add: powr_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2583 |
|
| 63558 | 2584 |
lemma powr_less_mono2_neg: "a < 0 \<Longrightarrow> 0 < x \<Longrightarrow> x < y \<Longrightarrow> y powr a < x powr a" |
2585 |
for x :: real |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2586 |
by (simp add: powr_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2587 |
|
| 63558 | 2588 |
lemma powr_mono2: "0 \<le> a \<Longrightarrow> 0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> x powr a \<le> y powr a" |
2589 |
for x :: real |
|
2590 |
apply (case_tac "a = 0") |
|
2591 |
apply simp |
|
2592 |
apply (case_tac "x = y") |
|
2593 |
apply simp |
|
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2594 |
apply (metis dual_order.strict_iff_order powr_less_mono2) |
| 53079 | 2595 |
done |
2596 |
||
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2597 |
lemma powr_mono2': |
| 63558 | 2598 |
fixes a x y :: real |
2599 |
assumes "a \<le> 0" "x > 0" "x \<le> y" |
|
2600 |
shows "x powr a \<ge> y powr a" |
|
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2601 |
proof - |
| 63558 | 2602 |
from assms have "x powr - a \<le> y powr - a" |
2603 |
by (intro powr_mono2) simp_all |
|
2604 |
with assms show ?thesis |
|
2605 |
by (auto simp add: powr_minus field_simps) |
|
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2606 |
qed |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2607 |
|
| 63558 | 2608 |
lemma powr_inj: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> a powr x = a powr y \<longleftrightarrow> x = y" |
2609 |
for x :: real |
|
| 51527 | 2610 |
unfolding powr_def exp_inj_iff by simp |
2611 |
||
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2612 |
lemma powr_half_sqrt: "0 \<le> x \<Longrightarrow> x powr (1/2) = sqrt x" |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2613 |
by (simp add: powr_def root_powr_inverse sqrt_def) |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2614 |
|
| 63558 | 2615 |
lemma ln_powr_bound: "1 \<le> x \<Longrightarrow> 0 < a \<Longrightarrow> ln x \<le> (x powr a) / a" |
2616 |
for x :: real |
|
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2617 |
by (metis exp_gt_zero linear ln_eq_zero_iff ln_exp ln_less_self ln_powr mult.commute |
| 63558 | 2618 |
mult_imp_le_div_pos not_less powr_gt_zero) |
| 51527 | 2619 |
|
2620 |
lemma ln_powr_bound2: |
|
| 63558 | 2621 |
fixes x :: real |
| 51527 | 2622 |
assumes "1 < x" and "0 < a" |
| 63558 | 2623 |
shows "(ln x) powr a \<le> (a powr a) * x" |
| 51527 | 2624 |
proof - |
| 63558 | 2625 |
from assms have "ln x \<le> (x powr (1 / a)) / (1 / a)" |
| 54575 | 2626 |
by (metis less_eq_real_def ln_powr_bound zero_less_divide_1_iff) |
| 63558 | 2627 |
also have "\<dots> = a * (x powr (1 / a))" |
| 51527 | 2628 |
by simp |
| 63558 | 2629 |
finally have "(ln x) powr a \<le> (a * (x powr (1 / a))) powr a" |
| 54575 | 2630 |
by (metis assms less_imp_le ln_gt_zero powr_mono2) |
| 63558 | 2631 |
also have "\<dots> = (a powr a) * ((x powr (1 / a)) powr a)" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2632 |
using assms powr_mult by auto |
| 51527 | 2633 |
also have "(x powr (1 / a)) powr a = x powr ((1 / a) * a)" |
2634 |
by (rule powr_powr) |
|
| 63558 | 2635 |
also have "\<dots> = x" using assms |
| 54575 | 2636 |
by auto |
| 51527 | 2637 |
finally show ?thesis . |
2638 |
qed |
|
2639 |
||
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2640 |
lemma tendsto_powr: |
| 63558 | 2641 |
fixes a b :: real |
2642 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2643 |
and g: "(g \<longlongrightarrow> b) F" |
|
2644 |
and a: "a \<noteq> 0" |
|
| 61973 | 2645 |
shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> a powr b) F" |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2646 |
unfolding powr_def |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2647 |
proof (rule filterlim_If) |
| 61973 | 2648 |
from f show "((\<lambda>x. 0) \<longlongrightarrow> (if a = 0 then 0 else exp (b * ln a))) (inf F (principal {x. f x = 0}))"
|
| 61810 | 2649 |
by simp (auto simp: filterlim_iff eventually_inf_principal elim: eventually_mono dest: t1_space_nhds) |
| 63558 | 2650 |
from f g a show "((\<lambda>x. exp (g x * ln (f x))) \<longlongrightarrow> (if a = 0 then 0 else exp (b * ln a))) |
2651 |
(inf F (principal {x. f x \<noteq> 0}))"
|
|
2652 |
by (auto intro!: tendsto_intros intro: tendsto_mono inf_le1) |
|
2653 |
qed |
|
| 51527 | 2654 |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2655 |
lemma tendsto_powr'[tendsto_intros]: |
| 63558 | 2656 |
fixes a :: real |
2657 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2658 |
and g: "(g \<longlongrightarrow> b) F" |
|
2659 |
and a: "a \<noteq> 0 \<or> (b > 0 \<and> eventually (\<lambda>x. f x \<ge> 0) F)" |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2660 |
shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> a powr b) F" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2661 |
proof - |
| 63558 | 2662 |
from a consider "a \<noteq> 0" | "a = 0" "b > 0" "eventually (\<lambda>x. f x \<ge> 0) F" |
2663 |
by auto |
|
2664 |
then show ?thesis |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2665 |
proof cases |
| 63558 | 2666 |
case 1 |
2667 |
with f g show ?thesis by (rule tendsto_powr) |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2668 |
next |
| 63558 | 2669 |
case 2 |
2670 |
have "((\<lambda>x. if f x = 0 then 0 else exp (g x * ln (f x))) \<longlongrightarrow> 0) F" |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2671 |
proof (intro filterlim_If) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2672 |
have "filterlim f (principal {0<..}) (inf F (principal {z. f z \<noteq> 0}))"
|
| 63558 | 2673 |
using \<open>eventually (\<lambda>x. f x \<ge> 0) F\<close> |
2674 |
by (auto simp add: filterlim_iff eventually_inf_principal |
|
2675 |
eventually_principal elim: eventually_mono) |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2676 |
moreover have "filterlim f (nhds a) (inf F (principal {z. f z \<noteq> 0}))"
|
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2677 |
by (rule tendsto_mono[OF _ f]) simp_all |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2678 |
ultimately have f: "filterlim f (at_right 0) (inf F (principal {x. f x \<noteq> 0}))"
|
| 63558 | 2679 |
by (simp add: at_within_def filterlim_inf \<open>a = 0\<close>) |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2680 |
have g: "(g \<longlongrightarrow> b) (inf F (principal {z. f z \<noteq> 0}))"
|
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2681 |
by (rule tendsto_mono[OF _ g]) simp_all |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2682 |
show "((\<lambda>x. exp (g x * ln (f x))) \<longlongrightarrow> 0) (inf F (principal {x. f x \<noteq> 0}))"
|
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2683 |
by (rule filterlim_compose[OF exp_at_bot] filterlim_tendsto_pos_mult_at_bot |
| 63558 | 2684 |
filterlim_compose[OF ln_at_0] f g \<open>b > 0\<close>)+ |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2685 |
qed simp_all |
| 63558 | 2686 |
with \<open>a = 0\<close> show ?thesis |
2687 |
by (simp add: powr_def) |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2688 |
qed |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2689 |
qed |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2690 |
|
| 51527 | 2691 |
lemma continuous_powr: |
| 53079 | 2692 |
assumes "continuous F f" |
2693 |
and "continuous F g" |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2694 |
and "f (Lim F (\<lambda>x. x)) \<noteq> 0" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2695 |
shows "continuous F (\<lambda>x. (f x) powr (g x :: real))" |
| 51527 | 2696 |
using assms unfolding continuous_def by (rule tendsto_powr) |
2697 |
||
2698 |
lemma continuous_at_within_powr[continuous_intros]: |
|
| 63558 | 2699 |
fixes f g :: "_ \<Rightarrow> real" |
| 53079 | 2700 |
assumes "continuous (at a within s) f" |
2701 |
and "continuous (at a within s) g" |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2702 |
and "f a \<noteq> 0" |
| 63558 | 2703 |
shows "continuous (at a within s) (\<lambda>x. (f x) powr (g x))" |
| 51527 | 2704 |
using assms unfolding continuous_within by (rule tendsto_powr) |
2705 |
||
2706 |
lemma isCont_powr[continuous_intros, simp]: |
|
| 63558 | 2707 |
fixes f g :: "_ \<Rightarrow> real" |
2708 |
assumes "isCont f a" "isCont g a" "f a \<noteq> 0" |
|
| 51527 | 2709 |
shows "isCont (\<lambda>x. (f x) powr g x) a" |
2710 |
using assms unfolding continuous_at by (rule tendsto_powr) |
|
2711 |
||
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
2712 |
lemma continuous_on_powr[continuous_intros]: |
| 63558 | 2713 |
fixes f g :: "_ \<Rightarrow> real" |
2714 |
assumes "continuous_on s f" "continuous_on s g" and "\<forall>x\<in>s. f x \<noteq> 0" |
|
| 51527 | 2715 |
shows "continuous_on s (\<lambda>x. (f x) powr (g x))" |
2716 |
using assms unfolding continuous_on_def by (fast intro: tendsto_powr) |
|
| 63558 | 2717 |
|
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2718 |
lemma tendsto_powr2: |
| 63558 | 2719 |
fixes a :: real |
2720 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2721 |
and g: "(g \<longlongrightarrow> b) F" |
|
2722 |
and "\<forall>\<^sub>F x in F. 0 \<le> f x" |
|
2723 |
and b: "0 < b" |
|
| 61973 | 2724 |
shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> a powr b) F" |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2725 |
using tendsto_powr'[of f a F g b] assms by auto |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2726 |
|
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2727 |
lemma DERIV_powr: |
| 63558 | 2728 |
fixes r :: real |
2729 |
assumes g: "DERIV g x :> m" |
|
2730 |
and pos: "g x > 0" |
|
2731 |
and f: "DERIV f x :> r" |
|
2732 |
shows "DERIV (\<lambda>x. g x powr f x) x :> (g x powr f x) * (r * ln (g x) + m * f x / g x)" |
|
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2733 |
proof - |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2734 |
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)" |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2735 |
using pos |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2736 |
by (auto intro!: derivative_eq_intros g pos f simp: powr_def field_simps exp_diff) |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2737 |
then show ?thesis |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2738 |
proof (rule DERIV_cong_ev[OF refl _ refl, THEN iffD1, rotated]) |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2739 |
from DERIV_isCont[OF g] pos have "\<forall>\<^sub>F x in at x. 0 < g x" |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2740 |
unfolding isCont_def by (rule order_tendstoD(1)) |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2741 |
with pos show "\<forall>\<^sub>F x in nhds x. exp (f x * ln (g x)) = g x powr f x" |
| 61810 | 2742 |
by (auto simp: eventually_at_filter powr_def elim: eventually_mono) |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2743 |
qed |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2744 |
qed |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2745 |
|
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2746 |
lemma DERIV_fun_powr: |
| 63558 | 2747 |
fixes r :: real |
2748 |
assumes g: "DERIV g x :> m" |
|
2749 |
and pos: "g x > 0" |
|
2750 |
shows "DERIV (\<lambda>x. (g x) powr r) x :> r * (g x) powr (r - of_nat 1) * m" |
|
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2751 |
using DERIV_powr[OF g pos DERIV_const, of r] pos |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2752 |
by (simp add: powr_divide2[symmetric] field_simps) |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2753 |
|
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2754 |
lemma has_real_derivative_powr: |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2755 |
assumes "z > 0" |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2756 |
shows "((\<lambda>z. z powr r) has_real_derivative r * z powr (r - 1)) (at z)" |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2757 |
proof (subst DERIV_cong_ev[OF refl _ refl]) |
| 63558 | 2758 |
from assms have "eventually (\<lambda>z. z \<noteq> 0) (nhds z)" |
2759 |
by (intro t1_space_nhds) auto |
|
2760 |
then show "eventually (\<lambda>z. z powr r = exp (r * ln z)) (nhds z)" |
|
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2761 |
unfolding powr_def by eventually_elim simp |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2762 |
from assms show "((\<lambda>z. exp (r * ln z)) has_real_derivative r * z powr (r - 1)) (at z)" |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2763 |
by (auto intro!: derivative_eq_intros simp: powr_def field_simps exp_diff) |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2764 |
qed |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2765 |
|
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2766 |
declare has_real_derivative_powr[THEN DERIV_chain2, derivative_intros] |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2767 |
|
| 51527 | 2768 |
lemma tendsto_zero_powrI: |
| 61973 | 2769 |
assumes "(f \<longlongrightarrow> (0::real)) F" "(g \<longlongrightarrow> b) F" "\<forall>\<^sub>F x in F. 0 \<le> f x" "0 < b" |
2770 |
shows "((\<lambda>x. f x powr g x) \<longlongrightarrow> 0) F" |
|
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2771 |
using tendsto_powr2[OF assms] by simp |
| 51527 | 2772 |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2773 |
lemma continuous_on_powr': |
| 63558 | 2774 |
fixes f g :: "_ \<Rightarrow> real" |
2775 |
assumes "continuous_on s f" "continuous_on s g" |
|
2776 |
and "\<forall>x\<in>s. f x \<ge> 0 \<and> (f x = 0 \<longrightarrow> g x > 0)" |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2777 |
shows "continuous_on s (\<lambda>x. (f x) powr (g x))" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2778 |
unfolding continuous_on_def |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2779 |
proof |
| 63558 | 2780 |
fix x |
2781 |
assume x: "x \<in> s" |
|
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2782 |
from assms x show "((\<lambda>x. f x powr g x) \<longlongrightarrow> f x powr g x) (at x within s)" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2783 |
proof (cases "f x = 0") |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2784 |
case True |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2785 |
from assms(3) have "eventually (\<lambda>x. f x \<ge> 0) (at x within s)" |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2786 |
by (auto simp: at_within_def eventually_inf_principal) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2787 |
with True x assms show ?thesis |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2788 |
by (auto intro!: tendsto_zero_powrI[of f _ g "g x"] simp: continuous_on_def) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2789 |
next |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2790 |
case False |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2791 |
with assms x show ?thesis |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2792 |
by (auto intro!: tendsto_powr' simp: continuous_on_def) |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2793 |
qed |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2794 |
qed |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2795 |
|
| 51527 | 2796 |
lemma tendsto_neg_powr: |
| 53079 | 2797 |
assumes "s < 0" |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2798 |
and f: "LIM x F. f x :> at_top" |
| 61973 | 2799 |
shows "((\<lambda>x. f x powr s) \<longlongrightarrow> (0::real)) F" |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2800 |
proof - |
| 61973 | 2801 |
have "((\<lambda>x. exp (s * ln (f x))) \<longlongrightarrow> (0::real)) F" (is "?X") |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2802 |
by (auto intro!: filterlim_compose[OF exp_at_bot] filterlim_compose[OF ln_at_top] |
| 63558 | 2803 |
filterlim_tendsto_neg_mult_at_bot assms) |
| 61973 | 2804 |
also have "?X \<longleftrightarrow> ((\<lambda>x. f x powr s) \<longlongrightarrow> (0::real)) F" |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2805 |
using f filterlim_at_top_dense[of f F] |
| 61810 | 2806 |
by (intro filterlim_cong[OF refl refl]) (auto simp: neq_iff powr_def elim: eventually_mono) |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2807 |
finally show ?thesis . |
| 51527 | 2808 |
qed |
2809 |
||
| 63558 | 2810 |
lemma tendsto_exp_limit_at_right: "((\<lambda>y. (1 + x * y) powr (1 / y)) \<longlongrightarrow> exp x) (at_right 0)" |
2811 |
for x :: real |
|
2812 |
proof (cases "x = 0") |
|
2813 |
case True |
|
2814 |
then show ?thesis by simp |
|
2815 |
next |
|
2816 |
case False |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2817 |
have "((\<lambda>y. ln (1 + x * y)::real) has_real_derivative 1 * x) (at 0)" |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2818 |
by (auto intro!: derivative_eq_intros) |
| 61973 | 2819 |
then have "((\<lambda>y. ln (1 + x * y) / y) \<longlongrightarrow> x) (at 0)" |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2820 |
by (auto simp add: has_field_derivative_def field_has_derivative_at) |
| 61973 | 2821 |
then have *: "((\<lambda>y. exp (ln (1 + x * y) / y)) \<longlongrightarrow> exp x) (at 0)" |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2822 |
by (rule tendsto_intros) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2823 |
then show ?thesis |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2824 |
proof (rule filterlim_mono_eventually) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2825 |
show "eventually (\<lambda>xa. exp (ln (1 + x * xa) / xa) = (1 + x * xa) powr (1 / xa)) (at_right 0)" |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2826 |
unfolding eventually_at_right[OF zero_less_one] |
| 63558 | 2827 |
using False |
2828 |
apply (intro exI[of _ "1 / \<bar>x\<bar>"]) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
2829 |
apply (auto simp: field_simps powr_def abs_if) |
| 63558 | 2830 |
apply (metis add_less_same_cancel1 mult_less_0_iff not_less_iff_gr_or_eq zero_less_one) |
2831 |
done |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2832 |
qed (simp_all add: at_eq_sup_left_right) |
| 63558 | 2833 |
qed |
2834 |
||
2835 |
lemma tendsto_exp_limit_at_top: "((\<lambda>y. (1 + x / y) powr y) \<longlongrightarrow> exp x) at_top" |
|
2836 |
for x :: real |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2837 |
apply (subst filterlim_at_top_to_right) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2838 |
apply (simp add: inverse_eq_divide) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2839 |
apply (rule tendsto_exp_limit_at_right) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2840 |
done |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2841 |
|
| 63558 | 2842 |
lemma tendsto_exp_limit_sequentially: "(\<lambda>n. (1 + x / n) ^ n) \<longlonglongrightarrow> exp x" |
2843 |
for x :: real |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2844 |
proof (rule filterlim_mono_eventually) |
| 61944 | 2845 |
from reals_Archimedean2 [of "\<bar>x\<bar>"] obtain n :: nat where *: "real n > \<bar>x\<bar>" .. |
| 63558 | 2846 |
then have "eventually (\<lambda>n :: nat. 0 < 1 + x / real n) at_top" |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2847 |
apply (intro eventually_sequentiallyI [of n]) |
| 63558 | 2848 |
apply (cases "x \<ge> 0") |
2849 |
apply (rule add_pos_nonneg) |
|
2850 |
apply (auto intro: divide_nonneg_nonneg) |
|
2851 |
apply (subgoal_tac "x / real xa > - 1") |
|
2852 |
apply (auto simp add: field_simps) |
|
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2853 |
done |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2854 |
then show "eventually (\<lambda>n. (1 + x / n) powr n = (1 + x / n) ^ n) at_top" |
| 61810 | 2855 |
by (rule eventually_mono) (erule powr_realpow) |
| 61969 | 2856 |
show "(\<lambda>n. (1 + x / real n) powr real n) \<longlonglongrightarrow> exp x" |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2857 |
by (rule filterlim_compose [OF tendsto_exp_limit_at_top filterlim_real_sequentially]) |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2858 |
qed auto |
|
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2859 |
|
| 63558 | 2860 |
|
| 60758 | 2861 |
subsection \<open>Sine and Cosine\<close> |
| 29164 | 2862 |
|
| 63558 | 2863 |
definition sin_coeff :: "nat \<Rightarrow> real" |
2864 |
where "sin_coeff = (\<lambda>n. if even n then 0 else (- 1) ^ ((n - Suc 0) div 2) / (fact n))" |
|
2865 |
||
2866 |
definition cos_coeff :: "nat \<Rightarrow> real" |
|
2867 |
where "cos_coeff = (\<lambda>n. if even n then ((- 1) ^ (n div 2)) / (fact n) else 0)" |
|
| 31271 | 2868 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2869 |
definition sin :: "'a \<Rightarrow> 'a::{real_normed_algebra_1,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2870 |
where "sin = (\<lambda>x. \<Sum>n. sin_coeff n *\<^sub>R x^n)" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2871 |
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2872 |
definition cos :: "'a \<Rightarrow> 'a::{real_normed_algebra_1,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2873 |
where "cos = (\<lambda>x. \<Sum>n. cos_coeff n *\<^sub>R x^n)" |
| 31271 | 2874 |
|
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2875 |
lemma sin_coeff_0 [simp]: "sin_coeff 0 = 0" |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2876 |
unfolding sin_coeff_def by simp |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2877 |
|
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2878 |
lemma cos_coeff_0 [simp]: "cos_coeff 0 = 1" |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2879 |
unfolding cos_coeff_def by simp |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2880 |
|
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2881 |
lemma sin_coeff_Suc: "sin_coeff (Suc n) = cos_coeff n / real (Suc n)" |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2882 |
unfolding cos_coeff_def sin_coeff_def |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2883 |
by (simp del: mult_Suc) |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2884 |
|
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2885 |
lemma cos_coeff_Suc: "cos_coeff (Suc n) = - sin_coeff n / real (Suc n)" |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2886 |
unfolding cos_coeff_def sin_coeff_def |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
2887 |
by (simp del: mult_Suc) (auto elim: oddE) |
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2888 |
|
| 63558 | 2889 |
lemma summable_norm_sin: "summable (\<lambda>n. norm (sin_coeff n *\<^sub>R x^n))" |
2890 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2891 |
unfolding sin_coeff_def |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2892 |
apply (rule summable_comparison_test [OF _ summable_norm_exp [where x=x]]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2893 |
apply (auto simp: divide_inverse abs_mult power_abs [symmetric] zero_le_mult_iff) |
| 53079 | 2894 |
done |
| 29164 | 2895 |
|
| 63558 | 2896 |
lemma summable_norm_cos: "summable (\<lambda>n. norm (cos_coeff n *\<^sub>R x^n))" |
2897 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
| 53079 | 2898 |
unfolding cos_coeff_def |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2899 |
apply (rule summable_comparison_test [OF _ summable_norm_exp [where x=x]]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2900 |
apply (auto simp: divide_inverse abs_mult power_abs [symmetric] zero_le_mult_iff) |
| 53079 | 2901 |
done |
| 29164 | 2902 |
|
| 63558 | 2903 |
lemma sin_converges: "(\<lambda>n. sin_coeff n *\<^sub>R x^n) sums sin x" |
2904 |
unfolding sin_def |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2905 |
by (metis (full_types) summable_norm_cancel summable_norm_sin summable_sums) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2906 |
|
| 63558 | 2907 |
lemma cos_converges: "(\<lambda>n. cos_coeff n *\<^sub>R x^n) sums cos x" |
2908 |
unfolding cos_def |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2909 |
by (metis (full_types) summable_norm_cancel summable_norm_cos summable_sums) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2910 |
|
| 63558 | 2911 |
lemma sin_of_real: "sin (of_real x) = of_real (sin x)" |
2912 |
for x :: real |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2913 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2914 |
have "(\<lambda>n. of_real (sin_coeff n *\<^sub>R x^n)) = (\<lambda>n. sin_coeff n *\<^sub>R (of_real x)^n)" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2915 |
proof |
| 63558 | 2916 |
show "of_real (sin_coeff n *\<^sub>R x^n) = sin_coeff n *\<^sub>R of_real x^n" for n |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2917 |
by (simp add: scaleR_conv_of_real) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2918 |
qed |
| 63558 | 2919 |
also have "\<dots> sums (sin (of_real x))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2920 |
by (rule sin_converges) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2921 |
finally have "(\<lambda>n. of_real (sin_coeff n *\<^sub>R x^n)) sums (sin (of_real x))" . |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2922 |
then show ?thesis |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2923 |
using sums_unique2 sums_of_real [OF sin_converges] |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2924 |
by blast |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2925 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2926 |
|
| 59862 | 2927 |
corollary sin_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> sin z \<in> \<real>" |
2928 |
by (metis Reals_cases Reals_of_real sin_of_real) |
|
2929 |
||
| 63558 | 2930 |
lemma cos_of_real: "cos (of_real x) = of_real (cos x)" |
2931 |
for x :: real |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2932 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2933 |
have "(\<lambda>n. of_real (cos_coeff n *\<^sub>R x^n)) = (\<lambda>n. cos_coeff n *\<^sub>R (of_real x)^n)" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2934 |
proof |
| 63558 | 2935 |
show "of_real (cos_coeff n *\<^sub>R x^n) = cos_coeff n *\<^sub>R of_real x^n" for n |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2936 |
by (simp add: scaleR_conv_of_real) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2937 |
qed |
| 63558 | 2938 |
also have "\<dots> sums (cos (of_real x))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2939 |
by (rule cos_converges) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2940 |
finally have "(\<lambda>n. of_real (cos_coeff n *\<^sub>R x^n)) sums (cos (of_real x))" . |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2941 |
then show ?thesis |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2942 |
using sums_unique2 sums_of_real [OF cos_converges] |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2943 |
by blast |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2944 |
qed |
| 29164 | 2945 |
|
| 59862 | 2946 |
corollary cos_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> cos z \<in> \<real>" |
2947 |
by (metis Reals_cases Reals_of_real cos_of_real) |
|
2948 |
||
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2949 |
lemma diffs_sin_coeff: "diffs sin_coeff = cos_coeff" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
2950 |
by (simp add: diffs_def sin_coeff_Suc del: of_nat_Suc) |
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2951 |
|
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2952 |
lemma diffs_cos_coeff: "diffs cos_coeff = (\<lambda>n. - sin_coeff n)" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
2953 |
by (simp add: diffs_def cos_coeff_Suc del: of_nat_Suc) |
| 29164 | 2954 |
|
| 63558 | 2955 |
text \<open>Now at last we can get the derivatives of exp, sin and cos.\<close> |
2956 |
||
2957 |
lemma DERIV_sin [simp]: "DERIV sin x :> cos x" |
|
2958 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2959 |
unfolding sin_def cos_def scaleR_conv_of_real |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2960 |
apply (rule DERIV_cong) |
| 63558 | 2961 |
apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"]) |
2962 |
apply (simp_all add: norm_less_p1 diffs_of_real diffs_sin_coeff diffs_cos_coeff |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2963 |
summable_minus_iff scaleR_conv_of_real [symmetric] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2964 |
summable_norm_sin [THEN summable_norm_cancel] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2965 |
summable_norm_cos [THEN summable_norm_cancel]) |
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2966 |
done |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2967 |
|
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2968 |
declare DERIV_sin[THEN DERIV_chain2, derivative_intros] |
| 63558 | 2969 |
and DERIV_sin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
2970 |
||
2971 |
lemma DERIV_cos [simp]: "DERIV cos x :> - sin x" |
|
2972 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2973 |
unfolding sin_def cos_def scaleR_conv_of_real |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2974 |
apply (rule DERIV_cong) |
| 63558 | 2975 |
apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"]) |
2976 |
apply (simp_all add: norm_less_p1 diffs_of_real diffs_minus suminf_minus |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2977 |
diffs_sin_coeff diffs_cos_coeff |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2978 |
summable_minus_iff scaleR_conv_of_real [symmetric] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2979 |
summable_norm_sin [THEN summable_norm_cancel] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
2980 |
summable_norm_cos [THEN summable_norm_cancel]) |
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
2981 |
done |
| 29164 | 2982 |
|
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2983 |
declare DERIV_cos[THEN DERIV_chain2, derivative_intros] |
| 63558 | 2984 |
and DERIV_cos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
2985 |
||
2986 |
lemma isCont_sin: "isCont sin x" |
|
2987 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 2988 |
by (rule DERIV_sin [THEN DERIV_isCont]) |
2989 |
||
| 63558 | 2990 |
lemma isCont_cos: "isCont cos x" |
2991 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 2992 |
by (rule DERIV_cos [THEN DERIV_isCont]) |
2993 |
||
| 63558 | 2994 |
lemma isCont_sin' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. sin (f x)) a" |
2995 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
| 44311 | 2996 |
by (rule isCont_o2 [OF _ isCont_sin]) |
2997 |
||
| 63558 | 2998 |
(* FIXME a context for f would be better *) |
2999 |
||
3000 |
lemma isCont_cos' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. cos (f x)) a" |
|
3001 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
| 44311 | 3002 |
by (rule isCont_o2 [OF _ isCont_cos]) |
3003 |
||
| 63558 | 3004 |
lemma tendsto_sin [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. sin (f x)) \<longlongrightarrow> sin a) F" |
3005 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
| 44311 | 3006 |
by (rule isCont_tendsto_compose [OF isCont_sin]) |
3007 |
||
| 63558 | 3008 |
lemma tendsto_cos [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. cos (f x)) \<longlongrightarrow> cos a) F" |
3009 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
| 44311 | 3010 |
by (rule isCont_tendsto_compose [OF isCont_cos]) |
| 29164 | 3011 |
|
| 63558 | 3012 |
lemma continuous_sin [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. sin (f x))" |
3013 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3014 |
unfolding continuous_def by (rule tendsto_sin) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3015 |
|
| 63558 | 3016 |
lemma continuous_on_sin [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. sin (f x))" |
3017 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3018 |
unfolding continuous_on_def by (auto intro: tendsto_sin) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3019 |
|
| 63558 | 3020 |
lemma continuous_within_sin: "continuous (at z within s) sin" |
3021 |
for z :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3022 |
by (simp add: continuous_within tendsto_sin) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3023 |
|
| 63558 | 3024 |
lemma continuous_cos [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. cos (f x))" |
3025 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3026 |
unfolding continuous_def by (rule tendsto_cos) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3027 |
|
| 63558 | 3028 |
lemma continuous_on_cos [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. cos (f x))" |
3029 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3030 |
unfolding continuous_on_def by (auto intro: tendsto_cos) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
3031 |
|
| 63558 | 3032 |
lemma continuous_within_cos: "continuous (at z within s) cos" |
3033 |
for z :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3034 |
by (simp add: continuous_within tendsto_cos) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3035 |
|
| 63558 | 3036 |
|
| 60758 | 3037 |
subsection \<open>Properties of Sine and Cosine\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3038 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3039 |
lemma sin_zero [simp]: "sin 0 = 0" |
| 63558 | 3040 |
by (simp add: sin_def sin_coeff_def scaleR_conv_of_real) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3041 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3042 |
lemma cos_zero [simp]: "cos 0 = 1" |
| 63558 | 3043 |
by (simp add: cos_def cos_coeff_def scaleR_conv_of_real) |
3044 |
||
3045 |
lemma DERIV_fun_sin: "DERIV g x :> m \<Longrightarrow> DERIV (\<lambda>x. sin (g x)) x :> cos (g x) * m" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3046 |
by (auto intro!: derivative_intros) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3047 |
|
| 63558 | 3048 |
lemma DERIV_fun_cos: "DERIV g x :> m \<Longrightarrow> DERIV (\<lambda>x. cos(g x)) x :> - sin (g x) * m" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3049 |
by (auto intro!: derivative_eq_intros) |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3050 |
|
| 63558 | 3051 |
|
| 60758 | 3052 |
subsection \<open>Deriving the Addition Formulas\<close> |
3053 |
||
| 63558 | 3054 |
text \<open>The product of two cosine series.\<close> |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3055 |
lemma cos_x_cos_y: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3056 |
fixes x :: "'a::{real_normed_field,banach}"
|
| 63558 | 3057 |
shows |
3058 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3059 |
if even p \<and> even n |
|
3060 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) |
|
3061 |
sums (cos x * cos y)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3062 |
proof - |
| 63558 | 3063 |
have "(cos_coeff n * cos_coeff (p - n)) *\<^sub>R (x^n * y^(p - n)) = |
3064 |
(if even p \<and> even n then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p - n) |
|
3065 |
else 0)" |
|
3066 |
if "n \<le> p" for n p :: nat |
|
3067 |
proof - |
|
3068 |
from that have *: "even n \<Longrightarrow> even p \<Longrightarrow> |
|
3069 |
(-1) ^ (n div 2) * (-1) ^ ((p - n) div 2) = (-1 :: real) ^ (p div 2)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3070 |
by (metis div_add power_add le_add_diff_inverse odd_add) |
| 63558 | 3071 |
with that show ?thesis |
3072 |
by (auto simp: algebra_simps cos_coeff_def binomial_fact) |
|
3073 |
qed |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3074 |
then have "(\<lambda>p. \<Sum>n\<le>p. if even p \<and> even n |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3075 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) = |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3076 |
(\<lambda>p. \<Sum>n\<le>p. (cos_coeff n * cos_coeff (p - n)) *\<^sub>R (x^n * y^(p-n)))" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3077 |
by simp |
| 63558 | 3078 |
also have "\<dots> = (\<lambda>p. \<Sum>n\<le>p. (cos_coeff n *\<^sub>R x^n) * (cos_coeff (p - n) *\<^sub>R y^(p-n)))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3079 |
by (simp add: algebra_simps) |
| 63558 | 3080 |
also have "\<dots> sums (cos x * cos y)" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3081 |
using summable_norm_cos |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3082 |
by (auto simp: cos_def scaleR_conv_of_real intro!: Cauchy_product_sums) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3083 |
finally show ?thesis . |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3084 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3085 |
|
| 63558 | 3086 |
text \<open>The product of two sine series.\<close> |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3087 |
lemma sin_x_sin_y: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3088 |
fixes x :: "'a::{real_normed_field,banach}"
|
| 63558 | 3089 |
shows |
3090 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3091 |
if even p \<and> odd n |
|
3092 |
then - ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3093 |
else 0) |
|
3094 |
sums (sin x * sin y)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3095 |
proof - |
| 63558 | 3096 |
have "(sin_coeff n * sin_coeff (p - n)) *\<^sub>R (x^n * y^(p-n)) = |
3097 |
(if even p \<and> odd n |
|
3098 |
then -((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3099 |
else 0)" |
|
3100 |
if "n \<le> p" for n p :: nat |
|
3101 |
proof - |
|
3102 |
have "(-1) ^ ((n - Suc 0) div 2) * (-1) ^ ((p - Suc n) div 2) = - ((-1 :: real) ^ (p div 2))" |
|
3103 |
if np: "odd n" "even p" |
|
3104 |
proof - |
|
3105 |
from \<open>n \<le> p\<close> np have *: "n - Suc 0 + (p - Suc n) = p - Suc (Suc 0)" "Suc (Suc 0) \<le> p" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3106 |
by arith+ |
| 63558 | 3107 |
have "(p - Suc (Suc 0)) div 2 = p div 2 - Suc 0" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3108 |
by simp |
| 63558 | 3109 |
with \<open>n \<le> p\<close> np * show ?thesis |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3110 |
apply (simp add: power_add [symmetric] div_add [symmetric] del: div_add) |
| 63558 | 3111 |
apply (metis (no_types) One_nat_def Suc_1 le_div_geq minus_minus |
3112 |
mult.left_neutral mult_minus_left power.simps(2) zero_less_Suc) |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3113 |
done |
| 63558 | 3114 |
qed |
3115 |
then show ?thesis |
|
3116 |
using \<open>n\<le>p\<close> by (auto simp: algebra_simps sin_coeff_def binomial_fact) |
|
3117 |
qed |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3118 |
then have "(\<lambda>p. \<Sum>n\<le>p. if even p \<and> odd n |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3119 |
then - ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) = |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3120 |
(\<lambda>p. \<Sum>n\<le>p. (sin_coeff n * sin_coeff (p - n)) *\<^sub>R (x^n * y^(p-n)))" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3121 |
by simp |
| 63558 | 3122 |
also have "\<dots> = (\<lambda>p. \<Sum>n\<le>p. (sin_coeff n *\<^sub>R x^n) * (sin_coeff (p - n) *\<^sub>R y^(p-n)))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3123 |
by (simp add: algebra_simps) |
| 63558 | 3124 |
also have "\<dots> sums (sin x * sin y)" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3125 |
using summable_norm_sin |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3126 |
by (auto simp: sin_def scaleR_conv_of_real intro!: Cauchy_product_sums) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3127 |
finally show ?thesis . |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3128 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3129 |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3130 |
lemma sums_cos_x_plus_y: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3131 |
fixes x :: "'a::{real_normed_field,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3132 |
shows |
| 63558 | 3133 |
"(\<lambda>p. \<Sum>n\<le>p. |
3134 |
if even p |
|
3135 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3136 |
else 0) |
|
3137 |
sums cos (x + y)" |
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3138 |
proof - |
| 63558 | 3139 |
have |
3140 |
"(\<Sum>n\<le>p. |
|
3141 |
if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3142 |
else 0) = cos_coeff p *\<^sub>R ((x + y) ^ p)" |
|
3143 |
for p :: nat |
|
3144 |
proof - |
|
3145 |
have |
|
3146 |
"(\<Sum>n\<le>p. if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) = |
|
3147 |
(if even p then \<Sum>n\<le>p. ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3148 |
by simp |
| 63558 | 3149 |
also have "\<dots> = |
3150 |
(if even p |
|
3151 |
then of_real ((-1) ^ (p div 2) / (fact p)) * (\<Sum>n\<le>p. (p choose n) *\<^sub>R (x^n) * y^(p-n)) |
|
3152 |
else 0)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3153 |
by (auto simp: setsum_right_distrib field_simps scaleR_conv_of_real nonzero_of_real_divide) |
| 63558 | 3154 |
also have "\<dots> = cos_coeff p *\<^sub>R ((x + y) ^ p)" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3155 |
by (simp add: cos_coeff_def binomial_ring [of x y] scaleR_conv_of_real atLeast0AtMost) |
| 63558 | 3156 |
finally show ?thesis . |
3157 |
qed |
|
3158 |
then have |
|
3159 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3160 |
if even p |
|
3161 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3162 |
else 0) = (\<lambda>p. cos_coeff p *\<^sub>R ((x+y)^p))" |
|
3163 |
by simp |
|
3164 |
also have "\<dots> sums cos (x + y)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3165 |
by (rule cos_converges) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3166 |
finally show ?thesis . |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3167 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3168 |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3169 |
theorem cos_add: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3170 |
fixes x :: "'a::{real_normed_field,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3171 |
shows "cos (x + y) = cos x * cos y - sin x * sin y" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3172 |
proof - |
| 63558 | 3173 |
have |
3174 |
"(if even p \<and> even n |
|
3175 |
then ((- 1) ^ (p div 2) * int (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) - |
|
3176 |
(if even p \<and> odd n |
|
3177 |
then - ((- 1) ^ (p div 2) * int (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) = |
|
3178 |
(if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0)" |
|
3179 |
if "n \<le> p" for n p :: nat |
|
3180 |
by simp |
|
3181 |
then have |
|
3182 |
"(\<lambda>p. \<Sum>n\<le>p. (if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0)) |
|
3183 |
sums (cos x * cos y - sin x * sin y)" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3184 |
using sums_diff [OF cos_x_cos_y [of x y] sin_x_sin_y [of x y]] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3185 |
by (simp add: setsum_subtractf [symmetric]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3186 |
then show ?thesis |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3187 |
by (blast intro: sums_cos_x_plus_y sums_unique2) |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3188 |
qed |
|
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3189 |
|
| 63558 | 3190 |
lemma sin_minus_converges: "(\<lambda>n. - (sin_coeff n *\<^sub>R (-x)^n)) sums sin x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3191 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3192 |
have [simp]: "\<And>n. - (sin_coeff n *\<^sub>R (-x)^n) = (sin_coeff n *\<^sub>R x^n)" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3193 |
by (auto simp: sin_coeff_def elim!: oddE) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3194 |
show ?thesis |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3195 |
by (simp add: sin_def summable_norm_sin [THEN summable_norm_cancel, THEN summable_sums]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3196 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3197 |
|
| 63558 | 3198 |
lemma sin_minus [simp]: "sin (- x) = - sin x" |
3199 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
3200 |
using sin_minus_converges [of x] |
|
3201 |
by (auto simp: sin_def summable_norm_sin [THEN summable_norm_cancel] |
|
3202 |
suminf_minus sums_iff equation_minus_iff) |
|
3203 |
||
3204 |
lemma cos_minus_converges: "(\<lambda>n. (cos_coeff n *\<^sub>R (-x)^n)) sums cos x" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3205 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3206 |
have [simp]: "\<And>n. (cos_coeff n *\<^sub>R (-x)^n) = (cos_coeff n *\<^sub>R x^n)" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3207 |
by (auto simp: Transcendental.cos_coeff_def elim!: evenE) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3208 |
show ?thesis |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3209 |
by (simp add: cos_def summable_norm_cos [THEN summable_norm_cancel, THEN summable_sums]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3210 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3211 |
|
| 63558 | 3212 |
lemma cos_minus [simp]: "cos (-x) = cos x" |
3213 |
for x :: "'a::{real_normed_algebra_1,banach}"
|
|
3214 |
using cos_minus_converges [of x] |
|
3215 |
by (simp add: cos_def summable_norm_cos [THEN summable_norm_cancel] |
|
3216 |
suminf_minus sums_iff equation_minus_iff) |
|
3217 |
||
3218 |
lemma sin_cos_squared_add [simp]: "(sin x)\<^sup>2 + (cos x)\<^sup>2 = 1" |
|
3219 |
for x :: "'a::{real_normed_field,banach}"
|
|
3220 |
using cos_add [of x "-x"] |
|
3221 |
by (simp add: power2_eq_square algebra_simps) |
|
3222 |
||
3223 |
lemma sin_cos_squared_add2 [simp]: "(cos x)\<^sup>2 + (sin x)\<^sup>2 = 1" |
|
3224 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
3225 |
by (subst add.commute, rule sin_cos_squared_add) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3226 |
|
| 63558 | 3227 |
lemma sin_cos_squared_add3 [simp]: "cos x * cos x + sin x * sin x = 1" |
3228 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3229 |
using sin_cos_squared_add2 [unfolded power2_eq_square] . |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3230 |
|
| 63558 | 3231 |
lemma sin_squared_eq: "(sin x)\<^sup>2 = 1 - (cos x)\<^sup>2" |
3232 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3233 |
unfolding eq_diff_eq by (rule sin_cos_squared_add) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3234 |
|
| 63558 | 3235 |
lemma cos_squared_eq: "(cos x)\<^sup>2 = 1 - (sin x)\<^sup>2" |
3236 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3237 |
unfolding eq_diff_eq by (rule sin_cos_squared_add2) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3238 |
|
| 63558 | 3239 |
lemma abs_sin_le_one [simp]: "\<bar>sin x\<bar> \<le> 1" |
3240 |
for x :: real |
|
3241 |
by (rule power2_le_imp_le) (simp_all add: sin_squared_eq) |
|
3242 |
||
3243 |
lemma sin_ge_minus_one [simp]: "- 1 \<le> sin x" |
|
3244 |
for x :: real |
|
3245 |
using abs_sin_le_one [of x] by (simp add: abs_le_iff) |
|
3246 |
||
3247 |
lemma sin_le_one [simp]: "sin x \<le> 1" |
|
3248 |
for x :: real |
|
3249 |
using abs_sin_le_one [of x] by (simp add: abs_le_iff) |
|
3250 |
||
3251 |
lemma abs_cos_le_one [simp]: "\<bar>cos x\<bar> \<le> 1" |
|
3252 |
for x :: real |
|
3253 |
by (rule power2_le_imp_le) (simp_all add: cos_squared_eq) |
|
3254 |
||
3255 |
lemma cos_ge_minus_one [simp]: "- 1 \<le> cos x" |
|
3256 |
for x :: real |
|
3257 |
using abs_cos_le_one [of x] by (simp add: abs_le_iff) |
|
3258 |
||
3259 |
lemma cos_le_one [simp]: "cos x \<le> 1" |
|
3260 |
for x :: real |
|
3261 |
using abs_cos_le_one [of x] by (simp add: abs_le_iff) |
|
3262 |
||
3263 |
lemma cos_diff: "cos (x - y) = cos x * cos y + sin x * sin y" |
|
3264 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3265 |
using cos_add [of x "- y"] by simp |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3266 |
|
| 63558 | 3267 |
lemma cos_double: "cos(2*x) = (cos x)\<^sup>2 - (sin x)\<^sup>2" |
3268 |
for x :: "'a::{real_normed_field,banach}"
|
|
3269 |
using cos_add [where x=x and y=x] by (simp add: power2_eq_square) |
|
3270 |
||
3271 |
lemma sin_cos_le1: "\<bar>sin x * sin y + cos x * cos y\<bar> \<le> 1" |
|
3272 |
for x :: real |
|
3273 |
using cos_diff [of x y] by (metis abs_cos_le_one add.commute) |
|
3274 |
||
3275 |
lemma DERIV_fun_pow: "DERIV g x :> m \<Longrightarrow> DERIV (\<lambda>x. (g x) ^ n) x :> real n * (g x) ^ (n - 1) * m" |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3276 |
by (auto intro!: derivative_eq_intros simp:) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3277 |
|
| 63558 | 3278 |
lemma DERIV_fun_exp: "DERIV g x :> m \<Longrightarrow> DERIV (\<lambda>x. exp (g x)) x :> exp (g x) * m" |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
3279 |
by (auto intro!: derivative_intros) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3280 |
|
| 63558 | 3281 |
|
| 60758 | 3282 |
subsection \<open>The Constant Pi\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3283 |
|
| 53079 | 3284 |
definition pi :: real |
| 63558 | 3285 |
where "pi = 2 * (THE x. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0)" |
3286 |
||
3287 |
text \<open>Show that there's a least positive @{term x} with @{term "cos x = 0"};
|
|
| 60758 | 3288 |
hence define pi.\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3289 |
|
| 63558 | 3290 |
lemma sin_paired: "(\<lambda>n. (- 1) ^ n / (fact (2 * n + 1)) * x ^ (2 * n + 1)) sums sin x" |
3291 |
for x :: real |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3292 |
proof - |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3293 |
have "(\<lambda>n. \<Sum>k = n*2..<n * 2 + 2. sin_coeff k * x ^ k) sums sin x" |
| 63558 | 3294 |
by (rule sums_group) (use sin_converges [of x, unfolded scaleR_conv_of_real] in auto) |
3295 |
then show ?thesis |
|
3296 |
by (simp add: sin_coeff_def ac_simps) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3297 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3298 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3299 |
lemma sin_gt_zero_02: |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3300 |
fixes x :: real |
| 53079 | 3301 |
assumes "0 < x" and "x < 2" |
3302 |
shows "0 < sin x" |
|
| 44728 | 3303 |
proof - |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3304 |
let ?f = "\<lambda>n::nat. \<Sum>k = n*2..<n*2+2. (- 1) ^ k / (fact (2*k+1)) * x^(2*k+1)" |
| 44728 | 3305 |
have pos: "\<forall>n. 0 < ?f n" |
3306 |
proof |
|
3307 |
fix n :: nat |
|
3308 |
let ?k2 = "real (Suc (Suc (4 * n)))" |
|
3309 |
let ?k3 = "real (Suc (Suc (Suc (4 * n))))" |
|
3310 |
have "x * x < ?k2 * ?k3" |
|
3311 |
using assms by (intro mult_strict_mono', simp_all) |
|
| 63558 | 3312 |
then have "x * x * x * x ^ (n * 4) < ?k2 * ?k3 * x * x ^ (n * 4)" |
| 60758 | 3313 |
by (intro mult_strict_right_mono zero_less_power \<open>0 < x\<close>) |
| 63558 | 3314 |
then show "0 < ?f n" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3315 |
by (simp add: divide_simps mult_ac del: mult_Suc) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3316 |
qed |
| 44728 | 3317 |
have sums: "?f sums sin x" |
| 63558 | 3318 |
by (rule sin_paired [THEN sums_group]) simp |
| 44728 | 3319 |
show "0 < sin x" |
3320 |
unfolding sums_unique [OF sums] |
|
3321 |
using sums_summable [OF sums] pos |
|
| 56213 | 3322 |
by (rule suminf_pos) |
| 44728 | 3323 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3324 |
|
| 63558 | 3325 |
lemma cos_double_less_one: "0 < x \<Longrightarrow> x < 2 \<Longrightarrow> cos (2 * x) < 1" |
3326 |
for x :: real |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3327 |
using sin_gt_zero_02 [where x = x] by (auto simp: cos_squared_eq cos_double) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3328 |
|
| 63558 | 3329 |
lemma cos_paired: "(\<lambda>n. (- 1) ^ n / (fact (2 * n)) * x ^ (2 * n)) sums cos x" |
3330 |
for x :: real |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3331 |
proof - |
| 31271 | 3332 |
have "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x" |
| 63558 | 3333 |
by (rule sums_group) (use cos_converges [of x, unfolded scaleR_conv_of_real] in auto) |
3334 |
then show ?thesis |
|
3335 |
by (simp add: cos_coeff_def ac_simps) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3336 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3337 |
|
| 53602 | 3338 |
lemmas realpow_num_eq_if = power_eq_if |
3339 |
||
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3340 |
lemma sumr_pos_lt_pair: |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
3341 |
fixes f :: "nat \<Rightarrow> real" |
| 63558 | 3342 |
shows "summable f \<Longrightarrow> |
3343 |
(\<And>d. 0 < f (k + (Suc(Suc 0) * d)) + f (k + ((Suc (Suc 0) * d) + 1))) \<Longrightarrow> |
|
3344 |
setsum f {..<k} < suminf f"
|
|
3345 |
apply (simp only: One_nat_def) |
|
3346 |
apply (subst suminf_split_initial_segment [where k=k]) |
|
3347 |
apply assumption |
|
3348 |
apply simp |
|
3349 |
apply (drule_tac k=k in summable_ignore_initial_segment) |
|
3350 |
apply (drule_tac k="Suc (Suc 0)" in sums_group [OF summable_sums]) |
|
3351 |
apply simp |
|
3352 |
apply simp |
|
3353 |
apply (metis (no_types, lifting) add.commute suminf_pos summable_def sums_unique) |
|
3354 |
done |
|
3355 |
||
3356 |
lemma cos_two_less_zero [simp]: "cos 2 < (0::real)" |
|
| 53602 | 3357 |
proof - |
|
63367
6c731c8b7f03
simplified definitions of combinatorial functions
haftmann
parents:
63365
diff
changeset
|
3358 |
note fact_Suc [simp del] |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3359 |
from sums_minus [OF cos_paired] |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3360 |
have *: "(\<lambda>n. - ((- 1) ^ n * 2 ^ (2 * n) / fact (2 * n))) sums - cos (2::real)" |
| 53602 | 3361 |
by simp |
| 60162 | 3362 |
then have sm: "summable (\<lambda>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
| 53602 | 3363 |
by (rule sums_summable) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3364 |
have "0 < (\<Sum>n<Suc (Suc (Suc 0)). - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3365 |
by (simp add: fact_num_eq_if realpow_num_eq_if) |
| 63558 | 3366 |
moreover have "(\<Sum>n<Suc (Suc (Suc 0)). - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n)))) < |
3367 |
(\<Sum>n. - ((- 1) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
|
| 53602 | 3368 |
proof - |
| 63558 | 3369 |
{
|
3370 |
fix d |
|
| 60162 | 3371 |
let ?six4d = "Suc (Suc (Suc (Suc (Suc (Suc (4 * d))))))" |
3372 |
have "(4::real) * (fact (?six4d)) < (Suc (Suc (?six4d)) * fact (Suc (?six4d)))" |
|
| 63558 | 3373 |
unfolding of_nat_mult by (rule mult_strict_mono) (simp_all add: fact_less_mono) |
| 60162 | 3374 |
then have "(4::real) * (fact (?six4d)) < (fact (Suc (Suc (?six4d))))" |
|
63367
6c731c8b7f03
simplified definitions of combinatorial functions
haftmann
parents:
63365
diff
changeset
|
3375 |
by (simp only: fact_Suc [of "Suc (?six4d)"] of_nat_mult of_nat_fact) |
| 60162 | 3376 |
then have "(4::real) * inverse (fact (Suc (Suc (?six4d)))) < inverse (fact (?six4d))" |
| 53602 | 3377 |
by (simp add: inverse_eq_divide less_divide_eq) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3378 |
} |
| 60162 | 3379 |
then show ?thesis |
| 60867 | 3380 |
by (force intro!: sumr_pos_lt_pair [OF sm] simp add: divide_inverse algebra_simps) |
| 53602 | 3381 |
qed |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3382 |
ultimately have "0 < (\<Sum>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
| 53602 | 3383 |
by (rule order_less_trans) |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3384 |
moreover from * have "- cos 2 = (\<Sum>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
| 53602 | 3385 |
by (rule sums_unique) |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3386 |
ultimately have "(0::real) < - cos 2" by simp |
| 53602 | 3387 |
then show ?thesis by simp |
3388 |
qed |
|
| 23053 | 3389 |
|
3390 |
lemmas cos_two_neq_zero [simp] = cos_two_less_zero [THEN less_imp_neq] |
|
3391 |
lemmas cos_two_le_zero [simp] = cos_two_less_zero [THEN order_less_imp_le] |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3392 |
|
| 63558 | 3393 |
lemma cos_is_zero: "\<exists>!x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
| 44730 | 3394 |
proof (rule ex_ex1I) |
| 63558 | 3395 |
show "\<exists>x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
3396 |
by (rule IVT2) simp_all |
|
| 44730 | 3397 |
next |
| 63558 | 3398 |
fix x y :: real |
| 44730 | 3399 |
assume x: "0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
3400 |
assume y: "0 \<le> y \<and> y \<le> 2 \<and> cos y = 0" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3401 |
have [simp]: "\<forall>x::real. cos differentiable (at x)" |
|
56181
2aa0b19e74f3
unify syntax for has_derivative and differentiable
hoelzl
parents:
56167
diff
changeset
|
3402 |
unfolding real_differentiable_def by (auto intro: DERIV_cos) |
| 63558 | 3403 |
from x y less_linear [of x y] show "x = y" |
3404 |
apply auto |
|
3405 |
apply (drule_tac f = cos in Rolle) |
|
3406 |
apply (drule_tac [5] f = cos in Rolle) |
|
3407 |
apply (auto dest!: DERIV_cos [THEN DERIV_unique]) |
|
3408 |
apply (metis order_less_le_trans less_le sin_gt_zero_02) |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3409 |
apply (metis order_less_le_trans less_le sin_gt_zero_02) |
| 44730 | 3410 |
done |
3411 |
qed |
|
| 31880 | 3412 |
|
| 63558 | 3413 |
lemma pi_half: "pi/2 = (THE x. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0)" |
| 53079 | 3414 |
by (simp add: pi_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3415 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3416 |
lemma cos_pi_half [simp]: "cos (pi / 2) = 0" |
| 53079 | 3417 |
by (simp add: pi_half cos_is_zero [THEN theI']) |
| 23053 | 3418 |
|
| 63558 | 3419 |
lemma cos_of_real_pi_half [simp]: "cos ((of_real pi / 2) :: 'a) = 0" |
3420 |
if "SORT_CONSTRAINT('a::{real_field,banach,real_normed_algebra_1})"
|
|
3421 |
by (metis cos_pi_half cos_of_real eq_numeral_simps(4) |
|
3422 |
nonzero_of_real_divide of_real_0 of_real_numeral) |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3423 |
|
| 23053 | 3424 |
lemma pi_half_gt_zero [simp]: "0 < pi / 2" |
| 53079 | 3425 |
apply (rule order_le_neq_trans) |
| 63558 | 3426 |
apply (simp add: pi_half cos_is_zero [THEN theI']) |
| 54575 | 3427 |
apply (metis cos_pi_half cos_zero zero_neq_one) |
| 53079 | 3428 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3429 |
|
| 23053 | 3430 |
lemmas pi_half_neq_zero [simp] = pi_half_gt_zero [THEN less_imp_neq, symmetric] |
3431 |
lemmas pi_half_ge_zero [simp] = pi_half_gt_zero [THEN order_less_imp_le] |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3432 |
|
| 23053 | 3433 |
lemma pi_half_less_two [simp]: "pi / 2 < 2" |
| 53079 | 3434 |
apply (rule order_le_neq_trans) |
| 63558 | 3435 |
apply (simp add: pi_half cos_is_zero [THEN theI']) |
| 54575 | 3436 |
apply (metis cos_pi_half cos_two_neq_zero) |
| 53079 | 3437 |
done |
| 23053 | 3438 |
|
3439 |
lemmas pi_half_neq_two [simp] = pi_half_less_two [THEN less_imp_neq] |
|
3440 |
lemmas pi_half_le_two [simp] = pi_half_less_two [THEN order_less_imp_le] |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3441 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3442 |
lemma pi_gt_zero [simp]: "0 < pi" |
| 53079 | 3443 |
using pi_half_gt_zero by simp |
| 23053 | 3444 |
|
3445 |
lemma pi_ge_zero [simp]: "0 \<le> pi" |
|
| 53079 | 3446 |
by (rule pi_gt_zero [THEN order_less_imp_le]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3447 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3448 |
lemma pi_neq_zero [simp]: "pi \<noteq> 0" |
| 53079 | 3449 |
by (rule pi_gt_zero [THEN less_imp_neq, symmetric]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3450 |
|
| 23053 | 3451 |
lemma pi_not_less_zero [simp]: "\<not> pi < 0" |
| 53079 | 3452 |
by (simp add: linorder_not_less) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3453 |
|
|
29165
562f95f06244
cleaned up some proofs; removed redundant simp rules
huffman
parents:
29164
diff
changeset
|
3454 |
lemma minus_pi_half_less_zero: "-(pi/2) < 0" |
| 53079 | 3455 |
by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3456 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3457 |
lemma m2pi_less_pi: "- (2*pi) < pi" |
| 53079 | 3458 |
by simp |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3459 |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3460 |
lemma sin_pi_half [simp]: "sin(pi/2) = 1" |
| 53079 | 3461 |
using sin_cos_squared_add2 [where x = "pi/2"] |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3462 |
using sin_gt_zero_02 [OF pi_half_gt_zero pi_half_less_two] |
| 53079 | 3463 |
by (simp add: power2_eq_1_iff) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3464 |
|
| 63558 | 3465 |
lemma sin_of_real_pi_half [simp]: "sin ((of_real pi / 2) :: 'a) = 1" |
3466 |
if "SORT_CONSTRAINT('a::{real_field,banach,real_normed_algebra_1})"
|
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3467 |
using sin_pi_half |
| 63558 | 3468 |
by (metis sin_pi_half eq_numeral_simps(4) nonzero_of_real_divide of_real_1 of_real_numeral sin_of_real) |
3469 |
||
3470 |
lemma sin_cos_eq: "sin x = cos (of_real pi / 2 - x)" |
|
3471 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3472 |
by (simp add: cos_diff) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3473 |
|
| 63558 | 3474 |
lemma minus_sin_cos_eq: "- sin x = cos (x + of_real pi / 2)" |
3475 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3476 |
by (simp add: cos_add nonzero_of_real_divide) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3477 |
|
| 63558 | 3478 |
lemma cos_sin_eq: "cos x = sin (of_real pi / 2 - x)" |
3479 |
for x :: "'a::{real_normed_field,banach}"
|
|
3480 |
using sin_cos_eq [of "of_real pi / 2 - x"] by simp |
|
3481 |
||
3482 |
lemma sin_add: "sin (x + y) = sin x * cos y + cos x * sin y" |
|
3483 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3484 |
using cos_add [of "of_real pi / 2 - x" "-y"] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3485 |
by (simp add: cos_sin_eq) (simp add: sin_cos_eq) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3486 |
|
| 63558 | 3487 |
lemma sin_diff: "sin (x - y) = sin x * cos y - cos x * sin y" |
3488 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3489 |
using sin_add [of x "- y"] by simp |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3490 |
|
| 63558 | 3491 |
lemma sin_double: "sin(2 * x) = 2 * sin x * cos x" |
3492 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3493 |
using sin_add [where x=x and y=x] by simp |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3494 |
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3495 |
lemma cos_of_real_pi [simp]: "cos (of_real pi) = -1" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3496 |
using cos_add [where x = "pi/2" and y = "pi/2"] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3497 |
by (simp add: cos_of_real) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3498 |
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3499 |
lemma sin_of_real_pi [simp]: "sin (of_real pi) = 0" |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3500 |
using sin_add [where x = "pi/2" and y = "pi/2"] |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3501 |
by (simp add: sin_of_real) |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3502 |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3503 |
lemma cos_pi [simp]: "cos pi = -1" |
| 53079 | 3504 |
using cos_add [where x = "pi/2" and y = "pi/2"] by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3505 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3506 |
lemma sin_pi [simp]: "sin pi = 0" |
| 53079 | 3507 |
using sin_add [where x = "pi/2" and y = "pi/2"] by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3508 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3509 |
lemma sin_periodic_pi [simp]: "sin (x + pi) = - sin x" |
| 53079 | 3510 |
by (simp add: sin_add) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3511 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3512 |
lemma sin_periodic_pi2 [simp]: "sin (pi + x) = - sin x" |
| 53079 | 3513 |
by (simp add: sin_add) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3514 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3515 |
lemma cos_periodic_pi [simp]: "cos (x + pi) = - cos x" |
| 53079 | 3516 |
by (simp add: cos_add) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3517 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3518 |
lemma cos_periodic_pi2 [simp]: "cos (pi + x) = - cos x" |
|
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3519 |
by (simp add: cos_add) |
|
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3520 |
|
| 63558 | 3521 |
lemma sin_periodic [simp]: "sin (x + 2 * pi) = sin x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3522 |
by (simp add: sin_add sin_double cos_double) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3523 |
|
| 63558 | 3524 |
lemma cos_periodic [simp]: "cos (x + 2 * pi) = cos x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3525 |
by (simp add: cos_add sin_double cos_double) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3526 |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
3527 |
lemma cos_npi [simp]: "cos (real n * pi) = (- 1) ^ n" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3528 |
by (induct n) (auto simp: distrib_right) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3529 |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
3530 |
lemma cos_npi2 [simp]: "cos (pi * real n) = (- 1) ^ n" |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
3531 |
by (metis cos_npi mult.commute) |
| 15383 | 3532 |
|
| 63558 | 3533 |
lemma sin_npi [simp]: "sin (real n * pi) = 0" |
3534 |
for n :: nat |
|
3535 |
by (induct n) (auto simp: distrib_right) |
|
3536 |
||
3537 |
lemma sin_npi2 [simp]: "sin (pi * real n) = 0" |
|
3538 |
for n :: nat |
|
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
3539 |
by (simp add: mult.commute [of pi]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3540 |
|
| 63558 | 3541 |
lemma cos_two_pi [simp]: "cos (2 * pi) = 1" |
| 53079 | 3542 |
by (simp add: cos_double) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3543 |
|
| 63558 | 3544 |
lemma sin_two_pi [simp]: "sin (2 * pi) = 0" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3545 |
by (simp add: sin_double) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3546 |
|
| 63558 | 3547 |
lemma sin_times_sin: "sin w * sin z = (cos (w - z) - cos (w + z)) / 2" |
3548 |
for w :: "'a::{real_normed_field,banach}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3549 |
by (simp add: cos_diff cos_add) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3550 |
|
| 63558 | 3551 |
lemma sin_times_cos: "sin w * cos z = (sin (w + z) + sin (w - z)) / 2" |
3552 |
for w :: "'a::{real_normed_field,banach}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3553 |
by (simp add: sin_diff sin_add) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3554 |
|
| 63558 | 3555 |
lemma cos_times_sin: "cos w * sin z = (sin (w + z) - sin (w - z)) / 2" |
3556 |
for w :: "'a::{real_normed_field,banach}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3557 |
by (simp add: sin_diff sin_add) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3558 |
|
| 63558 | 3559 |
lemma cos_times_cos: "cos w * cos z = (cos (w - z) + cos (w + z)) / 2" |
3560 |
for w :: "'a::{real_normed_field,banach}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3561 |
by (simp add: cos_diff cos_add) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3562 |
|
| 63558 | 3563 |
lemma sin_plus_sin: "sin w + sin z = 2 * sin ((w + z) / 2) * cos ((w - z) / 2)" |
3564 |
for w :: "'a::{real_normed_field,banach,field}" (* FIXME field should not be necessary *)
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3565 |
apply (simp add: mult.assoc sin_times_cos) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3566 |
apply (simp add: field_simps) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3567 |
done |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3568 |
|
| 63558 | 3569 |
lemma sin_diff_sin: "sin w - sin z = 2 * sin ((w - z) / 2) * cos ((w + z) / 2)" |
3570 |
for w :: "'a::{real_normed_field,banach,field}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3571 |
apply (simp add: mult.assoc sin_times_cos) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3572 |
apply (simp add: field_simps) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3573 |
done |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3574 |
|
| 63558 | 3575 |
lemma cos_plus_cos: "cos w + cos z = 2 * cos ((w + z) / 2) * cos ((w - z) / 2)" |
3576 |
for w :: "'a::{real_normed_field,banach,field}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3577 |
apply (simp add: mult.assoc cos_times_cos) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3578 |
apply (simp add: field_simps) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3579 |
done |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3580 |
|
| 63558 | 3581 |
lemma cos_diff_cos: "cos w - cos z = 2 * sin ((w + z) / 2) * sin ((z - w) / 2)" |
3582 |
for w :: "'a::{real_normed_field,banach,field}"
|
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3583 |
apply (simp add: mult.assoc sin_times_sin) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3584 |
apply (simp add: field_simps) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3585 |
done |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3586 |
|
| 63558 | 3587 |
lemma cos_double_cos: "cos (2 * z) = 2 * cos z ^ 2 - 1" |
3588 |
for z :: "'a::{real_normed_field,banach}"
|
|
3589 |
by (simp add: cos_double sin_squared_eq) |
|
3590 |
||
3591 |
lemma cos_double_sin: "cos (2 * z) = 1 - 2 * sin z ^ 2" |
|
3592 |
for z :: "'a::{real_normed_field,banach}"
|
|
3593 |
by (simp add: cos_double sin_squared_eq) |
|
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3594 |
|
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3595 |
lemma sin_pi_minus [simp]: "sin (pi - x) = sin x" |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3596 |
by (metis sin_minus sin_periodic_pi minus_minus uminus_add_conv_diff) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3597 |
|
| 63558 | 3598 |
lemma cos_pi_minus [simp]: "cos (pi - x) = - (cos x)" |
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3599 |
by (metis cos_minus cos_periodic_pi uminus_add_conv_diff) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3600 |
|
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3601 |
lemma sin_minus_pi [simp]: "sin (x - pi) = - (sin x)" |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3602 |
by (simp add: sin_diff) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3603 |
|
| 63558 | 3604 |
lemma cos_minus_pi [simp]: "cos (x - pi) = - (cos x)" |
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3605 |
by (simp add: cos_diff) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3606 |
|
| 63558 | 3607 |
lemma sin_2pi_minus [simp]: "sin (2 * pi - x) = - (sin x)" |
|
59741
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3608 |
by (metis sin_periodic_pi2 add_diff_eq mult_2 sin_pi_minus) |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3609 |
|
| 63558 | 3610 |
lemma cos_2pi_minus [simp]: "cos (2 * pi - x) = cos x" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3611 |
by (metis (no_types, hide_lams) cos_add cos_minus cos_two_pi sin_minus sin_two_pi |
| 63558 | 3612 |
diff_0_right minus_diff_eq mult_1 mult_zero_left uminus_add_conv_diff) |
3613 |
||
3614 |
lemma sin_gt_zero2: "0 < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < sin x" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3615 |
by (metis sin_gt_zero_02 order_less_trans pi_half_less_two) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3616 |
|
| 41970 | 3617 |
lemma sin_less_zero: |
| 53079 | 3618 |
assumes "- pi/2 < x" and "x < 0" |
3619 |
shows "sin x < 0" |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3620 |
proof - |
| 63558 | 3621 |
have "0 < sin (- x)" |
3622 |
using assms by (simp only: sin_gt_zero2) |
|
3623 |
then show ?thesis by simp |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3624 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3625 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3626 |
lemma pi_less_4: "pi < 4" |
| 53079 | 3627 |
using pi_half_less_two by auto |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3628 |
|
| 63558 | 3629 |
lemma cos_gt_zero: "0 < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < cos x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3630 |
by (simp add: cos_sin_eq sin_gt_zero2) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3631 |
|
| 63558 | 3632 |
lemma cos_gt_zero_pi: "-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < cos x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3633 |
using cos_gt_zero [of x] cos_gt_zero [of "-x"] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3634 |
by (cases rule: linorder_cases [of x 0]) auto |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3635 |
|
| 63558 | 3636 |
lemma cos_ge_zero: "-(pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> 0 \<le> cos x" |
3637 |
by (auto simp: order_le_less cos_gt_zero_pi) |
|
3638 |
(metis cos_pi_half eq_divide_eq eq_numeral_simps(4)) |
|
3639 |
||
3640 |
lemma sin_gt_zero: "0 < x \<Longrightarrow> x < pi \<Longrightarrow> 0 < sin x" |
|
| 53079 | 3641 |
by (simp add: sin_cos_eq cos_gt_zero_pi) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3642 |
|
| 63558 | 3643 |
lemma sin_lt_zero: "pi < x \<Longrightarrow> x < 2 * pi \<Longrightarrow> sin x < 0" |
3644 |
using sin_gt_zero [of "x - pi"] |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3645 |
by (simp add: sin_diff) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3646 |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3647 |
lemma pi_ge_two: "2 \<le> pi" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3648 |
proof (rule ccontr) |
| 63558 | 3649 |
assume "\<not> ?thesis" |
3650 |
then have "pi < 2" by auto |
|
3651 |
have "\<exists>y > pi. y < 2 \<and> y < 2 * pi" |
|
3652 |
proof (cases "2 < 2 * pi") |
|
3653 |
case True |
|
3654 |
with dense[OF \<open>pi < 2\<close>] show ?thesis by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3655 |
next |
| 63558 | 3656 |
case False |
3657 |
have "pi < 2 * pi" by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3658 |
from dense[OF this] and False show ?thesis by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3659 |
qed |
| 63558 | 3660 |
then obtain y where "pi < y" and "y < 2" and "y < 2 * pi" |
3661 |
by blast |
|
3662 |
then have "0 < sin y" |
|
3663 |
using sin_gt_zero_02 by auto |
|
3664 |
moreover have "sin y < 0" |
|
3665 |
using sin_gt_zero[of "y - pi"] \<open>pi < y\<close> and \<open>y < 2 * pi\<close> sin_periodic_pi[of "y - pi"] |
|
3666 |
by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3667 |
ultimately show False by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3668 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3669 |
|
| 63558 | 3670 |
lemma sin_ge_zero: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> 0 \<le> sin x" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3671 |
by (auto simp: order_le_less sin_gt_zero) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3672 |
|
| 63558 | 3673 |
lemma sin_le_zero: "pi \<le> x \<Longrightarrow> x < 2 * pi \<Longrightarrow> sin x \<le> 0" |
3674 |
using sin_ge_zero [of "x - pi"] by (simp add: sin_diff) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3675 |
|
|
62948
7700f467892b
lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
62679
diff
changeset
|
3676 |
lemma sin_pi_divide_n_ge_0 [simp]: |
| 63558 | 3677 |
assumes "n \<noteq> 0" |
3678 |
shows "0 \<le> sin (pi / real n)" |
|
3679 |
by (rule sin_ge_zero) (use assms in \<open>simp_all add: divide_simps\<close>) |
|
|
62948
7700f467892b
lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
62679
diff
changeset
|
3680 |
|
|
7700f467892b
lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
62679
diff
changeset
|
3681 |
lemma sin_pi_divide_n_gt_0: |
| 63558 | 3682 |
assumes "2 \<le> n" |
3683 |
shows "0 < sin (pi / real n)" |
|
3684 |
by (rule sin_gt_zero) (use assms in \<open>simp_all add: divide_simps\<close>) |
|
3685 |
||
3686 |
(* FIXME: This proof is almost identical to lemma \<open>cos_is_zero\<close>. |
|
3687 |
It should be possible to factor out some of the common parts. *) |
|
3688 |
lemma cos_total: |
|
3689 |
assumes y: "- 1 \<le> y" "y \<le> 1" |
|
3690 |
shows "\<exists>!x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y" |
|
| 44745 | 3691 |
proof (rule ex_ex1I) |
| 63558 | 3692 |
show "\<exists>x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y" |
3693 |
by (rule IVT2) (simp_all add: y) |
|
| 44745 | 3694 |
next |
3695 |
fix a b |
|
3696 |
assume a: "0 \<le> a \<and> a \<le> pi \<and> cos a = y" |
|
3697 |
assume b: "0 \<le> b \<and> b \<le> pi \<and> cos b = y" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3698 |
have [simp]: "\<forall>x::real. cos differentiable (at x)" |
|
56181
2aa0b19e74f3
unify syntax for has_derivative and differentiable
hoelzl
parents:
56167
diff
changeset
|
3699 |
unfolding real_differentiable_def by (auto intro: DERIV_cos) |
| 63558 | 3700 |
from a b less_linear [of a b] show "a = b" |
3701 |
apply auto |
|
3702 |
apply (drule_tac f = cos in Rolle) |
|
3703 |
apply (drule_tac [5] f = cos in Rolle) |
|
3704 |
apply (auto dest!: DERIV_cos [THEN DERIV_unique]) |
|
3705 |
apply (metis order_less_le_trans less_le sin_gt_zero) |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3706 |
apply (metis order_less_le_trans less_le sin_gt_zero) |
| 44745 | 3707 |
done |
3708 |
qed |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3709 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3710 |
lemma sin_total: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3711 |
assumes y: "-1 \<le> y" "y \<le> 1" |
| 63558 | 3712 |
shows "\<exists>!x. - (pi/2) \<le> x \<and> x \<le> pi/2 \<and> sin x = y" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3713 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3714 |
from cos_total [OF y] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3715 |
obtain x where x: "0 \<le> x" "x \<le> pi" "cos x = y" |
| 63558 | 3716 |
and uniq: "\<And>x'. 0 \<le> x' \<Longrightarrow> x' \<le> pi \<Longrightarrow> cos x' = y \<Longrightarrow> x' = x " |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3717 |
by blast |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3718 |
show ?thesis |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3719 |
apply (simp add: sin_cos_eq) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3720 |
apply (rule ex1I [where a="pi/2 - x"]) |
| 63558 | 3721 |
apply (cut_tac [2] x'="pi/2 - xa" in uniq) |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3722 |
using x |
| 63558 | 3723 |
apply auto |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3724 |
done |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3725 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3726 |
|
| 15229 | 3727 |
lemma cos_zero_lemma: |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3728 |
assumes "0 \<le> x" "cos x = 0" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3729 |
shows "\<exists>n. odd n \<and> x = of_nat n * (pi/2) \<and> n > 0" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3730 |
proof - |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3731 |
have xle: "x < (1 + real_of_int \<lfloor>x/pi\<rfloor>) * pi" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3732 |
using floor_correct [of "x/pi"] |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3733 |
by (simp add: add.commute divide_less_eq) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3734 |
obtain n where "real n * pi \<le> x" "x < real (Suc n) * pi" |
| 61942 | 3735 |
apply (rule that [of "nat \<lfloor>x/pi\<rfloor>"]) |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3736 |
using assms |
| 63558 | 3737 |
apply (simp_all add: xle) |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3738 |
apply (metis floor_less_iff less_irrefl mult_imp_div_pos_less not_le pi_gt_zero) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3739 |
done |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3740 |
then have x: "0 \<le> x - n * pi" "(x - n * pi) \<le> pi" "cos (x - n * pi) = 0" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3741 |
by (auto simp: algebra_simps cos_diff assms) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3742 |
then have "\<exists>!x. 0 \<le> x \<and> x \<le> pi \<and> cos x = 0" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3743 |
by (auto simp: intro!: cos_total) |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
3744 |
then obtain \<theta> where \<theta>: "0 \<le> \<theta>" "\<theta> \<le> pi" "cos \<theta> = 0" |
| 63558 | 3745 |
and uniq: "\<And>\<phi>. 0 \<le> \<phi> \<Longrightarrow> \<phi> \<le> pi \<Longrightarrow> cos \<phi> = 0 \<Longrightarrow> \<phi> = \<theta>" |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3746 |
by blast |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3747 |
then have "x - real n * pi = \<theta>" |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3748 |
using x by blast |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3749 |
moreover have "pi/2 = \<theta>" |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
3750 |
using pi_half_ge_zero uniq by fastforce |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3751 |
ultimately show ?thesis |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3752 |
by (rule_tac x = "Suc (2 * n)" in exI) (simp add: algebra_simps) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3753 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3754 |
|
| 63558 | 3755 |
lemma sin_zero_lemma: "0 \<le> x \<Longrightarrow> sin x = 0 \<Longrightarrow> \<exists>n::nat. even n \<and> x = real n * (pi/2)" |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3756 |
using cos_zero_lemma [of "x + pi/2"] |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3757 |
apply (clarsimp simp add: cos_add) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3758 |
apply (rule_tac x = "n - 1" in exI) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3759 |
apply (simp add: algebra_simps of_nat_diff) |
|
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3760 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3761 |
|
| 15229 | 3762 |
lemma cos_zero_iff: |
| 63558 | 3763 |
"cos x = 0 \<longleftrightarrow> ((\<exists>n. odd n \<and> x = real n * (pi/2)) \<or> (\<exists>n. odd n \<and> x = - (real n * (pi/2))))" |
3764 |
(is "?lhs = ?rhs") |
|
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
3765 |
proof - |
| 63558 | 3766 |
have *: "cos (real n * pi / 2) = 0" if "odd n" for n :: nat |
3767 |
proof - |
|
3768 |
from that obtain m where "n = 2 * m + 1" .. |
|
3769 |
then show ?thesis |
|
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3770 |
by (simp add: field_simps) (simp add: cos_add add_divide_distrib) |
| 63558 | 3771 |
qed |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
3772 |
show ?thesis |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3773 |
proof |
| 63558 | 3774 |
show ?rhs if ?lhs |
3775 |
using that cos_zero_lemma [of x] cos_zero_lemma [of "-x"] by force |
|
3776 |
show ?lhs if ?rhs |
|
3777 |
using that by (auto dest: * simp del: eq_divide_eq_numeral1) |
|
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3778 |
qed |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
3779 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3780 |
|
| 15229 | 3781 |
lemma sin_zero_iff: |
| 63558 | 3782 |
"sin x = 0 \<longleftrightarrow> ((\<exists>n. even n \<and> x = real n * (pi/2)) \<or> (\<exists>n. even n \<and> x = - (real n * (pi/2))))" |
3783 |
(is "?lhs = ?rhs") |
|
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3784 |
proof |
| 63558 | 3785 |
show ?rhs if ?lhs |
3786 |
using that sin_zero_lemma [of x] sin_zero_lemma [of "-x"] by force |
|
3787 |
show ?lhs if ?rhs |
|
3788 |
using that by (auto elim: evenE) |
|
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3789 |
qed |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3790 |
|
| 63558 | 3791 |
lemma cos_zero_iff_int: "cos x = 0 \<longleftrightarrow> (\<exists>n. odd n \<and> x = of_int n * (pi/2))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3792 |
proof safe |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3793 |
assume "cos x = 0" |
| 63558 | 3794 |
then show "\<exists>n. odd n \<and> x = of_int n * (pi/2)" |
3795 |
apply (simp add: cos_zero_iff) |
|
3796 |
apply safe |
|
3797 |
apply (metis even_int_iff of_int_of_nat_eq) |
|
3798 |
apply (rule_tac x="- (int n)" in exI) |
|
3799 |
apply simp |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3800 |
done |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3801 |
next |
| 63558 | 3802 |
fix n :: int |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3803 |
assume "odd n" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3804 |
then show "cos (of_int n * (pi / 2)) = 0" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3805 |
apply (simp add: cos_zero_iff) |
| 63558 | 3806 |
apply (cases n rule: int_cases2) |
3807 |
apply simp_all |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3808 |
done |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3809 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3810 |
|
| 63558 | 3811 |
lemma sin_zero_iff_int: "sin x = 0 \<longleftrightarrow> (\<exists>n. even n \<and> x = of_int n * (pi/2))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3812 |
proof safe |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3813 |
assume "sin x = 0" |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
3814 |
then show "\<exists>n. even n \<and> x = of_int n * (pi / 2)" |
| 63558 | 3815 |
apply (simp add: sin_zero_iff) |
3816 |
apply safe |
|
3817 |
apply (metis even_int_iff of_int_of_nat_eq) |
|
3818 |
apply (rule_tac x="- (int n)" in exI) |
|
3819 |
apply simp |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3820 |
done |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3821 |
next |
| 63558 | 3822 |
fix n :: int |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3823 |
assume "even n" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3824 |
then show "sin (of_int n * (pi / 2)) = 0" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3825 |
apply (simp add: sin_zero_iff) |
| 63558 | 3826 |
apply (cases n rule: int_cases2) |
3827 |
apply simp_all |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3828 |
done |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3829 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3830 |
|
| 63558 | 3831 |
lemma sin_zero_iff_int2: "sin x = 0 \<longleftrightarrow> (\<exists>n::int. x = of_int n * pi)" |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3832 |
apply (simp only: sin_zero_iff_int) |
|
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3833 |
apply (safe elim!: evenE) |
| 63558 | 3834 |
apply (simp_all add: field_simps) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3835 |
using dvd_triv_left apply fastforce |
|
60688
01488b559910
avoid explicit definition of the relation of associated elements in a ring -- prefer explicit normalization instead
haftmann
parents:
60301
diff
changeset
|
3836 |
done |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3837 |
|
| 53079 | 3838 |
lemma cos_monotone_0_pi: |
3839 |
assumes "0 \<le> y" and "y < x" and "x \<le> pi" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3840 |
shows "cos x < cos y" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3841 |
proof - |
| 33549 | 3842 |
have "- (x - y) < 0" using assms by auto |
| 60758 | 3843 |
from MVT2[OF \<open>y < x\<close> DERIV_cos[THEN impI, THEN allI]] |
| 53079 | 3844 |
obtain z where "y < z" and "z < x" and cos_diff: "cos x - cos y = (x - y) * - sin z" |
3845 |
by auto |
|
| 63558 | 3846 |
then have "0 < z" and "z < pi" |
3847 |
using assms by auto |
|
3848 |
then have "0 < sin z" |
|
3849 |
using sin_gt_zero by auto |
|
3850 |
then have "cos x - cos y < 0" |
|
| 53079 | 3851 |
unfolding cos_diff minus_mult_commute[symmetric] |
| 60758 | 3852 |
using \<open>- (x - y) < 0\<close> by (rule mult_pos_neg2) |
| 63558 | 3853 |
then show ?thesis by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3854 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3855 |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3856 |
lemma cos_monotone_0_pi_le: |
| 53079 | 3857 |
assumes "0 \<le> y" and "y \<le> x" and "x \<le> pi" |
3858 |
shows "cos x \<le> cos y" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3859 |
proof (cases "y < x") |
| 53079 | 3860 |
case True |
3861 |
show ?thesis |
|
| 60758 | 3862 |
using cos_monotone_0_pi[OF \<open>0 \<le> y\<close> True \<open>x \<le> pi\<close>] by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3863 |
next |
| 53079 | 3864 |
case False |
| 63558 | 3865 |
then have "y = x" using \<open>y \<le> x\<close> by auto |
3866 |
then show ?thesis by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3867 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3868 |
|
| 53079 | 3869 |
lemma cos_monotone_minus_pi_0: |
| 63558 | 3870 |
assumes "- pi \<le> y" and "y < x" and "x \<le> 0" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3871 |
shows "cos y < cos x" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3872 |
proof - |
| 63558 | 3873 |
have "0 \<le> - x" and "- x < - y" and "- y \<le> pi" |
| 53079 | 3874 |
using assms by auto |
3875 |
from cos_monotone_0_pi[OF this] show ?thesis |
|
3876 |
unfolding cos_minus . |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3877 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3878 |
|
| 53079 | 3879 |
lemma cos_monotone_minus_pi_0': |
| 63558 | 3880 |
assumes "- pi \<le> y" and "y \<le> x" and "x \<le> 0" |
| 53079 | 3881 |
shows "cos y \<le> cos x" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3882 |
proof (cases "y < x") |
| 53079 | 3883 |
case True |
| 60758 | 3884 |
show ?thesis using cos_monotone_minus_pi_0[OF \<open>-pi \<le> y\<close> True \<open>x \<le> 0\<close>] |
| 53079 | 3885 |
by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3886 |
next |
| 53079 | 3887 |
case False |
| 63558 | 3888 |
then have "y = x" using \<open>y \<le> x\<close> by auto |
3889 |
then show ?thesis by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3890 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3891 |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3892 |
lemma sin_monotone_2pi: |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3893 |
assumes "- (pi/2) \<le> y" and "y < x" and "x \<le> pi/2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3894 |
shows "sin y < sin x" |
| 63558 | 3895 |
apply (simp add: sin_cos_eq) |
3896 |
apply (rule cos_monotone_0_pi) |
|
3897 |
using assms |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3898 |
apply auto |
| 63558 | 3899 |
done |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3900 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3901 |
lemma sin_monotone_2pi_le: |
| 53079 | 3902 |
assumes "- (pi / 2) \<le> y" and "y \<le> x" and "x \<le> pi / 2" |
3903 |
shows "sin y \<le> sin x" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3904 |
by (metis assms le_less sin_monotone_2pi) |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3905 |
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3906 |
lemma sin_x_le_x: |
| 63558 | 3907 |
fixes x :: real |
3908 |
assumes x: "x \<ge> 0" |
|
3909 |
shows "sin x \<le> x" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3910 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3911 |
let ?f = "\<lambda>x. x - sin x" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3912 |
from x have "?f x \<ge> ?f 0" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3913 |
apply (rule DERIV_nonneg_imp_nondecreasing) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3914 |
apply (intro allI impI exI[of _ "1 - cos x" for x]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3915 |
apply (auto intro!: derivative_eq_intros simp: field_simps) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3916 |
done |
| 63558 | 3917 |
then show "sin x \<le> x" by simp |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3918 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3919 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3920 |
lemma sin_x_ge_neg_x: |
| 63558 | 3921 |
fixes x :: real |
3922 |
assumes x: "x \<ge> 0" |
|
3923 |
shows "sin x \<ge> - x" |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3924 |
proof - |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3925 |
let ?f = "\<lambda>x. x + sin x" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3926 |
from x have "?f x \<ge> ?f 0" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3927 |
apply (rule DERIV_nonneg_imp_nondecreasing) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3928 |
apply (intro allI impI exI[of _ "1 + cos x" for x]) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3929 |
apply (auto intro!: derivative_eq_intros simp: field_simps real_0_le_add_iff) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3930 |
done |
| 63558 | 3931 |
then show "sin x \<ge> -x" by simp |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3932 |
qed |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3933 |
|
| 63558 | 3934 |
lemma abs_sin_x_le_abs_x: "\<bar>sin x\<bar> \<le> \<bar>x\<bar>" |
3935 |
for x :: real |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3936 |
using sin_x_ge_neg_x [of x] sin_x_le_x [of x] sin_x_ge_neg_x [of "-x"] sin_x_le_x [of "-x"] |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3937 |
by (auto simp: abs_real_def) |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
3938 |
|
| 53079 | 3939 |
|
| 60758 | 3940 |
subsection \<open>More Corollaries about Sine and Cosine\<close> |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3941 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3942 |
lemma sin_cos_npi [simp]: "sin (real (Suc (2 * n)) * pi / 2) = (-1) ^ n" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3943 |
proof - |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3944 |
have "sin ((real n + 1/2) * pi) = cos (real n * pi)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3945 |
by (auto simp: algebra_simps sin_add) |
| 63558 | 3946 |
then show ?thesis |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3947 |
by (simp add: distrib_right add_divide_distrib add.commute mult.commute [of pi]) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3948 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3949 |
|
| 63558 | 3950 |
lemma cos_2npi [simp]: "cos (2 * real n * pi) = 1" |
3951 |
for n :: nat |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3952 |
by (cases "even n") (simp_all add: cos_double mult.assoc) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3953 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3954 |
lemma cos_3over2_pi [simp]: "cos (3/2*pi) = 0" |
| 63558 | 3955 |
apply (subgoal_tac "cos (pi + pi/2) = 0") |
3956 |
apply simp |
|
3957 |
apply (subst cos_add) |
|
3958 |
apply simp |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3959 |
done |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3960 |
|
| 63558 | 3961 |
lemma sin_2npi [simp]: "sin (2 * real n * pi) = 0" |
3962 |
for n :: nat |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3963 |
by (auto simp: mult.assoc sin_double) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3964 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3965 |
lemma sin_3over2_pi [simp]: "sin (3/2*pi) = - 1" |
| 63558 | 3966 |
apply (subgoal_tac "sin (pi + pi/2) = - 1") |
3967 |
apply simp |
|
3968 |
apply (subst sin_add) |
|
3969 |
apply simp |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3970 |
done |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3971 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3972 |
lemma cos_pi_eq_zero [simp]: "cos (pi * real (Suc (2 * m)) / 2) = 0" |
| 63558 | 3973 |
by (simp only: cos_add sin_add of_nat_Suc distrib_right distrib_left add_divide_distrib, auto) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3974 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3975 |
lemma DERIV_cos_add [simp]: "DERIV (\<lambda>x. cos (x + k)) xa :> - sin (xa + k)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3976 |
by (auto intro!: derivative_eq_intros) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3977 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3978 |
lemma sin_zero_norm_cos_one: |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3979 |
fixes x :: "'a::{real_normed_field,banach}"
|
| 63558 | 3980 |
assumes "sin x = 0" |
3981 |
shows "norm (cos x) = 1" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3982 |
using sin_cos_squared_add [of x, unfolded assms] |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3983 |
by (simp add: square_norm_one) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3984 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3985 |
lemma sin_zero_abs_cos_one: "sin x = 0 \<Longrightarrow> \<bar>cos x\<bar> = (1::real)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3986 |
using sin_zero_norm_cos_one by fastforce |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3987 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3988 |
lemma cos_one_sin_zero: |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3989 |
fixes x :: "'a::{real_normed_field,banach}"
|
| 63558 | 3990 |
assumes "cos x = 1" |
3991 |
shows "sin x = 0" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3992 |
using sin_cos_squared_add [of x, unfolded assms] |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3993 |
by simp |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
3994 |
|
| 63558 | 3995 |
lemma sin_times_pi_eq_0: "sin (x * pi) = 0 \<longleftrightarrow> x \<in> \<int>" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3996 |
by (simp add: sin_zero_iff_int2) (metis Ints_cases Ints_of_int) |
|
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
3997 |
|
| 63558 | 3998 |
lemma cos_one_2pi: "cos x = 1 \<longleftrightarrow> (\<exists>n::nat. x = n * 2 * pi) | (\<exists>n::nat. x = - (n * 2 * pi))" |
3999 |
(is "?lhs = ?rhs") |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4000 |
proof |
| 63558 | 4001 |
assume ?lhs |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4002 |
then have "sin x = 0" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4003 |
by (simp add: cos_one_sin_zero) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4004 |
then show ?rhs |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4005 |
proof (simp only: sin_zero_iff, elim exE disjE conjE) |
| 63558 | 4006 |
fix n :: nat |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4007 |
assume n: "even n" "x = real n * (pi/2)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4008 |
then obtain m where m: "n = 2 * m" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4009 |
using dvdE by blast |
| 60758 | 4010 |
then have me: "even m" using \<open>?lhs\<close> n |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4011 |
by (auto simp: field_simps) (metis one_neq_neg_one power_minus_odd power_one) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4012 |
show ?rhs |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4013 |
using m me n |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4014 |
by (auto simp: field_simps elim!: evenE) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4015 |
next |
| 63558 | 4016 |
fix n :: nat |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4017 |
assume n: "even n" "x = - (real n * (pi/2))" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4018 |
then obtain m where m: "n = 2 * m" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4019 |
using dvdE by blast |
| 60758 | 4020 |
then have me: "even m" using \<open>?lhs\<close> n |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4021 |
by (auto simp: field_simps) (metis one_neq_neg_one power_minus_odd power_one) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4022 |
show ?rhs |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4023 |
using m me n |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4024 |
by (auto simp: field_simps elim!: evenE) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4025 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4026 |
next |
| 63558 | 4027 |
assume ?rhs |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4028 |
then show "cos x = 1" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4029 |
by (metis cos_2npi cos_minus mult.assoc mult.left_commute) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4030 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4031 |
|
| 63558 | 4032 |
lemma cos_one_2pi_int: "cos x = 1 \<longleftrightarrow> (\<exists>n::int. x = n * 2 * pi)" |
4033 |
apply auto (* FIXME simproc bug? *) |
|
4034 |
apply (auto simp: cos_one_2pi) |
|
4035 |
apply (metis of_int_of_nat_eq) |
|
4036 |
apply (metis mult_minus_right of_int_minus of_int_of_nat_eq) |
|
4037 |
apply (metis mult_minus_right of_int_of_nat) |
|
4038 |
done |
|
4039 |
||
4040 |
lemma sin_cos_sqrt: "0 \<le> sin x \<Longrightarrow> sin x = sqrt (1 - (cos(x) ^ 2))" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4041 |
using sin_squared_eq real_sqrt_unique by fastforce |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4042 |
|
| 63558 | 4043 |
lemma sin_eq_0_pi: "- pi < x \<Longrightarrow> x < pi \<Longrightarrow> sin x = 0 \<Longrightarrow> x = 0" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4044 |
by (metis sin_gt_zero sin_minus minus_less_iff neg_0_less_iff_less not_less_iff_gr_or_eq) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4045 |
|
| 63558 | 4046 |
lemma cos_treble_cos: "cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x" |
4047 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4048 |
proof - |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4049 |
have *: "(sin x * (sin x * 3)) = 3 - (cos x * (cos x * 3))" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4050 |
by (simp add: mult.assoc [symmetric] sin_squared_eq [unfolded power2_eq_square]) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4051 |
have "cos(3 * x) = cos(2*x + x)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4052 |
by simp |
| 63558 | 4053 |
also have "\<dots> = 4 * cos x ^ 3 - 3 * cos x" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4054 |
apply (simp only: cos_add cos_double sin_double) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4055 |
apply (simp add: * field_simps power2_eq_square power3_eq_cube) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4056 |
done |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4057 |
finally show ?thesis . |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4058 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4059 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4060 |
lemma cos_45: "cos (pi / 4) = sqrt 2 / 2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4061 |
proof - |
| 63558 | 4062 |
let ?c = "cos (pi / 4)" |
4063 |
let ?s = "sin (pi / 4)" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4064 |
have nonneg: "0 \<le> ?c" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4065 |
by (simp add: cos_ge_zero) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4066 |
have "0 = cos (pi / 4 + pi / 4)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4067 |
by simp |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4068 |
also have "cos (pi / 4 + pi / 4) = ?c\<^sup>2 - ?s\<^sup>2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4069 |
by (simp only: cos_add power2_eq_square) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4070 |
also have "\<dots> = 2 * ?c\<^sup>2 - 1" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4071 |
by (simp add: sin_squared_eq) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4072 |
finally have "?c\<^sup>2 = (sqrt 2 / 2)\<^sup>2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4073 |
by (simp add: power_divide) |
| 63558 | 4074 |
then show ?thesis |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4075 |
using nonneg by (rule power2_eq_imp_eq) simp |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4076 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4077 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4078 |
lemma cos_30: "cos (pi / 6) = sqrt 3/2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4079 |
proof - |
| 63558 | 4080 |
let ?c = "cos (pi / 6)" |
4081 |
let ?s = "sin (pi / 6)" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4082 |
have pos_c: "0 < ?c" |
| 63558 | 4083 |
by (rule cos_gt_zero) simp_all |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4084 |
have "0 = cos (pi / 6 + pi / 6 + pi / 6)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4085 |
by simp |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4086 |
also have "\<dots> = (?c * ?c - ?s * ?s) * ?c - (?s * ?c + ?c * ?s) * ?s" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4087 |
by (simp only: cos_add sin_add) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4088 |
also have "\<dots> = ?c * (?c\<^sup>2 - 3 * ?s\<^sup>2)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4089 |
by (simp add: algebra_simps power2_eq_square) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4090 |
finally have "?c\<^sup>2 = (sqrt 3/2)\<^sup>2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4091 |
using pos_c by (simp add: sin_squared_eq power_divide) |
| 63558 | 4092 |
then show ?thesis |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4093 |
using pos_c [THEN order_less_imp_le] |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4094 |
by (rule power2_eq_imp_eq) simp |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4095 |
qed |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4096 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4097 |
lemma sin_45: "sin (pi / 4) = sqrt 2 / 2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4098 |
by (simp add: sin_cos_eq cos_45) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4099 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4100 |
lemma sin_60: "sin (pi / 3) = sqrt 3/2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4101 |
by (simp add: sin_cos_eq cos_30) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4102 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4103 |
lemma cos_60: "cos (pi / 3) = 1 / 2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4104 |
apply (rule power2_eq_imp_eq) |
| 63558 | 4105 |
apply (simp add: cos_squared_eq sin_60 power_divide) |
4106 |
apply (rule cos_ge_zero) |
|
4107 |
apply (rule order_trans [where y=0]) |
|
4108 |
apply simp_all |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4109 |
done |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4110 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4111 |
lemma sin_30: "sin (pi / 6) = 1 / 2" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4112 |
by (simp add: sin_cos_eq cos_60) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4113 |
|
| 63558 | 4114 |
lemma cos_integer_2pi: "n \<in> \<int> \<Longrightarrow> cos(2 * pi * n) = 1" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4115 |
by (metis Ints_cases cos_one_2pi_int mult.assoc mult.commute) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4116 |
|
| 63558 | 4117 |
lemma sin_integer_2pi: "n \<in> \<int> \<Longrightarrow> sin(2 * pi * n) = 0" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4118 |
by (metis sin_two_pi Ints_mult mult.assoc mult.commute sin_times_pi_eq_0) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4119 |
|
| 63558 | 4120 |
lemma cos_int_2npi [simp]: "cos (2 * of_int n * pi) = 1" |
4121 |
for n :: int |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4122 |
by (simp add: cos_one_2pi_int) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4123 |
|
| 63558 | 4124 |
lemma sin_int_2npi [simp]: "sin (2 * of_int n * pi) = 0" |
4125 |
for n :: int |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4126 |
by (metis Ints_of_int mult.assoc mult.commute sin_integer_2pi) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4127 |
|
| 63558 | 4128 |
lemma sincos_principal_value: "\<exists>y. (- pi < y \<and> y \<le> pi) \<and> (sin y = sin x \<and> cos y = cos x)" |
4129 |
apply (rule exI [where x="pi - (2 * pi) * frac ((pi - x) / (2 * pi))"]) |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4130 |
apply (auto simp: field_simps frac_lt_1) |
| 63558 | 4131 |
apply (simp_all add: frac_def divide_simps) |
4132 |
apply (simp_all add: add_divide_distrib diff_divide_distrib) |
|
4133 |
apply (simp_all add: sin_diff cos_diff mult.assoc [symmetric] cos_integer_2pi sin_integer_2pi) |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4134 |
done |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4135 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4136 |
|
| 60758 | 4137 |
subsection \<open>Tangent\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4138 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4139 |
definition tan :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
| 53079 | 4140 |
where "tan = (\<lambda>x. sin x / cos x)" |
| 23043 | 4141 |
|
| 63558 | 4142 |
lemma tan_of_real: "of_real (tan x) = (tan (of_real x) :: 'a::{real_normed_field,banach})"
|
| 59862 | 4143 |
by (simp add: tan_def sin_of_real cos_of_real) |
4144 |
||
| 63558 | 4145 |
lemma tan_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> tan z \<in> \<real>" |
4146 |
for z :: "'a::{real_normed_field,banach}"
|
|
| 59862 | 4147 |
by (simp add: tan_def) |
4148 |
||
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4149 |
lemma tan_zero [simp]: "tan 0 = 0" |
| 44311 | 4150 |
by (simp add: tan_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4151 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4152 |
lemma tan_pi [simp]: "tan pi = 0" |
| 44311 | 4153 |
by (simp add: tan_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4154 |
|
| 63558 | 4155 |
lemma tan_npi [simp]: "tan (real n * pi) = 0" |
4156 |
for n :: nat |
|
| 44311 | 4157 |
by (simp add: tan_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4158 |
|
| 63558 | 4159 |
lemma tan_minus [simp]: "tan (- x) = - tan x" |
| 44311 | 4160 |
by (simp add: tan_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4161 |
|
| 63558 | 4162 |
lemma tan_periodic [simp]: "tan (x + 2 * pi) = tan x" |
4163 |
by (simp add: tan_def) |
|
4164 |
||
4165 |
lemma lemma_tan_add1: "cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> 1 - tan x * tan y = cos (x + y)/(cos x * cos y)" |
|
| 44311 | 4166 |
by (simp add: tan_def cos_add field_simps) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4167 |
|
| 63558 | 4168 |
lemma add_tan_eq: "cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> tan x + tan y = sin(x + y)/(cos x * cos y)" |
4169 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 4170 |
by (simp add: tan_def sin_add field_simps) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4171 |
|
| 15229 | 4172 |
lemma tan_add: |
| 63558 | 4173 |
"cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> cos (x + y) \<noteq> 0 \<Longrightarrow> tan (x + y) = (tan x + tan y)/(1 - tan x * tan y)" |
4174 |
for x :: "'a::{real_normed_field,banach}"
|
|
4175 |
by (simp add: add_tan_eq lemma_tan_add1 field_simps) (simp add: tan_def) |
|
4176 |
||
4177 |
lemma tan_double: "cos x \<noteq> 0 \<Longrightarrow> cos (2 * x) \<noteq> 0 \<Longrightarrow> tan (2 * x) = (2 * tan x) / (1 - (tan x)\<^sup>2)" |
|
4178 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 4179 |
using tan_add [of x x] by (simp add: power2_eq_square) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4180 |
|
| 63558 | 4181 |
lemma tan_gt_zero: "0 < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < tan x" |
| 53079 | 4182 |
by (simp add: tan_def zero_less_divide_iff sin_gt_zero2 cos_gt_zero_pi) |
| 41970 | 4183 |
|
4184 |
lemma tan_less_zero: |
|
| 63558 | 4185 |
assumes "- pi/2 < x" and "x < 0" |
| 53079 | 4186 |
shows "tan x < 0" |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4187 |
proof - |
| 63558 | 4188 |
have "0 < tan (- x)" |
4189 |
using assms by (simp only: tan_gt_zero) |
|
4190 |
then show ?thesis by simp |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4191 |
qed |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4192 |
|
| 63558 | 4193 |
lemma tan_half: "tan x = sin (2 * x) / (cos (2 * x) + 1)" |
4194 |
for x :: "'a::{real_normed_field,banach,field}"
|
|
|
44756
efcd71fbaeec
simplify proof of tan_half, removing unused assumptions
huffman
parents:
44755
diff
changeset
|
4195 |
unfolding tan_def sin_double cos_double sin_squared_eq |
|
efcd71fbaeec
simplify proof of tan_half, removing unused assumptions
huffman
parents:
44755
diff
changeset
|
4196 |
by (simp add: power2_eq_square) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4197 |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4198 |
lemma tan_30: "tan (pi / 6) = 1 / sqrt 3" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4199 |
unfolding tan_def by (simp add: sin_30 cos_30) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4200 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4201 |
lemma tan_45: "tan (pi / 4) = 1" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4202 |
unfolding tan_def by (simp add: sin_45 cos_45) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4203 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4204 |
lemma tan_60: "tan (pi / 3) = sqrt 3" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4205 |
unfolding tan_def by (simp add: sin_60 cos_60) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4206 |
|
| 63558 | 4207 |
lemma DERIV_tan [simp]: "cos x \<noteq> 0 \<Longrightarrow> DERIV tan x :> inverse ((cos x)\<^sup>2)" |
4208 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 4209 |
unfolding tan_def |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
4210 |
by (auto intro!: derivative_eq_intros, simp add: divide_inverse power2_eq_square) |
| 44311 | 4211 |
|
| 63558 | 4212 |
lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x" |
4213 |
for x :: "'a::{real_normed_field,banach}"
|
|
| 44311 | 4214 |
by (rule DERIV_tan [THEN DERIV_isCont]) |
4215 |
||
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4216 |
lemma isCont_tan' [simp,continuous_intros]: |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4217 |
fixes a :: "'a::{real_normed_field,banach}" and f :: "'a \<Rightarrow> 'a"
|
| 63558 | 4218 |
shows "isCont f a \<Longrightarrow> cos (f a) \<noteq> 0 \<Longrightarrow> isCont (\<lambda>x. tan (f x)) a" |
| 44311 | 4219 |
by (rule isCont_o2 [OF _ isCont_tan]) |
4220 |
||
4221 |
lemma tendsto_tan [tendsto_intros]: |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4222 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
| 63558 | 4223 |
shows "(f \<longlongrightarrow> a) F \<Longrightarrow> cos a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. tan (f x)) \<longlongrightarrow> tan a) F" |
| 44311 | 4224 |
by (rule isCont_tendsto_compose [OF isCont_tan]) |
4225 |
||
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4226 |
lemma continuous_tan: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4227 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4228 |
shows "continuous F f \<Longrightarrow> cos (f (Lim F (\<lambda>x. x))) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. tan (f x))" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4229 |
unfolding continuous_def by (rule tendsto_tan) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4230 |
|
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4231 |
lemma continuous_on_tan [continuous_intros]: |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4232 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4233 |
shows "continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. cos (f x) \<noteq> 0) \<Longrightarrow> continuous_on s (\<lambda>x. tan (f x))" |
|
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4234 |
unfolding continuous_on_def by (auto intro: tendsto_tan) |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4235 |
|
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4236 |
lemma continuous_within_tan [continuous_intros]: |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4237 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
| 63558 | 4238 |
shows "continuous (at x within s) f \<Longrightarrow> |
4239 |
cos (f x) \<noteq> 0 \<Longrightarrow> continuous (at x within s) (\<lambda>x. tan (f x))" |
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4240 |
unfolding continuous_within by (rule tendsto_tan) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4241 |
|
| 61976 | 4242 |
lemma LIM_cos_div_sin: "(\<lambda>x. cos(x)/sin(x)) \<midarrow>pi/2\<rightarrow> 0" |
| 44311 | 4243 |
by (rule LIM_cong_limit, (rule tendsto_intros)+, simp_all) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4244 |
|
| 63558 | 4245 |
lemma lemma_tan_total: "0 < y \<Longrightarrow> \<exists>x. 0 < x \<and> x < pi/2 \<and> y < tan x" |
4246 |
apply (insert LIM_cos_div_sin) |
|
| 53079 | 4247 |
apply (simp only: LIM_eq) |
| 63558 | 4248 |
apply (drule_tac x = "inverse y" in spec) |
4249 |
apply safe |
|
4250 |
apply force |
|
4251 |
apply (drule_tac ?d1.0 = s in pi_half_gt_zero [THEN [2] real_lbound_gt_zero]) |
|
4252 |
apply safe |
|
| 53079 | 4253 |
apply (rule_tac x = "(pi/2) - e" in exI) |
4254 |
apply (simp (no_asm_simp)) |
|
4255 |
apply (drule_tac x = "(pi/2) - e" in spec) |
|
4256 |
apply (auto simp add: tan_def sin_diff cos_diff) |
|
4257 |
apply (rule inverse_less_iff_less [THEN iffD1]) |
|
| 63558 | 4258 |
apply (auto simp add: divide_inverse) |
4259 |
apply (rule mult_pos_pos) |
|
4260 |
apply (subgoal_tac [3] "0 < sin e \<and> 0 < cos e") |
|
4261 |
apply (auto intro: cos_gt_zero sin_gt_zero2 simp: mult.commute) |
|
| 53079 | 4262 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4263 |
|
| 63558 | 4264 |
lemma tan_total_pos: "0 \<le> y \<Longrightarrow> \<exists>x. 0 \<le> x \<and> x < pi/2 \<and> tan x = y" |
4265 |
apply (frule order_le_imp_less_or_eq) |
|
4266 |
apply safe |
|
| 53079 | 4267 |
prefer 2 apply force |
| 63558 | 4268 |
apply (drule lemma_tan_total) |
4269 |
apply safe |
|
| 53079 | 4270 |
apply (cut_tac f = tan and a = 0 and b = x and y = y in IVT_objl) |
4271 |
apply (auto intro!: DERIV_tan [THEN DERIV_isCont]) |
|
4272 |
apply (drule_tac y = xa in order_le_imp_less_or_eq) |
|
4273 |
apply (auto dest: cos_gt_zero) |
|
4274 |
done |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4275 |
|
| 63558 | 4276 |
lemma lemma_tan_total1: "\<exists>x. -(pi/2) < x \<and> x < (pi/2) \<and> tan x = y" |
4277 |
apply (insert linorder_linear [of 0 y]) |
|
4278 |
apply safe |
|
4279 |
apply (drule tan_total_pos) |
|
4280 |
apply (cut_tac [2] y="-y" in tan_total_pos) |
|
4281 |
apply safe |
|
4282 |
apply (rule_tac [3] x = "-x" in exI) |
|
4283 |
apply (auto del: exI intro!: exI) |
|
| 53079 | 4284 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4285 |
|
| 63558 | 4286 |
lemma tan_total: "\<exists>! x. -(pi/2) < x \<and> x < (pi/2) \<and> tan x = y" |
4287 |
apply (insert lemma_tan_total1 [where y = y]) |
|
4288 |
apply auto |
|
|
57492
74bf65a1910a
Hypsubst preserves equality hypotheses
Thomas Sewell <thomas.sewell@nicta.com.au>
parents:
57418
diff
changeset
|
4289 |
apply hypsubst_thin |
| 63558 | 4290 |
apply (cut_tac x = xa and y = y in linorder_less_linear) |
4291 |
apply auto |
|
4292 |
apply (subgoal_tac [2] "\<exists>z. y < z \<and> z < xa \<and> DERIV tan z :> 0") |
|
4293 |
apply (subgoal_tac "\<exists>z. xa < z \<and> z < y \<and> DERIV tan z :> 0") |
|
4294 |
apply (rule_tac [4] Rolle) |
|
4295 |
apply (rule_tac [2] Rolle) |
|
4296 |
apply (auto del: exI intro!: DERIV_tan DERIV_isCont exI |
|
4297 |
simp add: real_differentiable_def) |
|
4298 |
apply (rule_tac [!] DERIV_tan asm_rl) |
|
4299 |
apply (auto dest!: DERIV_unique [OF _ DERIV_tan] |
|
4300 |
simp add: cos_gt_zero_pi [THEN less_imp_neq, THEN not_sym]) |
|
| 53079 | 4301 |
done |
4302 |
||
4303 |
lemma tan_monotone: |
|
4304 |
assumes "- (pi / 2) < y" and "y < x" and "x < pi / 2" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4305 |
shows "tan y < tan x" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4306 |
proof - |
| 53079 | 4307 |
have "\<forall>x'. y \<le> x' \<and> x' \<le> x \<longrightarrow> DERIV tan x' :> inverse ((cos x')\<^sup>2)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4308 |
proof (rule allI, rule impI) |
| 53079 | 4309 |
fix x' :: real |
4310 |
assume "y \<le> x' \<and> x' \<le> x" |
|
| 63558 | 4311 |
then have "-(pi/2) < x'" and "x' < pi/2" |
4312 |
using assms by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4313 |
from cos_gt_zero_pi[OF this] |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4314 |
have "cos x' \<noteq> 0" by auto |
| 63558 | 4315 |
then show "DERIV tan x' :> inverse ((cos x')\<^sup>2)" |
4316 |
by (rule DERIV_tan) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4317 |
qed |
| 60758 | 4318 |
from MVT2[OF \<open>y < x\<close> this] |
| 53079 | 4319 |
obtain z where "y < z" and "z < x" |
4320 |
and tan_diff: "tan x - tan y = (x - y) * inverse ((cos z)\<^sup>2)" by auto |
|
| 63558 | 4321 |
then have "- (pi / 2) < z" and "z < pi / 2" |
4322 |
using assms by auto |
|
4323 |
then have "0 < cos z" |
|
4324 |
using cos_gt_zero_pi by auto |
|
4325 |
then have inv_pos: "0 < inverse ((cos z)\<^sup>2)" |
|
4326 |
by auto |
|
| 60758 | 4327 |
have "0 < x - y" using \<open>y < x\<close> by auto |
| 63558 | 4328 |
with inv_pos have "0 < tan x - tan y" |
4329 |
unfolding tan_diff by auto |
|
4330 |
then show ?thesis by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4331 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4332 |
|
| 53079 | 4333 |
lemma tan_monotone': |
4334 |
assumes "- (pi / 2) < y" |
|
4335 |
and "y < pi / 2" |
|
4336 |
and "- (pi / 2) < x" |
|
4337 |
and "x < pi / 2" |
|
| 63558 | 4338 |
shows "y < x \<longleftrightarrow> tan y < tan x" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4339 |
proof |
| 53079 | 4340 |
assume "y < x" |
| 63558 | 4341 |
then show "tan y < tan x" |
| 60758 | 4342 |
using tan_monotone and \<open>- (pi / 2) < y\<close> and \<open>x < pi / 2\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4343 |
next |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4344 |
assume "tan y < tan x" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4345 |
show "y < x" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4346 |
proof (rule ccontr) |
| 63558 | 4347 |
assume "\<not> ?thesis" |
4348 |
then have "x \<le> y" by auto |
|
4349 |
then have "tan x \<le> tan y" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4350 |
proof (cases "x = y") |
| 63558 | 4351 |
case True |
4352 |
then show ?thesis by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4353 |
next |
| 63558 | 4354 |
case False |
4355 |
then have "x < y" using \<open>x \<le> y\<close> by auto |
|
4356 |
from tan_monotone[OF \<open>- (pi/2) < x\<close> this \<open>y < pi / 2\<close>] show ?thesis |
|
4357 |
by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4358 |
qed |
| 63558 | 4359 |
then show False |
4360 |
using \<open>tan y < tan x\<close> by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4361 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4362 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4363 |
|
| 53079 | 4364 |
lemma tan_inverse: "1 / (tan y) = tan (pi / 2 - y)" |
4365 |
unfolding tan_def sin_cos_eq[of y] cos_sin_eq[of y] by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4366 |
|
| 41970 | 4367 |
lemma tan_periodic_pi[simp]: "tan (x + pi) = tan x" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4368 |
by (simp add: tan_def) |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4369 |
|
| 63558 | 4370 |
lemma tan_periodic_nat[simp]: "tan (x + real n * pi) = tan x" |
4371 |
for n :: nat |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4372 |
proof (induct n arbitrary: x) |
| 53079 | 4373 |
case 0 |
4374 |
then show ?case by simp |
|
4375 |
next |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4376 |
case (Suc n) |
| 53079 | 4377 |
have split_pi_off: "x + real (Suc n) * pi = (x + real n * pi) + pi" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4378 |
unfolding Suc_eq_plus1 of_nat_add distrib_right by auto |
| 63558 | 4379 |
show ?case |
4380 |
unfolding split_pi_off using Suc by auto |
|
| 53079 | 4381 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4382 |
|
| 63558 | 4383 |
lemma tan_periodic_int[simp]: "tan (x + of_int i * pi) = tan x" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4384 |
proof (cases "0 \<le> i") |
| 53079 | 4385 |
case True |
| 63558 | 4386 |
then have i_nat: "of_int i = of_int (nat i)" by auto |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4387 |
show ?thesis unfolding i_nat |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
4388 |
by (metis of_int_of_nat_eq tan_periodic_nat) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4389 |
next |
| 53079 | 4390 |
case False |
| 63558 | 4391 |
then have i_nat: "of_int i = - of_int (nat (- i))" by auto |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4392 |
have "tan x = tan (x + of_int i * pi - of_int i * pi)" |
| 53079 | 4393 |
by auto |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4394 |
also have "\<dots> = tan (x + of_int i * pi)" |
|
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4395 |
unfolding i_nat mult_minus_left diff_minus_eq_add |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
4396 |
by (metis of_int_of_nat_eq tan_periodic_nat) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4397 |
finally show ?thesis by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4398 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4399 |
|
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46240
diff
changeset
|
4400 |
lemma tan_periodic_n[simp]: "tan (x + numeral n * pi) = tan x" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4401 |
using tan_periodic_int[of _ "numeral n" ] by simp |
| 23043 | 4402 |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4403 |
lemma tan_minus_45: "tan (-(pi/4)) = -1" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4404 |
unfolding tan_def by (simp add: sin_45 cos_45) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4405 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4406 |
lemma tan_diff: |
| 63558 | 4407 |
"cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> cos (x - y) \<noteq> 0 \<Longrightarrow> tan (x - y) = (tan x - tan y)/(1 + tan x * tan y)" |
4408 |
for x :: "'a::{real_normed_field,banach}"
|
|
4409 |
using tan_add [of x "-y"] by simp |
|
4410 |
||
4411 |
lemma tan_pos_pi2_le: "0 \<le> x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 \<le> tan x" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4412 |
using less_eq_real_def tan_gt_zero by auto |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4413 |
|
| 63558 | 4414 |
lemma cos_tan: "\<bar>x\<bar> < pi/2 \<Longrightarrow> cos x = 1 / sqrt (1 + tan x ^ 2)" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4415 |
using cos_gt_zero_pi [of x] |
| 62390 | 4416 |
by (simp add: divide_simps tan_def real_sqrt_divide abs_if split: if_split_asm) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4417 |
|
| 63558 | 4418 |
lemma sin_tan: "\<bar>x\<bar> < pi/2 \<Longrightarrow> sin x = tan x / sqrt (1 + tan x ^ 2)" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4419 |
using cos_gt_zero [of "x"] cos_gt_zero [of "-x"] |
| 62390 | 4420 |
by (force simp add: divide_simps tan_def real_sqrt_divide abs_if split: if_split_asm) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4421 |
|
| 63558 | 4422 |
lemma tan_mono_le: "-(pi/2) < x \<Longrightarrow> x \<le> y \<Longrightarrow> y < pi/2 \<Longrightarrow> tan x \<le> tan y" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4423 |
using less_eq_real_def tan_monotone by auto |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4424 |
|
| 63558 | 4425 |
lemma tan_mono_lt_eq: |
4426 |
"-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> -(pi/2) < y \<Longrightarrow> y < pi/2 \<Longrightarrow> tan x < tan y \<longleftrightarrow> x < y" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4427 |
using tan_monotone' by blast |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4428 |
|
| 63558 | 4429 |
lemma tan_mono_le_eq: |
4430 |
"-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> -(pi/2) < y \<Longrightarrow> y < pi/2 \<Longrightarrow> tan x \<le> tan y \<longleftrightarrow> x \<le> y" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4431 |
by (meson tan_mono_le not_le tan_monotone) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4432 |
|
| 61944 | 4433 |
lemma tan_bound_pi2: "\<bar>x\<bar> < pi/4 \<Longrightarrow> \<bar>tan x\<bar> < 1" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4434 |
using tan_45 tan_monotone [of x "pi/4"] tan_monotone [of "-x" "pi/4"] |
| 62390 | 4435 |
by (auto simp: abs_if split: if_split_asm) |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4436 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4437 |
lemma tan_cot: "tan(pi/2 - x) = inverse(tan x)" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4438 |
by (simp add: tan_def sin_diff cos_diff) |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4439 |
|
| 63558 | 4440 |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4441 |
subsection \<open>Cotangent\<close> |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4442 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4443 |
definition cot :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4444 |
where "cot = (\<lambda>x. cos x / sin x)" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4445 |
|
| 63558 | 4446 |
lemma cot_of_real: "of_real (cot x) = (cot (of_real x) :: 'a::{real_normed_field,banach})"
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4447 |
by (simp add: cot_def sin_of_real cos_of_real) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4448 |
|
| 63558 | 4449 |
lemma cot_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> cot z \<in> \<real>" |
4450 |
for z :: "'a::{real_normed_field,banach}"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4451 |
by (simp add: cot_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4452 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4453 |
lemma cot_zero [simp]: "cot 0 = 0" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4454 |
by (simp add: cot_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4455 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4456 |
lemma cot_pi [simp]: "cot pi = 0" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4457 |
by (simp add: cot_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4458 |
|
| 63558 | 4459 |
lemma cot_npi [simp]: "cot (real n * pi) = 0" |
4460 |
for n :: nat |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4461 |
by (simp add: cot_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4462 |
|
| 63558 | 4463 |
lemma cot_minus [simp]: "cot (- x) = - cot x" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4464 |
by (simp add: cot_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4465 |
|
| 63558 | 4466 |
lemma cot_periodic [simp]: "cot (x + 2 * pi) = cot x" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4467 |
by (simp add: cot_def) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4468 |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4469 |
lemma cot_altdef: "cot x = inverse (tan x)" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4470 |
by (simp add: cot_def tan_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4471 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4472 |
lemma tan_altdef: "tan x = inverse (cot x)" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4473 |
by (simp add: cot_def tan_def) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4474 |
|
| 63558 | 4475 |
lemma tan_cot': "tan (pi/2 - x) = cot x" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4476 |
by (simp add: tan_cot cot_altdef) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4477 |
|
| 63558 | 4478 |
lemma cot_gt_zero: "0 < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < cot x" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4479 |
by (simp add: cot_def zero_less_divide_iff sin_gt_zero2 cos_gt_zero_pi) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4480 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4481 |
lemma cot_less_zero: |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4482 |
assumes lb: "- pi/2 < x" and "x < 0" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4483 |
shows "cot x < 0" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4484 |
proof - |
| 63558 | 4485 |
have "0 < cot (- x)" |
4486 |
using assms by (simp only: cot_gt_zero) |
|
4487 |
then show ?thesis by simp |
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4488 |
qed |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4489 |
|
| 63558 | 4490 |
lemma DERIV_cot [simp]: "sin x \<noteq> 0 \<Longrightarrow> DERIV cot x :> -inverse ((sin x)\<^sup>2)" |
4491 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4492 |
unfolding cot_def using cos_squared_eq[of x] |
| 63558 | 4493 |
by (auto intro!: derivative_eq_intros) (simp add: divide_inverse power2_eq_square) |
4494 |
||
4495 |
lemma isCont_cot: "sin x \<noteq> 0 \<Longrightarrow> isCont cot x" |
|
4496 |
for x :: "'a::{real_normed_field,banach}"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4497 |
by (rule DERIV_cot [THEN DERIV_isCont]) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4498 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4499 |
lemma isCont_cot' [simp,continuous_intros]: |
| 63558 | 4500 |
"isCont f a \<Longrightarrow> sin (f a) \<noteq> 0 \<Longrightarrow> isCont (\<lambda>x. cot (f x)) a" |
4501 |
for a :: "'a::{real_normed_field,banach}" and f :: "'a \<Rightarrow> 'a"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4502 |
by (rule isCont_o2 [OF _ isCont_cot]) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4503 |
|
| 63558 | 4504 |
lemma tendsto_cot [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> sin a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot a) F" |
4505 |
for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4506 |
by (rule isCont_tendsto_compose [OF isCont_cot]) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4507 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4508 |
lemma continuous_cot: |
| 63558 | 4509 |
"continuous F f \<Longrightarrow> sin (f (Lim F (\<lambda>x. x))) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. cot (f x))" |
4510 |
for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4511 |
unfolding continuous_def by (rule tendsto_cot) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4512 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4513 |
lemma continuous_on_cot [continuous_intros]: |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4514 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4515 |
shows "continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. sin (f x) \<noteq> 0) \<Longrightarrow> continuous_on s (\<lambda>x. cot (f x))" |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4516 |
unfolding continuous_on_def by (auto intro: tendsto_cot) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4517 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4518 |
lemma continuous_within_cot [continuous_intros]: |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4519 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}"
|
| 63558 | 4520 |
shows "continuous (at x within s) f \<Longrightarrow> sin (f x) \<noteq> 0 \<Longrightarrow> continuous (at x within s) (\<lambda>x. cot (f x))" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4521 |
unfolding continuous_within by (rule tendsto_cot) |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4522 |
|
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4523 |
|
| 60758 | 4524 |
subsection \<open>Inverse Trigonometric Functions\<close> |
| 23043 | 4525 |
|
| 63558 | 4526 |
definition arcsin :: "real \<Rightarrow> real" |
4527 |
where "arcsin y = (THE x. -(pi/2) \<le> x \<and> x \<le> pi/2 \<and> sin x = y)" |
|
4528 |
||
4529 |
definition arccos :: "real \<Rightarrow> real" |
|
4530 |
where "arccos y = (THE x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y)" |
|
4531 |
||
4532 |
definition arctan :: "real \<Rightarrow> real" |
|
4533 |
where "arctan y = (THE x. -(pi/2) < x \<and> x < pi/2 \<and> tan x = y)" |
|
4534 |
||
4535 |
lemma arcsin: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y \<and> arcsin y \<le> pi/2 \<and> sin (arcsin y) = y" |
|
| 53079 | 4536 |
unfolding arcsin_def by (rule theI' [OF sin_total]) |
| 23011 | 4537 |
|
| 63558 | 4538 |
lemma arcsin_pi: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y \<and> arcsin y \<le> pi \<and> sin (arcsin y) = y" |
4539 |
by (drule (1) arcsin) (force intro: order_trans) |
|
4540 |
||
4541 |
lemma sin_arcsin [simp]: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> sin (arcsin y) = y" |
|
4542 |
by (blast dest: arcsin) |
|
4543 |
||
4544 |
lemma arcsin_bounded: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y \<and> arcsin y \<le> pi/2" |
|
| 53079 | 4545 |
by (blast dest: arcsin) |
4546 |
||
| 63558 | 4547 |
lemma arcsin_lbound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y" |
| 53079 | 4548 |
by (blast dest: arcsin) |
4549 |
||
| 63558 | 4550 |
lemma arcsin_ubound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin y \<le> pi/2" |
| 53079 | 4551 |
by (blast dest: arcsin) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4552 |
|
| 63558 | 4553 |
lemma arcsin_lt_bounded: "- 1 < y \<Longrightarrow> y < 1 \<Longrightarrow> - (pi/2) < arcsin y \<and> arcsin y < pi/2" |
| 53079 | 4554 |
apply (frule order_less_imp_le) |
4555 |
apply (frule_tac y = y in order_less_imp_le) |
|
4556 |
apply (frule arcsin_bounded) |
|
| 63558 | 4557 |
apply safe |
4558 |
apply simp |
|
4559 |
apply (drule_tac y = "arcsin y" in order_le_imp_less_or_eq) |
|
4560 |
apply (drule_tac [2] y = "pi/2" in order_le_imp_less_or_eq) |
|
4561 |
apply safe |
|
4562 |
apply (drule_tac [!] f = sin in arg_cong) |
|
4563 |
apply auto |
|
| 53079 | 4564 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4565 |
|
| 63558 | 4566 |
lemma arcsin_sin: "- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> arcsin (sin x) = x" |
| 53079 | 4567 |
apply (unfold arcsin_def) |
4568 |
apply (rule the1_equality) |
|
| 63558 | 4569 |
apply (rule sin_total) |
4570 |
apply auto |
|
| 53079 | 4571 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4572 |
|
| 59869 | 4573 |
lemma arcsin_0 [simp]: "arcsin 0 = 0" |
| 63558 | 4574 |
using arcsin_sin [of 0] by simp |
| 59869 | 4575 |
|
4576 |
lemma arcsin_1 [simp]: "arcsin 1 = pi/2" |
|
| 63558 | 4577 |
using arcsin_sin [of "pi/2"] by simp |
4578 |
||
4579 |
lemma arcsin_minus_1 [simp]: "arcsin (- 1) = - (pi/2)" |
|
4580 |
using arcsin_sin [of "- pi/2"] by simp |
|
4581 |
||
4582 |
lemma arcsin_minus: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin (- x) = - arcsin x" |
|
| 59869 | 4583 |
by (metis (no_types, hide_lams) arcsin arcsin_sin minus_minus neg_le_iff_le sin_minus) |
4584 |
||
| 63558 | 4585 |
lemma arcsin_eq_iff: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arcsin x = arcsin y \<longleftrightarrow> x = y" |
|
61649
268d88ec9087
Tweaks for "real": Removal of [iff] status for some lemmas, adding [simp] for others. Plus fixes.
paulson <lp15@cam.ac.uk>
parents:
61609
diff
changeset
|
4586 |
by (metis abs_le_iff arcsin minus_le_iff) |
| 59869 | 4587 |
|
| 63558 | 4588 |
lemma cos_arcsin_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> cos (arcsin x) \<noteq> 0" |
| 59869 | 4589 |
using arcsin_lt_bounded cos_gt_zero_pi by force |
4590 |
||
| 63558 | 4591 |
lemma arccos: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi \<and> cos (arccos y) = y" |
| 53079 | 4592 |
unfolding arccos_def by (rule theI' [OF cos_total]) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4593 |
|
| 63558 | 4594 |
lemma cos_arccos [simp]: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> cos (arccos y) = y" |
| 53079 | 4595 |
by (blast dest: arccos) |
| 41970 | 4596 |
|
| 63558 | 4597 |
lemma arccos_bounded: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi" |
| 53079 | 4598 |
by (blast dest: arccos) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4599 |
|
| 63558 | 4600 |
lemma arccos_lbound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y" |
| 53079 | 4601 |
by (blast dest: arccos) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4602 |
|
| 63558 | 4603 |
lemma arccos_ubound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y \<le> pi" |
| 53079 | 4604 |
by (blast dest: arccos) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4605 |
|
| 63558 | 4606 |
lemma arccos_lt_bounded: "- 1 < y \<Longrightarrow> y < 1 \<Longrightarrow> 0 < arccos y \<and> arccos y < pi" |
| 53079 | 4607 |
apply (frule order_less_imp_le) |
4608 |
apply (frule_tac y = y in order_less_imp_le) |
|
| 63558 | 4609 |
apply (frule arccos_bounded) |
4610 |
apply auto |
|
4611 |
apply (drule_tac y = "arccos y" in order_le_imp_less_or_eq) |
|
4612 |
apply (drule_tac [2] y = pi in order_le_imp_less_or_eq) |
|
4613 |
apply auto |
|
4614 |
apply (drule_tac [!] f = cos in arg_cong) |
|
4615 |
apply auto |
|
| 53079 | 4616 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4617 |
|
| 63558 | 4618 |
lemma arccos_cos: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> arccos (cos x) = x" |
4619 |
by (auto simp: arccos_def intro!: the1_equality cos_total) |
|
4620 |
||
4621 |
lemma arccos_cos2: "x \<le> 0 \<Longrightarrow> - pi \<le> x \<Longrightarrow> arccos (cos x) = -x" |
|
4622 |
by (auto simp: arccos_def intro!: the1_equality cos_total) |
|
4623 |
||
4624 |
lemma cos_arcsin: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> cos (arcsin x) = sqrt (1 - x\<^sup>2)" |
|
| 53079 | 4625 |
apply (subgoal_tac "x\<^sup>2 \<le> 1") |
| 63558 | 4626 |
apply (rule power2_eq_imp_eq) |
4627 |
apply (simp add: cos_squared_eq) |
|
4628 |
apply (rule cos_ge_zero) |
|
4629 |
apply (erule (1) arcsin_lbound) |
|
4630 |
apply (erule (1) arcsin_ubound) |
|
4631 |
apply simp |
|
4632 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 \<le> 1\<^sup>2") |
|
4633 |
apply simp |
|
4634 |
apply (rule power_mono) |
|
4635 |
apply simp |
|
| 53079 | 4636 |
apply simp |
4637 |
done |
|
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4638 |
|
| 63558 | 4639 |
lemma sin_arccos: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> sin (arccos x) = sqrt (1 - x\<^sup>2)" |
| 53079 | 4640 |
apply (subgoal_tac "x\<^sup>2 \<le> 1") |
| 63558 | 4641 |
apply (rule power2_eq_imp_eq) |
4642 |
apply (simp add: sin_squared_eq) |
|
4643 |
apply (rule sin_ge_zero) |
|
4644 |
apply (erule (1) arccos_lbound) |
|
4645 |
apply (erule (1) arccos_ubound) |
|
4646 |
apply simp |
|
4647 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 \<le> 1\<^sup>2") |
|
4648 |
apply simp |
|
4649 |
apply (rule power_mono) |
|
4650 |
apply simp |
|
| 53079 | 4651 |
apply simp |
4652 |
done |
|
4653 |
||
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4654 |
lemma arccos_0 [simp]: "arccos 0 = pi/2" |
| 63558 | 4655 |
by (metis arccos_cos cos_gt_zero cos_pi cos_pi_half pi_gt_zero |
4656 |
pi_half_ge_zero not_le not_zero_less_neg_numeral numeral_One) |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4657 |
|
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4658 |
lemma arccos_1 [simp]: "arccos 1 = 0" |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4659 |
using arccos_cos by force |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4660 |
|
| 63558 | 4661 |
lemma arccos_minus_1 [simp]: "arccos (- 1) = pi" |
| 59869 | 4662 |
by (metis arccos_cos cos_pi order_refl pi_ge_zero) |
4663 |
||
| 63558 | 4664 |
lemma arccos_minus: "-1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arccos (- x) = pi - arccos x" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4665 |
by (metis arccos_cos arccos_cos2 cos_minus_pi cos_total diff_le_0_iff_le le_add_same_cancel1 |
| 63558 | 4666 |
minus_diff_eq uminus_add_conv_diff) |
4667 |
||
4668 |
lemma sin_arccos_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> \<not> sin (arccos x) = 0" |
|
| 59869 | 4669 |
using arccos_lt_bounded sin_gt_zero by force |
4670 |
||
| 63558 | 4671 |
lemma arctan: "- (pi/2) < arctan y \<and> arctan y < pi/2 \<and> tan (arctan y) = y" |
| 53079 | 4672 |
unfolding arctan_def by (rule theI' [OF tan_total]) |
4673 |
||
4674 |
lemma tan_arctan: "tan (arctan y) = y" |
|
| 59869 | 4675 |
by (simp add: arctan) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4676 |
|
| 63558 | 4677 |
lemma arctan_bounded: "- (pi/2) < arctan y \<and> arctan y < pi/2" |
| 53079 | 4678 |
by (auto simp only: arctan) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4679 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4680 |
lemma arctan_lbound: "- (pi/2) < arctan y" |
| 59869 | 4681 |
by (simp add: arctan) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4682 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4683 |
lemma arctan_ubound: "arctan y < pi/2" |
| 53079 | 4684 |
by (auto simp only: arctan) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4685 |
|
| 44746 | 4686 |
lemma arctan_unique: |
| 53079 | 4687 |
assumes "-(pi/2) < x" |
4688 |
and "x < pi/2" |
|
4689 |
and "tan x = y" |
|
| 44746 | 4690 |
shows "arctan y = x" |
4691 |
using assms arctan [of y] tan_total [of y] by (fast elim: ex1E) |
|
4692 |
||
| 53079 | 4693 |
lemma arctan_tan: "-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> arctan (tan x) = x" |
4694 |
by (rule arctan_unique) simp_all |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4695 |
|
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4696 |
lemma arctan_zero_zero [simp]: "arctan 0 = 0" |
| 53079 | 4697 |
by (rule arctan_unique) simp_all |
| 44746 | 4698 |
|
4699 |
lemma arctan_minus: "arctan (- x) = - arctan x" |
|
4700 |
apply (rule arctan_unique) |
|
| 63558 | 4701 |
apply (simp only: neg_less_iff_less arctan_ubound) |
4702 |
apply (metis minus_less_iff arctan_lbound) |
|
4703 |
apply (simp add: arctan) |
|
| 44746 | 4704 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4705 |
|
| 44725 | 4706 |
lemma cos_arctan_not_zero [simp]: "cos (arctan x) \<noteq> 0" |
| 63558 | 4707 |
by (intro less_imp_neq [symmetric] cos_gt_zero_pi arctan_lbound arctan_ubound) |
| 44725 | 4708 |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4709 |
lemma cos_arctan: "cos (arctan x) = 1 / sqrt (1 + x\<^sup>2)" |
| 44725 | 4710 |
proof (rule power2_eq_imp_eq) |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4711 |
have "0 < 1 + x\<^sup>2" by (simp add: add_pos_nonneg) |
|
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4712 |
show "0 \<le> 1 / sqrt (1 + x\<^sup>2)" by simp |
| 44725 | 4713 |
show "0 \<le> cos (arctan x)" |
4714 |
by (intro less_imp_le cos_gt_zero_pi arctan_lbound arctan_ubound) |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4715 |
have "(cos (arctan x))\<^sup>2 * (1 + (tan (arctan x))\<^sup>2) = 1" |
|
49962
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
webertj
parents:
47489
diff
changeset
|
4716 |
unfolding tan_def by (simp add: distrib_left power_divide) |
| 63558 | 4717 |
then show "(cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2" |
| 60758 | 4718 |
using \<open>0 < 1 + x\<^sup>2\<close> by (simp add: arctan power_divide eq_divide_eq) |
| 44725 | 4719 |
qed |
4720 |
||
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4721 |
lemma sin_arctan: "sin (arctan x) = x / sqrt (1 + x\<^sup>2)" |
| 44725 | 4722 |
using add_pos_nonneg [OF zero_less_one zero_le_power2 [of x]] |
4723 |
using tan_arctan [of x] unfolding tan_def cos_arctan |
|
4724 |
by (simp add: eq_divide_eq) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4725 |
|
| 63558 | 4726 |
lemma tan_sec: "cos x \<noteq> 0 \<Longrightarrow> 1 + (tan x)\<^sup>2 = (inverse (cos x))\<^sup>2" |
4727 |
for x :: "'a::{real_normed_field,banach,field}"
|
|
| 53079 | 4728 |
apply (rule power_inverse [THEN subst]) |
|
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
56213
diff
changeset
|
4729 |
apply (rule_tac c1 = "(cos x)\<^sup>2" in mult_right_cancel [THEN iffD1]) |
| 63558 | 4730 |
apply (auto simp add: tan_def field_simps) |
| 53079 | 4731 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4732 |
|
| 44746 | 4733 |
lemma arctan_less_iff: "arctan x < arctan y \<longleftrightarrow> x < y" |
4734 |
by (metis tan_monotone' arctan_lbound arctan_ubound tan_arctan) |
|
4735 |
||
4736 |
lemma arctan_le_iff: "arctan x \<le> arctan y \<longleftrightarrow> x \<le> y" |
|
4737 |
by (simp only: not_less [symmetric] arctan_less_iff) |
|
4738 |
||
4739 |
lemma arctan_eq_iff: "arctan x = arctan y \<longleftrightarrow> x = y" |
|
4740 |
by (simp only: eq_iff [where 'a=real] arctan_le_iff) |
|
4741 |
||
4742 |
lemma zero_less_arctan_iff [simp]: "0 < arctan x \<longleftrightarrow> 0 < x" |
|
4743 |
using arctan_less_iff [of 0 x] by simp |
|
4744 |
||
4745 |
lemma arctan_less_zero_iff [simp]: "arctan x < 0 \<longleftrightarrow> x < 0" |
|
4746 |
using arctan_less_iff [of x 0] by simp |
|
4747 |
||
4748 |
lemma zero_le_arctan_iff [simp]: "0 \<le> arctan x \<longleftrightarrow> 0 \<le> x" |
|
4749 |
using arctan_le_iff [of 0 x] by simp |
|
4750 |
||
4751 |
lemma arctan_le_zero_iff [simp]: "arctan x \<le> 0 \<longleftrightarrow> x \<le> 0" |
|
4752 |
using arctan_le_iff [of x 0] by simp |
|
4753 |
||
4754 |
lemma arctan_eq_zero_iff [simp]: "arctan x = 0 \<longleftrightarrow> x = 0" |
|
4755 |
using arctan_eq_iff [of x 0] by simp |
|
4756 |
||
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4757 |
lemma continuous_on_arcsin': "continuous_on {-1 .. 1} arcsin"
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4758 |
proof - |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4759 |
have "continuous_on (sin ` {- pi / 2 .. pi / 2}) arcsin"
|
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
4760 |
by (rule continuous_on_inv) (auto intro: continuous_intros simp: arcsin_sin) |
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4761 |
also have "sin ` {- pi / 2 .. pi / 2} = {-1 .. 1}"
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4762 |
proof safe |
| 53079 | 4763 |
fix x :: real |
4764 |
assume "x \<in> {-1..1}"
|
|
4765 |
then show "x \<in> sin ` {- pi / 2..pi / 2}"
|
|
4766 |
using arcsin_lbound arcsin_ubound |
|
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56409
diff
changeset
|
4767 |
by (intro image_eqI[where x="arcsin x"]) auto |
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4768 |
qed simp |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4769 |
finally show ?thesis . |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4770 |
qed |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4771 |
|
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
4772 |
lemma continuous_on_arcsin [continuous_intros]: |
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4773 |
"continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. -1 \<le> f x \<and> f x \<le> 1) \<Longrightarrow> continuous_on s (\<lambda>x. arcsin (f x))" |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4774 |
using continuous_on_compose[of s f, OF _ continuous_on_subset[OF continuous_on_arcsin']] |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4775 |
by (auto simp: comp_def subset_eq) |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4776 |
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4777 |
lemma isCont_arcsin: "-1 < x \<Longrightarrow> x < 1 \<Longrightarrow> isCont arcsin x" |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4778 |
using continuous_on_arcsin'[THEN continuous_on_subset, of "{ -1 <..< 1 }"]
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4779 |
by (auto simp: continuous_on_eq_continuous_at subset_eq) |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4780 |
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4781 |
lemma continuous_on_arccos': "continuous_on {-1 .. 1} arccos"
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4782 |
proof - |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4783 |
have "continuous_on (cos ` {0 .. pi}) arccos"
|
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
4784 |
by (rule continuous_on_inv) (auto intro: continuous_intros simp: arccos_cos) |
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4785 |
also have "cos ` {0 .. pi} = {-1 .. 1}"
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4786 |
proof safe |
| 53079 | 4787 |
fix x :: real |
4788 |
assume "x \<in> {-1..1}"
|
|
4789 |
then show "x \<in> cos ` {0..pi}"
|
|
4790 |
using arccos_lbound arccos_ubound |
|
4791 |
by (intro image_eqI[where x="arccos x"]) auto |
|
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4792 |
qed simp |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4793 |
finally show ?thesis . |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4794 |
qed |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4795 |
|
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
4796 |
lemma continuous_on_arccos [continuous_intros]: |
|
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4797 |
"continuous_on s f \<Longrightarrow> (\<forall>x\<in>s. -1 \<le> f x \<and> f x \<le> 1) \<Longrightarrow> continuous_on s (\<lambda>x. arccos (f x))" |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4798 |
using continuous_on_compose[of s f, OF _ continuous_on_subset[OF continuous_on_arccos']] |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4799 |
by (auto simp: comp_def subset_eq) |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4800 |
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4801 |
lemma isCont_arccos: "-1 < x \<Longrightarrow> x < 1 \<Longrightarrow> isCont arccos x" |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4802 |
using continuous_on_arccos'[THEN continuous_on_subset, of "{ -1 <..< 1 }"]
|
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
4803 |
by (auto simp: continuous_on_eq_continuous_at subset_eq) |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4804 |
|
|
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4805 |
lemma isCont_arctan: "isCont arctan x" |
| 63558 | 4806 |
apply (rule arctan_lbound [of x, THEN dense, THEN exE]) |
4807 |
apply clarify |
|
4808 |
apply (rule arctan_ubound [of x, THEN dense, THEN exE]) |
|
4809 |
apply clarify |
|
4810 |
apply (subgoal_tac "isCont arctan (tan (arctan x))") |
|
4811 |
apply (simp add: arctan) |
|
| 53079 | 4812 |
apply (erule (1) isCont_inverse_function2 [where f=tan]) |
| 63558 | 4813 |
apply (metis arctan_tan order_le_less_trans order_less_le_trans) |
| 53079 | 4814 |
apply (metis cos_gt_zero_pi isCont_tan order_less_le_trans less_le) |
4815 |
done |
|
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4816 |
|
| 61973 | 4817 |
lemma tendsto_arctan [tendsto_intros]: "(f \<longlongrightarrow> x) F \<Longrightarrow> ((\<lambda>x. arctan (f x)) \<longlongrightarrow> arctan x) F" |
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4818 |
by (rule isCont_tendsto_compose [OF isCont_arctan]) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4819 |
|
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4820 |
lemma continuous_arctan [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. arctan (f x))" |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4821 |
unfolding continuous_def by (rule tendsto_arctan) |
|
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4822 |
|
| 63558 | 4823 |
lemma continuous_on_arctan [continuous_intros]: |
4824 |
"continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. arctan (f x))" |
|
|
51478
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents:
51477
diff
changeset
|
4825 |
unfolding continuous_on_def by (auto intro: tendsto_arctan) |
| 53079 | 4826 |
|
| 63558 | 4827 |
lemma DERIV_arcsin: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> DERIV arcsin x :> inverse (sqrt (1 - x\<^sup>2))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4828 |
apply (rule DERIV_inverse_function [where f=sin and a="-1" and b=1]) |
| 63558 | 4829 |
apply (rule DERIV_cong [OF DERIV_sin]) |
4830 |
apply (simp add: cos_arcsin) |
|
4831 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 < 1\<^sup>2") |
|
4832 |
apply simp |
|
4833 |
apply (rule power_strict_mono) |
|
4834 |
apply simp |
|
4835 |
apply simp |
|
4836 |
apply simp |
|
4837 |
apply assumption |
|
4838 |
apply assumption |
|
4839 |
apply simp |
|
| 53079 | 4840 |
apply (erule (1) isCont_arcsin) |
4841 |
done |
|
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4842 |
|
| 63558 | 4843 |
lemma DERIV_arccos: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> DERIV arccos x :> inverse (- sqrt (1 - x\<^sup>2))" |
|
59658
0cc388370041
sin, cos generalised from type real to any "'a::{real_normed_field,banach}", including complex
paulson <lp15@cam.ac.uk>
parents:
59647
diff
changeset
|
4844 |
apply (rule DERIV_inverse_function [where f=cos and a="-1" and b=1]) |
| 63558 | 4845 |
apply (rule DERIV_cong [OF DERIV_cos]) |
4846 |
apply (simp add: sin_arccos) |
|
4847 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 < 1\<^sup>2") |
|
4848 |
apply simp |
|
4849 |
apply (rule power_strict_mono) |
|
4850 |
apply simp |
|
4851 |
apply simp |
|
4852 |
apply simp |
|
4853 |
apply assumption |
|
4854 |
apply assumption |
|
4855 |
apply simp |
|
| 53079 | 4856 |
apply (erule (1) isCont_arccos) |
4857 |
done |
|
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4858 |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4859 |
lemma DERIV_arctan: "DERIV arctan x :> inverse (1 + x\<^sup>2)" |
| 53079 | 4860 |
apply (rule DERIV_inverse_function [where f=tan and a="x - 1" and b="x + 1"]) |
| 63558 | 4861 |
apply (rule DERIV_cong [OF DERIV_tan]) |
4862 |
apply (rule cos_arctan_not_zero) |
|
4863 |
apply (simp_all add: add_pos_nonneg arctan isCont_arctan) |
|
4864 |
apply (simp add: arctan power_inverse [symmetric] tan_sec [symmetric]) |
|
4865 |
apply (subgoal_tac "0 < 1 + x\<^sup>2") |
|
4866 |
apply simp |
|
| 59869 | 4867 |
apply (simp_all add: add_pos_nonneg arctan isCont_arctan) |
| 53079 | 4868 |
done |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4869 |
|
| 31880 | 4870 |
declare |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
4871 |
DERIV_arcsin[THEN DERIV_chain2, derivative_intros] |
|
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
4872 |
DERIV_arcsin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
4873 |
DERIV_arccos[THEN DERIV_chain2, derivative_intros] |
|
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
4874 |
DERIV_arccos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
4875 |
DERIV_arctan[THEN DERIV_chain2, derivative_intros] |
|
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
4876 |
DERIV_arctan[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
| 31880 | 4877 |
|
|
61881
b4bfa62e799d
Transcendental: use [simp]-canonical form - (pi/2)
hoelzl
parents:
61810
diff
changeset
|
4878 |
lemma filterlim_tan_at_right: "filterlim tan at_bot (at_right (- (pi/2)))" |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4879 |
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]) |
| 59869 | 4880 |
(auto simp: arctan le_less eventually_at dist_real_def simp del: less_divide_eq_numeral1 |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4881 |
intro!: tan_monotone exI[of _ "pi/2"]) |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4882 |
|
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4883 |
lemma filterlim_tan_at_left: "filterlim tan at_top (at_left (pi/2))" |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4884 |
by (rule filterlim_at_top_at_left[where Q="\<lambda>x. - pi/2 < x \<and> x < pi/2" and P="\<lambda>x. True" and g=arctan]) |
| 59869 | 4885 |
(auto simp: arctan le_less eventually_at dist_real_def simp del: less_divide_eq_numeral1 |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4886 |
intro!: tan_monotone exI[of _ "pi/2"]) |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4887 |
|
| 61973 | 4888 |
lemma tendsto_arctan_at_top: "(arctan \<longlongrightarrow> (pi/2)) at_top" |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4889 |
proof (rule tendstoI) |
| 53079 | 4890 |
fix e :: real |
4891 |
assume "0 < e" |
|
| 63040 | 4892 |
define y where "y = pi/2 - min (pi/2) e" |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4893 |
then have y: "0 \<le> y" "y < pi/2" "pi/2 \<le> e + y" |
| 60758 | 4894 |
using \<open>0 < e\<close> by auto |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4895 |
show "eventually (\<lambda>x. dist (arctan x) (pi / 2) < e) at_top" |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4896 |
proof (intro eventually_at_top_dense[THEN iffD2] exI allI impI) |
| 53079 | 4897 |
fix x |
4898 |
assume "tan y < x" |
|
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4899 |
then have "arctan (tan y) < arctan x" |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4900 |
by (simp add: arctan_less_iff) |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4901 |
with y have "y < arctan x" |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4902 |
by (subst (asm) arctan_tan) simp_all |
| 60758 | 4903 |
with arctan_ubound[of x, arith] y \<open>0 < e\<close> |
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4904 |
show "dist (arctan x) (pi / 2) < e" |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4905 |
by (simp add: dist_real_def) |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4906 |
qed |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4907 |
qed |
|
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4908 |
|
| 61973 | 4909 |
lemma tendsto_arctan_at_bot: "(arctan \<longlongrightarrow> - (pi/2)) at_bot" |
| 53079 | 4910 |
unfolding filterlim_at_bot_mirror arctan_minus |
4911 |
by (intro tendsto_minus tendsto_arctan_at_top) |
|
4912 |
||
|
50346
a75c6429c3c3
add filterlim rules for eventually monotone bijective functions; mirror rules for at_top, at_bot; apply them to prove convergence of arctan at infinity and tan at pi/2
hoelzl
parents:
50326
diff
changeset
|
4913 |
|
| 63558 | 4914 |
subsection \<open>Prove Totality of the Trigonometric Functions\<close> |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4915 |
|
| 59869 | 4916 |
lemma cos_arccos_abs: "\<bar>y\<bar> \<le> 1 \<Longrightarrow> cos (arccos y) = y" |
4917 |
by (simp add: abs_le_iff) |
|
4918 |
||
4919 |
lemma sin_arccos_abs: "\<bar>y\<bar> \<le> 1 \<Longrightarrow> sin (arccos y) = sqrt (1 - y\<^sup>2)" |
|
4920 |
by (simp add: sin_arccos abs_le_iff) |
|
4921 |
||
| 63558 | 4922 |
lemma sin_mono_less_eq: |
4923 |
"- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> - (pi/2) \<le> y \<Longrightarrow> y \<le> pi/2 \<Longrightarrow> sin x < sin y \<longleftrightarrow> x < y" |
|
4924 |
by (metis not_less_iff_gr_or_eq sin_monotone_2pi) |
|
4925 |
||
4926 |
lemma sin_mono_le_eq: |
|
4927 |
"- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> - (pi/2) \<le> y \<Longrightarrow> y \<le> pi/2 \<Longrightarrow> sin x \<le> sin y \<longleftrightarrow> x \<le> y" |
|
4928 |
by (meson leD le_less_linear sin_monotone_2pi sin_monotone_2pi_le) |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4929 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4930 |
lemma sin_inj_pi: |
| 63558 | 4931 |
"- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> - (pi/2) \<le> y \<Longrightarrow> y \<le> pi/2 \<Longrightarrow> sin x = sin y \<Longrightarrow> x = y" |
4932 |
by (metis arcsin_sin) |
|
4933 |
||
4934 |
lemma cos_mono_less_eq: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> 0 \<le> y \<Longrightarrow> y \<le> pi \<Longrightarrow> cos x < cos y \<longleftrightarrow> y < x" |
|
4935 |
by (meson cos_monotone_0_pi cos_monotone_0_pi_le leD le_less_linear) |
|
4936 |
||
4937 |
lemma cos_mono_le_eq: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> 0 \<le> y \<Longrightarrow> y \<le> pi \<Longrightarrow> cos x \<le> cos y \<longleftrightarrow> y \<le> x" |
|
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4938 |
by (metis arccos_cos cos_monotone_0_pi_le eq_iff linear) |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4939 |
|
| 63558 | 4940 |
lemma cos_inj_pi: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> 0 \<le> y \<Longrightarrow> y \<le> pi \<Longrightarrow> cos x = cos y \<Longrightarrow> x = y" |
4941 |
by (metis arccos_cos) |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4942 |
|
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4943 |
lemma arccos_le_pi2: "\<lbrakk>0 \<le> y; y \<le> 1\<rbrakk> \<Longrightarrow> arccos y \<le> pi/2" |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4944 |
by (metis (mono_tags) arccos_0 arccos cos_le_one cos_monotone_0_pi_le |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4945 |
cos_pi cos_pi_half pi_half_ge_zero antisym_conv less_eq_neg_nonpos linear minus_minus order.trans order_refl) |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4946 |
|
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4947 |
lemma sincos_total_pi_half: |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4948 |
assumes "0 \<le> x" "0 \<le> y" "x\<^sup>2 + y\<^sup>2 = 1" |
| 63558 | 4949 |
shows "\<exists>t. 0 \<le> t \<and> t \<le> pi/2 \<and> x = cos t \<and> y = sin t" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4950 |
proof - |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4951 |
have x1: "x \<le> 1" |
| 63558 | 4952 |
using assms by (metis le_add_same_cancel1 power2_le_imp_le power_one zero_le_power2) |
4953 |
with assms have *: "0 \<le> arccos x" "cos (arccos x) = x" |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4954 |
by (auto simp: arccos) |
| 63540 | 4955 |
from assms have "y = sqrt (1 - x\<^sup>2)" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4956 |
by (metis abs_of_nonneg add.commute add_diff_cancel real_sqrt_abs) |
| 63558 | 4957 |
with x1 * assms arccos_le_pi2 [of x] show ?thesis |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4958 |
by (rule_tac x="arccos x" in exI) (auto simp: sin_arccos) |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4959 |
qed |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4960 |
|
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4961 |
lemma sincos_total_pi: |
| 63558 | 4962 |
assumes "0 \<le> y" "x\<^sup>2 + y\<^sup>2 = 1" |
4963 |
shows "\<exists>t. 0 \<le> t \<and> t \<le> pi \<and> x = cos t \<and> y = sin t" |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4964 |
proof (cases rule: le_cases [of 0 x]) |
| 63558 | 4965 |
case le |
4966 |
from sincos_total_pi_half [OF le] show ?thesis |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4967 |
by (metis pi_ge_two pi_half_le_two add.commute add_le_cancel_left add_mono assms) |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4968 |
next |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4969 |
case ge |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4970 |
then have "0 \<le> -x" |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4971 |
by simp |
| 63558 | 4972 |
then obtain t where t: "t\<ge>0" "t \<le> pi/2" "-x = cos t" "y = sin t" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4973 |
using sincos_total_pi_half assms |
| 63558 | 4974 |
by auto (metis \<open>0 \<le> - x\<close> power2_minus) |
4975 |
show ?thesis |
|
4976 |
by (rule exI [where x = "pi -t"]) (use t in auto) |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4977 |
qed |
|
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4978 |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4979 |
lemma sincos_total_2pi_le: |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4980 |
assumes "x\<^sup>2 + y\<^sup>2 = 1" |
| 63558 | 4981 |
shows "\<exists>t. 0 \<le> t \<and> t \<le> 2 * pi \<and> x = cos t \<and> y = sin t" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4982 |
proof (cases rule: le_cases [of 0 y]) |
| 63558 | 4983 |
case le |
4984 |
from sincos_total_pi [OF le] show ?thesis |
|
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4985 |
by (metis assms le_add_same_cancel1 mult.commute mult_2_right order.trans) |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4986 |
next |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4987 |
case ge |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4988 |
then have "0 \<le> -y" |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4989 |
by simp |
| 63558 | 4990 |
then obtain t where t: "t\<ge>0" "t \<le> pi" "x = cos t" "-y = sin t" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4991 |
using sincos_total_pi assms |
| 63558 | 4992 |
by auto (metis \<open>0 \<le> - y\<close> power2_minus) |
4993 |
show ?thesis |
|
4994 |
by (rule exI [where x = "2 * pi - t"]) (use t in auto) |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
4995 |
qed |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4996 |
|
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4997 |
lemma sincos_total_2pi: |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
4998 |
assumes "x\<^sup>2 + y\<^sup>2 = 1" |
| 63558 | 4999 |
obtains t where "0 \<le> t" "t < 2*pi" "x = cos t" "y = sin t" |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5000 |
proof - |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5001 |
from sincos_total_2pi_le [OF assms] |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5002 |
obtain t where t: "0 \<le> t" "t \<le> 2*pi" "x = cos t" "y = sin t" |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5003 |
by blast |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5004 |
show ?thesis |
| 63558 | 5005 |
by (cases "t = 2 * pi") (use t that in \<open>force+\<close>) |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5006 |
qed |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5007 |
|
| 61944 | 5008 |
lemma arcsin_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arcsin x < arcsin y \<longleftrightarrow> x < y" |
| 63558 | 5009 |
by (rule trans [OF sin_mono_less_eq [symmetric]]) (use arcsin_ubound arcsin_lbound in auto) |
| 59869 | 5010 |
|
| 61944 | 5011 |
lemma arcsin_le_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arcsin x \<le> arcsin y \<longleftrightarrow> x \<le> y" |
| 59869 | 5012 |
using arcsin_less_mono not_le by blast |
5013 |
||
| 63558 | 5014 |
lemma arcsin_less_arcsin: "- 1 \<le> x \<Longrightarrow> x < y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin x < arcsin y" |
| 59869 | 5015 |
using arcsin_less_mono by auto |
5016 |
||
| 63558 | 5017 |
lemma arcsin_le_arcsin: "- 1 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin x \<le> arcsin y" |
| 59869 | 5018 |
using arcsin_le_mono by auto |
5019 |
||
| 63558 | 5020 |
lemma arccos_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x < arccos y \<longleftrightarrow> y < x" |
5021 |
by (rule trans [OF cos_mono_less_eq [symmetric]]) (use arccos_ubound arccos_lbound in auto) |
|
| 59869 | 5022 |
|
| 61944 | 5023 |
lemma arccos_le_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x \<le> arccos y \<longleftrightarrow> y \<le> x" |
| 63558 | 5024 |
using arccos_less_mono [of y x] by (simp add: not_le [symmetric]) |
5025 |
||
5026 |
lemma arccos_less_arccos: "- 1 \<le> x \<Longrightarrow> x < y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y < arccos x" |
|
| 59869 | 5027 |
using arccos_less_mono by auto |
5028 |
||
| 63558 | 5029 |
lemma arccos_le_arccos: "- 1 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y \<le> arccos x" |
| 59869 | 5030 |
using arccos_le_mono by auto |
5031 |
||
| 63558 | 5032 |
lemma arccos_eq_iff: "\<bar>x\<bar> \<le> 1 \<and> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x = arccos y \<longleftrightarrow> x = y" |
| 59869 | 5033 |
using cos_arccos_abs by fastforce |
5034 |
||
| 63558 | 5035 |
|
5036 |
subsection \<open>Machin's formula\<close> |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5037 |
|
| 44746 | 5038 |
lemma arctan_one: "arctan 1 = pi / 4" |
| 63558 | 5039 |
by (rule arctan_unique) (simp_all add: tan_45 m2pi_less_pi) |
| 44746 | 5040 |
|
| 53079 | 5041 |
lemma tan_total_pi4: |
5042 |
assumes "\<bar>x\<bar> < 1" |
|
5043 |
shows "\<exists>z. - (pi / 4) < z \<and> z < pi / 4 \<and> tan z = x" |
|
| 44746 | 5044 |
proof |
5045 |
show "- (pi / 4) < arctan x \<and> arctan x < pi / 4 \<and> tan (arctan x) = x" |
|
5046 |
unfolding arctan_one [symmetric] arctan_minus [symmetric] |
|
| 63558 | 5047 |
unfolding arctan_less_iff |
5048 |
using assms by (auto simp add: arctan) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5049 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5050 |
|
| 53079 | 5051 |
lemma arctan_add: |
| 63558 | 5052 |
assumes "\<bar>x\<bar> \<le> 1" "\<bar>y\<bar> < 1" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5053 |
shows "arctan x + arctan y = arctan ((x + y) / (1 - x * y))" |
| 44746 | 5054 |
proof (rule arctan_unique [symmetric]) |
| 63558 | 5055 |
have "- (pi / 4) \<le> arctan x" "- (pi / 4) < arctan y" |
| 44746 | 5056 |
unfolding arctan_one [symmetric] arctan_minus [symmetric] |
| 63558 | 5057 |
unfolding arctan_le_iff arctan_less_iff |
5058 |
using assms by auto |
|
5059 |
from add_le_less_mono [OF this] show 1: "- (pi / 2) < arctan x + arctan y" |
|
5060 |
by simp |
|
5061 |
have "arctan x \<le> pi / 4" "arctan y < pi / 4" |
|
| 44746 | 5062 |
unfolding arctan_one [symmetric] |
| 63558 | 5063 |
unfolding arctan_le_iff arctan_less_iff |
5064 |
using assms by auto |
|
5065 |
from add_le_less_mono [OF this] show 2: "arctan x + arctan y < pi / 2" |
|
5066 |
by simp |
|
| 44746 | 5067 |
show "tan (arctan x + arctan y) = (x + y) / (1 - x * y)" |
| 59869 | 5068 |
using cos_gt_zero_pi [OF 1 2] by (simp add: arctan tan_add) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5069 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5070 |
|
| 63558 | 5071 |
lemma arctan_double: "\<bar>x\<bar> < 1 \<Longrightarrow> 2 * arctan x = arctan ((2 * x) / (1 - x\<^sup>2))" |
5072 |
by (metis arctan_add linear mult_2 not_less power2_eq_square) |
|
5073 |
||
5074 |
theorem machin: "pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5075 |
proof - |
| 63558 | 5076 |
have "\<bar>1 / 5\<bar> < (1 :: real)" |
5077 |
by auto |
|
5078 |
from arctan_add[OF less_imp_le[OF this] this] have "2 * arctan (1 / 5) = arctan (5 / 12)" |
|
5079 |
by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5080 |
moreover |
| 63558 | 5081 |
have "\<bar>5 / 12\<bar> < (1 :: real)" |
5082 |
by auto |
|
5083 |
from arctan_add[OF less_imp_le[OF this] this] have "2 * arctan (5 / 12) = arctan (120 / 119)" |
|
5084 |
by auto |
|
| 41970 | 5085 |
moreover |
| 63558 | 5086 |
have "\<bar>1\<bar> \<le> (1::real)" and "\<bar>1 / 239\<bar> < (1::real)" |
5087 |
by auto |
|
5088 |
from arctan_add[OF this] have "arctan 1 + arctan (1 / 239) = arctan (120 / 119)" |
|
5089 |
by auto |
|
5090 |
ultimately have "arctan 1 + arctan (1 / 239) = 4 * arctan (1 / 5)" |
|
5091 |
by auto |
|
5092 |
then show ?thesis |
|
5093 |
unfolding arctan_one by algebra |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5094 |
qed |
| 44746 | 5095 |
|
| 63558 | 5096 |
lemma machin_Euler: "5 * arctan (1 / 7) + 2 * arctan (3 / 79) = pi / 4" |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5097 |
proof - |
| 63558 | 5098 |
have 17: "\<bar>1 / 7\<bar> < (1 :: real)" by auto |
5099 |
with arctan_double have "2 * arctan (1 / 7) = arctan (7 / 24)" |
|
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
5100 |
by simp (simp add: field_simps) |
| 63558 | 5101 |
moreover |
5102 |
have "\<bar>7 / 24\<bar> < (1 :: real)" by auto |
|
5103 |
with arctan_double have "2 * arctan (7 / 24) = arctan (336 / 527)" |
|
5104 |
by simp (simp add: field_simps) |
|
5105 |
moreover |
|
5106 |
have "\<bar>336 / 527\<bar> < (1 :: real)" by auto |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5107 |
from arctan_add[OF less_imp_le[OF 17] this] |
| 63558 | 5108 |
have "arctan(1/7) + arctan (336 / 527) = arctan (2879 / 3353)" |
5109 |
by auto |
|
5110 |
ultimately have I: "5 * arctan (1 / 7) = arctan (2879 / 3353)" by auto |
|
5111 |
have 379: "\<bar>3 / 79\<bar> < (1 :: real)" by auto |
|
5112 |
with arctan_double have II: "2 * arctan (3 / 79) = arctan (237 / 3116)" |
|
5113 |
by simp (simp add: field_simps) |
|
5114 |
have *: "\<bar>2879 / 3353\<bar> < (1 :: real)" by auto |
|
5115 |
have "\<bar>237 / 3116\<bar> < (1 :: real)" by auto |
|
5116 |
from arctan_add[OF less_imp_le[OF *] this] have "arctan (2879/3353) + arctan (237/3116) = pi/4" |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5117 |
by (simp add: arctan_one) |
| 63558 | 5118 |
with I II show ?thesis by auto |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5119 |
qed |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5120 |
|
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5121 |
(*But could also prove MACHIN_GAUSS: |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5122 |
12 * arctan(1/18) + 8 * arctan(1/57) - 5 * arctan(1/239) = pi/4*) |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5123 |
|
| 53079 | 5124 |
|
| 60758 | 5125 |
subsection \<open>Introducing the inverse tangent power series\<close> |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5126 |
|
| 53079 | 5127 |
lemma monoseq_arctan_series: |
5128 |
fixes x :: real |
|
5129 |
assumes "\<bar>x\<bar> \<le> 1" |
|
| 63558 | 5130 |
shows "monoseq (\<lambda>n. 1 / real (n * 2 + 1) * x^(n * 2 + 1))" |
5131 |
(is "monoseq ?a") |
|
| 53079 | 5132 |
proof (cases "x = 0") |
5133 |
case True |
|
| 63558 | 5134 |
then show ?thesis by (auto simp: monoseq_def) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5135 |
next |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5136 |
case False |
| 63558 | 5137 |
have "norm x \<le> 1" and "x \<le> 1" and "-1 \<le> x" |
5138 |
using assms by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5139 |
show "monoseq ?a" |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5140 |
proof - |
| 63558 | 5141 |
have mono: "1 / real (Suc (Suc n * 2)) * x ^ Suc (Suc n * 2) \<le> |
| 53079 | 5142 |
1 / real (Suc (n * 2)) * x ^ Suc (n * 2)" |
| 63558 | 5143 |
if "0 \<le> x" and "x \<le> 1" for n and x :: real |
5144 |
proof (rule mult_mono) |
|
5145 |
show "1 / real (Suc (Suc n * 2)) \<le> 1 / real (Suc (n * 2))" |
|
5146 |
by (rule frac_le) simp_all |
|
5147 |
show "0 \<le> 1 / real (Suc (n * 2))" |
|
5148 |
by auto |
|
5149 |
show "x ^ Suc (Suc n * 2) \<le> x ^ Suc (n * 2)" |
|
5150 |
by (rule power_decreasing) (simp_all add: \<open>0 \<le> x\<close> \<open>x \<le> 1\<close>) |
|
5151 |
show "0 \<le> x ^ Suc (Suc n * 2)" |
|
5152 |
by (rule zero_le_power) (simp add: \<open>0 \<le> x\<close>) |
|
5153 |
qed |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5154 |
show ?thesis |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5155 |
proof (cases "0 \<le> x") |
| 63558 | 5156 |
case True |
5157 |
from mono[OF this \<open>x \<le> 1\<close>, THEN allI] |
|
5158 |
show ?thesis |
|
5159 |
unfolding Suc_eq_plus1[symmetric] by (rule mono_SucI2) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5160 |
next |
| 53079 | 5161 |
case False |
| 63558 | 5162 |
then have "0 \<le> - x" and "- x \<le> 1" |
5163 |
using \<open>-1 \<le> x\<close> by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5164 |
from mono[OF this] |
| 63558 | 5165 |
have "1 / real (Suc (Suc n * 2)) * x ^ Suc (Suc n * 2) \<ge> |
5166 |
1 / real (Suc (n * 2)) * x ^ Suc (n * 2)" for n |
|
5167 |
using \<open>0 \<le> -x\<close> by auto |
|
5168 |
then show ?thesis |
|
5169 |
unfolding Suc_eq_plus1[symmetric] by (rule mono_SucI1[OF allI]) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5170 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5171 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5172 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5173 |
|
| 53079 | 5174 |
lemma zeroseq_arctan_series: |
5175 |
fixes x :: real |
|
5176 |
assumes "\<bar>x\<bar> \<le> 1" |
|
| 63558 | 5177 |
shows "(\<lambda>n. 1 / real (n * 2 + 1) * x^(n * 2 + 1)) \<longlonglongrightarrow> 0" |
5178 |
(is "?a \<longlonglongrightarrow> 0") |
|
| 53079 | 5179 |
proof (cases "x = 0") |
5180 |
case True |
|
| 63558 | 5181 |
then show ?thesis by simp |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5182 |
next |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5183 |
case False |
| 63558 | 5184 |
have "norm x \<le> 1" and "x \<le> 1" and "-1 \<le> x" |
5185 |
using assms by auto |
|
| 61969 | 5186 |
show "?a \<longlonglongrightarrow> 0" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5187 |
proof (cases "\<bar>x\<bar> < 1") |
| 53079 | 5188 |
case True |
| 63558 | 5189 |
then have "norm x < 1" by auto |
| 60758 | 5190 |
from tendsto_mult[OF LIMSEQ_inverse_real_of_nat LIMSEQ_power_zero[OF \<open>norm x < 1\<close>, THEN LIMSEQ_Suc]] |
| 61969 | 5191 |
have "(\<lambda>n. 1 / real (n + 1) * x ^ (n + 1)) \<longlonglongrightarrow> 0" |
| 31790 | 5192 |
unfolding inverse_eq_divide Suc_eq_plus1 by simp |
| 63558 | 5193 |
then show ?thesis |
5194 |
using pos2 by (rule LIMSEQ_linear) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5195 |
next |
| 53079 | 5196 |
case False |
| 63558 | 5197 |
then have "x = -1 \<or> x = 1" |
5198 |
using \<open>\<bar>x\<bar> \<le> 1\<close> by auto |
|
5199 |
then have n_eq: "\<And> n. x ^ (n * 2 + 1) = x" |
|
| 53079 | 5200 |
unfolding One_nat_def by auto |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44319
diff
changeset
|
5201 |
from tendsto_mult[OF LIMSEQ_inverse_real_of_nat[THEN LIMSEQ_linear, OF pos2, unfolded inverse_eq_divide] tendsto_const[of x]] |
| 63558 | 5202 |
show ?thesis |
5203 |
unfolding n_eq Suc_eq_plus1 by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5204 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5205 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5206 |
|
| 53079 | 5207 |
lemma summable_arctan_series: |
|
61694
6571c78c9667
Removed some legacy theorems; minor adjustments to simplification rules; new material on homotopic paths
paulson <lp15@cam.ac.uk>
parents:
61649
diff
changeset
|
5208 |
fixes n :: nat |
| 53079 | 5209 |
assumes "\<bar>x\<bar> \<le> 1" |
5210 |
shows "summable (\<lambda> k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1)))" |
|
| 63558 | 5211 |
(is "summable (?c x)") |
5212 |
by (rule summable_Leibniz(1), |
|
5213 |
rule zeroseq_arctan_series[OF assms], |
|
5214 |
rule monoseq_arctan_series[OF assms]) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5215 |
|
| 53079 | 5216 |
lemma DERIV_arctan_series: |
| 63558 | 5217 |
assumes "\<bar>x\<bar> < 1" |
5218 |
shows "DERIV (\<lambda>x'. \<Sum>k. (-1)^k * (1 / real (k * 2 + 1) * x' ^ (k * 2 + 1))) x :> |
|
5219 |
(\<Sum>k. (-1)^k * x^(k * 2))" |
|
5220 |
(is "DERIV ?arctan _ :> ?Int") |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5221 |
proof - |
| 53079 | 5222 |
let ?f = "\<lambda>n. if even n then (-1)^(n div 2) * 1 / real (Suc n) else 0" |
5223 |
||
| 63558 | 5224 |
have n_even: "even n \<Longrightarrow> 2 * (n div 2) = n" for n :: nat |
| 53079 | 5225 |
by presburger |
| 63558 | 5226 |
then have if_eq: "?f n * real (Suc n) * x'^n = |
5227 |
(if even n then (-1)^(n div 2) * x'^(2 * (n div 2)) else 0)" |
|
5228 |
for n x' |
|
| 53079 | 5229 |
by auto |
5230 |
||
| 63558 | 5231 |
have summable_Integral: "summable (\<lambda> n. (- 1) ^ n * x^(2 * n))" if "\<bar>x\<bar> < 1" for x :: real |
5232 |
proof - |
|
5233 |
from that have "x\<^sup>2 < 1" |
|
5234 |
by (simp add: abs_square_less_1) |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5235 |
have "summable (\<lambda> n. (- 1) ^ n * (x\<^sup>2) ^n)" |
| 63558 | 5236 |
by (rule summable_Leibniz(1)) |
5237 |
(auto intro!: LIMSEQ_realpow_zero monoseq_realpow \<open>x\<^sup>2 < 1\<close> order_less_imp_le[OF \<open>x\<^sup>2 < 1\<close>]) |
|
5238 |
then show ?thesis |
|
5239 |
by (simp only: power_mult) |
|
5240 |
qed |
|
5241 |
||
5242 |
have sums_even: "op sums f = op sums (\<lambda> n. if even n then f (n div 2) else 0)" |
|
5243 |
for f :: "nat \<Rightarrow> real" |
|
5244 |
proof - |
|
5245 |
have "f sums x = (\<lambda> n. if even n then f (n div 2) else 0) sums x" for x :: real |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5246 |
proof |
| 53079 | 5247 |
assume "f sums x" |
| 63558 | 5248 |
from sums_if[OF sums_zero this] show "(\<lambda>n. if even n then f (n div 2) else 0) sums x" |
| 53079 | 5249 |
by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5250 |
next |
| 53079 | 5251 |
assume "(\<lambda> n. if even n then f (n div 2) else 0) sums x" |
| 63170 | 5252 |
from LIMSEQ_linear[OF this[simplified sums_def] pos2, simplified sum_split_even_odd[simplified mult.commute]] |
| 63558 | 5253 |
show "f sums x" |
5254 |
unfolding sums_def by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5255 |
qed |
| 63558 | 5256 |
then show ?thesis .. |
5257 |
qed |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5258 |
|
| 53079 | 5259 |
have Int_eq: "(\<Sum>n. ?f n * real (Suc n) * x^n) = ?Int" |
| 63558 | 5260 |
unfolding if_eq mult.commute[of _ 2] |
5261 |
suminf_def sums_even[of "\<lambda> n. (- 1) ^ n * x ^ (2 * n)", symmetric] |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5262 |
by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5263 |
|
| 63558 | 5264 |
have arctan_eq: "(\<Sum>n. ?f n * x^(Suc n)) = ?arctan x" for x |
5265 |
proof - |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5266 |
have if_eq': "\<And>n. (if even n then (- 1) ^ (n div 2) * 1 / real (Suc n) else 0) * x ^ Suc n = |
|
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5267 |
(if even n then (- 1) ^ (n div 2) * (1 / real (Suc (2 * (n div 2))) * x ^ Suc (2 * (n div 2))) else 0)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5268 |
using n_even by auto |
| 63558 | 5269 |
have idx_eq: "\<And>n. n * 2 + 1 = Suc (2 * n)" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5270 |
by auto |
| 63558 | 5271 |
then show ?thesis |
5272 |
unfolding if_eq' idx_eq suminf_def |
|
5273 |
sums_even[of "\<lambda> n. (- 1) ^ n * (1 / real (Suc (2 * n)) * x ^ Suc (2 * n))", symmetric] |
|
5274 |
by auto |
|
5275 |
qed |
|
5276 |
||
5277 |
have "DERIV (\<lambda> x. \<Sum> n. ?f n * x^(Suc n)) x :> (\<Sum>n. ?f n * real (Suc n) * x^n)" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5278 |
proof (rule DERIV_power_series') |
| 63558 | 5279 |
show "x \<in> {- 1 <..< 1}"
|
5280 |
using \<open>\<bar> x \<bar> < 1\<close> by auto |
|
5281 |
show "summable (\<lambda> n. ?f n * real (Suc n) * x'^n)" |
|
5282 |
if x'_bounds: "x' \<in> {- 1 <..< 1}" for x' :: real
|
|
5283 |
proof - |
|
5284 |
from that have "\<bar>x'\<bar> < 1" by auto |
|
5285 |
then have *: "summable (\<lambda>n. (- 1) ^ n * x' ^ (2 * n))" |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5286 |
by (rule summable_Integral) |
| 63558 | 5287 |
show ?thesis |
5288 |
unfolding if_eq |
|
5289 |
apply (rule sums_summable [where l="0 + (\<Sum>n. (-1)^n * x'^(2 * n))"]) |
|
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5290 |
apply (rule sums_if) |
| 63558 | 5291 |
apply (rule sums_zero) |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5292 |
apply (rule summable_sums) |
|
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5293 |
apply (rule *) |
|
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5294 |
done |
| 63558 | 5295 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5296 |
qed auto |
| 63558 | 5297 |
then show ?thesis |
5298 |
by (simp only: Int_eq arctan_eq) |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5299 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5300 |
|
| 53079 | 5301 |
lemma arctan_series: |
| 63558 | 5302 |
assumes "\<bar>x\<bar> \<le> 1" |
5303 |
shows "arctan x = (\<Sum>k. (-1)^k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))" |
|
5304 |
(is "_ = suminf (\<lambda> n. ?c x n)") |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5305 |
proof - |
| 53079 | 5306 |
let ?c' = "\<lambda>x n. (-1)^n * x^(n*2)" |
5307 |
||
| 63558 | 5308 |
have DERIV_arctan_suminf: "DERIV (\<lambda> x. suminf (?c x)) x :> (suminf (?c' x))" |
5309 |
if "0 < r" and "r < 1" and "\<bar>x\<bar> < r" for r x :: real |
|
5310 |
proof (rule DERIV_arctan_series) |
|
5311 |
from that show "\<bar>x\<bar> < 1" |
|
5312 |
using \<open>r < 1\<close> and \<open>\<bar>x\<bar> < r\<close> by auto |
|
5313 |
qed |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5314 |
|
| 53079 | 5315 |
{
|
5316 |
fix x :: real |
|
5317 |
assume "\<bar>x\<bar> \<le> 1" |
|
5318 |
note summable_Leibniz[OF zeroseq_arctan_series[OF this] monoseq_arctan_series[OF this]] |
|
5319 |
} note arctan_series_borders = this |
|
5320 |
||
| 63558 | 5321 |
have when_less_one: "arctan x = (\<Sum>k. ?c x k)" if "\<bar>x\<bar> < 1" for x :: real |
5322 |
proof - |
|
5323 |
obtain r where "\<bar>x\<bar> < r" and "r < 1" |
|
5324 |
using dense[OF \<open>\<bar>x\<bar> < 1\<close>] by blast |
|
5325 |
then have "0 < r" and "- r < x" and "x < r" by auto |
|
5326 |
||
5327 |
have suminf_eq_arctan_bounded: "suminf (?c x) - arctan x = suminf (?c a) - arctan a" |
|
5328 |
if "-r < a" and "b < r" and "a < b" and "a \<le> x" and "x \<le> b" for x a b |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5329 |
proof - |
| 63558 | 5330 |
from that have "\<bar>x\<bar> < r" by auto |
5331 |
show "suminf (?c x) - arctan x = suminf (?c a) - arctan a" |
|
5332 |
proof (rule DERIV_isconst2[of "a" "b"]) |
|
5333 |
show "a < b" and "a \<le> x" and "x \<le> b" |
|
5334 |
using \<open>a < b\<close> \<open>a \<le> x\<close> \<open>x \<le> b\<close> by auto |
|
5335 |
have "\<forall>x. - r < x \<and> x < r \<longrightarrow> DERIV (\<lambda> x. suminf (?c x) - arctan x) x :> 0" |
|
5336 |
proof (rule allI, rule impI) |
|
5337 |
fix x |
|
5338 |
assume "-r < x \<and> x < r" |
|
5339 |
then have "\<bar>x\<bar> < r" by auto |
|
5340 |
with \<open>r < 1\<close> have "\<bar>x\<bar> < 1" by auto |
|
5341 |
have "\<bar>- (x\<^sup>2)\<bar> < 1" using abs_square_less_1 \<open>\<bar>x\<bar> < 1\<close> by auto |
|
5342 |
then have "(\<lambda>n. (- (x\<^sup>2)) ^ n) sums (1 / (1 - (- (x\<^sup>2))))" |
|
5343 |
unfolding real_norm_def[symmetric] by (rule geometric_sums) |
|
5344 |
then have "(?c' x) sums (1 / (1 - (- (x\<^sup>2))))" |
|
5345 |
unfolding power_mult_distrib[symmetric] power_mult mult.commute[of _ 2] by auto |
|
5346 |
then have suminf_c'_eq_geom: "inverse (1 + x\<^sup>2) = suminf (?c' x)" |
|
5347 |
using sums_unique unfolding inverse_eq_divide by auto |
|
5348 |
have "DERIV (\<lambda> x. suminf (?c x)) x :> (inverse (1 + x\<^sup>2))" |
|
5349 |
unfolding suminf_c'_eq_geom |
|
5350 |
by (rule DERIV_arctan_suminf[OF \<open>0 < r\<close> \<open>r < 1\<close> \<open>\<bar>x\<bar> < r\<close>]) |
|
5351 |
from DERIV_diff [OF this DERIV_arctan] show "DERIV (\<lambda>x. suminf (?c x) - arctan x) x :> 0" |
|
5352 |
by auto |
|
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5353 |
qed |
| 63558 | 5354 |
then have DERIV_in_rball: "\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> DERIV (\<lambda>x. suminf (?c x) - arctan x) y :> 0" |
5355 |
using \<open>-r < a\<close> \<open>b < r\<close> by auto |
|
5356 |
then show "\<forall>y. a < y \<and> y < b \<longrightarrow> DERIV (\<lambda>x. suminf (?c x) - arctan x) y :> 0" |
|
5357 |
using \<open>\<bar>x\<bar> < r\<close> by auto |
|
5358 |
show "\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> isCont (\<lambda>x. suminf (?c x) - arctan x) y" |
|
5359 |
using DERIV_in_rball DERIV_isCont by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5360 |
qed |
| 63558 | 5361 |
qed |
5362 |
||
5363 |
have suminf_arctan_zero: "suminf (?c 0) - arctan 0 = 0" |
|
5364 |
unfolding Suc_eq_plus1[symmetric] power_Suc2 mult_zero_right arctan_zero_zero suminf_zero |
|
5365 |
by auto |
|
5366 |
||
5367 |
have "suminf (?c x) - arctan x = 0" |
|
5368 |
proof (cases "x = 0") |
|
5369 |
case True |
|
5370 |
then show ?thesis |
|
5371 |
using suminf_arctan_zero by auto |
|
5372 |
next |
|
5373 |
case False |
|
5374 |
then have "0 < \<bar>x\<bar>" and "- \<bar>x\<bar> < \<bar>x\<bar>" |
|
| 53079 | 5375 |
by auto |
| 63558 | 5376 |
have "suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>) = suminf (?c 0) - arctan 0" |
5377 |
by (rule suminf_eq_arctan_bounded[where x1="0" and a1="-\<bar>x\<bar>" and b1="\<bar>x\<bar>", symmetric]) |
|
5378 |
(simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>-\<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less) |
|
5379 |
moreover |
|
5380 |
have "suminf (?c x) - arctan x = suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>)" |
|
5381 |
by (rule suminf_eq_arctan_bounded[where x1="x" and a1="- \<bar>x\<bar>" and b1="\<bar>x\<bar>"]) |
|
5382 |
(simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>- \<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less) |
|
5383 |
ultimately show ?thesis |
|
5384 |
using suminf_arctan_zero by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5385 |
qed |
| 63558 | 5386 |
then show ?thesis by auto |
5387 |
qed |
|
5388 |
||
5389 |
show "arctan x = suminf (\<lambda>n. ?c x n)" |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5390 |
proof (cases "\<bar>x\<bar> < 1") |
| 53079 | 5391 |
case True |
| 63558 | 5392 |
then show ?thesis by (rule when_less_one) |
| 53079 | 5393 |
next |
5394 |
case False |
|
| 63558 | 5395 |
then have "\<bar>x\<bar> = 1" using \<open>\<bar>x\<bar> \<le> 1\<close> by auto |
5396 |
let ?a = "\<lambda>x n. \<bar>1 / real (n * 2 + 1) * x^(n * 2 + 1)\<bar>" |
|
5397 |
let ?diff = "\<lambda>x n. \<bar>arctan x - (\<Sum>i<n. ?c x i)\<bar>" |
|
5398 |
have "?diff 1 n \<le> ?a 1 n" for n :: nat |
|
5399 |
proof - |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5400 |
have "0 < (1 :: real)" by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5401 |
moreover |
| 63558 | 5402 |
have "?diff x n \<le> ?a x n" if "0 < x" and "x < 1" for x :: real |
5403 |
proof - |
|
5404 |
from that have "\<bar>x\<bar> \<le> 1" and "\<bar>x\<bar> < 1" |
|
5405 |
by auto |
|
| 60758 | 5406 |
from \<open>0 < x\<close> have "0 < 1 / real (0 * 2 + (1::nat)) * x ^ (0 * 2 + 1)" |
| 53079 | 5407 |
by auto |
| 60758 | 5408 |
note bounds = mp[OF arctan_series_borders(2)[OF \<open>\<bar>x\<bar> \<le> 1\<close>] this, unfolded when_less_one[OF \<open>\<bar>x\<bar> < 1\<close>, symmetric], THEN spec] |
| 53079 | 5409 |
have "0 < 1 / real (n*2+1) * x^(n*2+1)" |
| 63558 | 5410 |
by (rule mult_pos_pos) (simp_all only: zero_less_power[OF \<open>0 < x\<close>], auto) |
5411 |
then have a_pos: "?a x n = 1 / real (n*2+1) * x^(n*2+1)" |
|
| 53079 | 5412 |
by (rule abs_of_pos) |
| 63558 | 5413 |
show ?thesis |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5414 |
proof (cases "even n") |
| 53079 | 5415 |
case True |
| 63558 | 5416 |
then have sgn_pos: "(-1)^n = (1::real)" by auto |
| 60758 | 5417 |
from \<open>even n\<close> obtain m where "n = 2 * m" .. |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
5418 |
then have "2 * m = n" .. |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5419 |
from bounds[of m, unfolded this atLeastAtMost_iff] |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
5420 |
have "\<bar>arctan x - (\<Sum>i<n. (?c x i))\<bar> \<le> (\<Sum>i<n + 1. (?c x i)) - (\<Sum>i<n. (?c x i))" |
| 53079 | 5421 |
by auto |
| 63558 | 5422 |
also have "\<dots> = ?c x n" by auto |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5423 |
also have "\<dots> = ?a x n" unfolding sgn_pos a_pos by auto |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5424 |
finally show ?thesis . |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5425 |
next |
| 53079 | 5426 |
case False |
| 63558 | 5427 |
then have sgn_neg: "(-1)^n = (-1::real)" by auto |
| 60758 | 5428 |
from \<open>odd n\<close> obtain m where "n = 2 * m + 1" .. |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
5429 |
then have m_def: "2 * m + 1 = n" .. |
| 63558 | 5430 |
then have m_plus: "2 * (m + 1) = n + 1" by auto |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5431 |
from bounds[of "m + 1", unfolded this atLeastAtMost_iff, THEN conjunct1] bounds[of m, unfolded m_def atLeastAtMost_iff, THEN conjunct2] |
| 63558 | 5432 |
have "\<bar>arctan x - (\<Sum>i<n. (?c x i))\<bar> \<le> (\<Sum>i<n. (?c x i)) - (\<Sum>i<n+1. (?c x i))" by auto |
5433 |
also have "\<dots> = - ?c x n" by auto |
|
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5434 |
also have "\<dots> = ?a x n" unfolding sgn_neg a_pos by auto |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5435 |
finally show ?thesis . |
|
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5436 |
qed |
| 63558 | 5437 |
qed |
5438 |
hence "\<forall>x \<in> { 0 <..< 1 }. 0 \<le> ?a x n - ?diff x n" by auto
|
|
5439 |
moreover have "isCont (\<lambda> x. ?a x n - ?diff x n) x" for x |
|
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
5440 |
unfolding diff_conv_add_uminus divide_inverse |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5441 |
by (auto intro!: isCont_add isCont_rabs continuous_ident isCont_minus isCont_arctan |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5442 |
isCont_inverse isCont_mult isCont_power continuous_const isCont_setsum |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
5443 |
simp del: add_uminus_conv_diff) |
| 53079 | 5444 |
ultimately have "0 \<le> ?a 1 n - ?diff 1 n" |
5445 |
by (rule LIM_less_bound) |
|
| 63558 | 5446 |
then show ?thesis by auto |
5447 |
qed |
|
| 61969 | 5448 |
have "?a 1 \<longlonglongrightarrow> 0" |
|
44568
e6f291cb5810
discontinue many legacy theorems about LIM and LIMSEQ, in favor of tendsto theorems
huffman
parents:
44319
diff
changeset
|
5449 |
unfolding tendsto_rabs_zero_iff power_one divide_inverse One_nat_def |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
5450 |
by (auto intro!: tendsto_mult LIMSEQ_linear LIMSEQ_inverse_real_of_nat simp del: of_nat_Suc) |
| 61969 | 5451 |
have "?diff 1 \<longlonglongrightarrow> 0" |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5452 |
proof (rule LIMSEQ_I) |
| 53079 | 5453 |
fix r :: real |
5454 |
assume "0 < r" |
|
| 63558 | 5455 |
obtain N :: nat where N_I: "N \<le> n \<Longrightarrow> ?a 1 n < r" for n |
| 61969 | 5456 |
using LIMSEQ_D[OF \<open>?a 1 \<longlonglongrightarrow> 0\<close> \<open>0 < r\<close>] by auto |
| 63558 | 5457 |
have "norm (?diff 1 n - 0) < r" if "N \<le> n" for n |
5458 |
using \<open>?diff 1 n \<le> ?a 1 n\<close> N_I[OF that] by auto |
|
5459 |
then show "\<exists>N. \<forall> n \<ge> N. norm (?diff 1 n - 0) < r" by blast |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5460 |
qed |
| 44710 | 5461 |
from this [unfolded tendsto_rabs_zero_iff, THEN tendsto_add [OF _ tendsto_const], of "- arctan 1", THEN tendsto_minus] |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5462 |
have "(?c 1) sums (arctan 1)" unfolding sums_def by auto |
| 63558 | 5463 |
then have "arctan 1 = (\<Sum>i. ?c 1 i)" by (rule sums_unique) |
| 41970 | 5464 |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5465 |
show ?thesis |
| 53079 | 5466 |
proof (cases "x = 1") |
5467 |
case True |
|
| 60758 | 5468 |
then show ?thesis by (simp add: \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close>) |
| 53079 | 5469 |
next |
5470 |
case False |
|
| 63558 | 5471 |
then have "x = -1" using \<open>\<bar>x\<bar> = 1\<close> by auto |
| 41970 | 5472 |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5473 |
have "- (pi / 2) < 0" using pi_gt_zero by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5474 |
have "- (2 * pi) < 0" using pi_gt_zero by auto |
| 41970 | 5475 |
|
| 63558 | 5476 |
have c_minus_minus: "?c (- 1) i = - ?c 1 i" for i by auto |
| 53079 | 5477 |
|
5478 |
have "arctan (- 1) = arctan (tan (-(pi / 4)))" |
|
5479 |
unfolding tan_45 tan_minus .. |
|
5480 |
also have "\<dots> = - (pi / 4)" |
|
| 63558 | 5481 |
by (rule arctan_tan) (auto simp: order_less_trans[OF \<open>- (pi / 2) < 0\<close> pi_gt_zero]) |
| 53079 | 5482 |
also have "\<dots> = - (arctan (tan (pi / 4)))" |
| 63558 | 5483 |
unfolding neg_equal_iff_equal |
5484 |
by (rule arctan_tan[symmetric]) (auto simp: order_less_trans[OF \<open>- (2 * pi) < 0\<close> pi_gt_zero]) |
|
| 53079 | 5485 |
also have "\<dots> = - (arctan 1)" |
5486 |
unfolding tan_45 .. |
|
5487 |
also have "\<dots> = - (\<Sum> i. ?c 1 i)" |
|
| 60758 | 5488 |
using \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close> by auto |
| 53079 | 5489 |
also have "\<dots> = (\<Sum> i. ?c (- 1) i)" |
| 60758 | 5490 |
using suminf_minus[OF sums_summable[OF \<open>(?c 1) sums (arctan 1)\<close>]] |
| 53079 | 5491 |
unfolding c_minus_minus by auto |
| 60758 | 5492 |
finally show ?thesis using \<open>x = -1\<close> by auto |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5493 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5494 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5495 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5496 |
|
| 63558 | 5497 |
lemma arctan_half: "arctan x = 2 * arctan (x / (1 + sqrt(1 + x\<^sup>2)))" |
5498 |
for x :: real |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5499 |
proof - |
| 53079 | 5500 |
obtain y where low: "- (pi / 2) < y" and high: "y < pi / 2" and y_eq: "tan y = x" |
5501 |
using tan_total by blast |
|
| 63558 | 5502 |
then have low2: "- (pi / 2) < y / 2" and high2: "y / 2 < pi / 2" |
| 53079 | 5503 |
by auto |
5504 |
||
| 63558 | 5505 |
have "0 < cos y" by (rule cos_gt_zero_pi[OF low high]) |
5506 |
then have "cos y \<noteq> 0" and cos_sqrt: "sqrt ((cos y)\<^sup>2) = cos y" |
|
| 53079 | 5507 |
by auto |
5508 |
||
5509 |
have "1 + (tan y)\<^sup>2 = 1 + (sin y)\<^sup>2 / (cos y)\<^sup>2" |
|
5510 |
unfolding tan_def power_divide .. |
|
5511 |
also have "\<dots> = (cos y)\<^sup>2 / (cos y)\<^sup>2 + (sin y)\<^sup>2 / (cos y)\<^sup>2" |
|
| 60758 | 5512 |
using \<open>cos y \<noteq> 0\<close> by auto |
| 53079 | 5513 |
also have "\<dots> = 1 / (cos y)\<^sup>2" |
5514 |
unfolding add_divide_distrib[symmetric] sin_cos_squared_add2 .. |
|
| 53076 | 5515 |
finally have "1 + (tan y)\<^sup>2 = 1 / (cos y)\<^sup>2" . |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5516 |
|
| 53079 | 5517 |
have "sin y / (cos y + 1) = tan y / ((cos y + 1) / cos y)" |
| 60758 | 5518 |
unfolding tan_def using \<open>cos y \<noteq> 0\<close> by (simp add: field_simps) |
| 53079 | 5519 |
also have "\<dots> = tan y / (1 + 1 / cos y)" |
| 60758 | 5520 |
using \<open>cos y \<noteq> 0\<close> unfolding add_divide_distrib by auto |
| 53079 | 5521 |
also have "\<dots> = tan y / (1 + 1 / sqrt ((cos y)\<^sup>2))" |
5522 |
unfolding cos_sqrt .. |
|
5523 |
also have "\<dots> = tan y / (1 + sqrt (1 / (cos y)\<^sup>2))" |
|
5524 |
unfolding real_sqrt_divide by auto |
|
5525 |
finally have eq: "sin y / (cos y + 1) = tan y / (1 + sqrt(1 + (tan y)\<^sup>2))" |
|
| 60758 | 5526 |
unfolding \<open>1 + (tan y)\<^sup>2 = 1 / (cos y)\<^sup>2\<close> . |
| 53079 | 5527 |
|
5528 |
have "arctan x = y" |
|
5529 |
using arctan_tan low high y_eq by auto |
|
5530 |
also have "\<dots> = 2 * (arctan (tan (y/2)))" |
|
5531 |
using arctan_tan[OF low2 high2] by auto |
|
5532 |
also have "\<dots> = 2 * (arctan (sin y / (cos y + 1)))" |
|
5533 |
unfolding tan_half by auto |
|
5534 |
finally show ?thesis |
|
| 60758 | 5535 |
unfolding eq \<open>tan y = x\<close> . |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5536 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5537 |
|
| 53079 | 5538 |
lemma arctan_monotone: "x < y \<Longrightarrow> arctan x < arctan y" |
5539 |
by (simp only: arctan_less_iff) |
|
5540 |
||
5541 |
lemma arctan_monotone': "x \<le> y \<Longrightarrow> arctan x \<le> arctan y" |
|
5542 |
by (simp only: arctan_le_iff) |
|
| 44746 | 5543 |
|
5544 |
lemma arctan_inverse: |
|
| 53079 | 5545 |
assumes "x \<noteq> 0" |
5546 |
shows "arctan (1 / x) = sgn x * pi / 2 - arctan x" |
|
| 44746 | 5547 |
proof (rule arctan_unique) |
5548 |
show "- (pi / 2) < sgn x * pi / 2 - arctan x" |
|
5549 |
using arctan_bounded [of x] assms |
|
5550 |
unfolding sgn_real_def |
|
| 59869 | 5551 |
apply (auto simp add: arctan algebra_simps) |
| 44746 | 5552 |
apply (drule zero_less_arctan_iff [THEN iffD2]) |
5553 |
apply arith |
|
5554 |
done |
|
5555 |
show "sgn x * pi / 2 - arctan x < pi / 2" |
|
5556 |
using arctan_bounded [of "- x"] assms |
|
5557 |
unfolding sgn_real_def arctan_minus |
|
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
5558 |
by (auto simp add: algebra_simps) |
| 44746 | 5559 |
show "tan (sgn x * pi / 2 - arctan x) = 1 / x" |
5560 |
unfolding tan_inverse [of "arctan x", unfolded tan_arctan] |
|
5561 |
unfolding sgn_real_def |
|
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56409
diff
changeset
|
5562 |
by (simp add: tan_def cos_arctan sin_arctan sin_diff cos_diff) |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5563 |
qed |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5564 |
|
| 63558 | 5565 |
theorem pi_series: "pi / 4 = (\<Sum>k. (-1)^k * 1 / real (k * 2 + 1))" |
5566 |
(is "_ = ?SUM") |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5567 |
proof - |
| 63558 | 5568 |
have "pi / 4 = arctan 1" |
5569 |
using arctan_one by auto |
|
5570 |
also have "\<dots> = ?SUM" |
|
5571 |
using arctan_series[of 1] by auto |
|
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5572 |
finally show ?thesis by auto |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5573 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5574 |
|
| 53079 | 5575 |
|
| 60758 | 5576 |
subsection \<open>Existence of Polar Coordinates\<close> |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5577 |
|
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
5578 |
lemma cos_x_y_le_one: "\<bar>x / sqrt (x\<^sup>2 + y\<^sup>2)\<bar> \<le> 1" |
| 63558 | 5579 |
by (rule power2_le_imp_le [OF _ zero_le_one]) |
5580 |
(simp add: power_divide divide_le_eq not_sum_power2_lt_zero) |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5581 |
|
|
22978
1cd8cc21a7c3
clean up polar_Ex proofs; remove unnecessary lemmas
huffman
parents:
22977
diff
changeset
|
5582 |
lemmas cos_arccos_lemma1 = cos_arccos_abs [OF cos_x_y_le_one] |
| 15228 | 5583 |
|
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5584 |
lemmas sin_arccos_lemma1 = sin_arccos_abs [OF cos_x_y_le_one] |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5585 |
|
| 63558 | 5586 |
lemma polar_Ex: "\<exists>r::real. \<exists>a. x = r * cos a \<and> y = r * sin a" |
| 54573 | 5587 |
proof - |
| 63558 | 5588 |
have polar_ex1: "0 < y \<Longrightarrow> \<exists>r a. x = r * cos a \<and> y = r * sin a" for y |
5589 |
apply (rule exI [where x = "sqrt (x\<^sup>2 + y\<^sup>2)"]) |
|
5590 |
apply (rule exI [where x = "arccos (x / sqrt (x\<^sup>2 + y\<^sup>2))"]) |
|
| 54573 | 5591 |
apply (simp add: cos_arccos_lemma1 sin_arccos_lemma1 power_divide |
| 63558 | 5592 |
real_sqrt_mult [symmetric] right_diff_distrib) |
| 54573 | 5593 |
done |
5594 |
show ?thesis |
|
5595 |
proof (cases "0::real" y rule: linorder_cases) |
|
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
5596 |
case less |
| 63558 | 5597 |
then show ?thesis |
5598 |
by (rule polar_ex1) |
|
| 54573 | 5599 |
next |
5600 |
case equal |
|
| 63558 | 5601 |
then show ?thesis |
5602 |
by (force simp add: intro!: cos_zero sin_zero) |
|
| 54573 | 5603 |
next |
5604 |
case greater |
|
| 63558 | 5605 |
with polar_ex1 [where y="-y"] show ?thesis |
5606 |
by auto (metis cos_minus minus_minus minus_mult_right sin_minus) |
|
| 54573 | 5607 |
qed |
5608 |
qed |
|
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5609 |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5610 |
|
| 63558 | 5611 |
subsection \<open>Basics about polynomial functions: products, extremal behaviour and root counts\<close> |
5612 |
||
5613 |
lemma pairs_le_eq_Sigma: "{(i, j). i + j \<le> m} = Sigma (atMost m) (\<lambda>r. atMost (m - r))"
|
|
5614 |
for m :: nat |
|
5615 |
by auto |
|
5616 |
||
5617 |
lemma setsum_up_index_split: "(\<Sum>k\<le>m + n. f k) = (\<Sum>k\<le>m. f k) + (\<Sum>k = Suc m..m + n. f k)" |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5618 |
by (metis atLeast0AtMost Suc_eq_plus1 le0 setsum_ub_add_nat) |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5619 |
|
| 63558 | 5620 |
lemma Sigma_interval_disjoint: "(SIGMA i:A. {..v i}) \<inter> (SIGMA i:A.{v i<..w}) = {}"
|
5621 |
for w :: "'a::order" |
|
5622 |
by auto |
|
5623 |
||
5624 |
lemma product_atMost_eq_Un: "A \<times> {..m} = (SIGMA i:A.{..m - i}) \<union> (SIGMA i:A.{m - i<..m})"
|
|
5625 |
for m :: nat |
|
5626 |
by auto |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5627 |
|
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5628 |
lemma polynomial_product: (*with thanks to Chaitanya Mangla*) |
| 63558 | 5629 |
fixes x :: "'a::idom" |
5630 |
assumes m: "\<And>i. i > m \<Longrightarrow> a i = 0" |
|
5631 |
and n: "\<And>j. j > n \<Longrightarrow> b j = 0" |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
5632 |
shows "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) = |
| 63558 | 5633 |
(\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)" |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5634 |
proof - |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5635 |
have "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) = (\<Sum>i\<le>m. \<Sum>j\<le>n. (a i * x ^ i) * (b j * x ^ j))" |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5636 |
by (rule setsum_product) |
| 63558 | 5637 |
also have "\<dots> = (\<Sum>i\<le>m + n. \<Sum>j\<le>n + m. a i * x ^ i * (b j * x ^ j))" |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5638 |
using assms by (auto simp: setsum_up_index_split) |
| 63558 | 5639 |
also have "\<dots> = (\<Sum>r\<le>m + n. \<Sum>j\<le>m + n - r. a r * x ^ r * (b j * x ^ j))" |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5640 |
apply (simp add: add_ac setsum.Sigma product_atMost_eq_Un) |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5641 |
apply (clarsimp simp add: setsum_Un Sigma_interval_disjoint intro!: setsum.neutral) |
| 63558 | 5642 |
apply (metis add_diff_assoc2 add.commute add_lessD1 leD m n nat_le_linear neqE) |
5643 |
done |
|
5644 |
also have "\<dots> = (\<Sum>(i,j)\<in>{(i,j). i+j \<le> m+n}. (a i * x ^ i) * (b j * x ^ j))"
|
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5645 |
by (auto simp: pairs_le_eq_Sigma setsum.Sigma) |
| 63558 | 5646 |
also have "\<dots> = (\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)" |
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
5647 |
apply (subst setsum_triangle_reindex_eq) |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5648 |
apply (auto simp: algebra_simps setsum_right_distrib intro!: setsum.cong) |
| 63558 | 5649 |
apply (metis le_add_diff_inverse power_add) |
5650 |
done |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5651 |
finally show ?thesis . |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5652 |
qed |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5653 |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
5654 |
lemma polynomial_product_nat: |
| 63558 | 5655 |
fixes x :: nat |
5656 |
assumes m: "\<And>i. i > m \<Longrightarrow> a i = 0" |
|
5657 |
and n: "\<And>j. j > n \<Longrightarrow> b j = 0" |
|
|
61609
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents:
61552
diff
changeset
|
5658 |
shows "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) = |
| 63558 | 5659 |
(\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)" |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5660 |
using polynomial_product [of m a n b x] assms |
| 63558 | 5661 |
by (simp only: of_nat_mult [symmetric] of_nat_power [symmetric] |
5662 |
of_nat_eq_iff Int.int_setsum [symmetric]) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5663 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5664 |
lemma polyfun_diff: (*COMPLEX_SUB_POLYFUN in HOL Light*) |
| 63558 | 5665 |
fixes x :: "'a::idom" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5666 |
assumes "1 \<le> n" |
| 63558 | 5667 |
shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
5668 |
(x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5669 |
proof - |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5670 |
have h: "bij_betw (\<lambda>(i,j). (j,i)) ((SIGMA i : atMost n. lessThan i)) (SIGMA j : lessThan n. {Suc j..n})"
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5671 |
by (auto simp: bij_betw_def inj_on_def) |
| 63558 | 5672 |
have "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = (\<Sum>i\<le>n. a i * (x^i - y^i))" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5673 |
by (simp add: right_diff_distrib setsum_subtractf) |
| 63558 | 5674 |
also have "\<dots> = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5675 |
by (simp add: power_diff_sumr2 mult.assoc) |
| 63558 | 5676 |
also have "\<dots> = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y^(i - Suc j) * x^j))" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5677 |
by (simp add: setsum_right_distrib) |
| 63558 | 5678 |
also have "\<dots> = (\<Sum>(i,j) \<in> (SIGMA i : atMost n. lessThan i). a i * (x - y) * (y^(i - Suc j) * x^j))" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5679 |
by (simp add: setsum.Sigma) |
| 63558 | 5680 |
also have "\<dots> = (\<Sum>(j,i) \<in> (SIGMA j : lessThan n. {Suc j..n}). a i * (x - y) * (y^(i - Suc j) * x^j))"
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5681 |
by (auto simp add: setsum.reindex_bij_betw [OF h, symmetric] intro: setsum.strong_cong) |
| 63558 | 5682 |
also have "\<dots> = (\<Sum>j<n. \<Sum>i=Suc j..n. a i * (x - y) * (y^(i - Suc j) * x^j))" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5683 |
by (simp add: setsum.Sigma) |
| 63558 | 5684 |
also have "\<dots> = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5685 |
by (simp add: setsum_right_distrib mult_ac) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5686 |
finally show ?thesis . |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5687 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5688 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5689 |
lemma polyfun_diff_alt: (*COMPLEX_SUB_POLYFUN_ALT in HOL Light*) |
| 63558 | 5690 |
fixes x :: "'a::idom" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5691 |
assumes "1 \<le> n" |
| 63558 | 5692 |
shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
5693 |
(x - y) * ((\<Sum>j<n. \<Sum>k<n-j. a(j + k + 1) * y^k * x^j))" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5694 |
proof - |
| 63558 | 5695 |
have "(\<Sum>i=Suc j..n. a i * y^(i - j - 1)) = (\<Sum>k<n-j. a(j+k+1) * y^k)" |
5696 |
if "j < n" for j :: nat |
|
5697 |
proof - |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5698 |
have h: "bij_betw (\<lambda>i. i - (j + 1)) {Suc j..n} (lessThan (n-j))"
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5699 |
apply (auto simp: bij_betw_def inj_on_def) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5700 |
apply (rule_tac x="x + Suc j" in image_eqI) |
| 63558 | 5701 |
apply (auto simp: ) |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5702 |
done |
| 63558 | 5703 |
then show ?thesis |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5704 |
by (auto simp add: setsum.reindex_bij_betw [OF h, symmetric] intro: setsum.strong_cong) |
| 63558 | 5705 |
qed |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5706 |
then show ?thesis |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5707 |
by (simp add: polyfun_diff [OF assms] setsum_left_distrib) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5708 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5709 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5710 |
lemma polyfun_linear_factor: (*COMPLEX_POLYFUN_LINEAR_FACTOR in HOL Light*) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5711 |
fixes a :: "'a::idom" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5712 |
shows "\<exists>b. \<forall>z. (\<Sum>i\<le>n. c(i) * z^i) = (z - a) * (\<Sum>i<n. b(i) * z^i) + (\<Sum>i\<le>n. c(i) * a^i)" |
| 63558 | 5713 |
proof (cases "n = 0") |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5714 |
case True then show ?thesis |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5715 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5716 |
next |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5717 |
case False |
| 63558 | 5718 |
have "(\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) = (z - a) * (\<Sum>i<n. b i * z^i) + (\<Sum>i\<le>n. c i * a^i)) \<longleftrightarrow> |
5719 |
(\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) - (\<Sum>i\<le>n. c i * a^i) = (z - a) * (\<Sum>i<n. b i * z^i))" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5720 |
by (simp add: algebra_simps) |
| 63558 | 5721 |
also have "\<dots> \<longleftrightarrow> |
5722 |
(\<exists>b. \<forall>z. (z - a) * (\<Sum>j<n. (\<Sum>i = Suc j..n. c i * a^(i - Suc j)) * z^j) = |
|
5723 |
(z - a) * (\<Sum>i<n. b i * z^i))" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5724 |
using False by (simp add: polyfun_diff) |
| 63558 | 5725 |
also have "\<dots> = True" by auto |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5726 |
finally show ?thesis |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5727 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5728 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5729 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5730 |
lemma polyfun_linear_factor_root: (*COMPLEX_POLYFUN_LINEAR_FACTOR_ROOT in HOL Light*) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5731 |
fixes a :: "'a::idom" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5732 |
assumes "(\<Sum>i\<le>n. c(i) * a^i) = 0" |
| 63558 | 5733 |
obtains b where "\<And>z. (\<Sum>i\<le>n. c i * z^i) = (z - a) * (\<Sum>i<n. b i * z^i)" |
5734 |
using polyfun_linear_factor [of c n a] assms by auto |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5735 |
|
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5736 |
(*The material of this section, up until this point, could go into a new theory of polynomials |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5737 |
based on Main alone. The remaining material involves limits, continuity, series, etc.*) |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5738 |
|
| 63558 | 5739 |
lemma isCont_polynom: "isCont (\<lambda>w. \<Sum>i\<le>n. c i * w^i) a" |
5740 |
for c :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5741 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5742 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5743 |
lemma zero_polynom_imp_zero_coeffs: |
| 63558 | 5744 |
fixes c :: "nat \<Rightarrow> 'a::{ab_semigroup_mult,real_normed_div_algebra}"
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5745 |
assumes "\<And>w. (\<Sum>i\<le>n. c i * w^i) = 0" "k \<le> n" |
| 63558 | 5746 |
shows "c k = 0" |
5747 |
using assms |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5748 |
proof (induction n arbitrary: c k) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5749 |
case 0 |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5750 |
then show ?case |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5751 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5752 |
next |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5753 |
case (Suc n c k) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5754 |
have [simp]: "c 0 = 0" using Suc.prems(1) [of 0] |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5755 |
by simp |
| 63558 | 5756 |
have "(\<Sum>i\<le>Suc n. c i * w^i) = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" for w |
5757 |
proof - |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5758 |
have "(\<Sum>i\<le>Suc n. c i * w^i) = (\<Sum>i\<le>n. c (Suc i) * w ^ Suc i)" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5759 |
unfolding Set_Interval.setsum_atMost_Suc_shift |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5760 |
by simp |
| 63558 | 5761 |
also have "\<dots> = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" |
| 60867 | 5762 |
by (simp add: setsum_right_distrib ac_simps) |
| 63558 | 5763 |
finally show ?thesis . |
5764 |
qed |
|
5765 |
then have w: "\<And>w. w \<noteq> 0 \<Longrightarrow> (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5766 |
using Suc by auto |
| 61976 | 5767 |
then have "(\<lambda>h. \<Sum>i\<le>n. c (Suc i) * h^i) \<midarrow>0\<rightarrow> 0" |
| 63558 | 5768 |
by (simp cong: LIM_cong) \<comment> \<open>the case \<open>w = 0\<close> by continuity\<close> |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5769 |
then have "(\<Sum>i\<le>n. c (Suc i) * 0^i) = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5770 |
using isCont_polynom [of 0 "\<lambda>i. c (Suc i)" n] LIM_unique |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5771 |
by (force simp add: Limits.isCont_iff) |
| 63558 | 5772 |
then have "\<And>w. (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" |
5773 |
using w by metis |
|
5774 |
then have "\<And>i. i \<le> n \<Longrightarrow> c (Suc i) = 0" |
|
5775 |
using Suc.IH [of "\<lambda>i. c (Suc i)"] by blast |
|
| 60758 | 5776 |
then show ?case using \<open>k \<le> Suc n\<close> |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5777 |
by (cases k) auto |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5778 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5779 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5780 |
lemma polyfun_rootbound: (*COMPLEX_POLYFUN_ROOTBOUND in HOL Light*) |
| 63558 | 5781 |
fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5782 |
assumes "c k \<noteq> 0" "k\<le>n" |
| 63558 | 5783 |
shows "finite {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<and> card {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<le> n"
|
5784 |
using assms |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5785 |
proof (induction n arbitrary: c k) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5786 |
case 0 |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5787 |
then show ?case |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5788 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5789 |
next |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5790 |
case (Suc m c k) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5791 |
let ?succase = ?case |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5792 |
show ?case |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5793 |
proof (cases "{z. (\<Sum>i\<le>Suc m. c(i) * z^i) = 0} = {}")
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5794 |
case True |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5795 |
then show ?succase |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5796 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5797 |
next |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5798 |
case False |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5799 |
then obtain z0 where z0: "(\<Sum>i\<le>Suc m. c(i) * z0^i) = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5800 |
by blast |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5801 |
then obtain b where b: "\<And>w. (\<Sum>i\<le>Suc m. c i * w^i) = (w - z0) * (\<Sum>i\<le>m. b i * w^i)" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5802 |
using polyfun_linear_factor_root [OF z0, unfolded lessThan_Suc_atMost] |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5803 |
by blast |
| 63558 | 5804 |
then have eq: "{z. (\<Sum>i\<le>Suc m. c i * z^i) = 0} = insert z0 {z. (\<Sum>i\<le>m. b i * z^i) = 0}"
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5805 |
by auto |
| 63558 | 5806 |
have "\<not> (\<forall>k\<le>m. b k = 0)" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5807 |
proof |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5808 |
assume [simp]: "\<forall>k\<le>m. b k = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5809 |
then have "\<And>w. (\<Sum>i\<le>m. b i * w^i) = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5810 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5811 |
then have "\<And>w. (\<Sum>i\<le>Suc m. c i * w^i) = 0" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5812 |
using b by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5813 |
then have "\<And>k. k \<le> Suc m \<Longrightarrow> c k = 0" |
| 63558 | 5814 |
using zero_polynom_imp_zero_coeffs by blast |
5815 |
then show False using Suc.prems by blast |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5816 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5817 |
then obtain k' where bk': "b k' \<noteq> 0" "k' \<le> m" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5818 |
by blast |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5819 |
show ?succase |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5820 |
using Suc.IH [of b k'] bk' |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5821 |
by (simp add: eq card_insert_if del: setsum_atMost_Suc) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5822 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5823 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5824 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5825 |
lemma |
| 63558 | 5826 |
fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5827 |
assumes "c k \<noteq> 0" "k\<le>n" |
| 63558 | 5828 |
shows polyfun_roots_finite: "finite {z. (\<Sum>i\<le>n. c(i) * z^i) = 0}"
|
5829 |
and polyfun_roots_card: "card {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<le> n"
|
|
5830 |
using polyfun_rootbound assms by auto |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5831 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5832 |
lemma polyfun_finite_roots: (*COMPLEX_POLYFUN_FINITE_ROOTS in HOL Light*) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5833 |
fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5834 |
shows "finite {x. (\<Sum>i\<le>n. c i * x^i) = 0} \<longleftrightarrow> (\<exists>i\<le>n. c i \<noteq> 0)"
|
| 63558 | 5835 |
(is "?lhs = ?rhs") |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5836 |
proof |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5837 |
assume ?lhs |
| 63558 | 5838 |
moreover have "\<not> finite {x. (\<Sum>i\<le>n. c i * x^i) = 0}" if "\<forall>i\<le>n. c i = 0"
|
5839 |
proof - |
|
5840 |
from that have "\<And>x. (\<Sum>i\<le>n. c i * x^i) = 0" |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5841 |
by simp |
| 63558 | 5842 |
then show ?thesis |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5843 |
using ex_new_if_finite [OF infinite_UNIV_char_0 [where 'a='a]] |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5844 |
by auto |
| 63558 | 5845 |
qed |
5846 |
ultimately show ?rhs by metis |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5847 |
next |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5848 |
assume ?rhs |
| 63558 | 5849 |
with polyfun_rootbound show ?lhs by blast |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5850 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5851 |
|
| 63558 | 5852 |
lemma polyfun_eq_0: "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = 0) \<longleftrightarrow> (\<forall>i\<le>n. c i = 0)" |
5853 |
for c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
5854 |
(*COMPLEX_POLYFUN_EQ_0 in HOL Light*) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5855 |
using zero_polynom_imp_zero_coeffs by auto |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5856 |
|
| 63558 | 5857 |
lemma polyfun_eq_coeffs: "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = (\<Sum>i\<le>n. d i * x^i)) \<longleftrightarrow> (\<forall>i\<le>n. c i = d i)" |
5858 |
for c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5859 |
proof - |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5860 |
have "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = (\<Sum>i\<le>n. d i * x^i)) \<longleftrightarrow> (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x^i) = 0)" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5861 |
by (simp add: left_diff_distrib Groups_Big.setsum_subtractf) |
| 63558 | 5862 |
also have "\<dots> \<longleftrightarrow> (\<forall>i\<le>n. c i - d i = 0)" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5863 |
by (rule polyfun_eq_0) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5864 |
finally show ?thesis |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5865 |
by simp |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5866 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5867 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5868 |
lemma polyfun_eq_const: (*COMPLEX_POLYFUN_EQ_CONST in HOL Light*) |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5869 |
fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5870 |
shows "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = k) \<longleftrightarrow> c 0 = k \<and> (\<forall>i \<in> {1..n}. c i = 0)"
|
| 63558 | 5871 |
(is "?lhs = ?rhs") |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5872 |
proof - |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5873 |
have *: "\<forall>x. (\<Sum>i\<le>n. (if i=0 then k else 0) * x^i) = k" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5874 |
by (induct n) auto |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5875 |
show ?thesis |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5876 |
proof |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5877 |
assume ?lhs |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5878 |
with * have "(\<forall>i\<le>n. c i = (if i=0 then k else 0))" |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5879 |
by (simp add: polyfun_eq_coeffs [symmetric]) |
| 63540 | 5880 |
then show ?rhs by simp |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5881 |
next |
| 63540 | 5882 |
assume ?rhs |
5883 |
then show ?lhs by (induct n) auto |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5884 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5885 |
qed |
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5886 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5887 |
lemma root_polyfun: |
| 63540 | 5888 |
fixes z :: "'a::idom" |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5889 |
assumes "1 \<le> n" |
| 63540 | 5890 |
shows "z^n = a \<longleftrightarrow> (\<Sum>i\<le>n. (if i = 0 then -a else if i=n then 1 else 0) * z^i) = 0" |
| 63558 | 5891 |
using assms by (cases n) (simp_all add: setsum_head_Suc atLeast0AtMost [symmetric]) |
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5892 |
|
|
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5893 |
lemma |
| 63558 | 5894 |
assumes "SORT_CONSTRAINT('a::{idom,real_normed_div_algebra})"
|
5895 |
and "1 \<le> n" |
|
| 63540 | 5896 |
shows finite_roots_unity: "finite {z::'a. z^n = 1}"
|
5897 |
and card_roots_unity: "card {z::'a. z^n = 1} \<le> n"
|
|
| 63558 | 5898 |
using polyfun_rootbound [of "\<lambda>i. if i = 0 then -1 else if i=n then 1 else 0" n n] assms(2) |
5899 |
by (auto simp add: root_polyfun [OF assms(2)]) |
|
|
60017
b785d6d06430
Overloading of ln and powr, but "approximation" no longer works for powr. Code generation also fails due to type ambiguity in scala.
paulson <lp15@cam.ac.uk>
parents:
59869
diff
changeset
|
5900 |
|
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
5901 |
end |