[STATEMENT]
lemma multiplicity_Lcm_atLeast1AtMost_Suc:
  fixes p n :: nat
  assumes p: "prime p" and n: "n > 0"
  shows "multiplicity p (Lcm {1..Suc n}) =
           (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
define k where "k = Max (multiplicity p ` {1..n})"
[PROOF STATE]
proof (state)
this:
k = Max (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
define l where "l = multiplicity p (Suc n)"
[PROOF STATE]
proof (state)
this:
l = multiplicity p (Suc n)

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have eq: "{1..Suc n} = insert (Suc n) {1..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..Suc n} = insert (Suc n) {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..Suc n} = insert (Suc n) {1..n}

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
from \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
[PROOF STEP]
have "p > 1"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p
[PROOF STEP]
by (auto dest: prime_gt_1_nat)
[PROOF STATE]
proof (state)
this:
1 < p

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})
[PROOF STEP]
by (subst multiplicity_Lcm) auto
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = Max (multiplicity p ` {1..Suc n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "multiplicity p ` {1..Suc n} =
               insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})
[PROOF STEP]
by (simp only: eq image_insert)
[PROOF STATE]
proof (state)
this:
multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p ` {1..Suc n} = insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "Max \<dots> = max l k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k
[PROOF STEP]
unfolding l_def k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max (multiplicity p (Suc n)) (Max (multiplicity p ` {1..n}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p
0 < n

goal (1 subgoal):
 1. Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max (multiplicity p (Suc n)) (Max (multiplicity p ` {1..n}))
[PROOF STEP]
by (subst Max.insert) auto
[PROOF STATE]
proof (state)
this:
Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Max (insert (multiplicity p (Suc n)) (multiplicity p ` {1..n})) = max l k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "\<dots> = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
proof (cases "\<exists>k. Suc n = p ^ k")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>k. Suc n = p ^ k

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "p ^ l dvd Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ l dvd Suc n
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p (Suc n) dvd Suc n
[PROOF STEP]
by (intro multiplicity_dvd)
[PROOF STATE]
proof (state)
this:
p ^ l dvd Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
hence "p ^ l \<le> Suc n"
[PROOF STATE]
proof (prove)
using this:
p ^ l dvd Suc n

goal (1 subgoal):
 1. p ^ l \<le> Suc n
[PROOF STEP]
unfolding l_def
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p (Suc n) dvd Suc n

goal (1 subgoal):
 1. p ^ multiplicity p (Suc n) \<le> Suc n
[PROOF STEP]
by (intro dvd_imp_le multiplicity_dvd) auto
[PROOF STATE]
proof (state)
this:
p ^ l \<le> Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ l \<le> Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "Suc n \<noteq> p ^ l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n \<noteq> p ^ l
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<nexists>k. Suc n = p ^ k

goal (1 subgoal):
 1. Suc n \<noteq> p ^ l
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Suc n \<noteq> p ^ l

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ l \<le> Suc n
Suc n \<noteq> p ^ l
[PROOF STEP]
have "p ^ l < Suc n"
[PROOF STATE]
proof (prove)
using this:
p ^ l \<le> Suc n
Suc n \<noteq> p ^ l

goal (1 subgoal):
 1. p ^ l < Suc n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
p ^ l < Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ l < Suc n

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "p ^ l > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ l
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 0 < p ^ l
[PROOF STEP]
by (intro zero_less_power) auto
[PROOF STATE]
proof (state)
this:
0 < p ^ l

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ l < Suc n
0 < p ^ l
[PROOF STEP]
have "l = multiplicity p (p ^ l)" and "p ^ l \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
p ^ l < Suc n
0 < p ^ l

goal (1 subgoal):
 1. l = multiplicity p (p ^ l) &&& p ^ l \<in> {1..n}
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ l < Suc n
0 < p ^ l
prime p

goal (1 subgoal):
 1. l = multiplicity p (p ^ l) &&& p ^ l \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
hence "l \<le> k"
[PROOF STATE]
proof (prove)
using this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (1 subgoal):
 1. l \<le> k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
l = multiplicity p (p ^ l)
p ^ l \<in> {1..n}

goal (1 subgoal):
 1. l \<le> Max (multiplicity p ` {1..n})
[PROOF STEP]
by (intro Max.coboundedI) auto
[PROOF STATE]
proof (state)
this:
l \<le> k

goal (2 subgoals):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
 2. \<nexists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<nexists>k. Suc n = p ^ k
l \<le> k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<nexists>k. Suc n = p ^ k
l \<le> k

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
by (simp add: l_def k_def)
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k. Suc n = p ^ k
[PROOF STEP]
obtain x where x: "Suc n = p ^ x"
[PROOF STATE]
proof (prove)
using this:
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. (\<And>x. Suc n = p ^ x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Suc n = p ^ x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
from x and \<open>n > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
Suc n = p ^ x
0 < n
[PROOF STEP]
have "x > 0"
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x
0 < n

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (intro Nat.gr0I) auto
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
Suc n = p ^ x
[PROOF STEP]
have [simp]: "l = x"
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x

goal (1 subgoal):
 1. l = x
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
Suc n = p ^ x
prime p

goal (1 subgoal):
 1. l = x
[PROOF STEP]
by (simp add: l_def)
[PROOF STATE]
proof (state)
this:
l = x

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
have "x = k + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = k + 1
[PROOF STEP]
proof (intro antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
have "p ^ (x - 1) < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ (x - 1) < Suc n
[PROOF STEP]
using \<open>x > 0\<close> \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < p

goal (1 subgoal):
 1. p ^ (x - 1) < Suc n
[PROOF STEP]
unfolding x
[PROOF STATE]
proof (prove)
using this:
0 < x
1 < p

goal (1 subgoal):
 1. p ^ (x - 1) < p ^ x
[PROOF STEP]
by (intro power_strict_increasing) auto
[PROOF STATE]
proof (state)
this:
p ^ (x - 1) < Suc n

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ (x - 1) < Suc n

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
have "p ^ (x - 1) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < p ^ (x - 1)
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
1 < p

goal (1 subgoal):
 1. 0 < p ^ (x - 1)
[PROOF STEP]
by (intro zero_less_power) auto
[PROOF STATE]
proof (state)
this:
0 < p ^ (x - 1)

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)
[PROOF STEP]
have "multiplicity p (p ^ (x - 1)) = x - 1" and "p ^ (x - 1) \<in> {1..n}"
[PROOF STATE]
proof (prove)
using this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)

goal (1 subgoal):
 1. multiplicity p (p ^ (x - 1)) = x - 1 &&& p ^ (x - 1) \<in> {1..n}
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ (x - 1) < Suc n
0 < p ^ (x - 1)
prime p

goal (1 subgoal):
 1. multiplicity p (p ^ (x - 1)) = x - 1 &&& p ^ (x - 1) \<in> {1..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
hence "x - 1 \<le> k"
[PROOF STATE]
proof (prove)
using this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (1 subgoal):
 1. x - 1 \<le> k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
multiplicity p (p ^ (x - 1)) = x - 1
p ^ (x - 1) \<in> {1..n}

goal (1 subgoal):
 1. x - 1 \<le> Max (multiplicity p ` {1..n})
[PROOF STEP]
by (intro Max.coboundedI) force+
[PROOF STATE]
proof (state)
this:
x - 1 \<le> k

goal (2 subgoals):
 1. x \<le> k + 1
 2. k + 1 \<le> x
[PROOF STEP]
thus "x \<le> k + 1"
[PROOF STATE]
proof (prove)
using this:
x - 1 \<le> k

goal (1 subgoal):
 1. x \<le> k + 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
x \<le> k + 1

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
have "multiplicity p y < x" if "y \<in> {1..n}" for y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "p ^ multiplicity p y \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^ multiplicity p y \<le> y
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<in> {1..n}

goal (1 subgoal):
 1. p ^ multiplicity p y \<le> y
[PROOF STEP]
by (intro dvd_imp_le multiplicity_dvd) auto
[PROOF STATE]
proof (state)
this:
p ^ multiplicity p y \<le> y

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ^ multiplicity p y \<le> y

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "\<dots> < Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < Suc n
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
y \<in> {1..n}

goal (1 subgoal):
 1. y < Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y < Suc n

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
y < Suc n

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
have "\<dots> = p ^ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n = p ^ x
[PROOF STEP]
by (fact x)
[PROOF STATE]
proof (state)
this:
Suc n = p ^ x

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p ^ multiplicity p y < p ^ x
[PROOF STEP]
show "multiplicity p y < x"
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p y < p ^ x

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
using \<open>p > 1\<close>
[PROOF STATE]
proof (prove)
using this:
p ^ multiplicity p y < p ^ x
1 < p

goal (1 subgoal):
 1. multiplicity p y < x
[PROOF STEP]
by (subst (asm) power_strict_increasing_iff)
[PROOF STATE]
proof (state)
this:
multiplicity p y < x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
hence "k < x"
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x

goal (1 subgoal):
 1. k < x
[PROOF STEP]
using \<open>n > 0\<close>
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x
0 < n

goal (1 subgoal):
 1. k < x
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
using this:
?y \<in> {1..n} \<Longrightarrow> multiplicity p ?y < x
0 < n

goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) < x
[PROOF STEP]
by (subst Max_less_iff) auto
[PROOF STATE]
proof (state)
this:
k < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
thus "k + 1 \<le> x"
[PROOF STATE]
proof (prove)
using this:
k < x

goal (1 subgoal):
 1. k + 1 \<le> x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k + 1 \<le> x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = k + 1

goal (1 subgoal):
 1. \<exists>k. Suc n = p ^ k \<Longrightarrow> max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x = k + 1

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
x = k + 1
\<exists>k. Suc n = p ^ k

goal (1 subgoal):
 1. max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max l k = (if \<exists>k. Suc n = p ^ k then 1 else 0) + k

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
have "k = multiplicity p (Lcm {1..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = multiplicity p (Lcm {1..n})
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) = multiplicity p (Lcm {1..n})
[PROOF STEP]
using \<open>n > 0\<close> and \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
0 < n
prime p

goal (1 subgoal):
 1. Max (multiplicity p ` {1..n}) = multiplicity p (Lcm {1..n})
[PROOF STEP]
by (subst multiplicity_Lcm) auto
[PROOF STATE]
proof (state)
this:
k = multiplicity p (Lcm {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})

goal (1 subgoal):
 1. multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity p (Lcm {1..Suc n}) = (if \<exists>k. Suc n = p ^ k then 1 else 0) + multiplicity p (Lcm {1..n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem catalan_integral_form:
  "((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2*pi))
       has_integral real (catalan n)) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
have "((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2*pi)) has_integral
           I n * inverse (2 * pi)) {0..4}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}
[PROOF STEP]
unfolding I_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral integral {0..4} (\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x)) * inverse (2 * pi)) {0..4}
[PROOF STEP]
by (intro has_integral_mult_left integrable_integral integrable_I)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) * inverse (2 * pi)) has_integral I n * inverse (2 * pi)) {0..4}

goal (1 subgoal):
 1. ((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}
[PROOF STEP]
by (simp add: catalan_eq_I field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. x powr (real n - 1 / 2) * sqrt (4 - x) / (2 * pi)) has_integral real (catalan n)) {0..4}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma op_norm_def: "\<parallel>A\<parallel>\<^sub>o\<^sub>p = Sup {\<parallel>A *v x\<parallel> | x. \<parallel>x\<parallel> = 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A\<parallel>\<^sub>o\<^sub>p = Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
[PROOF STEP]
apply(rule antisym[OF onorm_le cSup_least[OF op_norm_set_proptys(3)]])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<parallel>A *v x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} * \<parallel>x\<parallel>
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(case_tac "x = 0", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} * \<parallel>x\<parallel>
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(subst mult_norm_matrix_sgn_eq[symmetric], simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v sgn x\<parallel> \<le> Sup {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(rule cSup_upper[OF _ op_norm_set_proptys(2)])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> \<parallel>A *v sgn x\<parallel> \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1}
 2. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
apply(force simp: norm_sgn)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> \<parallel>A\<parallel>\<^sub>o\<^sub>p
[PROOF STEP]
unfolding onorm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<le> (SUP x. \<parallel>A *v x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
apply(rule cSup_upper[OF _ onorm_set_proptys(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {\<parallel>A *v x\<parallel> |x. \<parallel>x\<parallel> = 1} \<Longrightarrow> x \<in> range (\<lambda>x. \<parallel>A *v x\<parallel> / \<parallel>x\<parallel>)
[PROOF STEP]
by (simp add: image_def, clarsimp) (metis div_by_1)


[STATEMENT]
lemma norm_sum_Pythagorean:
  assumes "finite I" "pairwise (\<lambda>i j. orthogonal (f i) (f j)) I"
    shows "(norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I

goal (1 subgoal):
 1. (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
[PROOF STEP]
proof (induction I rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pairwise (\<lambda>i j. orthogonal (f i) (f j)) {} \<Longrightarrow> (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}

goal (2 subgoals):
 1. pairwise (\<lambda>i j. orthogonal (f i) (f j)) {} \<Longrightarrow> (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
pairwise (\<lambda>i j. orthogonal (f i) (f j)) {}

goal (1 subgoal):
 1. (norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(norm (sum f {}))\<^sup>2 = (\<Sum>i\<in>{}. (norm (f i))\<^sup>2)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
case (insert x I)
[PROOF STATE]
proof (state)
this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
[PROOF STEP]
have "orthogonal (f x) (sum f I)"
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)

goal (1 subgoal):
 1. orthogonal (f x) (sum f I)
[PROOF STEP]
by (metis pairwise_insert orthogonal_rvsum)
[PROOF STATE]
proof (state)
this:
orthogonal (f x) (sum f I)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; pairwise (\<lambda>i j. orthogonal (f i) (f j)) F \<Longrightarrow> (norm (sum f F))\<^sup>2 = (\<Sum>i\<in>F. (norm (f i))\<^sup>2); pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x F)\<rbrakk> \<Longrightarrow> (norm (sum f (insert x F)))\<^sup>2 = (\<Sum>i\<in>insert x F. (norm (f i))\<^sup>2)
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
orthogonal (f x) (sum f I)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite I
x \<notin> I
pairwise (\<lambda>i j. orthogonal (f i) (f j)) I \<Longrightarrow> (norm (sum f I))\<^sup>2 = (\<Sum>i\<in>I. (norm (f i))\<^sup>2)
pairwise (\<lambda>i j. orthogonal (f i) (f j)) (insert x I)
orthogonal (f x) (sum f I)

goal (1 subgoal):
 1. (norm (sum f (insert x I)))\<^sup>2 = (\<Sum>i\<in>insert x I. (norm (f i))\<^sup>2)
[PROOF STEP]
by (simp add: pairwise_insert norm_add_Pythagorean)
[PROOF STATE]
proof (state)
this:
(norm (sum f (insert x I)))\<^sup>2 = (\<Sum>i\<in>insert x I. (norm (f i))\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_permutations_of_multiset_remove_aux:
  assumes "x \<in># A"
  shows   "card (permutations_of_multiset A) * count A x =
             size A * card (permutations_of_multiset (A - {#x#}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in># A
[PROOF STEP]
have A: "A - {#x#} + {#x#} = A"
[PROOF STATE]
proof (prove)
using this:
x \<in># A

goal (1 subgoal):
 1. A - {#x#} + {#x#} = A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A - {#x#} + {#x#} = A

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in># A
[PROOF STEP]
have B: "size A = size (A - {#x#}) + 1"
[PROOF STATE]
proof (prove)
using this:
x \<in># A

goal (1 subgoal):
 1. size A = size (A - {#x#}) + 1
[PROOF STEP]
by (subst A [symmetric], subst size_union) simp
[PROOF STATE]
proof (state)
this:
size A = size (A - {#x#}) + 1

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
using card_permutations_of_multiset_insert_aux[of "A - {#x#}" x, unfolded A] assms
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset A) * (count (A - {#x#}) x + 1) = (size (A - {#x#}) + 1) * card (permutations_of_multiset (A - {#x#}))
x \<in># A

goal (1 subgoal):
 1. card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))
[PROOF STEP]
by (simp add: B)
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset A) * count A x = size A * card (permutations_of_multiset (A - {#x#}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Im_Arccos_bound: "\<bar>Im (Arccos w)\<bar> \<le> cmod w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
have "(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2
[PROOF STEP]
using norm_cos_squared [of "Arccos w"] real_le_abs_sinh [of "Im (Arccos w)"]
[PROOF STATE]
proof (prove)
using this:
(cmod (cos (Arccos w)))\<^sup>2 = (cos (Re (Arccos w)))\<^sup>2 + (exp (Im (Arccos w)) - inverse (exp (Im (Arccos w))))\<^sup>2 / 4
\<bar>Im (Arccos w)\<bar> \<le> \<bar>(exp (Im (Arccos w)) - inverse (exp (Im (Arccos w)))) / 2\<bar>

goal (1 subgoal):
 1. (Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2
[PROOF STEP]
by (simp only: abs_le_square_iff) (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Im (Arccos w))\<^sup>2 \<le> (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
have "\<dots> \<le> (cmod w)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2 \<le> (cmod w)\<^sup>2
[PROOF STEP]
by (auto simp: cmod_power2)
[PROOF STATE]
proof (state)
this:
(cmod (cos (Arccos w)))\<^sup>2 - (cos (Re (Arccos w)))\<^sup>2 \<le> (cmod w)\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
using abs_le_square_iff
[PROOF STATE]
proof (prove)
using this:
(Im (Arccos w))\<^sup>2 \<le> (cmod w)\<^sup>2
(\<bar>?x\<bar> \<le> \<bar>?y\<bar>) = (?x\<^sup>2 \<le> ?y\<^sup>2)

goal (1 subgoal):
 1. \<bar>Im (Arccos w)\<bar> \<le> cmod w
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<bar>Im (Arccos w)\<bar> \<le> cmod w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_kronecker[simp]:
  "dim_row (kronecker_product A B) = dim_row A * dim_row B"
  "dim_col (kronecker_product A B) = dim_col A * dim_col B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (kronecker_product A B) = dim_row A * dim_row B &&& dim_col (kronecker_product A B) = dim_col A * dim_col B
[PROOF STEP]
unfolding kronecker_product_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B))) = dim_row A * dim_row B &&& dim_col (mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B))) = dim_col A * dim_col B
[PROOF STEP]
by auto


[STATEMENT]
lemma orthogonal_iff_vangle: "orthogonal u v \<longleftrightarrow> vangle u v = pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orthogonal u v = (vangle u v = pi / 2)
[PROOF STEP]
using arccos_eq_iff[of "u \<bullet> v / (norm u * norm v)" 0] Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
\<bar>u \<bullet> v / (norm u * norm v)\<bar> \<le> 1 \<and> \<bar>0\<bar> \<le> 1 \<Longrightarrow> (arccos (u \<bullet> v / (norm u * norm v)) = arccos 0) = (u \<bullet> v / (norm u * norm v) = 0)
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. orthogonal u v = (vangle u v = pi / 2)
[PROOF STEP]
by (auto simp: vangle_def orthogonal_def)


[STATEMENT]
lemma powrat_power_eq:
   "0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
 2. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < a

goal (2 subgoals):
 1. 0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
 2. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> rat_of_nat 0 = a ^ 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a

goal (1 subgoal):
 1. \<And>n. \<lbrakk>0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n; 0 < a\<rbrakk> \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
using powrat_add
[PROOF STATE]
proof (prove)
using this:
0 < a \<Longrightarrow> a pow\<^sub>\<rat> rat_of_nat n = a ^ n
0 < a
0 < ?x \<Longrightarrow> ?x pow\<^sub>\<rat> (?r + ?s) = ?x pow\<^sub>\<rat> ?r * ?x pow\<^sub>\<rat> ?s

goal (1 subgoal):
 1. a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a pow\<^sub>\<rat> rat_of_nat (Suc n) = a ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_permutations_of_multiset_insert_aux:
  "card (permutations_of_multiset (A + {#x#})) * (count A x + 1) =
      (size A + 1) * card (permutations_of_multiset A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note card_permutations_of_multiset_aux[of "A + {#x#}"]
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (\<Prod>xa\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) xa)) = fact (size (A + {#x#}))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (\<Prod>xa\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) xa)) = fact (size (A + {#x#}))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
have "fact (size (A + {#x#})) = (size A + 1) * fact (size A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact (size (A + {#x#})) = (size A + 1) * fact (size A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fact (size (A + {#x#})) = (size A + 1) * fact (size A)

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact (size (A + {#x#})) = (size A + 1) * fact (size A)

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note multiset_prod_fact_insert[of A x]
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>y\<in>set_mset (A + {#x#}). fact (count (A + {#x#}) y)) = (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
note card_permutations_of_multiset_aux[of A, symmetric]
[PROOF STATE]
proof (state)
this:
fact (size A) = card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (permutations_of_multiset (A + {#x#})) * ((count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))) = (size A + 1) * (card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x)))
[PROOF STEP]
have "card (permutations_of_multiset (A + {#x#})) * (count A x + 1) *
                    (\<Prod>y\<in>set_mset A. fact (count A y)) =
                (size A + 1) * card (permutations_of_multiset A) *
                    (\<Prod>x\<in>set_mset A. fact (count A x))"
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset (A + {#x#})) * ((count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y))) = (size A + 1) * (card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x)))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))
[PROOF STEP]
by (simp only: mult_ac)
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) * (\<Prod>y\<in>set_mset A. fact (count A y)) = (size A + 1) * card (permutations_of_multiset A) * (\<Prod>x\<in>set_mset A. fact (count A x))

goal (1 subgoal):
 1. card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)
[PROOF STEP]
by (subst (asm) mult_right_cancel) simp_all
[PROOF STATE]
proof (state)
this:
card (permutations_of_multiset (A + {#x#})) * (count A x + 1) = (size A + 1) * card (permutations_of_multiset A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_exponent_ennrealI:
  assumes "1/p + 1/q = (1::ennreal)"
  shows "p \<ge> 1" "q \<ge> 1" "p = conjugate_exponent q" "q = conjugate_exponent p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 \<le> p &&& 1 \<le> q) &&& p = conjugate_exponent q &&& q = conjugate_exponent p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. 1 \<le> p
 2. 1 \<le> q
 3. p = conjugate_exponent q
 4. q = conjugate_exponent p
[PROOF STEP]
have "1/p \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 / p + 1 / q = 1

goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
using le_iff_add
[PROOF STATE]
proof (prove)
using this:
1 / p + 1 / q = 1
(?a \<le> ?b) = (\<exists>c. ?b = ?a + c)

goal (1 subgoal):
 1. 1 / p \<le> 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
1 / p \<le> 1

goal (4 subgoals):
 1. 1 \<le> p
 2. 1 \<le> q
 3. p = conjugate_exponent q
 4. q = conjugate_exponent p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 / p \<le> 1
[PROOF STEP]
show "p \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 / p \<le> 1

goal (1 subgoal):
 1. 1 \<le> p
[PROOF STEP]
by (metis assms divide_ennreal_def ennreal_add_eq_top ennreal_divide_self ennreal_divide_zero ennreal_le_epsilon ennreal_one_neq_top mult.left_neutral mult_left_le zero_le)
[PROOF STATE]
proof (state)
this:
1 \<le> p

goal (3 subgoals):
 1. 1 \<le> q
 2. p = conjugate_exponent q
 3. q = conjugate_exponent p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> p
[PROOF STEP]
show "q = conjugate_exponent p"
[PROOF STATE]
proof (prove)
using this:
1 \<le> p

goal (1 subgoal):
 1. q = conjugate_exponent p
[PROOF STEP]
using conjugate_exponent_ennreal_iff assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> p
1 \<le> ?p \<Longrightarrow> (?q = conjugate_exponent ?p) = (1 / ?p + 1 / ?q = 1)
1 / p + 1 / q = 1

goal (1 subgoal):
 1. q = conjugate_exponent p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q = conjugate_exponent p

goal (2 subgoals):
 1. 1 \<le> q
 2. p = conjugate_exponent q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q = conjugate_exponent p
[PROOF STEP]
show "q \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
q = conjugate_exponent p

goal (1 subgoal):
 1. 1 \<le> q
[PROOF STEP]
using conjugate_exponent_ennreal[OF \<open>p \<ge> 1\<close>]
[PROOF STATE]
proof (prove)
using this:
q = conjugate_exponent p
1 / p + 1 / conjugate_exponent p = 1
1 \<le> conjugate_exponent p
conjugate_exponent (conjugate_exponent p) = p

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

goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
show "p = conjugate_exponent q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
using conjugate_exponent_ennreal_iff[OF \<open>q\<ge>1\<close>, of p] assms
[PROOF STATE]
proof (prove)
using this:
(p = conjugate_exponent q) = (1 / q + 1 / p = 1)
1 / p + 1 / q = 1

goal (1 subgoal):
 1. p = conjugate_exponent q
[PROOF STEP]
by (simp add: add.commute)
[PROOF STATE]
proof (state)
this:
p = conjugate_exponent q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_list_dvd_prod_list_subset:
fixes A::"'b::comm_monoid_mult list"
assumes dA: "distinct A"
  and dB: "distinct B" (*Maybe this condition could be avoided*)
  and s: "set A \<subseteq> set B"
shows "prod_list A dvd prod_list B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "prod_list A = prod_list (map id A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list A = prod_list (map id A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prod_list A = prod_list (map id A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list A = prod_list (map id A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod id (set A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id A) = prod id (set A)
[PROOF STEP]
by (rule prod.distinct_set_conv_list[symmetric, OF dA])
[PROOF STATE]
proof (state)
this:
prod_list (map id A) = prod id (set A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list (map id A) = prod id (set A)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... dvd prod id (set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set A) dvd prod id (set B)
[PROOF STEP]
by (rule prod_dvd_prod_subset[OF _ s], auto)
[PROOF STATE]
proof (state)
this:
prod id (set A) dvd prod id (set B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id (set A) dvd prod id (set B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod_list (map id B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod id (set B) = prod_list (map id B)
[PROOF STEP]
by (rule prod.distinct_set_conv_list[OF dB])
[PROOF STATE]
proof (state)
this:
prod id (set B) = prod_list (map id B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod id (set B) = prod_list (map id B)

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
have "... = prod_list B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map id B) = prod_list B
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod_list (map id B) = prod_list B

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod_list A dvd prod_list B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod_list A dvd prod_list B

goal (1 subgoal):
 1. prod_list A dvd prod_list B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod_list A dvd prod_list B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma kronecker_distr_left:
  assumes "dim_row B = dim_row C" "dim_col B = dim_col C"
  shows "kronecker_product A (B+C) = kronecker_product A B + kronecker_product A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kronecker_product A (B + C) = kronecker_product A B + kronecker_product A C
[PROOF STEP]
unfolding kronecker_product_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row A * dim_row (B + C)) (dim_col A * dim_col (B + C)) (\<lambda>(i, j). A $$ (i div dim_row (B + C), j div dim_col (B + C)) * (B + C) $$ (i mod dim_row (B + C), j mod dim_col (B + C))) = mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B)) + mat (dim_row A * dim_row C) (dim_col A * dim_col C) (\<lambda>(i, j). A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_row B = dim_row C
dim_col B = dim_col C

goal (1 subgoal):
 1. mat (dim_row A * dim_row (B + C)) (dim_col A * dim_col (B + C)) (\<lambda>(i, j). A $$ (i div dim_row (B + C), j div dim_col (B + C)) * (B + C) $$ (i mod dim_row (B + C), j mod dim_col (B + C))) = mat (dim_row A * dim_row B) (dim_col A * dim_col B) (\<lambda>(i, j). A $$ (i div dim_row B, j div dim_col B) * B $$ (i mod dim_row B, j mod dim_col B)) + mat (dim_row A * dim_row C) (dim_col A * dim_col C) (\<lambda>(i, j). A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C))
[PROOF STEP]
apply (auto simp add: mat_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>dim_row B = dim_row C; dim_col B = dim_col C; i < dim_row A * dim_row C; j < dim_col A * dim_col C\<rbrakk> \<Longrightarrow> A $$ (i div dim_row C, j div dim_col C) * (B + C) $$ (i mod dim_row C, j mod dim_col C) = A $$ (i div dim_row C, j div dim_col C) * B $$ (i mod dim_row C, j mod dim_col C) + A $$ (i div dim_row C, j div dim_col C) * C $$ (i mod dim_row C, j mod dim_col C)
[PROOF STEP]
by (metis (no_types, lifting) distrib_left index_add_mat(1) mod_less_divisor mult_eq_0_iff neq0_conv not_less_zero)


[STATEMENT]
lemma integral_norm_eq_0_iff:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes f[measurable]: "integrable M f"
  shows "(\<integral>x. norm (f x) \<partial>M) = 0 \<longleftrightarrow> emeasure M {x\<in>space M. f x \<noteq> 0} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
have "(\<integral>\<^sup>+x. norm (f x) \<partial>M) = (\<integral>x. norm (f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
integrable M f

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
by (intro nn_integral_eq_integral integrable_norm) auto
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))
[PROOF STEP]
have "(\<integral>x. norm (f x) \<partial>M) = 0 \<longleftrightarrow> (\<integral>\<^sup>+x. norm (f x) \<partial>M) = 0"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = ennreal (LINT x|M. norm (f x))

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> emeasure M {x\<in>space M. ennreal (norm (f x)) \<noteq> 0} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)
[PROOF STEP]
by (intro nn_integral_0_iff) auto
[PROOF STATE]
proof (state)
this:
(\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>M = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. ennreal (norm (f x)) \<noteq> 0} = 0)

goal (1 subgoal):
 1. (LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(LINT x|M. norm (f x) = 0) = (emeasure M {x \<in> space M. f x \<noteq> (0::'b)} = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_mult_lead_coeff:
  assumes "subring K R" "polynomial K p1" "polynomial K p2" and "p1 \<noteq> []" and "p2 \<noteq> []"
  shows "lead_coeff (poly_mult p1 p2) = (lead_coeff p1) \<otimes> (lead_coeff p2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
have "poly_mult p1 p2 \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p1 p2 \<noteq> []
[PROOF STEP]
using poly_mult_integral[OF assms(1-3)] assms(4-5)
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 = [] \<Longrightarrow> p1 = [] \<or> p2 = []
p1 \<noteq> []
p2 \<noteq> []

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

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
hence "lead_coeff (poly_mult p1 p2) = (coeff (poly_mult p1 p2)) (degree p1 + degree p2)"
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 \<noteq> []

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
[PROOF STEP]
using poly_mult_degree_eq[OF assms(1-3)] assms(4-5)
[PROOF STATE]
proof (prove)
using this:
poly_mult p1 p2 \<noteq> []
degree (poly_mult p1 p2) = (if p1 = [] \<or> p2 = [] then 0 else degree p1 + degree p2)
p1 \<noteq> []
p2 \<noteq> []

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
[PROOF STEP]
by (metis coeff.simps(2) list.collapse)
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
using poly_mult_lead_coeff_aux[OF assms]
[PROOF STATE]
proof (prove)
using this:
lead_coeff (poly_mult p1 p2) = local.coeff (poly_mult p1 p2) (degree p1 + degree p2)
local.coeff (poly_mult p1 p2) (degree p1 + degree p2) = lead_coeff p1 \<otimes> lead_coeff p2

goal (1 subgoal):
 1. lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lead_coeff (poly_mult p1 p2) = lead_coeff p1 \<otimes> lead_coeff p2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powr_inverse_numeral:
  "0 < x \<Longrightarrow> x powr (1 / numeral n) = root (numeral n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> x powr (1 / numeral n) = root (numeral n) x
[PROOF STEP]
by (simp add: root_powr_inverse)


[STATEMENT]
lemma card_prop_mono:
  assumes \<open>m \<le> n\<close>
    shows \<open>card {i::nat. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m \<le> n
[PROOF STEP]
have \<open>{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. {i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
have \<open>finite {i. i \<le> n \<and> P i}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. i \<le> n \<and> P i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
finite {i. i \<le> n \<and> P i}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{i. i \<le> m \<and> P i} \<subseteq> {i. i \<le> n \<and> P i}
finite {i. i \<le> n \<and> P i}

goal (1 subgoal):
 1. card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}
[PROOF STEP]
by (simp add: card_mono)
[PROOF STATE]
proof (state)
this:
card {i. i \<le> m \<and> P i} \<le> card {i. i \<le> n \<and> P i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_UNIV_iff_lsc_usc:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  shows "(\<forall>x. continuous (at x) f) \<longleftrightarrow> (lsc f) \<and> (usc f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. isCont f x) = (lsc f \<and> usc f)
[PROOF STEP]
by (metis continuous_iff_lsc_usc lsc_def usc_def)


[STATEMENT]
lemma mod_0_div_mult_cancel: "(n mod (m::nat) = 0) = (n div m * m = n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n mod m = 0) = (n div m * m = n)
[PROOF STEP]
apply (insert eq_diff_left_iff[OF mod_le_dividend le0, of n m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n - n mod m = n - 0) = (n mod m = 0) \<Longrightarrow> (n mod m = 0) = (n div m * m = n)
[PROOF STEP]
apply (simp add: mult.commute minus_mod_eq_mult_div [symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_Union_le:
  "finite F \<Longrightarrow> (\<And>S. S \<in> F \<Longrightarrow> S \<in> sets M) \<Longrightarrow> measure M (\<Union>F) \<le> (\<Sum>S\<in>F. measure M S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) \<le> sum (Sigma_Algebra.measure M) F
[PROOF STEP]
using measure_UNION_le[of F "\<lambda>x. x" M]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite F; \<And>i. i \<in> F \<Longrightarrow> i \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union>i\<in>F. i) \<le> sum (Sigma_Algebra.measure M) F

goal (1 subgoal):
 1. \<lbrakk>finite F; \<And>S. S \<in> F \<Longrightarrow> S \<in> sets M\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (\<Union> F) \<le> sum (Sigma_Algebra.measure M) F
[PROOF STEP]
by simp


[STATEMENT]
lemma (in group) int_pow_mult:
  assumes "x \<in> carrier G" shows "x [^] (i + j::int) = x [^] i \<otimes> x [^] j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
have [simp]: "-i - j = -j - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - i - j = - j - i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- i - j = - j - i

goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] (i + j) = x [^] i \<otimes> x [^] j
[PROOF STEP]
by (auto simp: assms int_pow_def2 inv_solve_left inv_solve_right nat_add_distrib [symmetric] nat_pow_mult)
[PROOF STATE]
proof (state)
this:
x [^] (i + j) = x [^] i \<otimes> x [^] j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vector_scalar_matrix_ac:
  fixes k :: "'a::{field}" and x :: "'a::{field}^'n" and A :: "'a^'m^'n"
  shows "x v* (k *k A) = k *s (x v* A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x v* (k *k A) = k *s (x v* A)
[PROOF STEP]
using scalar_vector_matrix_assoc
[PROOF STATE]
proof (prove)
using this:
?k *s ?x v* ?A = ?k *s (?x v* ?A)

goal (1 subgoal):
 1. x v* (k *k A) = k *s (x v* A)
[PROOF STEP]
unfolding vector_matrix_mult_def matrix_scalar_mult_def vec_eq_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>i. (\<chi>j. \<Sum>i\<in>UNIV. ?A $ i $ j * (?k *s ?x) $ i) $ i = (?k *s (\<chi>j. \<Sum>i\<in>UNIV. ?A $ i $ j * ?x $ i)) $ i

goal (1 subgoal):
 1. \<forall>i. (\<chi>j. \<Sum>i\<in>UNIV. (\<chi>i j. k * A $ i $ j) $ i $ j * x $ i) $ i = (k *s (\<chi>j. \<Sum>i\<in>UNIV. A $ i $ j * x $ i)) $ i
[PROOF STEP]
by (auto simp add: sum_distrib_left vector_space_over_itself.scale_scale)


[STATEMENT]
theorem zeta_even_nat:
  "zeta (2 * of_nat n) =
     of_real ((-1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
hence "(\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))
[PROOF STEP]
by (intro sums_zeta_nat) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>k. 1 / of_nat (Suc k) ^ (2 * n)) sums zeta (of_nat (2 * n))

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
 2. n \<noteq> 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
from sums_unique2 [OF this nat_even_power_sums_complex] False
[PROOF STATE]
proof (chain)
picking this:
0 < n \<Longrightarrow> zeta (of_nat (2 * n)) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
n \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> zeta (of_nat (2 * n)) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
n \<noteq> 0

goal (1 subgoal):
 1. zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> zeta (2 * of_nat n) = complex_of_real ((- 1) ^ Suc n * bernoulli (2 * n) * (2 * pi) ^ (2 * n) / (2 * fact (2 * n)))
[PROOF STEP]
qed (insert zeta_neg_of_nat[of 0], simp_all)


[STATEMENT]
lemma lm147:
  assumes "card (Pow A) = 2"
  shows "card A = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
using assms lm146 [of A]
[PROOF STATE]
proof (prove)
using this:
card (Pow A) = 2
card (Pow A) \<noteq> 0 \<Longrightarrow> card A = Discrete.log (card (Pow A))

goal (1 subgoal):
 1. card A = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma overdamped_door_arith:
  assumes "b\<^sup>2 + a * 4 > 0" and "a < 0" and "b \<le> 0" and "t \<ge> 0" and "s1 > 0"
  shows "0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 -
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) * s1 / sqrt (b\<^sup>2 + a * 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) / 2 - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) / 2) * s1 / sqrt (b\<^sup>2 + a * 4)
[PROOF STEP]
proof(subst diff_divide_distrib[symmetric], simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have f0: "s1 / (2 * sqrt (b\<^sup>2 + a * 4)) > 0"  (is "s1/?c3 > 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
using assms(1,5)
[PROOF STATE]
proof (prove)
using this:
0 < b\<^sup>2 + a * 4
0 < s1

goal (1 subgoal):
 1. 0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have f1: "(b - sqrt (b\<^sup>2 + 4 * a)) < (b + sqrt (b\<^sup>2 + 4 * a))" (is "?c2 < ?c1")
    and f2: "(b + sqrt (b\<^sup>2 + 4 * a)) < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a) &&& b + sqrt (b\<^sup>2 + 4 * a) < 0
[PROOF STEP]
using sqrt_ge_absD[of b "b\<^sup>2 + 4 * a"] assms
[PROOF STATE]
proof (prove)
using this:
\<bar>b\<bar> \<le> sqrt (b\<^sup>2 + 4 * a) \<Longrightarrow> b\<^sup>2 \<le> b\<^sup>2 + 4 * a
0 < b\<^sup>2 + a * 4
a < 0
b \<le> 0
0 \<le> t
0 < s1

goal (1 subgoal):
 1. b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a) &&& b + sqrt (b\<^sup>2 + 4 * a) < 0
[PROOF STEP]
by (force, linarith)
[PROOF STATE]
proof (state)
this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
hence f3: "exp (t * ?c2 / 2) \<le> exp (t * ?c1 / 2)" (is "exp ?t1 \<le> exp ?t2")
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
unfolding exp_le_cancel_iff
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<le> t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2
[PROOF STEP]
using assms(4)
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0
0 \<le> t

goal (1 subgoal):
 1. t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2 \<le> t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2
[PROOF STEP]
by (case_tac "t=0", simp_all)
[PROOF STATE]
proof (state)
this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
hence "?c2 * exp ?t2 \<le> ?c2 * exp ?t1"
[PROOF STATE]
proof (prove)
using this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1 f2 mult_le_cancel_left_pos[of "-?c2" "exp ?t1" "exp ?t2"]
[PROOF STATE]
proof (prove)
using this:
exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0
0 < - (b - sqrt (b\<^sup>2 + 4 * a)) \<Longrightarrow> (- (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) = (exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2))

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have "... < ?c1 * exp ?t1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)

goal (1 subgoal):
 1. (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
have"... \<le> ?c1 * exp ?t1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
using f1 f2
[PROOF STATE]
proof (prove)
using this:
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
b + sqrt (b\<^sup>2 + 4 * a) < 0

goal (1 subgoal):
 1. (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
[PROOF STEP]
show "0 \<le> (?c1 * exp ?t1 - ?c2 * exp ?t2) * s1 / ?c3"
[PROOF STATE]
proof (prove)
using this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
using f0 f1 assms(5)
[PROOF STATE]
proof (prove)
using this:
(b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2) < (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
(b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) \<le> (b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2)
0 < s1 / (2 * sqrt (b\<^sup>2 + a * 4))
b - sqrt (b\<^sup>2 + 4 * a) < b + sqrt (b\<^sup>2 + 4 * a)
0 < s1

goal (1 subgoal):
 1. 0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> ((b + sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b - sqrt (b\<^sup>2 + 4 * a)) / 2) - (b - sqrt (b\<^sup>2 + 4 * a)) * exp (t * (b + sqrt (b\<^sup>2 + 4 * a)) / 2)) * s1 / (2 * sqrt (b\<^sup>2 + a * 4))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma upper_asymptotic_density_zero_union:
  assumes "upper_asymptotic_density A = 0" "upper_asymptotic_density B = 0"
  shows "upper_asymptotic_density (A \<union> B) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
using upper_asymptotic_density_in_01(3)[of "A \<union> B"] upper_asymptotic_density_union[of A B]
[PROOF STATE]
proof (prove)
using this:
0 \<le> upper_asymptotic_density (A \<union> B)
upper_asymptotic_density (A \<union> B) \<le> upper_asymptotic_density A + upper_asymptotic_density B

goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> upper_asymptotic_density (A \<union> B)
upper_asymptotic_density (A \<union> B) \<le> 0 + 0

goal (1 subgoal):
 1. upper_asymptotic_density (A \<union> B) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma facet_of_convex_hull_affine_independent:
  fixes S :: "'a::euclidean_space set"
  assumes "\<not> affine_dependent S"
    shows "T facet_of (convex hull S) \<longleftrightarrow>
           T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))"
          (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T facet_of convex hull S) = (T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
T facet_of convex hull S

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T facet_of convex hull S
[PROOF STEP]
have "T face_of (convex hull S)" "T \<noteq> {}"
        and afft: "aff_dim T = aff_dim (convex hull S) - 1"
[PROOF STATE]
proof (prove)
using this:
T facet_of convex hull S

goal (1 subgoal):
 1. (T face_of convex hull S &&& T \<noteq> {}) &&& aff_dim T = aff_dim (convex hull S) - 1
[PROOF STEP]
by (auto simp: facet_of_def)
[PROOF STATE]
proof (state)
this:
T face_of convex hull S
T \<noteq> {}
aff_dim T = aff_dim (convex hull S) - 1

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T face_of convex hull S
T \<noteq> {}
aff_dim T = aff_dim (convex hull S) - 1
[PROOF STEP]
obtain c where "c \<subseteq> S" and c: "T = convex hull c"
[PROOF STATE]
proof (prove)
using this:
T face_of convex hull S
T \<noteq> {}
aff_dim T = aff_dim (convex hull S) - 1

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<subseteq> S; T = convex hull c\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: face_of_convex_hull_affine_independent [OF assms])
[PROOF STATE]
proof (state)
this:
c \<subseteq> S
T = convex hull c

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<subseteq> S
T = convex hull c
[PROOF STEP]
have affs: "aff_dim S = aff_dim c + 1"
[PROOF STATE]
proof (prove)
using this:
c \<subseteq> S
T = convex hull c

goal (1 subgoal):
 1. aff_dim S = aff_dim c + 1
[PROOF STEP]
by (metis aff_dim_convex_hull afft eq_diff_eq)
[PROOF STATE]
proof (state)
this:
aff_dim S = aff_dim c + 1

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
have "\<not> affine_dependent c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> affine_dependent c
[PROOF STEP]
using \<open>c \<subseteq> S\<close> affine_dependent_subset assms
[PROOF STATE]
proof (prove)
using this:
c \<subseteq> S
\<lbrakk>affine_dependent ?s; ?s \<subseteq> ?t\<rbrakk> \<Longrightarrow> affine_dependent ?t
\<not> affine_dependent S

goal (1 subgoal):
 1. \<not> affine_dependent c
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> affine_dependent c

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
with affs
[PROOF STATE]
proof (chain)
picking this:
aff_dim S = aff_dim c + 1
\<not> affine_dependent c
[PROOF STEP]
have "card (S - c) = 1"
[PROOF STATE]
proof (prove)
using this:
aff_dim S = aff_dim c + 1
\<not> affine_dependent c

goal (1 subgoal):
 1. card (S - c) = 1
[PROOF STEP]
apply (simp add: aff_dim_affine_independent [symmetric] aff_dim_convex_hull)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aff_dim S = int (card c); \<not> affine_dependent c\<rbrakk> \<Longrightarrow> card (S - c) = Suc 0
[PROOF STEP]
by (metis aff_dim_affine_independent aff_independent_finite One_nat_def \<open>c \<subseteq> S\<close> add.commute
                add_diff_cancel_right' assms card_Diff_subset card_mono of_nat_1 of_nat_diff of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
card (S - c) = 1

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (S - c) = 1
[PROOF STEP]
obtain u where u: "u \<in> S - c"
[PROOF STATE]
proof (prove)
using this:
card (S - c) = 1

goal (1 subgoal):
 1. (\<And>u. u \<in> S - c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis DiffI \<open>c \<subseteq> S\<close> aff_independent_finite assms cancel_comm_monoid_add_class.diff_cancel
                card_Diff_subset subsetI subset_antisym zero_neq_one)
[PROOF STATE]
proof (state)
this:
u \<in> S - c

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> S - c
[PROOF STEP]
have u: "S = insert u c"
[PROOF STATE]
proof (prove)
using this:
u \<in> S - c

goal (1 subgoal):
 1. S = insert u c
[PROOF STEP]
by (metis Diff_subset \<open>c \<subseteq> S\<close> \<open>card (S - c) = 1\<close> card_1_singletonE double_diff insert_Diff insert_subset singletonD)
[PROOF STATE]
proof (state)
this:
S = insert u c

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
have "T = convex hull (c - {u})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T = convex hull (c - {u})
[PROOF STEP]
by (metis Diff_empty Diff_insert0 \<open>T facet_of convex hull S\<close> c facet_of_irrefl insert_absorb u)
[PROOF STATE]
proof (state)
this:
T = convex hull (c - {u})

goal (2 subgoals):
 1. T facet_of convex hull S \<Longrightarrow> T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
 2. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
with \<open>T \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
T \<noteq> {}
T = convex hull (c - {u})
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {}
T = convex hull (c - {u})

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
[PROOF STEP]
using c u
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {}
T = convex hull (c - {u})
T = convex hull c
S = insert u c

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))
[PROOF STEP]
obtain u where "T \<noteq> {}" "u \<in> S" and u: "T = convex hull (S - {u})"
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u}))

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>T \<noteq> {}; u \<in> S; T = convex hull (S - {u})\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: facet_of_def)
[PROOF STATE]
proof (state)
this:
T \<noteq> {}
u \<in> S
T = convex hull (S - {u})

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
T \<noteq> {}
u \<in> S
T = convex hull (S - {u})
[PROOF STEP]
have "\<not> S \<subseteq> {u}"
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {}
u \<in> S
T = convex hull (S - {u})

goal (1 subgoal):
 1. \<not> S \<subseteq> {u}
[PROOF STEP]
using \<open>T \<noteq> {}\<close> u
[PROOF STATE]
proof (prove)
using this:
T \<noteq> {}
u \<in> S
T = convex hull (S - {u})
T \<noteq> {}
T = convex hull (S - {u})

goal (1 subgoal):
 1. \<not> S \<subseteq> {u}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> S \<subseteq> {u}

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
have "aff_dim (S - {u}) = aff_dim S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim (S - {u}) = aff_dim S - 1
[PROOF STEP]
using assms \<open>u \<in> S\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> affine_dependent S
u \<in> S

goal (1 subgoal):
 1. aff_dim (S - {u}) = aff_dim S - 1
[PROOF STEP]
unfolding affine_dependent_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>x\<in>S. x \<in> affine hull (S - {x}))
u \<in> S

goal (1 subgoal):
 1. aff_dim (S - {u}) = aff_dim S - 1
[PROOF STEP]
by (metis add_diff_cancel_right' aff_dim_insert insert_Diff [of u S])
[PROOF STATE]
proof (state)
this:
aff_dim (S - {u}) = aff_dim S - 1

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim (S - {u}) = aff_dim S - 1
[PROOF STEP]
have "aff_dim (convex hull (S - {u})) = aff_dim (convex hull S) - 1"
[PROOF STATE]
proof (prove)
using this:
aff_dim (S - {u}) = aff_dim S - 1

goal (1 subgoal):
 1. aff_dim (convex hull (S - {u})) = aff_dim (convex hull S) - 1
[PROOF STEP]
by (simp add: aff_dim_convex_hull)
[PROOF STATE]
proof (state)
this:
aff_dim (convex hull (S - {u})) = aff_dim (convex hull S) - 1

goal (1 subgoal):
 1. T \<noteq> {} \<and> (\<exists>u. u \<in> S \<and> T = convex hull (S - {u})) \<Longrightarrow> T facet_of convex hull S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
aff_dim (convex hull (S - {u})) = aff_dim (convex hull S) - 1
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
aff_dim (convex hull (S - {u})) = aff_dim (convex hull S) - 1

goal (1 subgoal):
 1. T facet_of convex hull S
[PROOF STEP]
by (metis Diff_subset \<open>T \<noteq> {}\<close> assms face_of_convex_hull_affine_independent facet_of_def u)
[PROOF STATE]
proof (state)
this:
T facet_of convex hull S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power_subdist: "x\<^bsup>n\<^esup> \<le> (x + y)\<^bsup>n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsup>n\<^esup> \<le> (x + y)\<^bsup>n\<^esup>
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x\<^bsup>0\<^esup> \<le> (x + y)\<^bsup>0\<^esup>
 2. \<And>n. x\<^bsup>n\<^esup> \<le> (x + y)\<^bsup>n\<^esup> \<Longrightarrow> x\<^bsup>Suc n\<^esup> \<le> (x + y)\<^bsup>Suc n\<^esup>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. x\<^bsup>n\<^esup> \<le> (x + y)\<^bsup>n\<^esup> \<Longrightarrow> x\<^bsup>Suc n\<^esup> \<le> (x + y)\<^bsup>Suc n\<^esup>
[PROOF STEP]
using local.mult_isol_var local.power_Suc2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<le> ?x; ?v \<le> ?y\<rbrakk> \<Longrightarrow> ?u \<cdot> ?v \<le> ?x \<cdot> ?y
?a\<^bsup>Suc ?n\<^esup> = ?a\<^bsup>?n\<^esup> \<cdot> ?a

goal (1 subgoal):
 1. \<And>n. x\<^bsup>n\<^esup> \<le> (x + y)\<^bsup>n\<^esup> \<Longrightarrow> x\<^bsup>Suc n\<^esup> \<le> (x + y)\<^bsup>Suc n\<^esup>
[PROOF STEP]
by auto


[STATEMENT]
lemma sq_mtx_inv_mult:
  assumes "mtx_invertible A" and "mtx_invertible B"
  shows "(A * B)\<^sup>-\<^sup>1 = B\<^sup>-\<^sup>1 * A\<^sup>-\<^sup>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B)\<^sup>-\<^sup>1 = B\<^sup>-\<^sup>1 * A\<^sup>-\<^sup>1
[PROOF STEP]
by (simp add: assms matrix_inv_matrix_mul sq_mtx_inv_def times_sq_mtx_def)


[STATEMENT]
theorem F1map_cong: "\<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F1set2 x \<Longrightarrow> f2 z = g2 z\<rbrakk>
  \<Longrightarrow> F1map f1 f2 x = F1map g1 g2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z\<rbrakk> \<Longrightarrow> F1map f1 f2 x = F1map g1 g2 x
[PROOF STEP]
apply (rule F.map_cong0)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>z1. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z1 \<in> Fset1 x\<rbrakk> \<Longrightarrow> id z1 = id z1
 2. \<And>z2. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z2 \<in> F1set1 x\<rbrakk> \<Longrightarrow> f1 z2 = g1 z2
 3. \<And>z3. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f2 z3 = g2 z3
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>z2. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z2 \<in> F1set1 x\<rbrakk> \<Longrightarrow> f1 z2 = g1 z2
 2. \<And>z3. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f2 z3 = g2 z3
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z3. \<lbrakk>\<And>z. z \<in> F1set1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> F2set x \<Longrightarrow> f2 z = g2 z; z3 \<in> F2set x\<rbrakk> \<Longrightarrow> f2 z3 = g2 z3
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fls_deriv_X_power:
  "fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
 2. \<And>nat. n = Suc nat \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
n = Suc m

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
 2. \<And>nat. n = Suc nat \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
have "fls_deriv (fls_X^Suc m) = of_nat (Suc m) * fls_X^m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (fls_X ^ Suc m) = of_nat (Suc m) * fls_X ^ m
[PROOF STEP]
by (induct m) (simp_all add: mult_of_nat_commute algebra_simps)
[PROOF STATE]
proof (state)
this:
fls_deriv (fls_X ^ Suc m) = of_nat (Suc m) * fls_X ^ m

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
 2. \<And>nat. n = Suc nat \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
with Suc
[PROOF STATE]
proof (chain)
picking this:
n = Suc m
fls_deriv (fls_X ^ Suc m) = of_nat (Suc m) * fls_X ^ m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = Suc m
fls_deriv (fls_X ^ Suc m) = of_nat (Suc m) * fls_X ^ m

goal (1 subgoal):
 1. fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> fls_deriv (fls_X ^ n) = of_nat n * fls_X ^ (n - 1)
[PROOF STEP]
qed simp


[STATEMENT]
lemma three_subset: "\<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; {x,y,z} \<subseteq> X\<rbrakk> \<Longrightarrow> card X \<ge> 3 \<or> infinite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; {x, y, z} \<subseteq> X\<rbrakk> \<Longrightarrow> 3 \<le> card X \<or> infinite X
[PROOF STEP]
apply (case_tac "finite X")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; {x, y, z} \<subseteq> X; finite X\<rbrakk> \<Longrightarrow> 3 \<le> card X \<or> infinite X
 2. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; {x, y, z} \<subseteq> X; infinite X\<rbrakk> \<Longrightarrow> 3 \<le> card X \<or> infinite X
[PROOF STEP]
apply (auto simp : card_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; finite X; x \<in> X; y \<in> X; z \<in> X\<rbrakk> \<Longrightarrow> 3 \<le> card X
[PROOF STEP]
apply (erule_tac Y = "{x,y,z}" in card_subset_finite)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; x \<in> X; y \<in> X; z \<in> X\<rbrakk> \<Longrightarrow> card {x, y, z} = 3
 2. \<lbrakk>x \<noteq> y; x \<noteq> z; y \<noteq> z; x \<in> X; y \<in> X; z \<in> X\<rbrakk> \<Longrightarrow> {x, y, z} \<subseteq> X
[PROOF STEP]
by auto