[STATEMENT]
lemma scalar_prod_double_sum_fn_vec:
  fixes c :: "nat \<Rightarrow> ('a :: {comm_semiring_0})"
  fixes f :: "nat \<Rightarrow> 'a vec"
  assumes "\<And> j . j < k \<Longrightarrow> dim_vec (f j) = n"
  shows "(vec n (\<lambda>i. \<Sum>j = 0..<k. c j * (f j) $ i)) \<bullet> (vec n (\<lambda>i. \<Sum>j = 0..<k. c j * (f j) $ i)) =
    (\<Sum> j1 \<in> {0..<k} . c j1 * c j1 * ((f j1) \<bullet> (f j1))) +
    (\<Sum> j1 \<in> {0..<k} . (\<Sum> j2 \<in> ({0..< k} - {j1}) . c j1 * c j2 * ((f j1) \<bullet> (f j2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have sum_simp: "\<And> j1 j2. (\<Sum>l \<in> {0..<n} . c j1 * (f j1) $ l * (c j2 * (f j2) $ l)) =
    c j1 * c j2 *(\<Sum>l \<in> {0..<n} .  (f j1) $ l * (f j2) $ l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j1 j2. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j1 j2. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
fix j1 j2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j1 j2. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
have "(\<Sum>l \<in> {0..<n} . c j1 * (f j1) $ l * (c j2 * (f j2) $ l)) =
        (\<Sum>l \<in> {0..<n} . c j1  * c j2 * (f j1) $ l * (f j2) $ l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)
[PROOF STEP]
using mult.commute sum.cong
[PROOF STATE]
proof (prove)
using this:
?a * ?b = ?b * ?a
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)
[PROOF STEP]
by (smt (z3) ab_semigroup_mult_class.mult_ac(1))
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)

goal (1 subgoal):
 1. \<And>j1 j2. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
(* SLOW *)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)

goal (1 subgoal):
 1. \<And>j1 j2. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)
[PROOF STEP]
show "(\<Sum>l \<in> {0..<n} . c j1 * (f j1) $ l * (c j2 * (f j2) $ l)) =
        c j1 * c j2 *(\<Sum>l \<in> {0..<n} .  (f j1) $ l * (f j2) $ l)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
using sum_distrib_left[of " c j1 * c j2" "\<lambda> l. (f j1) $ l * (f j2) $ l" "{0..<n}"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. c j1 * c j2 * f j1 $ l * f j2 $ l)
c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l) = (\<Sum>n = 0..<n. c j1 * c j2 * (f j1 $ n * f j2 $ n))

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)
[PROOF STEP]
by (metis (no_types, lifting) mult.assoc sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. c ?j1.0 * f ?j1.0 $ l * (c ?j2.0 * f ?j2.0 $ l)) = c ?j1.0 * c ?j2.0 * (\<Sum>l = 0..<n. f ?j1.0 $ l * f ?j2.0 $ l)

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have "(vec n (\<lambda>i. \<Sum>j = 0..<k. c j * (f j) $ i)) \<bullet> (vec n (\<lambda>i. \<Sum>j = 0..<k. c j * (f j) $ i))
       = (\<Sum> l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * (f j1) $ l) * (\<Sum>j2 = 0..<k. c j2 * (f j2) $ l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l))
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec (vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i)). vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) $ i * vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) $ i) = (\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have "... = (\<Sum> l \<in> {0..<n} . (\<Sum> j1 \<in> {0..<k} . (\<Sum> j2 \<in> {0..< k}. c j1 * (f j1) $ l *  (c j2 * (f j2) $ l))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l))
[PROOF STEP]
by (metis (no_types) sum_product)
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. (\<Sum>j1 = 0..<k. c j1 * f j1 $ l) * (\<Sum>j2 = 0..<k. c j2 * f j2 $ l)) = (\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have "... = (\<Sum> j1 \<in> {0..<k} . (\<Sum> j2 \<in> {0..<k} . (\<Sum>l \<in> {0..<n} . c j1 * (f j1) $ l * (c j2 * (f j2) $ l))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l))
[PROOF STEP]
using sum_reorder_triple[of "\<lambda> l j1 j2 .(c j1 * (f j1) $ l * (c j2 * (f j2) $ l))" "{0..<k}" "{0..<k}" "{0..<n}"]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. \<Sum>i = 0..<k. \<Sum>j = 0..<k. c i * f i $ l * (c j * f j $ l)) = (\<Sum>i = 0..<k. \<Sum>j = 0..<k. \<Sum>l = 0..<n. c i * f i $ l * (c j * f j $ l))

goal (1 subgoal):
 1. (\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<n. \<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have "... = (\<Sum> j1 \<in> {0..<k} . (\<Sum> j2 \<in> {0..<k} . c j1 * c j2 * (\<Sum>l \<in> {0..<n} . (f j1) $ l * (f j2) $ l)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l))
[PROOF STEP]
using sum_simp
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<n. c ?j1.0 * f ?j1.0 $ l * (c ?j2.0 * f ?j2.0 $ l)) = c ?j1.0 * c ?j2.0 * (\<Sum>l = 0..<n. f ?j1.0 $ l * f ?j2.0 $ l)

goal (1 subgoal):
 1. (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. \<Sum>l = 0..<n. c j1 * f j1 $ l * (c j2 * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
have "... = (\<Sum> j1 \<in> {0..<k} . (\<Sum> j2 \<in> {0..<k} . c j1 * c j2 * ((f j1) \<bullet> (f j2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>i = 0..<dim_vec (f j2). f j1 $ i * f j2 $ i))
[PROOF STEP]
using dim_col assms
[PROOF STATE]
proof (prove)
using this:
dim_vec (col ?A ?i) = dim_row ?A
?j < k \<Longrightarrow> dim_vec (f ?j) = n

goal (1 subgoal):
 1. (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>i = 0..<dim_vec (f j2). f j1 $ i * f j2 $ i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (\<Sum>l = 0..<n. f j1 $ l * f j2 $ l)) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (f j1 \<bullet> f j2))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (f j1 \<bullet> f j2))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
using double_sum_split_case
[PROOF STATE]
proof (prove)
using this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. \<Sum>j2 = 0..<k. c j1 * c j2 * (f j1 \<bullet> f j2))
finite ?A \<Longrightarrow> (\<Sum>i\<in>?A. sum (?f i) ?A) = (\<Sum>i\<in>?A. ?f i i) + (\<Sum>i\<in>?A. sum (?f i) (?A - {i}))

goal (1 subgoal):
 1. vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) \<bullet> vec n (\<lambda>i. \<Sum>j = 0..<k. c j * f j $ i) = (\<Sum>j1 = 0..<k. c j1 * c j1 * (f j1 \<bullet> f j1)) + (\<Sum>j1 = 0..<k. \<Sum>j2\<in>{0..<k} - {j1}. c j1 * c j2 * (f j1 \<bullet> f j2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dagger_of_dagger_is_id:
  fixes M :: "complex Matrix.mat"
  shows "(M\<^sup>\<dagger>)\<^sup>\<dagger> = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M\<^sup>\<dagger>\<^sup>\<dagger> = M
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
 2. dim_row M\<^sup>\<dagger>\<^sup>\<dagger> = dim_row M
 3. dim_col M\<^sup>\<dagger>\<^sup>\<dagger> = dim_col M
[PROOF STEP]
show "dim_row ((M\<^sup>\<dagger>)\<^sup>\<dagger>) = dim_row M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row M\<^sup>\<dagger>\<^sup>\<dagger> = dim_row M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row M\<^sup>\<dagger>\<^sup>\<dagger> = dim_row M

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
 2. dim_col M\<^sup>\<dagger>\<^sup>\<dagger> = dim_col M
[PROOF STEP]
show "dim_col ((M\<^sup>\<dagger>)\<^sup>\<dagger>) = dim_col M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col M\<^sup>\<dagger>\<^sup>\<dagger> = dim_col M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col M\<^sup>\<dagger>\<^sup>\<dagger> = dim_col M

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
assume a0:"i < dim_row M" and a1:"j < dim_col M"
[PROOF STATE]
proof (state)
this:
i < dim_row M
j < dim_col M

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row M
j < dim_col M
[PROOF STEP]
show "(M\<^sup>\<dagger>)\<^sup>\<dagger> $$ (i,j) = M $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row M
j < dim_col M

goal (1 subgoal):
 1. M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
using dagger_def a0 a1
[PROOF STATE]
proof (prove)
using this:
?M\<^sup>\<dagger> \<equiv> mat (dim_col ?M) (dim_row ?M) (\<lambda>(i, j). cnj (?M $$ (j, i)))
i < dim_row M
j < dim_col M

goal (1 subgoal):
 1. M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
M\<^sup>\<dagger>\<^sup>\<dagger> $$ (i, j) = M $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_subset_eq_mono_add_left_cancel: "C + (A::'a multiset) \<subseteq># C + B \<longleftrightarrow> A \<subseteq># B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (C + A \<subseteq># C + B) = (A \<subseteq># B)
[PROOF STEP]
by (fact subset_mset.add_le_cancel_left)


[STATEMENT]
lemma assoc_mult_vec_mat:
  assumes "v \<in> carrier_vec n1" and "A \<in> carrier_mat n1 n2" and "B \<in> carrier_mat n2 n3"
  shows "v \<^sub>v* (A * B) = (v \<^sub>v* A) \<^sub>v* B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<^sub>v* (A * B) = v \<^sub>v* A \<^sub>v* B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n1
A \<in> carrier_mat n1 n2
B \<in> carrier_mat n2 n3

goal (1 subgoal):
 1. v \<^sub>v* (A * B) = v \<^sub>v* A \<^sub>v* B
[PROOF STEP]
by (intro eq_vecI, auto simp add: mult_vec_mat_def mult_mat_vec_def assoc_scalar_prod)


[STATEMENT]
lemma linepath_le_1:
  fixes a::"'a::linordered_idom" shows "\<lbrakk>a \<le> 1; b \<le> 1; 0 \<le> u; u \<le> 1\<rbrakk> \<Longrightarrow> (1 - u) * a + u * b \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> (1::'a); b \<le> (1::'a); (0::'a) \<le> u; u \<le> (1::'a)\<rbrakk> \<Longrightarrow> ((1::'a) - u) * a + u * b \<le> (1::'a)
[PROOF STEP]
using mult_left_le [of a "1-u"] mult_left_le [of b u]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> (1::'a); (0::'a) \<le> (1::'a) - u\<rbrakk> \<Longrightarrow> ((1::'a) - u) * a \<le> (1::'a) - u
\<lbrakk>b \<le> (1::'a); (0::'a) \<le> u\<rbrakk> \<Longrightarrow> u * b \<le> u

goal (1 subgoal):
 1. \<lbrakk>a \<le> (1::'a); b \<le> (1::'a); (0::'a) \<le> u; u \<le> (1::'a)\<rbrakk> \<Longrightarrow> ((1::'a) - u) * a + u * b \<le> (1::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma ivl_integral_norm_bound_integral:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "f integrable_on (closed_segment a b)"
    and "g integrable_on (closed_segment a b)"
    and "\<And>x. x \<in> closed_segment a b \<Longrightarrow> norm (f x) \<le> g x"
  shows "norm (ivl_integral a b f) \<le> integral (closed_segment a b) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (ivl_integral a b f) \<le> integral (closed_segment a b) g
[PROOF STEP]
using integral_norm_bound_integral[OF assms]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> closed_segment a b \<Longrightarrow> x \<in> closed_segment a b) \<Longrightarrow> norm (integral (closed_segment a b) f) \<le> integral (closed_segment a b) g

goal (1 subgoal):
 1. norm (ivl_integral a b f) \<le> integral (closed_segment a b) g
[PROOF STEP]
by (auto simp: ivl_integral_def closed_segment_eq_real_ivl split: if_split_asm)


[STATEMENT]
lemma dagger_of_prod:
  fixes M N::"complex Matrix.mat"
  assumes "dim_col M = dim_row N"
  shows "(M * N)\<^sup>\<dagger> = N\<^sup>\<dagger> * (M\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
have "(M * N)\<^sup>\<dagger> = ((M * N)\<^sup>\<star>)\<^sup>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = M * N\<^sup>\<star>\<^sup>t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<dagger> = M * N\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<dagger> = M * N\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
have "... = ((M\<^sup>\<star>) * (N\<^sup>\<star>))\<^sup>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N\<^sup>\<star>\<^sup>t = M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t
[PROOF STEP]
using assms cpx_mat_cnj_prod
[PROOF STATE]
proof (prove)
using this:
dim_col M = dim_row N
dim_col ?M = dim_row ?N \<Longrightarrow> ?M * ?N\<^sup>\<star> = ?M\<^sup>\<star> * ?N\<^sup>\<star>

goal (1 subgoal):
 1. M * N\<^sup>\<star>\<^sup>t = M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<star>\<^sup>t = M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<star>\<^sup>t = M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
have "... = (N\<^sup>\<star>)\<^sup>t * ((M\<^sup>\<star>)\<^sup>t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t = N\<^sup>\<star>\<^sup>t * M\<^sup>\<star>\<^sup>t
[PROOF STEP]
using assms transpose_of_prod
[PROOF STATE]
proof (prove)
using this:
dim_col M = dim_row N
dim_col ?M = dim_row ?N \<Longrightarrow> ?M * ?N\<^sup>t = ?N\<^sup>t * ?M\<^sup>t

goal (1 subgoal):
 1. M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t = N\<^sup>\<star>\<^sup>t * M\<^sup>\<star>\<^sup>t
[PROOF STEP]
by (metis cnj_transpose_is_dagger dim_col_of_dagger dim_row_of_dagger index_transpose_mat(2) index_transpose_mat(3))
[PROOF STATE]
proof (state)
this:
M\<^sup>\<star> * N\<^sup>\<star>\<^sup>t = N\<^sup>\<star>\<^sup>t * M\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M * N\<^sup>\<dagger> = N\<^sup>\<star>\<^sup>t * M\<^sup>\<star>\<^sup>t
[PROOF STEP]
show "(M * N)\<^sup>\<dagger> = N\<^sup>\<dagger> * (M\<^sup>\<dagger>)"
[PROOF STATE]
proof (prove)
using this:
M * N\<^sup>\<dagger> = N\<^sup>\<star>\<^sup>t * M\<^sup>\<star>\<^sup>t

goal (1 subgoal):
 1. M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M * N\<^sup>\<dagger> = N\<^sup>\<dagger> * M\<^sup>\<dagger>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group) group_one_equality:
  assumes eq: "e * x = x"
  shows "1 = e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
have "1 = x * inverse x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) = x * inverse x
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
(1::'a) = x * inverse x

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1::'a) = x * inverse x

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
have "\<dots> = (e * x) * inverse x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * inverse x = e * x * inverse x
[PROOF STEP]
by (simp only: eq)
[PROOF STATE]
proof (state)
this:
x * inverse x = e * x * inverse x

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * inverse x = e * x * inverse x

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
have "\<dots> = e * (x * inverse x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * x * inverse x = e * (x * inverse x)
[PROOF STEP]
by (simp only: group_assoc)
[PROOF STATE]
proof (state)
this:
e * x * inverse x = e * (x * inverse x)

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
e * x * inverse x = e * (x * inverse x)

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
have "\<dots> = e * 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (x * inverse x) = e * (1::'a)
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
e * (x * inverse x) = e * (1::'a)

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
e * (x * inverse x) = e * (1::'a)

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
have "\<dots> = e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e * (1::'a) = e
[PROOF STEP]
by (simp only: group_right_one)
[PROOF STATE]
proof (state)
this:
e * (1::'a) = e

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1::'a) = e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1::'a) = e

goal (1 subgoal):
 1. (1::'a) = e
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1::'a) = e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NSDERIV_mult:
  assumes "NSDERIV g x :> Db" "NSDERIV f x :> Da"
  shows "NSDERIV (\<lambda>x. f x * g x) x :> (Da * g x) + (Db * f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x
[PROOF STEP]
have "(f has_field_derivative Da) (at x)" "(g has_field_derivative Db) (at x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative Da) (at x) &&& (g has_field_derivative Db) (at x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
NSDERIV g x :> Db
NSDERIV f x :> Da

goal (1 subgoal):
 1. (f has_field_derivative Da) (at x) &&& (g has_field_derivative Db) (at x)
[PROOF STEP]
by (simp_all add: DERIV_NS_iff NSDERIV_NSLIM_iff)
[PROOF STATE]
proof (state)
this:
(f has_field_derivative Da) (at x)
(g has_field_derivative Db) (at x)

goal (1 subgoal):
 1. NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_field_derivative Da) (at x)
(g has_field_derivative Db) (at x)
[PROOF STEP]
have "((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)"
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative Da) (at x)
(g has_field_derivative Db) (at x)

goal (1 subgoal):
 1. ((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)
[PROOF STEP]
using DERIV_mult
[PROOF STATE]
proof (prove)
using this:
(f has_field_derivative Da) (at x)
(g has_field_derivative Db) (at x)
\<lbrakk>(?f has_field_derivative ?Da) (at ?x within ?s); (?g has_field_derivative ?Db) (at ?x within ?s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. ?f x * ?g x) has_field_derivative ?Da * ?g ?x + ?Db * ?f ?x) (at ?x within ?s)

goal (1 subgoal):
 1. ((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)

goal (1 subgoal):
 1. NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>a. f a * g a) has_field_derivative Da * g x + Db * f x) (at x)

goal (1 subgoal):
 1. NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x
[PROOF STEP]
by (simp add: DERIV_NS_iff NSDERIV_NSLIM_iff)
[PROOF STATE]
proof (state)
this:
NSDERIV (\<lambda>x. f x * g x) x :> Da * g x + Db * f x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rbt_height_le: assumes "rbt t" shows "height t \<le> 2 * log 2 (size1 t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
have "2 powr (height t / 2) \<le> 2 powr bheight t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr (real (height t) / 2) \<le> 2 powr real (bheight t)
[PROOF STEP]
using rbt_height_bheight[OF assms]
[PROOF STATE]
proof (prove)
using this:
real (height t) / 2 \<le> real (bheight t)

goal (1 subgoal):
 1. 2 powr (real (height t) / 2) \<le> 2 powr real (bheight t)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
2 powr (real (height t) / 2) \<le> 2 powr real (bheight t)

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 powr (real (height t) / 2) \<le> 2 powr real (bheight t)

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
have "\<dots> \<le> size1 t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 powr real (bheight t) \<le> real (size1 t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
rbt t

goal (1 subgoal):
 1. 2 powr real (bheight t) \<le> real (size1 t)
[PROOF STEP]
by (simp add: powr_realpow bheight_size_bound rbt_def)
[PROOF STATE]
proof (state)
this:
2 powr real (bheight t) \<le> real (size1 t)

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 powr (real (height t) / 2) \<le> real (size1 t)
[PROOF STEP]
have "2 powr (height t / 2) \<le> size1 t"
[PROOF STATE]
proof (prove)
using this:
2 powr (real (height t) / 2) \<le> real (size1 t)

goal (1 subgoal):
 1. 2 powr (real (height t) / 2) \<le> real (size1 t)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
2 powr (real (height t) / 2) \<le> real (size1 t)

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
hence "height t / 2 \<le> log 2 (size1 t)"
[PROOF STATE]
proof (prove)
using this:
2 powr (real (height t) / 2) \<le> real (size1 t)

goal (1 subgoal):
 1. real (height t) / 2 \<le> log 2 (real (size1 t))
[PROOF STEP]
by (simp add: le_log_iff size1_size del: divide_le_eq_numeral1(1))
[PROOF STATE]
proof (state)
this:
real (height t) / 2 \<le> log 2 (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real (height t) / 2 \<le> log 2 (real (size1 t))

goal (1 subgoal):
 1. real (height t) \<le> 2 * log 2 (real (size1 t))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (height t) \<le> 2 * log 2 (real (size1 t))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_sum_squares_le_sum_abs: "sqrt (x\<^sup>2 + y\<^sup>2) \<le> \<bar>x\<bar> + \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 + y\<^sup>2) \<le> \<bar>x\<bar> + \<bar>y\<bar>
[PROOF STEP]
by (rule power2_le_imp_le) (simp_all add: power2_sum)


[STATEMENT]
theorem num_sylow_normalizer:
  assumes Psize:"P \<in> subgroups_of_size (p ^ a)"
  shows "card (rcosets\<^bsub>G\<lparr>carrier := group_action.stabilizer G (conjugation_action (p ^ a)) P\<rparr>\<^esub> P) * p ^ a = card (group_action.stabilizer G (conjugation_action (p ^ a)) P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := group_action.stabilizer G (conjugation_action (p ^ a)) P\<rparr>\<^esub> P) * p ^ a = card (group_action.stabilizer G (conjugation_action (p ^ a)) P)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := group_action.stabilizer G (conjugation_action (p ^ a)) P\<rparr>\<^esub> P) * p ^ a = card (group_action.stabilizer G (conjugation_action (p ^ a)) P)
[PROOF STEP]
from finite_G
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
[PROOF STEP]
interpret conj: group_action G "(conjugation_action (p ^ a))" "(subgroups_of_size (p ^ a))"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)

goal (1 subgoal):
 1. group_action G (conjugation_action (p ^ a)) (subgroups_of_size (p ^ a))
[PROOF STEP]
by (rule acts_on_subsets)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
from Psize
[PROOF STATE]
proof (chain)
picking this:
P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
have PG:"subgroup P G" and cardP:"card P = p ^ a"
[PROOF STATE]
proof (prove)
using this:
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. subgroup P G &&& card P = p ^ a
[PROOF STEP]
unfolding subgroups_of_size_def
[PROOF STATE]
proof (prove)
using this:
P \<in> {H. subgroup H G \<and> card H = p ^ a}

goal (1 subgoal):
 1. subgroup P G &&& card P = p ^ a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
with finite_G
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
subgroup P G
card P = p ^ a
[PROOF STEP]
have "order G = card (conj.orbit P) * card (conj.stabilizer P)"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
subgroup P G
card P = p ^ a

goal (1 subgoal):
 1. order G = card (conj.orbit P) * card (conj.stabilizer P)
[PROOF STEP]
by (metis Psize acts_on_subsets group_action.orbit_size)
[PROOF STATE]
proof (state)
this:
order G = card (conj.orbit P) * card (conj.stabilizer P)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
with order_G Psize
[PROOF STATE]
proof (chain)
picking this:
order G = p ^ a * m
P \<in> subgroups_of_size (p ^ a)
order G = card (conj.orbit P) * card (conj.stabilizer P)
[PROOF STEP]
have "p ^ a * m = card (subgroups_of_size (p ^ a)) * card (conj.stabilizer P)"
[PROOF STATE]
proof (prove)
using this:
order G = p ^ a * m
P \<in> subgroups_of_size (p ^ a)
order G = card (conj.orbit P) * card (conj.stabilizer P)

goal (1 subgoal):
 1. p ^ a * m = card (subgroups_of_size (p ^ a)) * card (conj.stabilizer P)
[PROOF STEP]
by (metis num_eq_card_orbit)
[PROOF STATE]
proof (state)
this:
p ^ a * m = card (subgroups_of_size (p ^ a)) * card (conj.stabilizer P)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p ^ a * m = card (subgroups_of_size (p ^ a)) * card (conj.stabilizer P)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
from Psize
[PROOF STATE]
proof (chain)
picking this:
P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
interpret stabGroup: group "G\<lparr>carrier := conj.stabilizer P\<rparr>"
[PROOF STATE]
proof (prove)
using this:
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. Group.group (G\<lparr>carrier := conj.stabilizer P\<rparr>)
[PROOF STEP]
by (metis conj.stabilizer_is_subgroup subgroup_imp_group)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
from finite_G Psize
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
have PStab:"subgroup P (G\<lparr>carrier := conj.stabilizer P\<rparr>)"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. subgroup P (G\<lparr>carrier := conj.stabilizer P\<rparr>)
[PROOF STEP]
by (rule stabilizer_supergrp_P)
[PROOF STATE]
proof (state)
this:
subgroup P (G\<lparr>carrier := conj.stabilizer P\<rparr>)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
from finite_G Psize
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)
[PROOF STEP]
have "finite (conj.stabilizer P)"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
P \<in> subgroups_of_size (p ^ a)

goal (1 subgoal):
 1. finite (conj.stabilizer P)
[PROOF STEP]
by (metis card.infinite conj.stabilizer_is_subgroup less_nat_zero_code subgroup.finite_imp_card_positive)
[PROOF STATE]
proof (state)
this:
finite (conj.stabilizer P)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
with finite_G PStab stabGroup.lagrange
[PROOF STATE]
proof (chain)
picking this:
finite (carrier G)
subgroup P (G\<lparr>carrier := conj.stabilizer P\<rparr>)
subgroup ?H (G\<lparr>carrier := conj.stabilizer P\<rparr>) \<Longrightarrow> card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> ?H) * card ?H = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)
finite (conj.stabilizer P)
[PROOF STEP]
have "card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)"
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
subgroup P (G\<lparr>carrier := conj.stabilizer P\<rparr>)
subgroup ?H (G\<lparr>carrier := conj.stabilizer P\<rparr>) \<Longrightarrow> card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> ?H) * card ?H = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)
finite (conj.stabilizer P)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
with cardP
[PROOF STATE]
proof (chain)
picking this:
card P = p ^ a
card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card P = p ^ a
card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = order (G\<lparr>carrier := conj.stabilizer P\<rparr>)

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
unfolding order_def
[PROOF STATE]
proof (prove)
using this:
card P = p ^ a
card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * card P = card (carrier (G\<lparr>carrier := conj.stabilizer P\<rparr>))

goal (1 subgoal):
 1. card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (rcosets\<^bsub>G\<lparr>carrier := conj.stabilizer P\<rparr>\<^esub> P) * p ^ a = card (conj.stabilizer P)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_err_antisym [rule_format]:
  "order r \<Longrightarrow> e1 <=_(le r) e2 \<longrightarrow> e2 <=_(le r) e1 \<longrightarrow> e1=e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> e1 \<sqsubseteq>\<^bsub>le r\<^esub> e2 \<longrightarrow> e2 \<sqsubseteq>\<^bsub>le r\<^esub> e1 \<longrightarrow> e1 = e2
[PROOF STEP]
apply (unfold unfold_lesub_err le_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> (case e2 of Err \<Rightarrow> True | OK y \<Rightarrow> case e1 of Err \<Rightarrow> False | OK x \<Rightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> y) \<longrightarrow> (case e1 of Err \<Rightarrow> True | OK y \<Rightarrow> case e2 of Err \<Rightarrow> False | OK x \<Rightarrow> x \<sqsubseteq>\<^bsub>r\<^esub> y) \<longrightarrow> e1 = e2
[PROOF STEP]
apply (simp split: err.split)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order r \<Longrightarrow> \<forall>x2. e1 = OK x2 \<longrightarrow> (\<forall>x2a. e2 = OK x2a \<longrightarrow> x2 \<sqsubseteq>\<^bsub>r\<^esub> x2a \<longrightarrow> x2a \<sqsubseteq>\<^bsub>r\<^esub> x2 \<longrightarrow> x2 = x2a)
[PROOF STEP]
apply (blast intro: order_antisym)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in finite_measure) finite_measure_Union:
  assumes sets: "A \<in> sets M" "B \<in> sets M" and "A \<inter> B = {}"
  shows "measure M (A \<union> B) = measure M A + measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B
[PROOF STEP]
using measure_Union[OF _ _ assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>emeasure M A \<noteq> \<infinity>; emeasure M B \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B

goal (1 subgoal):
 1. Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B
[PROOF STEP]
by simp


[STATEMENT]
lemma Log_mult:
     "\<lbrakk> 0 < a; a \<noteq> 1; 0 < x; 0 < y \<rbrakk>
      \<Longrightarrow> Log a (x * y) = Log a x + Log a y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < a; a \<noteq> 1; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> Log a (x * y) = Log a x + Log a y
[PROOF STEP]
by (metis Log_powreal_cancel powreal_Log_cancel powreal_add)


[STATEMENT]
lemma K2_isometry_cosh_dist:
  assumes "a \<in> hyp2" and "b \<in> hyp2" and "is_K2_isometry J"
  shows "cosh_dist (apply_cltn2 a J) (apply_cltn2 b J) = cosh_dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh_dist (apply_cltn2 a J) (apply_cltn2 b J) = cosh_dist a b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> hyp2
b \<in> hyp2
is_K2_isometry J

goal (1 subgoal):
 1. cosh_dist (apply_cltn2 a J) (apply_cltn2 b J) = cosh_dist a b
[PROOF STEP]
by (unfold cosh_dist_def) (simp add: K2_isometry_exp_2dist)


[STATEMENT]
lemma phytagorean_theorem_norm:
  assumes o: "orthogonal x y"
  shows "norm (x+y)^2=norm x^2 + norm y^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
have "norm (x+y)^2 = (x+y) \<bullet> (x+y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (x + y) \<bullet> (x + y)
[PROOF STEP]
unfolding power2_norm_eq_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) \<bullet> (x + y) = (x + y) \<bullet> (x + y)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(norm (x + y))\<^sup>2 = (x + y) \<bullet> (x + y)

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(norm (x + y))\<^sup>2 = (x + y) \<bullet> (x + y)

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
have "... = ((x+y) \<bullet> x) + ((x+y) \<bullet> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) \<bullet> (x + y) = (x + y) \<bullet> x + (x + y) \<bullet> y
[PROOF STEP]
unfolding inner_right_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) \<bullet> x + (x + y) \<bullet> y = (x + y) \<bullet> x + (x + y) \<bullet> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(x + y) \<bullet> (x + y) = (x + y) \<bullet> x + (x + y) \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y) \<bullet> (x + y) = (x + y) \<bullet> x + (x + y) \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
have "... = (x \<bullet> x) + (x \<bullet> y) + (y \<bullet> x) + (y \<bullet> y) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + y) \<bullet> x + (x + y) \<bullet> y = x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y
[PROOF STEP]
unfolding real_inner_class.inner_add_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> x + y \<bullet> x + (x \<bullet> y + y \<bullet> y) = x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + y) \<bullet> x + (x + y) \<bullet> y = x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x + y) \<bullet> x + (x + y) \<bullet> y = x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
have "... = (x \<bullet> x) + (y \<bullet> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y
[PROOF STEP]
using o
[PROOF STATE]
proof (prove)
using this:
orthogonal x y

goal (1 subgoal):
 1. x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y
[PROOF STEP]
unfolding orthogonal_def
[PROOF STATE]
proof (prove)
using this:
x \<bullet> y = 0

goal (1 subgoal):
 1. x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y
[PROOF STEP]
by (metis monoid_add_class.add.right_neutral inner_commute)
[PROOF STATE]
proof (state)
this:
x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<bullet> x + x \<bullet> y + y \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
have "... = norm x^2 + norm y^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> x + y \<bullet> y = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
unfolding power2_norm_eq_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet> x + y \<bullet> y = x \<bullet> x + y \<bullet> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<bullet> x + y \<bullet> y = (norm x)\<^sup>2 + (norm y)\<^sup>2

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2

goal (1 subgoal):
 1. (norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(norm (x + y))\<^sup>2 = (norm x)\<^sup>2 + (norm y)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma birkhoff_sum_cmult:
  fixes f::"_ \<Rightarrow> real"
  shows "birkhoff_sum (\<lambda>x. c * f x) n x = c * birkhoff_sum f n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. birkhoff_sum (\<lambda>x. c * f x) n x = c * birkhoff_sum f n x
[PROOF STEP]
unfolding birkhoff_sum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. c * f ((T ^^ i) x)) = c * (\<Sum>i<n. f ((T ^^ i) x))
[PROOF STEP]
by (simp add: sum_distrib_left)


[STATEMENT]
lemma real_pos_mult_max:
  fixes a b c :: "'a :: semiring_real_line"
  assumes c: "c > 0" and a: "is_real a" and b: "is_real b"
  shows "c * max a b = max (c * a) (c * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * max a b = max (c * a) (c * b)
[PROOF STEP]
by (rule hom_max, simp add: real_mult_le_cancel_left_pos[OF a b c])


[STATEMENT]
theorem real_lebesgue_integral_def:
  assumes f[measurable]: "integrable M f"
  shows "integral\<^sup>L M f = enn2real (\<integral>\<^sup>+x. f x \<partial>M) - enn2real (\<integral>\<^sup>+x. ennreal (- f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
have "integral\<^sup>L M f = integral\<^sup>L M (\<lambda>x. max 0 (f x) - max 0 (- f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L M f = LINT x|M. max 0 (f x) - max 0 (- f x)
[PROOF STEP]
by (auto intro!: arg_cong[where f="integral\<^sup>L M"])
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = LINT x|M. max 0 (f x) - max 0 (- f x)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = LINT x|M. max 0 (f x) - max 0 (- f x)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
have "\<dots> = integral\<^sup>L M (\<lambda>x. max 0 (f x)) - integral\<^sup>L M (\<lambda>x. max 0 (- f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. max 0 (f x) - max 0 (- f x) = (LINT x|M. max 0 (f x)) - (LINT x|M. max 0 (- f x))
[PROOF STEP]
by (intro integral_diff integrable_max integrable_minus integrable_zero f)
[PROOF STATE]
proof (state)
this:
LINT x|M. max 0 (f x) - max 0 (- f x) = (LINT x|M. max 0 (f x)) - (LINT x|M. max 0 (- f x))

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. max 0 (f x) - max 0 (- f x) = (LINT x|M. max 0 (f x)) - (LINT x|M. max 0 (- f x))

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>x. max 0 (f x)) = enn2real (\<integral>\<^sup>+x. ennreal (f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. max 0 (f x) = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)
[PROOF STEP]
by (subst integral_eq_nn_integral) (auto intro!: arg_cong[where f=enn2real] nn_integral_cong simp: max_def ennreal_neg)
[PROOF STATE]
proof (state)
this:
LINT x|M. max 0 (f x) = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. max 0 (f x) = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
have "integral\<^sup>L M (\<lambda>x. max 0 (- f x)) = enn2real (\<integral>\<^sup>+x. ennreal (- f x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. max 0 (- f x) = enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
by (subst integral_eq_nn_integral) (auto intro!: arg_cong[where f=enn2real] nn_integral_cong simp: max_def ennreal_neg)
[PROOF STATE]
proof (state)
this:
LINT x|M. max 0 (- f x) = enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)

goal (1 subgoal):
 1. integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
integral\<^sup>L M f = enn2real (\<integral>\<^sup>+ x. ennreal (f x) \<partial>M) - enn2real (\<integral>\<^sup>+ x. ennreal (- f x) \<partial>M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma null_space_is_preserved:
  fixes A::"'a::{field}^'cols^'rows"
  assumes P: "invertible P"
  shows "null_space (P**A) = null_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null_space (P ** A) = null_space A
[PROOF STEP]
unfolding null_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. P ** A *v x = 0} = {x. A *v x = 0}
[PROOF STEP]
using P matrix_inv_left matrix_left_invertible_ker matrix_vector_mul_assoc matrix_vector_mult_0_right
[PROOF STATE]
proof (prove)
using this:
invertible P
invertible ?M \<Longrightarrow> matrix_inv ?M ** ?M = mat (1::?'a)
(\<exists>B. B ** ?A = mat (1::?'a)) = (\<forall>x. ?A *v x = 0 \<longrightarrow> x = 0)
?A *v (?B *v ?x) = ?A ** ?B *v ?x
?A *v 0 = 0

goal (1 subgoal):
 1. {x. P ** A *v x = 0} = {x. A *v x = 0}
[PROOF STEP]
by metis


[STATEMENT]
lemma uniform_limit_null_comparison:
  assumes "\<forall>\<^sub>F x in F. \<forall>a\<in>S. norm (f x a) \<le> g x a"
  assumes "uniform_limit S g (\<lambda>_. 0) F"
  shows "uniform_limit S f (\<lambda>_. 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S f (\<lambda>_. 0::'c) F
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
uniform_limit S g (\<lambda>_. 0) F

goal (1 subgoal):
 1. uniform_limit S f (\<lambda>_. 0::'c) F
[PROOF STEP]
proof (rule metric_uniform_limit_imp_uniform_limit)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) (0::'c) \<le> dist (g x y) 0
[PROOF STEP]
show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) 0 \<le> dist (g x y) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) (0::'c) \<le> dist (g x y) 0
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. \<forall>a\<in>S. norm (f x a) \<le> g x a

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) (0::'c) \<le> dist (g x y) 0
[PROOF STEP]
by (rule eventually_mono) (force simp add: dist_norm)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) (0::'c) \<le> dist (g x y) 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integrable_density:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}" and g :: "'a \<Rightarrow> real"
  assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
    and nn: "AE x in M. 0 \<le> g x"
  shows "integrable (density M g) f \<longleftrightarrow> integrable M (\<lambda>x. g x *\<^sub>R f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (density M (\<lambda>x. ennreal (g x))) f = integrable M (\<lambda>x. g x *\<^sub>R f x)
[PROOF STEP]
unfolding integrable_iff_bounded
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable (density M (\<lambda>x. ennreal (g x))) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>density M (\<lambda>x. ennreal (g x)) < \<infinity>) = ((\<lambda>x. g x *\<^sub>R f x) \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (g x *\<^sub>R f x)) \<partial>M < \<infinity>)
[PROOF STEP]
using nn
[PROOF STATE]
proof (prove)
using this:
AE x in M. 0 \<le> g x

goal (1 subgoal):
 1. (f \<in> borel_measurable (density M (\<lambda>x. ennreal (g x))) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>density M (\<lambda>x. ennreal (g x)) < \<infinity>) = ((\<lambda>x. g x *\<^sub>R f x) \<in> borel_measurable M \<and> \<integral>\<^sup>+ x. ennreal (norm (g x *\<^sub>R f x)) \<partial>M < \<infinity>)
[PROOF STEP]
apply (simp add: nn_integral_density less_top[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. 0 \<le> g x \<Longrightarrow> (\<integral>\<^sup>+ x. ennreal (g x) * ennreal (norm (f x)) \<partial>M = top) = (\<integral>\<^sup>+ x. ennreal (\<bar>g x\<bar> * norm (f x)) \<partial>M = top)
[PROOF STEP]
apply (intro arg_cong2[where f="(=)"] refl nn_integral_cong_AE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M. 0 \<le> g x \<Longrightarrow> AE x in M. ennreal (g x) * ennreal (norm (f x)) = ennreal (\<bar>g x\<bar> * norm (f x))
[PROOF STEP]
apply (auto simp: ennreal_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_UNIV_tau_i_below_zero:
  assumes "finite (UNIV :: 'a set)" and "mono \<tau>"
   and  "(\<forall>i :: nat. ((\<tau> :: ('a set \<Rightarrow> 'a set)) ^^ (i + (1 :: nat)))(UNIV :: 'a set) \<subset> (\<tau> ^^ i) UNIV)"
 shows "card((\<tau> ^^ (card (UNIV ::'a set))) (UNIV ::'a set)) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<tau> ^^ card UNIV) UNIV) \<le> 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card ((\<tau> ^^ card UNIV) UNIV) \<le> 0
[PROOF STEP]
have "(\<forall> i :: nat. card((\<tau> ^^ i) (UNIV ::'a set)) \<le> (card (UNIV :: 'a set)) - i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. card ((\<tau> ^^ i) UNIV) \<le> card UNIV - i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite UNIV
mono \<tau>
\<forall>i. (\<tau> ^^ (i + 1)) UNIV \<subset> (\<tau> ^^ i) UNIV

goal (1 subgoal):
 1. \<forall>i. card ((\<tau> ^^ i) UNIV) \<le> card UNIV - i
[PROOF STEP]
by (rule card_univ_subtract)
[PROOF STATE]
proof (state)
this:
\<forall>i. card ((\<tau> ^^ i) UNIV) \<le> card UNIV - i

goal (1 subgoal):
 1. card ((\<tau> ^^ card UNIV) UNIV) \<le> 0
[PROOF STEP]
thus "card((\<tau> ^^ (card (UNIV ::'a set))) (UNIV ::'a set)) \<le> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>i. card ((\<tau> ^^ i) UNIV) \<le> card UNIV - i

goal (1 subgoal):
 1. card ((\<tau> ^^ card UNIV) UNIV) \<le> 0
[PROOF STEP]
by (drule_tac x = "card (UNIV ::'a set)" in spec, simp)
[PROOF STATE]
proof (state)
this:
card ((\<tau> ^^ card UNIV) UNIV) \<le> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqrt_Max_power2_eq_max_abs:
  "finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> sqrt (Max {(f i)\<^sup>2|i. i \<in> A}) = Max {\<bar>f i\<bar> |i. i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> sqrt (Max {(f i)\<^sup>2 |i. i \<in> A}) = Max {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
apply(subst cSup_eq_Max[symmetric], simp_all)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = Sup {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
using sqrt_Sup_power2_eq_Sup_abs
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> sqrt (Sup {(?f i)\<^sup>2 |i. i \<in> ?A}) = Sup {\<bar>?f i\<bar> |i. i \<in> ?A}

goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> sqrt (Sup {(f i)\<^sup>2 |i. i \<in> A}) = Sup {\<bar>f i\<bar> |i. i \<in> A}
[PROOF STEP]
.


[STATEMENT]
lemma rank_argument_det:
  fixes M :: "('c :: {conjugatable_ordered_field}) mat"
  assumes "M \<in> carrier_mat x y"
  assumes "det (M* M\<^sup>T) \<noteq> 0"
  shows "x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
let ?B = "(M * M\<^sup>T)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
have Mt_car: "M\<^sup>T \<in> carrier_mat y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M\<^sup>T \<in> carrier_mat y x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M \<in> carrier_mat x y
det (M * M\<^sup>T) \<noteq> (0::'c)

goal (1 subgoal):
 1. M\<^sup>T \<in> carrier_mat y x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M\<^sup>T \<in> carrier_mat y x

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
have b_car: "?B \<in> carrier_mat x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * M\<^sup>T \<in> carrier_mat x x
[PROOF STEP]
using transpose_carrier_mat assms
[PROOF STATE]
proof (prove)
using this:
(?A\<^sup>T \<in> carrier_mat ?nc ?nr) = (?A \<in> carrier_mat ?nr ?nc)
M \<in> carrier_mat x y
det (M * M\<^sup>T) \<noteq> (0::'c)

goal (1 subgoal):
 1. M * M\<^sup>T \<in> carrier_mat x x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
M * M\<^sup>T \<in> carrier_mat x x

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
M * M\<^sup>T \<in> carrier_mat x x
[PROOF STEP]
have b_rank: "vec_space.rank x ?B = x"
[PROOF STATE]
proof (prove)
using this:
M * M\<^sup>T \<in> carrier_mat x x

goal (1 subgoal):
 1. rank x (M * M\<^sup>T) = x
[PROOF STEP]
using vec_space.low_rank_det_zero assms(2)
[PROOF STATE]
proof (prove)
using this:
M * M\<^sup>T \<in> carrier_mat x x
\<lbrakk>?A \<in> carrier_mat ?n ?n; det ?A \<noteq> (0::?'a)\<rbrakk> \<Longrightarrow> rank ?n ?A = ?n
det (M * M\<^sup>T) \<noteq> (0::'c)

goal (1 subgoal):
 1. rank x (M * M\<^sup>T) = x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rank x (M * M\<^sup>T) = x

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rank x (M * M\<^sup>T) = x
[PROOF STEP]
have "rank x ?B \<le> min (rank x M) (rank y M\<^sup>T)"
[PROOF STATE]
proof (prove)
using this:
rank x (M * M\<^sup>T) = x

goal (1 subgoal):
 1. rank x (M * M\<^sup>T) \<le> min (rank x M) (rank y M\<^sup>T)
[PROOF STEP]
using rank_mat_mult_lt_min_rank_factor Mt_car b_car assms(1)
[PROOF STATE]
proof (prove)
using this:
rank x (M * M\<^sup>T) = x
\<lbrakk>?A \<in> carrier_mat ?n ?m; ?B \<in> carrier_mat ?m ?nc\<rbrakk> \<Longrightarrow> rank ?n (?A * ?B) \<le> min (rank ?n ?A) (rank ?m ?B)
M\<^sup>T \<in> carrier_mat y x
M * M\<^sup>T \<in> carrier_mat x x
M \<in> carrier_mat x y

goal (1 subgoal):
 1. rank x (M * M\<^sup>T) \<le> min (rank x M) (rank y M\<^sup>T)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
rank x (M * M\<^sup>T) \<le> min (rank x M) (rank y M\<^sup>T)

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
rank x (M * M\<^sup>T) \<le> min (rank x M) (rank y M\<^sup>T)

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
using le_trans vec_space.rank_le_nc
[PROOF STATE]
proof (prove)
using this:
rank x (M * M\<^sup>T) \<le> min (rank x M) (rank y M\<^sup>T)
\<lbrakk>?i \<le> ?j; ?j \<le> ?k\<rbrakk> \<Longrightarrow> ?i \<le> ?k
?A \<in> carrier_mat ?n ?nc \<Longrightarrow> rank ?n ?A \<le> ?nc

goal (1 subgoal):
 1. x \<le> y
[PROOF STEP]
by (metis assms(1) b_rank min.bounded_iff)
[PROOF STATE]
proof (state)
this:
x \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infsetsum_cmult_left:
  fixes f :: "'a \<Rightarrow> 'b :: {banach, real_normed_algebra, second_countable_topology}"
  assumes "c \<noteq> 0 \<Longrightarrow> f abs_summable_on A"
  shows   "infsetsum (\<lambda>x. f x * c) A = infsetsum f A * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x * c) = infsetsum f A * c
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> f abs_summable_on A

goal (1 subgoal):
 1. (\<Sum>\<^sub>ax\<in>A. f x * c) = infsetsum f A * c
[PROOF STEP]
unfolding infsetsum_def abs_summable_on_def
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> integrable (count_space A) f

goal (1 subgoal):
 1. LINT x|count_space A. f x * c = integral\<^sup>L (count_space A) f * c
[PROOF STEP]
by (rule Bochner_Integration.integral_mult_left)


[STATEMENT]
lemma odd_nodes_no_edge[simp]: "finite (nodes g) \<Longrightarrow> num_of_odd_nodes (g \<lparr>edges:={} \<rparr>) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nodes g) \<Longrightarrow> num_of_odd_nodes (g\<lparr>edges := {}\<rparr>) = 0
[PROOF STEP]
unfolding  num_of_odd_nodes_def odd_nodes_set_def degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nodes g) \<Longrightarrow> card {v \<in> nodes (g\<lparr>edges := {}\<rparr>). odd (card {e \<in> edges (g\<lparr>edges := {}\<rparr>). fst e = v})} = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma im_set_mono: "\<lbrakk>f \<in>A \<rightarrow> B; A1 \<subseteq> A2; A2 \<subseteq> A \<rbrakk> \<Longrightarrow> (f ` A1) \<subseteq> (f ` A2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A2; A2 \<subseteq> A\<rbrakk> \<Longrightarrow> f ` A1 \<subseteq> f ` A2
[PROOF STEP]
apply (simp add:image_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; A1 \<subseteq> A2; A2 \<subseteq> A\<rbrakk> \<Longrightarrow> {y. \<exists>x\<in>A1. y = f x} \<subseteq> {y. \<exists>x\<in>A2. y = f x}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma DFT_lower:
  "DFT (2 * m) a i =
  DFT m (%i. a (2 * i)) i +
  (root (2 * m)) ^ i * DFT m (%i. a (2 * i + 1)) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DFT (2 * m) a i = DFT m (\<lambda>i. a (2 * i)) i + FFT.root (2 * m) ^ i * DFT m (\<lambda>i. a (2 * i + 1)) i
[PROOF STEP]
proof (unfold DFT_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
have "(\<Sum>j = 0..<2 * m. root (2 * m) ^ (i * j) * a j) =
    (\<Sum>j = 0..<m. root (2 * m) ^ (i * (2 * j)) * a (2 * j)) +
    (\<Sum>j = 0..<m. root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1))"
    (is "?s = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1))
[PROOF STEP]
by (simp add: sum_splice)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1))

goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1))

goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
have "... = (\<Sum>j = 0..<m. root m ^ (i * j) * a (2 * j)) +
    root (2 * m) ^ i *
    (\<Sum>j = 0..<m. root m ^ (i * j) * a (2 * j + 1))"
    (is "_ = ?t")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1)) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
txt \<open>First pair of sums\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1)) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
apply (simp add: root_cancel1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i + i * (2 * j)) * a (Suc (2 * j))) = FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (Suc (2 * j)))
[PROOF STEP]
txt \<open>Second pair of sums\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i + i * (2 * j)) * a (Suc (2 * j))) = FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (Suc (2 * j)))
[PROOF STEP]
apply (simp add: sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i + i * (2 * j)) * a (Suc (2 * j))) = (\<Sum>n = 0..<m. FFT.root (2 * m) ^ i * (FFT.root m ^ (i * n) * a (Suc (2 * n))))
[PROOF STEP]
apply (simp add: power_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ i * FFT.root (2 * m) ^ (i * (2 * j)) * a (Suc (2 * j))) = (\<Sum>n = 0..<m. FFT.root (2 * m) ^ i * (FFT.root m ^ (i * n) * a (Suc (2 * n))))
[PROOF STEP]
apply (simp add: root_cancel1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<m. FFT.root (2 * m) ^ i * FFT.root m ^ (i * j) * a (Suc (2 * j))) = (\<Sum>n = 0..<m. FFT.root (2 * m) ^ i * (FFT.root m ^ (i * n) * a (Suc (2 * n))))
[PROOF STEP]
apply (simp add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j)) * a (2 * j)) + (\<Sum>j = 0..<m. FFT.root (2 * m) ^ (i * (2 * j + 1)) * a (2 * j + 1)) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))

goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
show "?s = ?t"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))

goal (1 subgoal):
 1. (\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<2 * m. FFT.root (2 * m) ^ (i * j) * a j) = (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j)) + FFT.root (2 * m) ^ i * (\<Sum>j = 0..<m. FFT.root m ^ (i * j) * a (2 * j + 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma and_dfa_accepts:
  assumes "wf_dfa M n"
  and "wf_dfa N n"
  and "list_all (is_alph n) bs"
  shows "dfa_accepts (and_dfa M N) bs = (dfa_accepts M bs \<and> dfa_accepts N bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dfa_accepts (and_dfa M N) bs = (dfa_accepts M bs \<and> dfa_accepts N bs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
wf_dfa N n
list_all (is_alph n) bs

goal (1 subgoal):
 1. dfa_accepts (and_dfa M N) bs = (dfa_accepts M bs \<and> dfa_accepts N bs)
[PROOF STEP]
by (simp add: binop_dfa_accepts and_dfa_def)


[STATEMENT]
lemma complex_add_divide_simps[vector_add_divide_simps]:  (* In Real_Vector_Spaces, these lemmas are unnamed *)
  "v + (b / z) *\<^sub>C w = (if z = 0 then v else (z *\<^sub>C v + b *\<^sub>C w) /\<^sub>C z)"
  "a *\<^sub>C v + (b / z) *\<^sub>C w = (if z = 0 then a *\<^sub>C v else ((a * z) *\<^sub>C v + b *\<^sub>C w) /\<^sub>C z)"
  "(a / z) *\<^sub>C v + w = (if z = 0 then w else (a *\<^sub>C v + z *\<^sub>C w) /\<^sub>C z)"
  "(a / z) *\<^sub>C v + b *\<^sub>C w = (if z = 0 then b *\<^sub>C w else (a *\<^sub>C v + (b * z) *\<^sub>C w) /\<^sub>C z)"
  "v - (b / z) *\<^sub>C w = (if z = 0 then v else (z *\<^sub>C v - b *\<^sub>C w) /\<^sub>C z)"
  "a *\<^sub>C v - (b / z) *\<^sub>C w = (if z = 0 then a *\<^sub>C v else ((a * z) *\<^sub>C v - b *\<^sub>C w) /\<^sub>C z)"
  "(a / z) *\<^sub>C v - w = (if z = 0 then -w else (a *\<^sub>C v - z *\<^sub>C w) /\<^sub>C z)"
  "(a / z) *\<^sub>C v - b *\<^sub>C w = (if z = 0 then -b *\<^sub>C w else (a *\<^sub>C v - (b * z) *\<^sub>C w) /\<^sub>C z)"
  for v :: "'a :: complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((v + (b / z) *\<^sub>C w = (if z = 0 then v else (z *\<^sub>C v + b *\<^sub>C w) /\<^sub>C z) &&& a *\<^sub>C v + (b / z) *\<^sub>C w = (if z = 0 then a *\<^sub>C v else ((a * z) *\<^sub>C v + b *\<^sub>C w) /\<^sub>C z)) &&& (a / z) *\<^sub>C v + w = (if z = 0 then w else (a *\<^sub>C v + z *\<^sub>C w) /\<^sub>C z) &&& (a / z) *\<^sub>C v + b *\<^sub>C w = (if z = 0 then b *\<^sub>C w else (a *\<^sub>C v + (b * z) *\<^sub>C w) /\<^sub>C z)) &&& (v - (b / z) *\<^sub>C w = (if z = 0 then v else (z *\<^sub>C v - b *\<^sub>C w) /\<^sub>C z) &&& a *\<^sub>C v - (b / z) *\<^sub>C w = (if z = 0 then a *\<^sub>C v else ((a * z) *\<^sub>C v - b *\<^sub>C w) /\<^sub>C z)) &&& (a / z) *\<^sub>C v - w = (if z = 0 then - w else (a *\<^sub>C v - z *\<^sub>C w) /\<^sub>C z) &&& (a / z) *\<^sub>C v - b *\<^sub>C w = (if z = 0 then - b *\<^sub>C w else (a *\<^sub>C v - (b * z) *\<^sub>C w) /\<^sub>C z)
[PROOF STEP]
by (simp_all add: divide_inverse_commute scaleC_add_right scaleC_diff_right)


[STATEMENT]
lemma wordinterval_setminus'_set_eq:
    "wordinterval_to_set (wordinterval_setminus' r1 r2) =
      wordinterval_to_set r1 - wordinterval_to_set r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wordinterval_to_set (wordinterval_setminus' r1 r2) = wordinterval_to_set r1 - wordinterval_to_set r2
[PROOF STEP]
apply(induction rule: wordinterval_setminus'.induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>s e ms me. wordinterval_to_set (wordinterval_setminus' (WordInterval s e) (WordInterval ms me)) = wordinterval_to_set (WordInterval s e) - wordinterval_to_set (WordInterval ms me)
 2. \<And>r1 r2 t. \<lbrakk>wordinterval_to_set (wordinterval_setminus' r1 t) = wordinterval_to_set r1 - wordinterval_to_set t; wordinterval_to_set (wordinterval_setminus' r2 t) = wordinterval_to_set r2 - wordinterval_to_set t\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (RangeUnion r1 r2) t) = wordinterval_to_set (RangeUnion r1 r2) - wordinterval_to_set t
 3. \<And>v va r1 r2. \<lbrakk>wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set r1; wordinterval_to_set (wordinterval_setminus' (wordinterval_setminus' (WordInterval v va) r1) r2) = wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) - wordinterval_to_set r2\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (WordInterval v va) (RangeUnion r1 r2)) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set (RangeUnion r1 r2)
[PROOF STEP]
using wordinterval_setminus'_rr_set_eq
[PROOF STATE]
proof (prove)
using this:
wordinterval_to_set (wordinterval_setminus' (WordInterval ?s ?e) (WordInterval ?ms ?me)) = wordinterval_to_set (WordInterval ?s ?e) - wordinterval_to_set (WordInterval ?ms ?me)

goal (3 subgoals):
 1. \<And>s e ms me. wordinterval_to_set (wordinterval_setminus' (WordInterval s e) (WordInterval ms me)) = wordinterval_to_set (WordInterval s e) - wordinterval_to_set (WordInterval ms me)
 2. \<And>r1 r2 t. \<lbrakk>wordinterval_to_set (wordinterval_setminus' r1 t) = wordinterval_to_set r1 - wordinterval_to_set t; wordinterval_to_set (wordinterval_setminus' r2 t) = wordinterval_to_set r2 - wordinterval_to_set t\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (RangeUnion r1 r2) t) = wordinterval_to_set (RangeUnion r1 r2) - wordinterval_to_set t
 3. \<And>v va r1 r2. \<lbrakk>wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set r1; wordinterval_to_set (wordinterval_setminus' (wordinterval_setminus' (WordInterval v va) r1) r2) = wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) - wordinterval_to_set r2\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (WordInterval v va) (RangeUnion r1 r2)) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set (RangeUnion r1 r2)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>r1 r2 t. \<lbrakk>wordinterval_to_set (wordinterval_setminus' r1 t) = wordinterval_to_set r1 - wordinterval_to_set t; wordinterval_to_set (wordinterval_setminus' r2 t) = wordinterval_to_set r2 - wordinterval_to_set t\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (RangeUnion r1 r2) t) = wordinterval_to_set (RangeUnion r1 r2) - wordinterval_to_set t
 2. \<And>v va r1 r2. \<lbrakk>wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set r1; wordinterval_to_set (wordinterval_setminus' (wordinterval_setminus' (WordInterval v va) r1) r2) = wordinterval_to_set (wordinterval_setminus' (WordInterval v va) r1) - wordinterval_to_set r2\<rbrakk> \<Longrightarrow> wordinterval_to_set (wordinterval_setminus' (WordInterval v va) (RangeUnion r1 r2)) = wordinterval_to_set (WordInterval v va) - wordinterval_to_set (RangeUnion r1 r2)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem ln_lower_11_eq: "0<x \<Longrightarrow>
    ln_lower_11 x = (1/30)*(142*x^5 + 2272*x^4 + 6397*x^3 + 4397*x^2 + 647*x + 5)*(x - 1) /
                    (x*(x^5 + 30*x^4 + 150*x^3 + 200*x^2 + 75*x + 6))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> ln_lower_11 x = 1 / 30 * (142 * x ^ 5 + 2272 * x ^ 4 + 6397 * x ^ 3 + 4397 * x\<^sup>2 + 647 * x + 5) * (x - 1) / (x * (x ^ 5 + 30 * x ^ 4 + 150 * x ^ 3 + 200 * x\<^sup>2 + 75 * x + 6))
[PROOF STEP]
unfolding ln_lower_11_def ln_upper_11_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> - ((5 * inverse x ^ 5 + 647 * inverse x ^ 4 + 4397 * inverse x ^ 3 + 6397 * (inverse x)\<^sup>2 + 2272 * inverse x + 142) * (inverse x - 1) / (30 * (6 * inverse x ^ 5 + 75 * inverse x ^ 4 + 200 * inverse x ^ 3 + 150 * (inverse x)\<^sup>2 + 30 * inverse x + 1))) = 1 / 30 * (142 * x ^ 5 + 2272 * x ^ 4 + 6397 * x ^ 3 + 4397 * x\<^sup>2 + 647 * x + 5) * (x - 1) / (x * (x ^ 5 + 30 * x ^ 4 + 150 * x ^ 3 + 200 * x\<^sup>2 + 75 * x + 6))
[PROOF STEP]
by (simp add: zero_less_mult_iff add_pos_pos dual_order.strict_implies_not_eq divide_simps)
     algebra


[STATEMENT]
lemma coprime_crossproduct_int:
  fixes a b c d :: int
  assumes "coprime a d" and "coprime b c"
  shows "\<bar>a\<bar> * \<bar>c\<bar> = \<bar>b\<bar> * \<bar>d\<bar> \<longleftrightarrow> \<bar>a\<bar> = \<bar>b\<bar> \<and> \<bar>c\<bar> = \<bar>d\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<bar>a\<bar> * \<bar>c\<bar> = \<bar>b\<bar> * \<bar>d\<bar>) = (\<bar>a\<bar> = \<bar>b\<bar> \<and> \<bar>c\<bar> = \<bar>d\<bar>)
[PROOF STEP]
using assms coprime_crossproduct [of a d b c]
[PROOF STATE]
proof (prove)
using this:
coprime a d
coprime b c
\<lbrakk>coprime a d; coprime b c\<rbrakk> \<Longrightarrow> (normalize a * normalize c = normalize b * normalize d) = (normalize a = normalize b \<and> normalize c = normalize d)

goal (1 subgoal):
 1. (\<bar>a\<bar> * \<bar>c\<bar> = \<bar>b\<bar> * \<bar>d\<bar>) = (\<bar>a\<bar> = \<bar>b\<bar> \<and> \<bar>c\<bar> = \<bar>d\<bar>)
[PROOF STEP]
by simp


[STATEMENT]
lemma (in aGroup) ring_nsum_zeroTr:"(\<forall>j \<le> (n::nat). f j \<in> carrier A) \<and>
                    (\<forall>j \<le> n. f j = \<zero>) \<longrightarrow> nsum A f n = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> carrier A) \<and> (\<forall>j\<le>0. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f 0 = \<zero>
 2. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<and> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (rule impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<forall>j\<le>0. f j \<in> carrier A) \<and> (\<forall>j\<le>0. f j = \<zero>) \<Longrightarrow> \<Sigma>\<^sub>e A f 0 = \<zero>
 2. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<and> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>j\<le>0. f j \<in> carrier A; \<forall>j\<le>0. f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f 0 = \<zero>
 2. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<and> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. (\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero> \<Longrightarrow> (\<forall>j\<le>Suc n. f j \<in> carrier A) \<and> (\<forall>j\<le>Suc n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (rule impI, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<forall>j\<le>n. f j \<in> carrier A) \<and> (\<forall>j\<le>n. f j = \<zero>) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>; \<forall>j\<le>Suc n. f j \<in> carrier A; \<forall>j\<le>Suc n. f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f Suc n = \<zero>
[PROOF STEP]
apply (cut_tac n = n in Nsetn_sub_mem1, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>((\<exists>j. j \<le> n) \<longrightarrow> \<zero> \<in> carrier A) \<longrightarrow> \<Sigma>\<^sub>e A f n = \<zero>; (\<exists>j. j \<le> Suc n) \<longrightarrow> \<zero> \<in> carrier A; \<forall>j\<le>Suc n. f j = \<zero>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e A f n \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (simp add:ag_inc_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<Sigma>\<^sub>e A f n = \<zero>; \<forall>j\<le>Suc n. f j = \<zero>\<rbrakk> \<Longrightarrow> \<zero> \<plusminus> \<zero> = \<zero>
[PROOF STEP]
apply (cut_tac ag_inc_zero,
        simp add:ag_r_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iffExI:
  "\<lbrakk> \<And>x. P x \<Longrightarrow> Q x; \<And>x. Q x \<Longrightarrow> P x \<rbrakk> \<Longrightarrow> (\<exists>x. P x) \<longleftrightarrow> (\<exists>x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. P x \<Longrightarrow> Q x; \<And>x. Q x \<Longrightarrow> P x\<rbrakk> \<Longrightarrow> (\<exists>x. P x) = (\<exists>x. Q x)
[PROOF STEP]
by metis


[STATEMENT]
lemma polar_identity:
  includes notation_norm
  shows \<open>\<parallel>x + y\<parallel>^2 = \<parallel>x\<parallel>^2 + \<parallel>y\<parallel>^2 + 2 * Re (x \<bullet>\<^sub>C y)\<close>
    \<comment> \<open>Shown in the proof of Corollary 1.5 in @{cite conway2013course}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
have \<open>(x \<bullet>\<^sub>C y) + (y \<bullet>\<^sub>C x) = (x \<bullet>\<^sub>C y) + cnj (x \<bullet>\<^sub>C y)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = x \<bullet>\<^sub>C y + cnj (x \<bullet>\<^sub>C y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = x \<bullet>\<^sub>C y + cnj (x \<bullet>\<^sub>C y)

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
hence \<open>(x \<bullet>\<^sub>C y) + (y \<bullet>\<^sub>C x) = 2 * Re (x \<bullet>\<^sub>C y) \<close>
[PROOF STATE]
proof (prove)
using this:
x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = x \<bullet>\<^sub>C y + cnj (x \<bullet>\<^sub>C y)

goal (1 subgoal):
 1. x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = complex_of_real (2 * Re (x \<bullet>\<^sub>C y))
[PROOF STEP]
using complex_add_cnj
[PROOF STATE]
proof (prove)
using this:
x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = x \<bullet>\<^sub>C y + cnj (x \<bullet>\<^sub>C y)
?z + cnj ?z = complex_of_real (2 * Re ?z)

goal (1 subgoal):
 1. x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = complex_of_real (2 * Re (x \<bullet>\<^sub>C y))
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = complex_of_real (2 * Re (x \<bullet>\<^sub>C y))

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
have \<open>\<parallel>x + y\<parallel>^2 = (x+y) \<bullet>\<^sub>C (x+y)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = (x + y) \<bullet>\<^sub>C (x + y)
[PROOF STEP]
by (simp add: cdot_square_norm)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = (x + y) \<bullet>\<^sub>C (x + y)

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
hence \<open>\<parallel>x + y\<parallel>^2 = (x \<bullet>\<^sub>C x) + (x \<bullet>\<^sub>C y) + (y \<bullet>\<^sub>C x) + (y \<bullet>\<^sub>C y)\<close>
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = (x + y) \<bullet>\<^sub>C (x + y)

goal (1 subgoal):
 1. complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = x \<bullet>\<^sub>C x + x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x + y \<bullet>\<^sub>C y
[PROOF STEP]
by (simp add: cinner_add_left cinner_add_right)
[PROOF STATE]
proof (state)
this:
complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = x \<bullet>\<^sub>C x + x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x + y \<bullet>\<^sub>C y

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = x \<bullet>\<^sub>C x + x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x + y \<bullet>\<^sub>C y

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
using  \<open>(x \<bullet>\<^sub>C y) + (y \<bullet>\<^sub>C x) = 2 * Re (x \<bullet>\<^sub>C y)\<close>
[PROOF STATE]
proof (prove)
using this:
complex_of_real (\<parallel>x + y\<parallel>\<^sup>2) = x \<bullet>\<^sub>C x + x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x + y \<bullet>\<^sub>C y
x \<bullet>\<^sub>C y + y \<bullet>\<^sub>C x = complex_of_real (2 * Re (x \<bullet>\<^sub>C y))

goal (1 subgoal):
 1. \<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)
[PROOF STEP]
by (smt (verit, ccfv_SIG) Re_complex_of_real plus_complex.simps(1) power2_norm_eq_cinner')
[PROOF STATE]
proof (state)
this:
\<parallel>x + y\<parallel>\<^sup>2 = \<parallel>x\<parallel>\<^sup>2 + \<parallel>y\<parallel>\<^sup>2 + 2 * Re (x \<bullet>\<^sub>C y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma stoch_non_neg_vec_norm1: assumes "stoch_vec (v :: real ^ 'n)" "non_neg_vec v"
  shows "norm1 v = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm1 v = 1
[PROOF STEP]
unfolding assms(1)[unfolded stoch_vec_def, symmetric] norm1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. norm (v $h i)) = sum (($h) v) UNIV
[PROOF STEP]
by (rule sum.cong, insert assms(2)[unfolded non_neg_vec_def], auto)


[STATEMENT]
lemma row_transpose_scalar_prod_as_sum:
assumes j: "j < dim_col A" and dim_v: "dim_vec v = dim_row A"
shows "row (transpose_mat A) j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i,j) * v $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
have "row (transpose_mat A) j \<bullet> v = col A j \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = col A j \<bullet> v
[PROOF STEP]
using j row_transpose
[PROOF STATE]
proof (prove)
using this:
j < dim_col A
?j < dim_col ?A \<Longrightarrow> row ?A\<^sup>T ?j = col ?A ?j

goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = col A j \<bullet> v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row A\<^sup>T j \<bullet> v = col A j \<bullet> v

goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row A\<^sup>T j \<bullet> v = col A j \<bullet> v

goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
have "... = (\<Sum>i = 0..<dim_vec v. A $$ (i,j) * v $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col A j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
by (rule col_scalar_prod_as_sum[OF dim_v])
[PROOF STATE]
proof (state)
this:
col A j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)

goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)

goal (1 subgoal):
 1. row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
row A\<^sup>T j \<bullet> v = (\<Sum>i = 0..<dim_vec v. A $$ (i, j) * v $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_45: "cos (pi / 4) = sqrt 2 / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
let ?c = "cos (pi / 4)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
let ?s = "sin (pi / 4)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
have nonneg: "0 \<le> ?c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> cos (pi / 4)
[PROOF STEP]
by (simp add: cos_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> cos (pi / 4)

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
have "0 = cos (pi / 4 + pi / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = cos (pi / 4 + pi / 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 = cos (pi / 4 + pi / 4)

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = cos (pi / 4 + pi / 4)

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
have "cos (pi / 4 + pi / 4) = ?c\<^sup>2 - ?s\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (pi / 4 + pi / 4) = (cos (pi / 4))\<^sup>2 - (sin (pi / 4))\<^sup>2
[PROOF STEP]
by (simp only: cos_add power2_eq_square)
[PROOF STATE]
proof (state)
this:
cos (pi / 4 + pi / 4) = (cos (pi / 4))\<^sup>2 - (sin (pi / 4))\<^sup>2

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (pi / 4 + pi / 4) = (cos (pi / 4))\<^sup>2 - (sin (pi / 4))\<^sup>2

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
have "\<dots> = 2 * ?c\<^sup>2 - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos (pi / 4))\<^sup>2 - (sin (pi / 4))\<^sup>2 = 2 * (cos (pi / 4))\<^sup>2 - 1
[PROOF STEP]
by (simp add: sin_squared_eq)
[PROOF STATE]
proof (state)
this:
(cos (pi / 4))\<^sup>2 - (sin (pi / 4))\<^sup>2 = 2 * (cos (pi / 4))\<^sup>2 - 1

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
0 = 2 * (cos (pi / 4))\<^sup>2 - 1
[PROOF STEP]
have "?c\<^sup>2 = (sqrt 2 / 2)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 = 2 * (cos (pi / 4))\<^sup>2 - 1

goal (1 subgoal):
 1. (cos (pi / 4))\<^sup>2 = (sqrt 2 / 2)\<^sup>2
[PROOF STEP]
by (simp add: power_divide)
[PROOF STATE]
proof (state)
this:
(cos (pi / 4))\<^sup>2 = (sqrt 2 / 2)\<^sup>2

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(cos (pi / 4))\<^sup>2 = (sqrt 2 / 2)\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(cos (pi / 4))\<^sup>2 = (sqrt 2 / 2)\<^sup>2

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
(cos (pi / 4))\<^sup>2 = (sqrt 2 / 2)\<^sup>2
0 \<le> cos (pi / 4)

goal (1 subgoal):
 1. cos (pi / 4) = sqrt 2 / 2
[PROOF STEP]
by (rule power2_eq_imp_eq) simp
[PROOF STATE]
proof (state)
this:
cos (pi / 4) = sqrt 2 / 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_div_gt_0:
  fixes a :: nat
  assumes "a > 0" and "b > 0"
  shows "lcm a b div a > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
have "lcm a b = (a * b) div (gcd a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm a b = a * b div gcd a b
[PROOF STEP]
using lcm_nat_def
[PROOF STATE]
proof (prove)
using this:
lcm ?x ?y = ?x * ?y div gcd ?x ?y

goal (1 subgoal):
 1. lcm a b = a * b div gcd a b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
lcm a b = a * b div gcd a b

goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
lcm a b = a * b div gcd a b

goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
have "\<dots> > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < a * b div gcd a b
[PROOF STEP]
using  assms
[PROOF STATE]
proof (prove)
using this:
0 < a
0 < b

goal (1 subgoal):
 1. 0 < a * b div gcd a b
[PROOF STEP]
by (metis assms calculation lcm_pos_nat)
[PROOF STATE]
proof (state)
this:
0 < a * b div gcd a b

goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lcm a b = a * b div gcd a b
0 < a * b div gcd a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lcm a b = a * b div gcd a b
0 < a * b div gcd a b

goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lcm a b = a * b div gcd a b
0 < a * b div gcd a b
0 < a
0 < b

goal (1 subgoal):
 1. 0 < lcm a b div a
[PROOF STEP]
by simp (metis div_greater_zero_iff div_le_mono2 div_mult_self_is_m gcd_le2_nat not_gr0)
[PROOF STATE]
proof (state)
this:
0 < lcm a b div a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_swap:
  fixes x y :: "complex vec"
  assumes "y \<in> carrier_vec n" and "x \<in> carrier_vec n"
  shows "inner_prod y x = conjugate (inner_prod x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod y x = conjugate (inner_prod x y)
[PROOF STEP]
apply (simp add: scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec y. x $ i * cnj (y $ i)) = (\<Sum>xa = 0..<dim_vec x. cnj (y $ xa) * x $ xa)
[PROOF STEP]
apply (rule sum.cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {0..<dim_vec y} = {0..<dim_vec x}
 2. \<And>xa. xa \<in> {0..<dim_vec x} \<Longrightarrow> x $ xa * cnj (y $ xa) = cnj (y $ xa) * x $ xa
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier_vec n
x \<in> carrier_vec n

goal (2 subgoals):
 1. {0..<dim_vec y} = {0..<dim_vec x}
 2. \<And>xa. xa \<in> {0..<dim_vec x} \<Longrightarrow> x $ xa * cnj (y $ xa) = cnj (y $ xa) * x $ xa
[PROOF STEP]
by auto