[STATEMENT]
theorem hurwitz_zeta_neg_of_nat:
  assumes "a > 0"
  shows   "hurwitz_zeta a (-of_nat n) = -bernpoly (Suc n) a / of_nat (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "-of_nat n \<noteq> (1::complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - of_nat n \<noteq> 1
[PROOF STEP]
by (simp add: complex_eq_iff)
[PROOF STATE]
proof (state)
this:
- of_nat n \<noteq> 1

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
hence "hurwitz_zeta a (-of_nat n) =
           pre_zeta a (-of_nat n) + a powr real (Suc n) / (-of_nat (Suc n))"
[PROOF STATE]
proof (prove)
using this:
- of_nat n \<noteq> 1

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = pre_zeta a (- of_nat n) + complex_of_real (a powr real (Suc n) / - real (Suc n))
[PROOF STEP]
unfolding zeta_def hurwitz_zeta_def
[PROOF STATE]
proof (prove)
using this:
- of_nat n \<noteq> 1

goal (1 subgoal):
 1. (if - of_nat n = 1 then 0 else pre_zeta a (- of_nat n) + complex_of_real a powr (1 - - of_nat n) / (- of_nat n - 1)) = pre_zeta a (- of_nat n) + complex_of_real (a powr real (Suc n) / - real (Suc n))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- of_nat n \<noteq> 1
0 < a

goal (1 subgoal):
 1. (if - of_nat n = 1 then 0 else pre_zeta a (- of_nat n) + complex_of_real a powr (1 - - of_nat n) / (- of_nat n - 1)) = pre_zeta a (- of_nat n) + complex_of_real (a powr real (Suc n) / - real (Suc n))
[PROOF STEP]
by (simp add: powr_of_real [symmetric])
[PROOF STATE]
proof (state)
this:
hurwitz_zeta a (- of_nat n) = pre_zeta a (- of_nat n) + complex_of_real (a powr real (Suc n) / - real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta a (- of_nat n) = pre_zeta a (- of_nat n) + complex_of_real (a powr real (Suc n) / - real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "a powr real (Suc n) / (-of_nat (Suc n)) = - (a powr real (Suc n) / of_nat (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a powr real (Suc n) / - real (Suc n) = - (a powr real (Suc n) / real (Suc n))
[PROOF STEP]
by (simp add: divide_simps del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
a powr real (Suc n) / - real (Suc n) = - (a powr real (Suc n) / real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a powr real (Suc n) / - real (Suc n) = - (a powr real (Suc n) / real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "a powr real (Suc n) = a ^ Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a powr real (Suc n) = a ^ Suc n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. a powr real (Suc n) = a ^ Suc n
[PROOF STEP]
by (intro powr_realpow)
[PROOF STATE]
proof (state)
this:
a powr real (Suc n) = a ^ Suc n

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a powr real (Suc n) = a ^ Suc n

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "pre_zeta a (-of_nat n) = pre_zeta_aux (Suc n) a (- of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_zeta a (- of_nat n) = pre_zeta_aux (Suc n) a (- of_nat n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. pre_zeta a (- of_nat n) = pre_zeta_aux (Suc n) a (- of_nat n)
[PROOF STEP]
by (intro pre_zeta_aux_eq_pre_zeta [symmetric]) auto
[PROOF STATE]
proof (state)
this:
pre_zeta a (- of_nat n) = pre_zeta_aux (Suc n) a (- of_nat n)

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pre_zeta a (- of_nat n) = pre_zeta_aux (Suc n) a (- of_nat n)

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "\<dots> = of_real a powr of_nat n / 2 +
                    (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R
                       (pochhammer (- of_nat n) (2 * i - 1) *
                       of_real a powr (of_nat n - of_nat (2 * i - 1)))) +
                    EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n)
                      (2*n+3) * of_real (x + a) powr (- of_nat n - 3))) 0"
    (is "_ = ?B + sum (\<lambda>n. ?f (2 * n)) _ + _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_zeta_aux (Suc n) a (- of_nat n) = complex_of_real a powr of_nat n / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n) (2 * n + 3) * complex_of_real (x + a) powr (- of_nat n - 3))) 0
[PROOF STEP]
unfolding pre_zeta_aux_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real a powr - (- of_nat n) / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (- (- of_nat n) - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n) (Suc (2 * Suc n)) * complex_of_real (x + a) powr (- 1 - 2 * of_nat (Suc n) - - of_nat n))) 0 = complex_of_real a powr of_nat n / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n) (2 * n + 3) * complex_of_real (x + a) powr (- of_nat n - 3))) 0
[PROOF STEP]
by (simp add: add_ac eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
pre_zeta_aux (Suc n) a (- of_nat n) = complex_of_real a powr of_nat n / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n) (2 * n + 3) * complex_of_real (x + a) powr (- of_nat n - 3))) 0

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pre_zeta_aux (Suc n) a (- of_nat n) = complex_of_real a powr of_nat n / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (pochhammer (- of_nat n) (2 * n + 3) * complex_of_real (x + a) powr (- of_nat n - 3))) 0

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "?B = of_real (a ^ n) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real a powr of_nat n / 2 = complex_of_real (a ^ n) / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. complex_of_real a powr of_nat n / 2 = complex_of_real (a ^ n) / 2
[PROOF STEP]
by (subst powr_Reals_eq) (auto simp: powr_realpow)
[PROOF STATE]
proof (state)
this:
complex_of_real a powr of_nat n / 2 = complex_of_real (a ^ n) / 2

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real a powr of_nat n / 2 = complex_of_real (a ^ n) / 2

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "pochhammer (-of_nat n :: complex) (2*n+3) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer (- of_nat n) (2 * n + 3) = 0
[PROOF STEP]
by (subst pochhammer_eq_0_iff) auto
[PROOF STATE]
proof (state)
this:
pochhammer (- of_nat n) (2 * n + 3) = 0

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta a (- of_nat n) = complex_of_real (a ^ n) / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (0 * complex_of_real (x + a) powr (- of_nat n - 3))) 0 + complex_of_real (- (a ^ Suc n / real (Suc n)))
[PROOF STEP]
have "hurwitz_zeta a (-of_nat n) =
                  - (a ^ Suc n / of_nat (Suc n)) + (a ^ n / 2 + sum (\<lambda>n. ?f (2 * n)) {1..Suc n})"
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta a (- of_nat n) = complex_of_real (a ^ n) / 2 + (\<Sum>i = 1..Suc n. (bernoulli (2 * i) / fact (2 * i)) *\<^sub>R (pochhammer (- of_nat n) (2 * i - 1) * complex_of_real a powr (of_nat n - of_nat (2 * i - 1)))) + EM_remainder (Suc (2 * Suc n)) (\<lambda>x. - (0 * complex_of_real (x + a) powr (- of_nat n - 3))) 0 + complex_of_real (- (a ^ Suc n / real (Suc n)))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- (a ^ Suc n / real (Suc n))) + (complex_of_real (a ^ n / 2) + (\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
hurwitz_zeta a (- of_nat n) = complex_of_real (- (a ^ Suc n / real (Suc n))) + (complex_of_real (a ^ n / 2) + (\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hurwitz_zeta a (- of_nat n) = complex_of_real (- (a ^ Suc n / real (Suc n))) + (complex_of_real (a ^ n / 2) + (\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "sum (\<lambda>n. ?f (2 * n)) {1..Suc n} = sum ?f ((*) 2 ` {1..Suc n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))) = (\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1))))
[PROOF STEP]
by (intro sum.reindex_bij_witness[of _ "\<lambda>i. i div 2" "\<lambda>i. 2*i"]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))) = (\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>na = 1..Suc n. (bernoulli (2 * na) / fact (2 * na)) *\<^sub>R (pochhammer (- of_nat n) (2 * na - 1) * complex_of_real a powr (of_nat n - of_nat (2 * na - 1)))) = (\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "\<dots> = (\<Sum>i=2..2*n+2. ?f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1)))) = (\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))
[PROOF STEP]
proof (intro sum.mono_neutral_left ballI, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. (*) 2 ` {1..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - (*) 2 ` {1..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
case (3 i)
[PROOF STATE]
proof (state)
this:
i \<in> {2..2 * n + 2} - (*) 2 ` {1..Suc n}

goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. (*) 2 ` {1..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - (*) 2 ` {1..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
hence "odd i" "i \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
i \<in> {2..2 * n + 2} - (*) 2 ` {1..Suc n}

goal (1 subgoal):
 1. odd i &&& i \<noteq> 1
[PROOF STEP]
by (auto elim!: evenE)
[PROOF STATE]
proof (state)
this:
odd i
i \<noteq> 1

goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. (*) 2 ` {1..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - (*) 2 ` {1..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
odd i
i \<noteq> 1

goal (1 subgoal):
 1. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
by (simp add: bernoulli_odd_eq_0)
[PROOF STATE]
proof (state)
this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0

goal (2 subgoals):
 1. finite {2..2 * n + 2}
 2. (*) 2 ` {1..Suc n} \<subseteq> {2..2 * n + 2}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1)))) = (\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>b\<in>(*) 2 ` {1..Suc n}. (bernoulli b / fact b) *\<^sub>R (pochhammer (- of_nat n) (b - 1) * complex_of_real a powr (of_nat n - of_nat (b - 1)))) = (\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "\<dots> = (\<Sum>i=2..Suc n. ?f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))
[PROOF STEP]
proof (intro sum.mono_neutral_right ballI, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. {2..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - {2..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
case (3 i)
[PROOF STATE]
proof (state)
this:
i \<in> {2..2 * n + 2} - {2..Suc n}

goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. {2..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - {2..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
hence "pochhammer (-of_nat n :: complex) (i - 1) = 0"
[PROOF STATE]
proof (prove)
using this:
i \<in> {2..2 * n + 2} - {2..Suc n}

goal (1 subgoal):
 1. pochhammer (- of_nat n) (i - 1) = 0
[PROOF STEP]
by (subst pochhammer_eq_0_iff) auto
[PROOF STATE]
proof (state)
this:
pochhammer (- of_nat n) (i - 1) = 0

goal (3 subgoals):
 1. finite {2..2 * n + 2}
 2. {2..Suc n} \<subseteq> {2..2 * n + 2}
 3. \<And>i. i \<in> {2..2 * n + 2} - {2..Suc n} \<Longrightarrow> (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
pochhammer (- of_nat n) (i - 1) = 0

goal (1 subgoal):
 1. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = 0

goal (2 subgoals):
 1. finite {2..2 * n + 2}
 2. {2..Suc n} \<subseteq> {2..2 * n + 2}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 2..2 * n + 2. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "\<dots> = (\<Sum>i=Suc 1..Suc n. -of_real (real (Suc n choose i) * bernoulli i *
                     a ^ (Suc n - i)) / of_nat (Suc n))"
    (is "sum ?lhs _ = sum ?f _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))
[PROOF STEP]
proof (intro sum.cong, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
case (2 i)
[PROOF STATE]
proof (state)
this:
i \<in> {Suc 1..Suc n}

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
hence "of_nat n - of_nat (i - 1) = (of_nat (Suc n - i) :: complex)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {Suc 1..Suc n}

goal (1 subgoal):
 1. of_nat n - of_nat (i - 1) = of_nat (Suc n - i)
[PROOF STEP]
by (auto simp: of_nat_diff)
[PROOF STATE]
proof (state)
this:
of_nat n - of_nat (i - 1) = of_nat (Suc n - i)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_nat n - of_nat (i - 1) = of_nat (Suc n - i)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "of_real a powr \<dots> = of_real (a ^ (Suc n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real a powr of_nat (Suc n - i) = complex_of_real (a ^ (Suc n - i))
[PROOF STEP]
using 2 assms
[PROOF STATE]
proof (prove)
using this:
i \<in> {Suc 1..Suc n}
0 < a

goal (1 subgoal):
 1. complex_of_real a powr of_nat (Suc n - i) = complex_of_real (a ^ (Suc n - i))
[PROOF STEP]
by (subst powr_nat) auto
[PROOF STATE]
proof (state)
this:
complex_of_real a powr of_nat (Suc n - i) = complex_of_real (a ^ (Suc n - i))

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real a powr (of_nat n - of_nat (i - 1)) = complex_of_real (a ^ (Suc n - i))
[PROOF STEP]
have A: "of_real a powr (of_nat n - of_nat (i - 1)) = \<dots>"
[PROOF STATE]
proof (prove)
using this:
complex_of_real a powr (of_nat n - of_nat (i - 1)) = complex_of_real (a ^ (Suc n - i))

goal (1 subgoal):
 1. complex_of_real a powr (of_nat n - of_nat (i - 1)) = complex_of_real (a ^ (Suc n - i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
complex_of_real a powr (of_nat n - of_nat (i - 1)) = complex_of_real (a ^ (Suc n - i))

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "pochhammer (-of_nat n) (i - 1) = complex_of_real (pochhammer (-real n) (i - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer (- of_nat n) (i - 1) = complex_of_real (pochhammer (- real n) (i - 1))
[PROOF STEP]
by (simp add: pochhammer_of_real [symmetric])
[PROOF STATE]
proof (state)
this:
pochhammer (- of_nat n) (i - 1) = complex_of_real (pochhammer (- real n) (i - 1))

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pochhammer (- of_nat n) (i - 1) = complex_of_real (pochhammer (- real n) (i - 1))

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "pochhammer (-real n) (i - 1) = pochhammer (-of_nat (Suc n)) i / (-1 - real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer (- real n) (i - 1) = pochhammer (- real (Suc n)) i / (- 1 - real n)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
i \<in> {Suc 1..Suc n}

goal (1 subgoal):
 1. pochhammer (- real n) (i - 1) = pochhammer (- real (Suc n)) i / (- 1 - real n)
[PROOF STEP]
by (subst (2) pochhammer_rec_if) auto
[PROOF STATE]
proof (state)
this:
pochhammer (- real n) (i - 1) = pochhammer (- real (Suc n)) i / (- 1 - real n)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pochhammer (- real n) (i - 1) = pochhammer (- real (Suc n)) i / (- 1 - real n)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "-1 - real n = -real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 - real n = - real (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- 1 - real n = - real (Suc n)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
pochhammer (- of_nat n) (i - 1) = complex_of_real (pochhammer (- real (Suc n)) i / - real (Suc n))
[PROOF STEP]
have B: "pochhammer (-of_nat n) (i - 1) =
                    -complex_of_real (pochhammer (-real (Suc n)) i / real (Suc n))"
[PROOF STATE]
proof (prove)
using this:
pochhammer (- of_nat n) (i - 1) = complex_of_real (pochhammer (- real (Suc n)) i / - real (Suc n))

goal (1 subgoal):
 1. pochhammer (- of_nat n) (i - 1) = - complex_of_real (pochhammer (- real (Suc n)) i / real (Suc n))
[PROOF STEP]
by (simp del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
pochhammer (- of_nat n) (i - 1) = - complex_of_real (pochhammer (- real (Suc n)) i / real (Suc n))

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "?lhs i = -complex_of_real (bernoulli i * pochhammer (-real (Suc n)) i / fact i *
                      a ^ (Suc n - i)) / of_nat (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (bernoulli i * pochhammer (- real (Suc n)) i / fact i * a ^ (Suc n - i)) / of_nat (Suc n)
[PROOF STEP]
by (simp only: A B) (simp add: scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (bernoulli i * pochhammer (- real (Suc n)) i / fact i * a ^ (Suc n - i)) / of_nat (Suc n)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (bernoulli i * pochhammer (- real (Suc n)) i / fact i * a ^ (Suc n - i)) / of_nat (Suc n)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "bernoulli i * pochhammer (-real (Suc n)) i / fact i =
                 (real (Suc n) gchoose i) * bernoulli i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli i * pochhammer (- real (Suc n)) i / fact i = (real (Suc n) gchoose i) * bernoulli i
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
i \<in> {Suc 1..Suc n}

goal (1 subgoal):
 1. bernoulli i * pochhammer (- real (Suc n)) i / fact i = (real (Suc n) gchoose i) * bernoulli i
[PROOF STEP]
by (subst gbinomial_pochhammer) (auto simp: minus_one_power_iff bernoulli_odd_eq_0)
[PROOF STATE]
proof (state)
this:
bernoulli i * pochhammer (- real (Suc n)) i / fact i = (real (Suc n) gchoose i) * bernoulli i

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bernoulli i * pochhammer (- real (Suc n)) i / fact i = (real (Suc n) gchoose i) * bernoulli i

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
have "real (Suc n) gchoose i = Suc n choose i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Suc n) gchoose i = real (Suc n choose i)
[PROOF STEP]
by (subst binomial_gbinomial) auto
[PROOF STATE]
proof (state)
this:
real (Suc n) gchoose i = real (Suc n choose i)

goal (2 subgoals):
 1. {2..Suc n} = {Suc 1..Suc n}
 2. \<And>x. x \<in> {Suc 1..Suc n} \<Longrightarrow> (bernoulli x / fact x) *\<^sub>R (pochhammer (- of_nat n) (x - 1) * complex_of_real a powr (of_nat n - of_nat (x - 1))) = - complex_of_real (real (Suc n choose x) * bernoulli x * a ^ (Suc n - x)) / of_nat (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)

goal (1 subgoal):
 1. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1))) = - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)

goal (1 subgoal):
 1. {2..Suc n} = {Suc 1..Suc n}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 2..Suc n. (bernoulli i / fact i) *\<^sub>R (pochhammer (- of_nat n) (i - 1) * complex_of_real a powr (of_nat n - of_nat (i - 1)))) = (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "a ^ n / 2 + sum ?f {Suc 1..Suc n} = sum ?f {1..Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (a ^ n / 2) + (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))
[PROOF STEP]
by (subst (2) sum.atLeast_Suc_atMost) (simp_all add: scaleR_conv_of_real del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
complex_of_real (a ^ n / 2) + (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (a ^ n / 2) + (\<Sum>i = Suc 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "-(a ^ Suc n / of_nat (Suc n)) + sum ?f {1..Suc n} = sum ?f {0..Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (- (a ^ Suc n / real (Suc n))) + (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 0..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))
[PROOF STEP]
by (subst (2) sum.atLeast_Suc_atMost) (simp_all add: scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
complex_of_real (- (a ^ Suc n / real (Suc n))) + (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 0..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real (- (a ^ Suc n / real (Suc n))) + (\<Sum>i = 1..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = (\<Sum>i = 0..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
have "\<dots> = - bernpoly (Suc n) a / of_nat (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
unfolding sum_negf sum_divide_distrib [symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Sum>i = 0..Suc n. complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i))) / of_nat (Suc n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
by (simp add: bernpoly_def atLeast0AtMost)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..Suc n. - complex_of_real (real (Suc n choose i) * bernoulli i * a ^ (Suc n - i)) / of_nat (Suc n)) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))

goal (1 subgoal):
 1. hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hurwitz_zeta a (- of_nat n) = complex_of_real (- bernpoly (Suc n) a / real (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_eq_nat_subst_order:  fixes  A::nat and  B::nat  and  C::nat  and  D::nat  and   E::nat
  assumes "B-C-D > 0" and "A = B-C-D+B"  shows "A = 2*B-C-D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = 2 * B - C - D
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < B - C - D
A = B - C - D + B

goal (1 subgoal):
 1. A = 2 * B - C - D
[PROOF STEP]
by auto


[STATEMENT]
lemma col_map_mat[simp]:
  assumes "j < dim_col A" shows "col (map_mat f A) j = map_vec f (col A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (map_mat f A) j = map_vec f (col A j)
[PROOF STEP]
unfolding map_mat_def map_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (mat (dim_row A) (dim_col A) (\<lambda>ij. f (A $$ ij))) j = vec (dim_vec (col A j)) (\<lambda>i. f (col A j $ i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < dim_col A

goal (1 subgoal):
 1. col (mat (dim_row A) (dim_col A) (\<lambda>ij. f (A $$ ij))) j = vec (dim_vec (col A j)) (\<lambda>i. f (col A j $ i))
[PROOF STEP]
by auto


[STATEMENT]
lemma open_Int_closure_eq_empty: "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> (S \<inter> closure T = {}) = (S \<inter> T = {})
[PROOF STEP]
using open_subset_interior[of S "- T"]
[PROOF STATE]
proof (prove)
using this:
open S \<Longrightarrow> (S \<subseteq> interior (- T)) = (S \<subseteq> - T)

goal (1 subgoal):
 1. open S \<Longrightarrow> (S \<inter> closure T = {}) = (S \<inter> T = {})
[PROOF STEP]
using interior_subset[of "- T"]
[PROOF STATE]
proof (prove)
using this:
open S \<Longrightarrow> (S \<subseteq> interior (- T)) = (S \<subseteq> - T)
interior (- T) \<subseteq> - T

goal (1 subgoal):
 1. open S \<Longrightarrow> (S \<inter> closure T = {}) = (S \<inter> T = {})
[PROOF STEP]
by (auto simp: closure_interior)


[STATEMENT]
lemma ennreal_tendsto_0_iff: "(\<And>n. f n \<ge> 0) \<Longrightarrow> ((\<lambda>n. ennreal (f n)) \<longlonglongrightarrow> 0) \<longleftrightarrow> (f \<longlonglongrightarrow> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. 0 \<le> f n) \<Longrightarrow> (\<lambda>n. ennreal (f n)) \<longlonglongrightarrow> 0 = f \<longlonglongrightarrow> 0
[PROOF STEP]
by (metis (mono_tags) ennreal_0 eventuallyI order_refl tendsto_ennreal_iff)


[STATEMENT]
lemma one_dim_mat_mult_is_scale:
  fixes A B :: "('a::conjugatable_field mat)"
  assumes "B \<in> carrier_mat 1 n"
  shows "(mat 1 1 (\<lambda>k. a)) * B = a \<cdot>\<^sub>m B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 1 1 (\<lambda>k. a) * B = a \<cdot>\<^sub>m B
[PROOF STEP]
apply (rule eq_matI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (a \<cdot>\<^sub>m B); j < dim_col (a \<cdot>\<^sub>m B)\<rbrakk> \<Longrightarrow> (mat 1 1 (\<lambda>k. a) * B) $$ (i, j) = (a \<cdot>\<^sub>m B) $$ (i, j)
 2. dim_row (mat 1 1 (\<lambda>k. a) * B) = dim_row (a \<cdot>\<^sub>m B)
 3. dim_col (mat 1 1 (\<lambda>k. a) * B) = dim_col (a \<cdot>\<^sub>m B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat 1 n

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (a \<cdot>\<^sub>m B); j < dim_col (a \<cdot>\<^sub>m B)\<rbrakk> \<Longrightarrow> (mat 1 1 (\<lambda>k. a) * B) $$ (i, j) = (a \<cdot>\<^sub>m B) $$ (i, j)
 2. dim_row (mat 1 1 (\<lambda>k. a) * B) = dim_row (a \<cdot>\<^sub>m B)
 3. dim_col (mat 1 1 (\<lambda>k. a) * B) = dim_col (a \<cdot>\<^sub>m B)
[PROOF STEP]
by (auto simp add: scalar_prod_def)


[STATEMENT]
lemma tanh_real_lt_1: "tanh (x :: real) < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tanh x < 1
[PROOF STEP]
by (simp add: tanh_def sinh_less_cosh_real)


[STATEMENT]
lemma Max_mono_on: "\<lbrakk> mono_on f A; \<exists>x. x \<in> A; finite A \<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>SetInterval2.mono_on f A; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply (unfold mono_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> Max (f ` A) = f (Max A)
[PROOF STEP]
apply (rule Max_equality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> f (Max A) \<in> f ` A
 2. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> finite (f ` A)
 3. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A; x \<in> f ` A\<rbrakk> \<Longrightarrow> x \<le> f (Max A)
[PROOF STEP]
apply (blast intro: Max_in)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A\<rbrakk> \<Longrightarrow> finite (f ` A)
 2. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A; x \<in> f ` A\<rbrakk> \<Longrightarrow> x \<le> f (Max A)
[PROOF STEP]
apply (rule finite_imageI, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>a\<in>A. \<forall>b\<in>A. a \<le> b \<longrightarrow> f a \<le> f b; \<exists>x. x \<in> A; finite A; x \<in> f ` A\<rbrakk> \<Longrightarrow> x \<le> f (Max A)
[PROOF STEP]
apply (blast intro: Max_in Max_ge)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Suc_Suc_induct: "P 0 \<Longrightarrow> P (Suc 0) \<Longrightarrow> (\<And>n. P n \<Longrightarrow> P (Suc n) \<Longrightarrow> P (Suc (Suc n))) \<Longrightarrow> P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; P (Suc 0); \<And>n. \<lbrakk>P n; P (Suc n)\<rbrakk> \<Longrightarrow> P (Suc (Suc n))\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
by induction_schema (pat_completeness, rule wf_measure[of id], auto)


[STATEMENT]
lemma round_up_less1:
  assumes "x < 1 / 2" "p > 0"
  shows "round_up p x < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
have "x * 2 powr p < 1 / 2 * 2 powr p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * 2 powr real_of_int p < 1 / 2 * 2 powr real_of_int p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x < 1 / 2
0 < p

goal (1 subgoal):
 1. x * 2 powr real_of_int p < 1 / 2 * 2 powr real_of_int p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * 2 powr real_of_int p < 1 / 2 * 2 powr real_of_int p

goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * 2 powr real_of_int p < 1 / 2 * 2 powr real_of_int p

goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
have "\<dots> \<le> 2 powr p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 2 * 2 powr real_of_int p \<le> 2 powr real_of_int p - 1
[PROOF STEP]
using \<open>p > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < p

goal (1 subgoal):
 1. 1 / 2 * 2 powr real_of_int p \<le> 2 powr real_of_int p - 1
[PROOF STEP]
by (auto simp: powr_diff powr_int field_simps self_le_power)
[PROOF STATE]
proof (state)
this:
1 / 2 * 2 powr real_of_int p \<le> 2 powr real_of_int p - 1

goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * 2 powr real_of_int p < 2 powr real_of_int p - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * 2 powr real_of_int p < 2 powr real_of_int p - 1

goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
using \<open>p > 0\<close>
[PROOF STATE]
proof (prove)
using this:
x * 2 powr real_of_int p < 2 powr real_of_int p - 1
0 < p

goal (1 subgoal):
 1. round_up p x < 1
[PROOF STEP]
by (simp add: round_up_def field_simps powr_minus powr_int ceiling_less_iff)
[PROOF STATE]
proof (state)
this:
round_up p x < 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_cSup:
  fixes f :: "'a::conditionally_complete_lattice \<Rightarrow> 'b::conditionally_complete_lattice"
  assumes "bdd_above A" "A \<noteq> {}" "mono f"
  shows "Sup (f`A) \<le> f (Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup (f ` A) \<le> f (Sup A)
[PROOF STEP]
by (metis assms(1) assms(2) assms(3) cSUP_least cSup_upper mono_def)


[STATEMENT]
lemma system_iff:
fixes v::"'b::comm_ring_1 vec"
assumes sq_Q: "dim_row Q = dim_col Q" and v: "dim_row Q = dim_vec v"
shows "(transpose_mat Q *\<^sub>v v = v) \<longleftrightarrow> ((transpose_mat Q - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
have t1:"transpose_mat Q *\<^sub>v v - v = 0\<^sub>v (dim_vec v) \<Longrightarrow> (transpose_mat Q - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v) \<Longrightarrow> (Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v)
[PROOF STEP]
by (subst minus_mult_distrib_mat_vec, insert sq_Q[symmetric] v, auto)
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v) \<Longrightarrow> (Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v)

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
have t2:"(transpose_mat Q - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v) \<Longrightarrow> transpose_mat Q *\<^sub>v v - v = 0\<^sub>v (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v) \<Longrightarrow> Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)
[PROOF STEP]
by (subst (asm) minus_mult_distrib_mat_vec, insert sq_Q[symmetric] v, auto)
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v) \<Longrightarrow> Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
have "transpose_mat Q *\<^sub>v v - v = v - v \<Longrightarrow> transpose_mat Q *\<^sub>v v = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
assume a1: "transpose_mat Q *\<^sub>v v - v = v - v"
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v - v = v - v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
have f2: "transpose_mat Q *\<^sub>v v \<in> carrier_vec (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)
[PROOF STEP]
by (metis dim_mult_mat_vec index_transpose_mat(2) sq_Q v carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)
[PROOF STEP]
have f3: "0\<^sub>v (dim_vec v) + transpose_mat Q *\<^sub>v v = transpose_mat Q *\<^sub>v v"
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)

goal (1 subgoal):
 1. 0\<^sub>v (dim_vec v) + Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v
[PROOF STEP]
by (meson left_zero_vec)
[PROOF STATE]
proof (state)
this:
0\<^sub>v (dim_vec v) + Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
have f4: "0\<^sub>v (dim_vec v) = transpose_mat Q *\<^sub>v v - v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>v (dim_vec v) = Q\<^sup>T *\<^sub>v v - v
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v - v = v - v

goal (1 subgoal):
 1. 0\<^sub>v (dim_vec v) = Q\<^sup>T *\<^sub>v v - v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0\<^sub>v (dim_vec v) = Q\<^sup>T *\<^sub>v v - v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
have f5: "- v \<in> carrier_vec (dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - v \<in> carrier_vec (dim_vec v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- v \<in> carrier_vec (dim_vec v)

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- v \<in> carrier_vec (dim_vec v)
[PROOF STEP]
have f6: "- v + transpose_mat Q *\<^sub>v v = v - v"
[PROOF STATE]
proof (prove)
using this:
- v \<in> carrier_vec (dim_vec v)

goal (1 subgoal):
 1. - v + Q\<^sup>T *\<^sub>v v = v - v
[PROOF STEP]
using f2 a1
[PROOF STATE]
proof (prove)
using this:
- v \<in> carrier_vec (dim_vec v)
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)
Q\<^sup>T *\<^sub>v v - v = v - v

goal (1 subgoal):
 1. - v + Q\<^sup>T *\<^sub>v v = v - v
[PROOF STEP]
using comm_add_vec minus_add_uminus_vec
[PROOF STATE]
proof (prove)
using this:
- v \<in> carrier_vec (dim_vec v)
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)
Q\<^sup>T *\<^sub>v v - v = v - v
\<lbrakk>?v\<^sub>1 \<in> carrier_vec ?n; ?v\<^sub>2 \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> ?v\<^sub>1 + ?v\<^sub>2 = ?v\<^sub>2 + ?v\<^sub>1
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> ?v - ?w = ?v + - ?w

goal (1 subgoal):
 1. - v + Q\<^sup>T *\<^sub>v v = v - v
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
- v + Q\<^sup>T *\<^sub>v v = v - v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
have "v - v = - v + v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v - v = - v + v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v - v = - v + v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v - v = - v + v
[PROOF STEP]
have "transpose_mat Q *\<^sub>v v = transpose_mat Q *\<^sub>v v - v + v"
[PROOF STATE]
proof (prove)
using this:
v - v = - v + v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v
[PROOF STEP]
using f6 f4 f3 f2
[PROOF STATE]
proof (prove)
using this:
v - v = - v + v
- v + Q\<^sup>T *\<^sub>v v = v - v
0\<^sub>v (dim_vec v) = Q\<^sup>T *\<^sub>v v - v
0\<^sub>v (dim_vec v) + Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v
Q\<^sup>T *\<^sub>v v \<in> carrier_vec (dim_vec v)

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v
[PROOF STEP]
by (metis (no_types, lifting) a1 assoc_add_vec comm_add_vec f5 carrier_vec_dim_vec)
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v = Q\<^sup>T *\<^sub>v v - v + v
Q\<^sup>T *\<^sub>v v - v = v - v

goal (1 subgoal):
 1. Q\<^sup>T *\<^sub>v v = v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v = v

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
hence "(transpose_mat Q *\<^sub>v v = v) = ((transpose_mat Q *\<^sub>v v) - v = v - v)"
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v - v = v - v \<Longrightarrow> Q\<^sup>T *\<^sub>v v = v

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = (Q\<^sup>T *\<^sub>v v - v = v - v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v = v) = (Q\<^sup>T *\<^sub>v v - v = v - v)

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v = v) = (Q\<^sup>T *\<^sub>v v - v = v - v)

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
have "... = ((transpose_mat Q *\<^sub>v v) - v = 0\<^sub>v (dim_vec v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v - v = v - v) = (Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v - v = v - v) = (Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v))

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v - v = v - v) = (Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v))

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
have "... = ((transpose_mat Q - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
using t1 t2
[PROOF STATE]
proof (prove)
using this:
Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v) \<Longrightarrow> (Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v)
(Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v) \<Longrightarrow> Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v - v = 0\<^sub>v (dim_vec v)) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))

goal (1 subgoal):
 1. (Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Q\<^sup>T *\<^sub>v v = v) = ((Q\<^sup>T - 1\<^sub>m (dim_row Q)) *\<^sub>v v = 0\<^sub>v (dim_vec v))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem list_dtree_iff_wf_list:
  "wf_list_arcs xs \<and> (\<forall>v \<in> fst ` set xs. set r \<inter> set v = {}) \<and> r \<noteq> [] \<and> wf_list_lverts xs
    \<longleftrightarrow> list_dtree (dtree_from_list r xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (wf_list_arcs xs \<and> (\<forall>v\<in>fst ` set xs. set r \<inter> set v = {}) \<and> r \<noteq> [] \<and> wf_list_lverts xs) = list_dtree (dtree_from_list r xs)
[PROOF STEP]
using wf_darcs_iff_wf_list_arcs wf_dlverts_iff_wf_list_lverts list_dtree_def
[PROOF STATE]
proof (prove)
using this:
wf_list_arcs ?xs = wf_darcs (dtree_from_list ?r ?xs)
((\<forall>v\<in>fst ` set ?xs. set ?r \<inter> set v = {}) \<and> ?r \<noteq> [] \<and> wf_list_lverts ?xs) = wf_dlverts (dtree_from_list ?r ?xs)
list_dtree ?t \<equiv> wf_darcs ?t \<and> wf_dlverts ?t

goal (1 subgoal):
 1. (wf_list_arcs xs \<and> (\<forall>v\<in>fst ` set xs. set r \<inter> set v = {}) \<and> r \<noteq> [] \<and> wf_list_lverts xs) = list_dtree (dtree_from_list r xs)
[PROOF STEP]
by metis


[STATEMENT]
lemma frag_cmul_distrib: "frag_cmul (c+d) a = frag_cmul c a + frag_cmul d a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frag_cmul (c + d) a = frag_cmul c a + frag_cmul d a
[PROOF STEP]
by (simp add: frag_cmul_def plus_poly_mapping_def int_distrib)


[STATEMENT]
lemma smult_scalar_prod_sum:
  fixes x :: "'a :: {comm_ring_1}"
  assumes "vx \<in> carrier_vec n"
  assumes "vy \<in> carrier_vec n"
  shows "(\<Sum> i \<in> {0..<n} .((x \<cdot>\<^sub>v vx) $ i) * ((y \<cdot>\<^sub>v vy) $ i)) = x * y * (vx \<bullet> vy)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
have "\<And> i . i < n \<Longrightarrow> ((x \<cdot>\<^sub>v vx) $ i) * ((y \<cdot>\<^sub>v vy) $ i) = x * y * (vx $ i) * (vy $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i = x * y * vx $ i * vy $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vx \<in> carrier_vec n
vy \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i = x * y * vx $ i * vy $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?i < n \<Longrightarrow> (x \<cdot>\<^sub>v vx) $ ?i * (y \<cdot>\<^sub>v vy) $ ?i = x * y * vx $ ?i * vy $ ?i

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n \<Longrightarrow> (x \<cdot>\<^sub>v vx) $ ?i * (y \<cdot>\<^sub>v vy) $ ?i = x * y * vx $ ?i * vy $ ?i
[PROOF STEP]
have "(\<Sum> i \<in> {0..<n} .((x \<cdot>\<^sub>v vx) $ i) * ((y \<cdot>\<^sub>v vy) $ i)) =
      (\<Sum> i \<in> {0..<n} .x * y * (vx $ i) * (vy $ i))"
[PROOF STATE]
proof (prove)
using this:
?i < n \<Longrightarrow> (x \<cdot>\<^sub>v vx) $ ?i * (y \<cdot>\<^sub>v vy) $ ?i = x * y * vx $ ?i * vy $ ?i

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = (\<Sum>i = 0..<n. x * y * vx $ i * vy $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = (\<Sum>i = 0..<n. x * y * vx $ i * vy $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = (\<Sum>i = 0..<n. x * y * vx $ i * vy $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
have "... = x * y * (\<Sum> i \<in> {0..<n} . (vx $ i) * (vy $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<n. x * y * vx $ i * vy $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)
[PROOF STEP]
using sum_distrib_left[of "x * y" "(\<lambda> i. (vx $ i) * (vy $ i))" "{0..<n}"]
[PROOF STATE]
proof (prove)
using this:
x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i) = (\<Sum>n = 0..<n. x * y * (vx $ n * vy $ n))

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. x * y * vx $ i * vy $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)
[PROOF STEP]
by (metis (no_types, lifting) mult.assoc sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. x * y * vx $ i * vy $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)
[PROOF STEP]
have "(\<Sum> i \<in> {0..<n} .((x \<cdot>\<^sub>v vx) $ i) * ((y \<cdot>\<^sub>v vy) $ i)) = x * y * (vx \<bullet> vy)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
using scalar_prod_def assms
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (\<Sum>i = 0..<n. vx $ i * vy $ i)
?v \<bullet> ?w \<equiv> \<Sum>i = 0..<dim_vec ?w. ?v $ i * ?w $ i
vx \<in> carrier_vec n
vy \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
by (metis carrier_vecD)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)

goal (1 subgoal):
 1. (\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<n. (x \<cdot>\<^sub>v vx) $ i * (y \<cdot>\<^sub>v vy) $ i) = x * y * (vx \<bullet> vy)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fcard_funion_disjoint:
  "A |\<inter>| B = {||} \<Longrightarrow> fcard (A |\<union>| B) = fcard A + fcard B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A |\<inter>| B = {||} \<Longrightarrow> fcard (A |\<union>| B) = fcard A + fcard B
[PROOF STEP]
by transfer (rule card_Un_disjoint)


[STATEMENT]
lemma I_Suc: "I (Suc n) = real (2 * (2*n + 1)) / real (n + 2) * I n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
define u' u v v'
    where "u' = (\<lambda>x. sqrt (4 - x :: real))"
      and "u = (\<lambda>x. -2/3 * (4 - x) powr (3/2 :: real))"
      and "v = (\<lambda>x. x powr (real n + 1/2))"
      and "v' = (\<lambda>x. (real n + 1/2) * x powr (real n - 1/2))"
[PROOF STATE]
proof (state)
this:
u' = (\<lambda>x. sqrt (4 - x))
u = (\<lambda>x. - 2 / 3 * (4 - x) powr (3 / 2))
v = (\<lambda>x. x powr (real n + 1 / 2))
v' = (\<lambda>x. (real n + 1 / 2) * x powr (real n - 1 / 2))

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
define c where "c = -2/3 * (real n + 1/2)"
[PROOF STATE]
proof (state)
this:
c = - 2 / 3 * (real n + 1 / 2)

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
define i where "i = (\<lambda>n x. x powr (real n - 1/2) * sqrt (4 - x) :: real)"
[PROOF STATE]
proof (state)
this:
i = (\<lambda>n x. x powr (real n - 1 / 2) * sqrt (4 - x))

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
have "I (Suc n) = integral {0..4} (\<lambda>x. u' x * v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I (Suc n) = integral {0..4} (\<lambda>x. u' x * v x)
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral {0..4} (\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)) = integral {0..4} (\<lambda>x. u' x * v x)
[PROOF STEP]
by (simp add: algebra_simps u'_def v_def)
[PROOF STATE]
proof (state)
this:
I (Suc n) = integral {0..4} (\<lambda>x. u' x * v x)

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
have "((\<lambda>x. u' x * v x) has_integral - c * (4 * I n - I (Suc n))) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. u' x * v x) has_integral - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
proof (rule integration_by_parts_interior[OF bounded_bilinear_mult])
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. 0 \<le> 4
 2. continuous_on {0..4} ?f
 3. continuous_on {0..4} v
 4. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (?f has_vector_derivative u' x) (at x)
 5. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 6. ((\<lambda>x. ?f x * ?g' x) has_integral ?f 4 * v 4 - ?f 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
show "continuous_on {0..4} u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..4} u
[PROOF STEP]
unfolding u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..4} (\<lambda>x. - 2 / 3 * (4 - x) powr (3 / 2))
[PROOF STEP]
by (intro continuous_on_powr' continuous_on_mult) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on {0..4} u

goal (5 subgoals):
 1. 0 \<le> 4
 2. continuous_on {0..4} v
 3. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (u has_vector_derivative u' x) (at x)
 4. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 5. ((\<lambda>x. u x * ?g' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
show "continuous_on {0..4} v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..4} v
[PROOF STEP]
unfolding v_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on {0..4} (\<lambda>x. x powr (real n + 1 / 2))
[PROOF STEP]
by (intro continuous_on_powr' continuous_on_mult) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on {0..4} v

goal (4 subgoals):
 1. 0 \<le> 4
 2. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (u has_vector_derivative u' x) (at x)
 3. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 4. ((\<lambda>x. u x * ?g' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. 0 \<le> 4
 2. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (u has_vector_derivative u' x) (at x)
 3. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 4. ((\<lambda>x. u x * ?g' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
assume x: "x \<in> {0<..<4}"
[PROOF STATE]
proof (state)
this:
x \<in> {0<..<4}

goal (4 subgoals):
 1. 0 \<le> 4
 2. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (u has_vector_derivative u' x) (at x)
 3. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 4. ((\<lambda>x. u x * ?g' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0<..<4}
[PROOF STEP]
show "(u has_vector_derivative u' x) (at x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<4}

goal (1 subgoal):
 1. (u has_vector_derivative u' x) (at x)
[PROOF STEP]
unfolding has_real_derivative_iff_has_vector_derivative [symmetric] u_def u'_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<4}

goal (1 subgoal):
 1. ((\<lambda>x. - 2 / 3 * (4 - x) powr (3 / 2)) has_real_derivative sqrt (4 - x)) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps powr_half_sqrt)
[PROOF STATE]
proof (state)
this:
(u has_vector_derivative u' x) (at x)

goal (3 subgoals):
 1. 0 \<le> 4
 2. \<And>x. x \<in> {0<..<4} \<Longrightarrow> (v has_vector_derivative ?g' x) (at x)
 3. ((\<lambda>x. u x * ?g' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0<..<4}
[PROOF STEP]
show "(v has_vector_derivative v' x) (at x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<4}

goal (1 subgoal):
 1. (v has_vector_derivative v' x) (at x)
[PROOF STEP]
unfolding has_real_derivative_iff_has_vector_derivative [symmetric] v_def v'_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {0<..<4}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n + 1 / 2)) has_real_derivative (real n + 1 / 2) * x powr (real n - 1 / 2)) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
(v has_vector_derivative v' x) (at x)

goal (2 subgoals):
 1. 0 \<le> 4
 2. ((\<lambda>x. u x * v' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> 4
 2. ((\<lambda>x. u x * v' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
show "((\<lambda>x. u x * v' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. u x * v' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
proof (rule has_integral_spike; (intro ballI)?)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
assume x: "x \<in> {0..4}-{0}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..4} - {0}

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
have "u x * v' x = c * ((4 - x) powr (1 + 1/2) * x powr (real n - 1/2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u x * v' x = c * ((4 - x) powr (1 + 1 / 2) * x powr (real n - 1 / 2))
[PROOF STEP]
by (simp add: u_def v'_def c_def)
[PROOF STATE]
proof (state)
this:
u x * v' x = c * ((4 - x) powr (1 + 1 / 2) * x powr (real n - 1 / 2))

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
u x * v' x = c * ((4 - x) powr (1 + 1 / 2) * x powr (real n - 1 / 2))

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> {0..4} - {0}
[PROOF STEP]
have "(4 - x) powr (1 + 1/2) = (4 - x) * sqrt (4 - x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..4} - {0}

goal (1 subgoal):
 1. (4 - x) powr (1 + 1 / 2) = (4 - x) * sqrt (4 - x)
[PROOF STEP]
by (subst powr_add) (simp_all add: powr_half_sqrt)
[PROOF STATE]
proof (state)
this:
(4 - x) powr (1 + 1 / 2) = (4 - x) * sqrt (4 - x)

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(4 - x) powr (1 + 1 / 2) = (4 - x) * sqrt (4 - x)

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
have "\<dots> * x powr (real n - 1/2) = 4 * sqrt (4 - x) * x powr (real n - 1/2) -
                     sqrt (4 - x) * x powr (real n - 1/2 + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (4 - x) * sqrt (4 - x) * x powr (real n - 1 / 2) = 4 * sqrt (4 - x) * x powr (real n - 1 / 2) - sqrt (4 - x) * x powr (real n - 1 / 2 + 1)
[PROOF STEP]
by (subst powr_add) (insert x, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(4 - x) * sqrt (4 - x) * x powr (real n - 1 / 2) = 4 * sqrt (4 - x) * x powr (real n - 1 / 2) - sqrt (4 - x) * x powr (real n - 1 / 2 + 1)

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(4 - x) * sqrt (4 - x) * x powr (real n - 1 / 2) = 4 * sqrt (4 - x) * x powr (real n - 1 / 2) - sqrt (4 - x) * x powr (real n - 1 / 2 + 1)

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
have "real n - 1/2 + 1 = real (Suc n) - 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n - 1 / 2 + 1 = real (Suc n) - 1 / 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real n - 1 / 2 + 1 = real (Suc n) - 1 / 2

goal (3 subgoals):
 1. negligible ?S1
 2. \<And>x. x \<in> {0..4} - ?S1 \<Longrightarrow> u x * v' x = ?f1 x
 3. (?f1 has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
u x * v' x = c * (4 * sqrt (4 - x) * x powr (real n - 1 / 2) - sqrt (4 - x) * x powr (real (Suc n) - 1 / 2))
[PROOF STEP]
show "u x * v' x = c * (4 * i n x - i (Suc n) x)"
[PROOF STATE]
proof (prove)
using this:
u x * v' x = c * (4 * sqrt (4 - x) * x powr (real n - 1 / 2) - sqrt (4 - x) * x powr (real (Suc n) - 1 / 2))

goal (1 subgoal):
 1. u x * v' x = c * (4 * i n x - i (Suc n) x)
[PROOF STEP]
by (simp add: i_def)
[PROOF STATE]
proof (state)
this:
u x * v' x = c * (4 * i n x - i (Suc n) x)

goal (2 subgoals):
 1. negligible {0}
 2. ((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. negligible {0}
 2. ((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
have "((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral c * (4 * I n - I (Suc n))) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
unfolding i_def I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. c * (4 * (x powr (real n - 1 / 2) * sqrt (4 - x)) - x powr (real (Suc n) - 1 / 2) * sqrt (4 - x))) has_integral c * (4 * integral {0..4} (\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x)) - integral {0..4} (\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)))) {0..4}
[PROOF STEP]
by (intro has_integral_mult_right has_integral_diff integrable_integral integrable_I)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral c * (4 * I n - I (Suc n))) {0..4}

goal (2 subgoals):
 1. negligible {0}
 2. ((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
thus "((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral  u 4 * v 4 - u 0 * v 0 - -
               c * (4 * I n - I (Suc n))) {0..4}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. ((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
by (simp add: u_def v_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. c * (4 * i n x - i (Suc n) x)) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. negligible {0}
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. u x * v' x) has_integral u 4 * v 4 - u 0 * v 0 - - c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. 0 \<le> 4
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
((\<lambda>x. u' x * v x) has_integral - c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. u' x * v x) has_integral - c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
have "(\<lambda>x. u' x * v x) = i (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. u' x * v x) = i (Suc n)
[PROOF STEP]
by (rule ext) (simp add: u'_def v_def i_def algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. u' x * v x) = i (Suc n)

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(i (Suc n) has_integral - c * (4 * I n - I (Suc n))) {0..4}
[PROOF STEP]
have "I (Suc n) = - c * (4 * I n - I (Suc n))"
[PROOF STATE]
proof (prove)
using this:
(i (Suc n) has_integral - c * (4 * I n - I (Suc n))) {0..4}

goal (1 subgoal):
 1. I (Suc n) = - c * (4 * I n - I (Suc n))
[PROOF STEP]
unfolding I_def i_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)) has_integral - c * (4 * integral {0..4} (\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x)) - integral {0..4} (\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)))) {0..4}

goal (1 subgoal):
 1. integral {0..4} (\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)) = - c * (4 * integral {0..4} (\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x)) - integral {0..4} (\<lambda>x. x powr (real (Suc n) - 1 / 2) * sqrt (4 - x)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
I (Suc n) = - c * (4 * I n - I (Suc n))

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
hence "(1 - c) * I (Suc n) = -4 * c * I n"
[PROOF STATE]
proof (prove)
using this:
I (Suc n) = - c * (4 * I n - I (Suc n))

goal (1 subgoal):
 1. (1 - c) * I (Suc n) = - 4 * c * I n
[PROOF STEP]
by algebra
[PROOF STATE]
proof (state)
this:
(1 - c) * I (Suc n) = - 4 * c * I n

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
hence "I (Suc n) = (-4 * c) / (1 - c) * I n"
[PROOF STATE]
proof (prove)
using this:
(1 - c) * I (Suc n) = - 4 * c * I n

goal (1 subgoal):
 1. I (Suc n) = - 4 * c / (1 - c) * I n
[PROOF STEP]
by (simp add: field_simps c_def)
[PROOF STATE]
proof (state)
this:
I (Suc n) = - 4 * c / (1 - c) * I n

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
I (Suc n) = - 4 * c / (1 - c) * I n

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
have "(-4 * c) / (1 - c) = real (2*(2*n + 1)) / real (n + 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 4 * c / (1 - c) = real (2 * (2 * n + 1)) / real (n + 2)
[PROOF STEP]
by (simp add: c_def field_simps)
[PROOF STATE]
proof (state)
this:
- 4 * c / (1 - c) = real (2 * (2 * n + 1)) / real (n + 2)

goal (1 subgoal):
 1. I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
I (Suc n) = real (2 * (2 * n + 1)) / real (n + 2) * I n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_nat_from_nat_id:
  assumes i: "i < CARD('a :: finite)"
  shows "to_nat (from_nat i :: 'a) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_nat (from_nat i) = i
[PROOF STEP]
unfolding to_nat_def from_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list) = i
[PROOF STEP]
proof (rule some_equality, simp)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < length univ_list
 2. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
have l: "length (univ_list::'a list) = card (set (univ_list::'a list))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length univ_list = card (set univ_list)
[PROOF STEP]
by (rule distinct_card[symmetric], simp add: univ_list)
[PROOF STATE]
proof (state)
this:
length univ_list = card (set univ_list)

goal (2 subgoals):
 1. i < length univ_list
 2. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
thus i2: "i < length (univ_list::'a list)"
[PROOF STATE]
proof (prove)
using this:
length univ_list = card (set univ_list)

goal (1 subgoal):
 1. i < length univ_list
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
length univ_list = card (set univ_list)
i < CARD('a)

goal (1 subgoal):
 1. i < length univ_list
[PROOF STEP]
unfolding univ_list
[PROOF STATE]
proof (prove)
using this:
length univ_list = CARD('a)
i < CARD('a)

goal (1 subgoal):
 1. i < length univ_list
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < length univ_list

goal (1 subgoal):
 1. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
assume n: "(univ_list::'a list) ! n = (univ_list::'a list) ! i \<and> n < length (univ_list::'a list)"
[PROOF STATE]
proof (state)
this:
univ_list ! n = univ_list ! i \<and> n < length univ_list

goal (1 subgoal):
 1. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
have d: "distinct (univ_list::'a list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct univ_list
[PROOF STEP]
using univ_list
[PROOF STATE]
proof (prove)
using this:
distinct univ_list
set univ_list = UNIV

goal (1 subgoal):
 1. distinct univ_list
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct univ_list

goal (1 subgoal):
 1. \<And>ia. univ_list ! ia = univ_list ! i \<and> ia < length univ_list \<Longrightarrow> ia = i
[PROOF STEP]
show "n = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = i
[PROOF STEP]
using nth_eq_iff_index_eq[OF d _ i2] n
[PROOF STATE]
proof (prove)
using this:
?i < length univ_list \<Longrightarrow> (univ_list ! ?i = univ_list ! i) = (?i = i)
univ_list ! n = univ_list ! i \<and> n < length univ_list

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_equality: "\<lbrakk> (k::'a::linorder) \<in> A; finite A; \<And>x. x \<in> A \<Longrightarrow> x \<le> k \<rbrakk> \<Longrightarrow>
  Max A = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<in> A; finite A; \<And>x. x \<in> A \<Longrightarrow> x \<le> k\<rbrakk> \<Longrightarrow> Max A = k
[PROOF STEP]
by (rule Max_eqI)


[STATEMENT]
lemma comm_scalar_prod: assumes "(v\<^sub>1 :: 'a :: comm_semiring_0 vec) \<in> carrier_vec n" "v\<^sub>2 \<in> carrier_vec n"
  shows "v\<^sub>1 \<bullet> v\<^sub>2 = v\<^sub>2 \<bullet> v\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v\<^sub>1 \<bullet> v\<^sub>2 = v\<^sub>2 \<bullet> v\<^sub>1
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec v\<^sub>2. v\<^sub>1 $ i * v\<^sub>2 $ i) = (\<Sum>i = 0..<dim_vec v\<^sub>1. v\<^sub>2 $ i * v\<^sub>1 $ i)
[PROOF STEP]
by (rule sum.cong, insert assms, auto simp: ac_simps)


[STATEMENT]
lemma gbinomial_Vandermonde:
  "sum (\<lambda>k. (a gchoose k) * (b gchoose (n - k))) {0..n} = (a + b) gchoose n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
let ?ba = "fps_binomial a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
let ?bb = "fps_binomial b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
let ?bab = "fps_binomial (a + b)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
from fps_binomial_add_mult[of a b]
[PROOF STATE]
proof (chain)
picking this:
fps_binomial (a + b) = fps_binomial a * fps_binomial b
[PROOF STEP]
have "?bab $ n = (?ba * ?bb)$n"
[PROOF STATE]
proof (prove)
using this:
fps_binomial (a + b) = fps_binomial a * fps_binomial b

goal (1 subgoal):
 1. fps_binomial (a + b) $ n = (fps_binomial a * fps_binomial b) $ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fps_binomial (a + b) $ n = (fps_binomial a * fps_binomial b) $ n

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_binomial (a + b) $ n = (fps_binomial a * fps_binomial b) $ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_binomial (a + b) $ n = (fps_binomial a * fps_binomial b) $ n

goal (1 subgoal):
 1. (\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n
[PROOF STEP]
by (simp add: fps_mult_nth)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..n. (a gchoose k) * (b gchoose (n - k))) = a + b gchoose n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<psi>_eq:
  "\<psi> = ccos (\<theta> / 2) \<cdot>\<^sub>v \<alpha> + csin (\<theta> / 2) \<cdot>\<^sub>v \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> = complex_of_real (cos (\<theta> / 2)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sin (\<theta> / 2)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
apply (simp add: cos_theta_div_2 sin_theta_div_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> = complex_of_real (sqrt (real (N - M) / real N)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sqrt (real M / real N)) \<cdot>\<^sub>v \<beta>
[PROOF STEP]
apply (rule eq_vecI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (complex_of_real (sqrt (real (N - M) / real N)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sqrt (real M / real N)) \<cdot>\<^sub>v \<beta>) \<Longrightarrow> \<psi> $ i = (complex_of_real (sqrt (real (N - M) / real N)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sqrt (real M / real N)) \<cdot>\<^sub>v \<beta>) $ i
 2. dim_vec \<psi> = dim_vec (complex_of_real (sqrt (real (N - M) / real N)) \<cdot>\<^sub>v \<alpha> + complex_of_real (sqrt (real M / real N)) \<cdot>\<^sub>v \<beta>)
[PROOF STEP]
by (auto simp add: \<alpha>_def \<beta>_def \<psi>_def real_sqrt_divide)


[STATEMENT]
lemma square_prod_cmod[simp]:
  "(cmod (a * b))^2 = cmod a ^ 2 * cmod b ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (a * b))\<^sup>2 = (cmod a)\<^sup>2 * (cmod b)\<^sup>2
[PROOF STEP]
by (simp add: norm_mult power_mult_distrib)


[STATEMENT]
lemma Longest_common_prefix_eq:
 "\<lbrakk> L \<noteq> {};  \<forall>xs \<in> L. prefix ps xs;
    \<forall>qs. (\<forall>xs \<in> L. prefix qs xs) \<longrightarrow> size qs \<le> size ps \<rbrakk>
  \<Longrightarrow> Longest_common_prefix L = ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L \<noteq> {}; \<forall>xs\<in>L. prefix ps xs; \<forall>qs. (\<forall>xs\<in>L. prefix qs xs) \<longrightarrow> length qs \<le> length ps\<rbrakk> \<Longrightarrow> Longest_common_prefix L = ps
[PROOF STEP]
unfolding Longest_common_prefix_def arg_max_def is_arg_max_linorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>L \<noteq> {}; \<forall>xs\<in>L. prefix ps xs; \<forall>qs. (\<forall>xs\<in>L. prefix qs xs) \<longrightarrow> length qs \<le> length ps\<rbrakk> \<Longrightarrow> (SOME x. Ball L (prefix x) \<and> (\<forall>y. Ball L (prefix y) \<longrightarrow> length y \<le> length x)) = ps
[PROOF STEP]
by(rule some1_equality[OF Longest_common_prefix_unique]) auto


[STATEMENT]
lemma sub_mset_sums[simp]: "sub_mset_sums xs = sum_mset ` { ys. ys \<subseteq># mset xs }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_mset_sums xs = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs}
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sub_mset_sums [] = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset []}
 2. \<And>a xs. sub_mset_sums xs = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} \<Longrightarrow> sub_mset_sums (a # xs) = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset (a # xs)}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
sub_mset_sums xs = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs}

goal (2 subgoals):
 1. sub_mset_sums [] = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset []}
 2. \<And>a xs. sub_mset_sums xs = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} \<Longrightarrow> sub_mset_sums (a # xs) = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset (a # xs)}
[PROOF STEP]
have id: "{ys. ys \<subseteq># mset (x # xs)} = {ys. ys \<subseteq># mset xs} \<union> {add_mset x ys | ys. ys \<subseteq># mset xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ys. ys \<subseteq># mset (x # xs)} = {ys. ys \<subseteq># mset xs} \<union> {add_mset x ys |ys. ys \<subseteq># mset xs}
[PROOF STEP]
unfolding mset.simps subset_add_mset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ys. ys \<subseteq># mset xs \<or> (\<exists>xs. xs \<subseteq># mset xs \<and> ys = add_mset x xs)} = {ys. ys \<subseteq># mset xs} \<union> {add_mset x ys |ys. ys \<subseteq># mset xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{ys. ys \<subseteq># mset (x # xs)} = {ys. ys \<subseteq># mset xs} \<union> {add_mset x ys |ys. ys \<subseteq># mset xs}

goal (2 subgoals):
 1. sub_mset_sums [] = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset []}
 2. \<And>a xs. sub_mset_sums xs = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} \<Longrightarrow> sub_mset_sums (a # xs) = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset (a # xs)}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sub_mset_sums (x # xs) = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset (x # xs)}
[PROOF STEP]
unfolding sub_mset_sums.simps Let_def Cons id image_Un
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} \<union> (+) x ` \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset xs} \<union> \<Sum>\<^sub># ` {add_mset x ys |ys. ys \<subseteq># mset xs}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sub_mset_sums (x # xs) = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset (x # xs)}

goal (1 subgoal):
 1. sub_mset_sums [] = \<Sum>\<^sub># ` {ys. ys \<subseteq># mset []}
[PROOF STEP]
qed auto


[STATEMENT]
lemma \<psi>\<^sub>1\<^sub>0_values:
  fixes i j n
  assumes "i < dim_row (\<psi>\<^sub>1\<^sub>0 n)" and "j < dim_col (\<psi>\<^sub>1\<^sub>0 n)"
  shows "(\<psi>\<^sub>1\<^sub>0 n) $$ (i,j) = 1/(sqrt 2)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)) $$ (i, j) = complex_of_real (1 / sqrt 2 ^ n)
[PROOF STEP]
using assms case_prod_conv
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)))
j < dim_col (Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)))
(case (?a, ?b) of (c, d) \<Rightarrow> ?f c d) = ?f ?a ?b

goal (1 subgoal):
 1. Matrix.mat (2 ^ n) 1 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> 1 / sqrt 2 ^ n)) $$ (i, j) = complex_of_real (1 / sqrt 2 ^ n)
[PROOF STEP]
by simp


[STATEMENT]
lemma has_measure_limit:
  assumes "S \<in> lmeasurable" "e > 0"
  obtains B where "B > 0"
    "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> \<bar>measure lebesgue (S \<inter> cbox a b) - measure lebesgue S\<bar> < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b. ball (0::'a) B \<subseteq> cbox a b \<Longrightarrow> \<bar>Sigma_Algebra.measure lebesgue (S \<inter> cbox a b) - Sigma_Algebra.measure lebesgue S\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<in> lmeasurable
0 < e

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b. ball (0::'a) B \<subseteq> cbox a b \<Longrightarrow> \<bar>Sigma_Algebra.measure lebesgue (S \<inter> cbox a b) - Sigma_Algebra.measure lebesgue S\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding lmeasurable_iff_has_integral has_integral_alt'
[PROOF STATE]
proof (prove)
using this:
(\<forall>a b. (\<lambda>x. if x \<in> UNIV then indicat_real S x else 0) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'a) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> UNIV then indicat_real S x else 0) - Sigma_Algebra.measure lebesgue S) < e)
0 < e

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b. ball (0::'a) B \<subseteq> cbox a b \<Longrightarrow> \<bar>Sigma_Algebra.measure lebesgue (S \<inter> cbox a b) - Sigma_Algebra.measure lebesgue S\<bar> < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: integral_indicator integrable_on_indicator)