[STATEMENT]
lemma arctan_series:
  assumes "\<bar>x\<bar> \<le> 1"
  shows "arctan x = (\<Sum>k. (-1)^k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))"
    (is "_ = suminf (\<lambda> n. ?c x n)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
let ?c' = "\<lambda>x n. (-1)^n * x^(n*2)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have DERIV_arctan_suminf: "DERIV (\<lambda> x. suminf (?c x)) x :> (suminf (?c' x))"
    if "0 < r" and "r < 1" and "\<bar>x\<bar> < r" for r x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative (\<Sum>n. (- 1) ^ n * x ^ (n * 2))) (at x)
[PROOF STEP]
proof (rule DERIV_arctan_series)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>x\<bar> < 1
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
0 < r
r < 1
\<bar>x\<bar> < r
[PROOF STEP]
show "\<bar>x\<bar> < 1"
[PROOF STATE]
proof (prove)
using this:
0 < r
r < 1
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<bar>x\<bar> < 1
[PROOF STEP]
using \<open>r < 1\<close> and \<open>\<bar>x\<bar> < r\<close>
[PROOF STATE]
proof (prove)
using this:
0 < r
r < 1
\<bar>x\<bar> < r
r < 1
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<bar>x\<bar> < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?r1; ?r1 < 1; \<bar>?x1\<bar> < ?r1\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative (\<Sum>n. (- 1) ^ n * ?x1 ^ (n * 2))) (at ?x1)

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?r1; ?r1 < 1; \<bar>?x1\<bar> < ?r1\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative (\<Sum>n. (- 1) ^ n * ?x1 ^ (n * 2))) (at ?x1)

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
assume "\<bar>x\<bar> \<le> 1"
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> \<le> 1

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
note summable_Leibniz[OF zeroseq_arctan_series[OF this] monoseq_arctan_series[OF this]]
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
0 < 1 / real (0 * 2 + 1) * x ^ (0 * 2 + 1) \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))..\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))})
1 / real (0 * 2 + 1) * x ^ (0 * 2 + 1) < 0 \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))..\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))})
(\<lambda>n. \<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
(\<lambda>n. \<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> summable (\<lambda>n. (- 1) ^ n * (1 / real (n * 2 + 1) * ?xa3 ^ (n * 2 + 1)))
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> 0 < 1 / real (0 * 2 + 1) * ?xa3 ^ (0 * 2 + 1) \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))..\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))})
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> 1 / real (0 * 2 + 1) * ?xa3 ^ (0 * 2 + 1) < 0 \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))..\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))})
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> (\<lambda>n. \<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1)))
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> (\<lambda>n. \<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
note arctan_series_borders = this
[PROOF STATE]
proof (state)
this:
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> summable (\<lambda>n. (- 1) ^ n * (1 / real (n * 2 + 1) * ?xa3 ^ (n * 2 + 1)))
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> 0 < 1 / real (0 * 2 + 1) * ?xa3 ^ (0 * 2 + 1) \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))..\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))})
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> 1 / real (0 * 2 + 1) * ?xa3 ^ (0 * 2 + 1) < 0 \<longrightarrow> (\<forall>n. (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<in> {\<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))..\<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))})
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> (\<lambda>n. \<Sum>i<2 * n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1)))
\<bar>?xa3\<bar> \<le> 1 \<Longrightarrow> (\<lambda>n. \<Sum>i<2 * n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1))) \<longlonglongrightarrow> (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * ?xa3 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have when_less_one: "arctan x = (\<Sum>k. ?c x k)" if "\<bar>x\<bar> < 1" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
obtain r where "\<bar>x\<bar> < r" and "r < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. \<lbrakk>\<bar>x\<bar> < r; r < 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using dense[OF \<open>\<bar>x\<bar> < 1\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>z>\<bar>x\<bar>. z < 1

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>\<bar>x\<bar> < r; r < 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < r
r < 1

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < r
r < 1
[PROOF STEP]
have "0 < r" and "- r < x" and "x < r"
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < r
r < 1

goal (1 subgoal):
 1. 0 < r &&& - r < x &&& x < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < r
- r < x
x < r

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have suminf_eq_arctan_bounded: "suminf (?c x) - arctan x = suminf (?c a) - arctan a"
      if "-r < a" and "b < r" and "a < b" and "a \<le> x" and "x \<le> b" for x a b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
- r < a
b < r
a < b
a \<le> x
x \<le> b
[PROOF STEP]
have "\<bar>x\<bar> < r"
[PROOF STATE]
proof (prove)
using this:
- r < a
b < r
a < b
a \<le> x
x \<le> b

goal (1 subgoal):
 1. \<bar>x\<bar> < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < r

goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a
[PROOF STEP]
show "suminf (?c x) - arctan x = suminf (?c a) - arctan a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a
[PROOF STEP]
proof (rule DERIV_isconst2[of "a" "b"])
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. a < b
 2. continuous_on {a..b} (\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a)
 3. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> ((\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a) has_real_derivative 0) (at x)
 4. a \<le> x
 5. x \<le> b
[PROOF STEP]
show "a < b" and "a \<le> x" and "x \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b &&& a \<le> x &&& x \<le> b
[PROOF STEP]
using \<open>a < b\<close> \<open>a \<le> x\<close> \<open>x \<le> b\<close>
[PROOF STATE]
proof (prove)
using this:
a < b
a \<le> x
x \<le> b

goal (1 subgoal):
 1. a < b &&& a \<le> x &&& x \<le> b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < b
a \<le> x
x \<le> b

goal (2 subgoals):
 1. continuous_on {a..b} (\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a)
 2. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> ((\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a) has_real_derivative 0) (at x)
[PROOF STEP]
have "\<forall>x. - r < x \<and> x < r \<longrightarrow> DERIV (\<lambda> x. suminf (?c x) - arctan x) x :> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. - r < x \<and> x < r \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
proof (rule allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
assume "-r < x \<and> x < r"
[PROOF STATE]
proof (state)
this:
- r < x \<and> x < r

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- r < x \<and> x < r
[PROOF STEP]
have "\<bar>x\<bar> < r"
[PROOF STATE]
proof (prove)
using this:
- r < x \<and> x < r

goal (1 subgoal):
 1. \<bar>x\<bar> < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
with \<open>r < 1\<close>
[PROOF STATE]
proof (chain)
picking this:
r < 1
\<bar>x\<bar> < r
[PROOF STEP]
have "\<bar>x\<bar> < 1"
[PROOF STATE]
proof (prove)
using this:
r < 1
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<bar>x\<bar> < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
have "\<bar>- (x\<^sup>2)\<bar> < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>- x\<^sup>2\<bar> < 1
[PROOF STEP]
using abs_square_less_1 \<open>\<bar>x\<bar> < 1\<close>
[PROOF STATE]
proof (prove)
using this:
(?x\<^sup>2 < (1::?'a)) = (\<bar>?x\<bar> < (1::?'a))
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. \<bar>- x\<^sup>2\<bar> < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>- x\<^sup>2\<bar> < 1

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>- x\<^sup>2\<bar> < 1
[PROOF STEP]
have "(\<lambda>n. (- (x\<^sup>2)) ^ n) sums (1 / (1 - (- (x\<^sup>2))))"
[PROOF STATE]
proof (prove)
using this:
\<bar>- x\<^sup>2\<bar> < 1

goal (1 subgoal):
 1. (^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
unfolding real_norm_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
norm (- x\<^sup>2) < 1

goal (1 subgoal):
 1. (^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
by (rule geometric_sums)
[PROOF STATE]
proof (state)
this:
(^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
have "(?c' x) sums (1 / (1 - (- (x\<^sup>2))))"
[PROOF STATE]
proof (prove)
using this:
(^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
unfolding power_mult_distrib[symmetric] power_mult mult.commute[of _ 2]
[PROOF STATE]
proof (prove)
using this:
(^) (- x\<^sup>2) sums (1 / (1 - - x\<^sup>2))

goal (1 subgoal):
 1. (^) (- 1 * x\<^sup>2) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))
[PROOF STEP]
have suminf_c'_eq_geom: "inverse (1 + x\<^sup>2) = suminf (?c' x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))

goal (1 subgoal):
 1. inverse (1 + x\<^sup>2) = (\<Sum>n. (- 1) ^ n * x ^ (n * 2))
[PROOF STEP]
using sums_unique
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))
?f sums ?s \<Longrightarrow> ?s = suminf ?f

goal (1 subgoal):
 1. inverse (1 + x\<^sup>2) = (\<Sum>n. (- 1) ^ n * x ^ (n * 2))
[PROOF STEP]
unfolding inverse_eq_divide
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (- 1) ^ n * x ^ (n * 2)) sums (1 / (1 - - x\<^sup>2))
?f sums ?s \<Longrightarrow> ?s = suminf ?f

goal (1 subgoal):
 1. 1 / (1 + x\<^sup>2) = (\<Sum>n. (- 1) ^ n * x ^ (n * 2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverse (1 + x\<^sup>2) = (\<Sum>n. (- 1) ^ n * x ^ (n * 2))

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
have "DERIV (\<lambda> x. suminf (?c x)) x :> (inverse (1 + x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative inverse (1 + x\<^sup>2)) (at x)
[PROOF STEP]
unfolding suminf_c'_eq_geom
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative (\<Sum>n. (- 1) ^ n * x ^ (n * 2))) (at x)
[PROOF STEP]
by (rule DERIV_arctan_suminf[OF \<open>0 < r\<close> \<open>r < 1\<close> \<open>\<bar>x\<bar> < r\<close>])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) has_real_derivative inverse (1 + x\<^sup>2)) (at x)

goal (1 subgoal):
 1. \<And>x. - r < x \<and> x < r \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
from DERIV_diff [OF this DERIV_arctan]
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative inverse (1 + x\<^sup>2) - inverse (1 + x\<^sup>2)) (at x)
[PROOF STEP]
show "DERIV (\<lambda>x. suminf (?c x) - arctan x) x :> 0"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative inverse (1 + x\<^sup>2) - inverse (1 + x\<^sup>2)) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. - r < x \<and> x < r \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)

goal (2 subgoals):
 1. continuous_on {a..b} (\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a)
 2. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> ((\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. - r < x \<and> x < r \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
[PROOF STEP]
have DERIV_in_rball: "\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> DERIV (\<lambda>x. suminf (?c x) - arctan x) y :> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. - r < x \<and> x < r \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)

goal (1 subgoal):
 1. \<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
[PROOF STEP]
using \<open>-r < a\<close> \<open>b < r\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>x. - r < x \<and> x < r \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at x)
- r < a
b < r

goal (1 subgoal):
 1. \<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)

goal (2 subgoals):
 1. continuous_on {a..b} (\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a)
 2. \<And>x. \<lbrakk>a < x; x < b\<rbrakk> \<Longrightarrow> ((\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a) has_real_derivative 0) (at x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
[PROOF STEP]
show "\<And>y. \<lbrakk>a < y; y < b\<rbrakk> \<Longrightarrow> DERIV (\<lambda>x. suminf (?c x) - arctan x) y :> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)

goal (1 subgoal):
 1. \<And>y. \<lbrakk>a < y; y < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
[PROOF STEP]
using \<open>\<bar>x\<bar> < r\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
\<bar>x\<bar> < r

goal (1 subgoal):
 1. \<And>y. \<lbrakk>a < y; y < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>a < ?y1; ?y1 < b\<rbrakk> \<Longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at ?y1)

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>a. (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a)
[PROOF STEP]
show "continuous_on {a..b} (\<lambda>x. suminf (?c x) - arctan x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x)
[PROOF STEP]
using DERIV_in_rball DERIV_atLeastAtMost_imp_continuous_on
[PROOF STATE]
proof (prove)
using this:
\<forall>y. a \<le> y \<and> y \<le> b \<longrightarrow> ((\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x) has_real_derivative 0) (at y)
(\<And>x. \<lbrakk>?a \<le> x; x \<le> ?b\<rbrakk> \<Longrightarrow> \<exists>y. (?f has_field_derivative y) (at x)) \<Longrightarrow> continuous_on {?a..?b} ?f

goal (1 subgoal):
 1. continuous_on {a..b} (\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
continuous_on {a..b} (\<lambda>x. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>b. (- 1) ^ b * (1 / real (b * 2 + 1) * a ^ (b * 2 + 1))) - arctan a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>- r < ?a1; ?b1 < r; ?a1 < ?b1; ?a1 \<le> ?x1; ?x1 \<le> ?b1\<rbrakk> \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * ?x1 ^ (a * 2 + 1))) - arctan ?x1 = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * ?a1 ^ (a * 2 + 1))) - arctan ?a1

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have suminf_arctan_zero: "suminf (?c 0) - arctan 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0 = 0
[PROOF STEP]
unfolding Suc_eq_plus1[symmetric] power_Suc2 mult_zero_right arctan_zero_zero suminf_zero
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 - 0 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0 = 0

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
have "suminf (?c x) - arctan x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
 2. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
 2. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 0

goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
using suminf_arctan_zero
[PROOF STATE]
proof (prove)
using this:
x = 0
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0 = 0

goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> 0
[PROOF STEP]
have "0 < \<bar>x\<bar>" and "- \<bar>x\<bar> < \<bar>x\<bar>"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. 0 < \<bar>x\<bar> &&& - \<bar>x\<bar> < \<bar>x\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < \<bar>x\<bar>
- \<bar>x\<bar> < \<bar>x\<bar>

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
have "suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>) = suminf (?c 0) - arctan 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0
[PROOF STEP]
by (rule suminf_eq_arctan_bounded[where x1=0 and a1="-\<bar>x\<bar>" and b1="\<bar>x\<bar>", symmetric])
          (simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>-\<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less)
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
have "suminf (?c x) - arctan x = suminf (?c (- \<bar>x\<bar>)) - arctan (- \<bar>x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>)
[PROOF STEP]
by (rule suminf_eq_arctan_bounded[where x1=x and a1="- \<bar>x\<bar>" and b1="\<bar>x\<bar>"])
           (simp_all only: \<open>\<bar>x\<bar> < r\<close> \<open>- \<bar>x\<bar> < \<bar>x\<bar>\<close> neg_less_iff_less)
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>)

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>)

goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
using suminf_arctan_zero
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>) = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * (- \<bar>x\<bar>) ^ (a * 2 + 1))) - arctan (- \<bar>x\<bar>)
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 0 ^ (a * 2 + 1))) - arctan 0 = 0

goal (1 subgoal):
 1. (\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a. (- 1) ^ a * (1 / real (a * 2 + 1) * x ^ (a * 2 + 1))) - arctan x = 0

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>?x1\<bar> < 1 \<Longrightarrow> arctan ?x1 = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * ?x1 ^ (k * 2 + 1)))

goal (1 subgoal):
 1. arctan x = (\<Sum>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
show "arctan x = suminf (\<lambda>n. ?c x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
proof (cases "\<bar>x\<bar> < 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
 2. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> < 1

goal (2 subgoals):
 1. \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
 2. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>x\<bar> < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
by (rule when_less_one)
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> \<bar>x\<bar> < 1

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> \<bar>x\<bar> < 1
[PROOF STEP]
have "\<bar>x\<bar> = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> \<bar>x\<bar> < 1

goal (1 subgoal):
 1. \<bar>x\<bar> = 1
[PROOF STEP]
using \<open>\<bar>x\<bar> \<le> 1\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> \<bar>x\<bar> < 1
\<bar>x\<bar> \<le> 1

goal (1 subgoal):
 1. \<bar>x\<bar> = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> = 1

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
let ?a = "\<lambda>x n. \<bar>1 / real (n * 2 + 1) * x^(n * 2 + 1)\<bar>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
let ?diff = "\<lambda>x n. \<bar>arctan x - (\<Sum>i<n. ?c x i)\<bar>"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "?diff 1 n \<le> ?a 1 n" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "0 < (1 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 1

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < 1

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "?diff x n \<le> ?a x n" if "0 < x" and "x < 1" for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
0 < x
x < 1
[PROOF STEP]
have "\<bar>x\<bar> \<le> 1" and "\<bar>x\<bar> < 1"
[PROOF STATE]
proof (prove)
using this:
0 < x
x < 1

goal (1 subgoal):
 1. \<bar>x\<bar> \<le> 1 &&& \<bar>x\<bar> < 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar> \<le> 1
\<bar>x\<bar> < 1

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from \<open>0 < x\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < x
[PROOF STEP]
have "0 < 1 / real (0 * 2 + (1::nat)) * x ^ (0 * 2 + 1)"
[PROOF STATE]
proof (prove)
using this:
0 < x

goal (1 subgoal):
 1. 0 < 1 / real (0 * 2 + 1) * x ^ (0 * 2 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < 1 / real (0 * 2 + 1) * x ^ (0 * 2 + 1)

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
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]
[PROOF STATE]
proof (state)
this:
arctan x \<in> {\<Sum>i<2 * ?x. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))..\<Sum>i<2 * ?x + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))}

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "0 < 1 / real (n*2+1) * x^(n*2+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by (rule mult_pos_pos) (simp_all only: zero_less_power[OF \<open>0 < x\<close>], auto)
[PROOF STATE]
proof (state)
this:
0 < 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
have a_pos: "?a x n = 1 / real (n*2+1) * x^(n*2+1)"
[PROOF STATE]
proof (prove)
using this:
0 < 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)

goal (1 subgoal):
 1. \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> = 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by (rule abs_of_pos)
[PROOF STATE]
proof (state)
this:
\<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> = 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
proof (cases "even n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even n

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
even n
[PROOF STEP]
have sgn_pos: "(-1)^n = (1::real)"
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. (- 1) ^ n = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ n = 1

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from \<open>even n\<close>
[PROOF STATE]
proof (chain)
picking this:
even n
[PROOF STEP]
obtain m where "n = 2 * m"
[PROOF STATE]
proof (prove)
using this:
even n

goal (1 subgoal):
 1. (\<And>m. n = 2 * m \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
n = 2 * m

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 2 * m
[PROOF STEP]
have "2 * m = n"
[PROOF STATE]
proof (prove)
using this:
n = 2 * m

goal (1 subgoal):
 1. 2 * m = n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
2 * m = n

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from bounds[of m, unfolded this atLeastAtMost_iff]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> arctan x \<and> arctan x \<le> (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
[PROOF STEP]
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))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> arctan x \<and> arctan x \<le> (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "\<dots> = ?c x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "\<dots> = ?a x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)) = \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
unfolding sgn_pos a_pos
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)) = 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)) = \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal (2 subgoals):
 1. even n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
 2. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
odd n

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd n
[PROOF STEP]
have sgn_neg: "(-1)^n = (-1::real)"
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. (- 1) ^ n = - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ n = - 1

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from \<open>odd n\<close>
[PROOF STATE]
proof (chain)
picking this:
odd n
[PROOF STEP]
obtain m where "n = 2 * m + 1"
[PROOF STATE]
proof (prove)
using this:
odd n

goal (1 subgoal):
 1. (\<And>m. n = 2 * m + 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
n = 2 * m + 1

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 2 * m + 1
[PROOF STEP]
have m_def: "2 * m + 1 = n"
[PROOF STATE]
proof (prove)
using this:
n = 2 * m + 1

goal (1 subgoal):
 1. 2 * m + 1 = n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
2 * m + 1 = n

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 * m + 1 = n
[PROOF STEP]
have m_plus: "2 * (m + 1) = n + 1"
[PROOF STATE]
proof (prove)
using this:
2 * m + 1 = n

goal (1 subgoal):
 1. 2 * (m + 1) = n + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * (m + 1) = n + 1

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
from bounds[of "m + 1", unfolded this atLeastAtMost_iff, THEN conjunct1] bounds[of m, unfolded m_def atLeastAtMost_iff, THEN conjunct2]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> arctan x
arctan x \<le> (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
[PROOF STEP]
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))"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) \<le> arctan x
arctan x \<le> (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "\<dots> = - ?c x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = - ((- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = - ((- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) - (\<Sum>i<n + 1. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1))) = - ((- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "\<dots> = ?a x n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))) = \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
unfolding sgn_neg a_pos
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- 1 * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))) = 1 / real (n * 2 + 1) * x ^ (n * 2 + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- ((- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1))) = \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. odd n \<Longrightarrow> \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?x1; ?x1 < 1\<rbrakk> \<Longrightarrow> \<bar>arctan ?x1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?x1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * ?x1 ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
hence "\<forall>x \<in> { 0 <..< 1 }. 0 \<le> ?a x n - ?diff x n"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x1; ?x1 < 1\<rbrakk> \<Longrightarrow> \<bar>arctan ?x1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * ?x1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * ?x1 ^ (n * 2 + 1)\<bar>

goal (1 subgoal):
 1. \<forall>x\<in>{0<..<1}. 0 \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0<..<1}. 0 \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{0<..<1}. 0 \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
have "isCont (\<lambda> x. ?a x n - ?diff x n) x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>) x
[PROOF STEP]
unfolding diff_conv_add_uminus divide_inverse
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. \<bar>1 * inverse (real (n * 2 + 1)) * x ^ (n * 2 + 1)\<bar> + - \<bar>arctan x + - (\<Sum>i<n. (- 1) ^ i * (1 * inverse (real (i * 2 + 1)) * x ^ (i * 2 + 1)))\<bar>) x
[PROOF STEP]
by (auto intro!: isCont_add isCont_rabs continuous_ident isCont_minus isCont_arctan
          continuous_at_within_inverse isCont_mult isCont_power continuous_const isCont_sum
          simp del: add_uminus_conv_diff)
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>) ?x1

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < 1
\<forall>x\<in>{0<..<1}. 0 \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>
isCont (\<lambda>x. \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>) ?x1
[PROOF STEP]
have "0 \<le> ?a 1 n - ?diff 1 n"
[PROOF STATE]
proof (prove)
using this:
0 < 1
\<forall>x\<in>{0<..<1}. 0 \<le> \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>
isCont (\<lambda>x. \<bar>1 / real (n * 2 + 1) * x ^ (n * 2 + 1)\<bar> - \<bar>arctan x - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * x ^ (i * 2 + 1)))\<bar>) ?x1

goal (1 subgoal):
 1. 0 \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> - \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>
[PROOF STEP]
by (rule LIM_less_bound)
[PROOF STATE]
proof (state)
this:
0 \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> - \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> - \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> - \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>

goal (1 subgoal):
 1. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>arctan 1 - (\<Sum>i<?n1. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (?n1 * 2 + 1) * 1 ^ (?n1 * 2 + 1)\<bar>

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "?a 1 \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>) \<longlonglongrightarrow> 0
[PROOF STEP]
unfolding tendsto_rabs_zero_iff power_one divide_inverse One_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 * inverse (real (n * 2 + Suc 0)) * 1) \<longlonglongrightarrow> 0
[PROOF STEP]
by (auto intro!: tendsto_mult LIMSEQ_linear LIMSEQ_inverse_real_of_nat simp del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "?diff 1 \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule LIMSEQ_I)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
fix r :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
assume "0 < r"
[PROOF STATE]
proof (state)
this:
0 < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
obtain N :: nat where N_I: "N \<le> n \<Longrightarrow> ?a 1 n < r" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> < r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using LIMSEQ_D[OF \<open>?a 1 \<longlonglongrightarrow> 0\<close> \<open>0 < r\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>no. \<forall>n\<ge>no. norm (\<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> - 0) < r

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> < r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n1 \<Longrightarrow> \<bar>1 / real (?n1 * 2 + 1) * 1 ^ (?n1 * 2 + 1)\<bar> < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
have "norm (?diff 1 n - 0) < r" if "N \<le> n" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
using \<open>?diff 1 n \<le> ?a 1 n\<close> N_I[OF that]
[PROOF STATE]
proof (prove)
using this:
\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> \<le> \<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar>
\<bar>1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)\<bar> < r

goal (1 subgoal):
 1. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n1 \<Longrightarrow> norm (\<bar>arctan 1 - (\<Sum>i<?n1. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r

goal (1 subgoal):
 1. \<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> ?n1 \<Longrightarrow> norm (\<bar>arctan 1 - (\<Sum>i<?n1. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
show "\<exists>N. \<forall> n \<ge> N. norm (?diff 1 n - 0) < r"
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n1 \<Longrightarrow> norm (\<bar>arctan 1 - (\<Sum>i<?n1. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>N. \<forall>n\<ge>N. norm (\<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar> - 0) < r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<bar>arctan 1 - (\<Sum>i<n. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))\<bar>) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
from this [unfolded tendsto_rabs_zero_iff, THEN tendsto_add [OF _ tendsto_const], of "- arctan 1", THEN tendsto_minus]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. - (arctan 1 - (\<Sum>i<x. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) + - arctan 1)) \<longlonglongrightarrow> - (0 + - arctan 1)
[PROOF STEP]
have "(?c 1) sums (arctan 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. - (arctan 1 - (\<Sum>i<x. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) + - arctan 1)) \<longlonglongrightarrow> - (0 + - arctan 1)

goal (1 subgoal):
 1. (\<lambda>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 1 ^ (a * 2 + 1))) sums arctan 1
[PROOF STEP]
unfolding sums_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. - (arctan 1 - (\<Sum>i<x. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) + - arctan 1)) \<longlonglongrightarrow> - (0 + - arctan 1)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>a<n. (- 1) ^ a * (1 / real (a * 2 + 1) * 1 ^ (a * 2 + 1))) \<longlonglongrightarrow> arctan 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 1 ^ (a * 2 + 1))) sums arctan 1

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 1 ^ (a * 2 + 1))) sums arctan 1
[PROOF STEP]
have "arctan 1 = (\<Sum>i. ?c 1 i)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>a. (- 1) ^ a * (1 / real (a * 2 + 1) * 1 ^ (a * 2 + 1))) sums arctan 1

goal (1 subgoal):
 1. arctan 1 = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))
[PROOF STEP]
by (rule sums_unique)
[PROOF STATE]
proof (state)
this:
arctan 1 = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. \<not> \<bar>x\<bar> < 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
proof (cases "x = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
 2. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = 1

goal (2 subgoals):
 1. x = 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
 2. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 1

goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
by (simp add: \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close>)
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> 1

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> 1
[PROOF STEP]
have "x = -1"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 1

goal (1 subgoal):
 1. x = - 1
[PROOF STEP]
using \<open>\<bar>x\<bar> = 1\<close>
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 1
\<bar>x\<bar> = 1

goal (1 subgoal):
 1. x = - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = - 1

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "- (pi/2) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) < 0
[PROOF STEP]
using pi_gt_zero
[PROOF STATE]
proof (prove)
using this:
0 < pi

goal (1 subgoal):
 1. - (pi / 2) < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (pi / 2) < 0

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "- (2 * pi) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (2 * pi) < 0
[PROOF STEP]
using pi_gt_zero
[PROOF STATE]
proof (prove)
using this:
0 < pi

goal (1 subgoal):
 1. - (2 * pi) < 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (2 * pi) < 0

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have c_minus_minus: "?c (- 1) i = - ?c 1 i" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)) = - ((- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(- 1) ^ ?i1 * (1 / real (?i1 * 2 + 1) * (- 1) ^ (?i1 * 2 + 1)) = - ((- 1) ^ ?i1 * (1 / real (?i1 * 2 + 1) * 1 ^ (?i1 * 2 + 1)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "arctan (- 1) = arctan (tan (-(pi / 4)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (- 1) = arctan (tan (- (pi / 4)))
[PROOF STEP]
unfolding tan_45 tan_minus
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (- 1) = arctan (- 1)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
arctan (- 1) = arctan (tan (- (pi / 4)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (- 1) = arctan (tan (- (pi / 4)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "\<dots> = - (pi / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arctan (tan (- (pi / 4))) = - (pi / 4)
[PROOF STEP]
by (rule arctan_tan) (auto simp: order_less_trans[OF \<open>- (pi/2) < 0\<close> pi_gt_zero])
[PROOF STATE]
proof (state)
this:
arctan (tan (- (pi / 4))) = - (pi / 4)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
arctan (tan (- (pi / 4))) = - (pi / 4)

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "\<dots> = - (arctan (tan (pi / 4)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 4) = - arctan (tan (pi / 4))
[PROOF STEP]
unfolding neg_equal_iff_equal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi / 4 = arctan (tan (pi / 4))
[PROOF STEP]
by (rule arctan_tan[symmetric]) (auto simp: order_less_trans[OF \<open>- (2 * pi) < 0\<close> pi_gt_zero])
[PROOF STATE]
proof (state)
this:
- (pi / 4) = - arctan (tan (pi / 4))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (pi / 4) = - arctan (tan (pi / 4))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "\<dots> = - (arctan 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - arctan (tan (pi / 4)) = - arctan 1
[PROOF STEP]
unfolding tan_45
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - arctan 1 = - arctan 1
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
- arctan (tan (pi / 4)) = - arctan 1

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- arctan (tan (pi / 4)) = - arctan 1

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "\<dots> = - (\<Sum> i. ?c 1 i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - arctan 1 = - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))
[PROOF STEP]
using \<open>arctan 1 = (\<Sum> i. ?c 1 i)\<close>
[PROOF STATE]
proof (prove)
using this:
arctan 1 = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. - arctan 1 = - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- arctan 1 = - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- arctan 1 = - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
have "\<dots> = (\<Sum> i. ?c (- 1) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))
[PROOF STEP]
using suminf_minus[OF sums_summable[OF \<open>(?c 1) sums (arctan 1)\<close>]]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. - ((- 1) ^ n * (1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)))) = - (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)))

goal (1 subgoal):
 1. - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))
[PROOF STEP]
unfolding c_minus_minus
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. - ((- 1) ^ n * (1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)))) = - (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * 1 ^ (n * 2 + 1)))

goal (1 subgoal):
 1. - (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) = (\<Sum>i. - ((- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * 1 ^ (i * 2 + 1))) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))

goal (1 subgoal):
 1. x \<noteq> 1 \<Longrightarrow> arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
arctan (- 1) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arctan (- 1) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))

goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
using \<open>x = -1\<close>
[PROOF STATE]
proof (prove)
using this:
arctan (- 1) = (\<Sum>i. (- 1) ^ i * (1 / real (i * 2 + 1) * (- 1) ^ (i * 2 + 1)))
x = - 1

goal (1 subgoal):
 1. arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
arctan x = (\<Sum>n. (- 1) ^ n * (1 / real (n * 2 + 1) * x ^ (n * 2 + 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthogonal_unit_vec [simp]:
  assumes "i < n" and "j < n" and "i \<noteq> j"
  shows "\<langle>unit_vec n i|unit_vec n j\<rangle> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = 0
[PROOF STEP]
have "\<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j
[PROOF STEP]
using assms unit_vec_def inner_prod_def scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
i < n
j < n
i \<noteq> j
unit_vec ?n ?i = vec ?n (\<lambda>j. if j = ?i then 1::?'a else (0::?'a))
\<langle>?u|?v\<rangle> \<equiv> \<Sum>i = 0..<dim_vec ?v. cnj (?u $ i) * ?v $ i
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i

goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j
[PROOF STEP]
by (smt complex_cnj_zero index_unit_vec(3) index_vec inner_prod_with_row_bra_vec row_bra_vec
        scalar_prod_right_unit)
[PROOF STATE]
proof (state)
this:
\<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j

goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = 0
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j

goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = 0
[PROOF STEP]
using assms scalar_prod_def unit_vec_def
[PROOF STATE]
proof (prove)
using this:
\<langle>unit_vec n i|unit_vec n j\<rangle> = unit_vec n i \<bullet> unit_vec n j
i < n
j < n
i \<noteq> j
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i
unit_vec ?n ?i = vec ?n (\<lambda>j. if j = ?i then 1::?'a else (0::?'a))

goal (1 subgoal):
 1. \<langle>unit_vec n i|unit_vec n j\<rangle> = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<langle>unit_vec n i|unit_vec n j\<rangle> = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem log_lin_time_explicitly:
  assumes "length numbers = 2^l"
  shows "T\<^sub>F\<^sub>N\<^sub>T\<^sub>T  numbers \<le> 30 * Discrete.log (length numbers) * length numbers + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T\<^sub>F\<^sub>N\<^sub>T\<^sub>T numbers \<le> 30 * Discrete.log (length numbers) * length numbers + 1
[PROOF STEP]
using log_lin_time[of numbers l] assms
[PROOF STATE]
proof (prove)
using this:
length numbers = 2 ^ l \<Longrightarrow> T\<^sub>F\<^sub>N\<^sub>T\<^sub>T numbers \<le> 30 * l * length numbers + 1
length numbers = 2 ^ l

goal (1 subgoal):
 1. T\<^sub>F\<^sub>N\<^sub>T\<^sub>T numbers \<le> 30 * Discrete.log (length numbers) * length numbers + 1
[PROOF STEP]
by simp


[STATEMENT]
theorem "\<Gamma>\<turnstile> \<lbrace>True\<rbrace>
           \<acute>S :== 0;; \<acute>I :== 1;;
           WHILE \<acute>I \<noteq> n
           INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace>
           DO
             \<acute>S :== \<acute>S + \<acute>I;;
             \<acute>I :== \<acute>I + 1
           OD
           \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>True\<rbrace> \<acute>S :== 0;; \<acute>I :== 1;; WHILE \<acute>I \<noteq> n INV \<lbrace>\<acute>S = (SUMM j<\<acute>I. j)\<rbrace> DO \<acute>S :== \<acute>S + \<acute>I;; \<acute>I :== \<acute>I + 1 OD \<lbrace>\<acute>S = (SUMM j<n. j)\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. True \<Longrightarrow> 0 = (SUMM j<1. j)
 2. \<And>I S. \<lbrakk>S = (SUMM j<I. j); I \<noteq> n\<rbrakk> \<Longrightarrow> S + I = (SUMM j<I + 1. j)
 3. \<And>I S. \<lbrakk>S = (SUMM j<I. j); \<not> I \<noteq> n\<rbrakk> \<Longrightarrow> S = (SUMM j<n. j)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma field_differentiable_bound:
  fixes S :: "'a::real_normed_field set"
  assumes cvs: "convex S"
      and df:  "\<And>z. z \<in> S \<Longrightarrow> (f has_field_derivative f' z) (at z within S)"
      and dn:  "\<And>z. z \<in> S \<Longrightarrow> norm (f' z) \<le> B"
      and "x \<in> S"  "y \<in> S"
    shows "norm(f x - f y) \<le> B * norm(x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (f x - f y) \<le> B * norm (x - y)
[PROOF STEP]
apply (rule differentiable_bound [OF cvs])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> (f has_derivative ?f' x) (at x within S)
 2. \<And>x. x \<in> S \<Longrightarrow> onorm (?f' x) \<le> B
 3. x \<in> S
 4. y \<in> S
[PROOF STEP]
apply (erule df [unfolded has_field_derivative_def])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. x \<in> S \<Longrightarrow> onorm ((*) (f' x)) \<le> B
 2. x \<in> S
 3. y \<in> S
[PROOF STEP]
apply (rule onorm_le, simp_all add: norm_mult mult_right_mono assms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sin_cos_squared_add [simp]: "(sin x)\<^sup>2 + (cos x)\<^sup>2 = 1"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin x)\<^sup>2 + (cos x)\<^sup>2 = (1::'a)
[PROOF STEP]
using cos_add [of x "-x"]
[PROOF STATE]
proof (prove)
using this:
cos (x + - x) = cos x * cos (- x) - sin x * sin (- x)

goal (1 subgoal):
 1. (sin x)\<^sup>2 + (cos x)\<^sup>2 = (1::'a)
[PROOF STEP]
by (simp add: power2_eq_square algebra_simps)


[STATEMENT]
theorem sigma_primepower:
  assumes "prime p"
  shows "(p - 1) * sigma(p^e) = p^(e+1) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1
[PROOF STEP]
have "sigma(p^e) = (\<Sum>i=0..e . p^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma (p ^ e) = sum ((^) p) {0..e}
[PROOF STEP]
using assms divisors_def dvd_prime_power_iff prime_nat_iff rewrite_sum_of_powers
[PROOF STATE]
proof (prove)
using this:
prime p
divisors ?m \<equiv> {n. n dvd ?m}
prime ?p \<Longrightarrow> {d. d dvd ?p ^ ?n} = (^) ?p ` {0..?n}
prime ?n = (1 < ?n \<and> (\<forall>m. m dvd ?n \<longrightarrow> m = 1 \<or> m = ?n))
1 < ?p \<Longrightarrow> \<Sum> ((^) ?p ` {0..?n}) = sum ((^) ?p) {0..?n}

goal (1 subgoal):
 1. sigma (p ^ e) = sum ((^) p) {0..e}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sigma (p ^ e) = sum ((^) p) {0..e}

goal (1 subgoal):
 1. (p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1
[PROOF STEP]
thus "(p - 1)*sigma(p^e) = p^(e+1) - 1"
[PROOF STATE]
proof (prove)
using this:
sigma (p ^ e) = sum ((^) p) {0..e}

goal (1 subgoal):
 1. (p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1
[PROOF STEP]
using sum_of_powers_nat
[PROOF STATE]
proof (prove)
using this:
sigma (p ^ e) = sum ((^) p) {0..e}
(?x - 1) * sum ((^) ?x) {0..?n} = ?x ^ Suc ?n - 1

goal (1 subgoal):
 1. (p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(p - 1) * sigma (p ^ e) = p ^ (e + 1) - 1

goal:
No subgoals!
[PROOF STEP]
qed