[STATEMENT]
lemma vonStaudt_Clausen_lemma:
  assumes "n > 0" and "prime p"
  shows   "[(\<Sum>m<p. (-1) ^ m * ((p - 1) choose m) * m ^ (2*n)) =
              (if (p - 1) dvd (2 * n) then -1 else 0)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
proof (cases "(p - 1) dvd (2 * n)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p - 1 dvd 2 * n

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have cong_power_2n: "[m ^ (2 * n) = 1] (mod p)" if "m > 0" "m < p" for m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
p - 1 dvd 2 * n
[PROOF STEP]
obtain q where "2 * n = (p - 1) * q"
[PROOF STATE]
proof (prove)
using this:
p - 1 dvd 2 * n

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

goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
hence "[m ^ (2 * n) = (m ^ (p - 1)) ^ q] (mod p)"
[PROOF STATE]
proof (prove)
using this:
2 * n = (p - 1) * q

goal (1 subgoal):
 1. [m ^ (2 * n) = (m ^ (p - 1)) ^ q] (mod p)
[PROOF STEP]
by (simp add: power_mult)
[PROOF STATE]
proof (state)
this:
[m ^ (2 * n) = (m ^ (p - 1)) ^ q] (mod p)

goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[m ^ (2 * n) = (m ^ (p - 1)) ^ q] (mod p)

goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
have "[(m ^ (p - 1)) ^ q = 1 ^ q] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(m ^ (p - 1)) ^ q = 1 ^ q] (mod p)
[PROOF STEP]
using assms \<open>m > 0\<close> \<open>m < p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
0 < m
m < p

goal (1 subgoal):
 1. [(m ^ (p - 1)) ^ q = 1 ^ q] (mod p)
[PROOF STEP]
by (intro cong_pow fermat_theorem) auto
[PROOF STATE]
proof (state)
this:
[(m ^ (p - 1)) ^ q = 1 ^ q] (mod p)

goal (1 subgoal):
 1. [m ^ (2 * n) = 1] (mod p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[m ^ (2 * n) = 1 ^ q] (mod p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[m ^ (2 * n) = 1 ^ q] (mod p)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?m; ?m < p\<rbrakk> \<Longrightarrow> [?m ^ (2 * n) = 1] (mod p)

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "(\<Sum>m<p. (-1)^m * ((p - 1) choose m) * m ^ (2*n)) =
          (\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * m ^ (2*n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))
[PROOF STEP]
by (intro sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "[\<dots> = (\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * int 1)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1] (mod int p)
[PROOF STEP]
by (intro cong_sum cong_mult cong_power_2n cong_int) auto
[PROOF STATE]
proof (state)
this:
[\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1] (mod int p)

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1] (mod int p)

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "(\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * int 1) =
               (\<Sum>m\<in>insert 0 {0<..<p}. (-1)^m * ((p - 1) choose m)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1) = (\<Sum>m\<in>insert 0 {0<..<p}. (- 1) ^ m * int (p - 1 choose m)) - 1
[PROOF STEP]
by (subst sum.insert) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1) = (\<Sum>m\<in>insert 0 {0<..<p}. (- 1) ^ m * int (p - 1 choose m)) - 1

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int 1) = (\<Sum>m\<in>insert 0 {0<..<p}. (- 1) ^ m * int (p - 1 choose m)) - 1

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "insert 0 {0<..<p} = {..p-1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert 0 {0<..<p} = {..p - 1}
[PROOF STEP]
using assms prime_gt_0_nat[of p]
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
prime p \<Longrightarrow> 0 < p

goal (1 subgoal):
 1. insert 0 {0<..<p} = {..p - 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert 0 {0<..<p} = {..p - 1}

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
insert 0 {0<..<p} = {..p - 1}

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "(\<Sum>m\<le>p-1. (-1)^m * ((p - 1) choose m)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m)) = 0
[PROOF STEP]
using prime_gt_1_nat[of p] assms
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 1 < p
0 < n
prime p

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m)) = 0
[PROOF STEP]
by (subst choose_alternating_sum) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m)) = 0

goal (2 subgoals):
 1. p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
 2. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0 - 1] (mod int p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0 - 1] (mod int p)

goal (1 subgoal):
 1. [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0 - 1] (mod int p)
p - 1 dvd 2 * n

goal (1 subgoal):
 1. [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> p - 1 dvd 2 * n

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
define n' where "n' = (2 * n) mod (p - 1)"
[PROOF STATE]
proof (state)
this:
n' = 2 * n mod (p - 1)

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
from assms False
[PROOF STATE]
proof (chain)
picking this:
0 < n
prime p
\<not> p - 1 dvd 2 * n
[PROOF STEP]
have "n' > 0"
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
\<not> p - 1 dvd 2 * n

goal (1 subgoal):
 1. 0 < n'
[PROOF STEP]
by (auto simp: n'_def dvd_eq_mod_eq_0)
[PROOF STATE]
proof (state)
this:
0 < n'

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> p - 1 dvd 2 * n
[PROOF STEP]
have "p \<noteq> 2"
[PROOF STATE]
proof (prove)
using this:
\<not> p - 1 dvd 2 * n

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

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
prime p
p \<noteq> 2
[PROOF STEP]
have "odd p"
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
p \<noteq> 2

goal (1 subgoal):
 1. odd p
[PROOF STEP]
using prime_prime_factor two_is_prime_nat
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
p \<noteq> 2
prime ?n = (?n \<noteq> 1 \<and> (\<forall>p. prime p \<and> p dvd ?n \<longrightarrow> p = ?n))
prime 2

goal (1 subgoal):
 1. odd p
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
odd p

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have cong_pow_2n: "[m ^ (2*n) = m ^ n'] (mod p)" if "m > 0" "m < p" for m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
from assms and that
[PROOF STATE]
proof (chain)
picking this:
0 < n
prime p
0 < m
m < p
[PROOF STEP]
have "coprime p m"
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
0 < m
m < p

goal (1 subgoal):
 1. coprime p m
[PROOF STEP]
by (intro prime_imp_coprime) auto
[PROOF STATE]
proof (state)
this:
coprime p m

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
have "[2 * n = n'] (mod (p - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [2 * n = n'] (mod p - 1)
[PROOF STEP]
by (simp add: n'_def)
[PROOF STATE]
proof (state)
this:
[2 * n = n'] (mod p - 1)

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
[2 * n = n'] (mod p - 1)

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
have "ord p m dvd (p - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord p m dvd p - 1
[PROOF STEP]
using order_divides_totient[of p m] \<open>coprime p m\<close> assms
[PROOF STATE]
proof (prove)
using this:
coprime p m \<Longrightarrow> ord p m dvd totient p
coprime p m
0 < n
prime p

goal (1 subgoal):
 1. ord p m dvd p - 1
[PROOF STEP]
by (auto simp: totient_prime)
[PROOF STATE]
proof (state)
this:
ord p m dvd p - 1

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
[2 * n = n'] (mod p - 1)
ord p m dvd p - 1
[PROOF STEP]
have "[2 * n = n'] (mod ord p m)"
[PROOF STATE]
proof (prove)
using this:
[2 * n = n'] (mod p - 1)
ord p m dvd p - 1

goal (1 subgoal):
 1. [2 * n = n'] (mod ord p m)
[PROOF STEP]
by (rule cong_dvd_modulus_nat)
[PROOF STATE]
proof (state)
this:
[2 * n = n'] (mod ord p m)

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[2 * n = n'] (mod ord p m)

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
using \<open>coprime p m\<close>
[PROOF STATE]
proof (prove)
using this:
[2 * n = n'] (mod ord p m)
coprime p m

goal (1 subgoal):
 1. [m ^ (2 * n) = m ^ n'] (mod p)
[PROOF STEP]
by (subst order_divides_expdiff) auto
[PROOF STATE]
proof (state)
this:
[m ^ (2 * n) = m ^ n'] (mod p)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 < ?m; ?m < p\<rbrakk> \<Longrightarrow> [?m ^ (2 * n) = ?m ^ n'] (mod p)

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "(\<Sum>m<p. (-1)^m * ((p - 1) choose m) * m ^ (2*n)) =
          (\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * m ^ (2*n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. (\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))
[PROOF STEP]
by (intro sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n))) = (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "[\<dots> = (\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * m ^ n')] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')] (mod int p)
[PROOF STEP]
by (intro cong_sum cong_mult cong_pow_2n cong_int) auto
[PROOF STATE]
proof (state)
this:
[\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')] (mod int p)

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = \<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')] (mod int p)

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "(\<Sum>m\<in>{0<..<p}. (-1)^m * ((p - 1) choose m) * m ^ n') =
               (\<Sum>m\<le>p-1. (-1)^m * ((p - 1) choose m) * m ^ n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n'))
[PROOF STEP]
using \<open>n' > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n'

goal (1 subgoal):
 1. (\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n'))
[PROOF STEP]
by (intro sum.mono_neutral_left) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n'))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<in>{0<..<p}. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n'))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "\<dots> = (\<Sum>m\<le>p-1. (-1)^(p - Suc m) * ((p - 1) choose m) * m ^ n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n'))
[PROOF STEP]
using \<open>n' > 0\<close> assms \<open>odd p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n'
0 < n
prime p
odd p

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n'))
[PROOF STEP]
by (intro sum.cong) (auto simp: uminus_power_if)
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n'))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>p - 1. (- 1) ^ m * int (p - 1 choose m) * int (m ^ n')) = (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n'))

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
have "of_int (\<Sum>m\<le>p-1. (-1)^(p - Suc m) * ((p - 1) choose m) * m ^ n') =
            real (Stirling n' (p - 1)) * fact (p - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = real (Stirling n' (p - 1)) * fact (p - 1)
[PROOF STEP]
by (simp add: Stirling_closed_form)
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = real (Stirling n' (p - 1)) * fact (p - 1)

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real_of_int (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = real (Stirling n' (p - 1)) * fact (p - 1)

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
have "n' < p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n' < p - 1
[PROOF STEP]
using assms prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. n' < p - 1
[PROOF STEP]
by (auto simp: n'_def)
[PROOF STATE]
proof (state)
this:
n' < p - 1

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
hence "Stirling n' (p - 1) = 0"
[PROOF STATE]
proof (prove)
using this:
n' < p - 1

goal (1 subgoal):
 1. Stirling n' (p - 1) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Stirling n' (p - 1) = 0

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real_of_int (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = real 0 * fact (p - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = real 0 * fact (p - 1)

goal (1 subgoal):
 1. (\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>m\<le>p - 1. (- 1) ^ (p - Suc m) * int (p - 1 choose m) * int (m ^ n')) = 0

goal (1 subgoal):
 1. \<not> p - 1 dvd 2 * n \<Longrightarrow> [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0] (mod int p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0] (mod int p)

goal (1 subgoal):
 1. [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int (m ^ (2 * n)) = 0] (mod int p)
\<not> p - 1 dvd 2 * n

goal (1 subgoal):
 1. [\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[\<Sum>m<p. (- 1) ^ m * int (p - 1 choose m) * int m ^ (2 * n) = if p - 1 dvd 2 * n then - 1 else 0] (mod int p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_iff_bounded:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  shows "integrable M f \<longleftrightarrow> f \<in> borel_measurable M \<and> (\<integral>\<^sup>+x. norm (f x) \<partial>M) < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f = (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>)
[PROOF STEP]
using integrableI_bounded[of f M] has_bochner_integral_implies_finite_norm[of M f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> integrable M f
has_bochner_integral M f ?x \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (1 subgoal):
 1. integrable M f = (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>)
[PROOF STEP]
unfolding integrable.simps has_bochner_integral.simps[abs_def]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f \<in> borel_measurable M; \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>\<rbrakk> \<Longrightarrow> \<exists>x s. f \<in> borel_measurable M \<and> (\<forall>x. simple_bochner_integrable M (s x)) \<and> (\<lambda>i. \<integral>\<^sup>+ x. ennreal (norm (f x - s i x)) \<partial>M) \<longlonglongrightarrow> 0 \<and> (\<lambda>i. simple_bochner_integral M (s i)) \<longlonglongrightarrow> x
\<exists>s. f \<in> borel_measurable M \<and> (\<forall>x. simple_bochner_integrable M (s x)) \<and> (\<lambda>i. \<integral>\<^sup>+ x. ennreal (norm (f x - s i x)) \<partial>M) \<longlonglongrightarrow> 0 \<and> (\<lambda>i. simple_bochner_integral M (s i)) \<longlonglongrightarrow> ?x \<Longrightarrow> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>

goal (1 subgoal):
 1. (\<exists>x s. f \<in> borel_measurable M \<and> (\<forall>x. simple_bochner_integrable M (s x)) \<and> (\<lambda>i. \<integral>\<^sup>+ x. ennreal (norm (f x - s i x)) \<partial>M) \<longlonglongrightarrow> 0 \<and> (\<lambda>i. simple_bochner_integral M (s i)) \<longlonglongrightarrow> x) = (f \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M < \<infinity>)
[PROOF STEP]
by auto


[STATEMENT]
lemma of_nat_ge_zero[intro,simp]: "of_nat n \<ge> (0 :: 'a :: ordered_semiring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> of_nat n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0::'a) \<le> of_nat 0
 2. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (0::'a) \<le> of_nat 0
 2. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> of_nat 0
[PROOF STEP]
by (simp add: ge_refl)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> of_nat 0

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> of_nat n

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
from plus_right_mono[OF Suc, of 1]
[PROOF STATE]
proof (chain)
picking this:
(1::'a) + (0::'a) \<le> (1::'a) + of_nat n
[PROOF STEP]
have "of_nat (Suc n) \<ge> (1 :: 'a)"
[PROOF STATE]
proof (prove)
using this:
(1::'a) + (0::'a) \<le> (1::'a) + of_nat n

goal (1 subgoal):
 1. (1::'a) \<le> of_nat (Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(1::'a) \<le> of_nat (Suc n)

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) \<le> of_nat (Suc n)

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
have "(1 :: 'a) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> (1::'a)
[PROOF STEP]
using one_ge_zero
[PROOF STATE]
proof (prove)
using this:
(0::?'a) \<le> (1::?'a)

goal (1 subgoal):
 1. (0::'a) \<le> (1::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> (1::'a)

goal (1 subgoal):
 1. \<And>n. (0::'a) \<le> of_nat n \<Longrightarrow> (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> of_nat (Suc n)

goal (1 subgoal):
 1. (0::'a) \<le> of_nat (Suc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> of_nat (Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma harmonic_bound:
  shows "1 / 2 ^(Suc n) < 1 / real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 2 ^ Suc n < 1 / real (Suc n)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 / 2 ^ Suc 0 < 1 / real (Suc 0)
 2. \<And>n. 1 / 2 ^ Suc n < 1 / real (Suc n) \<Longrightarrow> 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 1 / 2 ^ Suc 0 < 1 / real (Suc 0)
 2. \<And>n. 1 / 2 ^ Suc n < 1 / real (Suc n) \<Longrightarrow> 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 2 ^ Suc 0 < 1 / real (Suc 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / 2 ^ Suc 0 < 1 / real (Suc 0)

goal (1 subgoal):
 1. \<And>n. 1 / 2 ^ Suc n < 1 / real (Suc n) \<Longrightarrow> 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 1 / 2 ^ Suc n < 1 / real (Suc n) \<Longrightarrow> 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
1 / 2 ^ Suc n < 1 / real (Suc n)

goal (1 subgoal):
 1. \<And>n. 1 / 2 ^ Suc n < 1 / real (Suc n) \<Longrightarrow> 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 / 2 ^ Suc n < 1 / real (Suc n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 / 2 ^ Suc n < 1 / real (Suc n)

goal (1 subgoal):
 1. 1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))
[PROOF STEP]
by (smt frac_less2 of_nat_0_less_iff of_nat_less_two_power zero_less_Suc)
[PROOF STATE]
proof (state)
this:
1 / 2 ^ Suc (Suc n) < 1 / real (Suc (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_rel_interior: "openin (top_of_set (affine hull S)) (rel_interior S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
[PROOF STEP]
using openin_subopen
[PROOF STATE]
proof (prove)
using this:
openin ?U ?S = (\<forall>x\<in>?S. \<exists>T. openin ?U T \<and> x \<in> T \<and> T \<subseteq> ?S)

goal (1 subgoal):
 1. openin (top_of_set (affine hull S)) (rel_interior S)
[PROOF STEP]
by (fastforce simp add: rel_interior_def)


[STATEMENT]
lemma changes_replicate_0: shows "changes (replicate n 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. changes (replicate n (0::'a)) = 0
[PROOF STEP]
apply (induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. changes (replicate 0 (0::'a)) = 0
 2. \<And>n. changes (replicate n (0::'a)) = 0 \<Longrightarrow> changes (replicate (Suc n) (0::'a)) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_mv_inv:
  assumes "x =  A *\<^sub>m\<^sub>v y" and "mat_det A \<noteq> 0"
  shows "y = (mat_inv A) *\<^sub>m\<^sub>v x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = mat_inv A *\<^sub>m\<^sub>v x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x = A *\<^sub>m\<^sub>v y
mat_det A \<noteq> 0

goal (1 subgoal):
 1. y = mat_inv A *\<^sub>m\<^sub>v x
[PROOF STEP]
by (cases y) (simp add: mat_inv_l)


[STATEMENT]
lemma sum_eq: "(\<And> i. i < x \<Longrightarrow> f i = g i)
                    \<Longrightarrow> (\<Sum>i=0..<(x::nat). f i) = (\<Sum>i=0..<x. g i) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i < x \<Longrightarrow> f i = g i) \<Longrightarrow> sum f {0..<x} = sum g {0..<x}
[PROOF STEP]
by(induction x) (auto simp add: algebra_simps)


[STATEMENT]
lemma map_of_sunion_with:
  "\<lbrakk> sorted (map fst xs); sorted (map fst ys) \<rbrakk>
  \<Longrightarrow> map_of (sunion_with f xs ys) k =
  (case map_of xs k of None \<Rightarrow> map_of ys k
  | Some v \<Rightarrow> case map_of ys k of None \<Rightarrow> Some v
              | Some w \<Rightarrow> Some (f k v w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted (map fst xs); sorted (map fst ys)\<rbrakk> \<Longrightarrow> map_of (sunion_with f xs ys) k = (case map_of xs k of None \<Rightarrow> map_of ys k | Some v \<Rightarrow> case map_of ys k of None \<Rightarrow> Some v | Some w \<Rightarrow> Some (f k v w))
[PROOF STEP]
by(induct f xs ys rule: sunion_with.induct)(auto split: option.split dest: map_of_SomeD bspec)


[STATEMENT]
theorem product_of_chord_segments:
  fixes S\<^sub>1 T\<^sub>1 S\<^sub>2 T\<^sub>2 X C :: "'a :: euclidean_space"
  assumes "between (S\<^sub>1, T\<^sub>1) X" "between (S\<^sub>2, T\<^sub>2) X"
  assumes "dist C S\<^sub>1 = r" "dist C T\<^sub>1 = r"
  assumes "dist C S\<^sub>2 = r" "dist C T\<^sub>2 = r"
  shows "dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
from \<open>dist C S\<^sub>1 = r\<close> \<open>dist C T\<^sub>1 = r\<close> \<open>between (S\<^sub>1, T\<^sub>1) X\<close>
[PROOF STATE]
proof (chain)
picking this:
dist C S\<^sub>1 = r
dist C T\<^sub>1 = r
between (S\<^sub>1, T\<^sub>1) X
[PROOF STEP]
have "dist S\<^sub>1 X * dist X T\<^sub>1 = r ^ 2 - (dist C X) ^ 2"
[PROOF STATE]
proof (prove)
using this:
dist C S\<^sub>1 = r
dist C T\<^sub>1 = r
between (S\<^sub>1, T\<^sub>1) X

goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = r\<^sup>2 - (dist C X)\<^sup>2
[PROOF STEP]
by (subst chord_property) auto
[PROOF STATE]
proof (state)
this:
dist S\<^sub>1 X * dist X T\<^sub>1 = r\<^sup>2 - (dist C X)\<^sup>2

goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist S\<^sub>1 X * dist X T\<^sub>1 = r\<^sup>2 - (dist C X)\<^sup>2

goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
from \<open>dist C S\<^sub>2 = r\<close> \<open>dist C T\<^sub>2 = r\<close> \<open>between (S\<^sub>2, T\<^sub>2) X\<close>
[PROOF STATE]
proof (chain)
picking this:
dist C S\<^sub>2 = r
dist C T\<^sub>2 = r
between (S\<^sub>2, T\<^sub>2) X
[PROOF STEP]
have "\<dots> = dist S\<^sub>2 X * dist X T\<^sub>2"
[PROOF STATE]
proof (prove)
using this:
dist C S\<^sub>2 = r
dist C T\<^sub>2 = r
between (S\<^sub>2, T\<^sub>2) X

goal (1 subgoal):
 1. r\<^sup>2 - (dist C X)\<^sup>2 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
by (subst chord_property) auto
[PROOF STATE]
proof (state)
this:
r\<^sup>2 - (dist C X)\<^sup>2 = dist S\<^sub>2 X * dist X T\<^sub>2

goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2

goal (1 subgoal):
 1. dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist S\<^sub>1 X * dist X T\<^sub>1 = dist S\<^sub>2 X * dist X T\<^sub>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_of_Func_option_mono:
fixes A1 A2 :: "'a set" and B :: "'b set"
assumes A12: "A1 \<subseteq> A2" and B: "B \<noteq> {}"
shows "|Func_option A1 B| \<le>o |Func_option A2 B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Func_option A1 B| \<le>o |Func_option A2 B|
[PROOF STEP]
by (metis card_of_Func_mono[OF A12 B] card_of_Func_option_Func
  ordIso_ordLeq_trans ordLeq_ordIso_trans ordIso_symmetric)


[STATEMENT]
lemma measure_negligible_finite_Union_image:
  assumes "finite S"
    and meas: "\<And>x. x \<in> S \<Longrightarrow> f x \<in> lmeasurable"
    and djointish: "pairwise (\<lambda>x y. negligible (f x \<inter> f y)) S"
  shows "measure lebesgue (\<Union>(f ` S)) = (\<Sum>x\<in>S. measure lebesgue (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
have "measure lebesgue (\<Union>(f ` S)) = sum (measure lebesgue) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = sum (Sigma_Algebra.measure lebesgue) (f ` S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
?x \<in> S \<Longrightarrow> f ?x \<in> lmeasurable
pairwise (\<lambda>x y. negligible (f x \<inter> f y)) S

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = sum (Sigma_Algebra.measure lebesgue) (f ` S)
[PROOF STEP]
by (auto simp: pairwise_mono pairwise_image intro: measure_negligible_finite_Union)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = sum (Sigma_Algebra.measure lebesgue) (f ` S)

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = sum (Sigma_Algebra.measure lebesgue) (f ` S)

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
have "\<dots> = sum (measure lebesgue \<circ> f) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (Sigma_Algebra.measure lebesgue) (f ` S) = sum (Sigma_Algebra.measure lebesgue \<circ> f) S
[PROOF STEP]
using djointish [unfolded pairwise_def]
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<forall>y\<in>S. x \<noteq> y \<longrightarrow> negligible (f x \<inter> f y)

goal (1 subgoal):
 1. sum (Sigma_Algebra.measure lebesgue) (f ` S) = sum (Sigma_Algebra.measure lebesgue \<circ> f) S
[PROOF STEP]
by (metis inf.idem negligible_imp_measure0 sum.reindex_nontrivial [OF \<open>finite S\<close>])
[PROOF STATE]
proof (state)
this:
sum (Sigma_Algebra.measure lebesgue) (f ` S) = sum (Sigma_Algebra.measure lebesgue \<circ> f) S

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (Sigma_Algebra.measure lebesgue) (f ` S) = sum (Sigma_Algebra.measure lebesgue \<circ> f) S

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>S. measure lebesgue (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (Sigma_Algebra.measure lebesgue \<circ> f) S = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum (Sigma_Algebra.measure lebesgue \<circ> f) S = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (\<Union> (f ` S)) = (\<Sum>x\<in>S. Sigma_Algebra.measure lebesgue (f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gamma_integral_real:
  assumes x: "x > (0 :: real)"
  shows   "((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}
[PROOF STEP]
have A: "((\<lambda>t. complex_of_real t powr (complex_of_real x - 1) /
          complex_of_real (exp t)) has_integral complex_of_real (Gamma x)) {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (complex_of_real x - 1) / complex_of_real (exp t)) has_integral complex_of_real (Gamma x)) {0..}
[PROOF STEP]
using Gamma_integral_complex[of x] assms
[PROOF STATE]
proof (prove)
using this:
0 < Re (complex_of_real x) \<Longrightarrow> ((\<lambda>t. complex_of_real t powr (complex_of_real x - 1) / complex_of_real (exp t)) has_integral Gamma (complex_of_real x)) {0..}
0 < x

goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real t powr (complex_of_real x - 1) / complex_of_real (exp t)) has_integral complex_of_real (Gamma x)) {0..}
[PROOF STEP]
by (simp_all add: Gamma_complex_of_real powr_of_real)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real t powr (complex_of_real x - 1) / complex_of_real (exp t)) has_integral complex_of_real (Gamma x)) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}
[PROOF STEP]
have "((\<lambda>t. complex_of_real (t powr (x - 1) / exp t)) has_integral of_real (Gamma x)) {0..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>t. complex_of_real (t powr (x - 1) / exp t)) has_integral complex_of_real (Gamma x)) {0..}
[PROOF STEP]
by (rule has_integral_eq[OF _ A]) (simp_all add: powr_of_real [symmetric])
[PROOF STATE]
proof (state)
this:
((\<lambda>t. complex_of_real (t powr (x - 1) / exp t)) has_integral complex_of_real (Gamma x)) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}
[PROOF STEP]
from has_integral_linear[OF this bounded_linear_Re]
[PROOF STATE]
proof (chain)
picking this:
(Re \<circ> (\<lambda>t. complex_of_real (t powr (x - 1) / exp t)) has_integral Re (complex_of_real (Gamma x))) {0..}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Re \<circ> (\<lambda>t. complex_of_real (t powr (x - 1) / exp t)) has_integral Re (complex_of_real (Gamma x))) {0..}

goal (1 subgoal):
 1. ((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>t. t powr (x - 1) / exp t) has_integral Gamma x) {0..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sinh_less_cosh_real: "sinh (x :: real) < cosh x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sinh x < cosh x
[PROOF STEP]
by (simp add: sinh_def cosh_def)


[STATEMENT]
lemma (in group) conjugation_is_surj:
  assumes "g \<in> carrier G" "h \<in> carrier G"
  shows "g \<otimes> ((inv g) \<otimes> h \<otimes> g) \<otimes> (inv g) = h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<otimes> (inv g \<otimes> h \<otimes> g) \<otimes> inv g = h
[PROOF STEP]
using assms m_assoc inv_closed inv_inv m_closed monoid_axioms r_inv r_one
[PROOF STATE]
proof (prove)
using this:
g \<in> carrier G
h \<in> carrier G
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G; ?z \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<otimes> ?z = ?x \<otimes> (?y \<otimes> ?z)
?x \<in> carrier G \<Longrightarrow> inv ?x \<in> carrier G
?x \<in> carrier G \<Longrightarrow> inv (inv ?x) = ?x
\<lbrakk>?x \<in> carrier G; ?y \<in> carrier G\<rbrakk> \<Longrightarrow> ?x \<otimes> ?y \<in> carrier G
Group.monoid G
?x \<in> carrier G \<Longrightarrow> ?x \<otimes> inv ?x = \<one>
?x \<in> carrier G \<Longrightarrow> ?x \<otimes> \<one> = ?x

goal (1 subgoal):
 1. g \<otimes> (inv g \<otimes> h \<otimes> g) \<otimes> inv g = h
[PROOF STEP]
by metis


[STATEMENT]
lemma scalars_zero_if_independent:
  assumes fin_A: "finite A"
  and ind: "independent A"
  and sum: "(\<Sum>x\<in>A. scale (f x) x) = 0"
  shows "\<forall>x \<in> A. f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. f x = (0::'a)
[PROOF STEP]
using fin_A ind local.dependent_finite sum
[PROOF STATE]
proof (prove)
using this:
finite A
local.independent A
finite ?S \<Longrightarrow> local.dependent ?S = (\<exists>u. (\<exists>v\<in>?S. u v \<noteq> (0::'a)) \<and> (\<Sum>v\<in>?S. u v *s v) = (0::'b))
(\<Sum>x\<in>A. f x *s x) = (0::'b)

goal (1 subgoal):
 1. \<forall>x\<in>A. f x = (0::'a)
[PROOF STEP]
by blast


[STATEMENT]
lemma hcis_inverse [simp]: "\<And>a. inverse (hcis a) = hcis (- a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. inverse (hcis a) = hcis (- a)
[PROOF STEP]
by transfer (rule cis_inverse)


[STATEMENT]
lemma addition_over_lin_poly_to_vec:
  fixes x y
  assumes "a < dim_poly x"
  assumes "dim_poly x = dim_poly y"
  shows  "(lpoly_to_vec x + lpoly_to_vec y) $ a = coeff (x + y) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lpoly_to_vec x + lpoly_to_vec y) $ a = Abstract_Linear_Poly.coeff (x + y) a
[PROOF STEP]
using assms(1) assms(2) lin_poly_to_vec_coeff_access
[PROOF STATE]
proof (prove)
using this:
a < dim_poly x
dim_poly x = dim_poly y
?x < dim_poly ?y \<Longrightarrow> lpoly_to_vec ?y $ ?x = Abstract_Linear_Poly.coeff ?y ?x

goal (1 subgoal):
 1. (lpoly_to_vec x + lpoly_to_vec y) $ a = Abstract_Linear_Poly.coeff (x + y) a
[PROOF STEP]
by (simp add: dim_poly_dim_vec_equiv)


[STATEMENT]
lemma hom_component_zero [simp]: "hom_component 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_component 0 = 0
[PROOF STEP]
by (rule ext) (simp add: hom_component_def)


[STATEMENT]
lemma quadratic_eq_zeroes_iff:
  assumes D: "D = b\<^sup>2 - 4 * a * c"
  assumes x1: "x\<^sub>1 = (-b + sqrt D) / (2 * a)"
  assumes x2: "x\<^sub>2 = (-b - sqrt D) / (2 * a)"
  assumes a: "a \<noteq> 0"
  shows "a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow> (D \<ge> 0 \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))" (is "?z \<longleftrightarrow> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * x\<^sup>2 + b * x + c = 0) = (0 \<le> D \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))
[PROOF STEP]
using quadratic_eq_factoring[OF D _ x1 x2 a, of x] discriminant[of a x b c] a
[PROOF STATE]
proof (prove)
using this:
0 \<le> D \<Longrightarrow> a * x\<^sup>2 + b * x + c = a * (x - x\<^sub>1) * (x - x\<^sub>2)
a * x\<^sup>2 + b * x + c = 0 \<Longrightarrow> 0 \<le> b\<^sup>2 - 4 * a * c
a \<noteq> 0

goal (1 subgoal):
 1. (a * x\<^sup>2 + b * x + c = 0) = (0 \<le> D \<and> (x = x\<^sub>1 \<or> x = x\<^sub>2))
[PROOF STEP]
by (auto simp: D)


[STATEMENT]
lemma poly_y_x_fixed_deg:
  fixes p :: "'a :: comm_monoid_add poly poly"
  defines "d \<equiv> Max { degree (coeff p i) | i. i \<le> degree p }"
  shows "poly_y_x p = (\<Sum>i\<le>degree p. \<Sum>j\<le>d. monom (monom (coeff (coeff p i) j) i) j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_y_x p = (\<Sum>i\<le>degree p. \<Sum>j\<le>d. monom (monom (coeff (coeff p i) j) i) j)
[PROOF STEP]
apply (rule poly_y_x_fix_y_deg, intro allI impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<le> degree p \<Longrightarrow> degree (coeff p i) \<le> d
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<le> degree p \<Longrightarrow> degree (coeff p i) \<le> Max {degree (coeff p i) |i. i \<le> degree p}
[PROOF STEP]
by (subst Max_ge,auto)


[STATEMENT]
lemma gbinomial_partial_row_sum:
  "(\<Sum>k\<le>m. (a gchoose k) * ((a / 2) - of_nat k)) = ((of_nat m + 1)/2) * (a gchoose (m + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1))
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
 2. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
 2. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>0. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat 0 + (1::'a)) / (2::'a) * (a gchoose (0 + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
case (Suc mm)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))
[PROOF STEP]
have "(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / 2 - of_nat k)) =
      (a - of_nat (Suc mm)) * (a gchoose Suc mm) / 2"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat mm + (1::'a)) / (2::'a) * (a gchoose (mm + 1))

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
have "\<dots> = a * (a - 1 gchoose Suc mm) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)
[PROOF STEP]
by (subst gbinomial_absorb_comp) (rule refl)
[PROOF STATE]
proof (state)
this:
(a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a - of_nat (Suc mm)) * (a gchoose Suc mm) / (2::'a) = a * (a - (1::'a) gchoose Suc mm) / (2::'a)

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
have "\<dots> = (of_nat (Suc mm) + 1) / 2 * (a gchoose (Suc mm + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a - (1::'a) gchoose Suc mm) / (2::'a) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
by (subst gbinomial_absorption [symmetric]) simp
[PROOF STATE]
proof (state)
this:
a * (a - (1::'a) gchoose Suc mm) / (2::'a) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal (1 subgoal):
 1. \<And>m. (\<Sum>k\<le>m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat m + (1::'a)) / (2::'a) * (a gchoose (m + 1)) \<Longrightarrow> (\<Sum>k\<le>Suc m. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc m) + (1::'a)) / (2::'a) * (a gchoose (Suc m + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal (1 subgoal):
 1. (\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>Suc mm. (a gchoose k) * (a / (2::'a) - of_nat k)) = (of_nat (Suc mm) + (1::'a)) / (2::'a) * (a gchoose (Suc mm + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma T_slow_median_le: "T_slow_median xs \<le> length xs ^ 2 + 3 * length xs + 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_slow_median xs \<le> (length xs)\<^sup>2 + 3 * length xs + 4
[PROOF STEP]
unfolding T_slow_median_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T_slow_select ((length xs - 1) div 2) xs + 1 \<le> (length xs)\<^sup>2 + 3 * length xs + 4
[PROOF STEP]
using T_slow_select_le[of "(length xs - 1) div 2" xs]
[PROOF STATE]
proof (prove)
using this:
T_slow_select ((length xs - 1) div 2) xs \<le> (length xs)\<^sup>2 + 3 * length xs + 3

goal (1 subgoal):
 1. T_slow_select ((length xs - 1) div 2) xs + 1 \<le> (length xs)\<^sup>2 + 3 * length xs + 4
[PROOF STEP]
by simp


[STATEMENT]
lemma neighbourhood_base_at_with_subset:
   "\<lbrakk>openin X U; x \<in> U\<rbrakk>
        \<Longrightarrow> (neighbourhood_base_at x P X \<longleftrightarrow> neighbourhood_base_at x (\<lambda>T. T \<subseteq> U \<and> P T) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin X U; x \<in> U\<rbrakk> \<Longrightarrow> neighbourhood_base_at x P X = neighbourhood_base_at x (\<lambda>T. T \<subseteq> U \<and> P T) X
[PROOF STEP]
apply (simp add: neighbourhood_base_at_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin X U; x \<in> U\<rbrakk> \<Longrightarrow> (\<forall>W. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. P V \<and> x \<in> U \<and> U \<subseteq> V \<and> V \<subseteq> W))) = (\<forall>W. openin X W \<and> x \<in> W \<longrightarrow> (\<exists>Ua. openin X Ua \<and> (\<exists>V\<subseteq>U. P V \<and> x \<in> Ua \<and> Ua \<subseteq> V \<and> V \<subseteq> W)))
[PROOF STEP]
apply (metis IntI Int_subset_iff openin_Int)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma "\<lbrakk> x3 = \<bar>x2\<bar> - x1; x4 = \<bar>x3\<bar> - x2; x5 = \<bar>x4\<bar> - x3;
         x6 = \<bar>x5\<bar> - x4; x7 = \<bar>x6\<bar> - x5; x8 = \<bar>x7\<bar> - x6;
         x9 = \<bar>x8\<bar> - x7; x10 = \<bar>x9\<bar> - x8; x11 = \<bar>x10\<bar> - x9 \<rbrakk>
 \<Longrightarrow> x1 = x10 & x2 = (x11::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x3 = \<bar>x2\<bar> - x1; x4 = \<bar>x3\<bar> - x2; x5 = \<bar>x4\<bar> - x3; x6 = \<bar>x5\<bar> - x4; x7 = \<bar>x6\<bar> - x5; x8 = \<bar>x7\<bar> - x6; x9 = \<bar>x8\<bar> - x7; x10 = \<bar>x9\<bar> - x8; x11 = \<bar>x10\<bar> - x9\<rbrakk> \<Longrightarrow> x1 = x10 \<and> x2 = x11
[PROOF STEP]
by arith


[STATEMENT]
lemma "c \<noteq> 0 \<Longrightarrow> D (\<lambda>t. a5 * t^5 + a3 * (t^3 / c) - a2 * exp (t^2) + a1 * cos t + a0) =
  (\<lambda>t. 5 * a5 * t^4 + 3 * a3 * (t^2 / c) - 2 * a2 * t * exp (t^2) - a1 * sin t) on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow>  D (\<lambda>t. a5 * t ^ 5 + a3 * (t ^ 3 / c) - a2 * exp (t\<^sup>2) + a1 * cos t + a0) = (\<lambda>t. 5 * a5 * t ^ 4 + 3 * a3 * (t\<^sup>2 / c) - 2 * a2 * t * exp (t\<^sup>2) - a1 * sin t) on T
[PROOF STEP]
by(auto intro!: poly_derivatives simp: power2_eq_square)


[STATEMENT]
lemma abs_cSUP_le[intro]:
  "X \<noteq> {} \<Longrightarrow> bounded (F ` X) \<Longrightarrow> \<bar>\<Squnion>x \<in> X. (F x) :: real\<bar> \<le> (\<Squnion>x \<in> X. \<bar>F x\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<noteq> {}; bounded (F ` X)\<rbrakk> \<Longrightarrow> \<bar>\<Squnion> (F ` X)\<bar> \<le> (\<Squnion>x\<in>X. \<bar>F x\<bar>)
[PROOF STEP]
by (auto intro!: cSup_abs_le cSUP_upper2 bounded_imp_bdd_above simp: image_image[symmetric])


[STATEMENT]
lemma sin_cos_npi [simp]: "sin (real (Suc (2 * n)) * pi/2) = (-1) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (real (Suc (2 * n)) * pi / 2) = (- 1) ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sin (real (Suc (2 * n)) * pi / 2) = (- 1) ^ n
[PROOF STEP]
have "sin ((real n + 1/2) * pi) = cos (real n * pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin ((real n + 1 / 2) * pi) = cos (real n * pi)
[PROOF STEP]
by (auto simp: algebra_simps sin_add)
[PROOF STATE]
proof (state)
this:
sin ((real n + 1 / 2) * pi) = cos (real n * pi)

goal (1 subgoal):
 1. sin (real (Suc (2 * n)) * pi / 2) = (- 1) ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sin ((real n + 1 / 2) * pi) = cos (real n * pi)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sin ((real n + 1 / 2) * pi) = cos (real n * pi)

goal (1 subgoal):
 1. sin (real (Suc (2 * n)) * pi / 2) = (- 1) ^ n
[PROOF STEP]
by (simp add: distrib_right add_divide_distrib add.commute mult.commute [of pi])
[PROOF STATE]
proof (state)
this:
sin (real (Suc (2 * n)) * pi / 2) = (- 1) ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arg_uminus:
  assumes "z \<noteq> 0"
  shows "Arg (-z) = \<downharpoonright>Arg z + pi\<downharpoonleft>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (- z) = \<downharpoonright>Arg z + pi\<downharpoonleft>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0

goal (1 subgoal):
 1. Arg (- z) = \<downharpoonright>Arg z + pi\<downharpoonleft>
[PROOF STEP]
using arg_mult[of "-1" z]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
- 1 * z \<noteq> 0 \<Longrightarrow> Arg (- 1 * z) = \<downharpoonright>Arg (- 1) + Arg z\<downharpoonleft>

goal (1 subgoal):
 1. Arg (- z) = \<downharpoonright>Arg z + pi\<downharpoonleft>
[PROOF STEP]
using arg_complex_of_real_negative[of "-1"]
[PROOF STATE]
proof (prove)
using this:
z \<noteq> 0
- 1 * z \<noteq> 0 \<Longrightarrow> Arg (- 1 * z) = \<downharpoonright>Arg (- 1) + Arg z\<downharpoonleft>
- 1 < 0 \<Longrightarrow> Arg (cor (- 1)) = pi

goal (1 subgoal):
 1. Arg (- z) = \<downharpoonright>Arg z + pi\<downharpoonleft>
[PROOF STEP]
by (auto simp add: field_simps)


[STATEMENT]
theorem inorder_delete:
  "sorted(inorder t) \<Longrightarrow> inorder (delete x t) = del_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (Tree2.inorder t) \<Longrightarrow> Tree2.inorder (delete x t) = del_list x (Tree2.inorder t)
[PROOF STEP]
by(induction t)
  (auto simp: del_list_simps inorder_balL inorder_balR inorder_split_maxD split: prod.splits)


[STATEMENT]
lemma strictly_generalizes_antisym: "strictly_generalizes C D \<Longrightarrow> \<not> strictly_generalizes D C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strictly_generalizes C D \<Longrightarrow> \<not> strictly_generalizes D C
[PROOF STEP]
unfolding strictly_generalizes_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generalizes C D \<and> \<not> generalizes D C \<Longrightarrow> \<not> (generalizes D C \<and> \<not> generalizes C D)
[PROOF STEP]
by blast


[STATEMENT]
lemma mertens_third_convert:
  assumes "n > 0"
  shows "(\<Prod>k<n. 1 - 1 / real (nth_prime k)) =
           (\<Prod>p | prime p \<and> p \<le> nth_prime (n - 1). 1 - 1 / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
have "primorial' n = primorial (nth_prime (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primorial' n = primorial (real (nth_prime (n - 1)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. primorial' n = primorial (real (nth_prime (n - 1)))
[PROOF STEP]
by (simp add: primorial'_conv_primorial)
[PROOF STATE]
proof (state)
this:
primorial' n = primorial (real (nth_prime (n - 1)))

goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
primorial' n = primorial (real (nth_prime (n - 1)))

goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
have "real (totient \<dots>) =
               primorial' n * (\<Prod>p | prime p \<and> p \<le> nth_prime (n - 1). 1 - 1 / p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (totient (primorial (real (nth_prime (n - 1))))) = real (primorial' n) * (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. real (totient (primorial (real (nth_prime (n - 1))))) = real (primorial' n) * (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
by (subst totient_primorial) (auto simp: primorial'_conv_primorial)
[PROOF STATE]
proof (state)
this:
real (totient (primorial (real (nth_prime (n - 1))))) = real (primorial' n) * (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)

goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (totient (primorial' n)) = real (primorial' n) * (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (totient (primorial' n)) = real (primorial' n) * (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)

goal (1 subgoal):
 1. (\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)
[PROOF STEP]
by (simp add: totient_primorial')
[PROOF STATE]
proof (state)
this:
(\<Prod>k<n. 1 - 1 / real (nth_prime k)) = (\<Prod>x\<in>{p. prime p \<and> p \<le> nth_prime (n - 1)}. 1 - 1 / real x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proper_map_from_compact:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes contf: "continuous_on S f" and imf: "f ` S \<subseteq> T" and "compact S"
          "closedin (top_of_set T) K"
  shows "compact (S \<inter> f -` K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (S \<inter> f -` K)
[PROOF STEP]
by (rule closedin_compact [OF \<open>compact S\<close>] continuous_closedin_preimage_gen assms)+


[STATEMENT]
lemma harm_le: "n \<ge> 1 \<Longrightarrow> harm n \<le> ln n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> n \<Longrightarrow> harm n \<le> ln (real n) + 1
[PROOF STEP]
using euler_mascheroni_sequence_decreasing[of 1 n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < 1; 1 \<le> n\<rbrakk> \<Longrightarrow> harm n - ln (real n) \<le> harm 1 - ln (real 1)

goal (1 subgoal):
 1. 1 \<le> n \<Longrightarrow> harm n \<le> ln (real n) + 1
[PROOF STEP]
by (simp add: harm_expand)


[STATEMENT]
lemma INF_comp: "(\<Sqinter>(f ` A)) * z = (INF a \<in> A . (f a) * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> (f ` A) * z = (\<Sqinter>a\<in>A. f a * z)
[PROOF STEP]
unfolding Inf_comp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>x\<in>f ` A. x * z) = (\<Sqinter>a\<in>A. f a * z)
[PROOF STEP]
apply (subgoal_tac "((\<lambda>x::'a. x * z) ` f ` A) = ((\<lambda>a::'b. f a * z) ` A)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>x. x * z) ` f ` A = (\<lambda>a. f a * z) ` A \<Longrightarrow> (\<Sqinter>x\<in>f ` A. x * z) = (\<Sqinter>a\<in>A. f a * z)
 2. (\<lambda>x. x * z) ` f ` A = (\<lambda>a. f a * z) ` A
[PROOF STEP]
by auto


[STATEMENT]
lemma norm_le_componentwise_cart:
  fixes x :: "'a::real_normed_vector^'n"
  assumes "\<And>i. norm(x$i) \<le> norm(y$i)"
  shows "norm x \<le> norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x \<le> norm y
[PROOF STEP]
unfolding norm_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L2_set (\<lambda>i. norm (x $ i)) UNIV \<le> L2_set (\<lambda>i. norm (y $ i)) UNIV
[PROOF STEP]
by (rule L2_set_mono) (auto simp: assms)


[STATEMENT]
lemma open_segment_translation:
    "open_segment (c + a) (c + b) = image (\<lambda>x. c + x) (open_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment (c + a) (c + b) = (+) c ` open_segment a b
[PROOF STEP]
by (simp add: open_segment_def closed_segment_translation translation_diff)


[STATEMENT]
lemma reachable_subs_nnvs: "\<lbrakk> u \<in> verts G; Suc n \<le> card {x. u \<rightarrow>\<^sup>* x} \<rbrakk>
 \<Longrightarrow> \<exists>A \<subseteq> {x. u \<rightarrow>\<^sup>* x}. card A = Suc n \<and> n_nearest_verts w u n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> verts G; Suc n \<le> card {x. u \<rightarrow>\<^sup>* x}\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>{x. u \<rightarrow>\<^sup>* x}. card A = Suc n \<and> n_nearest_verts w u n A
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>u \<in> verts G; Suc 0 \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc 0 \<and> n_nearest_verts w u 0 A
 2. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
u \<in> verts G
Suc 0 \<le> card {a. u \<rightarrow>\<^sup>* a}

goal (2 subgoals):
 1. \<lbrakk>u \<in> verts G; Suc 0 \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc 0 \<and> n_nearest_verts w u 0 A
 2. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> verts G
Suc 0 \<le> card {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
have "{u} \<subseteq> {x. u \<rightarrow>\<^sup>* x}"
[PROOF STATE]
proof (prove)
using this:
u \<in> verts G
Suc 0 \<le> card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. {u} \<subseteq> {x. u \<rightarrow>\<^sup>* x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{u} \<subseteq> {x. u \<rightarrow>\<^sup>* x}

goal (2 subgoals):
 1. \<lbrakk>u \<in> verts G; Suc 0 \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc 0 \<and> n_nearest_verts w u 0 A
 2. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
with zero_nnvs[OF \<open>u \<in> verts G\<close>]
[PROOF STATE]
proof (chain)
picking this:
n_nearest_verts ?uu u 0 {u}
{u} \<subseteq> {x. u \<rightarrow>\<^sup>* x}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n_nearest_verts ?uu u 0 {u}
{u} \<subseteq> {x. u \<rightarrow>\<^sup>* x}

goal (1 subgoal):
 1. \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc 0 \<and> n_nearest_verts w u 0 A
[PROOF STEP]
by (metis card_Suc_eq card.empty empty_iff)
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc 0 \<and> n_nearest_verts w u 0 A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>u \<in> verts G; Suc n \<le> card {a. u \<rightarrow>\<^sup>* a}\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc n \<and> n_nearest_verts w u n A
u \<in> verts G
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
from Suc.IH[OF Suc.prems(1)]
[PROOF STATE]
proof (chain)
picking this:
Suc n \<le> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc n \<and> n_nearest_verts w u n A
[PROOF STEP]
obtain A
    where "A \<subseteq> {a. u \<rightarrow>\<^sup>* a}" and "card A = Suc n" and "n_nearest_verts w u n A"
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc n \<and> n_nearest_verts w u n A

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>A \<subseteq> {a. u \<rightarrow>\<^sup>* a}; card A = Suc n; n_nearest_verts w u n A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc.prems(2) Suc_leD
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc n \<and> n_nearest_verts w u n A
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}
Suc ?m \<le> ?n \<Longrightarrow> ?m \<le> ?n

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>A \<subseteq> {a. u \<rightarrow>\<^sup>* a}; card A = Suc n; n_nearest_verts w u n A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
note A = this
[PROOF STATE]
proof (state)
this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<lbrakk>u \<in> verts G; Suc n \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc n \<and> n_nearest_verts w u n A; u \<in> verts G; Suc (Suc n) \<le> card (Collect (reachable G u))\<rbrakk> \<Longrightarrow> \<exists>A\<subseteq>Collect (reachable G u). card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
proof(cases "Suc n = card {a. u \<rightarrow>\<^sup>* a}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Suc n = card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
 2. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Suc n = card {a. u \<rightarrow>\<^sup>* a}

goal (2 subgoals):
 1. Suc n = card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
 2. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
with A Suc.prems(2)
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}
Suc n = card {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}
Suc n = card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
with Suc.prems(2)
[PROOF STATE]
proof (chain)
picking this:
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}
Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
have "Suc n < card {a. u \<rightarrow>\<^sup>* a}"
[PROOF STATE]
proof (prove)
using this:
Suc (Suc n) \<le> card {a. u \<rightarrow>\<^sup>* a}
Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. Suc n < card {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc n < card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A
Suc n < card {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
have "\<exists>x \<in> {a. u \<rightarrow>\<^sup>* a}. x \<notin> A"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A
Suc n < card {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. \<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A
[PROOF STEP]
using subset_antisym
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card A = Suc n
n_nearest_verts w u n A
Suc n < card {a. u \<rightarrow>\<^sup>* a}
\<lbrakk>?A \<subseteq> ?B; ?B \<subseteq> ?A\<rbrakk> \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. \<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A
[PROOF STEP]
have unvis_non_empty: "unvisited_verts u A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A

goal (1 subgoal):
 1. unvisited_verts u A \<noteq> {}
[PROOF STEP]
unfolding unvisited_verts_def
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A

goal (1 subgoal):
 1. {x \<in> verts G - A. u \<rightarrow>\<^sup>* x} \<noteq> {}
[PROOF STEP]
using reachable_in_verts(2)
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>{a. u \<rightarrow>\<^sup>* a}. x \<notin> A
?u \<rightarrow>\<^sup>* ?v \<Longrightarrow> ?v \<in> verts G

goal (1 subgoal):
 1. {x \<in> verts G - A. u \<rightarrow>\<^sup>* x} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
unvisited_verts u A \<noteq> {}

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
let ?A' = "insert (nearest_vert w u A) A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
note n_nnvs_unvis[OF A(3) unvis_non_empty]
[PROOF STATE]
proof (state)
this:
n_nearest_verts w u (Suc n) (insert (nearest_vert w u A) A)

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n_nearest_verts w u (Suc n) (insert (nearest_vert w u A) A)

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
from A(1)
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
have "?A' \<subseteq> {a. u \<rightarrow>\<^sup>* a}"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
using some_unvis_vert[OF unvis_non_empty]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
?x = nearest_vert ?w u A \<Longrightarrow> ?x \<in> unvisited_verts u A
?x = nearest_vert ?w u A \<Longrightarrow> \<forall>y\<in>unvisited_verts u A. \<mu> ?w u ?x \<le> \<mu> ?w u y

goal (1 subgoal):
 1. insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
[PROOF STEP]
by (simp add: unvisited_verts_def)
[PROOF STATE]
proof (state)
this:
insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
note nearest_vert_not_mem[OF unvis_non_empty]
[PROOF STATE]
proof (state)
this:
nearest_vert ?w u A \<notin> A

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
with A(2) card.insert[OF nnvs_finite[OF A(3)]] nnvs_finite
[PROOF STATE]
proof (chain)
picking this:
card A = Suc n
?x \<notin> A \<Longrightarrow> card (insert ?x A) = Suc (card A)
n_nearest_verts ?w ?u ?n ?U \<Longrightarrow> finite ?U
nearest_vert ?w u A \<notin> A
[PROOF STEP]
have "card ?A' = Suc (Suc n)"
[PROOF STATE]
proof (prove)
using this:
card A = Suc n
?x \<notin> A \<Longrightarrow> card (insert ?x A) = Suc (card A)
n_nearest_verts ?w ?u ?n ?U \<Longrightarrow> finite ?U
nearest_vert ?w u A \<notin> A

goal (1 subgoal):
 1. card (insert (nearest_vert w u A) A) = Suc (Suc n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (insert (nearest_vert w u A) A) = Suc (Suc n)

goal (1 subgoal):
 1. Suc n \<noteq> card {a. u \<rightarrow>\<^sup>* a} \<Longrightarrow> \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
n_nearest_verts w u (Suc n) (insert (nearest_vert w u A) A)
insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card (insert (nearest_vert w u A) A) = Suc (Suc n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n_nearest_verts w u (Suc n) (insert (nearest_vert w u A) A)
insert (nearest_vert w u A) A \<subseteq> {a. u \<rightarrow>\<^sup>* a}
card (insert (nearest_vert w u A) A) = Suc (Suc n)

goal (1 subgoal):
 1. \<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>A\<subseteq>{a. u \<rightarrow>\<^sup>* a}. card A = Suc (Suc n) \<and> n_nearest_verts w u (Suc n) A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeffs_poly_of_vec:
  "coeffs (poly_of_vec v) = rev (dropWhile ((=) 0) (list_of_vec v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeffs (poly_of_vec v) = rev (dropWhile ((=) (0::'a)) (list_of_vec v))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeffs (poly_of_vec v) = rev (dropWhile ((=) (0::'a)) (list_of_vec v))
[PROOF STEP]
obtain n f where v: "v = vec n f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n f. v = vec n f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (state)
this:
v = vec n f

goal (1 subgoal):
 1. coeffs (poly_of_vec v) = rev (dropWhile ((=) (0::'a)) (list_of_vec v))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeffs (poly_of_vec v) = rev (dropWhile ((=) (0::'a)) (list_of_vec v))
[PROOF STEP]
by (simp add: v poly_of_vec_vec)
[PROOF STATE]
proof (state)
this:
coeffs (poly_of_vec v) = rev (dropWhile ((=) (0::'a)) (list_of_vec v))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_card_dom_map_of:
  assumes "distinct (map fst l)"
  shows "length l = card (dom (map_of l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l = card (dom (map_of l))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct (map fst l)

goal (1 subgoal):
 1. length l = card (dom (map_of l))
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct (map fst []) \<Longrightarrow> length [] = card (dom (map_of []))
 2. \<And>a l. \<lbrakk>distinct (map fst l) \<Longrightarrow> length l = card (dom (map_of l)); distinct (map fst (a # l))\<rbrakk> \<Longrightarrow> length (a # l) = card (dom (map_of (a # l)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>distinct (map fst l) \<Longrightarrow> length l = card (dom (map_of l)); distinct (map fst (a # l))\<rbrakk> \<Longrightarrow> length (a # l) = card (dom (map_of (a # l)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>length l = card (dom (map_of l)); fst a \<notin> fst ` set l \<and> distinct (map fst l)\<rbrakk> \<Longrightarrow> Suc (card (dom (map_of l))) = card (insert (fst a) (dom (map_of l)))
[PROOF STEP]
apply (case_tac a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l aa b. \<lbrakk>length l = card (dom (map_of l)); fst a \<notin> fst ` set l \<and> distinct (map fst l); a = (aa, b)\<rbrakk> \<Longrightarrow> Suc (card (dom (map_of l))) = card (insert (fst a) (dom (map_of l)))
[PROOF STEP]
apply (auto intro!: fst_conv map_of_SomeD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l aa. \<lbrakk>length l = card (dom (map_of l)); aa \<notin> fst ` set l; distinct (map fst l)\<rbrakk> \<Longrightarrow> Suc (card (dom (map_of l))) = card (insert aa (dom (map_of l)))
[PROOF STEP]
apply (subgoal_tac "aa \<notin> dom (map_of l)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>l aa. \<lbrakk>length l = card (dom (map_of l)); aa \<notin> fst ` set l; distinct (map fst l); aa \<notin> dom (map_of l)\<rbrakk> \<Longrightarrow> Suc (card (dom (map_of l))) = card (insert aa (dom (map_of l)))
 2. \<And>l aa. \<lbrakk>length l = card (dom (map_of l)); aa \<notin> fst ` set l; distinct (map fst l)\<rbrakk> \<Longrightarrow> aa \<notin> dom (map_of l)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l aa. \<lbrakk>length l = card (dom (map_of l)); aa \<notin> fst ` set l; distinct (map fst l)\<rbrakk> \<Longrightarrow> aa \<notin> dom (map_of l)
[PROOF STEP]
by (metis dom_map_of_conv_image_fst)


[STATEMENT]
lemma strong_operator_topology_basis:
  fixes f::"('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector)" and U::"'i \<Rightarrow> 'b set" and x::"'i \<Rightarrow> 'a"
  assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> open (U i)"
  shows "openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
have "open {g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open {g. \<forall>i\<in>I. g (x i) \<in> U i}
[PROOF STEP]
by (rule product_topology_basis'[OF assms])
[PROOF STATE]
proof (state)
this:
open {g. \<forall>i\<in>I. g (x i) \<in> U i}

goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open {g. \<forall>i\<in>I. g (x i) \<in> U i}

goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
have "{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
                = blinfun_apply-`{g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i} = blinfun_apply -` {g. \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i} = blinfun_apply -` {g. \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV

goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open {g. \<forall>i\<in>I. g (x i) \<in> U i}
{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i} = blinfun_apply -` {g. \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open {g. \<forall>i\<in>I. g (x i) \<in> U i}
{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i} = blinfun_apply -` {g. \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV

goal (1 subgoal):
 1. openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
unfolding strong_operator_topology_def
[PROOF STATE]
proof (prove)
using this:
open {g. \<forall>i\<in>I. g (x i) \<in> U i}
{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i} = blinfun_apply -` {g. \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV

goal (1 subgoal):
 1. openin (pullback_topology UNIV blinfun_apply euclidean) {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
[PROOF STEP]
by (subst openin_pullback_topology) auto
[PROOF STATE]
proof (state)
this:
openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma l2norm_pow_2:
   "f square_integrable S \<Longrightarrow> (l2norm S f) ^ 2 = l2product S f f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f square_integrable S \<Longrightarrow> (l2norm S f)\<^sup>2 = l2product S f f
[PROOF STEP]
by (simp add: l2norm_def l2product_pos_le)


[STATEMENT]
lemma real_interval_zero: "real_interval 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_interval 0 = 0
[PROOF STEP]
by (simp add: interval_eqI)


[STATEMENT]
lemma module_hom_smult: "\<lbrakk>f\<in> module_hom R M N; r\<in>carrier R; m\<in>carrier M \<rbrakk>  \<Longrightarrow> f (r \<odot>\<^bsub>M\<^esub> m) = r \<odot>\<^bsub>N\<^esub> (f m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> module_hom R M N; r \<in> carrier R; m \<in> carrier M\<rbrakk> \<Longrightarrow> f (r \<odot>\<^bsub>M\<^esub> m) = r \<odot>\<^bsub>N\<^esub> f m
[PROOF STEP]
by (unfold module_hom_def, auto)


[STATEMENT]
lemma H_tensor_Id_1_is_gate:
  shows "gate 2 (H \<Otimes> Id 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate 2 (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dim_row (H \<Otimes> Quantum.Id 1) = 2\<^sup>2
 2. square_mat (H \<Otimes> Quantum.Id 1)
 3. unitary (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
show "dim_row (H \<Otimes> Quantum.Id 1) = 2\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (H \<Otimes> Quantum.Id 1) = 2\<^sup>2
[PROOF STEP]
using H_tensor_Id_1
[PROOF STATE]
proof (prove)
using this:
H \<Otimes> Quantum.Id 1 = Tensor.mat_of_cols_list 4 (map (map complex_of_real) [[1 / sqrt 2, 0, 1 / sqrt 2, 0], [0, 1 / sqrt 2, 0, 1 / sqrt 2], [1 / sqrt 2, 0, - 1 / sqrt 2, 0], [0, 1 / sqrt 2, 0, - 1 / sqrt 2]])

goal (1 subgoal):
 1. dim_row (H \<Otimes> Quantum.Id 1) = 2\<^sup>2
[PROOF STEP]
by (simp add: mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_row (H \<Otimes> Quantum.Id 1) = 2\<^sup>2

goal (2 subgoals):
 1. square_mat (H \<Otimes> Quantum.Id 1)
 2. unitary (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
show "square_mat (H \<Otimes> Quantum.Id 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
using H_is_gate id_is_gate tensor_gate_sqr_mat
[PROOF STATE]
proof (prove)
using this:
gate 1 H
gate ?n (Quantum.Id ?n)
\<lbrakk>gate ?m ?G1.0; gate ?n ?G2.0\<rbrakk> \<Longrightarrow> square_mat (?G1.0 \<Otimes> ?G2.0)

goal (1 subgoal):
 1. square_mat (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
square_mat (H \<Otimes> Quantum.Id 1)

goal (1 subgoal):
 1. unitary (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
show "unitary (H \<Otimes> Quantum.Id 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
using H_is_gate gate_def id_is_gate tensor_gate
[PROOF STATE]
proof (prove)
using this:
gate 1 H
gate ?n ?A \<equiv> dim_row ?A = 2 ^ ?n \<and> square_mat ?A \<and> unitary ?A
gate ?n (Quantum.Id ?n)
\<lbrakk>gate ?m ?G1.0; gate ?n ?G2.0\<rbrakk> \<Longrightarrow> gate (?m + ?n) (?G1.0 \<Otimes> ?G2.0)

goal (1 subgoal):
 1. unitary (H \<Otimes> Quantum.Id 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
unitary (H \<Otimes> Quantum.Id 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma transpose_mult_matrix:
  assumes
  "\<forall>a. fmul 0 a = 0"
  "\<forall>a. fmul a 0 = 0"
  "fadd 0 0 = 0"
  "\<forall>x y. fmul y x = fmul x y"
  shows
  "transpose_matrix (mult_matrix fmul fadd A B) = mult_matrix fmul fadd (transpose_matrix B) (transpose_matrix A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose_matrix (mult_matrix fmul fadd A B) = mult_matrix fmul fadd (transpose_matrix B) (transpose_matrix A)
[PROOF STEP]
apply (simp add: Rep_matrix_inject[THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (transpose_matrix (mult_matrix fmul fadd A B)) = Rep_matrix (mult_matrix fmul fadd (transpose_matrix B) (transpose_matrix A))
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (transpose_matrix (mult_matrix fmul fadd A B)) x xa = Rep_matrix (mult_matrix fmul fadd (transpose_matrix B) (transpose_matrix A)) x xa
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>a. fmul (0::'a) a = (0::'b)
\<forall>a. fmul a (0::'a) = (0::'b)
fadd (0::'b) (0::'b) = (0::'b)
\<forall>x y. fmul y x = fmul x y

goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (transpose_matrix (mult_matrix fmul fadd A B)) x xa = Rep_matrix (mult_matrix fmul fadd (transpose_matrix B) (transpose_matrix A)) x xa
[PROOF STEP]
apply (simp add: Rep_mult_matrix ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gbinomial_rec: "((a + 1) gchoose (Suc k)) = (a gchoose k) * ((a + 1) / of_nat (Suc k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = (a gchoose k) * ((a + (1::'a)) / of_nat (Suc k))
[PROOF STEP]
using gbinomial_mult_1[of a k]
[PROOF STATE]
proof (prove)
using this:
a * (a gchoose k) = of_nat k * (a gchoose k) + of_nat (Suc k) * (a gchoose Suc k)

goal (1 subgoal):
 1. a + (1::'a) gchoose Suc k = (a gchoose k) * ((a + (1::'a)) / of_nat (Suc k))
[PROOF STEP]
by (subst gbinomial_Suc_Suc) (simp add: field_simps del: of_nat_Suc, simp add: algebra_simps)