author | paulson <lp15@cam.ac.uk> |
Mon, 27 Feb 2017 17:17:26 +0000 | |
changeset 65057 | 799bbbb3a395 |
parent 65036 | ab7e11730ad8 |
child 65109 | a79c1080f1e9 |
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)" |
64272 | 38 |
by (simp add: pochhammer_prod) |
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 |
||
63766
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
74 |
subsection \<open>More facts about binomial coefficients\<close> |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
75 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
76 |
text \<open> |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
77 |
These facts could have been proven before, but having real numbers |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
78 |
makes the proofs a lot easier. |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
79 |
\<close> |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
80 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
81 |
lemma central_binomial_odd: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
82 |
"odd n \<Longrightarrow> n choose (Suc (n div 2)) = n choose (n div 2)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
83 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
84 |
assume "odd n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
85 |
hence "Suc (n div 2) \<le> n" by presburger |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
86 |
hence "n choose (Suc (n div 2)) = n choose (n - Suc (n div 2))" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
87 |
by (rule binomial_symmetric) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
88 |
also from \<open>odd n\<close> have "n - Suc (n div 2) = n div 2" by presburger |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
89 |
finally show ?thesis . |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
90 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
91 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
92 |
lemma binomial_less_binomial_Suc: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
93 |
assumes k: "k < n div 2" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
94 |
shows "n choose k < n choose (Suc k)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
95 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
96 |
from k have k': "k \<le> n" "Suc k \<le> n" by simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
97 |
from k' have "real (n choose k) = fact n / (fact k * fact (n - k))" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
98 |
by (simp add: binomial_fact) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
99 |
also from k' have "n - k = Suc (n - Suc k)" by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
100 |
also from k' have "fact \<dots> = (real n - real k) * fact (n - Suc k)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
101 |
by (subst fact_Suc) (simp_all add: of_nat_diff) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
102 |
also from k have "fact k = fact (Suc k) / (real k + 1)" by (simp add: field_simps) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
103 |
also have "fact n / (fact (Suc k) / (real k + 1) * ((real n - real k) * fact (n - Suc k))) = |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
104 |
(n choose (Suc k)) * ((real k + 1) / (real n - real k))" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
105 |
using k by (simp add: divide_simps binomial_fact) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
106 |
also from assms have "(real k + 1) / (real n - real k) < 1" by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
107 |
finally show ?thesis using k by (simp add: mult_less_cancel_left) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
108 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
109 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
110 |
lemma binomial_strict_mono: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
111 |
assumes "k < k'" "2*k' \<le> n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
112 |
shows "n choose k < n choose k'" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
113 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
114 |
from assms have "k \<le> k' - 1" by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
115 |
thus ?thesis |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
116 |
proof (induction rule: inc_induct) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
117 |
case base |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
118 |
with assms binomial_less_binomial_Suc[of "k' - 1" n] |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
119 |
show ?case by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
120 |
next |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
121 |
case (step k) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
122 |
from step.prems step.hyps assms have "n choose k < n choose (Suc k)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
123 |
by (intro binomial_less_binomial_Suc) simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
124 |
also have "\<dots> < n choose k'" by (rule step.IH) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
125 |
finally show ?case . |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
126 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
127 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
128 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
129 |
lemma binomial_mono: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
130 |
assumes "k \<le> k'" "2*k' \<le> n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
131 |
shows "n choose k \<le> n choose k'" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
132 |
using assms binomial_strict_mono[of k k' n] by (cases "k = k'") simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
133 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
134 |
lemma binomial_strict_antimono: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
135 |
assumes "k < k'" "2 * k \<ge> n" "k' \<le> n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
136 |
shows "n choose k > n choose k'" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
137 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
138 |
from assms have "n choose (n - k) > n choose (n - k')" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
139 |
by (intro binomial_strict_mono) (simp_all add: algebra_simps) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
140 |
with assms show ?thesis by (simp add: binomial_symmetric [symmetric]) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
141 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
142 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
143 |
lemma binomial_antimono: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
144 |
assumes "k \<le> k'" "k \<ge> n div 2" "k' \<le> n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
145 |
shows "n choose k \<ge> n choose k'" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
146 |
proof (cases "k = k'") |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
147 |
case False |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
148 |
note not_eq = False |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
149 |
show ?thesis |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
150 |
proof (cases "k = n div 2 \<and> odd n") |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
151 |
case False |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
152 |
with assms(2) have "2*k \<ge> n" by presburger |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
153 |
with not_eq assms binomial_strict_antimono[of k k' n] |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
154 |
show ?thesis by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
155 |
next |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
156 |
case True |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
157 |
have "n choose k' \<le> n choose (Suc (n div 2))" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
158 |
proof (cases "k' = Suc (n div 2)") |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
159 |
case False |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
160 |
with assms True not_eq have "Suc (n div 2) < k'" by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
161 |
with assms binomial_strict_antimono[of "Suc (n div 2)" k' n] True |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
162 |
show ?thesis by auto |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
163 |
qed simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
164 |
also from True have "\<dots> = n choose k" by (simp add: central_binomial_odd) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
165 |
finally show ?thesis . |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
166 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
167 |
qed simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
168 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
169 |
lemma binomial_maximum: "n choose k \<le> n choose (n div 2)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
170 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
171 |
have "k \<le> n div 2 \<longleftrightarrow> 2*k \<le> n" by linarith |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
172 |
consider "2*k \<le> n" | "2*k \<ge> n" "k \<le> n" | "k > n" by linarith |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
173 |
thus ?thesis |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
174 |
proof cases |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
175 |
case 1 |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
176 |
thus ?thesis by (intro binomial_mono) linarith+ |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
177 |
next |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
178 |
case 2 |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
179 |
thus ?thesis by (intro binomial_antimono) simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
180 |
qed (simp_all add: binomial_eq_0) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
181 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
182 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
183 |
lemma binomial_maximum': "(2*n) choose k \<le> (2*n) choose n" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
184 |
using binomial_maximum[of "2*n"] by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
185 |
|
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
186 |
lemma central_binomial_lower_bound: |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
187 |
assumes "n > 0" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
188 |
shows "4^n / (2*real n) \<le> real ((2*n) choose n)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
189 |
proof - |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
190 |
from binomial[of 1 1 "2*n"] |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
191 |
have "4 ^ n = (\<Sum>k=0..2*n. (2*n) choose k)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
192 |
by (simp add: power_mult power2_eq_square One_nat_def [symmetric] del: One_nat_def) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
193 |
also have "{0..2*n} = {0<..<2*n} \<union> {0,2*n}" by auto |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
194 |
also have "(\<Sum>k\<in>\<dots>. (2*n) choose k) = |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
195 |
(\<Sum>k\<in>{0<..<2*n}. (2*n) choose k) + (\<Sum>k\<in>{0,2*n}. (2*n) choose k)" |
64267 | 196 |
by (subst sum.union_disjoint) auto |
63766
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
197 |
also have "(\<Sum>k\<in>{0,2*n}. (2*n) choose k) \<le> (\<Sum>k\<le>1. (n choose k)\<^sup>2)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
198 |
by (cases n) simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
199 |
also from assms have "\<dots> \<le> (\<Sum>k\<le>n. (n choose k)\<^sup>2)" |
64267 | 200 |
by (intro sum_mono3) auto |
63766
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
201 |
also have "\<dots> = (2*n) choose n" by (rule choose_square_sum) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
202 |
also have "(\<Sum>k\<in>{0<..<2*n}. (2*n) choose k) \<le> (\<Sum>k\<in>{0<..<2*n}. (2*n) choose n)" |
64267 | 203 |
by (intro sum_mono binomial_maximum') |
63766
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
204 |
also have "\<dots> = card {0<..<2*n} * ((2*n) choose n)" by simp |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
205 |
also have "card {0<..<2*n} \<le> 2*n - 1" by (cases n) simp_all |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
206 |
also have "(2 * n - 1) * (2 * n choose n) + (2 * n choose n) = ((2*n) choose n) * (2*n)" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
207 |
using assms by (simp add: algebra_simps) |
63834 | 208 |
finally have "4 ^ n \<le> (2 * n choose n) * (2 * n)" by simp_all |
63766
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
209 |
hence "real (4 ^ n) \<le> real ((2 * n choose n) * (2 * n))" |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
210 |
by (subst of_nat_le_iff) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
211 |
with assms show ?thesis by (simp add: field_simps) |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
212 |
qed |
695d60817cb1
Some facts about factorial and binomial coefficients
Manuel Eberl <eberlm@in.tum.de>
parents:
63721
diff
changeset
|
213 |
|
63467 | 214 |
|
60758 | 215 |
subsection \<open>Properties of Power Series\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
216 |
|
63467 | 217 |
lemma powser_zero [simp]: "(\<Sum>n. f n * 0 ^ n) = f 0" |
218 |
for f :: "nat \<Rightarrow> 'a::real_normed_algebra_1" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
219 |
proof - |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
220 |
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
|
221 |
by (subst suminf_finite[where N="{0}"]) (auto simp: power_0_left) |
63558 | 222 |
then show ?thesis by simp |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
223 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
224 |
|
63467 | 225 |
lemma powser_sums_zero: "(\<lambda>n. a n * 0^n) sums a 0" |
226 |
for a :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
|
227 |
using sums_finite [of "{0}" "\<lambda>n. a n * 0 ^ n"] |
|
228 |
by simp |
|
229 |
||
230 |
lemma powser_sums_zero_iff [simp]: "(\<lambda>n. a n * 0^n) sums x \<longleftrightarrow> a 0 = x" |
|
231 |
for a :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
|
232 |
using powser_sums_zero sums_unique2 by blast |
|
233 |
||
234 |
text \<open> |
|
235 |
Power series has a circle or radius of convergence: if it sums for \<open>x\<close>, |
|
236 |
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
|
237 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
238 |
lemma powser_insidea: |
53599 | 239 |
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
|
240 |
assumes 1: "summable (\<lambda>n. f n * x^n)" |
53079 | 241 |
and 2: "norm z < norm x" |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
242 |
shows "summable (\<lambda>n. norm (f n * z ^ n))" |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
243 |
proof - |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
244 |
from 2 have x_neq_0: "x \<noteq> 0" by clarsimp |
61969 | 245 |
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
|
246 |
by (rule summable_LIMSEQ_zero) |
63558 | 247 |
then have "convergent (\<lambda>n. f n * x^n)" |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
248 |
by (rule convergentI) |
63558 | 249 |
then have "Cauchy (\<lambda>n. f n * x^n)" |
44726 | 250 |
by (rule convergent_Cauchy) |
63558 | 251 |
then have "Bseq (\<lambda>n. f n * x^n)" |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
252 |
by (rule Cauchy_Bseq) |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
253 |
then obtain K where 3: "0 < K" and 4: "\<forall>n. norm (f n * x^n) \<le> K" |
63558 | 254 |
by (auto simp add: Bseq_def) |
255 |
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
|
256 |
proof (intro exI allI impI) |
63558 | 257 |
fix n :: nat |
53079 | 258 |
assume "0 \<le> n" |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
259 |
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
|
260 |
norm (f n * x^n) * norm (z ^ n)" |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
261 |
by (simp add: norm_mult abs_mult) |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
262 |
also have "\<dots> \<le> K * norm (z ^ n)" |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
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
|
266 |
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
|
267 |
by (simp only: mult.assoc) |
63558 | 268 |
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
|
269 |
by (simp add: mult_le_cancel_right x_neq_0) |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
270 |
qed |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
271 |
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
|
272 |
proof - |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
273 |
from 2 have "norm (norm (z * inverse x)) < 1" |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
274 |
using x_neq_0 |
53599 | 275 |
by (simp add: norm_mult nonzero_norm_inverse divide_inverse [where 'a=real, symmetric]) |
63558 | 276 |
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
|
277 |
by (rule summable_geometric) |
63558 | 278 |
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
|
279 |
by (rule summable_mult) |
63558 | 280 |
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
|
281 |
using x_neq_0 |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
282 |
by (simp add: norm_mult nonzero_norm_inverse power_mult_distrib |
63558 | 283 |
power_inverse norm_power mult.assoc) |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
284 |
qed |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
285 |
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
|
286 |
by (rule summable_comparison_test) |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
287 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
288 |
|
15229 | 289 |
lemma powser_inside: |
53599 | 290 |
fixes f :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}" |
53079 | 291 |
shows |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
292 |
"summable (\<lambda>n. f n * (x^n)) \<Longrightarrow> norm z < norm x \<Longrightarrow> |
53079 | 293 |
summable (\<lambda>n. f n * (z ^ n))" |
294 |
by (rule powser_insidea [THEN summable_norm_cancel]) |
|
295 |
||
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
296 |
lemma powser_times_n_limit_0: |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
297 |
fixes x :: "'a::{real_normed_div_algebra,banach}" |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
298 |
assumes "norm x < 1" |
61969 | 299 |
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
|
300 |
proof - |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
301 |
have "norm x / (1 - norm x) \<ge> 0" |
63558 | 302 |
using assms by (auto simp: divide_simps) |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
303 |
moreover obtain N where N: "norm x / (1 - norm x) < of_int N" |
63558 | 304 |
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
|
305 |
ultimately have N0: "N>0" |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
306 |
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
|
307 |
then have *: "real_of_int (N + 1) * norm x / real_of_int N < 1" |
63558 | 308 |
using N assms by (auto simp: field_simps) |
309 |
have **: "real_of_int N * (norm x * (real_of_nat (Suc n) * norm (x ^ n))) \<le> |
|
310 |
real_of_nat n * (norm x * ((1 + N) * norm (x ^ n)))" if "N \<le> int n" for n :: nat |
|
311 |
proof - |
|
312 |
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
|
313 |
by (simp add: algebra_simps) |
63558 | 314 |
then have "(real_of_int N * real_of_nat (Suc n)) * (norm x * norm (x ^ n)) \<le> |
315 |
(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
|
316 |
using N0 mult_mono by fastforce |
63558 | 317 |
then show ?thesis |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
318 |
by (simp add: algebra_simps) |
63558 | 319 |
qed |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
320 |
show ?thesis using * |
63558 | 321 |
by (rule summable_LIMSEQ_zero [OF summable_ratio_test, where N1="nat N"]) |
322 |
(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
|
323 |
qed |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
324 |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
325 |
corollary lim_n_over_pown: |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
326 |
fixes x :: "'a::{real_normed_field,banach}" |
61973 | 327 |
shows "1 < norm x \<Longrightarrow> ((\<lambda>n. of_nat n / x^n) \<longlongrightarrow> 0) sequentially" |
63558 | 328 |
using powser_times_n_limit_0 [of "inverse x"] |
329 |
by (simp add: norm_divide divide_simps) |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
330 |
|
53079 | 331 |
lemma sum_split_even_odd: |
332 |
fixes f :: "nat \<Rightarrow> real" |
|
63558 | 333 |
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
|
334 |
proof (induct n) |
53079 | 335 |
case 0 |
336 |
then show ?case by simp |
|
337 |
next |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
338 |
case (Suc n) |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
339 |
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
|
340 |
(\<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
|
341 |
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
|
342 |
also have "\<dots> = (\<Sum>i<Suc n. f (2 * i)) + (\<Sum>i<Suc n. g (2 * i + 1))" |
53079 | 343 |
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
|
344 |
finally show ?case . |
53079 | 345 |
qed |
346 |
||
347 |
lemma sums_if': |
|
348 |
fixes g :: "nat \<Rightarrow> real" |
|
349 |
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
|
350 |
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
|
351 |
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
|
352 |
proof (rule LIMSEQ_I) |
53079 | 353 |
fix r :: real |
354 |
assume "0 < r" |
|
60758 | 355 |
from \<open>g sums x\<close>[unfolded sums_def, THEN LIMSEQ_D, OF this] |
64267 | 356 |
obtain no where no_eq: "\<And>n. n \<ge> no \<Longrightarrow> (norm (sum g {..<n} - x) < r)" |
63558 | 357 |
by blast |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
358 |
|
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
359 |
let ?SUM = "\<lambda> m. \<Sum>i<m. if even i then 0 else g ((i - 1) div 2)" |
63558 | 360 |
have "(norm (?SUM m - x) < r)" if "m \<ge> 2 * no" for m |
361 |
proof - |
|
362 |
from that have "m div 2 \<ge> no" by auto |
|
64267 | 363 |
have sum_eq: "?SUM (2 * (m div 2)) = sum 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
|
364 |
using sum_split_even_odd by auto |
63558 | 365 |
then have "(norm (?SUM (2 * (m div 2)) - x) < r)" |
60758 | 366 |
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
|
367 |
moreover |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
368 |
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
|
369 |
proof (cases "even m") |
53079 | 370 |
case True |
63558 | 371 |
then show ?thesis |
372 |
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
|
373 |
next |
53079 | 374 |
case False |
58834 | 375 |
then have eq: "Suc (2 * (m div 2)) = m" by simp |
63558 | 376 |
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
|
377 |
have "?SUM m = ?SUM (Suc (2 * (m div 2)))" unfolding eq .. |
60758 | 378 |
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
|
379 |
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
|
380 |
qed |
63558 | 381 |
ultimately show ?thesis by auto |
382 |
qed |
|
383 |
then show "\<exists>no. \<forall> m \<ge> no. norm (?SUM m - x) < r" |
|
384 |
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
|
385 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
386 |
|
53079 | 387 |
lemma sums_if: |
388 |
fixes g :: "nat \<Rightarrow> real" |
|
389 |
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
|
390 |
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
|
391 |
proof - |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
392 |
let ?s = "\<lambda> n. if even n then 0 else f ((n - 1) div 2)" |
63558 | 393 |
have if_sum: "(if B then (0 :: real) else E) + (if B then T else 0) = (if B then T else E)" |
394 |
for B T E |
|
395 |
by (cases B) auto |
|
53079 | 396 |
have g_sums: "(\<lambda> n. if even n then 0 else g ((n - 1) div 2)) sums x" |
60758 | 397 |
using sums_if'[OF \<open>g sums x\<close>] . |
63558 | 398 |
have if_eq: "\<And>B T E. (if \<not> B then T else E) = (if B then E else T)" |
399 |
by auto |
|
400 |
have "?s sums y" using sums_if'[OF \<open>f sums y\<close>] . |
|
401 |
from this[unfolded sums_def, THEN LIMSEQ_Suc] |
|
402 |
have "(\<lambda>n. if even n then f (n div 2) else 0) sums y" |
|
64267 | 403 |
by (simp add: lessThan_Suc_eq_insert_0 sum_atLeast1_atMost_eq image_Suc_lessThan |
63566 | 404 |
if_eq sums_def cong del: if_weak_cong) |
63558 | 405 |
from sums_add[OF g_sums this] show ?thesis |
406 |
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
|
407 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
408 |
|
60758 | 409 |
subsection \<open>Alternating series test / Leibniz formula\<close> |
63558 | 410 |
(* 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
|
411 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
412 |
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
|
413 |
fixes a :: "nat \<Rightarrow> real" |
63558 | 414 |
assumes mono: "\<And>n. a (Suc n) \<le> a n" |
415 |
and a_pos: "\<And>n. 0 \<le> a n" |
|
416 |
and "a \<longlonglongrightarrow> 0" |
|
61969 | 417 |
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> |
418 |
((\<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
|
419 |
(is "\<exists>l. ((\<forall>n. ?f n \<le> l) \<and> _) \<and> ((\<forall>n. l \<le> ?g n) \<and> _)") |
53079 | 420 |
proof (rule nested_sequence_unique) |
63558 | 421 |
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
|
422 |
|
53079 | 423 |
show "\<forall>n. ?f n \<le> ?f (Suc n)" |
424 |
proof |
|
63558 | 425 |
show "?f n \<le> ?f (Suc n)" for n |
426 |
using mono[of "2*n"] by auto |
|
53079 | 427 |
qed |
428 |
show "\<forall>n. ?g (Suc n) \<le> ?g n" |
|
429 |
proof |
|
63558 | 430 |
show "?g (Suc n) \<le> ?g n" for n |
431 |
using mono[of "Suc (2*n)"] by auto |
|
53079 | 432 |
qed |
433 |
show "\<forall>n. ?f n \<le> ?g n" |
|
434 |
proof |
|
63558 | 435 |
show "?f n \<le> ?g n" for n |
436 |
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
|
437 |
qed |
63558 | 438 |
show "(\<lambda>n. ?f n - ?g n) \<longlonglongrightarrow> 0" |
439 |
unfolding fg_diff |
|
53079 | 440 |
proof (rule LIMSEQ_I) |
441 |
fix r :: real |
|
442 |
assume "0 < r" |
|
61969 | 443 |
with \<open>a \<longlonglongrightarrow> 0\<close>[THEN LIMSEQ_D] obtain N where "\<And> n. n \<ge> N \<Longrightarrow> norm (a n - 0) < r" |
53079 | 444 |
by auto |
63558 | 445 |
then have "\<forall>n \<ge> N. norm (- a (2 * n) - 0) < r" |
446 |
by auto |
|
447 |
then show "\<exists>N. \<forall>n \<ge> N. norm (- a (2 * n) - 0) < r" |
|
448 |
by auto |
|
53079 | 449 |
qed |
41970 | 450 |
qed |
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
451 |
|
53079 | 452 |
lemma summable_Leibniz': |
453 |
fixes a :: "nat \<Rightarrow> real" |
|
61969 | 454 |
assumes a_zero: "a \<longlonglongrightarrow> 0" |
63558 | 455 |
and a_pos: "\<And>n. 0 \<le> a n" |
456 |
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
|
457 |
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
|
458 |
and "\<And>n. (\<Sum>i<2*n. (-1)^i*a i) \<le> (\<Sum>i. (-1)^i*a i)" |
61969 | 459 |
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
|
460 |
and "\<And>n. (\<Sum>i. (-1)^i*a i) \<le> (\<Sum>i<2*n+1. (-1)^i*a i)" |
61969 | 461 |
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
|
462 |
proof - |
53079 | 463 |
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
|
464 |
let ?P = "\<lambda>n. \<Sum>i<n. ?S i" |
53079 | 465 |
let ?f = "\<lambda>n. ?P (2 * n)" |
466 |
let ?g = "\<lambda>n. ?P (2 * n + 1)" |
|
467 |
obtain l :: real |
|
468 |
where below_l: "\<forall> n. ?f n \<le> l" |
|
61969 | 469 |
and "?f \<longlonglongrightarrow> l" |
53079 | 470 |
and above_l: "\<forall> n. l \<le> ?g n" |
61969 | 471 |
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
|
472 |
using sums_alternating_upper_lower[OF a_monotone a_pos a_zero] by blast |
41970 | 473 |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
474 |
let ?Sa = "\<lambda>m. \<Sum>n<m. ?S n" |
61969 | 475 |
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
|
476 |
proof (rule LIMSEQ_I) |
53079 | 477 |
fix r :: real |
478 |
assume "0 < r" |
|
61969 | 479 |
with \<open>?f \<longlonglongrightarrow> l\<close>[THEN LIMSEQ_D] |
63558 | 480 |
obtain f_no where f: "\<And>n. n \<ge> f_no \<Longrightarrow> norm (?f n - l) < r" |
481 |
by auto |
|
61969 | 482 |
from \<open>0 < r\<close> \<open>?g \<longlonglongrightarrow> l\<close>[THEN LIMSEQ_D] |
63558 | 483 |
obtain g_no where g: "\<And>n. n \<ge> g_no \<Longrightarrow> norm (?g n - l) < r" |
484 |
by auto |
|
485 |
have "norm (?Sa n - l) < r" if "n \<ge> (max (2 * f_no) (2 * g_no))" for n |
|
486 |
proof - |
|
487 |
from that have "n \<ge> 2 * f_no" and "n \<ge> 2 * g_no" by auto |
|
488 |
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
|
489 |
proof (cases "even n") |
53079 | 490 |
case True |
63558 | 491 |
then have n_eq: "2 * (n div 2) = n" |
492 |
by (simp add: even_two_times_div_two) |
|
60758 | 493 |
with \<open>n \<ge> 2 * f_no\<close> have "n div 2 \<ge> f_no" |
53079 | 494 |
by auto |
495 |
from f[OF this] show ?thesis |
|
496 |
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
|
497 |
next |
53079 | 498 |
case False |
63558 | 499 |
then have "even (n - 1)" by simp |
58710
7216a10d69ba
augmented and tuned facts on even/odd and division
haftmann
parents:
58709
diff
changeset
|
500 |
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
|
501 |
by (simp add: even_two_times_div_two) |
63558 | 502 |
then have range_eq: "n - 1 + 1 = n" |
53079 | 503 |
using odd_pos[OF False] by auto |
60758 | 504 |
from n_eq \<open>n \<ge> 2 * g_no\<close> have "(n - 1) div 2 \<ge> g_no" |
53079 | 505 |
by auto |
506 |
from g[OF this] show ?thesis |
|
63558 | 507 |
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
|
508 |
qed |
63558 | 509 |
qed |
510 |
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
|
511 |
qed |
63558 | 512 |
then have sums_l: "(\<lambda>i. (-1)^i * a i) sums l" |
513 |
by (simp only: sums_def) |
|
514 |
then show "summable ?S" |
|
515 |
by (auto simp: summable_def) |
|
516 |
||
517 |
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
|
518 |
|
53079 | 519 |
fix n |
520 |
show "suminf ?S \<le> ?g n" |
|
521 |
unfolding sums_unique[OF sums_l, symmetric] using above_l by auto |
|
522 |
show "?f n \<le> suminf ?S" |
|
523 |
unfolding sums_unique[OF sums_l, symmetric] using below_l by auto |
|
61969 | 524 |
show "?g \<longlonglongrightarrow> suminf ?S" |
525 |
using \<open>?g \<longlonglongrightarrow> l\<close> \<open>l = suminf ?S\<close> by auto |
|
526 |
show "?f \<longlonglongrightarrow> suminf ?S" |
|
527 |
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
|
528 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
529 |
|
53079 | 530 |
theorem summable_Leibniz: |
531 |
fixes a :: "nat \<Rightarrow> real" |
|
63558 | 532 |
assumes a_zero: "a \<longlonglongrightarrow> 0" |
533 |
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
|
534 |
shows "summable (\<lambda> n. (-1)^n * a n)" (is "?summable") |
53079 | 535 |
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
|
536 |
(\<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 | 537 |
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
|
538 |
(\<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 | 539 |
and "(\<lambda>n. \<Sum>i<2*n. (- 1)^i*a i) \<longlonglongrightarrow> (\<Sum>i. (- 1)^i*a i)" (is "?f") |
540 |
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
|
541 |
proof - |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
542 |
have "?summable \<and> ?pos \<and> ?neg \<and> ?f \<and> ?g" |
63558 | 543 |
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
|
544 |
case True |
63558 | 545 |
then have ord: "\<And>n m. m \<le> n \<Longrightarrow> a n \<le> a m" |
546 |
and ge0: "\<And>n. 0 \<le> a n" |
|
53079 | 547 |
by auto |
63558 | 548 |
have mono: "a (Suc n) \<le> a n" for n |
549 |
using ord[where n="Suc n" and m=n] by auto |
|
61969 | 550 |
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
|
551 |
from leibniz[OF mono] |
60758 | 552 |
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
|
553 |
next |
63558 | 554 |
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
|
555 |
case False |
61969 | 556 |
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
|
557 |
have "(\<forall> n. a n \<le> 0) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n)" by auto |
63558 | 558 |
then have ord: "\<And>n m. m \<le> n \<Longrightarrow> ?a n \<le> ?a m" and ge0: "\<And> n. 0 \<le> ?a n" |
53079 | 559 |
by auto |
63558 | 560 |
have monotone: "?a (Suc n) \<le> ?a n" for n |
561 |
using ord[where n="Suc n" and m=n] by auto |
|
53079 | 562 |
note leibniz = |
563 |
summable_Leibniz'[OF _ ge0, of "\<lambda>x. x", |
|
61969 | 564 |
OF tendsto_minus[OF \<open>a \<longlonglongrightarrow> 0\<close>, unfolded minus_zero] monotone] |
53079 | 565 |
have "summable (\<lambda> n. (-1)^n * ?a n)" |
566 |
using leibniz(1) by auto |
|
567 |
then obtain l where "(\<lambda> n. (-1)^n * ?a n) sums l" |
|
568 |
unfolding summable_def by auto |
|
569 |
from this[THEN sums_minus] have "(\<lambda> n. (-1)^n * a n) sums -l" |
|
570 |
by auto |
|
63558 | 571 |
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
|
572 |
moreover |
63558 | 573 |
have "\<bar>- a - - b\<bar> = \<bar>a - b\<bar>" for a b :: real |
53079 | 574 |
unfolding minus_diff_minus by auto |
41970 | 575 |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
576 |
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
|
577 |
have move_minus: "(\<Sum>n. - ((- 1) ^ n * a n)) = - (\<Sum>n. (- 1) ^ n * a n)" |
53079 | 578 |
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
|
579 |
|
60758 | 580 |
have ?pos using \<open>0 \<le> ?a 0\<close> by auto |
53079 | 581 |
moreover have ?neg |
582 |
using leibniz(2,4) |
|
64267 | 583 |
unfolding mult_minus_right sum_negf move_minus neg_le_iff_le |
53079 | 584 |
by auto |
585 |
moreover have ?f and ?g |
|
64267 | 586 |
using leibniz(3,5)[unfolded mult_minus_right sum_negf move_minus, THEN tendsto_minus_cancel] |
53079 | 587 |
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
|
588 |
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
|
589 |
qed |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
590 |
then show ?summable and ?pos and ?neg and ?f and ?g |
54573 | 591 |
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
|
592 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
593 |
|
63558 | 594 |
|
60758 | 595 |
subsection \<open>Term-by-Term Differentiability of Power Series\<close> |
23043 | 596 |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
597 |
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
|
598 |
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
|
599 |
|
63558 | 600 |
text \<open>Lemma about distributing negation over it.\<close> |
53079 | 601 |
lemma diffs_minus: "diffs (\<lambda>n. - c n) = (\<lambda>n. - diffs c n)" |
602 |
by (simp add: diffs_def) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
603 |
|
15229 | 604 |
lemma diffs_equiv: |
63558 | 605 |
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
|
606 |
shows "summable (\<lambda>n. diffs c n * x^n) \<Longrightarrow> |
63558 | 607 |
(\<lambda>n. of_nat n * c n * x^(n - Suc 0)) sums (\<Sum>n. diffs c n * x^n)" |
53079 | 608 |
unfolding diffs_def |
54573 | 609 |
by (simp add: summable_sums sums_Suc_imp) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
610 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
611 |
lemma lemma_termdiff1: |
63558 | 612 |
fixes z :: "'a :: {monoid_mult,comm_ring}" |
613 |
shows "(\<Sum>p<m. (((z + h) ^ (m - p)) * (z ^ p)) - (z ^ m)) = |
|
614 |
(\<Sum>p<m. (z ^ p) * (((z + h) ^ (m - p)) - (z ^ (m - p))))" |
|
53079 | 615 |
by (auto simp add: algebra_simps power_add [symmetric]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
616 |
|
64267 | 617 |
lemma sumr_diff_mult_const2: "sum f {..<n} - of_nat n * r = (\<Sum>i<n. f i - r)" |
63558 | 618 |
for r :: "'a::ring_1" |
64267 | 619 |
by (simp add: sum_subtractf) |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
620 |
|
60162 | 621 |
lemma lemma_realpow_rev_sumr: |
63558 | 622 |
"(\<Sum>p<Suc n. (x ^ p) * (y ^ (n - p))) = (\<Sum>p<Suc n. (x ^ (n - p)) * (y ^ p))" |
64267 | 623 |
by (subst nat_diff_sum_reindex[symmetric]) simp |
60162 | 624 |
|
15229 | 625 |
lemma lemma_termdiff2: |
63558 | 626 |
fixes h :: "'a::field" |
53079 | 627 |
assumes h: "h \<noteq> 0" |
63558 | 628 |
shows "((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0) = |
629 |
h * (\<Sum>p< n - Suc 0. \<Sum>q< n - Suc 0 - p. (z + h) ^ q * z ^ (n - 2 - q))" |
|
630 |
(is "?lhs = ?rhs") |
|
631 |
apply (subgoal_tac "h * ?lhs = h * ?rhs") |
|
632 |
apply (simp add: h) |
|
53079 | 633 |
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
|
634 |
apply (simp add: mult.assoc [symmetric]) |
63558 | 635 |
apply (cases n) |
636 |
apply simp |
|
64267 | 637 |
apply (simp add: diff_power_eq_sum h right_diff_distrib [symmetric] mult.assoc |
638 |
del: power_Suc sum_lessThan_Suc of_nat_Suc) |
|
53079 | 639 |
apply (subst lemma_realpow_rev_sumr) |
640 |
apply (subst sumr_diff_mult_const2) |
|
641 |
apply simp |
|
64267 | 642 |
apply (simp only: lemma_termdiff1 sum_distrib_left) |
643 |
apply (rule sum.cong [OF refl]) |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
644 |
apply (simp add: less_iff_Suc_add) |
63558 | 645 |
apply clarify |
64267 | 646 |
apply (simp add: sum_distrib_left diff_power_eq_sum ac_simps |
647 |
del: sum_lessThan_Suc power_Suc) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
648 |
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
|
649 |
apply (simp add: ac_simps) |
53079 | 650 |
done |
20860 | 651 |
|
64267 | 652 |
lemma real_sum_nat_ivl_bounded2: |
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
34974
diff
changeset
|
653 |
fixes K :: "'a::linordered_semidom" |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
654 |
assumes f: "\<And>p::nat. p < n \<Longrightarrow> f p \<le> K" |
53079 | 655 |
and K: "0 \<le> K" |
64267 | 656 |
shows "sum f {..<n-k} \<le> of_nat n * K" |
657 |
apply (rule order_trans [OF sum_mono]) |
|
63558 | 658 |
apply (rule f) |
659 |
apply simp |
|
53079 | 660 |
apply (simp add: mult_right_mono K) |
661 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
662 |
|
15229 | 663 |
lemma lemma_termdiff3: |
63558 | 664 |
fixes h z :: "'a::real_normed_field" |
20860 | 665 |
assumes 1: "h \<noteq> 0" |
53079 | 666 |
and 2: "norm z \<le> K" |
667 |
and 3: "norm (z + h) \<le> K" |
|
63558 | 668 |
shows "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) \<le> |
669 |
of_nat n * of_nat (n - Suc 0) * K ^ (n - 2) * norm h" |
|
20860 | 670 |
proof - |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
671 |
have "norm (((z + h) ^ n - z ^ n) / h - of_nat n * z ^ (n - Suc 0)) = |
63558 | 672 |
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
|
673 |
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
|
674 |
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
|
675 |
proof (rule mult_right_mono [OF _ norm_ge_zero]) |
53079 | 676 |
from norm_ge_zero 2 have K: "0 \<le> K" |
677 |
by (rule order_trans) |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
678 |
have le_Kn: "\<And>i j n. i + j = n \<Longrightarrow> norm ((z + h) ^ i * z ^ j) \<le> K ^ n" |
20860 | 679 |
apply (erule subst) |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
680 |
apply (simp only: norm_mult norm_power power_add) |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
681 |
apply (intro mult_mono power_mono 2 3 norm_ge_zero zero_le_power K) |
20860 | 682 |
done |
63558 | 683 |
show "norm (\<Sum>p<n - Suc 0. \<Sum>q<n - Suc 0 - p. (z + h) ^ q * z ^ (n - 2 - q)) \<le> |
684 |
of_nat n * (of_nat (n - Suc 0) * K ^ (n - 2))" |
|
20860 | 685 |
apply (intro |
64267 | 686 |
order_trans [OF norm_sum] |
687 |
real_sum_nat_ivl_bounded2 |
|
63558 | 688 |
mult_nonneg_nonneg |
689 |
of_nat_0_le_iff |
|
690 |
zero_le_power K) |
|
691 |
apply (rule le_Kn) |
|
692 |
apply simp |
|
20860 | 693 |
done |
694 |
qed |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
695 |
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
|
696 |
by (simp only: mult.assoc) |
20860 | 697 |
finally show ?thesis . |
698 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
699 |
|
20860 | 700 |
lemma lemma_termdiff4: |
56167 | 701 |
fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" |
63558 | 702 |
and k :: real |
703 |
assumes k: "0 < k" |
|
704 |
and le: "\<And>h. h \<noteq> 0 \<Longrightarrow> norm h < k \<Longrightarrow> norm (f h) \<le> K * norm h" |
|
61976 | 705 |
shows "f \<midarrow>0\<rightarrow> 0" |
56167 | 706 |
proof (rule tendsto_norm_zero_cancel) |
61976 | 707 |
show "(\<lambda>h. norm (f h)) \<midarrow>0\<rightarrow> 0" |
56167 | 708 |
proof (rule real_tendsto_sandwich) |
709 |
show "eventually (\<lambda>h. 0 \<le> norm (f h)) (at 0)" |
|
20860 | 710 |
by simp |
56167 | 711 |
show "eventually (\<lambda>h. norm (f h) \<le> K * norm h) (at 0)" |
712 |
using k by (auto simp add: eventually_at dist_norm le) |
|
61976 | 713 |
show "(\<lambda>h. 0) \<midarrow>(0::'a)\<rightarrow> (0::real)" |
56167 | 714 |
by (rule tendsto_const) |
61976 | 715 |
have "(\<lambda>h. K * norm h) \<midarrow>(0::'a)\<rightarrow> K * norm (0::'a)" |
56167 | 716 |
by (intro tendsto_intros) |
61976 | 717 |
then show "(\<lambda>h. K * norm h) \<midarrow>(0::'a)\<rightarrow> 0" |
56167 | 718 |
by simp |
20860 | 719 |
qed |
720 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
721 |
|
15229 | 722 |
lemma lemma_termdiff5: |
56167 | 723 |
fixes g :: "'a::real_normed_vector \<Rightarrow> nat \<Rightarrow> 'b::banach" |
63558 | 724 |
and k :: real |
725 |
assumes k: "0 < k" |
|
726 |
and f: "summable f" |
|
727 |
and le: "\<And>h n. h \<noteq> 0 \<Longrightarrow> norm h < k \<Longrightarrow> norm (g h n) \<le> f n * norm h" |
|
61976 | 728 |
shows "(\<lambda>h. suminf (g h)) \<midarrow>0\<rightarrow> 0" |
20860 | 729 |
proof (rule lemma_termdiff4 [OF k]) |
63558 | 730 |
fix h :: 'a |
53079 | 731 |
assume "h \<noteq> 0" and "norm h < k" |
63558 | 732 |
then have 1: "\<forall>n. norm (g h n) \<le> f n * norm h" |
20860 | 733 |
by (simp add: le) |
63558 | 734 |
then have "\<exists>N. \<forall>n\<ge>N. norm (norm (g h n)) \<le> f n * norm h" |
20860 | 735 |
by simp |
63558 | 736 |
moreover from f have 2: "summable (\<lambda>n. f n * norm h)" |
20860 | 737 |
by (rule summable_mult2) |
63558 | 738 |
ultimately have 3: "summable (\<lambda>n. norm (g h n))" |
20860 | 739 |
by (rule summable_comparison_test) |
63558 | 740 |
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
|
741 |
by (rule summable_norm) |
63558 | 742 |
also from 1 3 2 have "(\<Sum>n. norm (g h n)) \<le> (\<Sum>n. f n * norm h)" |
56213 | 743 |
by (rule suminf_le) |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
744 |
also from f have "(\<Sum>n. f n * norm h) = suminf f * norm h" |
20860 | 745 |
by (rule suminf_mult2 [symmetric]) |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
746 |
finally show "norm (suminf (g h)) \<le> suminf f * norm h" . |
20860 | 747 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
748 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
749 |
|
63558 | 750 |
(* FIXME: Long proofs *) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
751 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
752 |
lemma termdiffs_aux: |
31017 | 753 |
fixes x :: "'a::{real_normed_field,banach}" |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
754 |
assumes 1: "summable (\<lambda>n. diffs (diffs c) n * K ^ n)" |
53079 | 755 |
and 2: "norm x < norm K" |
63558 | 756 |
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
|
757 |
proof - |
63558 | 758 |
from dense [OF 2] obtain r where r1: "norm x < r" and r2: "r < norm K" |
759 |
by fast |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
760 |
from norm_ge_zero r1 have r: "0 < r" |
20860 | 761 |
by (rule order_le_less_trans) |
63558 | 762 |
then have r_neq_0: "r \<noteq> 0" by simp |
20860 | 763 |
show ?thesis |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
764 |
proof (rule lemma_termdiff5) |
63558 | 765 |
show "0 < r - norm x" |
766 |
using r1 by simp |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
767 |
from r r2 have "norm (of_real r::'a) < norm K" |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
768 |
by simp |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
769 |
with 1 have "summable (\<lambda>n. norm (diffs (diffs c) n * (of_real r ^ n)))" |
20860 | 770 |
by (rule powser_insidea) |
63558 | 771 |
then have "summable (\<lambda>n. diffs (diffs (\<lambda>n. norm (c n))) n * r ^ n)" |
772 |
using r by (simp add: diffs_def norm_mult norm_power del: of_nat_Suc) |
|
773 |
then have "summable (\<lambda>n. of_nat n * diffs (\<lambda>n. norm (c n)) n * r ^ (n - Suc 0))" |
|
20860 | 774 |
by (rule diffs_equiv [THEN sums_summable]) |
53079 | 775 |
also have "(\<lambda>n. of_nat n * diffs (\<lambda>n. norm (c n)) n * r ^ (n - Suc 0)) = |
776 |
(\<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
|
777 |
apply (rule ext) |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
778 |
apply (simp add: diffs_def) |
63558 | 779 |
apply (case_tac n) |
780 |
apply (simp_all add: r_neq_0) |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
781 |
done |
41970 | 782 |
finally have "summable |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
783 |
(\<lambda>n. of_nat n * (of_nat (n - Suc 0) * norm (c n) * inverse r) * r ^ (n - Suc 0))" |
20860 | 784 |
by (rule diffs_equiv [THEN sums_summable]) |
785 |
also have |
|
63558 | 786 |
"(\<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
|
787 |
(\<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
|
788 |
apply (rule ext) |
63558 | 789 |
apply (case_tac n) |
790 |
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
|
791 |
apply (rename_tac nat) |
63558 | 792 |
apply (case_tac nat) |
793 |
apply simp |
|
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
794 |
apply (simp add: r_neq_0) |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
795 |
done |
63558 | 796 |
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
|
797 |
next |
63558 | 798 |
fix h :: 'a |
799 |
fix n :: nat |
|
20860 | 800 |
assume h: "h \<noteq> 0" |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
801 |
assume "norm h < r - norm x" |
63558 | 802 |
then have "norm x + norm h < r" by simp |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
803 |
with norm_triangle_ineq have xh: "norm (x + h) < r" |
20860 | 804 |
by (rule order_le_less_trans) |
63558 | 805 |
show "norm (c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0))) \<le> |
806 |
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
|
807 |
apply (simp only: norm_mult mult.assoc) |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
808 |
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
|
809 |
apply (simp add: mult.assoc [symmetric]) |
54575 | 810 |
apply (metis h lemma_termdiff3 less_eq_real_def r1 xh) |
20860 | 811 |
done |
20849
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
812 |
qed |
389cd9c8cfe1
rewrite proofs of powser_insidea and termdiffs_aux
huffman
parents:
20692
diff
changeset
|
813 |
qed |
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
814 |
|
20860 | 815 |
lemma termdiffs: |
31017 | 816 |
fixes K x :: "'a::{real_normed_field,banach}" |
20860 | 817 |
assumes 1: "summable (\<lambda>n. c n * K ^ n)" |
63558 | 818 |
and 2: "summable (\<lambda>n. (diffs c) n * K ^ n)" |
819 |
and 3: "summable (\<lambda>n. (diffs (diffs c)) n * K ^ n)" |
|
820 |
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
|
821 |
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
|
822 |
unfolding DERIV_def |
29163 | 823 |
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
|
824 |
show "(\<lambda>h. (suminf (\<lambda>n. c n * (x + h) ^ n) - suminf (\<lambda>n. c n * x^n)) / h |
61976 | 825 |
- suminf (\<lambda>n. diffs c n * x^n)) \<midarrow>0\<rightarrow> 0" |
20860 | 826 |
proof (rule LIM_equal2) |
63558 | 827 |
show "0 < norm K - norm x" |
828 |
using 4 by (simp add: less_diff_eq) |
|
20860 | 829 |
next |
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
830 |
fix h :: 'a |
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
831 |
assume "norm (h - 0) < norm K - norm x" |
63558 | 832 |
then have "norm x + norm h < norm K" by simp |
833 |
then have 5: "norm (x + h) < norm K" |
|
23082
ffef77eed382
generalize powerseries and termdiffs lemmas using axclasses
huffman
parents:
23069
diff
changeset
|
834 |
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
|
835 |
have "summable (\<lambda>n. c n * x^n)" |
56167 | 836 |
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
|
837 |
and "summable (\<lambda>n. diffs c n * x^n)" |
56167 | 838 |
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
|
839 |
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
|
840 |
(\<Sum>n. (c n * (x + h) ^ n - c n * x^n) / h - of_nat n * c n * x ^ (n - Suc 0))" |
56167 | 841 |
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
|
842 |
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
|
843 |
(\<Sum>n. c n * (((x + h) ^ n - x^n) / h - of_nat n * x ^ (n - Suc 0)))" |
54575 | 844 |
by (simp add: algebra_simps) |
20860 | 845 |
next |
61976 | 846 |
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 | 847 |
by (rule termdiffs_aux [OF 3 4]) |
20860 | 848 |
qed |
849 |
qed |
|
850 |
||
60758 | 851 |
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
|
852 |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
853 |
lemma termdiff_converges: |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
854 |
fixes x :: "'a::{real_normed_field,banach}" |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
855 |
assumes K: "norm x < K" |
63558 | 856 |
and sm: "\<And>x. norm x < K \<Longrightarrow> summable(\<lambda>n. c n * x ^ n)" |
857 |
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
|
858 |
proof (cases "x = 0") |
63558 | 859 |
case True |
860 |
then show ?thesis |
|
861 |
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
|
862 |
next |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
863 |
case False |
63558 | 864 |
then have "K > 0" |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
865 |
using K less_trans zero_less_norm_iff by blast |
63558 | 866 |
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
|
867 |
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
|
868 |
by (auto simp: field_simps abs_less_iff add_pos_pos intro: that [of "(norm x + K) / 2"]) |
61969 | 869 |
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
|
870 |
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
|
871 |
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
|
872 |
using r unfolding LIMSEQ_iff |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
873 |
apply (drule_tac x=1 in spec) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
874 |
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
|
875 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
876 |
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
|
877 |
apply (rule summable_comparison_test' [of "\<lambda>n. norm(c n * (of_real r) ^ n)" N]) |
63558 | 878 |
apply (rule powser_insidea [OF sm [of "of_real ((r+K)/2)"]]) |
879 |
using N r norm_of_real [of "r + K", where 'a = 'a] |
|
880 |
apply (auto simp add: norm_divide norm_mult norm_power field_simps) |
|
881 |
apply (fastforce simp: less_eq_real_def) |
|
882 |
done |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
883 |
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
|
884 |
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
|
885 |
by simp |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
886 |
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
|
887 |
using False summable_mult2 [of "\<lambda>n. (of_nat (Suc n) * c(Suc n) * x ^ n) * x" "inverse x"] |
60867 | 888 |
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
|
889 |
then show ?thesis |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
890 |
by (simp add: diffs_def) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
891 |
qed |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
892 |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
893 |
lemma termdiff_converges_all: |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
894 |
fixes x :: "'a::{real_normed_field,banach}" |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
895 |
assumes "\<And>x. summable (\<lambda>n. c n * x^n)" |
63558 | 896 |
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
|
897 |
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
|
898 |
using assms |
63558 | 899 |
apply auto |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
900 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
901 |
|
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
902 |
lemma termdiffs_strong: |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
903 |
fixes K x :: "'a::{real_normed_field,banach}" |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
904 |
assumes sm: "summable (\<lambda>n. c n * K ^ n)" |
63558 | 905 |
and K: "norm x < norm K" |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
906 |
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
|
907 |
proof - |
60762 | 908 |
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
|
909 |
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
|
910 |
apply (auto simp: norm_divide field_simps) |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
911 |
apply (rule le_less_trans [of _ "of_real (norm K) + of_real (norm x)"]) |
63558 | 912 |
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
|
913 |
done |
60762 | 914 |
then have [simp]: "norm ((of_real (norm K) + of_real (norm x)) :: 'a) < norm K * 2" |
915 |
by simp |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
916 |
have "summable (\<lambda>n. c n * (of_real (norm x + norm K) / 2) ^ n)" |
60762 | 917 |
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
|
918 |
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
|
919 |
by (blast intro: sm termdiff_converges powser_inside) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
920 |
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
|
921 |
by (blast intro: sm termdiff_converges powser_inside) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
922 |
ultimately show ?thesis |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
923 |
apply (rule termdiffs [where K = "of_real (norm x + norm K) / 2"]) |
63558 | 924 |
apply (auto simp: field_simps) |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
925 |
using K |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
926 |
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
|
927 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
928 |
qed |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
929 |
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
930 |
lemma termdiffs_strong_converges_everywhere: |
63558 | 931 |
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
|
932 |
assumes "\<And>y. summable (\<lambda>n. c n * y ^ n)" |
63558 | 933 |
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
|
934 |
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
|
935 |
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
|
936 |
|
63721 | 937 |
lemma termdiffs_strong': |
938 |
fixes z :: "'a :: {real_normed_field,banach}" |
|
939 |
assumes "\<And>z. norm z < K \<Longrightarrow> summable (\<lambda>n. c n * z ^ n)" |
|
940 |
assumes "norm z < K" |
|
941 |
shows "((\<lambda>z. \<Sum>n. c n * z^n) has_field_derivative (\<Sum>n. diffs c n * z^n)) (at z)" |
|
942 |
proof (rule termdiffs_strong) |
|
943 |
define L :: real where "L = (norm z + K) / 2" |
|
944 |
have "0 \<le> norm z" by simp |
|
945 |
also note \<open>norm z < K\<close> |
|
946 |
finally have K: "K \<ge> 0" by simp |
|
947 |
from assms K have L: "L \<ge> 0" "norm z < L" "L < K" by (simp_all add: L_def) |
|
948 |
from L show "norm z < norm (of_real L :: 'a)" by simp |
|
949 |
from L show "summable (\<lambda>n. c n * of_real L ^ n)" by (intro assms(1)) simp_all |
|
950 |
qed |
|
951 |
||
952 |
lemma termdiffs_sums_strong: |
|
953 |
fixes z :: "'a :: {banach,real_normed_field}" |
|
954 |
assumes sums: "\<And>z. norm z < K \<Longrightarrow> (\<lambda>n. c n * z ^ n) sums f z" |
|
955 |
assumes deriv: "(f has_field_derivative f') (at z)" |
|
956 |
assumes norm: "norm z < K" |
|
957 |
shows "(\<lambda>n. diffs c n * z ^ n) sums f'" |
|
958 |
proof - |
|
959 |
have summable: "summable (\<lambda>n. diffs c n * z^n)" |
|
960 |
by (intro termdiff_converges[OF norm] sums_summable[OF sums]) |
|
961 |
from norm have "eventually (\<lambda>z. z \<in> norm -` {..<K}) (nhds z)" |
|
962 |
by (intro eventually_nhds_in_open open_vimage) |
|
963 |
(simp_all add: continuous_on_norm continuous_on_id) |
|
964 |
hence eq: "eventually (\<lambda>z. (\<Sum>n. c n * z^n) = f z) (nhds z)" |
|
965 |
by eventually_elim (insert sums, simp add: sums_iff) |
|
966 |
||
967 |
have "((\<lambda>z. \<Sum>n. c n * z^n) has_field_derivative (\<Sum>n. diffs c n * z^n)) (at z)" |
|
968 |
by (intro termdiffs_strong'[OF _ norm] sums_summable[OF sums]) |
|
969 |
hence "(f has_field_derivative (\<Sum>n. diffs c n * z^n)) (at z)" |
|
970 |
by (subst (asm) DERIV_cong_ev[OF refl eq refl]) |
|
971 |
from this and deriv have "(\<Sum>n. diffs c n * z^n) = f'" by (rule DERIV_unique) |
|
972 |
with summable show ?thesis by (simp add: sums_iff) |
|
973 |
qed |
|
974 |
||
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
975 |
lemma isCont_powser: |
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
976 |
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
|
977 |
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
|
978 |
assumes "norm x < norm K" |
63558 | 979 |
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
|
980 |
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
|
981 |
|
61552
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
982 |
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
|
983 |
|
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
984 |
lemma isCont_powser_converges_everywhere: |
980dd46a03fb
Added binomial identities to CONTRIBUTORS; small lemmas on of_int/pochhammer
eberlm
parents:
61531
diff
changeset
|
985 |
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
|
986 |
assumes "\<And>y. summable (\<lambda>n. c n * y ^ n)" |
63558 | 987 |
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
|
988 |
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
|
989 |
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
|
990 |
|
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
|
991 |
lemma powser_limit_0: |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
992 |
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
|
993 |
assumes s: "0 < s" |
63558 | 994 |
and sm: "\<And>x. norm x < s \<Longrightarrow> (\<lambda>n. a n * x ^ n) sums (f x)" |
995 |
shows "(f \<longlongrightarrow> a 0) (at 0)" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
996 |
proof - |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
997 |
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
|
998 |
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
|
999 |
using s |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1000 |
apply (auto simp: norm_divide) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1001 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1002 |
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
|
1003 |
apply (rule termdiffs_strong) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1004 |
using s |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1005 |
apply (auto simp: norm_divide) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1006 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1007 |
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
|
1008 |
by (blast intro: DERIV_continuous) |
61973 | 1009 |
then have "((\<lambda>x. \<Sum>n. a n * x ^ n) \<longlongrightarrow> a 0) (at 0)" |
63558 | 1010 |
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
|
1011 |
then show ?thesis |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1012 |
apply (rule Lim_transform) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1013 |
apply (auto simp add: LIM_eq) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1014 |
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
|
1015 |
using s |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1016 |
apply (auto simp: sm [THEN sums_unique]) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1017 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1018 |
qed |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1019 |
|
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
|
1020 |
lemma powser_limit_0_strong: |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1021 |
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
|
1022 |
assumes s: "0 < s" |
63558 | 1023 |
and sm: "\<And>x. x \<noteq> 0 \<Longrightarrow> norm x < s \<Longrightarrow> (\<lambda>n. a n * x ^ n) sums (f x)" |
1024 |
shows "(f \<longlongrightarrow> a 0) (at 0)" |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1025 |
proof - |
61973 | 1026 |
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
|
1027 |
apply (rule powser_limit_0 [OF s]) |
63558 | 1028 |
apply (case_tac "x = 0") |
1029 |
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
|
1030 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1031 |
show ?thesis |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1032 |
apply (subst LIM_equal [where g = "(\<lambda>x. if x = 0 then a 0 else f x)"]) |
63558 | 1033 |
apply (simp_all add: *) |
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1034 |
done |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1035 |
qed |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1036 |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1037 |
|
60758 | 1038 |
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
|
1039 |
|
53079 | 1040 |
lemma DERIV_series': |
1041 |
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
|
1042 |
assumes DERIV_f: "\<And> n. DERIV (\<lambda> x. f x n) x0 :> (f' x0 n)" |
63558 | 1043 |
and allf_summable: "\<And> x. x \<in> {a <..< b} \<Longrightarrow> summable (f x)" |
1044 |
and x0_in_I: "x0 \<in> {a <..< b}" |
|
53079 | 1045 |
and "summable (f' x0)" |
1046 |
and "summable L" |
|
63558 | 1047 |
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
|
1048 |
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
|
1049 |
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
|
1050 |
proof (rule LIM_I) |
53079 | 1051 |
fix r :: real |
63558 | 1052 |
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
|
1053 |
|
41970 | 1054 |
obtain N_L where N_L: "\<And> n. N_L \<le> n \<Longrightarrow> \<bar> \<Sum> i. L (i + n) \<bar> < r/3" |
60758 | 1055 |
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
|
1056 |
|
41970 | 1057 |
obtain N_f' where N_f': "\<And> n. N_f' \<le> n \<Longrightarrow> \<bar> \<Sum> i. f' x0 (i + n) \<bar> < r/3" |
60758 | 1058 |
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
|
1059 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1060 |
let ?N = "Suc (max N_L N_f')" |
63558 | 1061 |
have "\<bar> \<Sum> i. f' x0 (i + ?N) \<bar> < r/3" (is "?f'_part < r/3") |
1062 |
and L_estimate: "\<bar> \<Sum> i. L (i + ?N) \<bar> < r/3" |
|
1063 |
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
|
1064 |
|
53079 | 1065 |
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
|
1066 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1067 |
let ?r = "r / (3 * real ?N)" |
60758 | 1068 |
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
|
1069 |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1070 |
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 | 1071 |
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
|
1072 |
|
63558 | 1073 |
have "0 < S'" |
1074 |
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
|
1075 |
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
|
1076 |
show "\<forall>x \<in> (?s ` {..< ?N }). 0 < x" |
53079 | 1077 |
proof |
1078 |
fix x |
|
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1079 |
assume "x \<in> ?s ` {..<?N}" |
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1080 |
then obtain n where "x = ?s n" and "n \<in> {..<?N}" |
53079 | 1081 |
using image_iff[THEN iffD1] by blast |
60758 | 1082 |
from DERIV_D[OF DERIV_f[where n=n], THEN LIM_D, OF \<open>0 < ?r\<close>, unfolded real_norm_def] |
53079 | 1083 |
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)" |
1084 |
by auto |
|
63558 | 1085 |
have "0 < ?s n" |
1086 |
by (rule someI2[where a=s]) (auto simp add: s_bound simp del: of_nat_Suc) |
|
1087 |
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
|
1088 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1089 |
qed auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1090 |
|
63040 | 1091 |
define S where "S = min (min (x0 - a) (b - x0)) S'" |
63558 | 1092 |
then have "0 < S" and S_a: "S \<le> x0 - a" and S_b: "S \<le> b - x0" |
60758 | 1093 |
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
|
1094 |
by auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1095 |
|
63558 | 1096 |
have "\<bar>(suminf (f (x0 + x)) - suminf (f x0)) / x - suminf (f' x0)\<bar> < r" |
1097 |
if "x \<noteq> 0" and "\<bar>x\<bar> < S" for x |
|
1098 |
proof - |
|
1099 |
from that have x_in_I: "x0 + x \<in> {a <..< b}" |
|
53079 | 1100 |
using S_a S_b by auto |
41970 | 1101 |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1102 |
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
|
1103 |
note div_smbl = summable_divide[OF diff_smbl] |
60758 | 1104 |
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
|
1105 |
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
|
1106 |
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
|
1107 |
note div_shft_smbl = summable_divide[OF diff_shft_smbl] |
60758 | 1108 |
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
|
1109 |
|
63558 | 1110 |
have 1: "\<bar>(\<bar>?diff (n + ?N) x\<bar>)\<bar> \<le> L (n + ?N)" for n |
1111 |
proof - |
|
1112 |
have "\<bar>?diff (n + ?N) x\<bar> \<le> L (n + ?N) * \<bar>(x0 + x) - x0\<bar> / \<bar>x\<bar>" |
|
53079 | 1113 |
using divide_right_mono[OF L_def[OF x_in_I x0_in_I] abs_ge_zero] |
63558 | 1114 |
by (simp only: abs_divide) |
1115 |
with \<open>x \<noteq> 0\<close> show ?thesis by auto |
|
1116 |
qed |
|
1117 |
note 2 = summable_rabs_comparison_test[OF _ ign[OF \<open>summable L\<close>]] |
|
1118 |
from 1 have "\<bar> \<Sum> i. ?diff (i + ?N) x \<bar> \<le> (\<Sum> i. L (i + ?N))" |
|
1119 |
by (metis (lifting) abs_idempotent |
|
1120 |
order_trans[OF summable_rabs[OF 2] suminf_le[OF _ 2 ign[OF \<open>summable L\<close>]]]) |
|
1121 |
then have "\<bar>\<Sum>i. ?diff (i + ?N) x\<bar> \<le> r / 3" (is "?L_part \<le> r/3") |
|
53079 | 1122 |
using L_estimate by auto |
1123 |
||
63558 | 1124 |
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
|
1125 |
also have "\<dots> < (\<Sum>n<?N. ?r)" |
64267 | 1126 |
proof (rule sum_strict_mono) |
53079 | 1127 |
fix n |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1128 |
assume "n \<in> {..< ?N}" |
60758 | 1129 |
have "\<bar>x\<bar> < S" using \<open>\<bar>x\<bar> < S\<close> . |
1130 |
also have "S \<le> S'" using \<open>S \<le> S'\<close> . |
|
63558 | 1131 |
also have "S' \<le> ?s n" |
1132 |
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
|
1133 |
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
|
1134 |
have "?s n \<in> (?s ` {..<?N}) \<and> ?s n \<le> ?s n" |
60758 | 1135 |
using \<open>n \<in> {..< ?N}\<close> by auto |
63558 | 1136 |
then show "\<exists> a \<in> (?s ` {..<?N}). a \<le> ?s n" |
1137 |
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
|
1138 |
qed auto |
53079 | 1139 |
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
|
1140 |
|
63558 | 1141 |
from DERIV_D[OF DERIV_f[where n=n], THEN LIM_D, OF \<open>0 < ?r\<close>, |
1142 |
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
|
1143 |
have "\<forall>x. x \<noteq> 0 \<and> \<bar>x\<bar> < ?s n \<longrightarrow> \<bar>?diff n x - f' x0 n\<bar> < ?r" . |
60758 | 1144 |
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 | 1145 |
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
|
1146 |
qed auto |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1147 |
also have "\<dots> = of_nat (card {..<?N}) * ?r" |
64267 | 1148 |
by (rule sum_constant) |
63558 | 1149 |
also have "\<dots> = real ?N * ?r" |
1150 |
by simp |
|
1151 |
also have "\<dots> = r/3" |
|
1152 |
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
|
1153 |
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
|
1154 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1155 |
from suminf_diff[OF allf_summable[OF x_in_I] allf_summable[OF x0_in_I]] |
53079 | 1156 |
have "\<bar>(suminf (f (x0 + x)) - (suminf (f x0))) / x - suminf (f' x0)\<bar> = |
1157 |
\<bar>\<Sum>n. ?diff n x - f' x0 n\<bar>" |
|
60758 | 1158 |
unfolding suminf_diff[OF div_smbl \<open>summable (f' x0)\<close>, symmetric] |
53079 | 1159 |
using suminf_divide[OF diff_smbl, symmetric] by auto |
63558 | 1160 |
also have "\<dots> \<le> ?diff_part + \<bar>(\<Sum>n. ?diff (n + ?N) x) - (\<Sum> n. f' x0 (n + ?N))\<bar>" |
53079 | 1161 |
unfolding suminf_split_initial_segment[OF all_smbl, where k="?N"] |
60758 | 1162 |
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
|
1163 |
apply (subst (5) add.commute) |
63558 | 1164 |
apply (rule abs_triangle_ineq) |
1165 |
done |
|
53079 | 1166 |
also have "\<dots> \<le> ?diff_part + ?L_part + ?f'_part" |
1167 |
using abs_triangle_ineq4 by auto |
|
41970 | 1168 |
also have "\<dots> < r /3 + r/3 + r/3" |
60758 | 1169 |
using \<open>?diff_part < r/3\<close> \<open>?L_part \<le> r/3\<close> and \<open>?f'_part < r/3\<close> |
36842 | 1170 |
by (rule add_strict_mono [OF add_less_le_mono]) |
63558 | 1171 |
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
|
1172 |
by auto |
63558 | 1173 |
qed |
1174 |
then show "\<exists>s > 0. \<forall> x. x \<noteq> 0 \<and> norm (x - 0) < s \<longrightarrow> |
|
53079 | 1175 |
norm (((\<Sum>n. f (x0 + x) n) - (\<Sum>n. f x0 n)) / x - (\<Sum>n. f' x0 n)) < r" |
63558 | 1176 |
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
|
1177 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1178 |
|
53079 | 1179 |
lemma DERIV_power_series': |
1180 |
fixes f :: "nat \<Rightarrow> real" |
|
63558 | 1181 |
assumes converges: "\<And>x. x \<in> {-R <..< R} \<Longrightarrow> summable (\<lambda>n. f n * real (Suc n) * x^n)" |
1182 |
and x0_in_I: "x0 \<in> {-R <..< R}" |
|
1183 |
and "0 < R" |
|
1184 |
shows "DERIV (\<lambda>x. (\<Sum>n. f n * x^(Suc n))) x0 :> (\<Sum>n. f n * real (Suc n) * x0^n)" |
|
1185 |
(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
|
1186 |
proof - |
63558 | 1187 |
have for_subinterval: "DERIV (\<lambda>x. suminf (?f x)) x0 :> suminf (?f' x0)" |
1188 |
if "0 < R'" and "R' < R" and "-R' < x0" and "x0 < R'" for R' |
|
1189 |
proof - |
|
1190 |
from that have "x0 \<in> {-R' <..< R'}" and "R' \<in> {-R <..< R}" and "x0 \<in> {-R <..< R}" |
|
53079 | 1191 |
by auto |
63558 | 1192 |
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
|
1193 |
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
|
1194 |
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
|
1195 |
proof - |
53079 | 1196 |
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
|
1197 |
using \<open>0 < R'\<close> \<open>0 < R\<close> \<open>R' < R\<close> by (auto simp: field_simps) |
63558 | 1198 |
then have in_Rball: "(R' + R) / 2 \<in> {-R <..< R}" |
60758 | 1199 |
using \<open>R' < R\<close> by auto |
53079 | 1200 |
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
|
1201 |
using \<open>0 < R'\<close> \<open>0 < R\<close> \<open>R' < R\<close> by (auto simp: field_simps) |
53079 | 1202 |
from powser_insidea[OF converges[OF in_Rball] this] show ?thesis |
1203 |
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
|
1204 |
qed |
63558 | 1205 |
next |
1206 |
fix n x y |
|
1207 |
assume "x \<in> {-R' <..< R'}" and "y \<in> {-R' <..< R'}" |
|
1208 |
show "\<bar>?f x n - ?f y n\<bar> \<le> \<bar>f n * real (Suc n) * R'^n\<bar> * \<bar>x-y\<bar>" |
|
1209 |
proof - |
|
1210 |
have "\<bar>f n * x ^ (Suc n) - f n * y ^ (Suc n)\<bar> = |
|
1211 |
(\<bar>f n\<bar> * \<bar>x-y\<bar>) * \<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar>" |
|
64267 | 1212 |
unfolding right_diff_distrib[symmetric] diff_power_eq_sum abs_mult |
63558 | 1213 |
by auto |
1214 |
also have "\<dots> \<le> (\<bar>f n\<bar> * \<bar>x-y\<bar>) * (\<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>)" |
|
1215 |
proof (rule mult_left_mono) |
|
1216 |
have "\<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> (\<Sum>p<Suc n. \<bar>x ^ p * y ^ (n - p)\<bar>)" |
|
64267 | 1217 |
by (rule sum_abs) |
63558 | 1218 |
also have "\<dots> \<le> (\<Sum>p<Suc n. R' ^ n)" |
64267 | 1219 |
proof (rule sum_mono) |
63558 | 1220 |
fix p |
1221 |
assume "p \<in> {..<Suc n}" |
|
1222 |
then have "p \<le> n" by auto |
|
1223 |
have "\<bar>x^n\<bar> \<le> R'^n" if "x \<in> {-R'<..<R'}" for n and x :: real |
|
1224 |
proof - |
|
1225 |
from that have "\<bar>x\<bar> \<le> R'" by auto |
|
1226 |
then show ?thesis |
|
1227 |
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
|
1228 |
qed |
63558 | 1229 |
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"]] |
1230 |
and \<open>0 < R'\<close> |
|
1231 |
have "\<bar>x^p * y^(n - p)\<bar> \<le> R'^p * R'^(n - p)" |
|
1232 |
unfolding abs_mult by auto |
|
1233 |
then show "\<bar>x^p * y^(n - p)\<bar> \<le> R'^n" |
|
1234 |
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
|
1235 |
qed |
63558 | 1236 |
also have "\<dots> = real (Suc n) * R' ^ n" |
64267 | 1237 |
unfolding sum_constant card_atLeastLessThan by auto |
63558 | 1238 |
finally show "\<bar>\<Sum>p<Suc n. x ^ p * y ^ (n - p)\<bar> \<le> \<bar>real (Suc n)\<bar> * \<bar>R' ^ n\<bar>" |
1239 |
unfolding abs_of_nonneg[OF zero_le_power[OF less_imp_le[OF \<open>0 < R'\<close>]]] |
|
1240 |
by linarith |
|
1241 |
show "0 \<le> \<bar>f n\<bar> * \<bar>x - y\<bar>" |
|
1242 |
unfolding abs_mult[symmetric] by auto |
|
53079 | 1243 |
qed |
63558 | 1244 |
also have "\<dots> = \<bar>f n * real (Suc n) * R' ^ n\<bar> * \<bar>x - y\<bar>" |
1245 |
unfolding abs_mult mult.assoc[symmetric] by algebra |
|
1246 |
finally show ?thesis . |
|
1247 |
qed |
|
1248 |
next |
|
1249 |
show "DERIV (\<lambda>x. ?f x n) x0 :> ?f' x0 n" for n |
|
1250 |
by (auto intro!: derivative_eq_intros simp del: power_Suc) |
|
1251 |
next |
|
1252 |
fix x |
|
1253 |
assume "x \<in> {-R' <..< R'}" |
|
1254 |
then have "R' \<in> {-R <..< R}" and "norm x < norm R'" |
|
1255 |
using assms \<open>R' < R\<close> by auto |
|
1256 |
have "summable (\<lambda>n. f n * x^n)" |
|
1257 |
proof (rule summable_comparison_test, intro exI allI impI) |
|
53079 | 1258 |
fix n |
63558 | 1259 |
have le: "\<bar>f n\<bar> * 1 \<le> \<bar>f n\<bar> * real (Suc n)" |
1260 |
by (rule mult_left_mono) auto |
|
1261 |
show "norm (f n * x^n) \<le> norm (f n * real (Suc n) * x^n)" |
|
1262 |
unfolding real_norm_def abs_mult |
|
1263 |
using le mult_right_mono by fastforce |
|
1264 |
qed (rule powser_insidea[OF converges[OF \<open>R' \<in> {-R <..< R}\<close>] \<open>norm x < norm R'\<close>]) |
|
1265 |
from this[THEN summable_mult2[where c=x], simplified mult.assoc, simplified mult.commute] |
|
1266 |
show "summable (?f x)" by auto |
|
1267 |
next |
|
53079 | 1268 |
show "summable (?f' x0)" |
60758 | 1269 |
using converges[OF \<open>x0 \<in> {-R <..< R}\<close>] . |
53079 | 1270 |
show "x0 \<in> {-R' <..< R'}" |
60758 | 1271 |
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
|
1272 |
qed |
63558 | 1273 |
qed |
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1274 |
let ?R = "(R + \<bar>x0\<bar>) / 2" |
63558 | 1275 |
have "\<bar>x0\<bar> < ?R" |
1276 |
using assms by (auto simp: field_simps) |
|
1277 |
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
|
1278 |
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
|
1279 |
case True |
63558 | 1280 |
then have "- x0 < ?R" |
1281 |
using \<open>\<bar>x0\<bar> < ?R\<close> by auto |
|
1282 |
then show ?thesis |
|
1283 |
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
|
1284 |
next |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1285 |
case False |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1286 |
have "- ?R < 0" using assms by auto |
41970 | 1287 |
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
|
1288 |
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
|
1289 |
qed |
63558 | 1290 |
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
|
1291 |
using assms by (auto simp: field_simps) |
63558 | 1292 |
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
|
1293 |
qed |
29695 | 1294 |
|
63721 | 1295 |
lemma geometric_deriv_sums: |
1296 |
fixes z :: "'a :: {real_normed_field,banach}" |
|
1297 |
assumes "norm z < 1" |
|
1298 |
shows "(\<lambda>n. of_nat (Suc n) * z ^ n) sums (1 / (1 - z)^2)" |
|
1299 |
proof - |
|
1300 |
have "(\<lambda>n. diffs (\<lambda>n. 1) n * z^n) sums (1 / (1 - z)^2)" |
|
1301 |
proof (rule termdiffs_sums_strong) |
|
1302 |
fix z :: 'a assume "norm z < 1" |
|
1303 |
thus "(\<lambda>n. 1 * z^n) sums (1 / (1 - z))" by (simp add: geometric_sums) |
|
1304 |
qed (insert assms, auto intro!: derivative_eq_intros simp: power2_eq_square) |
|
1305 |
thus ?thesis unfolding diffs_def by simp |
|
1306 |
qed |
|
53079 | 1307 |
|
63558 | 1308 |
lemma isCont_pochhammer [continuous_intros]: "isCont (\<lambda>z. pochhammer z n) z" |
1309 |
for z :: "'a::real_normed_field" |
|
1310 |
by (induct n) (auto simp: pochhammer_rec') |
|
1311 |
||
1312 |
lemma continuous_on_pochhammer [continuous_intros]: "continuous_on A (\<lambda>z. pochhammer z n)" |
|
1313 |
for A :: "'a::real_normed_field set" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1314 |
by (intro continuous_at_imp_continuous_on ballI isCont_pochhammer) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1315 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
1316 |
|
60758 | 1317 |
subsection \<open>Exponential Function\<close> |
23043 | 1318 |
|
58656 | 1319 |
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
|
1320 |
where "exp = (\<lambda>x. \<Sum>n. x^n /\<^sub>R fact n)" |
23043 | 1321 |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1322 |
lemma summable_exp_generic: |
31017 | 1323 |
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
|
1324 |
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
|
1325 |
shows "summable S" |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1326 |
proof - |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
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
|
1332 |
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
|
1333 |
from r1 show ?thesis |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
1334 |
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
|
1335 |
fix n :: nat |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1336 |
assume n: "N \<le> n" |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1337 |
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
|
1338 |
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
|
1339 |
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
|
1340 |
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
|
1341 |
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
|
1342 |
using norm_ge_zero by (rule mult_right_mono) |
63558 | 1343 |
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
|
1344 |
by (rule order_trans [OF norm_mult_ineq]) |
63558 | 1345 |
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
|
1346 |
by (simp add: pos_divide_le_eq ac_simps) |
63558 | 1347 |
then show "norm (S (Suc n)) \<le> r * norm (S n)" |
35216 | 1348 |
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
|
1349 |
qed |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1350 |
qed |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1351 |
|
63558 | 1352 |
lemma summable_norm_exp: "summable (\<lambda>n. norm (x^n /\<^sub>R fact n))" |
1353 |
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
|
1354 |
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
|
1355 |
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
|
1356 |
by (rule summable_exp_generic) |
63558 | 1357 |
show "norm (x^n /\<^sub>R fact n) \<le> norm x^n /\<^sub>R fact n" for n |
35216 | 1358 |
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
|
1359 |
qed |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1360 |
|
63558 | 1361 |
lemma summable_exp: "summable (\<lambda>n. inverse (fact n) * x^n)" |
1362 |
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
|
1363 |
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
|
1364 |
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
|
1365 |
|
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1366 |
lemma exp_converges: "(\<lambda>n. x^n /\<^sub>R fact n) sums exp x" |
53079 | 1367 |
unfolding exp_def by (rule summable_exp_generic [THEN summable_sums]) |
23043 | 1368 |
|
41970 | 1369 |
lemma exp_fdiffs: |
60241 | 1370 |
"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
|
1371 |
by (simp add: diffs_def mult_ac nonzero_inverse_mult_distrib nonzero_of_real_inverse |
63558 | 1372 |
del: mult_Suc of_nat_Suc) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1373 |
|
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1374 |
lemma diffs_of_real: "diffs (\<lambda>n. of_real (f n)) = (\<lambda>n. of_real (diffs f n))" |
53079 | 1375 |
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
|
1376 |
|
63558 | 1377 |
lemma DERIV_exp [simp]: "DERIV exp x :> exp x" |
53079 | 1378 |
unfolding exp_def scaleR_conv_of_real |
1379 |
apply (rule DERIV_cong) |
|
63558 | 1380 |
apply (rule termdiffs [where K="of_real (1 + norm x)"]) |
1381 |
apply (simp_all only: diffs_of_real scaleR_conv_of_real exp_fdiffs) |
|
1382 |
apply (rule exp_converges [THEN sums_summable, unfolded scaleR_conv_of_real])+ |
|
53079 | 1383 |
apply (simp del: of_real_add) |
1384 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1385 |
|
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
|
1386 |
declare DERIV_exp[THEN DERIV_chain2, derivative_intros] |
63558 | 1387 |
and DERIV_exp[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
51527 | 1388 |
|
58656 | 1389 |
lemma norm_exp: "norm (exp x) \<le> exp (norm x)" |
1390 |
proof - |
|
1391 |
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
|
1392 |
have "norm (exp x) \<le> (\<Sum>n. inverse (fact n) * norm (x^n))" |
58656 | 1393 |
by (simp add: exp_def) |
1394 |
also have "\<dots> \<le> exp (norm x)" |
|
1395 |
using summable_exp_generic[of "norm x"] summable_norm_exp[of x] |
|
1396 |
by (auto simp: exp_def intro!: suminf_le norm_power_ineq) |
|
1397 |
finally show ?thesis . |
|
1398 |
qed |
|
1399 |
||
63558 | 1400 |
lemma isCont_exp: "isCont exp x" |
1401 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 1402 |
by (rule DERIV_exp [THEN DERIV_isCont]) |
1403 |
||
63558 | 1404 |
lemma isCont_exp' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. exp (f x)) a" |
1405 |
for f :: "_ \<Rightarrow>'a::{real_normed_field,banach}" |
|
44311 | 1406 |
by (rule isCont_o2 [OF _ isCont_exp]) |
1407 |
||
63558 | 1408 |
lemma tendsto_exp [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. exp (f x)) \<longlongrightarrow> exp a) F" |
1409 |
for f:: "_ \<Rightarrow>'a::{real_normed_field,banach}" |
|
44311 | 1410 |
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
|
1411 |
|
63558 | 1412 |
lemma continuous_exp [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. exp (f x))" |
1413 |
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
|
1414 |
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
|
1415 |
|
63558 | 1416 |
lemma continuous_on_exp [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. exp (f x))" |
1417 |
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
|
1418 |
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
|
1419 |
|
53079 | 1420 |
|
60758 | 1421 |
subsubsection \<open>Properties of the Exponential Function\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1422 |
|
23278 | 1423 |
lemma exp_zero [simp]: "exp 0 = 1" |
63558 | 1424 |
unfolding exp_def by (simp add: scaleR_conv_of_real) |
23278 | 1425 |
|
58656 | 1426 |
lemma exp_series_add_commuting: |
63558 | 1427 |
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
|
1428 |
defines S_def: "S \<equiv> \<lambda>x n. x^n /\<^sub>R fact n" |
58656 | 1429 |
assumes comm: "x * y = y * x" |
56213 | 1430 |
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
|
1431 |
proof (induct n) |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1432 |
case 0 |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1433 |
show ?case |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1434 |
unfolding S_def by simp |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1435 |
next |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1436 |
case (Suc n) |
25062 | 1437 |
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
|
1438 |
unfolding S_def by (simp del: mult_Suc) |
63558 | 1439 |
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
|
1440 |
by simp |
58656 | 1441 |
have S_comm: "\<And>n. S x n * y = y * S x n" |
1442 |
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
|
1443 |
|
25062 | 1444 |
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
|
1445 |
by (simp only: times_S) |
63558 | 1446 |
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
|
1447 |
by (simp only: Suc) |
63558 | 1448 |
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
|
1449 |
by (rule distrib_right) |
63558 | 1450 |
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))" |
64267 | 1451 |
by (simp add: sum_distrib_left ac_simps S_comm) |
63558 | 1452 |
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 | 1453 |
by (simp add: ac_simps) |
63558 | 1454 |
also have "\<dots> = (\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) + |
1455 |
(\<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
|
1456 |
by (simp add: times_S Suc_diff_le) |
63558 | 1457 |
also have "(\<Sum>i\<le>n. real (Suc i) *\<^sub>R (S x (Suc i) * S y (n - i))) = |
1458 |
(\<Sum>i\<le>Suc n. real i *\<^sub>R (S x i * S y (Suc n - i)))" |
|
64267 | 1459 |
by (subst sum_atMost_Suc_shift) simp |
63558 | 1460 |
also have "(\<Sum>i\<le>n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i))) = |
1461 |
(\<Sum>i\<le>Suc n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i)))" |
|
56213 | 1462 |
by simp |
63558 | 1463 |
also have "(\<Sum>i\<le>Suc n. real i *\<^sub>R (S x i * S y (Suc n - i))) + |
1464 |
(\<Sum>i\<le>Suc n. real (Suc n - i) *\<^sub>R (S x i * S y (Suc n - i))) = |
|
1465 |
(\<Sum>i\<le>Suc n. real (Suc n) *\<^sub>R (S x i * S y (Suc n - i)))" |
|
64267 | 1466 |
by (simp only: sum.distrib [symmetric] scaleR_left_distrib [symmetric] |
63558 | 1467 |
of_nat_add [symmetric]) simp |
1468 |
also have "\<dots> = real (Suc n) *\<^sub>R (\<Sum>i\<le>Suc n. S x i * S y (Suc n - i))" |
|
64267 | 1469 |
by (simp only: scaleR_right.sum) |
63558 | 1470 |
finally show "S (x + y) (Suc n) = (\<Sum>i\<le>Suc n. S x i * S y (Suc n - i))" |
64267 | 1471 |
by (simp del: sum_cl_ivl_Suc) |
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1472 |
qed |
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1473 |
|
58656 | 1474 |
lemma exp_add_commuting: "x * y = y * x \<Longrightarrow> exp (x + y) = exp x * exp y" |
63558 | 1475 |
by (simp only: exp_def Cauchy_product summable_norm_exp exp_series_add_commuting) |
58656 | 1476 |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1477 |
lemma exp_times_arg_commute: "exp A * A = A * exp A" |
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1478 |
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
|
1479 |
|
63558 | 1480 |
lemma exp_add: "exp (x + y) = exp x * exp y" |
1481 |
for x y :: "'a::{real_normed_field,banach}" |
|
58656 | 1482 |
by (rule exp_add_commuting) (simp add: ac_simps) |
1483 |
||
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1484 |
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
|
1485 |
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
|
1486 |
|
58656 | 1487 |
lemmas mult_exp_exp = exp_add [symmetric] |
29170 | 1488 |
|
23241 | 1489 |
lemma exp_of_real: "exp (of_real x) = of_real (exp x)" |
53079 | 1490 |
unfolding exp_def |
1491 |
apply (subst suminf_of_real) |
|
63558 | 1492 |
apply (rule summable_exp_generic) |
53079 | 1493 |
apply (simp add: scaleR_conv_of_real) |
1494 |
done |
|
23241 | 1495 |
|
59862 | 1496 |
corollary exp_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> exp z \<in> \<real>" |
1497 |
by (metis Reals_cases Reals_of_real exp_of_real) |
|
1498 |
||
29170 | 1499 |
lemma exp_not_eq_zero [simp]: "exp x \<noteq> 0" |
1500 |
proof |
|
63558 | 1501 |
have "exp x * exp (- x) = 1" |
1502 |
by (simp add: exp_add_commuting[symmetric]) |
|
29170 | 1503 |
also assume "exp x = 0" |
63558 | 1504 |
finally show False by simp |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1505 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1506 |
|
63558 | 1507 |
lemma exp_minus_inverse: "exp x * exp (- x) = 1" |
58656 | 1508 |
by (simp add: exp_add_commuting[symmetric]) |
1509 |
||
63558 | 1510 |
lemma exp_minus: "exp (- x) = inverse (exp x)" |
1511 |
for x :: "'a::{real_normed_field,banach}" |
|
58656 | 1512 |
by (intro inverse_unique [symmetric] exp_minus_inverse) |
1513 |
||
63558 | 1514 |
lemma exp_diff: "exp (x - y) = exp x / exp y" |
1515 |
for x :: "'a::{real_normed_field,banach}" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
1516 |
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
|
1517 |
|
63558 | 1518 |
lemma exp_of_nat_mult: "exp (of_nat n * x) = exp x ^ n" |
1519 |
for x :: "'a::{real_normed_field,banach}" |
|
1520 |
by (induct n) (auto simp add: distrib_left exp_add mult.commute) |
|
1521 |
||
1522 |
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
|
1523 |
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
|
1524 |
|
64272 | 1525 |
lemma exp_sum: "finite I \<Longrightarrow> exp (sum f I) = prod (\<lambda>x. exp (f x)) I" |
63558 | 1526 |
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
|
1527 |
|
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
|
1528 |
lemma exp_divide_power_eq: |
63558 | 1529 |
fixes x :: "'a::{real_normed_field,banach}" |
1530 |
assumes "n > 0" |
|
1531 |
shows "exp (x / of_nat n) ^ n = exp x" |
|
1532 |
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
|
1533 |
proof (induction n arbitrary: x) |
63558 | 1534 |
case 0 |
1535 |
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
|
1536 |
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
|
1537 |
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
|
1538 |
show ?case |
63558 | 1539 |
proof (cases "n = 0") |
1540 |
case True |
|
1541 |
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
|
1542 |
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
|
1543 |
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
|
1544 |
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
|
1545 |
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
|
1546 |
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
|
1547 |
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
|
1548 |
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
|
1549 |
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
|
1550 |
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
|
1551 |
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
|
1552 |
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
|
1553 |
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
|
1554 |
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
|
1555 |
|
29167 | 1556 |
|
60758 | 1557 |
subsubsection \<open>Properties of the Exponential Function on Reals\<close> |
1558 |
||
1559 |
text \<open>Comparisons of @{term "exp x"} with zero.\<close> |
|
1560 |
||
63558 | 1561 |
text \<open>Proof: because every exponential can be seen as a square.\<close> |
1562 |
lemma exp_ge_zero [simp]: "0 \<le> exp x" |
|
1563 |
for x :: real |
|
29167 | 1564 |
proof - |
63558 | 1565 |
have "0 \<le> exp (x/2) * exp (x/2)" |
1566 |
by simp |
|
1567 |
then show ?thesis |
|
1568 |
by (simp add: exp_add [symmetric]) |
|
29167 | 1569 |
qed |
1570 |
||
63558 | 1571 |
lemma exp_gt_zero [simp]: "0 < exp x" |
1572 |
for x :: real |
|
53079 | 1573 |
by (simp add: order_less_le) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1574 |
|
63558 | 1575 |
lemma not_exp_less_zero [simp]: "\<not> exp x < 0" |
1576 |
for x :: real |
|
53079 | 1577 |
by (simp add: not_less) |
29170 | 1578 |
|
63558 | 1579 |
lemma not_exp_le_zero [simp]: "\<not> exp x \<le> 0" |
1580 |
for x :: real |
|
53079 | 1581 |
by (simp add: not_le) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1582 |
|
63558 | 1583 |
lemma abs_exp_cancel [simp]: "\<bar>exp x\<bar> = exp x" |
1584 |
for x :: real |
|
53079 | 1585 |
by simp |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1586 |
|
60758 | 1587 |
text \<open>Strict monotonicity of exponential.\<close> |
29170 | 1588 |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
1589 |
lemma exp_ge_add_one_self_aux: |
63558 | 1590 |
fixes x :: real |
1591 |
assumes "0 \<le> x" |
|
1592 |
shows "1 + x \<le> exp x" |
|
1593 |
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
|
1594 |
proof |
54575 | 1595 |
assume "0 < x" |
63558 | 1596 |
have "1 + x \<le> (\<Sum>n<2. inverse (fact n) * x^n)" |
54575 | 1597 |
by (auto simp add: numeral_2_eq_2) |
63558 | 1598 |
also have "\<dots> \<le> (\<Sum>n. inverse (fact n) * x^n)" |
64267 | 1599 |
apply (rule sum_le_suminf [OF summable_exp]) |
60758 | 1600 |
using \<open>0 < x\<close> |
54575 | 1601 |
apply (auto simp add: zero_le_mult_iff) |
1602 |
done |
|
63558 | 1603 |
finally show "1 + x \<le> exp x" |
54575 | 1604 |
by (simp add: exp_def) |
1605 |
next |
|
1606 |
assume "0 = x" |
|
1607 |
then show "1 + x \<le> exp x" |
|
1608 |
by auto |
|
1609 |
qed |
|
29170 | 1610 |
|
63558 | 1611 |
lemma exp_gt_one: "0 < x \<Longrightarrow> 1 < exp x" |
1612 |
for x :: real |
|
29170 | 1613 |
proof - |
1614 |
assume x: "0 < x" |
|
63558 | 1615 |
then have "1 < 1 + x" by simp |
29170 | 1616 |
also from x have "1 + x \<le> exp x" |
1617 |
by (simp add: exp_ge_add_one_self_aux) |
|
1618 |
finally show ?thesis . |
|
1619 |
qed |
|
1620 |
||
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1621 |
lemma exp_less_mono: |
23115
4615b2078592
generalized exp to work over any complete field; new proof of exp_add
huffman
parents:
23112
diff
changeset
|
1622 |
fixes x y :: real |
53079 | 1623 |
assumes "x < y" |
1624 |
shows "exp x < exp y" |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1625 |
proof - |
60758 | 1626 |
from \<open>x < y\<close> have "0 < y - x" by simp |
63558 | 1627 |
then have "1 < exp (y - x)" by (rule exp_gt_one) |
1628 |
then have "1 < exp y / exp x" by (simp only: exp_diff) |
|
1629 |
then show "exp x < exp y" by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1630 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1631 |
|
63558 | 1632 |
lemma exp_less_cancel: "exp x < exp y \<Longrightarrow> x < y" |
1633 |
for x y :: real |
|
54575 | 1634 |
unfolding linorder_not_le [symmetric] |
1635 |
by (auto simp add: order_le_less exp_less_mono) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1636 |
|
63558 | 1637 |
lemma exp_less_cancel_iff [iff]: "exp x < exp y \<longleftrightarrow> x < y" |
1638 |
for x y :: real |
|
53079 | 1639 |
by (auto intro: exp_less_mono exp_less_cancel) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1640 |
|
63558 | 1641 |
lemma exp_le_cancel_iff [iff]: "exp x \<le> exp y \<longleftrightarrow> x \<le> y" |
1642 |
for x y :: real |
|
53079 | 1643 |
by (auto simp add: linorder_not_less [symmetric]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1644 |
|
63558 | 1645 |
lemma exp_inj_iff [iff]: "exp x = exp y \<longleftrightarrow> x = y" |
1646 |
for x y :: real |
|
53079 | 1647 |
by (simp add: order_eq_iff) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1648 |
|
60758 | 1649 |
text \<open>Comparisons of @{term "exp x"} with one.\<close> |
29170 | 1650 |
|
63558 | 1651 |
lemma one_less_exp_iff [simp]: "1 < exp x \<longleftrightarrow> 0 < x" |
1652 |
for x :: real |
|
1653 |
using exp_less_cancel_iff [where x = 0 and y = x] by simp |
|
1654 |
||
1655 |
lemma exp_less_one_iff [simp]: "exp x < 1 \<longleftrightarrow> x < 0" |
|
1656 |
for x :: real |
|
1657 |
using exp_less_cancel_iff [where x = x and y = 0] by simp |
|
1658 |
||
1659 |
lemma one_le_exp_iff [simp]: "1 \<le> exp x \<longleftrightarrow> 0 \<le> x" |
|
1660 |
for x :: real |
|
1661 |
using exp_le_cancel_iff [where x = 0 and y = x] by simp |
|
1662 |
||
1663 |
lemma exp_le_one_iff [simp]: "exp x \<le> 1 \<longleftrightarrow> x \<le> 0" |
|
1664 |
for x :: real |
|
1665 |
using exp_le_cancel_iff [where x = x and y = 0] by simp |
|
1666 |
||
1667 |
lemma exp_eq_one_iff [simp]: "exp x = 1 \<longleftrightarrow> x = 0" |
|
1668 |
for x :: real |
|
1669 |
using exp_inj_iff [where x = x and y = 0] by simp |
|
1670 |
||
1671 |
lemma lemma_exp_total: "1 \<le> y \<Longrightarrow> \<exists>x. 0 \<le> x \<and> x \<le> y - 1 \<and> exp x = y" |
|
1672 |
for y :: real |
|
44755 | 1673 |
proof (rule IVT) |
1674 |
assume "1 \<le> y" |
|
63558 | 1675 |
then have "0 \<le> y - 1" by simp |
1676 |
then have "1 + (y - 1) \<le> exp (y - 1)" |
|
1677 |
by (rule exp_ge_add_one_self_aux) |
|
1678 |
then show "y \<le> exp (y - 1)" by simp |
|
44755 | 1679 |
qed (simp_all add: le_diff_eq) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1680 |
|
63558 | 1681 |
lemma exp_total: "0 < y \<Longrightarrow> \<exists>x. exp x = y" |
1682 |
for y :: real |
|
44755 | 1683 |
proof (rule linorder_le_cases [of 1 y]) |
53079 | 1684 |
assume "1 \<le> y" |
63558 | 1685 |
then show "\<exists>x. exp x = y" |
1686 |
by (fast dest: lemma_exp_total) |
|
44755 | 1687 |
next |
1688 |
assume "0 < y" and "y \<le> 1" |
|
63558 | 1689 |
then have "1 \<le> inverse y" |
1690 |
by (simp add: one_le_inverse_iff) |
|
1691 |
then obtain x where "exp x = inverse y" |
|
1692 |
by (fast dest: lemma_exp_total) |
|
1693 |
then have "exp (- x) = y" |
|
1694 |
by (simp add: exp_minus) |
|
1695 |
then show "\<exists>x. exp x = y" .. |
|
44755 | 1696 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1697 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1698 |
|
60758 | 1699 |
subsection \<open>Natural Logarithm\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1700 |
|
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
|
1701 |
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
|
1702 |
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
|
1703 |
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
|
1704 |
|
63558 | 1705 |
definition powr :: "'a \<Rightarrow> 'a \<Rightarrow> 'a::ln" (infixr "powr" 80) |
61799 | 1706 |
\<comment> \<open>exponentation via ln and exp\<close> |
63558 | 1707 |
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
|
1708 |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1709 |
lemma powr_0 [simp]: "0 powr z = 0" |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1710 |
by (simp add: powr_def) |
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
1711 |
|
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
|
1712 |
|
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
|
1713 |
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
|
1714 |
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
|
1715 |
|
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
|
1716 |
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
|
1717 |
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
|
1718 |
|
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
|
1719 |
instance |
63558 | 1720 |
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
|
1721 |
|
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
|
1722 |
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
|
1723 |
|
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
|
1724 |
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
|
1725 |
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
|
1726 |
|
63558 | 1727 |
lemma ln_exp [simp]: "ln (exp x) = x" |
1728 |
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
|
1729 |
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
|
1730 |
|
63558 | 1731 |
lemma exp_ln [simp]: "0 < x \<Longrightarrow> exp (ln x) = x" |
1732 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1733 |
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
|
1734 |
|
63558 | 1735 |
lemma exp_ln_iff [simp]: "exp (ln x) = x \<longleftrightarrow> 0 < x" |
1736 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1737 |
by (metis exp_gt_zero exp_ln) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1738 |
|
63558 | 1739 |
lemma ln_unique: "exp y = x \<Longrightarrow> ln x = y" |
1740 |
for x :: real |
|
1741 |
by (erule subst) (rule ln_exp) |
|
1742 |
||
1743 |
lemma ln_mult: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln (x * y) = ln x + ln y" |
|
1744 |
for x :: real |
|
53079 | 1745 |
by (rule ln_unique) (simp add: exp_add) |
29171 | 1746 |
|
64272 | 1747 |
lemma ln_prod: "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i > 0) \<Longrightarrow> ln (prod f I) = sum (\<lambda>x. ln(f x)) I" |
63558 | 1748 |
for f :: "'a \<Rightarrow> real" |
64272 | 1749 |
by (induct I rule: finite_induct) (auto simp: ln_mult prod_pos) |
63558 | 1750 |
|
1751 |
lemma ln_inverse: "0 < x \<Longrightarrow> ln (inverse x) = - ln x" |
|
1752 |
for x :: real |
|
53079 | 1753 |
by (rule ln_unique) (simp add: exp_minus) |
1754 |
||
63558 | 1755 |
lemma ln_div: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln (x / y) = ln x - ln y" |
1756 |
for x :: real |
|
53079 | 1757 |
by (rule ln_unique) (simp add: exp_diff) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1758 |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1759 |
lemma ln_realpow: "0 < x \<Longrightarrow> ln (x^n) = real n * ln x" |
53079 | 1760 |
by (rule ln_unique) (simp add: exp_real_of_nat_mult) |
1761 |
||
63558 | 1762 |
lemma ln_less_cancel_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x < ln y \<longleftrightarrow> x < y" |
1763 |
for x :: real |
|
53079 | 1764 |
by (subst exp_less_cancel_iff [symmetric]) simp |
1765 |
||
63558 | 1766 |
lemma ln_le_cancel_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x \<le> ln y \<longleftrightarrow> x \<le> y" |
1767 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1768 |
by (simp add: linorder_not_less [symmetric]) |
29171 | 1769 |
|
63558 | 1770 |
lemma ln_inj_iff [simp]: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x = ln y \<longleftrightarrow> x = y" |
1771 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1772 |
by (simp add: order_eq_iff) |
29171 | 1773 |
|
63558 | 1774 |
lemma ln_add_one_self_le_self [simp]: "0 \<le> x \<Longrightarrow> ln (1 + x) \<le> x" |
1775 |
for x :: real |
|
1776 |
by (rule exp_le_cancel_iff [THEN iffD1]) (simp add: exp_ge_add_one_self_aux) |
|
1777 |
||
1778 |
lemma ln_less_self [simp]: "0 < x \<Longrightarrow> ln x < x" |
|
1779 |
for x :: real |
|
1780 |
by (rule order_less_le_trans [where y = "ln (1 + x)"]) simp_all |
|
1781 |
||
1782 |
lemma ln_ge_zero [simp]: "1 \<le> x \<Longrightarrow> 0 \<le> ln x" |
|
1783 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1784 |
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
|
1785 |
|
63558 | 1786 |
lemma ln_ge_zero_imp_ge_one: "0 \<le> ln x \<Longrightarrow> 0 < x \<Longrightarrow> 1 \<le> x" |
1787 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1788 |
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
|
1789 |
|
63558 | 1790 |
lemma ln_ge_zero_iff [simp]: "0 < x \<Longrightarrow> 0 \<le> ln x \<longleftrightarrow> 1 \<le> x" |
1791 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1792 |
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
|
1793 |
|
63558 | 1794 |
lemma ln_less_zero_iff [simp]: "0 < x \<Longrightarrow> ln x < 0 \<longleftrightarrow> x < 1" |
1795 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1796 |
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
|
1797 |
|
63558 | 1798 |
lemma ln_gt_zero: "1 < x \<Longrightarrow> 0 < ln x" |
1799 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1800 |
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
|
1801 |
|
63558 | 1802 |
lemma ln_gt_zero_imp_gt_one: "0 < ln x \<Longrightarrow> 0 < x \<Longrightarrow> 1 < x" |
1803 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1804 |
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
|
1805 |
|
63558 | 1806 |
lemma ln_gt_zero_iff [simp]: "0 < x \<Longrightarrow> 0 < ln x \<longleftrightarrow> 1 < x" |
1807 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1808 |
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
|
1809 |
|
63558 | 1810 |
lemma ln_eq_zero_iff [simp]: "0 < x \<Longrightarrow> ln x = 0 \<longleftrightarrow> x = 1" |
1811 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1812 |
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
|
1813 |
|
63558 | 1814 |
lemma ln_less_zero: "0 < x \<Longrightarrow> x < 1 \<Longrightarrow> ln x < 0" |
1815 |
for x :: real |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
1816 |
by simp |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1817 |
|
63558 | 1818 |
lemma ln_neg_is_const: "x \<le> 0 \<Longrightarrow> ln x = (THE x. False)" |
1819 |
for x :: real |
|
1820 |
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
|
1821 |
|
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
|
1822 |
lemma isCont_ln: |
63558 | 1823 |
fixes x :: real |
1824 |
assumes "x \<noteq> 0" |
|
1825 |
shows "isCont ln x" |
|
63540 | 1826 |
proof (cases "0 < x") |
1827 |
case True |
|
1828 |
then have "isCont ln (exp (ln x))" |
|
63558 | 1829 |
by (intro isCont_inv_fun[where d = "\<bar>x\<bar>" and f = exp]) auto |
63540 | 1830 |
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
|
1831 |
by simp |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
1832 |
next |
63540 | 1833 |
case False |
1834 |
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
|
1835 |
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
|
1836 |
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
|
1837 |
(auto simp: ln_neg_is_const not_less eventually_at dist_real_def |
63558 | 1838 |
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
|
1839 |
qed |
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
1840 |
|
63558 | 1841 |
lemma tendsto_ln [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. ln (f x)) \<longlongrightarrow> ln a) F" |
1842 |
for a :: real |
|
45915 | 1843 |
by (rule isCont_tendsto_compose [OF isCont_ln]) |
1844 |
||
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
|
1845 |
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
|
1846 |
"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
|
1847 |
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
|
1848 |
|
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
|
1849 |
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
|
1850 |
"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
|
1851 |
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
|
1852 |
|
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
|
1853 |
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
|
1854 |
"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
|
1855 |
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
|
1856 |
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
1857 |
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
|
1858 |
"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
|
1859 |
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
|
1860 |
|
63558 | 1861 |
lemma DERIV_ln: "0 < x \<Longrightarrow> DERIV ln x :> inverse x" |
1862 |
for x :: real |
|
1863 |
by (rule DERIV_inverse_function [where f=exp and a=0 and b="x+1"]) |
|
1864 |
(auto intro: DERIV_cong [OF DERIV_exp exp_ln] isCont_ln) |
|
1865 |
||
1866 |
lemma DERIV_ln_divide: "0 < x \<Longrightarrow> DERIV ln x :> 1 / x" |
|
1867 |
for x :: real |
|
1868 |
by (rule DERIV_ln[THEN DERIV_cong]) (simp_all add: divide_inverse) |
|
33667 | 1869 |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
1870 |
declare DERIV_ln_divide[THEN DERIV_chain2, derivative_intros] |
63558 | 1871 |
and DERIV_ln_divide[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
51527 | 1872 |
|
53079 | 1873 |
lemma ln_series: |
1874 |
assumes "0 < x" and "x < 2" |
|
1875 |
shows "ln x = (\<Sum> n. (-1)^n * (1 / real (n + 1)) * (x - 1)^(Suc n))" |
|
63558 | 1876 |
(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
|
1877 |
proof - |
53079 | 1878 |
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
|
1879 |
|
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1880 |
have "ln x - suminf (?f (x - 1)) = ln 1 - suminf (?f (1 - 1))" |
63558 | 1881 |
proof (rule DERIV_isconst3 [where x = x]) |
53079 | 1882 |
fix x :: real |
1883 |
assume "x \<in> {0 <..< 2}" |
|
63558 | 1884 |
then have "0 < x" and "x < 2" by auto |
53079 | 1885 |
have "norm (1 - x) < 1" |
60758 | 1886 |
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
|
1887 |
have "1 / x = 1 / (1 - (1 - x))" by auto |
53079 | 1888 |
also have "\<dots> = (\<Sum> n. (1 - x)^n)" |
60758 | 1889 |
using geometric_sums[OF \<open>norm (1 - x) < 1\<close>] by (rule sums_unique) |
53079 | 1890 |
also have "\<dots> = suminf (?f' x)" |
1891 |
unfolding power_mult_distrib[symmetric] |
|
1892 |
by (rule arg_cong[where f=suminf], rule arg_cong[where f="op ^"], auto) |
|
1893 |
finally have "DERIV ln x :> suminf (?f' x)" |
|
60758 | 1894 |
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
|
1895 |
moreover |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
1896 |
have repos: "\<And> h x :: real. h - 1 + x = h + x - 1" by auto |
53079 | 1897 |
have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> |
1898 |
(\<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
|
1899 |
proof (rule DERIV_power_series') |
53079 | 1900 |
show "x - 1 \<in> {- 1<..<1}" and "(0 :: real) < 1" |
60758 | 1901 |
using \<open>0 < x\<close> \<open>x < 2\<close> by auto |
63558 | 1902 |
next |
53079 | 1903 |
fix x :: real |
1904 |
assume "x \<in> {- 1<..<1}" |
|
63558 | 1905 |
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
|
1906 |
show "summable (\<lambda>n. (- 1) ^ n * (1 / real (n + 1)) * real (Suc n) * x^n)" |
53079 | 1907 |
unfolding One_nat_def |
60758 | 1908 |
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
|
1909 |
qed |
63558 | 1910 |
then have "DERIV (\<lambda>x. suminf (?f x)) (x - 1) :> suminf (?f' x)" |
53079 | 1911 |
unfolding One_nat_def by auto |
63558 | 1912 |
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
|
1913 |
unfolding DERIV_def repos . |
63558 | 1914 |
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
|
1915 |
by (rule DERIV_diff) |
63558 | 1916 |
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
|
1917 |
qed (auto simp add: assms) |
63558 | 1918 |
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
|
1919 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
1920 |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1921 |
lemma exp_first_terms: |
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1922 |
fixes x :: "'a::{real_normed_algebra_1,banach}" |
63558 | 1923 |
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 | 1924 |
proof - |
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1925 |
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
|
1926 |
by (simp add: exp_def) |
63558 | 1927 |
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
|
1928 |
(\<Sum> n::nat<k. inverse(fact n) *\<^sub>R (x^n))" (is "_ = _ + ?a") |
50326 | 1929 |
by (rule suminf_split_initial_segment) |
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1930 |
finally show ?thesis by simp |
50326 | 1931 |
qed |
1932 |
||
63558 | 1933 |
lemma exp_first_term: "exp x = 1 + (\<Sum>n. inverse (fact (Suc n)) *\<^sub>R (x ^ Suc n))" |
1934 |
for x :: "'a::{real_normed_algebra_1,banach}" |
|
62949
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1935 |
using exp_first_terms[of x 1] by simp |
f36a54da47a4
added derivative of scaling in exponential function
immler
parents:
62948
diff
changeset
|
1936 |
|
63558 | 1937 |
lemma exp_first_two_terms: "exp x = 1 + x + (\<Sum>n. inverse (fact (n + 2)) *\<^sub>R (x ^ (n + 2)))" |
1938 |
for x :: "'a::{real_normed_algebra_1,banach}" |
|
1939 |
using exp_first_terms[of x 2] by (simp add: eval_nat_numeral) |
|
1940 |
||
1941 |
lemma exp_bound: |
|
1942 |
fixes x :: real |
|
1943 |
assumes a: "0 \<le> x" |
|
1944 |
and b: "x \<le> 1" |
|
1945 |
shows "exp x \<le> 1 + x + x\<^sup>2" |
|
50326 | 1946 |
proof - |
63558 | 1947 |
have aux1: "inverse (fact (n + 2)) * x ^ (n + 2) \<le> (x\<^sup>2/2) * ((1/2)^n)" for n :: nat |
1948 |
proof - |
|
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
1949 |
have "(2::nat) * 2 ^ n \<le> fact (n + 2)" |
53079 | 1950 |
by (induct n) simp_all |
63558 | 1951 |
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
|
1952 |
by (simp only: of_nat_le_iff) |
63558 | 1953 |
then have "((2::real) * 2 ^ n) \<le> fact (n + 2)" |
1954 |
unfolding of_nat_fact by simp |
|
1955 |
then have "inverse (fact (n + 2)) \<le> inverse ((2::real) * 2 ^ n)" |
|
50326 | 1956 |
by (rule le_imp_inverse_le) simp |
63558 | 1957 |
then have "inverse (fact (n + 2)) \<le> 1/(2::real) * (1/2)^n" |
60867 | 1958 |
by (simp add: power_inverse [symmetric]) |
63558 | 1959 |
then have "inverse (fact (n + 2)) * (x^n * x\<^sup>2) \<le> 1/2 * (1/2)^n * (1 * x\<^sup>2)" |
1960 |
by (rule mult_mono) (rule mult_mono, simp_all add: power_le_one a b) |
|
1961 |
then show ?thesis |
|
1962 |
unfolding power_add by (simp add: ac_simps del: fact_Suc) |
|
1963 |
qed |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
1964 |
have "(\<lambda>n. x\<^sup>2 / 2 * (1 / 2) ^ n) sums (x\<^sup>2 / 2 * (1 / (1 - 1 / 2)))" |
63558 | 1965 |
by (intro sums_mult geometric_sums) simp |
1966 |
then have aux2: "(\<lambda>n. x\<^sup>2 / 2 * (1 / 2) ^ n) sums x\<^sup>2" |
|
50326 | 1967 |
by simp |
63558 | 1968 |
have "suminf (\<lambda>n. inverse(fact (n+2)) * (x ^ (n + 2))) \<le> x\<^sup>2" |
50326 | 1969 |
proof - |
63558 | 1970 |
have "suminf (\<lambda>n. inverse(fact (n+2)) * (x ^ (n + 2))) \<le> suminf (\<lambda>n. (x\<^sup>2/2) * ((1/2)^n))" |
56213 | 1971 |
apply (rule suminf_le) |
63558 | 1972 |
apply (rule allI) |
1973 |
apply (rule aux1) |
|
1974 |
apply (rule summable_exp [THEN summable_ignore_initial_segment]) |
|
1975 |
apply (rule sums_summable) |
|
1976 |
apply (rule aux2) |
|
1977 |
done |
|
1978 |
also have "\<dots> = x\<^sup>2" |
|
1979 |
by (rule sums_unique [THEN sym]) (rule aux2) |
|
50326 | 1980 |
finally show ?thesis . |
1981 |
qed |
|
63558 | 1982 |
then show ?thesis |
1983 |
unfolding exp_first_two_terms by auto |
|
50326 | 1984 |
qed |
1985 |
||
59613
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1986 |
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
|
1987 |
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
|
1988 |
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
|
1989 |
|
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
|
1990 |
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
|
1991 |
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
|
1992 |
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
|
1993 |
|
63558 | 1994 |
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
|
1995 |
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
|
1996 |
|
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
1997 |
lemma exp_bound_lemma: |
63558 | 1998 |
assumes "norm z \<le> 1/2" |
1999 |
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
|
2000 |
proof - |
63558 | 2001 |
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
|
2002 |
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
|
2003 |
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
|
2004 |
using assms |
63558 | 2005 |
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
|
2006 |
done |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2007 |
show ?thesis |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2008 |
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
|
2009 |
apply (rule order_trans [OF exp_bound]) |
63558 | 2010 |
using assms * |
2011 |
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
|
2012 |
done |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2013 |
qed |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2014 |
|
63558 | 2015 |
lemma real_exp_bound_lemma: "0 \<le> x \<Longrightarrow> x \<le> 1/2 \<Longrightarrow> exp x \<le> 1 + 2 * x" |
2016 |
for x :: real |
|
2017 |
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
|
2018 |
|
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
|
2019 |
lemma ln_one_minus_pos_upper_bound: |
63558 | 2020 |
fixes x :: real |
2021 |
assumes a: "0 \<le> x" and b: "x < 1" |
|
2022 |
shows "ln (1 - x) \<le> - x" |
|
50326 | 2023 |
proof - |
63558 | 2024 |
have "(1 - x) * (1 + x + x\<^sup>2) = 1 - x^3" |
50326 | 2025 |
by (simp add: algebra_simps power2_eq_square power3_eq_cube) |
63558 | 2026 |
also have "\<dots> \<le> 1" |
50326 | 2027 |
by (auto simp add: a) |
63558 | 2028 |
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
|
2029 |
moreover have c: "0 < 1 + x + x\<^sup>2" |
50326 | 2030 |
by (simp add: add_pos_nonneg a) |
63558 | 2031 |
ultimately have "1 - x \<le> 1 / (1 + x + x\<^sup>2)" |
50326 | 2032 |
by (elim mult_imp_le_div_pos) |
63558 | 2033 |
also have "\<dots> \<le> 1 / exp x" |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2034 |
by (metis a abs_one b exp_bound exp_gt_zero frac_le less_eq_real_def real_sqrt_abs |
63558 | 2035 |
real_sqrt_pow2_iff real_sqrt_power) |
2036 |
also have "\<dots> = exp (- x)" |
|
50326 | 2037 |
by (auto simp add: exp_minus divide_inverse) |
63558 | 2038 |
finally have "1 - x \<le> exp (- x)" . |
50326 | 2039 |
also have "1 - x = exp (ln (1 - x))" |
54576 | 2040 |
by (metis b diff_0 exp_ln_iff less_iff_diff_less_0 minus_diff_eq) |
63558 | 2041 |
finally have "exp (ln (1 - x)) \<le> exp (- x)" . |
2042 |
then show ?thesis |
|
2043 |
by (auto simp only: exp_le_cancel_iff) |
|
50326 | 2044 |
qed |
2045 |
||
63558 | 2046 |
lemma exp_ge_add_one_self [simp]: "1 + x \<le> exp x" |
2047 |
for x :: real |
|
2048 |
apply (cases "0 \<le> x") |
|
2049 |
apply (erule exp_ge_add_one_self_aux) |
|
2050 |
apply (cases "x \<le> -1") |
|
2051 |
apply (subgoal_tac "1 + x \<le> 0") |
|
2052 |
apply (erule order_trans) |
|
2053 |
apply simp |
|
2054 |
apply simp |
|
2055 |
apply (subgoal_tac "1 + x = exp (ln (1 + x))") |
|
2056 |
apply (erule ssubst) |
|
2057 |
apply (subst exp_le_cancel_iff) |
|
2058 |
apply (subgoal_tac "ln (1 - (- x)) \<le> - (- x)") |
|
2059 |
apply simp |
|
2060 |
apply (rule ln_one_minus_pos_upper_bound) |
|
2061 |
apply auto |
|
2062 |
done |
|
50326 | 2063 |
|
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
|
2064 |
lemma ln_one_plus_pos_lower_bound: |
63558 | 2065 |
fixes x :: real |
2066 |
assumes a: "0 \<le> x" and b: "x \<le> 1" |
|
2067 |
shows "x - x\<^sup>2 \<le> ln (1 + x)" |
|
51527 | 2068 |
proof - |
53076 | 2069 |
have "exp (x - x\<^sup>2) = exp x / exp (x\<^sup>2)" |
51527 | 2070 |
by (rule exp_diff) |
63558 | 2071 |
also have "\<dots> \<le> (1 + x + x\<^sup>2) / exp (x \<^sup>2)" |
54576 | 2072 |
by (metis a b divide_right_mono exp_bound exp_ge_zero) |
63558 | 2073 |
also have "\<dots> \<le> (1 + x + x\<^sup>2) / (1 + x\<^sup>2)" |
56544 | 2074 |
by (simp add: a divide_left_mono add_pos_nonneg) |
63558 | 2075 |
also from a have "\<dots> \<le> 1 + x" |
51527 | 2076 |
by (simp add: field_simps add_strict_increasing zero_le_mult_iff) |
63558 | 2077 |
finally have "exp (x - x\<^sup>2) \<le> 1 + x" . |
2078 |
also have "\<dots> = exp (ln (1 + x))" |
|
51527 | 2079 |
proof - |
2080 |
from a have "0 < 1 + x" by auto |
|
63558 | 2081 |
then show ?thesis |
51527 | 2082 |
by (auto simp only: exp_ln_iff [THEN sym]) |
2083 |
qed |
|
63558 | 2084 |
finally have "exp (x - x\<^sup>2) \<le> exp (ln (1 + x))" . |
2085 |
then show ?thesis |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
2086 |
by (metis exp_le_cancel_iff) |
51527 | 2087 |
qed |
2088 |
||
53079 | 2089 |
lemma ln_one_minus_pos_lower_bound: |
63558 | 2090 |
fixes x :: real |
2091 |
assumes a: "0 \<le> x" and b: "x \<le> 1 / 2" |
|
2092 |
shows "- x - 2 * x\<^sup>2 \<le> ln (1 - x)" |
|
51527 | 2093 |
proof - |
53079 | 2094 |
from b have c: "x < 1" by auto |
51527 | 2095 |
then have "ln (1 - x) = - ln (1 + x / (1 - x))" |
54576 | 2096 |
apply (subst ln_inverse [symmetric]) |
63558 | 2097 |
apply (simp add: field_simps) |
54576 | 2098 |
apply (rule arg_cong [where f=ln]) |
2099 |
apply (simp add: field_simps) |
|
2100 |
done |
|
63558 | 2101 |
also have "- (x / (1 - x)) \<le> \<dots>" |
53079 | 2102 |
proof - |
63558 | 2103 |
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
|
2104 |
using a c by (intro ln_add_one_self_le_self) auto |
63558 | 2105 |
then show ?thesis |
51527 | 2106 |
by auto |
2107 |
qed |
|
63558 | 2108 |
also have "- (x / (1 - x)) = - x / (1 - x)" |
51527 | 2109 |
by auto |
63558 | 2110 |
finally have d: "- x / (1 - x) \<le> ln (1 - x)" . |
51527 | 2111 |
have "0 < 1 - x" using a b by simp |
63558 | 2112 |
then have e: "- x - 2 * x\<^sup>2 \<le> - x / (1 - x)" |
2113 |
using mult_right_le_one_le[of "x * x" "2 * x"] a b |
|
53079 | 2114 |
by (simp add: field_simps power2_eq_square) |
63558 | 2115 |
from e d show "- x - 2 * x\<^sup>2 \<le> ln (1 - x)" |
51527 | 2116 |
by (rule order_trans) |
2117 |
qed |
|
2118 |
||
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
|
2119 |
lemma ln_add_one_self_le_self2: |
63558 | 2120 |
fixes x :: real |
2121 |
shows "-1 < x \<Longrightarrow> ln (1 + x) \<le> x" |
|
2122 |
apply (subgoal_tac "ln (1 + x) \<le> ln (exp x)") |
|
2123 |
apply simp |
|
51527 | 2124 |
apply (subst ln_le_cancel_iff) |
63558 | 2125 |
apply auto |
53079 | 2126 |
done |
51527 | 2127 |
|
2128 |
lemma abs_ln_one_plus_x_minus_x_bound_nonneg: |
|
63558 | 2129 |
fixes x :: real |
2130 |
assumes x: "0 \<le> x" and x1: "x \<le> 1" |
|
2131 |
shows "\<bar>ln (1 + x) - x\<bar> \<le> x\<^sup>2" |
|
51527 | 2132 |
proof - |
63558 | 2133 |
from x have "ln (1 + x) \<le> x" |
51527 | 2134 |
by (rule ln_add_one_self_le_self) |
63558 | 2135 |
then have "ln (1 + x) - x \<le> 0" |
51527 | 2136 |
by simp |
61944 | 2137 |
then have "\<bar>ln(1 + x) - x\<bar> = - (ln(1 + x) - x)" |
51527 | 2138 |
by (rule abs_of_nonpos) |
63558 | 2139 |
also have "\<dots> = x - ln (1 + x)" |
51527 | 2140 |
by simp |
63558 | 2141 |
also have "\<dots> \<le> x\<^sup>2" |
51527 | 2142 |
proof - |
63558 | 2143 |
from x x1 have "x - x\<^sup>2 \<le> ln (1 + x)" |
51527 | 2144 |
by (intro ln_one_plus_pos_lower_bound) |
63558 | 2145 |
then show ?thesis |
51527 | 2146 |
by simp |
2147 |
qed |
|
2148 |
finally show ?thesis . |
|
2149 |
qed |
|
2150 |
||
2151 |
lemma abs_ln_one_plus_x_minus_x_bound_nonpos: |
|
63558 | 2152 |
fixes x :: real |
2153 |
assumes a: "-(1 / 2) \<le> x" and b: "x \<le> 0" |
|
2154 |
shows "\<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2" |
|
51527 | 2155 |
proof - |
63558 | 2156 |
have "\<bar>ln (1 + x) - x\<bar> = x - ln (1 - (- x))" |
51527 | 2157 |
apply (subst abs_of_nonpos) |
63558 | 2158 |
apply simp |
2159 |
apply (rule ln_add_one_self_le_self2) |
|
51527 | 2160 |
using a apply auto |
2161 |
done |
|
63558 | 2162 |
also have "\<dots> \<le> 2 * x\<^sup>2" |
2163 |
apply (subgoal_tac "- (-x) - 2 * (-x)\<^sup>2 \<le> ln (1 - (- x))") |
|
2164 |
apply (simp add: algebra_simps) |
|
51527 | 2165 |
apply (rule ln_one_minus_pos_lower_bound) |
2166 |
using a b apply auto |
|
2167 |
done |
|
2168 |
finally show ?thesis . |
|
2169 |
qed |
|
2170 |
||
2171 |
lemma abs_ln_one_plus_x_minus_x_bound: |
|
63558 | 2172 |
fixes x :: real |
2173 |
shows "\<bar>x\<bar> \<le> 1 / 2 \<Longrightarrow> \<bar>ln (1 + x) - x\<bar> \<le> 2 * x\<^sup>2" |
|
2174 |
apply (cases "0 \<le> x") |
|
2175 |
apply (rule order_trans) |
|
2176 |
apply (rule abs_ln_one_plus_x_minus_x_bound_nonneg) |
|
2177 |
apply auto |
|
51527 | 2178 |
apply (rule abs_ln_one_plus_x_minus_x_bound_nonpos) |
63558 | 2179 |
apply auto |
53079 | 2180 |
done |
2181 |
||
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
|
2182 |
lemma ln_x_over_x_mono: |
63558 | 2183 |
fixes x :: real |
2184 |
assumes x: "exp 1 \<le> x" "x \<le> y" |
|
2185 |
shows "ln y / y \<le> ln x / x" |
|
51527 | 2186 |
proof - |
63558 | 2187 |
note x |
51527 | 2188 |
moreover have "0 < exp (1::real)" by simp |
2189 |
ultimately have a: "0 < x" and b: "0 < y" |
|
2190 |
by (fast intro: less_le_trans order_trans)+ |
|
2191 |
have "x * ln y - x * ln x = x * (ln y - ln x)" |
|
2192 |
by (simp add: algebra_simps) |
|
63558 | 2193 |
also have "\<dots> = x * ln (y / x)" |
51527 | 2194 |
by (simp only: ln_div a b) |
2195 |
also have "y / x = (x + (y - x)) / x" |
|
2196 |
by simp |
|
63558 | 2197 |
also have "\<dots> = 1 + (y - x) / x" |
51527 | 2198 |
using x a by (simp add: field_simps) |
63558 | 2199 |
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
|
2200 |
using x a |
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
2201 |
by (intro mult_left_mono ln_add_one_self_le_self) simp_all |
63558 | 2202 |
also have "\<dots> = y - x" |
2203 |
using a by simp |
|
2204 |
also have "\<dots> = (y - x) * ln (exp 1)" by simp |
|
2205 |
also have "\<dots> \<le> (y - x) * ln x" |
|
51527 | 2206 |
apply (rule mult_left_mono) |
63558 | 2207 |
apply (subst ln_le_cancel_iff) |
2208 |
apply fact |
|
2209 |
apply (rule a) |
|
2210 |
apply (rule x) |
|
51527 | 2211 |
using x apply simp |
2212 |
done |
|
63558 | 2213 |
also have "\<dots> = y * ln x - x * ln x" |
51527 | 2214 |
by (rule left_diff_distrib) |
63558 | 2215 |
finally have "x * ln y \<le> y * ln x" |
51527 | 2216 |
by arith |
63558 | 2217 |
then have "ln y \<le> (y * ln x) / x" |
2218 |
using a by (simp add: field_simps) |
|
2219 |
also have "\<dots> = y * (ln x / x)" by simp |
|
2220 |
finally show ?thesis |
|
2221 |
using b by (simp add: field_simps) |
|
51527 | 2222 |
qed |
2223 |
||
63558 | 2224 |
lemma ln_le_minus_one: "0 < x \<Longrightarrow> ln x \<le> x - 1" |
2225 |
for x :: real |
|
51527 | 2226 |
using exp_ge_add_one_self[of "ln x"] by simp |
2227 |
||
63558 | 2228 |
corollary ln_diff_le: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> ln x - ln y \<le> (x - y) / y" |
2229 |
for x :: real |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2230 |
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
|
2231 |
|
51527 | 2232 |
lemma ln_eq_minus_one: |
63558 | 2233 |
fixes x :: real |
53079 | 2234 |
assumes "0 < x" "ln x = x - 1" |
2235 |
shows "x = 1" |
|
51527 | 2236 |
proof - |
53079 | 2237 |
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
|
2238 |
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
|
2239 |
by (auto intro!: derivative_eq_intros) |
51527 | 2240 |
|
2241 |
show ?thesis |
|
2242 |
proof (cases rule: linorder_cases) |
|
2243 |
assume "x < 1" |
|
60758 | 2244 |
from dense[OF \<open>x < 1\<close>] obtain a where "x < a" "a < 1" by blast |
2245 |
from \<open>x < a\<close> have "?l x < ?l a" |
|
51527 | 2246 |
proof (rule DERIV_pos_imp_increasing, safe) |
53079 | 2247 |
fix y |
2248 |
assume "x \<le> y" "y \<le> a" |
|
60758 | 2249 |
with \<open>0 < x\<close> \<open>a < 1\<close> have "0 < 1 / y - 1" "0 < y" |
51527 | 2250 |
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
|
2251 |
with D show "\<exists>z. DERIV ?l y :> z \<and> 0 < z" by blast |
51527 | 2252 |
qed |
2253 |
also have "\<dots> \<le> 0" |
|
60758 | 2254 |
using ln_le_minus_one \<open>0 < x\<close> \<open>x < a\<close> by (auto simp: field_simps) |
51527 | 2255 |
finally show "x = 1" using assms by auto |
2256 |
next |
|
2257 |
assume "1 < x" |
|
53079 | 2258 |
from dense[OF this] obtain a where "1 < a" "a < x" by blast |
60758 | 2259 |
from \<open>a < x\<close> have "?l x < ?l a" |
51527 | 2260 |
proof (rule DERIV_neg_imp_decreasing, safe) |
53079 | 2261 |
fix y |
2262 |
assume "a \<le> y" "y \<le> x" |
|
60758 | 2263 |
with \<open>1 < a\<close> have "1 / y - 1 < 0" "0 < y" |
51527 | 2264 |
by (auto simp: field_simps) |
2265 |
with D show "\<exists>z. DERIV ?l y :> z \<and> z < 0" |
|
2266 |
by blast |
|
2267 |
qed |
|
2268 |
also have "\<dots> \<le> 0" |
|
60758 | 2269 |
using ln_le_minus_one \<open>1 < a\<close> by (auto simp: field_simps) |
51527 | 2270 |
finally show "x = 1" using assms by auto |
53079 | 2271 |
next |
2272 |
assume "x = 1" |
|
2273 |
then show ?thesis by simp |
|
2274 |
qed |
|
51527 | 2275 |
qed |
2276 |
||
63558 | 2277 |
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
|
2278 |
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
|
2279 |
from eventually_gt_at_top[of "0::real"] |
63558 | 2280 |
show "\<forall>\<^sub>F x in at_top. (ln has_real_derivative inverse x) (at x)" |
2281 |
by eventually_elim (auto intro!: derivative_eq_intros simp: field_simps) |
|
2282 |
qed (use tendsto_inverse_0 in |
|
2283 |
\<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
|
2284 |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2285 |
lemma exp_ge_one_plus_x_over_n_power_n: |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2286 |
assumes "x \<ge> - real n" "n > 0" |
63558 | 2287 |
shows "(1 + x / of_nat n) ^ n \<le> exp x" |
2288 |
proof (cases "x = - of_nat n") |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2289 |
case False |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2290 |
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
|
2291 |
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
|
2292 |
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
|
2293 |
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
|
2294 |
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
|
2295 |
by (simp add: field_simps) |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2296 |
finally show ?thesis . |
63558 | 2297 |
next |
2298 |
case True |
|
2299 |
then show ?thesis by (simp add: zero_power) |
|
2300 |
qed |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2301 |
|
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2302 |
lemma exp_ge_one_minus_x_over_n_power_n: |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2303 |
assumes "x \<le> real n" "n > 0" |
63558 | 2304 |
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
|
2305 |
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
|
2306 |
|
61973 | 2307 |
lemma exp_at_bot: "(exp \<longlongrightarrow> (0::real)) at_bot" |
50326 | 2308 |
unfolding tendsto_Zfun_iff |
2309 |
proof (rule ZfunI, simp add: eventually_at_bot_dense) |
|
63558 | 2310 |
fix r :: real |
2311 |
assume "0 < r" |
|
2312 |
have "exp x < r" if "x < ln r" for x |
|
2313 |
proof - |
|
2314 |
from that have "exp x < exp (ln r)" |
|
50326 | 2315 |
by simp |
63558 | 2316 |
with \<open>0 < r\<close> show ?thesis |
53079 | 2317 |
by simp |
63558 | 2318 |
qed |
50326 | 2319 |
then show "\<exists>k. \<forall>n<k. exp n < r" by auto |
2320 |
qed |
|
2321 |
||
2322 |
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
|
2323 |
by (rule filterlim_at_top_at_top[where Q="\<lambda>x. True" and P="\<lambda>x. 0 < x" and g="ln"]) |
63558 | 2324 |
(auto intro: eventually_gt_at_top) |
2325 |
||
2326 |
lemma lim_exp_minus_1: "((\<lambda>z::'a. (exp(z) - 1) / z) \<longlongrightarrow> 1) (at 0)" |
|
2327 |
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
|
2328 |
proof - |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2329 |
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
|
2330 |
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
|
2331 |
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
|
2332 |
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
|
2333 |
qed |
7103019278f0
The function frac. Various lemmas about limits, series, the exp function, etc.
paulson <lp15@cam.ac.uk>
parents:
59587
diff
changeset
|
2334 |
|
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
|
2335 |
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
|
2336 |
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
|
2337 |
(auto simp: eventually_at_filter) |
50326 | 2338 |
|
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
|
2339 |
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
|
2340 |
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
|
2341 |
(auto intro: eventually_gt_at_top) |
50326 | 2342 |
|
60721
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2343 |
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
|
2344 |
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
|
2345 |
|
c1b7793c23a3
generalized filtermap_homeomorph to filtermap_fun_inverse; add eventually_at_top/bot_not_equal
hoelzl
parents:
60688
diff
changeset
|
2346 |
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
|
2347 |
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
|
2348 |
(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
|
2349 |
|
61973 | 2350 |
lemma tendsto_power_div_exp_0: "((\<lambda>x. x ^ k / exp x) \<longlongrightarrow> (0::real)) at_top" |
50347 | 2351 |
proof (induct k) |
53079 | 2352 |
case 0 |
61973 | 2353 |
show "((\<lambda>x. x ^ 0 / exp x) \<longlongrightarrow> (0::real)) at_top" |
50347 | 2354 |
by (simp add: inverse_eq_divide[symmetric]) |
2355 |
(metis filterlim_compose[OF tendsto_inverse_0] exp_at_top filterlim_mono |
|
63558 | 2356 |
at_top_le_at_infinity order_refl) |
50347 | 2357 |
next |
2358 |
case (Suc k) |
|
2359 |
show ?case |
|
2360 |
proof (rule lhospital_at_top_at_top) |
|
2361 |
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
|
2362 |
by eventually_elim (intro derivative_eq_intros, auto) |
50347 | 2363 |
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
|
2364 |
by eventually_elim auto |
50347 | 2365 |
show "eventually (\<lambda>x. exp x \<noteq> 0) at_top" |
2366 |
by auto |
|
2367 |
from tendsto_mult[OF tendsto_const Suc, of "real (Suc k)"] |
|
61973 | 2368 |
show "((\<lambda>x. real (Suc k) * x ^ k / exp x) \<longlongrightarrow> 0) at_top" |
50347 | 2369 |
by simp |
2370 |
qed (rule exp_at_top) |
|
2371 |
qed |
|
2372 |
||
64758
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2373 |
subsubsection\<open> A couple of simple bounds\<close> |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2374 |
|
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2375 |
lemma exp_plus_inverse_exp: |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2376 |
fixes x::real |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2377 |
shows "2 \<le> exp x + inverse (exp x)" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2378 |
proof - |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2379 |
have "2 \<le> exp x + exp (-x)" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2380 |
using exp_ge_add_one_self [of x] exp_ge_add_one_self [of "-x"] |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2381 |
by linarith |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2382 |
then show ?thesis |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2383 |
by (simp add: exp_minus) |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2384 |
qed |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2385 |
|
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2386 |
lemma real_le_x_sinh: |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2387 |
fixes x::real |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2388 |
assumes "0 \<le> x" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2389 |
shows "x \<le> (exp x - inverse(exp x)) / 2" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2390 |
proof - |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2391 |
have *: "exp a - inverse(exp a) - 2*a \<le> exp b - inverse(exp b) - 2*b" if "a \<le> b" for a b::real |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2392 |
apply (rule DERIV_nonneg_imp_nondecreasing [OF that]) |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2393 |
using exp_plus_inverse_exp |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2394 |
apply (intro exI allI impI conjI derivative_eq_intros | force)+ |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2395 |
done |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2396 |
show ?thesis |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2397 |
using*[OF assms] by simp |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2398 |
qed |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2399 |
|
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2400 |
lemma real_le_abs_sinh: |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2401 |
fixes x::real |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2402 |
shows "abs x \<le> abs((exp x - inverse(exp x)) / 2)" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2403 |
proof (cases "0 \<le> x") |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2404 |
case True |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2405 |
show ?thesis |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2406 |
using real_le_x_sinh [OF True] True by (simp add: abs_if) |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2407 |
next |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2408 |
case False |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2409 |
have "-x \<le> (exp(-x) - inverse(exp(-x))) / 2" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2410 |
by (meson False linear neg_le_0_iff_le real_le_x_sinh) |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2411 |
also have "... \<le> \<bar>(exp x - inverse (exp x)) / 2\<bar>" |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2412 |
by (metis (no_types, hide_lams) abs_divide abs_le_iff abs_minus_cancel |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2413 |
add.inverse_inverse exp_minus minus_diff_eq order_refl) |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2414 |
finally show ?thesis |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2415 |
using False by linarith |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2416 |
qed |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2417 |
|
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2418 |
subsection\<open>The general logarithm\<close> |
3b33d2fc5fc0
A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents:
64446
diff
changeset
|
2419 |
|
63558 | 2420 |
definition log :: "real \<Rightarrow> real \<Rightarrow> real" |
61799 | 2421 |
\<comment> \<open>logarithm of @{term x} to base @{term a}\<close> |
53079 | 2422 |
where "log a x = ln x / ln a" |
51527 | 2423 |
|
2424 |
lemma tendsto_log [tendsto_intros]: |
|
63558 | 2425 |
"(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> 0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < b \<Longrightarrow> |
2426 |
((\<lambda>x. log (f x) (g x)) \<longlongrightarrow> log a b) F" |
|
51527 | 2427 |
unfolding log_def by (intro tendsto_intros) auto |
2428 |
||
2429 |
lemma continuous_log: |
|
53079 | 2430 |
assumes "continuous F f" |
2431 |
and "continuous F g" |
|
2432 |
and "0 < f (Lim F (\<lambda>x. x))" |
|
2433 |
and "f (Lim F (\<lambda>x. x)) \<noteq> 1" |
|
2434 |
and "0 < g (Lim F (\<lambda>x. x))" |
|
51527 | 2435 |
shows "continuous F (\<lambda>x. log (f x) (g x))" |
2436 |
using assms unfolding continuous_def by (rule tendsto_log) |
|
2437 |
||
2438 |
lemma continuous_at_within_log[continuous_intros]: |
|
53079 | 2439 |
assumes "continuous (at a within s) f" |
2440 |
and "continuous (at a within s) g" |
|
2441 |
and "0 < f a" |
|
2442 |
and "f a \<noteq> 1" |
|
2443 |
and "0 < g a" |
|
51527 | 2444 |
shows "continuous (at a within s) (\<lambda>x. log (f x) (g x))" |
2445 |
using assms unfolding continuous_within by (rule tendsto_log) |
|
2446 |
||
2447 |
lemma isCont_log[continuous_intros, simp]: |
|
2448 |
assumes "isCont f a" "isCont g a" "0 < f a" "f a \<noteq> 1" "0 < g a" |
|
2449 |
shows "isCont (\<lambda>x. log (f x) (g x)) a" |
|
2450 |
using assms unfolding continuous_at by (rule tendsto_log) |
|
2451 |
||
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
2452 |
lemma continuous_on_log[continuous_intros]: |
53079 | 2453 |
assumes "continuous_on s f" "continuous_on s g" |
2454 |
and "\<forall>x\<in>s. 0 < f x" "\<forall>x\<in>s. f x \<noteq> 1" "\<forall>x\<in>s. 0 < g x" |
|
51527 | 2455 |
shows "continuous_on s (\<lambda>x. log (f x) (g x))" |
2456 |
using assms unfolding continuous_on_def by (fast intro: tendsto_log) |
|
2457 |
||
2458 |
lemma powr_one_eq_one [simp]: "1 powr a = 1" |
|
53079 | 2459 |
by (simp add: powr_def) |
51527 | 2460 |
|
63558 | 2461 |
lemma powr_zero_eq_one [simp]: "x powr 0 = (if x = 0 then 0 else 1)" |
53079 | 2462 |
by (simp add: powr_def) |
51527 | 2463 |
|
63558 | 2464 |
lemma powr_one_gt_zero_iff [simp]: "x powr 1 = x \<longleftrightarrow> 0 \<le> x" |
2465 |
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
|
2466 |
by (auto simp: powr_def) |
51527 | 2467 |
declare powr_one_gt_zero_iff [THEN iffD2, simp] |
2468 |
||
63558 | 2469 |
lemma powr_mult: "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> (x * y) powr a = (x powr a) * (y powr a)" |
2470 |
for a x y :: real |
|
53079 | 2471 |
by (simp add: powr_def exp_add [symmetric] ln_mult distrib_left) |
51527 | 2472 |
|
63558 | 2473 |
lemma powr_ge_pzero [simp]: "0 \<le> x powr y" |
2474 |
for x y :: real |
|
53079 | 2475 |
by (simp add: powr_def) |
51527 | 2476 |
|
63558 | 2477 |
lemma powr_divide: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> (x / y) powr a = (x powr a) / (y powr a)" |
2478 |
for a b x :: real |
|
53079 | 2479 |
apply (simp add: divide_inverse positive_imp_inverse_positive powr_mult) |
2480 |
apply (simp add: powr_def exp_minus [symmetric] exp_add [symmetric] ln_inverse) |
|
2481 |
done |
|
51527 | 2482 |
|
63558 | 2483 |
lemma powr_divide2: "x powr a / x powr b = x powr (a - b)" |
2484 |
for a b x :: real |
|
51527 | 2485 |
apply (simp add: powr_def) |
2486 |
apply (subst exp_diff [THEN sym]) |
|
2487 |
apply (simp add: left_diff_distrib) |
|
53079 | 2488 |
done |
51527 | 2489 |
|
63558 | 2490 |
lemma powr_add: "x powr (a + b) = (x powr a) * (x powr b)" |
2491 |
for a b x :: real |
|
53079 | 2492 |
by (simp add: powr_def exp_add [symmetric] distrib_right) |
2493 |
||
63558 | 2494 |
lemma powr_mult_base: "0 < x \<Longrightarrow>x * x powr y = x powr (1 + y)" |
2495 |
for x :: real |
|
63092 | 2496 |
by (auto simp: powr_add) |
51527 | 2497 |
|
63558 | 2498 |
lemma powr_powr: "(x powr a) powr b = x powr (a * b)" |
2499 |
for a b x :: real |
|
53079 | 2500 |
by (simp add: powr_def) |
51527 | 2501 |
|
63558 | 2502 |
lemma powr_powr_swap: "(x powr a) powr b = (x powr b) powr a" |
2503 |
for a b x :: real |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
2504 |
by (simp add: powr_powr mult.commute) |
51527 | 2505 |
|
63558 | 2506 |
lemma powr_minus: "x powr (- a) = inverse (x powr a)" |
2507 |
for x a :: real |
|
53079 | 2508 |
by (simp add: powr_def exp_minus [symmetric]) |
51527 | 2509 |
|
63558 | 2510 |
lemma powr_minus_divide: "x powr (- a) = 1/(x powr a)" |
2511 |
for x a :: real |
|
53079 | 2512 |
by (simp add: divide_inverse powr_minus) |
2513 |
||
63558 | 2514 |
lemma divide_powr_uminus: "a / b powr c = a * b powr (- c)" |
2515 |
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
|
2516 |
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
|
2517 |
|
63558 | 2518 |
lemma powr_less_mono: "a < b \<Longrightarrow> 1 < x \<Longrightarrow> x powr a < x powr b" |
2519 |
for a b x :: real |
|
53079 | 2520 |
by (simp add: powr_def) |
2521 |
||
63558 | 2522 |
lemma powr_less_cancel: "x powr a < x powr b \<Longrightarrow> 1 < x \<Longrightarrow> a < b" |
2523 |
for a b x :: real |
|
53079 | 2524 |
by (simp add: powr_def) |
2525 |
||
63558 | 2526 |
lemma powr_less_cancel_iff [simp]: "1 < x \<Longrightarrow> x powr a < x powr b \<longleftrightarrow> a < b" |
2527 |
for a b x :: real |
|
53079 | 2528 |
by (blast intro: powr_less_cancel powr_less_mono) |
2529 |
||
63558 | 2530 |
lemma powr_le_cancel_iff [simp]: "1 < x \<Longrightarrow> x powr a \<le> x powr b \<longleftrightarrow> a \<le> b" |
2531 |
for a b x :: real |
|
53079 | 2532 |
by (simp add: linorder_not_less [symmetric]) |
51527 | 2533 |
|
2534 |
lemma log_ln: "ln x = log (exp(1)) x" |
|
53079 | 2535 |
by (simp add: log_def) |
2536 |
||
2537 |
lemma DERIV_log: |
|
2538 |
assumes "x > 0" |
|
2539 |
shows "DERIV (\<lambda>y. log b y) x :> 1 / (ln b * x)" |
|
51527 | 2540 |
proof - |
63040 | 2541 |
define lb where "lb = 1 / ln b" |
51527 | 2542 |
moreover have "DERIV (\<lambda>y. lb * ln y) x :> lb / x" |
60758 | 2543 |
using \<open>x > 0\<close> by (auto intro!: derivative_eq_intros) |
51527 | 2544 |
ultimately show ?thesis |
2545 |
by (simp add: log_def) |
|
2546 |
qed |
|
2547 |
||
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
2548 |
lemmas DERIV_log[THEN DERIV_chain2, derivative_intros] |
63558 | 2549 |
and DERIV_log[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
51527 | 2550 |
|
53079 | 2551 |
lemma powr_log_cancel [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> a powr (log a x) = x" |
2552 |
by (simp add: powr_def log_def) |
|
2553 |
||
2554 |
lemma log_powr_cancel [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log a (a powr y) = y" |
|
2555 |
by (simp add: log_def powr_def) |
|
2556 |
||
2557 |
lemma log_mult: |
|
2558 |
"0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> |
|
2559 |
log a (x * y) = log a x + log a y" |
|
2560 |
by (simp add: log_def ln_mult divide_inverse distrib_right) |
|
2561 |
||
2562 |
lemma log_eq_div_ln_mult_log: |
|
2563 |
"0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < b \<Longrightarrow> b \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> |
|
2564 |
log a x = (ln b/ln a) * log b x" |
|
2565 |
by (simp add: log_def divide_inverse) |
|
51527 | 2566 |
|
60758 | 2567 |
text\<open>Base 10 logarithms\<close> |
53079 | 2568 |
lemma log_base_10_eq1: "0 < x \<Longrightarrow> log 10 x = (ln (exp 1) / ln 10) * ln x" |
2569 |
by (simp add: log_def) |
|
2570 |
||
2571 |
lemma log_base_10_eq2: "0 < x \<Longrightarrow> log 10 x = (log 10 (exp 1)) * ln x" |
|
2572 |
by (simp add: log_def) |
|
51527 | 2573 |
|
2574 |
lemma log_one [simp]: "log a 1 = 0" |
|
53079 | 2575 |
by (simp add: log_def) |
51527 | 2576 |
|
63558 | 2577 |
lemma log_eq_one [simp]: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log a a = 1" |
53079 | 2578 |
by (simp add: log_def) |
2579 |
||
2580 |
lemma log_inverse: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> 0 < x \<Longrightarrow> log a (inverse x) = - log a x" |
|
63558 | 2581 |
apply (rule add_left_cancel [THEN iffD1, where a1 = "log a x"]) |
53079 | 2582 |
apply (simp add: log_mult [symmetric]) |
2583 |
done |
|
2584 |
||
2585 |
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" |
|
2586 |
by (simp add: log_mult divide_inverse log_inverse) |
|
51527 | 2587 |
|
63558 | 2588 |
lemma powr_gt_zero [simp]: "0 < x powr a \<longleftrightarrow> x \<noteq> 0" |
2589 |
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
|
2590 |
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
|
2591 |
|
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2592 |
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
|
2593 |
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
|
2594 |
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
|
2595 |
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
|
2596 |
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
|
2597 |
|
63558 | 2598 |
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 | 2599 |
apply safe |
63558 | 2600 |
apply (rule_tac [2] powr_less_cancel) |
2601 |
apply (drule_tac a = "log a x" in powr_less_mono) |
|
2602 |
apply auto |
|
53079 | 2603 |
done |
2604 |
||
2605 |
lemma log_inj: |
|
2606 |
assumes "1 < b" |
|
2607 |
shows "inj_on (log b) {0 <..}" |
|
51527 | 2608 |
proof (rule inj_onI, simp) |
53079 | 2609 |
fix x y |
2610 |
assume pos: "0 < x" "0 < y" and *: "log b x = log b y" |
|
51527 | 2611 |
show "x = y" |
2612 |
proof (cases rule: linorder_cases) |
|
53079 | 2613 |
assume "x = y" |
2614 |
then show ?thesis by simp |
|
2615 |
next |
|
63558 | 2616 |
assume "x < y" |
2617 |
then have "log b x < log b y" |
|
60758 | 2618 |
using log_less_cancel_iff[OF \<open>1 < b\<close>] pos by simp |
53079 | 2619 |
then show ?thesis using * by simp |
51527 | 2620 |
next |
63558 | 2621 |
assume "y < x" |
2622 |
then have "log b y < log b x" |
|
60758 | 2623 |
using log_less_cancel_iff[OF \<open>1 < b\<close>] pos by simp |
53079 | 2624 |
then show ?thesis using * by simp |
2625 |
qed |
|
51527 | 2626 |
qed |
2627 |
||
63558 | 2628 |
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 | 2629 |
by (simp add: linorder_not_less [symmetric]) |
51527 | 2630 |
|
2631 |
lemma zero_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < log a x \<longleftrightarrow> 1 < x" |
|
2632 |
using log_less_cancel_iff[of a 1 x] by simp |
|
2633 |
||
2634 |
lemma zero_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 \<le> log a x \<longleftrightarrow> 1 \<le> x" |
|
2635 |
using log_le_cancel_iff[of a 1 x] by simp |
|
2636 |
||
2637 |
lemma log_less_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 0 \<longleftrightarrow> x < 1" |
|
2638 |
using log_less_cancel_iff[of a x 1] by simp |
|
2639 |
||
2640 |
lemma log_le_zero_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 0 \<longleftrightarrow> x \<le> 1" |
|
2641 |
using log_le_cancel_iff[of a x 1] by simp |
|
2642 |
||
2643 |
lemma one_less_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 < log a x \<longleftrightarrow> a < x" |
|
2644 |
using log_less_cancel_iff[of a a x] by simp |
|
2645 |
||
2646 |
lemma one_le_log_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 1 \<le> log a x \<longleftrightarrow> a \<le> x" |
|
2647 |
using log_le_cancel_iff[of a a x] by simp |
|
2648 |
||
2649 |
lemma log_less_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x < 1 \<longleftrightarrow> x < a" |
|
2650 |
using log_less_cancel_iff[of a x a] by simp |
|
2651 |
||
2652 |
lemma log_le_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 1 \<longleftrightarrow> x \<le> a" |
|
2653 |
using log_le_cancel_iff[of a x a] by simp |
|
2654 |
||
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2655 |
lemma le_log_iff: |
63558 | 2656 |
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
|
2657 |
assumes "1 < b" "x > 0" |
63558 | 2658 |
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
|
2659 |
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
|
2660 |
apply auto |
63558 | 2661 |
apply (metis (no_types, hide_lams) less_irrefl less_le_trans linear powr_le_cancel_iff |
2662 |
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
|
2663 |
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
|
2664 |
done |
58984
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2665 |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2666 |
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
|
2667 |
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
|
2668 |
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
|
2669 |
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
|
2670 |
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
|
2671 |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2672 |
lemma |
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2673 |
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
|
2674 |
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
|
2675 |
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
|
2676 |
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
|
2677 |
by auto |
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2678 |
|
ae0c56c485ae
added lemmas: convert between powr and log in comparisons, pull log out of addition/subtraction
immler
parents:
58981
diff
changeset
|
2679 |
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
|
2680 |
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
|
2681 |
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
|
2682 |
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
|
2683 |
|
64446 | 2684 |
lemma gr_one_powr[simp]: |
2685 |
fixes x y :: real shows "\<lbrakk> x > 1; y > 0 \<rbrakk> \<Longrightarrow> 1 < x powr y" |
|
2686 |
by(simp add: less_powr_iff) |
|
2687 |
||
63558 | 2688 |
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
|
2689 |
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
|
2690 |
|
63558 | 2691 |
lemma powr_realpow: "0 < x \<Longrightarrow> x powr (real n) = x^n" |
2692 |
by (induct n) (simp_all add: ac_simps powr_add) |
|
51527 | 2693 |
|
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
|
2694 |
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
|
2695 |
by (metis of_nat_numeral powr_realpow) |
52139 | 2696 |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2697 |
lemma powr_real_of_int: |
63558 | 2698 |
"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
|
2699 |
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
|
2700 |
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
|
2701 |
|
57180 | 2702 |
lemma powr2_sqrt[simp]: "0 < x \<Longrightarrow> sqrt x powr 2 = x" |
63558 | 2703 |
by (simp add: powr_numeral) |
2704 |
||
2705 |
lemma powr_realpow2: "0 \<le> x \<Longrightarrow> 0 < n \<Longrightarrow> x^n = (if (x = 0) then 0 else x powr (real n))" |
|
2706 |
apply (cases "x = 0") |
|
2707 |
apply simp_all |
|
2708 |
apply (rule powr_realpow [THEN sym]) |
|
2709 |
apply simp |
|
53079 | 2710 |
done |
51527 | 2711 |
|
2712 |
lemma powr_int: |
|
2713 |
assumes "x > 0" |
|
2714 |
shows "x powr i = (if i \<ge> 0 then x ^ nat i else 1 / x ^ nat (-i))" |
|
53079 | 2715 |
proof (cases "i < 0") |
2716 |
case True |
|
63558 | 2717 |
have r: "x powr i = 1 / x powr (- i)" |
2718 |
by (simp add: powr_minus field_simps) |
|
2719 |
show ?thesis using \<open>i < 0\<close> \<open>x > 0\<close> |
|
2720 |
by (simp add: r field_simps powr_realpow[symmetric]) |
|
53079 | 2721 |
next |
2722 |
case False |
|
63558 | 2723 |
then show ?thesis |
2724 |
by (simp add: assms powr_realpow[symmetric]) |
|
53079 | 2725 |
qed |
51527 | 2726 |
|
58981 | 2727 |
lemma compute_powr[code]: |
63558 | 2728 |
fixes i :: real |
58981 | 2729 |
shows "b powr i = |
2730 |
(if b \<le> 0 then Code.abort (STR ''op powr with nonpositive base'') (\<lambda>_. b powr i) |
|
63558 | 2731 |
else if \<lfloor>i\<rfloor> = i then (if 0 \<le> i then b ^ nat \<lfloor>i\<rfloor> else 1 / b ^ nat \<lfloor>- i\<rfloor>) |
2732 |
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
|
2733 |
by (auto simp: powr_int) |
58981 | 2734 |
|
63558 | 2735 |
lemma powr_one: "0 \<le> x \<Longrightarrow> x powr 1 = x" |
2736 |
for x :: real |
|
2737 |
using powr_realpow [of x 1] by simp |
|
2738 |
||
2739 |
lemma powr_neg_one: "0 < x \<Longrightarrow> x powr - 1 = 1 / x" |
|
2740 |
for x :: real |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2741 |
using powr_int [of x "- 1"] by simp |
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2742 |
|
63558 | 2743 |
lemma powr_neg_numeral: "0 < x \<Longrightarrow> x powr - numeral n = 1 / x ^ numeral n" |
2744 |
for x :: real |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
2745 |
using powr_int [of x "- numeral n"] by simp |
51527 | 2746 |
|
53079 | 2747 |
lemma root_powr_inverse: "0 < n \<Longrightarrow> 0 < x \<Longrightarrow> root n x = x powr (1/n)" |
51527 | 2748 |
by (rule real_root_pos_unique) (auto simp: powr_realpow[symmetric] powr_powr) |
2749 |
||
63558 | 2750 |
lemma ln_powr: "x \<noteq> 0 \<Longrightarrow> ln (x powr y) = y * ln x" |
2751 |
for x :: real |
|
56483 | 2752 |
by (simp add: powr_def) |
2753 |
||
63558 | 2754 |
lemma ln_root: "n > 0 \<Longrightarrow> b > 0 \<Longrightarrow> ln (root n b) = ln b / n" |
2755 |
by (simp add: root_powr_inverse ln_powr) |
|
56952 | 2756 |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
2757 |
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
|
2758 |
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
|
2759 |
|
63558 | 2760 |
lemma log_root: "n > 0 \<Longrightarrow> a > 0 \<Longrightarrow> log b (root n a) = log b a / n" |
2761 |
by (simp add: log_def ln_root) |
|
56952 | 2762 |
|
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
|
2763 |
lemma log_powr: "x \<noteq> 0 \<Longrightarrow> log b (x powr y) = y * log b x" |
56483 | 2764 |
by (simp add: log_def ln_powr) |
2765 |
||
64446 | 2766 |
(* [simp] is not worth it, interferes with some proofs *) |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
2767 |
lemma log_nat_power: "0 < x \<Longrightarrow> log b (x^n) = real n * log b x" |
56483 | 2768 |
by (simp add: log_powr powr_realpow [symmetric]) |
2769 |
||
63558 | 2770 |
lemma le_log_of_power: |
2771 |
assumes "1 < b" "b ^ n \<le> m" |
|
2772 |
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
|
2773 |
proof - |
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2774 |
from assms have "0 < m" |
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2775 |
by (metis less_trans zero_less_power less_le_trans zero_less_one) |
63558 | 2776 |
have "n = log b (b ^ n)" |
2777 |
using assms(1) by (simp add: log_nat_power) |
|
2778 |
also have "\<dots> \<le> log b m" |
|
2779 |
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
|
2780 |
finally show ?thesis . |
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2781 |
qed |
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2782 |
|
63558 | 2783 |
lemma le_log2_of_power: "2 ^ n \<le> m \<Longrightarrow> n \<le> log 2 m" |
2784 |
for m n :: nat |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2785 |
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
|
2786 |
|
56483 | 2787 |
lemma log_base_change: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> log b x = log a x / log a b" |
2788 |
by (simp add: log_def) |
|
2789 |
||
2790 |
lemma log_base_pow: "0 < a \<Longrightarrow> log (a ^ n) x = log a x / n" |
|
2791 |
by (simp add: log_def ln_realpow) |
|
2792 |
||
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
|
2793 |
lemma log_base_powr: "a \<noteq> 0 \<Longrightarrow> log (a powr b) x = log a x / b" |
56483 | 2794 |
by (simp add: log_def ln_powr) |
51527 | 2795 |
|
63558 | 2796 |
lemma log_base_root: "n > 0 \<Longrightarrow> b > 0 \<Longrightarrow> log (root n b) x = n * (log b x)" |
2797 |
by (simp add: log_def ln_root) |
|
2798 |
||
2799 |
lemma ln_bound: "1 \<le> x \<Longrightarrow> ln x \<le> x" |
|
2800 |
for x :: real |
|
2801 |
apply (subgoal_tac "ln (1 + (x - 1)) \<le> x - 1") |
|
2802 |
apply simp |
|
2803 |
apply (rule ln_add_one_self_le_self) |
|
51527 | 2804 |
apply simp |
53079 | 2805 |
done |
51527 | 2806 |
|
63558 | 2807 |
lemma powr_mono: "a \<le> b \<Longrightarrow> 1 \<le> x \<Longrightarrow> x powr a \<le> x powr b" |
2808 |
for x :: real |
|
2809 |
apply (cases "x = 1") |
|
2810 |
apply simp |
|
2811 |
apply (cases "a = b") |
|
2812 |
apply simp |
|
2813 |
apply (rule order_less_imp_le) |
|
2814 |
apply (rule powr_less_mono) |
|
2815 |
apply auto |
|
2816 |
done |
|
2817 |
||
2818 |
lemma ge_one_powr_ge_zero: "1 \<le> x \<Longrightarrow> 0 \<le> a \<Longrightarrow> 1 \<le> x powr a" |
|
2819 |
for x :: real |
|
2820 |
using powr_mono by fastforce |
|
2821 |
||
2822 |
lemma powr_less_mono2: "0 < a \<Longrightarrow> 0 \<le> x \<Longrightarrow> x < y \<Longrightarrow> x powr a < y powr a" |
|
2823 |
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
|
2824 |
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
|
2825 |
|
63558 | 2826 |
lemma powr_less_mono2_neg: "a < 0 \<Longrightarrow> 0 < x \<Longrightarrow> x < y \<Longrightarrow> y powr a < x powr a" |
2827 |
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
|
2828 |
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
|
2829 |
|
63558 | 2830 |
lemma powr_mono2: "0 \<le> a \<Longrightarrow> 0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> x powr a \<le> y powr a" |
2831 |
for x :: real |
|
2832 |
apply (case_tac "a = 0") |
|
2833 |
apply simp |
|
2834 |
apply (case_tac "x = y") |
|
2835 |
apply simp |
|
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2836 |
apply (metis dual_order.strict_iff_order powr_less_mono2) |
53079 | 2837 |
done |
2838 |
||
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2839 |
lemma powr_mono2': |
63558 | 2840 |
fixes a x y :: real |
2841 |
assumes "a \<le> 0" "x > 0" "x \<le> y" |
|
2842 |
shows "x powr a \<ge> y powr a" |
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2843 |
proof - |
63558 | 2844 |
from assms have "x powr - a \<le> y powr - a" |
2845 |
by (intro powr_mono2) simp_all |
|
2846 |
with assms show ?thesis |
|
2847 |
by (auto simp add: powr_minus field_simps) |
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2848 |
qed |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2849 |
|
63558 | 2850 |
lemma powr_inj: "0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> a powr x = a powr y \<longleftrightarrow> x = y" |
2851 |
for x :: real |
|
51527 | 2852 |
unfolding powr_def exp_inj_iff by simp |
2853 |
||
60141
833adf7db7d8
New material, mostly about limits. Consolidation.
paulson <lp15@cam.ac.uk>
parents:
60036
diff
changeset
|
2854 |
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
|
2855 |
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
|
2856 |
|
63558 | 2857 |
lemma ln_powr_bound: "1 \<le> x \<Longrightarrow> 0 < a \<Longrightarrow> ln x \<le> (x powr a) / a" |
2858 |
for x :: real |
|
62679
092cb9c96c99
add le_log_of_power and le_log2_of_power by Tobias Nipkow
hoelzl
parents:
62393
diff
changeset
|
2859 |
by (metis exp_gt_zero linear ln_eq_zero_iff ln_exp ln_less_self ln_powr mult.commute |
63558 | 2860 |
mult_imp_le_div_pos not_less powr_gt_zero) |
51527 | 2861 |
|
2862 |
lemma ln_powr_bound2: |
|
63558 | 2863 |
fixes x :: real |
51527 | 2864 |
assumes "1 < x" and "0 < a" |
63558 | 2865 |
shows "(ln x) powr a \<le> (a powr a) * x" |
51527 | 2866 |
proof - |
63558 | 2867 |
from assms have "ln x \<le> (x powr (1 / a)) / (1 / a)" |
54575 | 2868 |
by (metis less_eq_real_def ln_powr_bound zero_less_divide_1_iff) |
63558 | 2869 |
also have "\<dots> = a * (x powr (1 / a))" |
51527 | 2870 |
by simp |
63558 | 2871 |
finally have "(ln x) powr a \<le> (a * (x powr (1 / a))) powr a" |
54575 | 2872 |
by (metis assms less_imp_le ln_gt_zero powr_mono2) |
63558 | 2873 |
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
|
2874 |
using assms powr_mult by auto |
51527 | 2875 |
also have "(x powr (1 / a)) powr a = x powr ((1 / a) * a)" |
2876 |
by (rule powr_powr) |
|
63558 | 2877 |
also have "\<dots> = x" using assms |
54575 | 2878 |
by auto |
51527 | 2879 |
finally show ?thesis . |
2880 |
qed |
|
2881 |
||
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2882 |
lemma tendsto_powr: |
63558 | 2883 |
fixes a b :: real |
2884 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2885 |
and g: "(g \<longlongrightarrow> b) F" |
|
2886 |
and a: "a \<noteq> 0" |
|
61973 | 2887 |
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
|
2888 |
unfolding powr_def |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2889 |
proof (rule filterlim_If) |
61973 | 2890 |
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 | 2891 |
by simp (auto simp: filterlim_iff eventually_inf_principal elim: eventually_mono dest: t1_space_nhds) |
63558 | 2892 |
from f g a show "((\<lambda>x. exp (g x * ln (f x))) \<longlongrightarrow> (if a = 0 then 0 else exp (b * ln a))) |
2893 |
(inf F (principal {x. f x \<noteq> 0}))" |
|
2894 |
by (auto intro!: tendsto_intros intro: tendsto_mono inf_le1) |
|
2895 |
qed |
|
51527 | 2896 |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2897 |
lemma tendsto_powr'[tendsto_intros]: |
63558 | 2898 |
fixes a :: real |
2899 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2900 |
and g: "(g \<longlongrightarrow> b) F" |
|
2901 |
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
|
2902 |
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
|
2903 |
proof - |
63558 | 2904 |
from a consider "a \<noteq> 0" | "a = 0" "b > 0" "eventually (\<lambda>x. f x \<ge> 0) F" |
2905 |
by auto |
|
2906 |
then show ?thesis |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2907 |
proof cases |
63558 | 2908 |
case 1 |
2909 |
with f g show ?thesis by (rule tendsto_powr) |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2910 |
next |
63558 | 2911 |
case 2 |
2912 |
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
|
2913 |
proof (intro filterlim_If) |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2914 |
have "filterlim f (principal {0<..}) (inf F (principal {z. f z \<noteq> 0}))" |
63558 | 2915 |
using \<open>eventually (\<lambda>x. f x \<ge> 0) F\<close> |
2916 |
by (auto simp add: filterlim_iff eventually_inf_principal |
|
2917 |
eventually_principal elim: eventually_mono) |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2918 |
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
|
2919 |
by (rule tendsto_mono[OF _ f]) simp_all |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2920 |
ultimately have f: "filterlim f (at_right 0) (inf F (principal {x. f x \<noteq> 0}))" |
63558 | 2921 |
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
|
2922 |
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
|
2923 |
by (rule tendsto_mono[OF _ g]) simp_all |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2924 |
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
|
2925 |
by (rule filterlim_compose[OF exp_at_bot] filterlim_tendsto_pos_mult_at_bot |
63558 | 2926 |
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
|
2927 |
qed simp_all |
63558 | 2928 |
with \<open>a = 0\<close> show ?thesis |
2929 |
by (simp add: powr_def) |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2930 |
qed |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2931 |
qed |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
2932 |
|
51527 | 2933 |
lemma continuous_powr: |
53079 | 2934 |
assumes "continuous F f" |
2935 |
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
|
2936 |
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
|
2937 |
shows "continuous F (\<lambda>x. (f x) powr (g x :: real))" |
51527 | 2938 |
using assms unfolding continuous_def by (rule tendsto_powr) |
2939 |
||
2940 |
lemma continuous_at_within_powr[continuous_intros]: |
|
63558 | 2941 |
fixes f g :: "_ \<Rightarrow> real" |
53079 | 2942 |
assumes "continuous (at a within s) f" |
2943 |
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
|
2944 |
and "f a \<noteq> 0" |
63558 | 2945 |
shows "continuous (at a within s) (\<lambda>x. (f x) powr (g x))" |
51527 | 2946 |
using assms unfolding continuous_within by (rule tendsto_powr) |
2947 |
||
2948 |
lemma isCont_powr[continuous_intros, simp]: |
|
63558 | 2949 |
fixes f g :: "_ \<Rightarrow> real" |
2950 |
assumes "isCont f a" "isCont g a" "f a \<noteq> 0" |
|
51527 | 2951 |
shows "isCont (\<lambda>x. (f x) powr g x) a" |
2952 |
using assms unfolding continuous_at by (rule tendsto_powr) |
|
2953 |
||
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
2954 |
lemma continuous_on_powr[continuous_intros]: |
63558 | 2955 |
fixes f g :: "_ \<Rightarrow> real" |
2956 |
assumes "continuous_on s f" "continuous_on s g" and "\<forall>x\<in>s. f x \<noteq> 0" |
|
51527 | 2957 |
shows "continuous_on s (\<lambda>x. (f x) powr (g x))" |
2958 |
using assms unfolding continuous_on_def by (fast intro: tendsto_powr) |
|
63558 | 2959 |
|
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2960 |
lemma tendsto_powr2: |
63558 | 2961 |
fixes a :: real |
2962 |
assumes f: "(f \<longlongrightarrow> a) F" |
|
2963 |
and g: "(g \<longlongrightarrow> b) F" |
|
2964 |
and "\<forall>\<^sub>F x in F. 0 \<le> f x" |
|
2965 |
and b: "0 < b" |
|
61973 | 2966 |
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
|
2967 |
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
|
2968 |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2969 |
lemma DERIV_powr: |
63558 | 2970 |
fixes r :: real |
2971 |
assumes g: "DERIV g x :> m" |
|
2972 |
and pos: "g x > 0" |
|
2973 |
and f: "DERIV f x :> r" |
|
2974 |
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
|
2975 |
proof - |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2976 |
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
|
2977 |
using pos |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2978 |
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
|
2979 |
then show ?thesis |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2980 |
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
|
2981 |
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
|
2982 |
unfolding isCont_def by (rule order_tendstoD(1)) |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2983 |
with pos show "\<forall>\<^sub>F x in nhds x. exp (f x * ln (g x)) = g x powr f x" |
61810 | 2984 |
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
|
2985 |
qed |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2986 |
qed |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2987 |
|
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2988 |
lemma DERIV_fun_powr: |
63558 | 2989 |
fixes r :: real |
2990 |
assumes g: "DERIV g x :> m" |
|
2991 |
and pos: "g x > 0" |
|
2992 |
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
|
2993 |
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
|
2994 |
by (simp add: powr_divide2[symmetric] field_simps) |
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
2995 |
|
61524
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2996 |
lemma has_real_derivative_powr: |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2997 |
assumes "z > 0" |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
2998 |
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
|
2999 |
proof (subst DERIV_cong_ev[OF refl _ refl]) |
63558 | 3000 |
from assms have "eventually (\<lambda>z. z \<noteq> 0) (nhds z)" |
3001 |
by (intro t1_space_nhds) auto |
|
3002 |
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
|
3003 |
unfolding powr_def by eventually_elim simp |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
3004 |
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
|
3005 |
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
|
3006 |
qed |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
3007 |
|
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
3008 |
declare has_real_derivative_powr[THEN DERIV_chain2, derivative_intros] |
f2e51e704a96
added many small lemmas about setsum/setprod/powr/...
eberlm
parents:
61518
diff
changeset
|
3009 |
|
51527 | 3010 |
lemma tendsto_zero_powrI: |
61973 | 3011 |
assumes "(f \<longlongrightarrow> (0::real)) F" "(g \<longlongrightarrow> b) F" "\<forall>\<^sub>F x in F. 0 \<le> f x" "0 < b" |
3012 |
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
|
3013 |
using tendsto_powr2[OF assms] by simp |
51527 | 3014 |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3015 |
lemma continuous_on_powr': |
63558 | 3016 |
fixes f g :: "_ \<Rightarrow> real" |
3017 |
assumes "continuous_on s f" "continuous_on s g" |
|
3018 |
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
|
3019 |
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
|
3020 |
unfolding continuous_on_def |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3021 |
proof |
63558 | 3022 |
fix x |
3023 |
assume x: "x \<in> s" |
|
63295
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3024 |
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
|
3025 |
proof (cases "f x = 0") |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3026 |
case True |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3027 |
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
|
3028 |
by (auto simp: at_within_def eventually_inf_principal) |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3029 |
with True x assms show ?thesis |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3030 |
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
|
3031 |
next |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3032 |
case False |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3033 |
with assms x show ?thesis |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3034 |
by (auto intro!: tendsto_powr' simp: continuous_on_def) |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3035 |
qed |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3036 |
qed |
52792bb9126e
Facts about HK integration, complex powers, Gamma function
eberlm
parents:
63170
diff
changeset
|
3037 |
|
51527 | 3038 |
lemma tendsto_neg_powr: |
53079 | 3039 |
assumes "s < 0" |
60182
e1ea5a6379c9
generalized tends over powr; added DERIV rule for powr
hoelzl
parents:
60162
diff
changeset
|
3040 |
and f: "LIM x F. f x :> at_top" |
61973 | 3041 |
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
|
3042 |
proof - |
61973 | 3043 |
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
|
3044 |
by (auto intro!: filterlim_compose[OF exp_at_bot] filterlim_compose[OF ln_at_top] |
63558 | 3045 |
filterlim_tendsto_neg_mult_at_bot assms) |
61973 | 3046 |
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
|
3047 |
using f filterlim_at_top_dense[of f F] |
61810 | 3048 |
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
|
3049 |
finally show ?thesis . |
51527 | 3050 |
qed |
3051 |
||
63558 | 3052 |
lemma tendsto_exp_limit_at_right: "((\<lambda>y. (1 + x * y) powr (1 / y)) \<longlongrightarrow> exp x) (at_right 0)" |
3053 |
for x :: real |
|
3054 |
proof (cases "x = 0") |
|
3055 |
case True |
|
3056 |
then show ?thesis by simp |
|
3057 |
next |
|
3058 |
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
|
3059 |
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
|
3060 |
by (auto intro!: derivative_eq_intros) |
61973 | 3061 |
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
|
3062 |
by (auto simp add: has_field_derivative_def field_has_derivative_at) |
61973 | 3063 |
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
|
3064 |
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
|
3065 |
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
|
3066 |
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
|
3067 |
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
|
3068 |
unfolding eventually_at_right[OF zero_less_one] |
63558 | 3069 |
using False |
3070 |
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
|
3071 |
apply (auto simp: field_simps powr_def abs_if) |
63558 | 3072 |
apply (metis add_less_same_cancel1 mult_less_0_iff not_less_iff_gr_or_eq zero_less_one) |
3073 |
done |
|
57275
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
3074 |
qed (simp_all add: at_eq_sup_left_right) |
63558 | 3075 |
qed |
3076 |
||
3077 |
lemma tendsto_exp_limit_at_top: "((\<lambda>y. (1 + x / y) powr y) \<longlongrightarrow> exp x) at_top" |
|
3078 |
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
|
3079 |
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
|
3080 |
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
|
3081 |
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
|
3082 |
done |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
3083 |
|
63558 | 3084 |
lemma tendsto_exp_limit_sequentially: "(\<lambda>n. (1 + x / n) ^ n) \<longlonglongrightarrow> exp x" |
3085 |
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
|
3086 |
proof (rule filterlim_mono_eventually) |
61944 | 3087 |
from reals_Archimedean2 [of "\<bar>x\<bar>"] obtain n :: nat where *: "real n > \<bar>x\<bar>" .. |
63558 | 3088 |
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
|
3089 |
apply (intro eventually_sequentiallyI [of n]) |
63558 | 3090 |
apply (cases "x \<ge> 0") |
3091 |
apply (rule add_pos_nonneg) |
|
3092 |
apply (auto intro: divide_nonneg_nonneg) |
|
3093 |
apply (subgoal_tac "x / real xa > - 1") |
|
3094 |
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
|
3095 |
done |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
3096 |
then show "eventually (\<lambda>n. (1 + x / n) powr n = (1 + x / n) ^ n) at_top" |
61810 | 3097 |
by (rule eventually_mono) (erule powr_realpow) |
61969 | 3098 |
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
|
3099 |
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
|
3100 |
qed auto |
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents:
57180
diff
changeset
|
3101 |
|
63558 | 3102 |
|
60758 | 3103 |
subsection \<open>Sine and Cosine\<close> |
29164 | 3104 |
|
63558 | 3105 |
definition sin_coeff :: "nat \<Rightarrow> real" |
3106 |
where "sin_coeff = (\<lambda>n. if even n then 0 else (- 1) ^ ((n - Suc 0) div 2) / (fact n))" |
|
3107 |
||
3108 |
definition cos_coeff :: "nat \<Rightarrow> real" |
|
3109 |
where "cos_coeff = (\<lambda>n. if even n then ((- 1) ^ (n div 2)) / (fact n) else 0)" |
|
31271 | 3110 |
|
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
|
3111 |
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
|
3112 |
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
|
3113 |
|
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
|
3114 |
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
|
3115 |
where "cos = (\<lambda>x. \<Sum>n. cos_coeff n *\<^sub>R x^n)" |
31271 | 3116 |
|
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3117 |
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
|
3118 |
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
|
3119 |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3120 |
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
|
3121 |
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
|
3122 |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3123 |
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
|
3124 |
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
|
3125 |
by (simp del: mult_Suc) |
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3126 |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3127 |
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
|
3128 |
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
|
3129 |
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
|
3130 |
|
63558 | 3131 |
lemma summable_norm_sin: "summable (\<lambda>n. norm (sin_coeff n *\<^sub>R x^n))" |
3132 |
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
|
3133 |
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
|
3134 |
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
|
3135 |
apply (auto simp: divide_inverse abs_mult power_abs [symmetric] zero_le_mult_iff) |
53079 | 3136 |
done |
29164 | 3137 |
|
63558 | 3138 |
lemma summable_norm_cos: "summable (\<lambda>n. norm (cos_coeff n *\<^sub>R x^n))" |
3139 |
for x :: "'a::{real_normed_algebra_1,banach}" |
|
53079 | 3140 |
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
|
3141 |
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
|
3142 |
apply (auto simp: divide_inverse abs_mult power_abs [symmetric] zero_le_mult_iff) |
53079 | 3143 |
done |
29164 | 3144 |
|
63558 | 3145 |
lemma sin_converges: "(\<lambda>n. sin_coeff n *\<^sub>R x^n) sums sin x" |
3146 |
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
|
3147 |
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
|
3148 |
|
63558 | 3149 |
lemma cos_converges: "(\<lambda>n. cos_coeff n *\<^sub>R x^n) sums cos x" |
3150 |
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
|
3151 |
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
|
3152 |
|
63558 | 3153 |
lemma sin_of_real: "sin (of_real x) = of_real (sin x)" |
3154 |
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
|
3155 |
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
|
3156 |
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
|
3157 |
proof |
63558 | 3158 |
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
|
3159 |
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
|
3160 |
qed |
63558 | 3161 |
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
|
3162 |
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
|
3163 |
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
|
3164 |
then show ?thesis |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3165 |
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
|
3166 |
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
|
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 |
|
59862 | 3169 |
corollary sin_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> sin z \<in> \<real>" |
3170 |
by (metis Reals_cases Reals_of_real sin_of_real) |
|
3171 |
||
63558 | 3172 |
lemma cos_of_real: "cos (of_real x) = of_real (cos x)" |
3173 |
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
|
3174 |
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
|
3175 |
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
|
3176 |
proof |
63558 | 3177 |
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
|
3178 |
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
|
3179 |
qed |
63558 | 3180 |
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
|
3181 |
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
|
3182 |
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
|
3183 |
then show ?thesis |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3184 |
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
|
3185 |
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
|
3186 |
qed |
29164 | 3187 |
|
59862 | 3188 |
corollary cos_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> cos z \<in> \<real>" |
3189 |
by (metis Reals_cases Reals_of_real cos_of_real) |
|
3190 |
||
44319
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3191 |
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
|
3192 |
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
|
3193 |
|
806e0390de53
move sin_coeff and cos_coeff lemmas to Transcendental.thy; simplify some proofs
huffman
parents:
44318
diff
changeset
|
3194 |
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
|
3195 |
by (simp add: diffs_def cos_coeff_Suc del: of_nat_Suc) |
29164 | 3196 |
|
65036
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3197 |
lemma sin_int_times_real: "sin (of_int m * of_real x) = of_real (sin (of_int m * x))" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3198 |
by (metis sin_of_real of_real_mult of_real_of_int_eq) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3199 |
|
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3200 |
lemma cos_int_times_real: "cos (of_int m * of_real x) = of_real (cos (of_int m * x))" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3201 |
by (metis cos_of_real of_real_mult of_real_of_int_eq) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
3202 |
|
63558 | 3203 |
text \<open>Now at last we can get the derivatives of exp, sin and cos.\<close> |
3204 |
||
3205 |
lemma DERIV_sin [simp]: "DERIV sin x :> cos x" |
|
3206 |
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
|
3207 |
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
|
3208 |
apply (rule DERIV_cong) |
63558 | 3209 |
apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"]) |
3210 |
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
|
3211 |
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
|
3212 |
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
|
3213 |
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
|
3214 |
done |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3215 |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
3216 |
declare DERIV_sin[THEN DERIV_chain2, derivative_intros] |
63558 | 3217 |
and DERIV_sin[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
3218 |
||
3219 |
lemma DERIV_cos [simp]: "DERIV cos x :> - sin x" |
|
3220 |
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
|
3221 |
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
|
3222 |
apply (rule DERIV_cong) |
63558 | 3223 |
apply (rule termdiffs [where K="of_real (norm x) + 1 :: 'a"]) |
3224 |
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
|
3225 |
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
|
3226 |
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
|
3227 |
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
|
3228 |
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
|
3229 |
done |
29164 | 3230 |
|
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
3231 |
declare DERIV_cos[THEN DERIV_chain2, derivative_intros] |
63558 | 3232 |
and DERIV_cos[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
3233 |
||
3234 |
lemma isCont_sin: "isCont sin x" |
|
3235 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 3236 |
by (rule DERIV_sin [THEN DERIV_isCont]) |
3237 |
||
63558 | 3238 |
lemma isCont_cos: "isCont cos x" |
3239 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 3240 |
by (rule DERIV_cos [THEN DERIV_isCont]) |
3241 |
||
63558 | 3242 |
lemma isCont_sin' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. sin (f x)) a" |
3243 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}" |
|
44311 | 3244 |
by (rule isCont_o2 [OF _ isCont_sin]) |
3245 |
||
63558 | 3246 |
(* FIXME a context for f would be better *) |
3247 |
||
3248 |
lemma isCont_cos' [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. cos (f x)) a" |
|
3249 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}" |
|
44311 | 3250 |
by (rule isCont_o2 [OF _ isCont_cos]) |
3251 |
||
63558 | 3252 |
lemma tendsto_sin [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. sin (f x)) \<longlongrightarrow> sin a) F" |
3253 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}" |
|
44311 | 3254 |
by (rule isCont_tendsto_compose [OF isCont_sin]) |
3255 |
||
63558 | 3256 |
lemma tendsto_cos [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. cos (f x)) \<longlongrightarrow> cos a) F" |
3257 |
for f :: "_ \<Rightarrow> 'a::{real_normed_field,banach}" |
|
44311 | 3258 |
by (rule isCont_tendsto_compose [OF isCont_cos]) |
29164 | 3259 |
|
63558 | 3260 |
lemma continuous_sin [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. sin (f x))" |
3261 |
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
|
3262 |
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
|
3263 |
|
63558 | 3264 |
lemma continuous_on_sin [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. sin (f x))" |
3265 |
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
|
3266 |
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
|
3267 |
|
63558 | 3268 |
lemma continuous_within_sin: "continuous (at z within s) sin" |
3269 |
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
|
3270 |
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
|
3271 |
|
63558 | 3272 |
lemma continuous_cos [continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. cos (f x))" |
3273 |
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
|
3274 |
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
|
3275 |
|
63558 | 3276 |
lemma continuous_on_cos [continuous_intros]: "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. cos (f x))" |
3277 |
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
|
3278 |
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
|
3279 |
|
63558 | 3280 |
lemma continuous_within_cos: "continuous (at z within s) cos" |
3281 |
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
|
3282 |
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
|
3283 |
|
63558 | 3284 |
|
60758 | 3285 |
subsection \<open>Properties of Sine and Cosine\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3286 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3287 |
lemma sin_zero [simp]: "sin 0 = 0" |
63558 | 3288 |
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
|
3289 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3290 |
lemma cos_zero [simp]: "cos 0 = 1" |
63558 | 3291 |
by (simp add: cos_def cos_coeff_def scaleR_conv_of_real) |
3292 |
||
3293 |
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
|
3294 |
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
|
3295 |
|
63558 | 3296 |
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
|
3297 |
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
|
3298 |
|
63558 | 3299 |
|
60758 | 3300 |
subsection \<open>Deriving the Addition Formulas\<close> |
3301 |
||
63558 | 3302 |
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
|
3303 |
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
|
3304 |
fixes x :: "'a::{real_normed_field,banach}" |
63558 | 3305 |
shows |
3306 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3307 |
if even p \<and> even n |
|
3308 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) |
|
3309 |
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
|
3310 |
proof - |
63558 | 3311 |
have "(cos_coeff n * cos_coeff (p - n)) *\<^sub>R (x^n * y^(p - n)) = |
3312 |
(if even p \<and> even n then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p - n) |
|
3313 |
else 0)" |
|
3314 |
if "n \<le> p" for n p :: nat |
|
3315 |
proof - |
|
3316 |
from that have *: "even n \<Longrightarrow> even p \<Longrightarrow> |
|
3317 |
(-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
|
3318 |
by (metis div_add power_add le_add_diff_inverse odd_add) |
63558 | 3319 |
with that show ?thesis |
3320 |
by (auto simp: algebra_simps cos_coeff_def binomial_fact) |
|
3321 |
qed |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3322 |
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
|
3323 |
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
|
3324 |
(\<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
|
3325 |
by simp |
63558 | 3326 |
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
|
3327 |
by (simp add: algebra_simps) |
63558 | 3328 |
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
|
3329 |
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
|
3330 |
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
|
3331 |
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
|
3332 |
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
|
3333 |
|
63558 | 3334 |
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
|
3335 |
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
|
3336 |
fixes x :: "'a::{real_normed_field,banach}" |
63558 | 3337 |
shows |
3338 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3339 |
if even p \<and> odd n |
|
3340 |
then - ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3341 |
else 0) |
|
3342 |
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
|
3343 |
proof - |
63558 | 3344 |
have "(sin_coeff n * sin_coeff (p - n)) *\<^sub>R (x^n * y^(p-n)) = |
3345 |
(if even p \<and> odd n |
|
3346 |
then -((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3347 |
else 0)" |
|
3348 |
if "n \<le> p" for n p :: nat |
|
3349 |
proof - |
|
3350 |
have "(-1) ^ ((n - Suc 0) div 2) * (-1) ^ ((p - Suc n) div 2) = - ((-1 :: real) ^ (p div 2))" |
|
3351 |
if np: "odd n" "even p" |
|
3352 |
proof - |
|
3353 |
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
|
3354 |
by arith+ |
63558 | 3355 |
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
|
3356 |
by simp |
63558 | 3357 |
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
|
3358 |
apply (simp add: power_add [symmetric] div_add [symmetric] del: div_add) |
63558 | 3359 |
apply (metis (no_types) One_nat_def Suc_1 le_div_geq minus_minus |
3360 |
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
|
3361 |
done |
63558 | 3362 |
qed |
3363 |
then show ?thesis |
|
3364 |
using \<open>n\<le>p\<close> by (auto simp: algebra_simps sin_coeff_def binomial_fact) |
|
3365 |
qed |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3366 |
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
|
3367 |
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
|
3368 |
(\<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
|
3369 |
by simp |
63558 | 3370 |
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
|
3371 |
by (simp add: algebra_simps) |
63558 | 3372 |
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
|
3373 |
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
|
3374 |
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
|
3375 |
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
|
3376 |
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
|
3377 |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3378 |
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
|
3379 |
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
|
3380 |
shows |
63558 | 3381 |
"(\<lambda>p. \<Sum>n\<le>p. |
3382 |
if even p |
|
3383 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3384 |
else 0) |
|
3385 |
sums cos (x + y)" |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3386 |
proof - |
63558 | 3387 |
have |
3388 |
"(\<Sum>n\<le>p. |
|
3389 |
if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3390 |
else 0) = cos_coeff p *\<^sub>R ((x + y) ^ p)" |
|
3391 |
for p :: nat |
|
3392 |
proof - |
|
3393 |
have |
|
3394 |
"(\<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) = |
|
3395 |
(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
|
3396 |
by simp |
63558 | 3397 |
also have "\<dots> = |
3398 |
(if even p |
|
3399 |
then of_real ((-1) ^ (p div 2) / (fact p)) * (\<Sum>n\<le>p. (p choose n) *\<^sub>R (x^n) * y^(p-n)) |
|
3400 |
else 0)" |
|
64267 | 3401 |
by (auto simp: sum_distrib_left field_simps scaleR_conv_of_real nonzero_of_real_divide) |
63558 | 3402 |
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
|
3403 |
by (simp add: cos_coeff_def binomial_ring [of x y] scaleR_conv_of_real atLeast0AtMost) |
63558 | 3404 |
finally show ?thesis . |
3405 |
qed |
|
3406 |
then have |
|
3407 |
"(\<lambda>p. \<Sum>n\<le>p. |
|
3408 |
if even p |
|
3409 |
then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) |
|
3410 |
else 0) = (\<lambda>p. cos_coeff p *\<^sub>R ((x+y)^p))" |
|
3411 |
by simp |
|
3412 |
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
|
3413 |
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
|
3414 |
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
|
3415 |
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
|
3416 |
|
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3417 |
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
|
3418 |
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
|
3419 |
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
|
3420 |
proof - |
63558 | 3421 |
have |
3422 |
"(if even p \<and> even n |
|
3423 |
then ((- 1) ^ (p div 2) * int (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) - |
|
3424 |
(if even p \<and> odd n |
|
3425 |
then - ((- 1) ^ (p div 2) * int (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0) = |
|
3426 |
(if even p then ((-1) ^ (p div 2) * (p choose n) / (fact p)) *\<^sub>R (x^n) * y^(p-n) else 0)" |
|
3427 |
if "n \<le> p" for n p :: nat |
|
3428 |
by simp |
|
3429 |
then have |
|
3430 |
"(\<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)) |
|
3431 |
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
|
3432 |
using sums_diff [OF cos_x_cos_y [of x y] sin_x_sin_y [of x y]] |
64267 | 3433 |
by (simp add: sum_subtractf [symmetric]) |
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
|
3434 |
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
|
3435 |
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
|
3436 |
qed |
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3437 |
|
63558 | 3438 |
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
|
3439 |
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
|
3440 |
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
|
3441 |
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
|
3442 |
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
|
3443 |
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
|
3444 |
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
|
3445 |
|
63558 | 3446 |
lemma sin_minus [simp]: "sin (- x) = - sin x" |
3447 |
for x :: "'a::{real_normed_algebra_1,banach}" |
|
3448 |
using sin_minus_converges [of x] |
|
3449 |
by (auto simp: sin_def summable_norm_sin [THEN summable_norm_cancel] |
|
3450 |
suminf_minus sums_iff equation_minus_iff) |
|
3451 |
||
3452 |
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
|
3453 |
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
|
3454 |
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
|
3455 |
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
|
3456 |
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
|
3457 |
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
|
3458 |
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
|
3459 |
|
63558 | 3460 |
lemma cos_minus [simp]: "cos (-x) = cos x" |
3461 |
for x :: "'a::{real_normed_algebra_1,banach}" |
|
3462 |
using cos_minus_converges [of x] |
|
3463 |
by (simp add: cos_def summable_norm_cos [THEN summable_norm_cancel] |
|
3464 |
suminf_minus sums_iff equation_minus_iff) |
|
3465 |
||
3466 |
lemma sin_cos_squared_add [simp]: "(sin x)\<^sup>2 + (cos x)\<^sup>2 = 1" |
|
3467 |
for x :: "'a::{real_normed_field,banach}" |
|
3468 |
using cos_add [of x "-x"] |
|
3469 |
by (simp add: power2_eq_square algebra_simps) |
|
3470 |
||
3471 |
lemma sin_cos_squared_add2 [simp]: "(cos x)\<^sup>2 + (sin x)\<^sup>2 = 1" |
|
3472 |
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
|
3473 |
by (subst add.commute, rule sin_cos_squared_add) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3474 |
|
63558 | 3475 |
lemma sin_cos_squared_add3 [simp]: "cos x * cos x + sin x * sin x = 1" |
3476 |
for x :: "'a::{real_normed_field,banach}" |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3477 |
using sin_cos_squared_add2 [unfolded power2_eq_square] . |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3478 |
|
63558 | 3479 |
lemma sin_squared_eq: "(sin x)\<^sup>2 = 1 - (cos x)\<^sup>2" |
3480 |
for x :: "'a::{real_normed_field,banach}" |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3481 |
unfolding eq_diff_eq by (rule sin_cos_squared_add) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3482 |
|
63558 | 3483 |
lemma cos_squared_eq: "(cos x)\<^sup>2 = 1 - (sin x)\<^sup>2" |
3484 |
for x :: "'a::{real_normed_field,banach}" |
|
44308
d2a6f9af02f4
Transcendental.thy: remove several unused lemmas and simplify some proofs
huffman
parents:
44307
diff
changeset
|
3485 |
unfolding eq_diff_eq by (rule sin_cos_squared_add2) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3486 |
|
63558 | 3487 |
lemma abs_sin_le_one [simp]: "\<bar>sin x\<bar> \<le> 1" |
3488 |
for x :: real |
|
3489 |
by (rule power2_le_imp_le) (simp_all add: sin_squared_eq) |
|
3490 |
||
3491 |
lemma sin_ge_minus_one [simp]: "- 1 \<le> sin x" |
|
3492 |
for x :: real |
|
3493 |
using abs_sin_le_one [of x] by (simp add: abs_le_iff) |
|
3494 |
||
3495 |
lemma sin_le_one [simp]: "sin x \<le> 1" |
|
3496 |
for x :: real |
|
3497 |
using abs_sin_le_one [of x] by (simp add: abs_le_iff) |
|
3498 |
||
3499 |
lemma abs_cos_le_one [simp]: "\<bar>cos x\<bar> \<le> 1" |
|
3500 |
for x :: real |
|
3501 |
by (rule power2_le_imp_le) (simp_all add: cos_squared_eq) |
|
3502 |
||
3503 |
lemma cos_ge_minus_one [simp]: "- 1 \<le> cos x" |
|
3504 |
for x :: real |
|
3505 |
using abs_cos_le_one [of x] by (simp add: abs_le_iff) |
|
3506 |
||
3507 |
lemma cos_le_one [simp]: "cos x \<le> 1" |
|
3508 |
for x :: real |
|
3509 |
using abs_cos_le_one [of x] by (simp add: abs_le_iff) |
|
3510 |
||
3511 |
lemma cos_diff: "cos (x - y) = cos x * cos y + sin x * sin y" |
|
3512 |
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
|
3513 |
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
|
3514 |
|
63558 | 3515 |
lemma cos_double: "cos(2*x) = (cos x)\<^sup>2 - (sin x)\<^sup>2" |
3516 |
for x :: "'a::{real_normed_field,banach}" |
|
3517 |
using cos_add [where x=x and y=x] by (simp add: power2_eq_square) |
|
3518 |
||
3519 |
lemma sin_cos_le1: "\<bar>sin x * sin y + cos x * cos y\<bar> \<le> 1" |
|
3520 |
for x :: real |
|
3521 |
using cos_diff [of x y] by (metis abs_cos_le_one add.commute) |
|
3522 |
||
3523 |
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
|
3524 |
by (auto intro!: derivative_eq_intros simp:) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3525 |
|
63558 | 3526 |
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
|
3527 |
by (auto intro!: derivative_intros) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3528 |
|
63558 | 3529 |
|
60758 | 3530 |
subsection \<open>The Constant Pi\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3531 |
|
53079 | 3532 |
definition pi :: real |
63558 | 3533 |
where "pi = 2 * (THE x. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0)" |
3534 |
||
3535 |
text \<open>Show that there's a least positive @{term x} with @{term "cos x = 0"}; |
|
60758 | 3536 |
hence define pi.\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3537 |
|
63558 | 3538 |
lemma sin_paired: "(\<lambda>n. (- 1) ^ n / (fact (2 * n + 1)) * x ^ (2 * n + 1)) sums sin x" |
3539 |
for x :: real |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3540 |
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
|
3541 |
have "(\<lambda>n. \<Sum>k = n*2..<n * 2 + 2. sin_coeff k * x ^ k) sums sin x" |
63558 | 3542 |
by (rule sums_group) (use sin_converges [of x, unfolded scaleR_conv_of_real] in auto) |
3543 |
then show ?thesis |
|
3544 |
by (simp add: sin_coeff_def ac_simps) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3545 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3546 |
|
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
|
3547 |
lemma sin_gt_zero_02: |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3548 |
fixes x :: real |
53079 | 3549 |
assumes "0 < x" and "x < 2" |
3550 |
shows "0 < sin x" |
|
44728 | 3551 |
proof - |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3552 |
let ?f = "\<lambda>n::nat. \<Sum>k = n*2..<n*2+2. (- 1) ^ k / (fact (2*k+1)) * x^(2*k+1)" |
44728 | 3553 |
have pos: "\<forall>n. 0 < ?f n" |
3554 |
proof |
|
3555 |
fix n :: nat |
|
3556 |
let ?k2 = "real (Suc (Suc (4 * n)))" |
|
3557 |
let ?k3 = "real (Suc (Suc (Suc (4 * n))))" |
|
3558 |
have "x * x < ?k2 * ?k3" |
|
3559 |
using assms by (intro mult_strict_mono', simp_all) |
|
63558 | 3560 |
then have "x * x * x * x ^ (n * 4) < ?k2 * ?k3 * x * x ^ (n * 4)" |
60758 | 3561 |
by (intro mult_strict_right_mono zero_less_power \<open>0 < x\<close>) |
63558 | 3562 |
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
|
3563 |
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
|
3564 |
qed |
44728 | 3565 |
have sums: "?f sums sin x" |
63558 | 3566 |
by (rule sin_paired [THEN sums_group]) simp |
44728 | 3567 |
show "0 < sin x" |
3568 |
unfolding sums_unique [OF sums] |
|
3569 |
using sums_summable [OF sums] pos |
|
56213 | 3570 |
by (rule suminf_pos) |
44728 | 3571 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3572 |
|
63558 | 3573 |
lemma cos_double_less_one: "0 < x \<Longrightarrow> x < 2 \<Longrightarrow> cos (2 * x) < 1" |
3574 |
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
|
3575 |
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
|
3576 |
|
63558 | 3577 |
lemma cos_paired: "(\<lambda>n. (- 1) ^ n / (fact (2 * n)) * x ^ (2 * n)) sums cos x" |
3578 |
for x :: real |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3579 |
proof - |
31271 | 3580 |
have "(\<lambda>n. \<Sum>k = n * 2..<n * 2 + 2. cos_coeff k * x ^ k) sums cos x" |
63558 | 3581 |
by (rule sums_group) (use cos_converges [of x, unfolded scaleR_conv_of_real] in auto) |
3582 |
then show ?thesis |
|
3583 |
by (simp add: cos_coeff_def ac_simps) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3584 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3585 |
|
53602 | 3586 |
lemmas realpow_num_eq_if = power_eq_if |
3587 |
||
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
|
3588 |
lemma sumr_pos_lt_pair: |
56193
c726ecfb22b6
cleanup Series: sorted according to typeclass hierarchy, use {..<_} instead of {0..<_}
hoelzl
parents:
56181
diff
changeset
|
3589 |
fixes f :: "nat \<Rightarrow> real" |
63558 | 3590 |
shows "summable f \<Longrightarrow> |
3591 |
(\<And>d. 0 < f (k + (Suc(Suc 0) * d)) + f (k + ((Suc (Suc 0) * d) + 1))) \<Longrightarrow> |
|
64267 | 3592 |
sum f {..<k} < suminf f" |
63558 | 3593 |
apply (simp only: One_nat_def) |
3594 |
apply (subst suminf_split_initial_segment [where k=k]) |
|
3595 |
apply assumption |
|
3596 |
apply simp |
|
3597 |
apply (drule_tac k=k in summable_ignore_initial_segment) |
|
3598 |
apply (drule_tac k="Suc (Suc 0)" in sums_group [OF summable_sums]) |
|
3599 |
apply simp |
|
3600 |
apply simp |
|
3601 |
apply (metis (no_types, lifting) add.commute suminf_pos summable_def sums_unique) |
|
3602 |
done |
|
3603 |
||
3604 |
lemma cos_two_less_zero [simp]: "cos 2 < (0::real)" |
|
53602 | 3605 |
proof - |
63367
6c731c8b7f03
simplified definitions of combinatorial functions
haftmann
parents:
63365
diff
changeset
|
3606 |
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
|
3607 |
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
|
3608 |
have *: "(\<lambda>n. - ((- 1) ^ n * 2 ^ (2 * n) / fact (2 * n))) sums - cos (2::real)" |
53602 | 3609 |
by simp |
60162 | 3610 |
then have sm: "summable (\<lambda>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
53602 | 3611 |
by (rule sums_summable) |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3612 |
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
|
3613 |
by (simp add: fact_num_eq_if realpow_num_eq_if) |
63558 | 3614 |
moreover have "(\<Sum>n<Suc (Suc (Suc 0)). - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n)))) < |
3615 |
(\<Sum>n. - ((- 1) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
|
53602 | 3616 |
proof - |
63558 | 3617 |
{ |
3618 |
fix d |
|
60162 | 3619 |
let ?six4d = "Suc (Suc (Suc (Suc (Suc (Suc (4 * d))))))" |
3620 |
have "(4::real) * (fact (?six4d)) < (Suc (Suc (?six4d)) * fact (Suc (?six4d)))" |
|
63558 | 3621 |
unfolding of_nat_mult by (rule mult_strict_mono) (simp_all add: fact_less_mono) |
60162 | 3622 |
then have "(4::real) * (fact (?six4d)) < (fact (Suc (Suc (?six4d))))" |
63367
6c731c8b7f03
simplified definitions of combinatorial functions
haftmann
parents:
63365
diff
changeset
|
3623 |
by (simp only: fact_Suc [of "Suc (?six4d)"] of_nat_mult of_nat_fact) |
60162 | 3624 |
then have "(4::real) * inverse (fact (Suc (Suc (?six4d)))) < inverse (fact (?six4d))" |
53602 | 3625 |
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
|
3626 |
} |
60162 | 3627 |
then show ?thesis |
60867 | 3628 |
by (force intro!: sumr_pos_lt_pair [OF sm] simp add: divide_inverse algebra_simps) |
53602 | 3629 |
qed |
59730
b7c394c7a619
The factorial function, "fact", now has type "nat => 'a"
paulson <lp15@cam.ac.uk>
parents:
59669
diff
changeset
|
3630 |
ultimately have "0 < (\<Sum>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
53602 | 3631 |
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
|
3632 |
moreover from * have "- cos 2 = (\<Sum>n. - ((- 1::real) ^ n * 2 ^ (2 * n) / (fact (2 * n))))" |
53602 | 3633 |
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
|
3634 |
ultimately have "(0::real) < - cos 2" by simp |
53602 | 3635 |
then show ?thesis by simp |
3636 |
qed |
|
23053 | 3637 |
|
3638 |
lemmas cos_two_neq_zero [simp] = cos_two_less_zero [THEN less_imp_neq] |
|
3639 |
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
|
3640 |
|
63558 | 3641 |
lemma cos_is_zero: "\<exists>!x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
44730 | 3642 |
proof (rule ex_ex1I) |
63558 | 3643 |
show "\<exists>x::real. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
3644 |
by (rule IVT2) simp_all |
|
44730 | 3645 |
next |
63558 | 3646 |
fix x y :: real |
44730 | 3647 |
assume x: "0 \<le> x \<and> x \<le> 2 \<and> cos x = 0" |
3648 |
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
|
3649 |
have [simp]: "\<forall>x::real. cos differentiable (at x)" |
56181
2aa0b19e74f3
unify syntax for has_derivative and differentiable
hoelzl
parents:
56167
diff
changeset
|
3650 |
unfolding real_differentiable_def by (auto intro: DERIV_cos) |
63558 | 3651 |
from x y less_linear [of x y] show "x = y" |
3652 |
apply auto |
|
3653 |
apply (drule_tac f = cos in Rolle) |
|
3654 |
apply (drule_tac [5] f = cos in Rolle) |
|
3655 |
apply (auto dest!: DERIV_cos [THEN DERIV_unique]) |
|
3656 |
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
|
3657 |
apply (metis order_less_le_trans less_le sin_gt_zero_02) |
44730 | 3658 |
done |
3659 |
qed |
|
31880 | 3660 |
|
63558 | 3661 |
lemma pi_half: "pi/2 = (THE x. 0 \<le> x \<and> x \<le> 2 \<and> cos x = 0)" |
53079 | 3662 |
by (simp add: pi_def) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3663 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3664 |
lemma cos_pi_half [simp]: "cos (pi / 2) = 0" |
53079 | 3665 |
by (simp add: pi_half cos_is_zero [THEN theI']) |
23053 | 3666 |
|
63558 | 3667 |
lemma cos_of_real_pi_half [simp]: "cos ((of_real pi / 2) :: 'a) = 0" |
3668 |
if "SORT_CONSTRAINT('a::{real_field,banach,real_normed_algebra_1})" |
|
3669 |
by (metis cos_pi_half cos_of_real eq_numeral_simps(4) |
|
3670 |
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
|
3671 |
|
23053 | 3672 |
lemma pi_half_gt_zero [simp]: "0 < pi / 2" |
53079 | 3673 |
apply (rule order_le_neq_trans) |
63558 | 3674 |
apply (simp add: pi_half cos_is_zero [THEN theI']) |
54575 | 3675 |
apply (metis cos_pi_half cos_zero zero_neq_one) |
53079 | 3676 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3677 |
|
23053 | 3678 |
lemmas pi_half_neq_zero [simp] = pi_half_gt_zero [THEN less_imp_neq, symmetric] |
3679 |
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
|
3680 |
|
23053 | 3681 |
lemma pi_half_less_two [simp]: "pi / 2 < 2" |
53079 | 3682 |
apply (rule order_le_neq_trans) |
63558 | 3683 |
apply (simp add: pi_half cos_is_zero [THEN theI']) |
54575 | 3684 |
apply (metis cos_pi_half cos_two_neq_zero) |
53079 | 3685 |
done |
23053 | 3686 |
|
3687 |
lemmas pi_half_neq_two [simp] = pi_half_less_two [THEN less_imp_neq] |
|
3688 |
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
|
3689 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3690 |
lemma pi_gt_zero [simp]: "0 < pi" |
53079 | 3691 |
using pi_half_gt_zero by simp |
23053 | 3692 |
|
3693 |
lemma pi_ge_zero [simp]: "0 \<le> pi" |
|
53079 | 3694 |
by (rule pi_gt_zero [THEN order_less_imp_le]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3695 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3696 |
lemma pi_neq_zero [simp]: "pi \<noteq> 0" |
53079 | 3697 |
by (rule pi_gt_zero [THEN less_imp_neq, symmetric]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3698 |
|
23053 | 3699 |
lemma pi_not_less_zero [simp]: "\<not> pi < 0" |
53079 | 3700 |
by (simp add: linorder_not_less) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3701 |
|
29165
562f95f06244
cleaned up some proofs; removed redundant simp rules
huffman
parents:
29164
diff
changeset
|
3702 |
lemma minus_pi_half_less_zero: "-(pi/2) < 0" |
53079 | 3703 |
by simp |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3704 |
|
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
|
3705 |
lemma m2pi_less_pi: "- (2*pi) < pi" |
53079 | 3706 |
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
|
3707 |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3708 |
lemma sin_pi_half [simp]: "sin(pi/2) = 1" |
53079 | 3709 |
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
|
3710 |
using sin_gt_zero_02 [OF pi_half_gt_zero pi_half_less_two] |
53079 | 3711 |
by (simp add: power2_eq_1_iff) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3712 |
|
63558 | 3713 |
lemma sin_of_real_pi_half [simp]: "sin ((of_real pi / 2) :: 'a) = 1" |
3714 |
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
|
3715 |
using sin_pi_half |
63558 | 3716 |
by (metis sin_pi_half eq_numeral_simps(4) nonzero_of_real_divide of_real_1 of_real_numeral sin_of_real) |
3717 |
||
3718 |
lemma sin_cos_eq: "sin x = cos (of_real pi / 2 - x)" |
|
3719 |
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
|
3720 |
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
|
3721 |
|
63558 | 3722 |
lemma minus_sin_cos_eq: "- sin x = cos (x + of_real pi / 2)" |
3723 |
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
|
3724 |
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
|
3725 |
|
63558 | 3726 |
lemma cos_sin_eq: "cos x = sin (of_real pi / 2 - x)" |
3727 |
for x :: "'a::{real_normed_field,banach}" |
|
3728 |
using sin_cos_eq [of "of_real pi / 2 - x"] by simp |
|
3729 |
||
3730 |
lemma sin_add: "sin (x + y) = sin x * cos y + cos x * sin y" |
|
3731 |
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
|
3732 |
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
|
3733 |
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
|
3734 |
|
63558 | 3735 |
lemma sin_diff: "sin (x - y) = sin x * cos y - cos x * sin y" |
3736 |
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
|
3737 |
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
|
3738 |
|
63558 | 3739 |
lemma sin_double: "sin(2 * x) = 2 * sin x * cos x" |
3740 |
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
|
3741 |
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
|
3742 |
|
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
|
3743 |
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
|
3744 |
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
|
3745 |
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
|
3746 |
|
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
|
3747 |
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
|
3748 |
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
|
3749 |
by (simp add: sin_of_real) |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
3750 |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3751 |
lemma cos_pi [simp]: "cos pi = -1" |
53079 | 3752 |
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
|
3753 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3754 |
lemma sin_pi [simp]: "sin pi = 0" |
53079 | 3755 |
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
|
3756 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3757 |
lemma sin_periodic_pi [simp]: "sin (x + pi) = - sin x" |
53079 | 3758 |
by (simp add: sin_add) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3759 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3760 |
lemma sin_periodic_pi2 [simp]: "sin (pi + x) = - sin x" |
53079 | 3761 |
by (simp add: sin_add) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3762 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3763 |
lemma cos_periodic_pi [simp]: "cos (x + pi) = - cos x" |
53079 | 3764 |
by (simp add: cos_add) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3765 |
|
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
|
3766 |
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
|
3767 |
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
|
3768 |
|
63558 | 3769 |
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
|
3770 |
by (simp add: sin_add sin_double cos_double) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3771 |
|
63558 | 3772 |
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
|
3773 |
by (simp add: cos_add sin_double cos_double) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3774 |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
3775 |
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
|
3776 |
by (induct n) (auto simp: distrib_right) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3777 |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
3778 |
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
|
3779 |
by (metis cos_npi mult.commute) |
15383 | 3780 |
|
63558 | 3781 |
lemma sin_npi [simp]: "sin (real n * pi) = 0" |
3782 |
for n :: nat |
|
3783 |
by (induct n) (auto simp: distrib_right) |
|
3784 |
||
3785 |
lemma sin_npi2 [simp]: "sin (pi * real n) = 0" |
|
3786 |
for n :: nat |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57492
diff
changeset
|
3787 |
by (simp add: mult.commute [of pi]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3788 |
|
63558 | 3789 |
lemma cos_two_pi [simp]: "cos (2 * pi) = 1" |
53079 | 3790 |
by (simp add: cos_double) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3791 |
|
63558 | 3792 |
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
|
3793 |
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
|
3794 |
|
63558 | 3795 |
lemma sin_times_sin: "sin w * sin z = (cos (w - z) - cos (w + z)) / 2" |
3796 |
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
|
3797 |
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
|
3798 |
|
63558 | 3799 |
lemma sin_times_cos: "sin w * cos z = (sin (w + z) + sin (w - z)) / 2" |
3800 |
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
|
3801 |
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
|
3802 |
|
63558 | 3803 |
lemma cos_times_sin: "cos w * sin z = (sin (w + z) - sin (w - z)) / 2" |
3804 |
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
|
3805 |
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
|
3806 |
|
63558 | 3807 |
lemma cos_times_cos: "cos w * cos z = (cos (w - z) + cos (w + z)) / 2" |
3808 |
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
|
3809 |
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
|
3810 |
|
63558 | 3811 |
lemma sin_plus_sin: "sin w + sin z = 2 * sin ((w + z) / 2) * cos ((w - z) / 2)" |
3812 |
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
|
3813 |
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
|
3814 |
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
|
3815 |
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
|
3816 |
|
63558 | 3817 |
lemma sin_diff_sin: "sin w - sin z = 2 * sin ((w - z) / 2) * cos ((w + z) / 2)" |
3818 |
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
|
3819 |
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
|
3820 |
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
|
3821 |
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
|
3822 |
|
63558 | 3823 |
lemma cos_plus_cos: "cos w + cos z = 2 * cos ((w + z) / 2) * cos ((w - z) / 2)" |
3824 |
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
|
3825 |
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
|
3826 |
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
|
3827 |
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
|
3828 |
|
63558 | 3829 |
lemma cos_diff_cos: "cos w - cos z = 2 * sin ((w + z) / 2) * sin ((z - w) / 2)" |
3830 |
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
|
3831 |
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
|
3832 |
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
|
3833 |
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
|
3834 |
|
63558 | 3835 |
lemma cos_double_cos: "cos (2 * z) = 2 * cos z ^ 2 - 1" |
3836 |
for z :: "'a::{real_normed_field,banach}" |
|
3837 |
by (simp add: cos_double sin_squared_eq) |
|
3838 |
||
3839 |
lemma cos_double_sin: "cos (2 * z) = 1 - 2 * sin z ^ 2" |
|
3840 |
for z :: "'a::{real_normed_field,banach}" |
|
3841 |
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
|
3842 |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3843 |
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
|
3844 |
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
|
3845 |
|
63558 | 3846 |
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
|
3847 |
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
|
3848 |
|
5b762cd73a8e
Lots of new material on complex-valued functions. Modified simplification of (x/n)^k
paulson <lp15@cam.ac.uk>
parents:
59731
diff
changeset
|
3849 |
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
|
3850 |
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
|
3851 |
|
63558 | 3852 |
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
|
3853 |
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
|
3854 |
|
63558 | 3855 |
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
|
3856 |
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
|
3857 |
|
63558 | 3858 |
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
|
3859 |
by (metis (no_types, hide_lams) cos_add cos_minus cos_two_pi sin_minus sin_two_pi |
63558 | 3860 |
diff_0_right minus_diff_eq mult_1 mult_zero_left uminus_add_conv_diff) |
3861 |
||
3862 |
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
|
3863 |
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
|
3864 |
|
41970 | 3865 |
lemma sin_less_zero: |
53079 | 3866 |
assumes "- pi/2 < x" and "x < 0" |
3867 |
shows "sin x < 0" |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3868 |
proof - |
63558 | 3869 |
have "0 < sin (- x)" |
3870 |
using assms by (simp only: sin_gt_zero2) |
|
3871 |
then show ?thesis by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3872 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3873 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3874 |
lemma pi_less_4: "pi < 4" |
53079 | 3875 |
using pi_half_less_two by auto |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3876 |
|
63558 | 3877 |
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
|
3878 |
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
|
3879 |
|
63558 | 3880 |
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
|
3881 |
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
|
3882 |
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
|
3883 |
|
63558 | 3884 |
lemma cos_ge_zero: "-(pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> 0 \<le> cos x" |
3885 |
by (auto simp: order_le_less cos_gt_zero_pi) |
|
3886 |
(metis cos_pi_half eq_divide_eq eq_numeral_simps(4)) |
|
3887 |
||
3888 |
lemma sin_gt_zero: "0 < x \<Longrightarrow> x < pi \<Longrightarrow> 0 < sin x" |
|
53079 | 3889 |
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
|
3890 |
|
63558 | 3891 |
lemma sin_lt_zero: "pi < x \<Longrightarrow> x < 2 * pi \<Longrightarrow> sin x < 0" |
3892 |
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
|
3893 |
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
|
3894 |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3895 |
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
|
3896 |
proof (rule ccontr) |
63558 | 3897 |
assume "\<not> ?thesis" |
3898 |
then have "pi < 2" by auto |
|
3899 |
have "\<exists>y > pi. y < 2 \<and> y < 2 * pi" |
|
3900 |
proof (cases "2 < 2 * pi") |
|
3901 |
case True |
|
3902 |
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
|
3903 |
next |
63558 | 3904 |
case False |
3905 |
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
|
3906 |
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
|
3907 |
qed |
63558 | 3908 |
then obtain y where "pi < y" and "y < 2" and "y < 2 * pi" |
3909 |
by blast |
|
3910 |
then have "0 < sin y" |
|
3911 |
using sin_gt_zero_02 by auto |
|
3912 |
moreover have "sin y < 0" |
|
3913 |
using sin_gt_zero[of "y - pi"] \<open>pi < y\<close> and \<open>y < 2 * pi\<close> sin_periodic_pi[of "y - pi"] |
|
3914 |
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
|
3915 |
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
|
3916 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
3917 |
|
63558 | 3918 |
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
|
3919 |
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
|
3920 |
|
63558 | 3921 |
lemma sin_le_zero: "pi \<le> x \<Longrightarrow> x < 2 * pi \<Longrightarrow> sin x \<le> 0" |
3922 |
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
|
3923 |
|
62948
7700f467892b
lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
62679
diff
changeset
|
3924 |
lemma sin_pi_divide_n_ge_0 [simp]: |
63558 | 3925 |
assumes "n \<noteq> 0" |
3926 |
shows "0 \<le> sin (pi / real n)" |
|
3927 |
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
|
3928 |
|
7700f467892b
lots of new theorems for multivariate analysis
paulson <lp15@cam.ac.uk>
parents:
62679
diff
changeset
|
3929 |
lemma sin_pi_divide_n_gt_0: |
63558 | 3930 |
assumes "2 \<le> n" |
3931 |
shows "0 < sin (pi / real n)" |
|
3932 |
by (rule sin_gt_zero) (use assms in \<open>simp_all add: divide_simps\<close>) |
|
3933 |
||
3934 |
(* FIXME: This proof is almost identical to lemma \<open>cos_is_zero\<close>. |
|
3935 |
It should be possible to factor out some of the common parts. *) |
|
3936 |
lemma cos_total: |
|
3937 |
assumes y: "- 1 \<le> y" "y \<le> 1" |
|
3938 |
shows "\<exists>!x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y" |
|
44745 | 3939 |
proof (rule ex_ex1I) |
63558 | 3940 |
show "\<exists>x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y" |
3941 |
by (rule IVT2) (simp_all add: y) |
|
44745 | 3942 |
next |
3943 |
fix a b |
|
3944 |
assume a: "0 \<le> a \<and> a \<le> pi \<and> cos a = y" |
|
3945 |
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
|
3946 |
have [simp]: "\<forall>x::real. cos differentiable (at x)" |
56181
2aa0b19e74f3
unify syntax for has_derivative and differentiable
hoelzl
parents:
56167
diff
changeset
|
3947 |
unfolding real_differentiable_def by (auto intro: DERIV_cos) |
63558 | 3948 |
from a b less_linear [of a b] show "a = b" |
3949 |
apply auto |
|
3950 |
apply (drule_tac f = cos in Rolle) |
|
3951 |
apply (drule_tac [5] f = cos in Rolle) |
|
3952 |
apply (auto dest!: DERIV_cos [THEN DERIV_unique]) |
|
3953 |
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
|
3954 |
apply (metis order_less_le_trans less_le sin_gt_zero) |
44745 | 3955 |
done |
3956 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3957 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3958 |
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
|
3959 |
assumes y: "-1 \<le> y" "y \<le> 1" |
63558 | 3960 |
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
|
3961 |
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
|
3962 |
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
|
3963 |
obtain x where x: "0 \<le> x" "x \<le> pi" "cos x = y" |
63558 | 3964 |
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
|
3965 |
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
|
3966 |
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
|
3967 |
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
|
3968 |
apply (rule ex1I [where a="pi/2 - x"]) |
63558 | 3969 |
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
|
3970 |
using x |
63558 | 3971 |
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
|
3972 |
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
|
3973 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
3974 |
|
15229 | 3975 |
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
|
3976 |
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
|
3977 |
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
|
3978 |
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
|
3979 |
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
|
3980 |
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
|
3981 |
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
|
3982 |
obtain n where "real n * pi \<le> x" "x < real (Suc n) * pi" |
61942 | 3983 |
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
|
3984 |
using assms |
63558 | 3985 |
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
|
3986 |
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
|
3987 |
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
|
3988 |
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
|
3989 |
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
|
3990 |
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
|
3991 |
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
|
3992 |
then obtain \<theta> where \<theta>: "0 \<le> \<theta>" "\<theta> \<le> pi" "cos \<theta> = 0" |
63558 | 3993 |
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
|
3994 |
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
|
3995 |
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
|
3996 |
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
|
3997 |
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
|
3998 |
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
|
3999 |
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
|
4000 |
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
|
4001 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4002 |
|
63558 | 4003 |
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
|
4004 |
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
|
4005 |
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
|
4006 |
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
|
4007 |
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
|
4008 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4009 |
|
15229 | 4010 |
lemma cos_zero_iff: |
63558 | 4011 |
"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))))" |
4012 |
(is "?lhs = ?rhs") |
|
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
4013 |
proof - |
63558 | 4014 |
have *: "cos (real n * pi / 2) = 0" if "odd n" for n :: nat |
4015 |
proof - |
|
4016 |
from that obtain m where "n = 2 * m + 1" .. |
|
4017 |
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
|
4018 |
by (simp add: field_simps) (simp add: cos_add add_divide_distrib) |
63558 | 4019 |
qed |
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
4020 |
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
|
4021 |
proof |
63558 | 4022 |
show ?rhs if ?lhs |
4023 |
using that cos_zero_lemma [of x] cos_zero_lemma [of "-x"] by force |
|
4024 |
show ?lhs if ?rhs |
|
4025 |
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
|
4026 |
qed |
58709
efdc6c533bd3
prefer generic elimination rules for even/odd over specialized unfold rules for nat
haftmann
parents:
58656
diff
changeset
|
4027 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4028 |
|
15229 | 4029 |
lemma sin_zero_iff: |
63558 | 4030 |
"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))))" |
4031 |
(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
|
4032 |
proof |
63558 | 4033 |
show ?rhs if ?lhs |
4034 |
using that sin_zero_lemma [of x] sin_zero_lemma [of "-x"] by force |
|
4035 |
show ?lhs if ?rhs |
|
4036 |
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
|
4037 |
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
|
4038 |
|
63558 | 4039 |
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
|
4040 |
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
|
4041 |
assume "cos x = 0" |
63558 | 4042 |
then show "\<exists>n. odd n \<and> x = of_int n * (pi/2)" |
4043 |
apply (simp add: cos_zero_iff) |
|
4044 |
apply safe |
|
4045 |
apply (metis even_int_iff of_int_of_nat_eq) |
|
4046 |
apply (rule_tac x="- (int n)" in exI) |
|
4047 |
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
|
4048 |
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
|
4049 |
next |
63558 | 4050 |
fix n :: int |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
4051 |
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
|
4052 |
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
|
4053 |
apply (simp add: cos_zero_iff) |
63558 | 4054 |
apply (cases n rule: int_cases2) |
4055 |
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
|
4056 |
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
|
4057 |
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
|
4058 |
|
63558 | 4059 |
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
|
4060 |
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
|
4061 |
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
|
4062 |
then show "\<exists>n. even n \<and> x = of_int n * (pi / 2)" |
63558 | 4063 |
apply (simp add: sin_zero_iff) |
4064 |
apply safe |
|
4065 |
apply (metis even_int_iff of_int_of_nat_eq) |
|
4066 |
apply (rule_tac x="- (int n)" in exI) |
|
4067 |
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
|
4068 |
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
|
4069 |
next |
63558 | 4070 |
fix n :: int |
59669
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
4071 |
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
|
4072 |
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
|
4073 |
apply (simp add: sin_zero_iff) |
63558 | 4074 |
apply (cases n rule: int_cases2) |
4075 |
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
|
4076 |
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
|
4077 |
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
|
4078 |
|
63558 | 4079 |
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
|
4080 |
apply (simp only: sin_zero_iff_int) |
de7792ea4090
renaming HOL/Fact.thy -> Binomial.thy
paulson <lp15@cam.ac.uk>
parents:
59658
diff
changeset
|
4081 |
apply (safe elim!: evenE) |
63558 | 4082 |
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
|
4083 |
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
|
4084 |
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
|
4085 |
|
65036
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4086 |
lemma sin_npi_int [simp]: "sin (pi * of_int n) = 0" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4087 |
by (simp add: sin_zero_iff_int2) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4088 |
|
53079 | 4089 |
lemma cos_monotone_0_pi: |
4090 |
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
|
4091 |
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
|
4092 |
proof - |
33549 | 4093 |
have "- (x - y) < 0" using assms by auto |
60758 | 4094 |
from MVT2[OF \<open>y < x\<close> DERIV_cos[THEN impI, THEN allI]] |
53079 | 4095 |
obtain z where "y < z" and "z < x" and cos_diff: "cos x - cos y = (x - y) * - sin z" |
4096 |
by auto |
|
63558 | 4097 |
then have "0 < z" and "z < pi" |
4098 |
using assms by auto |
|
4099 |
then have "0 < sin z" |
|
4100 |
using sin_gt_zero by auto |
|
4101 |
then have "cos x - cos y < 0" |
|
53079 | 4102 |
unfolding cos_diff minus_mult_commute[symmetric] |
60758 | 4103 |
using \<open>- (x - y) < 0\<close> by (rule mult_pos_neg2) |
63558 | 4104 |
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
|
4105 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4106 |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4107 |
lemma cos_monotone_0_pi_le: |
53079 | 4108 |
assumes "0 \<le> y" and "y \<le> x" and "x \<le> pi" |
4109 |
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
|
4110 |
proof (cases "y < x") |
53079 | 4111 |
case True |
4112 |
show ?thesis |
|
60758 | 4113 |
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
|
4114 |
next |
53079 | 4115 |
case False |
63558 | 4116 |
then have "y = x" using \<open>y \<le> x\<close> by auto |
4117 |
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
|
4118 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4119 |
|
53079 | 4120 |
lemma cos_monotone_minus_pi_0: |
63558 | 4121 |
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
|
4122 |
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
|
4123 |
proof - |
63558 | 4124 |
have "0 \<le> - x" and "- x < - y" and "- y \<le> pi" |
53079 | 4125 |
using assms by auto |
4126 |
from cos_monotone_0_pi[OF this] show ?thesis |
|
4127 |
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
|
4128 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4129 |
|
53079 | 4130 |
lemma cos_monotone_minus_pi_0': |
63558 | 4131 |
assumes "- pi \<le> y" and "y \<le> x" and "x \<le> 0" |
53079 | 4132 |
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
|
4133 |
proof (cases "y < x") |
53079 | 4134 |
case True |
60758 | 4135 |
show ?thesis using cos_monotone_minus_pi_0[OF \<open>-pi \<le> y\<close> True \<open>x \<le> 0\<close>] |
53079 | 4136 |
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
|
4137 |
next |
53079 | 4138 |
case False |
63558 | 4139 |
then have "y = x" using \<open>y \<le> x\<close> by auto |
4140 |
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
|
4141 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4142 |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4143 |
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
|
4144 |
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
|
4145 |
shows "sin y < sin x" |
63558 | 4146 |
apply (simp add: sin_cos_eq) |
4147 |
apply (rule cos_monotone_0_pi) |
|
4148 |
using assms |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4149 |
apply auto |
63558 | 4150 |
done |
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4151 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4152 |
lemma sin_monotone_2pi_le: |
53079 | 4153 |
assumes "- (pi / 2) \<le> y" and "y \<le> x" and "x \<le> pi / 2" |
4154 |
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
|
4155 |
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
|
4156 |
|
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
|
4157 |
lemma sin_x_le_x: |
63558 | 4158 |
fixes x :: real |
4159 |
assumes x: "x \<ge> 0" |
|
4160 |
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
|
4161 |
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
|
4162 |
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
|
4163 |
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
|
4164 |
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
|
4165 |
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
|
4166 |
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
|
4167 |
done |
63558 | 4168 |
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
|
4169 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4170 |
|
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
|
4171 |
lemma sin_x_ge_neg_x: |
63558 | 4172 |
fixes x :: real |
4173 |
assumes x: "x \<ge> 0" |
|
4174 |
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
|
4175 |
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
|
4176 |
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
|
4177 |
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
|
4178 |
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
|
4179 |
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
|
4180 |
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
|
4181 |
done |
63558 | 4182 |
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
|
4183 |
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
|
4184 |
|
63558 | 4185 |
lemma abs_sin_x_le_abs_x: "\<bar>sin x\<bar> \<le> \<bar>x\<bar>" |
4186 |
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
|
4187 |
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
|
4188 |
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
|
4189 |
|
53079 | 4190 |
|
60758 | 4191 |
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
|
4192 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4193 |
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
|
4194 |
proof - |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4195 |
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
|
4196 |
by (auto simp: algebra_simps sin_add) |
63558 | 4197 |
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
|
4198 |
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
|
4199 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4200 |
|
63558 | 4201 |
lemma cos_2npi [simp]: "cos (2 * real n * pi) = 1" |
4202 |
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
|
4203 |
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
|
4204 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4205 |
lemma cos_3over2_pi [simp]: "cos (3/2*pi) = 0" |
63558 | 4206 |
apply (subgoal_tac "cos (pi + pi/2) = 0") |
4207 |
apply simp |
|
4208 |
apply (subst cos_add) |
|
4209 |
apply simp |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4210 |
done |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4211 |
|
63558 | 4212 |
lemma sin_2npi [simp]: "sin (2 * real n * pi) = 0" |
4213 |
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
|
4214 |
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
|
4215 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4216 |
lemma sin_3over2_pi [simp]: "sin (3/2*pi) = - 1" |
63558 | 4217 |
apply (subgoal_tac "sin (pi + pi/2) = - 1") |
4218 |
apply simp |
|
4219 |
apply (subst sin_add) |
|
4220 |
apply simp |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4221 |
done |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4222 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4223 |
lemma cos_pi_eq_zero [simp]: "cos (pi * real (Suc (2 * m)) / 2) = 0" |
63558 | 4224 |
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
|
4225 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4226 |
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
|
4227 |
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
|
4228 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4229 |
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
|
4230 |
fixes x :: "'a::{real_normed_field,banach}" |
63558 | 4231 |
assumes "sin x = 0" |
4232 |
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
|
4233 |
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
|
4234 |
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
|
4235 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4236 |
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
|
4237 |
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
|
4238 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4239 |
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
|
4240 |
fixes x :: "'a::{real_normed_field,banach}" |
63558 | 4241 |
assumes "cos x = 1" |
4242 |
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
|
4243 |
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
|
4244 |
by simp |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4245 |
|
63558 | 4246 |
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
|
4247 |
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
|
4248 |
|
63558 | 4249 |
lemma cos_one_2pi: "cos x = 1 \<longleftrightarrow> (\<exists>n::nat. x = n * 2 * pi) | (\<exists>n::nat. x = - (n * 2 * pi))" |
4250 |
(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
|
4251 |
proof |
63558 | 4252 |
assume ?lhs |
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4253 |
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
|
4254 |
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
|
4255 |
then show ?rhs |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4256 |
proof (simp only: sin_zero_iff, elim exE disjE conjE) |
63558 | 4257 |
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
|
4258 |
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
|
4259 |
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
|
4260 |
using dvdE by blast |
60758 | 4261 |
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
|
4262 |
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
|
4263 |
show ?rhs |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4264 |
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
|
4265 |
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
|
4266 |
next |
63558 | 4267 |
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
|
4268 |
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
|
4269 |
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
|
4270 |
using dvdE by blast |
60758 | 4271 |
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
|
4272 |
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
|
4273 |
show ?rhs |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4274 |
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
|
4275 |
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
|
4276 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4277 |
next |
63558 | 4278 |
assume ?rhs |
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4279 |
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
|
4280 |
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
|
4281 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4282 |
|
65036
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4283 |
lemma cos_one_2pi_int: "cos x = 1 \<longleftrightarrow> (\<exists>n::int. x = n * 2 * pi)" (is "?lhs = ?rhs") |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4284 |
proof |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4285 |
assume "cos x = 1" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4286 |
then show ?rhs |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4287 |
apply (auto simp: cos_one_2pi) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4288 |
apply (metis of_int_of_nat_eq) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4289 |
apply (metis mult_minus_right of_int_minus of_int_of_nat_eq) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4290 |
done |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4291 |
next |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4292 |
assume ?rhs |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4293 |
then show "cos x = 1" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4294 |
by (clarsimp simp add: cos_one_2pi) (metis mult_minus_right of_int_of_nat) |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4295 |
qed |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4296 |
|
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4297 |
lemma cos_npi_int [simp]: |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4298 |
fixes n::int shows "cos (pi * of_int n) = (if even n then 1 else -1)" |
ab7e11730ad8
Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents:
64758
diff
changeset
|
4299 |
by (auto simp: algebra_simps cos_one_2pi_int elim!: oddE evenE) |
63558 | 4300 |
|
4301 |
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
|
4302 |
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
|
4303 |
|
63558 | 4304 |
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
|
4305 |
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
|
4306 |
|
63558 | 4307 |
lemma cos_treble_cos: "cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x" |
4308 |
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
|
4309 |
proof - |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4310 |
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
|
4311 |
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
|
4312 |
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
|
4313 |
by simp |
63558 | 4314 |
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
|
4315 |
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
|
4316 |
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
|
4317 |
done |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4318 |
finally show ?thesis . |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4319 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4320 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4321 |
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
|
4322 |
proof - |
63558 | 4323 |
let ?c = "cos (pi / 4)" |
4324 |
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
|
4325 |
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
|
4326 |
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
|
4327 |
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
|
4328 |
by simp |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4329 |
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
|
4330 |
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
|
4331 |
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
|
4332 |
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
|
4333 |
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
|
4334 |
by (simp add: power_divide) |
63558 | 4335 |
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
|
4336 |
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
|
4337 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4338 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4339 |
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
|
4340 |
proof - |
63558 | 4341 |
let ?c = "cos (pi / 6)" |
4342 |
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
|
4343 |
have pos_c: "0 < ?c" |
63558 | 4344 |
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
|
4345 |
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
|
4346 |
by simp |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4347 |
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
|
4348 |
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
|
4349 |
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
|
4350 |
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
|
4351 |
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
|
4352 |
using pos_c by (simp add: sin_squared_eq power_divide) |
63558 | 4353 |
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
|
4354 |
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
|
4355 |
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
|
4356 |
qed |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4357 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4358 |
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
|
4359 |
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
|
4360 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4361 |
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
|
4362 |
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
|
4363 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4364 |
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
|
4365 |
apply (rule power2_eq_imp_eq) |
63558 | 4366 |
apply (simp add: cos_squared_eq sin_60 power_divide) |
4367 |
apply (rule cos_ge_zero) |
|
4368 |
apply (rule order_trans [where y=0]) |
|
4369 |
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
|
4370 |
done |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4371 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4372 |
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
|
4373 |
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
|
4374 |
|
63558 | 4375 |
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
|
4376 |
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
|
4377 |
|
63558 | 4378 |
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
|
4379 |
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
|
4380 |
|
63558 | 4381 |
lemma cos_int_2npi [simp]: "cos (2 * of_int n * pi) = 1" |
4382 |
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
|
4383 |
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
|
4384 |
|
63558 | 4385 |
lemma sin_int_2npi [simp]: "sin (2 * of_int n * pi) = 0" |
4386 |
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
|
4387 |
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
|
4388 |
|
63558 | 4389 |
lemma sincos_principal_value: "\<exists>y. (- pi < y \<and> y \<le> pi) \<and> (sin y = sin x \<and> cos y = cos x)" |
4390 |
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
|
4391 |
apply (auto simp: field_simps frac_lt_1) |
63558 | 4392 |
apply (simp_all add: frac_def divide_simps) |
4393 |
apply (simp_all add: add_divide_distrib diff_divide_distrib) |
|
4394 |
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
|
4395 |
done |
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4396 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4397 |
|
60758 | 4398 |
subsection \<open>Tangent\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4399 |
|
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
|
4400 |
definition tan :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
53079 | 4401 |
where "tan = (\<lambda>x. sin x / cos x)" |
23043 | 4402 |
|
63558 | 4403 |
lemma tan_of_real: "of_real (tan x) = (tan (of_real x) :: 'a::{real_normed_field,banach})" |
59862 | 4404 |
by (simp add: tan_def sin_of_real cos_of_real) |
4405 |
||
63558 | 4406 |
lemma tan_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> tan z \<in> \<real>" |
4407 |
for z :: "'a::{real_normed_field,banach}" |
|
59862 | 4408 |
by (simp add: tan_def) |
4409 |
||
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4410 |
lemma tan_zero [simp]: "tan 0 = 0" |
44311 | 4411 |
by (simp add: tan_def) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4412 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4413 |
lemma tan_pi [simp]: "tan pi = 0" |
44311 | 4414 |
by (simp add: tan_def) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4415 |
|
63558 | 4416 |
lemma tan_npi [simp]: "tan (real n * pi) = 0" |
4417 |
for n :: nat |
|
44311 | 4418 |
by (simp add: tan_def) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4419 |
|
63558 | 4420 |
lemma tan_minus [simp]: "tan (- x) = - tan x" |
44311 | 4421 |
by (simp add: tan_def) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4422 |
|
63558 | 4423 |
lemma tan_periodic [simp]: "tan (x + 2 * pi) = tan x" |
4424 |
by (simp add: tan_def) |
|
4425 |
||
4426 |
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 | 4427 |
by (simp add: tan_def cos_add field_simps) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4428 |
|
63558 | 4429 |
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)" |
4430 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 4431 |
by (simp add: tan_def sin_add field_simps) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4432 |
|
15229 | 4433 |
lemma tan_add: |
63558 | 4434 |
"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)" |
4435 |
for x :: "'a::{real_normed_field,banach}" |
|
4436 |
by (simp add: add_tan_eq lemma_tan_add1 field_simps) (simp add: tan_def) |
|
4437 |
||
4438 |
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)" |
|
4439 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 4440 |
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
|
4441 |
|
63558 | 4442 |
lemma tan_gt_zero: "0 < x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 < tan x" |
53079 | 4443 |
by (simp add: tan_def zero_less_divide_iff sin_gt_zero2 cos_gt_zero_pi) |
41970 | 4444 |
|
4445 |
lemma tan_less_zero: |
|
63558 | 4446 |
assumes "- pi/2 < x" and "x < 0" |
53079 | 4447 |
shows "tan x < 0" |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4448 |
proof - |
63558 | 4449 |
have "0 < tan (- x)" |
4450 |
using assms by (simp only: tan_gt_zero) |
|
4451 |
then show ?thesis by simp |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4452 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4453 |
|
63558 | 4454 |
lemma tan_half: "tan x = sin (2 * x) / (cos (2 * x) + 1)" |
4455 |
for x :: "'a::{real_normed_field,banach,field}" |
|
44756
efcd71fbaeec
simplify proof of tan_half, removing unused assumptions
huffman
parents:
44755
diff
changeset
|
4456 |
unfolding tan_def sin_double cos_double sin_squared_eq |
efcd71fbaeec
simplify proof of tan_half, removing unused assumptions
huffman
parents:
44755
diff
changeset
|
4457 |
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
|
4458 |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4459 |
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
|
4460 |
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
|
4461 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4462 |
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
|
4463 |
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
|
4464 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4465 |
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
|
4466 |
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
|
4467 |
|
63558 | 4468 |
lemma DERIV_tan [simp]: "cos x \<noteq> 0 \<Longrightarrow> DERIV tan x :> inverse ((cos x)\<^sup>2)" |
4469 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 4470 |
unfolding tan_def |
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
4471 |
by (auto intro!: derivative_eq_intros, simp add: divide_inverse power2_eq_square) |
44311 | 4472 |
|
63558 | 4473 |
lemma isCont_tan: "cos x \<noteq> 0 \<Longrightarrow> isCont tan x" |
4474 |
for x :: "'a::{real_normed_field,banach}" |
|
44311 | 4475 |
by (rule DERIV_tan [THEN DERIV_isCont]) |
4476 |
||
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
|
4477 |
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
|
4478 |
fixes a :: "'a::{real_normed_field,banach}" and f :: "'a \<Rightarrow> 'a" |
63558 | 4479 |
shows "isCont f a \<Longrightarrow> cos (f a) \<noteq> 0 \<Longrightarrow> isCont (\<lambda>x. tan (f x)) a" |
44311 | 4480 |
by (rule isCont_o2 [OF _ isCont_tan]) |
4481 |
||
4482 |
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
|
4483 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
63558 | 4484 |
shows "(f \<longlongrightarrow> a) F \<Longrightarrow> cos a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. tan (f x)) \<longlongrightarrow> tan a) F" |
44311 | 4485 |
by (rule isCont_tendsto_compose [OF isCont_tan]) |
4486 |
||
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
|
4487 |
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
|
4488 |
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
|
4489 |
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
|
4490 |
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
|
4491 |
|
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
|
4492 |
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
|
4493 |
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
|
4494 |
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
|
4495 |
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
|
4496 |
|
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
|
4497 |
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
|
4498 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
63558 | 4499 |
shows "continuous (at x within s) f \<Longrightarrow> |
4500 |
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
|
4501 |
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
|
4502 |
|
61976 | 4503 |
lemma LIM_cos_div_sin: "(\<lambda>x. cos(x)/sin(x)) \<midarrow>pi/2\<rightarrow> 0" |
44311 | 4504 |
by (rule LIM_cong_limit, (rule tendsto_intros)+, simp_all) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4505 |
|
63558 | 4506 |
lemma lemma_tan_total: "0 < y \<Longrightarrow> \<exists>x. 0 < x \<and> x < pi/2 \<and> y < tan x" |
4507 |
apply (insert LIM_cos_div_sin) |
|
53079 | 4508 |
apply (simp only: LIM_eq) |
63558 | 4509 |
apply (drule_tac x = "inverse y" in spec) |
4510 |
apply safe |
|
4511 |
apply force |
|
4512 |
apply (drule_tac ?d1.0 = s in pi_half_gt_zero [THEN [2] real_lbound_gt_zero]) |
|
4513 |
apply safe |
|
53079 | 4514 |
apply (rule_tac x = "(pi/2) - e" in exI) |
4515 |
apply (simp (no_asm_simp)) |
|
4516 |
apply (drule_tac x = "(pi/2) - e" in spec) |
|
4517 |
apply (auto simp add: tan_def sin_diff cos_diff) |
|
4518 |
apply (rule inverse_less_iff_less [THEN iffD1]) |
|
63558 | 4519 |
apply (auto simp add: divide_inverse) |
4520 |
apply (rule mult_pos_pos) |
|
4521 |
apply (subgoal_tac [3] "0 < sin e \<and> 0 < cos e") |
|
4522 |
apply (auto intro: cos_gt_zero sin_gt_zero2 simp: mult.commute) |
|
53079 | 4523 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4524 |
|
63558 | 4525 |
lemma tan_total_pos: "0 \<le> y \<Longrightarrow> \<exists>x. 0 \<le> x \<and> x < pi/2 \<and> tan x = y" |
4526 |
apply (frule order_le_imp_less_or_eq) |
|
4527 |
apply safe |
|
53079 | 4528 |
prefer 2 apply force |
63558 | 4529 |
apply (drule lemma_tan_total) |
4530 |
apply safe |
|
53079 | 4531 |
apply (cut_tac f = tan and a = 0 and b = x and y = y in IVT_objl) |
4532 |
apply (auto intro!: DERIV_tan [THEN DERIV_isCont]) |
|
4533 |
apply (drule_tac y = xa in order_le_imp_less_or_eq) |
|
4534 |
apply (auto dest: cos_gt_zero) |
|
4535 |
done |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4536 |
|
63558 | 4537 |
lemma lemma_tan_total1: "\<exists>x. -(pi/2) < x \<and> x < (pi/2) \<and> tan x = y" |
4538 |
apply (insert linorder_linear [of 0 y]) |
|
4539 |
apply safe |
|
4540 |
apply (drule tan_total_pos) |
|
4541 |
apply (cut_tac [2] y="-y" in tan_total_pos) |
|
4542 |
apply safe |
|
4543 |
apply (rule_tac [3] x = "-x" in exI) |
|
4544 |
apply (auto del: exI intro!: exI) |
|
53079 | 4545 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4546 |
|
63558 | 4547 |
lemma tan_total: "\<exists>! x. -(pi/2) < x \<and> x < (pi/2) \<and> tan x = y" |
4548 |
apply (insert lemma_tan_total1 [where y = y]) |
|
4549 |
apply auto |
|
57492
74bf65a1910a
Hypsubst preserves equality hypotheses
Thomas Sewell <thomas.sewell@nicta.com.au>
parents:
57418
diff
changeset
|
4550 |
apply hypsubst_thin |
63558 | 4551 |
apply (cut_tac x = xa and y = y in linorder_less_linear) |
4552 |
apply auto |
|
4553 |
apply (subgoal_tac [2] "\<exists>z. y < z \<and> z < xa \<and> DERIV tan z :> 0") |
|
4554 |
apply (subgoal_tac "\<exists>z. xa < z \<and> z < y \<and> DERIV tan z :> 0") |
|
4555 |
apply (rule_tac [4] Rolle) |
|
4556 |
apply (rule_tac [2] Rolle) |
|
4557 |
apply (auto del: exI intro!: DERIV_tan DERIV_isCont exI |
|
4558 |
simp add: real_differentiable_def) |
|
4559 |
apply (rule_tac [!] DERIV_tan asm_rl) |
|
4560 |
apply (auto dest!: DERIV_unique [OF _ DERIV_tan] |
|
4561 |
simp add: cos_gt_zero_pi [THEN less_imp_neq, THEN not_sym]) |
|
53079 | 4562 |
done |
4563 |
||
4564 |
lemma tan_monotone: |
|
4565 |
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
|
4566 |
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
|
4567 |
proof - |
53079 | 4568 |
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
|
4569 |
proof (rule allI, rule impI) |
53079 | 4570 |
fix x' :: real |
4571 |
assume "y \<le> x' \<and> x' \<le> x" |
|
63558 | 4572 |
then have "-(pi/2) < x'" and "x' < pi/2" |
4573 |
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
|
4574 |
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
|
4575 |
have "cos x' \<noteq> 0" by auto |
63558 | 4576 |
then show "DERIV tan x' :> inverse ((cos x')\<^sup>2)" |
4577 |
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
|
4578 |
qed |
60758 | 4579 |
from MVT2[OF \<open>y < x\<close> this] |
53079 | 4580 |
obtain z where "y < z" and "z < x" |
4581 |
and tan_diff: "tan x - tan y = (x - y) * inverse ((cos z)\<^sup>2)" by auto |
|
63558 | 4582 |
then have "- (pi / 2) < z" and "z < pi / 2" |
4583 |
using assms by auto |
|
4584 |
then have "0 < cos z" |
|
4585 |
using cos_gt_zero_pi by auto |
|
4586 |
then have inv_pos: "0 < inverse ((cos z)\<^sup>2)" |
|
4587 |
by auto |
|
60758 | 4588 |
have "0 < x - y" using \<open>y < x\<close> by auto |
63558 | 4589 |
with inv_pos have "0 < tan x - tan y" |
4590 |
unfolding tan_diff by auto |
|
4591 |
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
|
4592 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4593 |
|
53079 | 4594 |
lemma tan_monotone': |
4595 |
assumes "- (pi / 2) < y" |
|
4596 |
and "y < pi / 2" |
|
4597 |
and "- (pi / 2) < x" |
|
4598 |
and "x < pi / 2" |
|
63558 | 4599 |
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
|
4600 |
proof |
53079 | 4601 |
assume "y < x" |
63558 | 4602 |
then show "tan y < tan x" |
60758 | 4603 |
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
|
4604 |
next |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4605 |
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
|
4606 |
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
|
4607 |
proof (rule ccontr) |
63558 | 4608 |
assume "\<not> ?thesis" |
4609 |
then have "x \<le> y" by auto |
|
4610 |
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
|
4611 |
proof (cases "x = y") |
63558 | 4612 |
case True |
4613 |
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
|
4614 |
next |
63558 | 4615 |
case False |
4616 |
then have "x < y" using \<open>x \<le> y\<close> by auto |
|
4617 |
from tan_monotone[OF \<open>- (pi/2) < x\<close> this \<open>y < pi / 2\<close>] show ?thesis |
|
4618 |
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
|
4619 |
qed |
63558 | 4620 |
then show False |
4621 |
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
|
4622 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4623 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4624 |
|
53079 | 4625 |
lemma tan_inverse: "1 / (tan y) = tan (pi / 2 - y)" |
4626 |
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
|
4627 |
|
41970 | 4628 |
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
|
4629 |
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
|
4630 |
|
63558 | 4631 |
lemma tan_periodic_nat[simp]: "tan (x + real n * pi) = tan x" |
4632 |
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
|
4633 |
proof (induct n arbitrary: x) |
53079 | 4634 |
case 0 |
4635 |
then show ?case by simp |
|
4636 |
next |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4637 |
case (Suc n) |
53079 | 4638 |
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
|
4639 |
unfolding Suc_eq_plus1 of_nat_add distrib_right by auto |
63558 | 4640 |
show ?case |
4641 |
unfolding split_pi_off using Suc by auto |
|
53079 | 4642 |
qed |
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4643 |
|
63558 | 4644 |
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
|
4645 |
proof (cases "0 \<le> i") |
53079 | 4646 |
case True |
63558 | 4647 |
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
|
4648 |
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
|
4649 |
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
|
4650 |
next |
53079 | 4651 |
case False |
63558 | 4652 |
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
|
4653 |
have "tan x = tan (x + of_int i * pi - of_int i * pi)" |
53079 | 4654 |
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
|
4655 |
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
|
4656 |
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
|
4657 |
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
|
4658 |
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
|
4659 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
4660 |
|
47108
2a1953f0d20d
merged fork with new numeral representation (see NEWS)
huffman
parents:
46240
diff
changeset
|
4661 |
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
|
4662 |
using tan_periodic_int[of _ "numeral n" ] by simp |
23043 | 4663 |
|
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4664 |
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
|
4665 |
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
|
4666 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4667 |
lemma tan_diff: |
63558 | 4668 |
"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)" |
4669 |
for x :: "'a::{real_normed_field,banach}" |
|
4670 |
using tan_add [of x "-y"] by simp |
|
4671 |
||
4672 |
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
|
4673 |
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
|
4674 |
|
63558 | 4675 |
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
|
4676 |
using cos_gt_zero_pi [of x] |
62390 | 4677 |
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
|
4678 |
|
63558 | 4679 |
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
|
4680 |
using cos_gt_zero [of "x"] cos_gt_zero [of "-x"] |
62390 | 4681 |
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
|
4682 |
|
63558 | 4683 |
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
|
4684 |
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
|
4685 |
|
63558 | 4686 |
lemma tan_mono_lt_eq: |
4687 |
"-(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
|
4688 |
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
|
4689 |
|
63558 | 4690 |
lemma tan_mono_le_eq: |
4691 |
"-(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
|
4692 |
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
|
4693 |
|
61944 | 4694 |
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
|
4695 |
using tan_45 tan_monotone [of x "pi/4"] tan_monotone [of "-x" "pi/4"] |
62390 | 4696 |
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
|
4697 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4698 |
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
|
4699 |
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
|
4700 |
|
63558 | 4701 |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4702 |
subsection \<open>Cotangent\<close> |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4703 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4704 |
definition cot :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4705 |
where "cot = (\<lambda>x. cos x / sin x)" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4706 |
|
63558 | 4707 |
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
|
4708 |
by (simp add: cot_def sin_of_real cos_of_real) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4709 |
|
63558 | 4710 |
lemma cot_in_Reals [simp]: "z \<in> \<real> \<Longrightarrow> cot z \<in> \<real>" |
4711 |
for z :: "'a::{real_normed_field,banach}" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4712 |
by (simp add: cot_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4713 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4714 |
lemma cot_zero [simp]: "cot 0 = 0" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4715 |
by (simp add: cot_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4716 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4717 |
lemma cot_pi [simp]: "cot pi = 0" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4718 |
by (simp add: cot_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4719 |
|
63558 | 4720 |
lemma cot_npi [simp]: "cot (real n * pi) = 0" |
4721 |
for n :: nat |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4722 |
by (simp add: cot_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4723 |
|
63558 | 4724 |
lemma cot_minus [simp]: "cot (- x) = - cot x" |
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4725 |
by (simp add: cot_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4726 |
|
63558 | 4727 |
lemma cot_periodic [simp]: "cot (x + 2 * pi) = cot x" |
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4728 |
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
|
4729 |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4730 |
lemma cot_altdef: "cot x = inverse (tan x)" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4731 |
by (simp add: cot_def tan_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4732 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4733 |
lemma tan_altdef: "tan x = inverse (cot x)" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4734 |
by (simp add: cot_def tan_def) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4735 |
|
63558 | 4736 |
lemma tan_cot': "tan (pi/2 - x) = cot x" |
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4737 |
by (simp add: tan_cot cot_altdef) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4738 |
|
63558 | 4739 |
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
|
4740 |
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
|
4741 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4742 |
lemma cot_less_zero: |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4743 |
assumes lb: "- pi/2 < x" and "x < 0" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4744 |
shows "cot x < 0" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4745 |
proof - |
63558 | 4746 |
have "0 < cot (- x)" |
4747 |
using assms by (simp only: cot_gt_zero) |
|
4748 |
then show ?thesis by simp |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4749 |
qed |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4750 |
|
63558 | 4751 |
lemma DERIV_cot [simp]: "sin x \<noteq> 0 \<Longrightarrow> DERIV cot x :> -inverse ((sin x)\<^sup>2)" |
4752 |
for x :: "'a::{real_normed_field,banach}" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4753 |
unfolding cot_def using cos_squared_eq[of x] |
63558 | 4754 |
by (auto intro!: derivative_eq_intros) (simp add: divide_inverse power2_eq_square) |
4755 |
||
4756 |
lemma isCont_cot: "sin x \<noteq> 0 \<Longrightarrow> isCont cot x" |
|
4757 |
for x :: "'a::{real_normed_field,banach}" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4758 |
by (rule DERIV_cot [THEN DERIV_isCont]) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4759 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4760 |
lemma isCont_cot' [simp,continuous_intros]: |
63558 | 4761 |
"isCont f a \<Longrightarrow> sin (f a) \<noteq> 0 \<Longrightarrow> isCont (\<lambda>x. cot (f x)) a" |
4762 |
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
|
4763 |
by (rule isCont_o2 [OF _ isCont_cot]) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4764 |
|
63558 | 4765 |
lemma tendsto_cot [tendsto_intros]: "(f \<longlongrightarrow> a) F \<Longrightarrow> sin a \<noteq> 0 \<Longrightarrow> ((\<lambda>x. cot (f x)) \<longlongrightarrow> cot a) F" |
4766 |
for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4767 |
by (rule isCont_tendsto_compose [OF isCont_cot]) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4768 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4769 |
lemma continuous_cot: |
63558 | 4770 |
"continuous F f \<Longrightarrow> sin (f (Lim F (\<lambda>x. x))) \<noteq> 0 \<Longrightarrow> continuous F (\<lambda>x. cot (f x))" |
4771 |
for f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
|
61531
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4772 |
unfolding continuous_def by (rule tendsto_cot) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4773 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4774 |
lemma continuous_on_cot [continuous_intros]: |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4775 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4776 |
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
|
4777 |
unfolding continuous_on_def by (auto intro: tendsto_cot) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4778 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4779 |
lemma continuous_within_cot [continuous_intros]: |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4780 |
fixes f :: "'a \<Rightarrow> 'a::{real_normed_field,banach}" |
63558 | 4781 |
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
|
4782 |
unfolding continuous_within by (rule tendsto_cot) |
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4783 |
|
ab2e862263e7
Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents:
61524
diff
changeset
|
4784 |
|
60758 | 4785 |
subsection \<open>Inverse Trigonometric Functions\<close> |
23043 | 4786 |
|
63558 | 4787 |
definition arcsin :: "real \<Rightarrow> real" |
4788 |
where "arcsin y = (THE x. -(pi/2) \<le> x \<and> x \<le> pi/2 \<and> sin x = y)" |
|
4789 |
||
4790 |
definition arccos :: "real \<Rightarrow> real" |
|
4791 |
where "arccos y = (THE x. 0 \<le> x \<and> x \<le> pi \<and> cos x = y)" |
|
4792 |
||
4793 |
definition arctan :: "real \<Rightarrow> real" |
|
4794 |
where "arctan y = (THE x. -(pi/2) < x \<and> x < pi/2 \<and> tan x = y)" |
|
4795 |
||
4796 |
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 | 4797 |
unfolding arcsin_def by (rule theI' [OF sin_total]) |
23011 | 4798 |
|
63558 | 4799 |
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" |
4800 |
by (drule (1) arcsin) (force intro: order_trans) |
|
4801 |
||
4802 |
lemma sin_arcsin [simp]: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> sin (arcsin y) = y" |
|
4803 |
by (blast dest: arcsin) |
|
4804 |
||
4805 |
lemma arcsin_bounded: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y \<and> arcsin y \<le> pi/2" |
|
53079 | 4806 |
by (blast dest: arcsin) |
4807 |
||
63558 | 4808 |
lemma arcsin_lbound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> - (pi/2) \<le> arcsin y" |
53079 | 4809 |
by (blast dest: arcsin) |
4810 |
||
63558 | 4811 |
lemma arcsin_ubound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin y \<le> pi/2" |
53079 | 4812 |
by (blast dest: arcsin) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4813 |
|
63558 | 4814 |
lemma arcsin_lt_bounded: "- 1 < y \<Longrightarrow> y < 1 \<Longrightarrow> - (pi/2) < arcsin y \<and> arcsin y < pi/2" |
53079 | 4815 |
apply (frule order_less_imp_le) |
4816 |
apply (frule_tac y = y in order_less_imp_le) |
|
4817 |
apply (frule arcsin_bounded) |
|
63558 | 4818 |
apply safe |
4819 |
apply simp |
|
4820 |
apply (drule_tac y = "arcsin y" in order_le_imp_less_or_eq) |
|
4821 |
apply (drule_tac [2] y = "pi/2" in order_le_imp_less_or_eq) |
|
4822 |
apply safe |
|
4823 |
apply (drule_tac [!] f = sin in arg_cong) |
|
4824 |
apply auto |
|
53079 | 4825 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4826 |
|
63558 | 4827 |
lemma arcsin_sin: "- (pi/2) \<le> x \<Longrightarrow> x \<le> pi/2 \<Longrightarrow> arcsin (sin x) = x" |
53079 | 4828 |
apply (unfold arcsin_def) |
4829 |
apply (rule the1_equality) |
|
63558 | 4830 |
apply (rule sin_total) |
4831 |
apply auto |
|
53079 | 4832 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4833 |
|
59869 | 4834 |
lemma arcsin_0 [simp]: "arcsin 0 = 0" |
63558 | 4835 |
using arcsin_sin [of 0] by simp |
59869 | 4836 |
|
4837 |
lemma arcsin_1 [simp]: "arcsin 1 = pi/2" |
|
63558 | 4838 |
using arcsin_sin [of "pi/2"] by simp |
4839 |
||
4840 |
lemma arcsin_minus_1 [simp]: "arcsin (- 1) = - (pi/2)" |
|
4841 |
using arcsin_sin [of "- pi/2"] by simp |
|
4842 |
||
4843 |
lemma arcsin_minus: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> arcsin (- x) = - arcsin x" |
|
59869 | 4844 |
by (metis (no_types, hide_lams) arcsin arcsin_sin minus_minus neg_le_iff_le sin_minus) |
4845 |
||
63558 | 4846 |
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
|
4847 |
by (metis abs_le_iff arcsin minus_le_iff) |
59869 | 4848 |
|
63558 | 4849 |
lemma cos_arcsin_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> cos (arcsin x) \<noteq> 0" |
59869 | 4850 |
using arcsin_lt_bounded cos_gt_zero_pi by force |
4851 |
||
63558 | 4852 |
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 | 4853 |
unfolding arccos_def by (rule theI' [OF cos_total]) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4854 |
|
63558 | 4855 |
lemma cos_arccos [simp]: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> cos (arccos y) = y" |
53079 | 4856 |
by (blast dest: arccos) |
41970 | 4857 |
|
63558 | 4858 |
lemma arccos_bounded: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y \<and> arccos y \<le> pi" |
53079 | 4859 |
by (blast dest: arccos) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4860 |
|
63558 | 4861 |
lemma arccos_lbound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> 0 \<le> arccos y" |
53079 | 4862 |
by (blast dest: arccos) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4863 |
|
63558 | 4864 |
lemma arccos_ubound: "- 1 \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y \<le> pi" |
53079 | 4865 |
by (blast dest: arccos) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4866 |
|
63558 | 4867 |
lemma arccos_lt_bounded: "- 1 < y \<Longrightarrow> y < 1 \<Longrightarrow> 0 < arccos y \<and> arccos y < pi" |
53079 | 4868 |
apply (frule order_less_imp_le) |
4869 |
apply (frule_tac y = y in order_less_imp_le) |
|
63558 | 4870 |
apply (frule arccos_bounded) |
4871 |
apply auto |
|
4872 |
apply (drule_tac y = "arccos y" in order_le_imp_less_or_eq) |
|
4873 |
apply (drule_tac [2] y = pi in order_le_imp_less_or_eq) |
|
4874 |
apply auto |
|
4875 |
apply (drule_tac [!] f = cos in arg_cong) |
|
4876 |
apply auto |
|
53079 | 4877 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4878 |
|
63558 | 4879 |
lemma arccos_cos: "0 \<le> x \<Longrightarrow> x \<le> pi \<Longrightarrow> arccos (cos x) = x" |
4880 |
by (auto simp: arccos_def intro!: the1_equality cos_total) |
|
4881 |
||
4882 |
lemma arccos_cos2: "x \<le> 0 \<Longrightarrow> - pi \<le> x \<Longrightarrow> arccos (cos x) = -x" |
|
4883 |
by (auto simp: arccos_def intro!: the1_equality cos_total) |
|
4884 |
||
4885 |
lemma cos_arcsin: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> cos (arcsin x) = sqrt (1 - x\<^sup>2)" |
|
53079 | 4886 |
apply (subgoal_tac "x\<^sup>2 \<le> 1") |
63558 | 4887 |
apply (rule power2_eq_imp_eq) |
4888 |
apply (simp add: cos_squared_eq) |
|
4889 |
apply (rule cos_ge_zero) |
|
4890 |
apply (erule (1) arcsin_lbound) |
|
4891 |
apply (erule (1) arcsin_ubound) |
|
4892 |
apply simp |
|
4893 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 \<le> 1\<^sup>2") |
|
4894 |
apply simp |
|
4895 |
apply (rule power_mono) |
|
4896 |
apply simp |
|
53079 | 4897 |
apply simp |
4898 |
done |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
4899 |
|
63558 | 4900 |
lemma sin_arccos: "- 1 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> sin (arccos x) = sqrt (1 - x\<^sup>2)" |
53079 | 4901 |
apply (subgoal_tac "x\<^sup>2 \<le> 1") |
63558 | 4902 |
apply (rule power2_eq_imp_eq) |
4903 |
apply (simp add: sin_squared_eq) |
|
4904 |
apply (rule sin_ge_zero) |
|
4905 |
apply (erule (1) arccos_lbound) |
|
4906 |
apply (erule (1) arccos_ubound) |
|
4907 |
apply simp |
|
4908 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 \<le> 1\<^sup>2") |
|
4909 |
apply simp |
|
4910 |
apply (rule power_mono) |
|
4911 |
apply simp |
|
53079 | 4912 |
apply simp |
4913 |
done |
|
4914 |
||
59751
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4915 |
lemma arccos_0 [simp]: "arccos 0 = pi/2" |
63558 | 4916 |
by (metis arccos_cos cos_gt_zero cos_pi cos_pi_half pi_gt_zero |
4917 |
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
|
4918 |
|
916c0f6c83e3
New material for complex sin, cos, tan, Ln, also some reorganisation
paulson <lp15@cam.ac.uk>
parents:
59746
diff
changeset
|
4919 |
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
|
4920 |
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
|
4921 |
|
63558 | 4922 |
lemma arccos_minus_1 [simp]: "arccos (- 1) = pi" |
59869 | 4923 |
by (metis arccos_cos cos_pi order_refl pi_ge_zero) |
4924 |
||
63558 | 4925 |
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
|
4926 |
by (metis arccos_cos arccos_cos2 cos_minus_pi cos_total diff_le_0_iff_le le_add_same_cancel1 |
63558 | 4927 |
minus_diff_eq uminus_add_conv_diff) |
4928 |
||
65057
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4929 |
corollary arccos_minus_abs: |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4930 |
assumes "\<bar>x\<bar> \<le> 1" |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4931 |
shows "arccos (- x) = pi - arccos x" |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4932 |
using assms by (simp add: arccos_minus) |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4933 |
|
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4934 |
lemma sin_arccos_nonzero: "- 1 < x \<Longrightarrow> x < 1 \<Longrightarrow> sin (arccos x) \<noteq> 0" |
59869 | 4935 |
using arccos_lt_bounded sin_gt_zero by force |
4936 |
||
63558 | 4937 |
lemma arctan: "- (pi/2) < arctan y \<and> arctan y < pi/2 \<and> tan (arctan y) = y" |
53079 | 4938 |
unfolding arctan_def by (rule theI' [OF tan_total]) |
4939 |
||
4940 |
lemma tan_arctan: "tan (arctan y) = y" |
|
59869 | 4941 |
by (simp add: arctan) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4942 |
|
63558 | 4943 |
lemma arctan_bounded: "- (pi/2) < arctan y \<and> arctan y < pi/2" |
53079 | 4944 |
by (auto simp only: arctan) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4945 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4946 |
lemma arctan_lbound: "- (pi/2) < arctan y" |
59869 | 4947 |
by (simp add: arctan) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4948 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4949 |
lemma arctan_ubound: "arctan y < pi/2" |
53079 | 4950 |
by (auto simp only: arctan) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4951 |
|
44746 | 4952 |
lemma arctan_unique: |
53079 | 4953 |
assumes "-(pi/2) < x" |
4954 |
and "x < pi/2" |
|
4955 |
and "tan x = y" |
|
44746 | 4956 |
shows "arctan y = x" |
4957 |
using assms arctan [of y] tan_total [of y] by (fast elim: ex1E) |
|
4958 |
||
53079 | 4959 |
lemma arctan_tan: "-(pi/2) < x \<Longrightarrow> x < pi/2 \<Longrightarrow> arctan (tan x) = x" |
4960 |
by (rule arctan_unique) simp_all |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4961 |
|
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4962 |
lemma arctan_zero_zero [simp]: "arctan 0 = 0" |
53079 | 4963 |
by (rule arctan_unique) simp_all |
44746 | 4964 |
|
4965 |
lemma arctan_minus: "arctan (- x) = - arctan x" |
|
65057
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
65036
diff
changeset
|
4966 |
using arctan [of "x"] by (auto simp: arctan_unique) |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4967 |
|
44725 | 4968 |
lemma cos_arctan_not_zero [simp]: "cos (arctan x) \<noteq> 0" |
63558 | 4969 |
by (intro less_imp_neq [symmetric] cos_gt_zero_pi arctan_lbound arctan_ubound) |
44725 | 4970 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4971 |
lemma cos_arctan: "cos (arctan x) = 1 / sqrt (1 + x\<^sup>2)" |
44725 | 4972 |
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
|
4973 |
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
|
4974 |
show "0 \<le> 1 / sqrt (1 + x\<^sup>2)" by simp |
44725 | 4975 |
show "0 \<le> cos (arctan x)" |
4976 |
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
|
4977 |
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
|
4978 |
unfolding tan_def by (simp add: distrib_left power_divide) |
63558 | 4979 |
then show "(cos (arctan x))\<^sup>2 = (1 / sqrt (1 + x\<^sup>2))\<^sup>2" |
60758 | 4980 |
using \<open>0 < 1 + x\<^sup>2\<close> by (simp add: arctan power_divide eq_divide_eq) |
44725 | 4981 |
qed |
4982 |
||
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
4983 |
lemma sin_arctan: "sin (arctan x) = x / sqrt (1 + x\<^sup>2)" |
44725 | 4984 |
using add_pos_nonneg [OF zero_less_one zero_le_power2 [of x]] |
4985 |
using tan_arctan [of x] unfolding tan_def cos_arctan |
|
4986 |
by (simp add: eq_divide_eq) |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4987 |
|
63558 | 4988 |
lemma tan_sec: "cos x \<noteq> 0 \<Longrightarrow> 1 + (tan x)\<^sup>2 = (inverse (cos x))\<^sup>2" |
4989 |
for x :: "'a::{real_normed_field,banach,field}" |
|
53079 | 4990 |
apply (rule power_inverse [THEN subst]) |
56217
dc429a5b13c4
Some rationalisation of basic lemmas
paulson <lp15@cam.ac.uk>
parents:
56213
diff
changeset
|
4991 |
apply (rule_tac c1 = "(cos x)\<^sup>2" in mult_right_cancel [THEN iffD1]) |
63558 | 4992 |
apply (auto simp add: tan_def field_simps) |
53079 | 4993 |
done |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
4994 |
|
44746 | 4995 |
lemma arctan_less_iff: "arctan x < arctan y \<longleftrightarrow> x < y" |
4996 |
by (metis tan_monotone' arctan_lbound arctan_ubound tan_arctan) |
|
4997 |
||
4998 |
lemma arctan_le_iff: "arctan x \<le> arctan y \<longleftrightarrow> x \<le> y" |
|
4999 |
by (simp only: not_less [symmetric] arctan_less_iff) |
|
5000 |
||
5001 |
lemma arctan_eq_iff: "arctan x = arctan y \<longleftrightarrow> x = y" |
|
5002 |
by (simp only: eq_iff [where 'a=real] arctan_le_iff) |
|
5003 |
||
5004 |
lemma zero_less_arctan_iff [simp]: "0 < arctan x \<longleftrightarrow> 0 < x" |
|
5005 |
using arctan_less_iff [of 0 x] by simp |
|
5006 |
||
5007 |
lemma arctan_less_zero_iff [simp]: "arctan x < 0 \<longleftrightarrow> x < 0" |
|
5008 |
using arctan_less_iff [of x 0] by simp |
|
5009 |
||
5010 |
lemma zero_le_arctan_iff [simp]: "0 \<le> arctan x \<longleftrightarrow> 0 \<le> x" |
|
5011 |
using arctan_le_iff [of 0 x] by simp |
|
5012 |
||
5013 |
lemma arctan_le_zero_iff [simp]: "arctan x \<le> 0 \<longleftrightarrow> x \<le> 0" |
|
5014 |
using arctan_le_iff [of x 0] by simp |
|
5015 |
||
5016 |
lemma arctan_eq_zero_iff [simp]: "arctan x = 0 \<longleftrightarrow> x = 0" |
|
5017 |
using arctan_eq_iff [of x 0] by simp |
|
5018 |
||
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5019 |
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
|
5020 |
proof - |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5021 |
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
|
5022 |
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
|
5023 |
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
|
5024 |
proof safe |
53079 | 5025 |
fix x :: real |
5026 |
assume "x \<in> {-1..1}" |
|
5027 |
then show "x \<in> sin ` {- pi / 2..pi / 2}" |
|
5028 |
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
|
5029 |
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
|
5030 |
qed simp |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5031 |
finally show ?thesis . |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5032 |
qed |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5033 |
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
5034 |
lemma continuous_on_arcsin [continuous_intros]: |
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5035 |
"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
|
5036 |
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
|
5037 |
by (auto simp: comp_def subset_eq) |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5038 |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5039 |
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
|
5040 |
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
|
5041 |
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
|
5042 |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5043 |
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
|
5044 |
proof - |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5045 |
have "continuous_on (cos ` {0 .. pi}) arccos" |
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
5046 |
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
|
5047 |
also have "cos ` {0 .. pi} = {-1 .. 1}" |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5048 |
proof safe |
53079 | 5049 |
fix x :: real |
5050 |
assume "x \<in> {-1..1}" |
|
5051 |
then show "x \<in> cos ` {0..pi}" |
|
5052 |
using arccos_lbound arccos_ubound |
|
5053 |
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
|
5054 |
qed simp |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5055 |
finally show ?thesis . |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5056 |
qed |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5057 |
|
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56261
diff
changeset
|
5058 |
lemma continuous_on_arccos [continuous_intros]: |
51482
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5059 |
"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
|
5060 |
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
|
5061 |
by (auto simp: comp_def subset_eq) |
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5062 |
|
80efd8c49f52
arcsin and arccos are continuous on {0 .. 1} (including the endpoints)
hoelzl
parents:
51481
diff
changeset
|
5063 |
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
|
5064 |
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
|
5065 |
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
|
5066 |
|
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5067 |
lemma isCont_arctan: "isCont arctan x" |
63558 | 5068 |
apply (rule arctan_lbound [of x, THEN dense, THEN exE]) |
5069 |
apply clarify |
|
5070 |
apply (rule arctan_ubound [of x, THEN dense, THEN exE]) |
|
5071 |
apply clarify |
|
5072 |
apply (subgoal_tac "isCont arctan (tan (arctan x))") |
|
5073 |
apply (simp add: arctan) |
|
53079 | 5074 |
apply (erule (1) isCont_inverse_function2 [where f=tan]) |
63558 | 5075 |
apply (metis arctan_tan order_le_less_trans order_less_le_trans) |
53079 | 5076 |
apply (metis cos_gt_zero_pi isCont_tan order_less_le_trans less_le) |
5077 |
done |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5078 |
|
61973 | 5079 |
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
|
5080 |
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
|
5081 |
|
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
|
5082 |
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
|
5083 |
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
|
5084 |
|
63558 | 5085 |
lemma continuous_on_arctan [continuous_intros]: |
5086 |
"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
|
5087 |
unfolding continuous_on_def by (auto intro: tendsto_arctan) |
53079 | 5088 |
|
63558 | 5089 |
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
|
5090 |
apply (rule DERIV_inverse_function [where f=sin and a="-1" and b=1]) |
63558 | 5091 |
apply (rule DERIV_cong [OF DERIV_sin]) |
5092 |
apply (simp add: cos_arcsin) |
|
5093 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 < 1\<^sup>2") |
|
5094 |
apply simp |
|
5095 |
apply (rule power_strict_mono) |
|
5096 |
apply simp |
|
5097 |
apply simp |
|
5098 |
apply simp |
|
5099 |
apply assumption |
|
5100 |
apply assumption |
|
5101 |
apply simp |
|
53079 | 5102 |
apply (erule (1) isCont_arcsin) |
5103 |
done |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5104 |
|
63558 | 5105 |
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
|
5106 |
apply (rule DERIV_inverse_function [where f=cos and a="-1" and b=1]) |
63558 | 5107 |
apply (rule DERIV_cong [OF DERIV_cos]) |
5108 |
apply (simp add: sin_arccos) |
|
5109 |
apply (subgoal_tac "\<bar>x\<bar>\<^sup>2 < 1\<^sup>2") |
|
5110 |
apply simp |
|
5111 |
apply (rule power_strict_mono) |
|
5112 |
apply simp |
|
5113 |
apply simp |
|
5114 |
apply simp |
|
5115 |
apply assumption |
|
5116 |
apply assumption |
|
5117 |
apply simp |
|
53079 | 5118 |
apply (erule (1) isCont_arccos) |
5119 |
done |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5120 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
5121 |
lemma DERIV_arctan: "DERIV arctan x :> inverse (1 + x\<^sup>2)" |
53079 | 5122 |
apply (rule DERIV_inverse_function [where f=tan and a="x - 1" and b="x + 1"]) |
63558 | 5123 |
apply (rule DERIV_cong [OF DERIV_tan]) |
5124 |
apply (rule cos_arctan_not_zero) |
|
5125 |
apply (simp_all add: add_pos_nonneg arctan isCont_arctan) |
|
5126 |
apply (simp add: arctan power_inverse [symmetric] tan_sec [symmetric]) |
|
5127 |
apply (subgoal_tac "0 < 1 + x\<^sup>2") |
|
5128 |
apply simp |
|
59869 | 5129 |
apply (simp_all add: add_pos_nonneg arctan isCont_arctan) |
53079 | 5130 |
done |
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5131 |
|
31880 | 5132 |
declare |
56381
0556204bc230
merged DERIV_intros, has_derivative_intros into derivative_intros
hoelzl
parents:
56371
diff
changeset
|
5133 |
DERIV_arcsin[THEN DERIV_chain2, derivative_intros] |
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
5134 |
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
|
5135 |
DERIV_arccos[THEN DERIV_chain2, derivative_intros] |
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
5136 |
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
|
5137 |
DERIV_arctan[THEN DERIV_chain2, derivative_intros] |
61518
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
paulson
parents:
61284
diff
changeset
|
5138 |
DERIV_arctan[THEN DERIV_chain2, unfolded has_field_derivative_def, derivative_intros] |
31880 | 5139 |
|
61881
b4bfa62e799d
Transcendental: use [simp]-canonical form - (pi/2)
hoelzl
parents:
61810
diff
changeset
|
5140 |
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
|
5141 |
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 | 5142 |
(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
|
5143 |
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
|
5144 |
|
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
|
5145 |
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
|
5146 |
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 | 5147 |
(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
|
5148 |
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
|
5149 |
|
61973 | 5150 |
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
|
5151 |
proof (rule tendstoI) |
53079 | 5152 |
fix e :: real |
5153 |
assume "0 < e" |
|
63040 | 5154 |
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
|
5155 |
then have y: "0 \<le> y" "y < pi/2" "pi/2 \<le> e + y" |
60758 | 5156 |
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
|
5157 |
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
|
5158 |
proof (intro eventually_at_top_dense[THEN iffD2] exI allI impI) |
53079 | 5159 |
fix x |
5160 |
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
|
5161 |
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
|
5162 |
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
|
5163 |
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
|
5164 |
by (subst (asm) arctan_tan) simp_all |
60758 | 5165 |
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
|
5166 |
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
|
5167 |
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
|
5168 |
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
|
5169 |
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
|
5170 |
|
61973 | 5171 |
lemma tendsto_arctan_at_bot: "(arctan \<longlongrightarrow> - (pi/2)) at_bot" |
53079 | 5172 |
unfolding filterlim_at_bot_mirror arctan_minus |
5173 |
by (intro tendsto_minus tendsto_arctan_at_top) |
|
5174 |
||
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
|
5175 |
|
63558 | 5176 |
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
|
5177 |
|
59869 | 5178 |
lemma cos_arccos_abs: "\<bar>y\<bar> \<le> 1 \<Longrightarrow> cos (arccos y) = y" |
5179 |
by (simp add: abs_le_iff) |
|
5180 |
||
5181 |
lemma sin_arccos_abs: "\<bar>y\<bar> \<le> 1 \<Longrightarrow> sin (arccos y) = sqrt (1 - y\<^sup>2)" |
|
5182 |
by (simp add: sin_arccos abs_le_iff) |
|
5183 |
||
63558 | 5184 |
lemma sin_mono_less_eq: |
5185 |
"- (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" |
|
5186 |
by (metis not_less_iff_gr_or_eq sin_monotone_2pi) |
|
5187 |
||
5188 |
lemma sin_mono_le_eq: |
|
5189 |
"- (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" |
|
5190 |
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
|
5191 |
|
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
|
5192 |
lemma sin_inj_pi: |
63558 | 5193 |
"- (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" |
5194 |
by (metis arcsin_sin) |
|
5195 |
||
5196 |
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" |
|
5197 |
by (meson cos_monotone_0_pi cos_monotone_0_pi_le leD le_less_linear) |
|
5198 |
||
5199 |
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
|
5200 |
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
|
5201 |
|
63558 | 5202 |
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" |
5203 |
by (metis arccos_cos) |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5204 |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5205 |
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
|
5206 |
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
|
5207 |
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
|
5208 |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5209 |
lemma sincos_total_pi_half: |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5210 |
assumes "0 \<le> x" "0 \<le> y" "x\<^sup>2 + y\<^sup>2 = 1" |
63558 | 5211 |
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
|
5212 |
proof - |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5213 |
have x1: "x \<le> 1" |
63558 | 5214 |
using assms by (metis le_add_same_cancel1 power2_le_imp_le power_one zero_le_power2) |
5215 |
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
|
5216 |
by (auto simp: arccos) |
63540 | 5217 |
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
|
5218 |
by (metis abs_of_nonneg add.commute add_diff_cancel real_sqrt_abs) |
63558 | 5219 |
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
|
5220 |
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
|
5221 |
qed |
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5222 |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5223 |
lemma sincos_total_pi: |
63558 | 5224 |
assumes "0 \<le> y" "x\<^sup>2 + y\<^sup>2 = 1" |
5225 |
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
|
5226 |
proof (cases rule: le_cases [of 0 x]) |
63558 | 5227 |
case le |
5228 |
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
|
5229 |
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
|
5230 |
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
|
5231 |
case ge |
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5232 |
then have "0 \<le> -x" |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5233 |
by simp |
63558 | 5234 |
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
|
5235 |
using sincos_total_pi_half assms |
63558 | 5236 |
by auto (metis \<open>0 \<le> - x\<close> power2_minus) |
5237 |
show ?thesis |
|
5238 |
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
|
5239 |
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
|
5240 |
|
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5241 |
lemma sincos_total_2pi_le: |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5242 |
assumes "x\<^sup>2 + y\<^sup>2 = 1" |
63558 | 5243 |
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
|
5244 |
proof (cases rule: le_cases [of 0 y]) |
63558 | 5245 |
case le |
5246 |
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
|
5247 |
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
|
5248 |
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
|
5249 |
case ge |
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5250 |
then have "0 \<le> -y" |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5251 |
by simp |
63558 | 5252 |
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
|
5253 |
using sincos_total_pi assms |
63558 | 5254 |
by auto (metis \<open>0 \<le> - y\<close> power2_minus) |
5255 |
show ?thesis |
|
5256 |
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
|
5257 |
qed |
59746
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5258 |
|
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5259 |
lemma sincos_total_2pi: |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5260 |
assumes "x\<^sup>2 + y\<^sup>2 = 1" |
63558 | 5261 |
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
|
5262 |
proof - |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5263 |
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
|
5264 |
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
|
5265 |
by blast |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5266 |
show ?thesis |
63558 | 5267 |
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
|
5268 |
qed |
ddae5727c5a9
new HOL Light material about exp, sin, cos
paulson <lp15@cam.ac.uk>
parents:
59741
diff
changeset
|
5269 |
|
61944 | 5270 |
lemma arcsin_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arcsin x < arcsin y \<longleftrightarrow> x < y" |
63558 | 5271 |
by (rule trans [OF sin_mono_less_eq [symmetric]]) (use arcsin_ubound arcsin_lbound in auto) |
59869 | 5272 |
|
61944 | 5273 |
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 | 5274 |
using arcsin_less_mono not_le by blast |
5275 |
||
63558 | 5276 |
lemma arcsin_less_arcsin: "- 1 \<le> x \<Longrightarrow> x < y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin x < arcsin y" |
59869 | 5277 |
using arcsin_less_mono by auto |
5278 |
||
63558 | 5279 |
lemma arcsin_le_arcsin: "- 1 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arcsin x \<le> arcsin y" |
59869 | 5280 |
using arcsin_le_mono by auto |
5281 |
||
63558 | 5282 |
lemma arccos_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x < arccos y \<longleftrightarrow> y < x" |
5283 |
by (rule trans [OF cos_mono_less_eq [symmetric]]) (use arccos_ubound arccos_lbound in auto) |
|
59869 | 5284 |
|
61944 | 5285 |
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 | 5286 |
using arccos_less_mono [of y x] by (simp add: not_le [symmetric]) |
5287 |
||
5288 |
lemma arccos_less_arccos: "- 1 \<le> x \<Longrightarrow> x < y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y < arccos x" |
|
59869 | 5289 |
using arccos_less_mono by auto |
5290 |
||
63558 | 5291 |
lemma arccos_le_arccos: "- 1 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> y \<le> 1 \<Longrightarrow> arccos y \<le> arccos x" |
59869 | 5292 |
using arccos_le_mono by auto |
5293 |
||
63558 | 5294 |
lemma arccos_eq_iff: "\<bar>x\<bar> \<le> 1 \<and> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x = arccos y \<longleftrightarrow> x = y" |
59869 | 5295 |
using cos_arccos_abs by fastforce |
5296 |
||
63558 | 5297 |
|
5298 |
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
|
5299 |
|
44746 | 5300 |
lemma arctan_one: "arctan 1 = pi / 4" |
63558 | 5301 |
by (rule arctan_unique) (simp_all add: tan_45 m2pi_less_pi) |
44746 | 5302 |
|
53079 | 5303 |
lemma tan_total_pi4: |
5304 |
assumes "\<bar>x\<bar> < 1" |
|
5305 |
shows "\<exists>z. - (pi / 4) < z \<and> z < pi / 4 \<and> tan z = x" |
|
44746 | 5306 |
proof |
5307 |
show "- (pi / 4) < arctan x \<and> arctan x < pi / 4 \<and> tan (arctan x) = x" |
|
5308 |
unfolding arctan_one [symmetric] arctan_minus [symmetric] |
|
63558 | 5309 |
unfolding arctan_less_iff |
5310 |
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
|
5311 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5312 |
|
53079 | 5313 |
lemma arctan_add: |
63558 | 5314 |
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
|
5315 |
shows "arctan x + arctan y = arctan ((x + y) / (1 - x * y))" |
44746 | 5316 |
proof (rule arctan_unique [symmetric]) |
63558 | 5317 |
have "- (pi / 4) \<le> arctan x" "- (pi / 4) < arctan y" |
44746 | 5318 |
unfolding arctan_one [symmetric] arctan_minus [symmetric] |
63558 | 5319 |
unfolding arctan_le_iff arctan_less_iff |
5320 |
using assms by auto |
|
5321 |
from add_le_less_mono [OF this] show 1: "- (pi / 2) < arctan x + arctan y" |
|
5322 |
by simp |
|
5323 |
have "arctan x \<le> pi / 4" "arctan y < pi / 4" |
|
44746 | 5324 |
unfolding arctan_one [symmetric] |
63558 | 5325 |
unfolding arctan_le_iff arctan_less_iff |
5326 |
using assms by auto |
|
5327 |
from add_le_less_mono [OF this] show 2: "arctan x + arctan y < pi / 2" |
|
5328 |
by simp |
|
44746 | 5329 |
show "tan (arctan x + arctan y) = (x + y) / (1 - x * y)" |
59869 | 5330 |
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
|
5331 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5332 |
|
63558 | 5333 |
lemma arctan_double: "\<bar>x\<bar> < 1 \<Longrightarrow> 2 * arctan x = arctan ((2 * x) / (1 - x\<^sup>2))" |
5334 |
by (metis arctan_add linear mult_2 not_less power2_eq_square) |
|
5335 |
||
5336 |
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
|
5337 |
proof - |
63558 | 5338 |
have "\<bar>1 / 5\<bar> < (1 :: real)" |
5339 |
by auto |
|
5340 |
from arctan_add[OF less_imp_le[OF this] this] have "2 * arctan (1 / 5) = arctan (5 / 12)" |
|
5341 |
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
|
5342 |
moreover |
63558 | 5343 |
have "\<bar>5 / 12\<bar> < (1 :: real)" |
5344 |
by auto |
|
5345 |
from arctan_add[OF less_imp_le[OF this] this] have "2 * arctan (5 / 12) = arctan (120 / 119)" |
|
5346 |
by auto |
|
41970 | 5347 |
moreover |
63558 | 5348 |
have "\<bar>1\<bar> \<le> (1::real)" and "\<bar>1 / 239\<bar> < (1::real)" |
5349 |
by auto |
|
5350 |
from arctan_add[OF this] have "arctan 1 + arctan (1 / 239) = arctan (120 / 119)" |
|
5351 |
by auto |
|
5352 |
ultimately have "arctan 1 + arctan (1 / 239) = 4 * arctan (1 / 5)" |
|
5353 |
by auto |
|
5354 |
then show ?thesis |
|
5355 |
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
|
5356 |
qed |
44746 | 5357 |
|
63558 | 5358 |
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
|
5359 |
proof - |
63558 | 5360 |
have 17: "\<bar>1 / 7\<bar> < (1 :: real)" by auto |
5361 |
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
|
5362 |
by simp (simp add: field_simps) |
63558 | 5363 |
moreover |
5364 |
have "\<bar>7 / 24\<bar> < (1 :: real)" by auto |
|
5365 |
with arctan_double have "2 * arctan (7 / 24) = arctan (336 / 527)" |
|
5366 |
by simp (simp add: field_simps) |
|
5367 |
moreover |
|
5368 |
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
|
5369 |
from arctan_add[OF less_imp_le[OF 17] this] |
63558 | 5370 |
have "arctan(1/7) + arctan (336 / 527) = arctan (2879 / 3353)" |
5371 |
by auto |
|
5372 |
ultimately have I: "5 * arctan (1 / 7) = arctan (2879 / 3353)" by auto |
|
5373 |
have 379: "\<bar>3 / 79\<bar> < (1 :: real)" by auto |
|
5374 |
with arctan_double have II: "2 * arctan (3 / 79) = arctan (237 / 3116)" |
|
5375 |
by simp (simp add: field_simps) |
|
5376 |
have *: "\<bar>2879 / 3353\<bar> < (1 :: real)" by auto |
|
5377 |
have "\<bar>237 / 3116\<bar> < (1 :: real)" by auto |
|
5378 |
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
|
5379 |
by (simp add: arctan_one) |
63558 | 5380 |
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
|
5381 |
qed |
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5382 |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5383 |
(*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
|
5384 |
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
|
5385 |
|
53079 | 5386 |
|
60758 | 5387 |
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
|
5388 |
|
53079 | 5389 |
lemma monoseq_arctan_series: |
5390 |
fixes x :: real |
|
5391 |
assumes "\<bar>x\<bar> \<le> 1" |
|
63558 | 5392 |
shows "monoseq (\<lambda>n. 1 / real (n * 2 + 1) * x^(n * 2 + 1))" |
5393 |
(is "monoseq ?a") |
|
53079 | 5394 |
proof (cases "x = 0") |
5395 |
case True |
|
63558 | 5396 |
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
|
5397 |
next |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5398 |
case False |
63558 | 5399 |
have "norm x \<le> 1" and "x \<le> 1" and "-1 \<le> x" |
5400 |
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
|
5401 |
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
|
5402 |
proof - |
63558 | 5403 |
have mono: "1 / real (Suc (Suc n * 2)) * x ^ Suc (Suc n * 2) \<le> |
53079 | 5404 |
1 / real (Suc (n * 2)) * x ^ Suc (n * 2)" |
63558 | 5405 |
if "0 \<le> x" and "x \<le> 1" for n and x :: real |
5406 |
proof (rule mult_mono) |
|
5407 |
show "1 / real (Suc (Suc n * 2)) \<le> 1 / real (Suc (n * 2))" |
|
5408 |
by (rule frac_le) simp_all |
|
5409 |
show "0 \<le> 1 / real (Suc (n * 2))" |
|
5410 |
by auto |
|
5411 |
show "x ^ Suc (Suc n * 2) \<le> x ^ Suc (n * 2)" |
|
5412 |
by (rule power_decreasing) (simp_all add: \<open>0 \<le> x\<close> \<open>x \<le> 1\<close>) |
|
5413 |
show "0 \<le> x ^ Suc (Suc n * 2)" |
|
5414 |
by (rule zero_le_power) (simp add: \<open>0 \<le> x\<close>) |
|
5415 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5416 |
show ?thesis |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5417 |
proof (cases "0 \<le> x") |
63558 | 5418 |
case True |
5419 |
from mono[OF this \<open>x \<le> 1\<close>, THEN allI] |
|
5420 |
show ?thesis |
|
5421 |
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
|
5422 |
next |
53079 | 5423 |
case False |
63558 | 5424 |
then have "0 \<le> - x" and "- x \<le> 1" |
5425 |
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
|
5426 |
from mono[OF this] |
63558 | 5427 |
have "1 / real (Suc (Suc n * 2)) * x ^ Suc (Suc n * 2) \<ge> |
5428 |
1 / real (Suc (n * 2)) * x ^ Suc (n * 2)" for n |
|
5429 |
using \<open>0 \<le> -x\<close> by auto |
|
5430 |
then show ?thesis |
|
5431 |
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
|
5432 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5433 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5434 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5435 |
|
53079 | 5436 |
lemma zeroseq_arctan_series: |
5437 |
fixes x :: real |
|
5438 |
assumes "\<bar>x\<bar> \<le> 1" |
|
63558 | 5439 |
shows "(\<lambda>n. 1 / real (n * 2 + 1) * x^(n * 2 + 1)) \<longlonglongrightarrow> 0" |
5440 |
(is "?a \<longlonglongrightarrow> 0") |
|
53079 | 5441 |
proof (cases "x = 0") |
5442 |
case True |
|
63558 | 5443 |
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
|
5444 |
next |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5445 |
case False |
63558 | 5446 |
have "norm x \<le> 1" and "x \<le> 1" and "-1 \<le> x" |
5447 |
using assms by auto |
|
61969 | 5448 |
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
|
5449 |
proof (cases "\<bar>x\<bar> < 1") |
53079 | 5450 |
case True |
63558 | 5451 |
then have "norm x < 1" by auto |
60758 | 5452 |
from tendsto_mult[OF LIMSEQ_inverse_real_of_nat LIMSEQ_power_zero[OF \<open>norm x < 1\<close>, THEN LIMSEQ_Suc]] |
61969 | 5453 |
have "(\<lambda>n. 1 / real (n + 1) * x ^ (n + 1)) \<longlonglongrightarrow> 0" |
31790 | 5454 |
unfolding inverse_eq_divide Suc_eq_plus1 by simp |
63558 | 5455 |
then show ?thesis |
5456 |
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
|
5457 |
next |
53079 | 5458 |
case False |
63558 | 5459 |
then have "x = -1 \<or> x = 1" |
5460 |
using \<open>\<bar>x\<bar> \<le> 1\<close> by auto |
|
5461 |
then have n_eq: "\<And> n. x ^ (n * 2 + 1) = x" |
|
53079 | 5462 |
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
|
5463 |
from tendsto_mult[OF LIMSEQ_inverse_real_of_nat[THEN LIMSEQ_linear, OF pos2, unfolded inverse_eq_divide] tendsto_const[of x]] |
63558 | 5464 |
show ?thesis |
5465 |
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
|
5466 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5467 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5468 |
|
53079 | 5469 |
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
|
5470 |
fixes n :: nat |
53079 | 5471 |
assumes "\<bar>x\<bar> \<le> 1" |
5472 |
shows "summable (\<lambda> k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1)))" |
|
63558 | 5473 |
(is "summable (?c x)") |
5474 |
by (rule summable_Leibniz(1), |
|
5475 |
rule zeroseq_arctan_series[OF assms], |
|
5476 |
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
|
5477 |
|
53079 | 5478 |
lemma DERIV_arctan_series: |
63558 | 5479 |
assumes "\<bar>x\<bar> < 1" |
5480 |
shows "DERIV (\<lambda>x'. \<Sum>k. (-1)^k * (1 / real (k * 2 + 1) * x' ^ (k * 2 + 1))) x :> |
|
5481 |
(\<Sum>k. (-1)^k * x^(k * 2))" |
|
5482 |
(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
|
5483 |
proof - |
53079 | 5484 |
let ?f = "\<lambda>n. if even n then (-1)^(n div 2) * 1 / real (Suc n) else 0" |
5485 |
||
63558 | 5486 |
have n_even: "even n \<Longrightarrow> 2 * (n div 2) = n" for n :: nat |
53079 | 5487 |
by presburger |
63558 | 5488 |
then have if_eq: "?f n * real (Suc n) * x'^n = |
5489 |
(if even n then (-1)^(n div 2) * x'^(2 * (n div 2)) else 0)" |
|
5490 |
for n x' |
|
53079 | 5491 |
by auto |
5492 |
||
63558 | 5493 |
have summable_Integral: "summable (\<lambda> n. (- 1) ^ n * x^(2 * n))" if "\<bar>x\<bar> < 1" for x :: real |
5494 |
proof - |
|
5495 |
from that have "x\<^sup>2 < 1" |
|
5496 |
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
|
5497 |
have "summable (\<lambda> n. (- 1) ^ n * (x\<^sup>2) ^n)" |
63558 | 5498 |
by (rule summable_Leibniz(1)) |
5499 |
(auto intro!: LIMSEQ_realpow_zero monoseq_realpow \<open>x\<^sup>2 < 1\<close> order_less_imp_le[OF \<open>x\<^sup>2 < 1\<close>]) |
|
5500 |
then show ?thesis |
|
5501 |
by (simp only: power_mult) |
|
5502 |
qed |
|
5503 |
||
5504 |
have sums_even: "op sums f = op sums (\<lambda> n. if even n then f (n div 2) else 0)" |
|
5505 |
for f :: "nat \<Rightarrow> real" |
|
5506 |
proof - |
|
5507 |
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
|
5508 |
proof |
53079 | 5509 |
assume "f sums x" |
63558 | 5510 |
from sums_if[OF sums_zero this] show "(\<lambda>n. if even n then f (n div 2) else 0) sums x" |
53079 | 5511 |
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
|
5512 |
next |
53079 | 5513 |
assume "(\<lambda> n. if even n then f (n div 2) else 0) sums x" |
63170 | 5514 |
from LIMSEQ_linear[OF this[simplified sums_def] pos2, simplified sum_split_even_odd[simplified mult.commute]] |
63558 | 5515 |
show "f sums x" |
5516 |
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
|
5517 |
qed |
63558 | 5518 |
then show ?thesis .. |
5519 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5520 |
|
53079 | 5521 |
have Int_eq: "(\<Sum>n. ?f n * real (Suc n) * x^n) = ?Int" |
63558 | 5522 |
unfolding if_eq mult.commute[of _ 2] |
5523 |
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
|
5524 |
by auto |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5525 |
|
63558 | 5526 |
have arctan_eq: "(\<Sum>n. ?f n * x^(Suc n)) = ?arctan x" for x |
5527 |
proof - |
|
58410
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5528 |
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
|
5529 |
(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
|
5530 |
using n_even by auto |
63558 | 5531 |
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
|
5532 |
by auto |
63558 | 5533 |
then show ?thesis |
5534 |
unfolding if_eq' idx_eq suminf_def |
|
5535 |
sums_even[of "\<lambda> n. (- 1) ^ n * (1 / real (Suc (2 * n)) * x ^ Suc (2 * n))", symmetric] |
|
5536 |
by auto |
|
5537 |
qed |
|
5538 |
||
5539 |
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
|
5540 |
proof (rule DERIV_power_series') |
63558 | 5541 |
show "x \<in> {- 1 <..< 1}" |
5542 |
using \<open>\<bar> x \<bar> < 1\<close> by auto |
|
5543 |
show "summable (\<lambda> n. ?f n * real (Suc n) * x'^n)" |
|
5544 |
if x'_bounds: "x' \<in> {- 1 <..< 1}" for x' :: real |
|
5545 |
proof - |
|
5546 |
from that have "\<bar>x'\<bar> < 1" by auto |
|
5547 |
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
|
5548 |
by (rule summable_Integral) |
63558 | 5549 |
show ?thesis |
5550 |
unfolding if_eq |
|
5551 |
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
|
5552 |
apply (rule sums_if) |
63558 | 5553 |
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
|
5554 |
apply (rule summable_sums) |
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5555 |
apply (rule *) |
6d46ad54a2ab
explicit separation of signed and unsigned numerals using existing lexical categories num and xnum
haftmann
parents:
57514
diff
changeset
|
5556 |
done |
63558 | 5557 |
qed |
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5558 |
qed auto |
63558 | 5559 |
then show ?thesis |
5560 |
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
|
5561 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5562 |
|
53079 | 5563 |
lemma arctan_series: |
63558 | 5564 |
assumes "\<bar>x\<bar> \<le> 1" |
5565 |
shows "arctan x = (\<Sum>k. (-1)^k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))" |
|
5566 |
(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
|
5567 |
proof - |
53079 | 5568 |
let ?c' = "\<lambda>x n. (-1)^n * x^(n*2)" |
5569 |
||
63558 | 5570 |
have DERIV_arctan_suminf: "DERIV (\<lambda> x. suminf (?c x)) x :> (suminf (?c' x))" |
5571 |
if "0 < r" and "r < 1" and "\<bar>x\<bar> < r" for r x :: real |
|
5572 |
proof (rule DERIV_arctan_series) |
|
5573 |
from that show "\<bar>x\<bar> < 1" |
|
5574 |
using \<open>r < 1\<close> and \<open>\<bar>x\<bar> < r\<close> by auto |
|
5575 |
qed |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5576 |
|
53079 | 5577 |
{ |
5578 |
fix x :: real |
|
5579 |
assume "\<bar>x\<bar> \<le> 1" |
|
5580 |
note summable_Leibniz[OF zeroseq_arctan_series[OF this] monoseq_arctan_series[OF this]] |
|
5581 |
} note arctan_series_borders = this |
|
5582 |
||
63558 | 5583 |
have when_less_one: "arctan x = (\<Sum>k. ?c x k)" if "\<bar>x\<bar> < 1" for x :: real |
5584 |
proof - |
|
5585 |
obtain r where "\<bar>x\<bar> < r" and "r < 1" |
|
5586 |
using dense[OF \<open>\<bar>x\<bar> < 1\<close>] by blast |
|
5587 |
then have "0 < r" and "- r < x" and "x < r" by auto |
|
5588 |
||
5589 |
have suminf_eq_arctan_bounded: "suminf (?c x) - arctan x = suminf (?c a) - arctan a" |
|
5590 |
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
|
5591 |
proof - |
63558 | 5592 |
from that have "\<bar>x\<bar> < r" by auto |
5593 |
show "suminf (?c x) - arctan x = suminf (?c a) - arctan a" |
|
5594 |
proof (rule DERIV_isconst2[of "a" "b"]) |
|
5595 |
show "a < b" and "a \<le> x" and "x \<le> b" |
|
5596 |
using \<open>a < b\<close> \<open>a \<le> x\<close> \<open>x \<le> b\<close> by auto |
|
5597 |
have "\<forall>x. - r < x \<and> x < r \<longrightarrow> DERIV (\<lambda> x. suminf (?c x) - arctan x) x :> 0" |
|
5598 |
proof (rule allI, rule impI) |
|
5599 |
fix x |
|
5600 |
assume "-r < x \<and> x < r" |
|
5601 |
then have "\<bar>x\<bar> < r" by auto |
|
5602 |
with \<open>r < 1\<close> have "\<bar>x\<bar> < 1" by auto |
|
5603 |
have "\<bar>- (x\<^sup>2)\<bar> < 1" using abs_square_less_1 \<open>\<bar>x\<bar> < 1\<close> by auto |
|
5604 |
then have "(\<lambda>n. (- (x\<^sup>2)) ^ n) sums (1 / (1 - (- (x\<^sup>2))))" |
|
5605 |
unfolding real_norm_def[symmetric] by (rule geometric_sums) |
|
5606 |
then have "(?c' x) sums (1 / (1 - (- (x\<^sup>2))))" |
|
5607 |
unfolding power_mult_distrib[symmetric] power_mult mult.commute[of _ 2] by auto |
|
5608 |
then have suminf_c'_eq_geom: "inverse (1 + x\<^sup>2) = suminf (?c' x)" |
|
5609 |
using sums_unique unfolding inverse_eq_divide by auto |
|
5610 |
have "DERIV (\<lambda> x. suminf (?c x)) x :> (inverse (1 + x\<^sup>2))" |
|
5611 |
unfolding suminf_c'_eq_geom |
|
5612 |
by (rule DERIV_arctan_suminf[OF \<open>0 < r\<close> \<open>r < 1\<close> \<open>\<bar>x\<bar> < r\<close>]) |
|
5613 |
from DERIV_diff [OF this DERIV_arctan] show "DERIV (\<lambda>x. suminf (?c x) - arctan x) x :> 0" |
|
5614 |
by auto |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5615 |
qed |
63558 | 5616 |
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" |
5617 |
using \<open>-r < a\<close> \<open>b < r\<close> by auto |
|
5618 |
then show "\<forall>y. a < y \<and> y < b \<longrightarrow> DERIV (\<lambda>x. suminf (?c x) - arctan x) y :> 0" |
|
5619 |
using \<open>\<bar>x\<bar> < r\<close> by auto |
|
5620 |
show "\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> isCont (\<lambda>x. suminf (?c x) - arctan x) y" |
|
5621 |
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
|
5622 |
qed |
63558 | 5623 |
qed |
5624 |
||
5625 |
have suminf_arctan_zero: "suminf (?c 0) - arctan 0 = 0" |
|
5626 |
unfolding Suc_eq_plus1[symmetric] power_Suc2 mult_zero_right arctan_zero_zero suminf_zero |
|
5627 |
by auto |
|
5628 |
||
5629 |
have "suminf (?c x) - arctan x = 0" |
|
5630 |
proof (cases "x = 0") |
|
5631 |
case True |
|
5632 |
then show ?thesis |
|
5633 |
using suminf_arctan_zero by auto |
|
5634 |
next |
|
5635 |
case False |
|
5636 |
then have "0 < \<bar>x\<bar>" and "- \<bar>x\<bar> < \<bar>x\<bar>" |
|
53079 | 5637 |
by auto |
63558 | 5638 |
have "suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>) = suminf (?c 0) - arctan 0" |
5639 |
by (rule suminf_eq_arctan_bounded[where x1="0" and a1="-\<bar>x\<bar>" and b1="\<bar>x\<bar>", symmetric]) |
|
5640 |
(simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>-\<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less) |
|
5641 |
moreover |
|
5642 |
have "suminf (?c x) - arctan x = suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>)" |
|
5643 |
by (rule suminf_eq_arctan_bounded[where x1="x" and a1="- \<bar>x\<bar>" and b1="\<bar>x\<bar>"]) |
|
5644 |
(simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>- \<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less) |
|
5645 |
ultimately show ?thesis |
|
5646 |
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
|
5647 |
qed |
63558 | 5648 |
then show ?thesis by auto |
5649 |
qed |
|
5650 |
||
5651 |
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
|
5652 |
proof (cases "\<bar>x\<bar> < 1") |
53079 | 5653 |
case True |
63558 | 5654 |
then show ?thesis by (rule when_less_one) |
53079 | 5655 |
next |
5656 |
case False |
|
63558 | 5657 |
then have "\<bar>x\<bar> = 1" using \<open>\<bar>x\<bar> \<le> 1\<close> by auto |
5658 |
let ?a = "\<lambda>x n. \<bar>1 / real (n * 2 + 1) * x^(n * 2 + 1)\<bar>" |
|
5659 |
let ?diff = "\<lambda>x n. \<bar>arctan x - (\<Sum>i<n. ?c x i)\<bar>" |
|
5660 |
have "?diff 1 n \<le> ?a 1 n" for n :: nat |
|
5661 |
proof - |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5662 |
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
|
5663 |
moreover |
63558 | 5664 |
have "?diff x n \<le> ?a x n" if "0 < x" and "x < 1" for x :: real |
5665 |
proof - |
|
5666 |
from that have "\<bar>x\<bar> \<le> 1" and "\<bar>x\<bar> < 1" |
|
5667 |
by auto |
|
60758 | 5668 |
from \<open>0 < x\<close> have "0 < 1 / real (0 * 2 + (1::nat)) * x ^ (0 * 2 + 1)" |
53079 | 5669 |
by auto |
60758 | 5670 |
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 | 5671 |
have "0 < 1 / real (n*2+1) * x^(n*2+1)" |
63558 | 5672 |
by (rule mult_pos_pos) (simp_all only: zero_less_power[OF \<open>0 < x\<close>], auto) |
5673 |
then have a_pos: "?a x n = 1 / real (n*2+1) * x^(n*2+1)" |
|
53079 | 5674 |
by (rule abs_of_pos) |
63558 | 5675 |
show ?thesis |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5676 |
proof (cases "even n") |
53079 | 5677 |
case True |
63558 | 5678 |
then have sgn_pos: "(-1)^n = (1::real)" by auto |
60758 | 5679 |
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
|
5680 |
then have "2 * m = n" .. |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5681 |
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
|
5682 |
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 | 5683 |
by auto |
63558 | 5684 |
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
|
5685 |
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
|
5686 |
finally show ?thesis . |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5687 |
next |
53079 | 5688 |
case False |
63558 | 5689 |
then have sgn_neg: "(-1)^n = (-1::real)" by auto |
60758 | 5690 |
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
|
5691 |
then have m_def: "2 * m + 1 = n" .. |
63558 | 5692 |
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
|
5693 |
from bounds[of "m + 1", unfolded this atLeastAtMost_iff, THEN conjunct1] bounds[of m, unfolded m_def atLeastAtMost_iff, THEN conjunct2] |
63558 | 5694 |
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 |
5695 |
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
|
5696 |
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
|
5697 |
finally show ?thesis . |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
32047
diff
changeset
|
5698 |
qed |
63558 | 5699 |
qed |
5700 |
hence "\<forall>x \<in> { 0 <..< 1 }. 0 \<le> ?a x n - ?diff x n" by auto |
|
5701 |
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
|
5702 |
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
|
5703 |
by (auto intro!: isCont_add isCont_rabs continuous_ident isCont_minus isCont_arctan |
64267 | 5704 |
isCont_inverse isCont_mult isCont_power continuous_const isCont_sum |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53602
diff
changeset
|
5705 |
simp del: add_uminus_conv_diff) |
53079 | 5706 |
ultimately have "0 \<le> ?a 1 n - ?diff 1 n" |
5707 |
by (rule LIM_less_bound) |
|
63558 | 5708 |
then show ?thesis by auto |
5709 |
qed |
|
61969 | 5710 |
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
|
5711 |
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
|
5712 |
by (auto intro!: tendsto_mult LIMSEQ_linear LIMSEQ_inverse_real_of_nat simp del: of_nat_Suc) |
61969 | 5713 |
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
|
5714 |
proof (rule LIMSEQ_I) |
53079 | 5715 |
fix r :: real |
5716 |
assume "0 < r" |
|
63558 | 5717 |
obtain N :: nat where N_I: "N \<le> n \<Longrightarrow> ?a 1 n < r" for n |
61969 | 5718 |
using LIMSEQ_D[OF \<open>?a 1 \<longlonglongrightarrow> 0\<close> \<open>0 < r\<close>] by auto |
63558 | 5719 |
have "norm (?diff 1 n - 0) < r" if "N \<le> n" for n |
5720 |
using \<open>?diff 1 n \<le> ?a 1 n\<close> N_I[OF that] by auto |
|
5721 |
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
|
5722 |
qed |
44710 | 5723 |
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
|
5724 |
have "(?c 1) sums (arctan 1)" unfolding sums_def by auto |
63558 | 5725 |
then have "arctan 1 = (\<Sum>i. ?c 1 i)" by (rule sums_unique) |
41970 | 5726 |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5727 |
show ?thesis |
53079 | 5728 |
proof (cases "x = 1") |
5729 |
case True |
|
60758 | 5730 |
then show ?thesis by (simp add: \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close>) |
53079 | 5731 |
next |
5732 |
case False |
|
63558 | 5733 |
then have "x = -1" using \<open>\<bar>x\<bar> = 1\<close> by auto |
41970 | 5734 |
|
29803
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5735 |
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
|
5736 |
have "- (2 * pi) < 0" using pi_gt_zero by auto |
41970 | 5737 |
|
63558 | 5738 |
have c_minus_minus: "?c (- 1) i = - ?c 1 i" for i by auto |
53079 | 5739 |
|
5740 |
have "arctan (- 1) = arctan (tan (-(pi / 4)))" |
|
5741 |
unfolding tan_45 tan_minus .. |
|
5742 |
also have "\<dots> = - (pi / 4)" |
|
63558 | 5743 |
by (rule arctan_tan) (auto simp: order_less_trans[OF \<open>- (pi / 2) < 0\<close> pi_gt_zero]) |
53079 | 5744 |
also have "\<dots> = - (arctan (tan (pi / 4)))" |
63558 | 5745 |
unfolding neg_equal_iff_equal |
5746 |
by (rule arctan_tan[symmetric]) (auto simp: order_less_trans[OF \<open>- (2 * pi) < 0\<close> pi_gt_zero]) |
|
53079 | 5747 |
also have "\<dots> = - (arctan 1)" |
5748 |
unfolding tan_45 .. |
|
5749 |
also have "\<dots> = - (\<Sum> i. ?c 1 i)" |
|
60758 | 5750 |
using \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close> by auto |
53079 | 5751 |
also have "\<dots> = (\<Sum> i. ?c (- 1) i)" |
60758 | 5752 |
using suminf_minus[OF sums_summable[OF \<open>(?c 1) sums (arctan 1)\<close>]] |
53079 | 5753 |
unfolding c_minus_minus by auto |
60758 | 5754 |
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
|
5755 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5756 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5757 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5758 |
|
63558 | 5759 |
lemma arctan_half: "arctan x = 2 * arctan (x / (1 + sqrt(1 + x\<^sup>2)))" |
5760 |
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
|
5761 |
proof - |
53079 | 5762 |
obtain y where low: "- (pi / 2) < y" and high: "y < pi / 2" and y_eq: "tan y = x" |
5763 |
using tan_total by blast |
|
63558 | 5764 |
then have low2: "- (pi / 2) < y / 2" and high2: "y / 2 < pi / 2" |
53079 | 5765 |
by auto |
5766 |
||
63558 | 5767 |
have "0 < cos y" by (rule cos_gt_zero_pi[OF low high]) |
5768 |
then have "cos y \<noteq> 0" and cos_sqrt: "sqrt ((cos y)\<^sup>2) = cos y" |
|
53079 | 5769 |
by auto |
5770 |
||
5771 |
have "1 + (tan y)\<^sup>2 = 1 + (sin y)\<^sup>2 / (cos y)\<^sup>2" |
|
5772 |
unfolding tan_def power_divide .. |
|
5773 |
also have "\<dots> = (cos y)\<^sup>2 / (cos y)\<^sup>2 + (sin y)\<^sup>2 / (cos y)\<^sup>2" |
|
60758 | 5774 |
using \<open>cos y \<noteq> 0\<close> by auto |
53079 | 5775 |
also have "\<dots> = 1 / (cos y)\<^sup>2" |
5776 |
unfolding add_divide_distrib[symmetric] sin_cos_squared_add2 .. |
|
53076 | 5777 |
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
|
5778 |
|
53079 | 5779 |
have "sin y / (cos y + 1) = tan y / ((cos y + 1) / cos y)" |
60758 | 5780 |
unfolding tan_def using \<open>cos y \<noteq> 0\<close> by (simp add: field_simps) |
53079 | 5781 |
also have "\<dots> = tan y / (1 + 1 / cos y)" |
60758 | 5782 |
using \<open>cos y \<noteq> 0\<close> unfolding add_divide_distrib by auto |
53079 | 5783 |
also have "\<dots> = tan y / (1 + 1 / sqrt ((cos y)\<^sup>2))" |
5784 |
unfolding cos_sqrt .. |
|
5785 |
also have "\<dots> = tan y / (1 + sqrt (1 / (cos y)\<^sup>2))" |
|
5786 |
unfolding real_sqrt_divide by auto |
|
5787 |
finally have eq: "sin y / (cos y + 1) = tan y / (1 + sqrt(1 + (tan y)\<^sup>2))" |
|
60758 | 5788 |
unfolding \<open>1 + (tan y)\<^sup>2 = 1 / (cos y)\<^sup>2\<close> . |
53079 | 5789 |
|
5790 |
have "arctan x = y" |
|
5791 |
using arctan_tan low high y_eq by auto |
|
5792 |
also have "\<dots> = 2 * (arctan (tan (y/2)))" |
|
5793 |
using arctan_tan[OF low2 high2] by auto |
|
5794 |
also have "\<dots> = 2 * (arctan (sin y / (cos y + 1)))" |
|
5795 |
unfolding tan_half by auto |
|
5796 |
finally show ?thesis |
|
60758 | 5797 |
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
|
5798 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5799 |
|
53079 | 5800 |
lemma arctan_monotone: "x < y \<Longrightarrow> arctan x < arctan y" |
5801 |
by (simp only: arctan_less_iff) |
|
5802 |
||
5803 |
lemma arctan_monotone': "x \<le> y \<Longrightarrow> arctan x \<le> arctan y" |
|
5804 |
by (simp only: arctan_le_iff) |
|
44746 | 5805 |
|
5806 |
lemma arctan_inverse: |
|
53079 | 5807 |
assumes "x \<noteq> 0" |
5808 |
shows "arctan (1 / x) = sgn x * pi / 2 - arctan x" |
|
44746 | 5809 |
proof (rule arctan_unique) |
5810 |
show "- (pi / 2) < sgn x * pi / 2 - arctan x" |
|
5811 |
using arctan_bounded [of x] assms |
|
5812 |
unfolding sgn_real_def |
|
59869 | 5813 |
apply (auto simp add: arctan algebra_simps) |
44746 | 5814 |
apply (drule zero_less_arctan_iff [THEN iffD2]) |
5815 |
apply arith |
|
5816 |
done |
|
5817 |
show "sgn x * pi / 2 - arctan x < pi / 2" |
|
5818 |
using arctan_bounded [of "- x"] assms |
|
5819 |
unfolding sgn_real_def arctan_minus |
|
54489
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
haftmann
parents:
54230
diff
changeset
|
5820 |
by (auto simp add: algebra_simps) |
44746 | 5821 |
show "tan (sgn x * pi / 2 - arctan x) = 1 / x" |
5822 |
unfolding tan_inverse [of "arctan x", unfolded tan_arctan] |
|
5823 |
unfolding sgn_real_def |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56409
diff
changeset
|
5824 |
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
|
5825 |
qed |
c56a5571f60a
Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents:
29695
diff
changeset
|
5826 |
|
63558 | 5827 |
theorem pi_series: "pi / 4 = (\<Sum>k. (-1)^k * 1 / real (k * 2 + 1))" |
5828 |
(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
|
5829 |
proof - |
63558 | 5830 |
have "pi / 4 = arctan 1" |
5831 |
using arctan_one by auto |
|
5832 |
also have "\<dots> = ?SUM" |
|
5833 |
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
|
5834 |
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
|
5835 |
qed |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5836 |
|
53079 | 5837 |
|
60758 | 5838 |
subsection \<open>Existence of Polar Coordinates\<close> |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5839 |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
52139
diff
changeset
|
5840 |
lemma cos_x_y_le_one: "\<bar>x / sqrt (x\<^sup>2 + y\<^sup>2)\<bar> \<le> 1" |
63558 | 5841 |
by (rule power2_le_imp_le [OF _ zero_le_one]) |
5842 |
(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
|
5843 |
|
22978
1cd8cc21a7c3
clean up polar_Ex proofs; remove unnecessary lemmas
huffman
parents:
22977
diff
changeset
|
5844 |
lemmas cos_arccos_lemma1 = cos_arccos_abs [OF cos_x_y_le_one] |
15228 | 5845 |
|
23045
95e04f335940
add lemmas about inverse functions; cleaned up proof of polar_ex
huffman
parents:
23043
diff
changeset
|
5846 |
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
|
5847 |
|
63558 | 5848 |
lemma polar_Ex: "\<exists>r::real. \<exists>a. x = r * cos a \<and> y = r * sin a" |
54573 | 5849 |
proof - |
63558 | 5850 |
have polar_ex1: "0 < y \<Longrightarrow> \<exists>r a. x = r * cos a \<and> y = r * sin a" for y |
5851 |
apply (rule exI [where x = "sqrt (x\<^sup>2 + y\<^sup>2)"]) |
|
5852 |
apply (rule exI [where x = "arccos (x / sqrt (x\<^sup>2 + y\<^sup>2))"]) |
|
54573 | 5853 |
apply (simp add: cos_arccos_lemma1 sin_arccos_lemma1 power_divide |
63558 | 5854 |
real_sqrt_mult [symmetric] right_diff_distrib) |
54573 | 5855 |
done |
5856 |
show ?thesis |
|
5857 |
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
|
5858 |
case less |
63558 | 5859 |
then show ?thesis |
5860 |
by (rule polar_ex1) |
|
54573 | 5861 |
next |
5862 |
case equal |
|
63558 | 5863 |
then show ?thesis |
5864 |
by (force simp add: intro!: cos_zero sin_zero) |
|
54573 | 5865 |
next |
5866 |
case greater |
|
63558 | 5867 |
with polar_ex1 [where y="-y"] show ?thesis |
5868 |
by auto (metis cos_minus minus_minus minus_mult_right sin_minus) |
|
54573 | 5869 |
qed |
5870 |
qed |
|
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15013
diff
changeset
|
5871 |
|
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 |
|
63558 | 5873 |
subsection \<open>Basics about polynomial functions: products, extremal behaviour and root counts\<close> |
5874 |
||
5875 |
lemma pairs_le_eq_Sigma: "{(i, j). i + j \<le> m} = Sigma (atMost m) (\<lambda>r. atMost (m - r))" |
|
5876 |
for m :: nat |
|
5877 |
by auto |
|
5878 |
||
64267 | 5879 |
lemma sum_up_index_split: "(\<Sum>k\<le>m + n. f k) = (\<Sum>k\<le>m. f k) + (\<Sum>k = Suc m..m + n. f k)" |
5880 |
by (metis atLeast0AtMost Suc_eq_plus1 le0 sum_ub_add_nat) |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5881 |
|
63558 | 5882 |
lemma Sigma_interval_disjoint: "(SIGMA i:A. {..v i}) \<inter> (SIGMA i:A.{v i<..w}) = {}" |
5883 |
for w :: "'a::order" |
|
5884 |
by auto |
|
5885 |
||
5886 |
lemma product_atMost_eq_Un: "A \<times> {..m} = (SIGMA i:A.{..m - i}) \<union> (SIGMA i:A.{m - i<..m})" |
|
5887 |
for m :: nat |
|
5888 |
by auto |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5889 |
|
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5890 |
lemma polynomial_product: (*with thanks to Chaitanya Mangla*) |
63558 | 5891 |
fixes x :: "'a::idom" |
5892 |
assumes m: "\<And>i. i > m \<Longrightarrow> a i = 0" |
|
5893 |
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
|
5894 |
shows "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) = |
63558 | 5895 |
(\<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
|
5896 |
proof - |
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5897 |
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))" |
64267 | 5898 |
by (rule sum_product) |
63558 | 5899 |
also have "\<dots> = (\<Sum>i\<le>m + n. \<Sum>j\<le>n + m. a i * x ^ i * (b j * x ^ j))" |
64267 | 5900 |
using assms by (auto simp: sum_up_index_split) |
63558 | 5901 |
also have "\<dots> = (\<Sum>r\<le>m + n. \<Sum>j\<le>m + n - r. a r * x ^ r * (b j * x ^ j))" |
64267 | 5902 |
apply (simp add: add_ac sum.Sigma product_atMost_eq_Un) |
5903 |
apply (clarsimp simp add: sum_Un Sigma_interval_disjoint intro!: sum.neutral) |
|
63558 | 5904 |
apply (metis add_diff_assoc2 add.commute add_lessD1 leD m n nat_le_linear neqE) |
5905 |
done |
|
5906 |
also have "\<dots> = (\<Sum>(i,j)\<in>{(i,j). i+j \<le> m+n}. (a i * x ^ i) * (b j * x ^ j))" |
|
64267 | 5907 |
by (auto simp: pairs_le_eq_Sigma sum.Sigma) |
63558 | 5908 |
also have "\<dots> = (\<Sum>r\<le>m + n. (\<Sum>k\<le>r. (a k) * (b (r - k))) * x ^ r)" |
64267 | 5909 |
apply (subst sum_triangle_reindex_eq) |
5910 |
apply (auto simp: algebra_simps sum_distrib_left intro!: sum.cong) |
|
63558 | 5911 |
apply (metis le_add_diff_inverse power_add) |
5912 |
done |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5913 |
finally show ?thesis . |
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5914 |
qed |
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5915 |
|
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
|
5916 |
lemma polynomial_product_nat: |
63558 | 5917 |
fixes x :: nat |
5918 |
assumes m: "\<And>i. i > m \<Longrightarrow> a i = 0" |
|
5919 |
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
|
5920 |
shows "(\<Sum>i\<le>m. (a i) * x ^ i) * (\<Sum>j\<le>n. (b j) * x ^ j) = |
63558 | 5921 |
(\<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
|
5922 |
using polynomial_product [of m a n b x] assms |
63558 | 5923 |
by (simp only: of_nat_mult [symmetric] of_nat_power [symmetric] |
64267 | 5924 |
of_nat_eq_iff Int.int_sum [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
|
5925 |
|
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
|
5926 |
lemma polyfun_diff: (*COMPLEX_SUB_POLYFUN in HOL Light*) |
63558 | 5927 |
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
|
5928 |
assumes "1 \<le> n" |
63558 | 5929 |
shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
5930 |
(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
|
5931 |
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
|
5932 |
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
|
5933 |
by (auto simp: bij_betw_def inj_on_def) |
63558 | 5934 |
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))" |
64267 | 5935 |
by (simp add: right_diff_distrib sum_subtractf) |
63558 | 5936 |
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
|
5937 |
by (simp add: power_diff_sumr2 mult.assoc) |
63558 | 5938 |
also have "\<dots> = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y^(i - Suc j) * x^j))" |
64267 | 5939 |
by (simp add: sum_distrib_left) |
63558 | 5940 |
also have "\<dots> = (\<Sum>(i,j) \<in> (SIGMA i : atMost n. lessThan i). a i * (x - y) * (y^(i - Suc j) * x^j))" |
64267 | 5941 |
by (simp add: sum.Sigma) |
63558 | 5942 |
also have "\<dots> = (\<Sum>(j,i) \<in> (SIGMA j : lessThan n. {Suc j..n}). a i * (x - y) * (y^(i - Suc j) * x^j))" |
64267 | 5943 |
by (auto simp add: sum.reindex_bij_betw [OF h, symmetric] intro: sum.strong_cong) |
63558 | 5944 |
also have "\<dots> = (\<Sum>j<n. \<Sum>i=Suc j..n. a i * (x - y) * (y^(i - Suc j) * x^j))" |
64267 | 5945 |
by (simp add: sum.Sigma) |
63558 | 5946 |
also have "\<dots> = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)" |
64267 | 5947 |
by (simp add: sum_distrib_left mult_ac) |
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
|
5948 |
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
|
5949 |
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
|
5950 |
|
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
|
5951 |
lemma polyfun_diff_alt: (*COMPLEX_SUB_POLYFUN_ALT in HOL Light*) |
63558 | 5952 |
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
|
5953 |
assumes "1 \<le> n" |
63558 | 5954 |
shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
5955 |
(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
|
5956 |
proof - |
63558 | 5957 |
have "(\<Sum>i=Suc j..n. a i * y^(i - j - 1)) = (\<Sum>k<n-j. a(j+k+1) * y^k)" |
5958 |
if "j < n" for j :: nat |
|
5959 |
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
|
5960 |
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
|
5961 |
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
|
5962 |
apply (rule_tac x="x + Suc j" in image_eqI) |
63558 | 5963 |
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
|
5964 |
done |
63558 | 5965 |
then show ?thesis |
64267 | 5966 |
by (auto simp add: sum.reindex_bij_betw [OF h, symmetric] intro: sum.strong_cong) |
63558 | 5967 |
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
|
5968 |
then show ?thesis |
64267 | 5969 |
by (simp add: polyfun_diff [OF assms] sum_distrib_right) |
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
|
5970 |
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
|
5971 |
|
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
|
5972 |
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
|
5973 |
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
|
5974 |
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 | 5975 |
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
|
5976 |
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
|
5977 |
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
|
5978 |
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
|
5979 |
case False |
63558 | 5980 |
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> |
5981 |
(\<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
|
5982 |
by (simp add: algebra_simps) |
63558 | 5983 |
also have "\<dots> \<longleftrightarrow> |
5984 |
(\<exists>b. \<forall>z. (z - a) * (\<Sum>j<n. (\<Sum>i = Suc j..n. c i * a^(i - Suc j)) * z^j) = |
|
5985 |
(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
|
5986 |
using False by (simp add: polyfun_diff) |
63558 | 5987 |
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
|
5988 |
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
|
5989 |
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
|
5990 |
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
|
5991 |
|
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
|
5992 |
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
|
5993 |
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
|
5994 |
assumes "(\<Sum>i\<le>n. c(i) * a^i) = 0" |
63558 | 5995 |
obtains b where "\<And>z. (\<Sum>i\<le>n. c i * z^i) = (z - a) * (\<Sum>i<n. b i * z^i)" |
5996 |
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
|
5997 |
|
60150
bd773c47ad0b
New material about complex transcendental functions (especially Ln, Arg) and polynomials
paulson <lp15@cam.ac.uk>
parents:
60141
diff
changeset
|
5998 |
(*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
|
5999 |
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
|
6000 |
|
63558 | 6001 |
lemma isCont_polynom: "isCont (\<lambda>w. \<Sum>i\<le>n. c i * w^i) a" |
6002 |
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
|
6003 |
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
|
6004 |
|
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
|
6005 |
lemma zero_polynom_imp_zero_coeffs: |
63558 | 6006 |
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
|
6007 |
assumes "\<And>w. (\<Sum>i\<le>n. c i * w^i) = 0" "k \<le> n" |
63558 | 6008 |
shows "c k = 0" |
6009 |
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
|
6010 |
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
|
6011 |
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
|
6012 |
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
|
6013 |
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
|
6014 |
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
|
6015 |
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
|
6016 |
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
|
6017 |
by simp |
63558 | 6018 |
have "(\<Sum>i\<le>Suc n. c i * w^i) = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" for w |
6019 |
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
|
6020 |
have "(\<Sum>i\<le>Suc n. c i * w^i) = (\<Sum>i\<le>n. c (Suc i) * w ^ Suc i)" |
64267 | 6021 |
unfolding Set_Interval.sum_atMost_Suc_shift |
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
|
6022 |
by simp |
63558 | 6023 |
also have "\<dots> = w * (\<Sum>i\<le>n. c (Suc i) * w^i)" |
64267 | 6024 |
by (simp add: sum_distrib_left ac_simps) |
63558 | 6025 |
finally show ?thesis . |
6026 |
qed |
|
6027 |
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
|
6028 |
using Suc by auto |
61976 | 6029 |
then have "(\<lambda>h. \<Sum>i\<le>n. c (Suc i) * h^i) \<midarrow>0\<rightarrow> 0" |
63558 | 6030 |
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
|
6031 |
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
|
6032 |
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
|
6033 |
by (force simp add: Limits.isCont_iff) |
63558 | 6034 |
then have "\<And>w. (\<Sum>i\<le>n. c (Suc i) * w^i) = 0" |
6035 |
using w by metis |
|
6036 |
then have "\<And>i. i \<le> n \<Longrightarrow> c (Suc i) = 0" |
|
6037 |
using Suc.IH [of "\<lambda>i. c (Suc i)"] by blast |
|
60758 | 6038 |
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
|
6039 |
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
|
6040 |
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
|
6041 |
|
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
|
6042 |
lemma polyfun_rootbound: (*COMPLEX_POLYFUN_ROOTBOUND in HOL Light*) |
63558 | 6043 |
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
|
6044 |
assumes "c k \<noteq> 0" "k\<le>n" |
63558 | 6045 |
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" |
6046 |
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
|
6047 |
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
|
6048 |
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
|
6049 |
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
|
6050 |
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
|
6051 |
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
|
6052 |
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
|
6053 |
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
|
6054 |
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
|
6055 |
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
|
6056 |
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
|
6057 |
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
|
6058 |
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
|
6059 |
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
|
6060 |
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
|
6061 |
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
|
6062 |
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
|
6063 |
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
|
6064 |
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
|
6065 |
by blast |
63558 | 6066 |
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
|
6067 |
by auto |
63558 | 6068 |
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
|
6069 |
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
|
6070 |
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
|
6071 |
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
|
6072 |
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
|
6073 |
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
|
6074 |
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
|
6075 |
then have "\<And>k. k \<le> Suc m \<Longrightarrow> c k = 0" |
63558 | 6076 |
using zero_polynom_imp_zero_coeffs by blast |
6077 |
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
|
6078 |
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
|
6079 |
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
|
6080 |
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
|
6081 |
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
|
6082 |
using Suc.IH [of b k'] bk' |
64267 | 6083 |
by (simp add: eq card_insert_if del: sum_atMost_Suc) |
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
|
6084 |
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
|
6085 |
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
|
6086 |
|
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
|
6087 |
lemma |
63558 | 6088 |
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
|
6089 |
assumes "c k \<noteq> 0" "k\<le>n" |
63558 | 6090 |
shows polyfun_roots_finite: "finite {z. (\<Sum>i\<le>n. c(i) * z^i) = 0}" |
6091 |
and polyfun_roots_card: "card {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<le> n" |
|
6092 |
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
|
6093 |
|
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
|
6094 |
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
|
6095 |
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
|
6096 |
shows "finite {x. (\<Sum>i\<le>n. c i * x^i) = 0} \<longleftrightarrow> (\<exists>i\<le>n. c i \<noteq> 0)" |
63558 | 6097 |
(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
|
6098 |
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
|
6099 |
assume ?lhs |
63558 | 6100 |
moreover have "\<not> finite {x. (\<Sum>i\<le>n. c i * x^i) = 0}" if "\<forall>i\<le>n. c i = 0" |
6101 |
proof - |
|
6102 |
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
|
6103 |
by simp |
63558 | 6104 |
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
|
6105 |
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
|
6106 |
by auto |
63558 | 6107 |
qed |
6108 |
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
|
6109 |
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
|
6110 |
assume ?rhs |
63558 | 6111 |
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
|
6112 |
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
|
6113 |
|
63558 | 6114 |
lemma polyfun_eq_0: "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = 0) \<longleftrightarrow> (\<forall>i\<le>n. c i = 0)" |
6115 |
for c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}" |
|
6116 |
(*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
|
6117 |
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
|
6118 |
|
63558 | 6119 |
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)" |
6120 |
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
|
6121 |
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
|
6122 |
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)" |
64267 | 6123 |
by (simp add: left_diff_distrib Groups_Big.sum_subtractf) |
63558 | 6124 |
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
|
6125 |
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
|
6126 |
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
|
6127 |
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
|
6128 |
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
|
6129 |
|
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
|
6130 |
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
|
6131 |
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
|
6132 |
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 | 6133 |
(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
|
6134 |
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
|
6135 |
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
|
6136 |
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
|
6137 |
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
|
6138 |
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
|
6139 |
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
|
6140 |
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
|
6141 |
by (simp add: polyfun_eq_coeffs [symmetric]) |
63540 | 6142 |
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
|
6143 |
next |
63540 | 6144 |
assume ?rhs |
6145 |
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
|
6146 |
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
|
6147 |
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
|
6148 |
|
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
|
6149 |
lemma root_polyfun: |
63540 | 6150 |
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
|
6151 |
assumes "1 \<le> n" |
63540 | 6152 |
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" |
64267 | 6153 |
using assms by (cases n) (simp_all add: sum_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
|
6154 |
|
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
|
6155 |
lemma |
63558 | 6156 |
assumes "SORT_CONSTRAINT('a::{idom,real_normed_div_algebra})" |
6157 |
and "1 \<le> n" |
|
63540 | 6158 |
shows finite_roots_unity: "finite {z::'a. z^n = 1}" |
6159 |
and card_roots_unity: "card {z::'a. z^n = 1} \<le> n" |
|
63558 | 6160 |
using polyfun_rootbound [of "\<lambda>i. if i = 0 then -1 else if i=n then 1 else 0" n n] assms(2) |
6161 |
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
|
6162 |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29803
diff
changeset
|
6163 |
end |