author | hoelzl |
Tue, 30 Jun 2009 18:24:00 +0200 | |
changeset 31882 | 3578434d645d |
parent 31881 | eba74a5790d2 |
child 32038 | 4127b89f48ab |
permissions | -rw-r--r-- |
28952
15a4b2cf8c34
made repository layout more coherent with logical distribution structure; stripped some $Id$s
haftmann
parents:
27239
diff
changeset
|
1 |
(* Author : Jacques D. Fleuriot |
12224 | 2 |
Copyright : 2001 University of Edinburgh |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
3 |
Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
12224 | 4 |
*) |
5 |
||
15944 | 6 |
header{*MacLaurin Series*} |
7 |
||
15131 | 8 |
theory MacLaurin |
29811
026b0f9f579f
fixed Proofs and dependencies ; Theory Dense_Linear_Order moved to Library
chaieb@chaieb-laptop
parents:
29803
diff
changeset
|
9 |
imports Transcendental |
15131 | 10 |
begin |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
11 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
12 |
subsection{*Maclaurin's Theorem with Lagrange Form of Remainder*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
13 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
14 |
text{*This is a very long, messy proof even now that it's been broken down |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
15 |
into lemmas.*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
16 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
17 |
lemma Maclaurin_lemma: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
18 |
"0 < h ==> |
15539 | 19 |
\<exists>B. f h = (\<Sum>m=0..<n. (j m / real (fact m)) * (h^m)) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
20 |
(B * ((h^n) / real(fact n)))" |
15539 | 21 |
apply (rule_tac x = "(f h - (\<Sum>m=0..<n. (j m / real (fact m)) * h^m)) * |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
22 |
real(fact n) / (h^n)" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
23 |
in exI) |
15539 | 24 |
apply (simp) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
25 |
done |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
26 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
27 |
lemma eq_diff_eq': "(x = y - z) = (y = x + (z::real))" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
28 |
by arith |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
29 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
30 |
lemma Maclaurin_lemma2: |
29187 | 31 |
assumes diff: "\<forall>m t. m < n \<and> 0\<le>t \<and> t\<le>h \<longrightarrow> DERIV (diff m) t :> diff (Suc m) t" |
32 |
assumes n: "n = Suc k" |
|
33 |
assumes difg: "difg = |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
34 |
(\<lambda>m t. diff m t - |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
35 |
((\<Sum>p = 0..<n - m. diff (m + p) 0 / real (fact p) * t ^ p) + |
29187 | 36 |
B * (t ^ (n - m) / real (fact (n - m)))))" |
37 |
shows |
|
38 |
"\<forall>m t. m < n & 0 \<le> t & t \<le> h --> DERIV (difg m) t :> difg (Suc m) t" |
|
39 |
unfolding difg |
|
40 |
apply clarify |
|
41 |
apply (rule DERIV_diff) |
|
42 |
apply (simp add: diff) |
|
43 |
apply (simp only: n) |
|
44 |
apply (rule DERIV_add) |
|
45 |
apply (rule_tac [2] DERIV_cmult) |
|
46 |
apply (rule_tac [2] lemma_DERIV_subst) |
|
47 |
apply (rule_tac [2] DERIV_quotient) |
|
48 |
apply (rule_tac [3] DERIV_const) |
|
49 |
apply (rule_tac [2] DERIV_pow) |
|
50 |
prefer 3 apply (simp add: fact_diff_Suc) |
|
51 |
prefer 2 apply simp |
|
52 |
apply (frule less_iff_Suc_add [THEN iffD1], clarify) |
|
53 |
apply (simp del: setsum_op_ivl_Suc) |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29811
diff
changeset
|
54 |
apply (insert sumr_offset4 [of "Suc 0"]) |
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
55 |
apply (simp del: setsum_op_ivl_Suc fact_Suc power_Suc) |
29187 | 56 |
apply (rule lemma_DERIV_subst) |
57 |
apply (rule DERIV_add) |
|
58 |
apply (rule_tac [2] DERIV_const) |
|
59 |
apply (rule DERIV_sumr, clarify) |
|
60 |
prefer 2 apply simp |
|
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
61 |
apply (simp (no_asm) add: divide_inverse mult_assoc del: fact_Suc power_Suc) |
29187 | 62 |
apply (rule DERIV_cmult) |
63 |
apply (rule lemma_DERIV_subst) |
|
31881 | 64 |
apply (best intro!: DERIV_intros) |
29187 | 65 |
apply (subst fact_Suc) |
66 |
apply (subst real_of_nat_mult) |
|
67 |
apply (simp add: mult_ac) |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
68 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
69 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
70 |
lemma Maclaurin: |
29187 | 71 |
assumes h: "0 < h" |
72 |
assumes n: "0 < n" |
|
73 |
assumes diff_0: "diff 0 = f" |
|
74 |
assumes diff_Suc: |
|
75 |
"\<forall>m t. m < n & 0 \<le> t & t \<le> h --> DERIV (diff m) t :> diff (Suc m) t" |
|
76 |
shows |
|
77 |
"\<exists>t. 0 < t & t < h & |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
78 |
f h = |
15539 | 79 |
setsum (%m. (diff m 0 / real (fact m)) * h ^ m) {0..<n} + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
80 |
(diff n t / real (fact n)) * h ^ n" |
29187 | 81 |
proof - |
82 |
from n obtain m where m: "n = Suc m" |
|
83 |
by (cases n, simp add: n) |
|
84 |
||
85 |
obtain B where f_h: "f h = |
|
86 |
(\<Sum>m = 0..<n. diff m (0\<Colon>real) / real (fact m) * h ^ m) + |
|
87 |
B * (h ^ n / real (fact n))" |
|
88 |
using Maclaurin_lemma [OF h] .. |
|
89 |
||
90 |
obtain g where g_def: "g = (%t. f t - |
|
91 |
(setsum (%m. (diff m 0 / real(fact m)) * t^m) {0..<n} |
|
92 |
+ (B * (t^n / real(fact n)))))" by blast |
|
93 |
||
94 |
have g2: "g 0 = 0 & g h = 0" |
|
95 |
apply (simp add: m f_h g_def del: setsum_op_ivl_Suc) |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29811
diff
changeset
|
96 |
apply (cut_tac n = m and k = "Suc 0" in sumr_offset2) |
29187 | 97 |
apply (simp add: eq_diff_eq' diff_0 del: setsum_op_ivl_Suc) |
98 |
done |
|
99 |
||
100 |
obtain difg where difg_def: "difg = (%m t. diff m t - |
|
101 |
(setsum (%p. (diff (m + p) 0 / real (fact p)) * (t ^ p)) {0..<n-m} |
|
102 |
+ (B * ((t ^ (n - m)) / real (fact (n - m))))))" by blast |
|
103 |
||
104 |
have difg_0: "difg 0 = g" |
|
105 |
unfolding difg_def g_def by (simp add: diff_0) |
|
106 |
||
107 |
have difg_Suc: "\<forall>(m\<Colon>nat) t\<Colon>real. |
|
108 |
m < n \<and> (0\<Colon>real) \<le> t \<and> t \<le> h \<longrightarrow> DERIV (difg m) t :> difg (Suc m) t" |
|
109 |
using diff_Suc m difg_def by (rule Maclaurin_lemma2) |
|
110 |
||
111 |
have difg_eq_0: "\<forall>m. m < n --> difg m 0 = 0" |
|
112 |
apply clarify |
|
113 |
apply (simp add: m difg_def) |
|
114 |
apply (frule less_iff_Suc_add [THEN iffD1], clarify) |
|
115 |
apply (simp del: setsum_op_ivl_Suc) |
|
30082
43c5b7bfc791
make more proofs work whether or not One_nat_def is a simp rule
huffman
parents:
29811
diff
changeset
|
116 |
apply (insert sumr_offset4 [of "Suc 0"]) |
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
117 |
apply (simp del: setsum_op_ivl_Suc fact_Suc) |
29187 | 118 |
done |
119 |
||
120 |
have isCont_difg: "\<And>m x. \<lbrakk>m < n; 0 \<le> x; x \<le> h\<rbrakk> \<Longrightarrow> isCont (difg m) x" |
|
121 |
by (rule DERIV_isCont [OF difg_Suc [rule_format]]) simp |
|
122 |
||
123 |
have differentiable_difg: |
|
124 |
"\<And>m x. \<lbrakk>m < n; 0 \<le> x; x \<le> h\<rbrakk> \<Longrightarrow> difg m differentiable x" |
|
125 |
by (rule differentiableI [OF difg_Suc [rule_format]]) simp |
|
126 |
||
127 |
have difg_Suc_eq_0: "\<And>m t. \<lbrakk>m < n; 0 \<le> t; t \<le> h; DERIV (difg m) t :> 0\<rbrakk> |
|
128 |
\<Longrightarrow> difg (Suc m) t = 0" |
|
129 |
by (rule DERIV_unique [OF difg_Suc [rule_format]]) simp |
|
130 |
||
131 |
have "m < n" using m by simp |
|
132 |
||
133 |
have "\<exists>t. 0 < t \<and> t < h \<and> DERIV (difg m) t :> 0" |
|
134 |
using `m < n` |
|
135 |
proof (induct m) |
|
136 |
case 0 |
|
137 |
show ?case |
|
138 |
proof (rule Rolle) |
|
139 |
show "0 < h" by fact |
|
140 |
show "difg 0 0 = difg 0 h" by (simp add: difg_0 g2) |
|
141 |
show "\<forall>x. 0 \<le> x \<and> x \<le> h \<longrightarrow> isCont (difg (0\<Colon>nat)) x" |
|
142 |
by (simp add: isCont_difg n) |
|
143 |
show "\<forall>x. 0 < x \<and> x < h \<longrightarrow> difg (0\<Colon>nat) differentiable x" |
|
144 |
by (simp add: differentiable_difg n) |
|
145 |
qed |
|
146 |
next |
|
147 |
case (Suc m') |
|
148 |
hence "\<exists>t. 0 < t \<and> t < h \<and> DERIV (difg m') t :> 0" by simp |
|
149 |
then obtain t where t: "0 < t" "t < h" "DERIV (difg m') t :> 0" by fast |
|
150 |
have "\<exists>t'. 0 < t' \<and> t' < t \<and> DERIV (difg (Suc m')) t' :> 0" |
|
151 |
proof (rule Rolle) |
|
152 |
show "0 < t" by fact |
|
153 |
show "difg (Suc m') 0 = difg (Suc m') t" |
|
154 |
using t `Suc m' < n` by (simp add: difg_Suc_eq_0 difg_eq_0) |
|
155 |
show "\<forall>x. 0 \<le> x \<and> x \<le> t \<longrightarrow> isCont (difg (Suc m')) x" |
|
156 |
using `t < h` `Suc m' < n` by (simp add: isCont_difg) |
|
157 |
show "\<forall>x. 0 < x \<and> x < t \<longrightarrow> difg (Suc m') differentiable x" |
|
158 |
using `t < h` `Suc m' < n` by (simp add: differentiable_difg) |
|
159 |
qed |
|
160 |
thus ?case |
|
161 |
using `t < h` by auto |
|
162 |
qed |
|
163 |
||
164 |
then obtain t where "0 < t" "t < h" "DERIV (difg m) t :> 0" by fast |
|
165 |
||
166 |
hence "difg (Suc m) t = 0" |
|
167 |
using `m < n` by (simp add: difg_Suc_eq_0) |
|
168 |
||
169 |
show ?thesis |
|
170 |
proof (intro exI conjI) |
|
171 |
show "0 < t" by fact |
|
172 |
show "t < h" by fact |
|
173 |
show "f h = |
|
174 |
(\<Sum>m = 0..<n. diff m 0 / real (fact m) * h ^ m) + |
|
175 |
diff n t / real (fact n) * h ^ n" |
|
176 |
using `difg (Suc m) t = 0` |
|
30273
ecd6f0ca62ea
declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents:
30082
diff
changeset
|
177 |
by (simp add: m f_h difg_def del: fact_Suc) |
29187 | 178 |
qed |
179 |
||
180 |
qed |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
181 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
182 |
lemma Maclaurin_objl: |
25162 | 183 |
"0 < h & n>0 & diff 0 = f & |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
184 |
(\<forall>m t. m < n & 0 \<le> t & t \<le> h --> DERIV (diff m) t :> diff (Suc m) t) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
185 |
--> (\<exists>t. 0 < t & t < h & |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
186 |
f h = (\<Sum>m=0..<n. diff m 0 / real (fact m) * h ^ m) + |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
187 |
diff n t / real (fact n) * h ^ n)" |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
188 |
by (blast intro: Maclaurin) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
189 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
190 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
191 |
lemma Maclaurin2: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
192 |
"[| 0 < h; diff 0 = f; |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
193 |
\<forall>m t. |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
194 |
m < n & 0 \<le> t & t \<le> h --> DERIV (diff m) t :> diff (Suc m) t |] |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
195 |
==> \<exists>t. 0 < t & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
196 |
t \<le> h & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
197 |
f h = |
15539 | 198 |
(\<Sum>m=0..<n. diff m 0 / real (fact m) * h ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
199 |
diff n t / real (fact n) * h ^ n" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
200 |
apply (case_tac "n", auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
201 |
apply (drule Maclaurin, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
202 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
203 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
204 |
lemma Maclaurin2_objl: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
205 |
"0 < h & diff 0 = f & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
206 |
(\<forall>m t. |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
207 |
m < n & 0 \<le> t & t \<le> h --> DERIV (diff m) t :> diff (Suc m) t) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
208 |
--> (\<exists>t. 0 < t & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
209 |
t \<le> h & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
210 |
f h = |
15539 | 211 |
(\<Sum>m=0..<n. diff m 0 / real (fact m) * h ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
212 |
diff n t / real (fact n) * h ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
213 |
by (blast intro: Maclaurin2) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
214 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
215 |
lemma Maclaurin_minus: |
25162 | 216 |
"[| h < 0; n > 0; diff 0 = f; |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
217 |
\<forall>m t. m < n & h \<le> t & t \<le> 0 --> DERIV (diff m) t :> diff (Suc m) t |] |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
218 |
==> \<exists>t. h < t & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
219 |
t < 0 & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
220 |
f h = |
15539 | 221 |
(\<Sum>m=0..<n. diff m 0 / real (fact m) * h ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
222 |
diff n t / real (fact n) * h ^ n" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
223 |
apply (cut_tac f = "%x. f (-x)" |
23177 | 224 |
and diff = "%n x. (-1 ^ n) * diff n (-x)" |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
225 |
and h = "-h" and n = n in Maclaurin_objl) |
15539 | 226 |
apply (simp) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
227 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
228 |
apply (subst minus_mult_right) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
229 |
apply (rule DERIV_cmult) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
230 |
apply (rule lemma_DERIV_subst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
231 |
apply (rule DERIV_chain2 [where g=uminus]) |
23069
cdfff0241c12
rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents:
22985
diff
changeset
|
232 |
apply (rule_tac [2] DERIV_minus, rule_tac [2] DERIV_ident) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
233 |
prefer 2 apply force |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
234 |
apply force |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
235 |
apply (rule_tac x = "-t" in exI, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
236 |
apply (subgoal_tac "(\<Sum>m = 0..<n. -1 ^ m * diff m 0 * (-h)^m / real(fact m)) = |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
237 |
(\<Sum>m = 0..<n. diff m 0 * h ^ m / real(fact m))") |
15536 | 238 |
apply (rule_tac [2] setsum_cong[OF refl]) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
239 |
apply (auto simp add: divide_inverse power_mult_distrib [symmetric]) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
240 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
241 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
242 |
lemma Maclaurin_minus_objl: |
25162 | 243 |
"(h < 0 & n > 0 & diff 0 = f & |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
244 |
(\<forall>m t. |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
245 |
m < n & h \<le> t & t \<le> 0 --> DERIV (diff m) t :> diff (Suc m) t)) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
246 |
--> (\<exists>t. h < t & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
247 |
t < 0 & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
248 |
f h = |
15539 | 249 |
(\<Sum>m=0..<n. diff m 0 / real (fact m) * h ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
250 |
diff n t / real (fact n) * h ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
251 |
by (blast intro: Maclaurin_minus) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
252 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
253 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
254 |
subsection{*More Convenient "Bidirectional" Version.*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
255 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
256 |
(* not good for PVS sin_approx, cos_approx *) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
257 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
258 |
lemma Maclaurin_bi_le_lemma [rule_format]: |
25162 | 259 |
"n>0 \<longrightarrow> |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
260 |
diff 0 0 = |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
261 |
(\<Sum>m = 0..<n. diff m 0 * 0 ^ m / real (fact m)) + |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
262 |
diff n 0 * 0 ^ n / real (fact n)" |
15251 | 263 |
by (induct "n", auto) |
14738 | 264 |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
265 |
lemma Maclaurin_bi_le: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
266 |
"[| diff 0 = f; |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
267 |
\<forall>m t. m < n & abs t \<le> abs x --> DERIV (diff m) t :> diff (Suc m) t |] |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
268 |
==> \<exists>t. abs t \<le> abs x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
269 |
f x = |
15539 | 270 |
(\<Sum>m=0..<n. diff m 0 / real (fact m) * x ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
271 |
diff n t / real (fact n) * x ^ n" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
272 |
apply (case_tac "n = 0", force) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
273 |
apply (case_tac "x = 0") |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
274 |
apply (rule_tac x = 0 in exI) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
275 |
apply (force simp add: Maclaurin_bi_le_lemma) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
276 |
apply (cut_tac x = x and y = 0 in linorder_less_linear, auto) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
277 |
txt{*Case 1, where @{term "x < 0"}*} |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
278 |
apply (cut_tac f = "diff 0" and diff = diff and h = x and n = n in Maclaurin_minus_objl, safe) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
279 |
apply (simp add: abs_if) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
280 |
apply (rule_tac x = t in exI) |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
281 |
apply (simp add: abs_if) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
282 |
txt{*Case 2, where @{term "0 < x"}*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
283 |
apply (cut_tac f = "diff 0" and diff = diff and h = x and n = n in Maclaurin_objl, safe) |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
284 |
apply (simp add: abs_if) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
285 |
apply (rule_tac x = t in exI) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
286 |
apply (simp add: abs_if) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
287 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
288 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
289 |
lemma Maclaurin_all_lt: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
290 |
"[| diff 0 = f; |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
291 |
\<forall>m x. DERIV (diff m) x :> diff(Suc m) x; |
25162 | 292 |
x ~= 0; n > 0 |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
293 |
|] ==> \<exists>t. 0 < abs t & abs t < abs x & |
15539 | 294 |
f x = (\<Sum>m=0..<n. (diff m 0 / real (fact m)) * x ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
295 |
(diff n t / real (fact n)) * x ^ n" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
296 |
apply (rule_tac x = x and y = 0 in linorder_cases) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
297 |
prefer 2 apply blast |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
298 |
apply (drule_tac [2] diff=diff in Maclaurin) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
299 |
apply (drule_tac diff=diff in Maclaurin_minus, simp_all, safe) |
15229 | 300 |
apply (rule_tac [!] x = t in exI, auto) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
301 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
302 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
303 |
lemma Maclaurin_all_lt_objl: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
304 |
"diff 0 = f & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
305 |
(\<forall>m x. DERIV (diff m) x :> diff(Suc m) x) & |
25162 | 306 |
x ~= 0 & n > 0 |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
307 |
--> (\<exists>t. 0 < abs t & abs t < abs x & |
15539 | 308 |
f x = (\<Sum>m=0..<n. (diff m 0 / real (fact m)) * x ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
309 |
(diff n t / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
310 |
by (blast intro: Maclaurin_all_lt) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
311 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
312 |
lemma Maclaurin_zero [rule_format]: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
313 |
"x = (0::real) |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
314 |
==> n \<noteq> 0 --> |
15539 | 315 |
(\<Sum>m=0..<n. (diff m (0::real) / real (fact m)) * x ^ m) = |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
316 |
diff 0 0" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
317 |
by (induct n, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
318 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
319 |
lemma Maclaurin_all_le: "[| diff 0 = f; |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
320 |
\<forall>m x. DERIV (diff m) x :> diff (Suc m) x |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
321 |
|] ==> \<exists>t. abs t \<le> abs x & |
15539 | 322 |
f x = (\<Sum>m=0..<n. (diff m 0 / real (fact m)) * x ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
323 |
(diff n t / real (fact n)) * x ^ n" |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
324 |
apply(cases "n=0") |
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
325 |
apply (force) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
326 |
apply (case_tac "x = 0") |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
327 |
apply (frule_tac diff = diff and n = n in Maclaurin_zero, assumption) |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
328 |
apply (drule not0_implies_Suc) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
329 |
apply (rule_tac x = 0 in exI, force) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
330 |
apply (frule_tac diff = diff and n = n in Maclaurin_all_lt, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
331 |
apply (rule_tac x = t in exI, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
332 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
333 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
334 |
lemma Maclaurin_all_le_objl: "diff 0 = f & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
335 |
(\<forall>m x. DERIV (diff m) x :> diff (Suc m) x) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
336 |
--> (\<exists>t. abs t \<le> abs x & |
15539 | 337 |
f x = (\<Sum>m=0..<n. (diff m 0 / real (fact m)) * x ^ m) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
338 |
(diff n t / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
339 |
by (blast intro: Maclaurin_all_le) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
340 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
341 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
342 |
subsection{*Version for Exponential Function*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
343 |
|
25162 | 344 |
lemma Maclaurin_exp_lt: "[| x ~= 0; n > 0 |] |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
345 |
==> (\<exists>t. 0 < abs t & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
346 |
abs t < abs x & |
15539 | 347 |
exp x = (\<Sum>m=0..<n. (x ^ m) / real (fact m)) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
348 |
(exp t / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
349 |
by (cut_tac diff = "%n. exp" and f = exp and x = x and n = n in Maclaurin_all_lt_objl, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
350 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
351 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
352 |
lemma Maclaurin_exp_le: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
353 |
"\<exists>t. abs t \<le> abs x & |
15539 | 354 |
exp x = (\<Sum>m=0..<n. (x ^ m) / real (fact m)) + |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
355 |
(exp t / real (fact n)) * x ^ n" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
356 |
by (cut_tac diff = "%n. exp" and f = exp and x = x and n = n in Maclaurin_all_le_objl, auto) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
357 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
358 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
359 |
subsection{*Version for Sine Function*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
360 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
361 |
lemma mod_exhaust_less_4: |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
362 |
"m mod 4 = 0 | m mod 4 = 1 | m mod 4 = 2 | m mod 4 = (3::nat)" |
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
363 |
by auto |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
364 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
365 |
lemma Suc_Suc_mult_two_diff_two [rule_format, simp]: |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
366 |
"n\<noteq>0 --> Suc (Suc (2 * n - 2)) = 2*n" |
15251 | 367 |
by (induct "n", auto) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
368 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
369 |
lemma lemma_Suc_Suc_4n_diff_2 [rule_format, simp]: |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
370 |
"n\<noteq>0 --> Suc (Suc (4*n - 2)) = 4*n" |
15251 | 371 |
by (induct "n", auto) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
372 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
373 |
lemma Suc_mult_two_diff_one [rule_format, simp]: |
25134
3d4953e88449
Eliminated most of the neq0_conv occurrences. As a result, many
nipkow
parents:
25112
diff
changeset
|
374 |
"n\<noteq>0 --> Suc (2 * n - 1) = 2*n" |
15251 | 375 |
by (induct "n", auto) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
376 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
377 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
378 |
text{*It is unclear why so many variant results are needed.*} |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
379 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
380 |
lemma Maclaurin_sin_expansion2: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
381 |
"\<exists>t. abs t \<le> abs x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
382 |
sin x = |
15539 | 383 |
(\<Sum>m=0..<n. (if even m then 0 |
23177 | 384 |
else (-1 ^ ((m - Suc 0) div 2)) / real (fact m)) * |
15539 | 385 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
386 |
+ ((sin(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
387 |
apply (cut_tac f = sin and n = n and x = x |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
388 |
and diff = "%n x. sin (x + 1/2*real n * pi)" in Maclaurin_all_lt_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
389 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
390 |
apply (simp (no_asm)) |
15539 | 391 |
apply (simp (no_asm)) |
23242 | 392 |
apply (case_tac "n", clarify, simp, simp add: lemma_STAR_sin) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
393 |
apply (rule ccontr, simp) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
394 |
apply (drule_tac x = x in spec, simp) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
395 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
396 |
apply (rule_tac x = t in exI, simp) |
15536 | 397 |
apply (rule setsum_cong[OF refl]) |
15539 | 398 |
apply (auto simp add: sin_zero_iff odd_Suc_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
399 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
400 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
401 |
lemma Maclaurin_sin_expansion: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
402 |
"\<exists>t. sin x = |
15539 | 403 |
(\<Sum>m=0..<n. (if even m then 0 |
23177 | 404 |
else (-1 ^ ((m - Suc 0) div 2)) / real (fact m)) * |
15539 | 405 |
x ^ m) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
406 |
+ ((sin(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
407 |
apply (insert Maclaurin_sin_expansion2 [of x n]) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
408 |
apply (blast intro: elim:); |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
409 |
done |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
410 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
411 |
|
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
412 |
lemma Maclaurin_sin_expansion3: |
25162 | 413 |
"[| n > 0; 0 < x |] ==> |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
414 |
\<exists>t. 0 < t & t < x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
415 |
sin x = |
15539 | 416 |
(\<Sum>m=0..<n. (if even m then 0 |
23177 | 417 |
else (-1 ^ ((m - Suc 0) div 2)) / real (fact m)) * |
15539 | 418 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
419 |
+ ((sin(t + 1/2 * real(n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
420 |
apply (cut_tac f = sin and n = n and h = x and diff = "%n x. sin (x + 1/2*real (n) *pi)" in Maclaurin_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
421 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
422 |
apply simp |
15539 | 423 |
apply (simp (no_asm)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
424 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
425 |
apply (rule_tac x = t in exI, simp) |
15536 | 426 |
apply (rule setsum_cong[OF refl]) |
15539 | 427 |
apply (auto simp add: sin_zero_iff odd_Suc_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
428 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
429 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
430 |
lemma Maclaurin_sin_expansion4: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
431 |
"0 < x ==> |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
432 |
\<exists>t. 0 < t & t \<le> x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
433 |
sin x = |
15539 | 434 |
(\<Sum>m=0..<n. (if even m then 0 |
23177 | 435 |
else (-1 ^ ((m - Suc 0) div 2)) / real (fact m)) * |
15539 | 436 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
437 |
+ ((sin(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
438 |
apply (cut_tac f = sin and n = n and h = x and diff = "%n x. sin (x + 1/2*real (n) *pi)" in Maclaurin2_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
439 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
440 |
apply simp |
15539 | 441 |
apply (simp (no_asm)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
442 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
443 |
apply (rule_tac x = t in exI, simp) |
15536 | 444 |
apply (rule setsum_cong[OF refl]) |
15539 | 445 |
apply (auto simp add: sin_zero_iff odd_Suc_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
446 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
447 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
448 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
449 |
subsection{*Maclaurin Expansion for Cosine Function*} |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
450 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
451 |
lemma sumr_cos_zero_one [simp]: |
15539 | 452 |
"(\<Sum>m=0..<(Suc n). |
23177 | 453 |
(if even m then -1 ^ (m div 2)/(real (fact m)) else 0) * 0 ^ m) = 1" |
15251 | 454 |
by (induct "n", auto) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
455 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
456 |
lemma Maclaurin_cos_expansion: |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
457 |
"\<exists>t. abs t \<le> abs x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
458 |
cos x = |
15539 | 459 |
(\<Sum>m=0..<n. (if even m |
23177 | 460 |
then -1 ^ (m div 2)/(real (fact m)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
461 |
else 0) * |
15539 | 462 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
463 |
+ ((cos(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
464 |
apply (cut_tac f = cos and n = n and x = x and diff = "%n x. cos (x + 1/2*real (n) *pi)" in Maclaurin_all_lt_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
465 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
466 |
apply (simp (no_asm)) |
15539 | 467 |
apply (simp (no_asm)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
468 |
apply (case_tac "n", simp) |
15561 | 469 |
apply (simp del: setsum_op_ivl_Suc) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
470 |
apply (rule ccontr, simp) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
471 |
apply (drule_tac x = x in spec, simp) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
472 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
473 |
apply (rule_tac x = t in exI, simp) |
15536 | 474 |
apply (rule setsum_cong[OF refl]) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
475 |
apply (auto simp add: cos_zero_iff even_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
476 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
477 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
478 |
lemma Maclaurin_cos_expansion2: |
25162 | 479 |
"[| 0 < x; n > 0 |] ==> |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
480 |
\<exists>t. 0 < t & t < x & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
481 |
cos x = |
15539 | 482 |
(\<Sum>m=0..<n. (if even m |
23177 | 483 |
then -1 ^ (m div 2)/(real (fact m)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
484 |
else 0) * |
15539 | 485 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
486 |
+ ((cos(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
487 |
apply (cut_tac f = cos and n = n and h = x and diff = "%n x. cos (x + 1/2*real (n) *pi)" in Maclaurin_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
488 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
489 |
apply simp |
15539 | 490 |
apply (simp (no_asm)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
491 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
492 |
apply (rule_tac x = t in exI, simp) |
15536 | 493 |
apply (rule setsum_cong[OF refl]) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
494 |
apply (auto simp add: cos_zero_iff even_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
495 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
496 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
497 |
lemma Maclaurin_minus_cos_expansion: |
25162 | 498 |
"[| x < 0; n > 0 |] ==> |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
499 |
\<exists>t. x < t & t < 0 & |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
500 |
cos x = |
15539 | 501 |
(\<Sum>m=0..<n. (if even m |
23177 | 502 |
then -1 ^ (m div 2)/(real (fact m)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
503 |
else 0) * |
15539 | 504 |
x ^ m) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
505 |
+ ((cos(t + 1/2 * real (n) *pi) / real (fact n)) * x ^ n)" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
506 |
apply (cut_tac f = cos and n = n and h = x and diff = "%n x. cos (x + 1/2*real (n) *pi)" in Maclaurin_minus_objl) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
507 |
apply safe |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
508 |
apply simp |
15539 | 509 |
apply (simp (no_asm)) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
510 |
apply (erule ssubst) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
511 |
apply (rule_tac x = t in exI, simp) |
15536 | 512 |
apply (rule setsum_cong[OF refl]) |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
513 |
apply (auto simp add: cos_zero_iff even_mult_two_ex) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
514 |
done |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
515 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
516 |
(* ------------------------------------------------------------------------- *) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
517 |
(* Version for ln(1 +/- x). Where is it?? *) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
518 |
(* ------------------------------------------------------------------------- *) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
519 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
520 |
lemma sin_bound_lemma: |
15081 | 521 |
"[|x = y; abs u \<le> (v::real) |] ==> \<bar>(x + u) - y\<bar> \<le> v" |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
522 |
by auto |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
523 |
|
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
524 |
lemma Maclaurin_sin_bound: |
23177 | 525 |
"abs(sin x - (\<Sum>m=0..<n. (if even m then 0 else (-1 ^ ((m - Suc 0) div 2)) / real (fact m)) * |
15081 | 526 |
x ^ m)) \<le> inverse(real (fact n)) * \<bar>x\<bar> ^ n" |
14738 | 527 |
proof - |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
528 |
have "!! x (y::real). x \<le> 1 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x * y \<le> 1 * y" |
14738 | 529 |
by (rule_tac mult_right_mono,simp_all) |
530 |
note est = this[simplified] |
|
22985 | 531 |
let ?diff = "\<lambda>(n::nat) x. if n mod 4 = 0 then sin(x) else if n mod 4 = 1 then cos(x) else if n mod 4 = 2 then -sin(x) else -cos(x)" |
532 |
have diff_0: "?diff 0 = sin" by simp |
|
533 |
have DERIV_diff: "\<forall>m x. DERIV (?diff m) x :> ?diff (Suc m) x" |
|
534 |
apply (clarify) |
|
535 |
apply (subst (1 2 3) mod_Suc_eq_Suc_mod) |
|
536 |
apply (cut_tac m=m in mod_exhaust_less_4) |
|
31881 | 537 |
apply (safe, auto intro!: DERIV_intros) |
22985 | 538 |
done |
539 |
from Maclaurin_all_le [OF diff_0 DERIV_diff] |
|
540 |
obtain t where t1: "\<bar>t\<bar> \<le> \<bar>x\<bar>" and |
|
541 |
t2: "sin x = (\<Sum>m = 0..<n. ?diff m 0 / real (fact m) * x ^ m) + |
|
542 |
?diff n t / real (fact n) * x ^ n" by fast |
|
543 |
have diff_m_0: |
|
544 |
"\<And>m. ?diff m 0 = (if even m then 0 |
|
23177 | 545 |
else -1 ^ ((m - Suc 0) div 2))" |
22985 | 546 |
apply (subst even_even_mod_4_iff) |
547 |
apply (cut_tac m=m in mod_exhaust_less_4) |
|
548 |
apply (elim disjE, simp_all) |
|
549 |
apply (safe dest!: mod_eqD, simp_all) |
|
550 |
done |
|
14738 | 551 |
show ?thesis |
22985 | 552 |
apply (subst t2) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
553 |
apply (rule sin_bound_lemma) |
15536 | 554 |
apply (rule setsum_cong[OF refl]) |
22985 | 555 |
apply (subst diff_m_0, simp) |
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
556 |
apply (auto intro: mult_right_mono [where b=1, simplified] mult_right_mono |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
15944
diff
changeset
|
557 |
simp add: est mult_nonneg_nonneg mult_ac divide_inverse |
16924 | 558 |
power_abs [symmetric] abs_mult) |
14738 | 559 |
done |
560 |
qed |
|
561 |
||
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14738
diff
changeset
|
562 |
end |