[STATEMENT]
lemma diameter_open_interval [simp]: "diameter {a<..<b} = (if b < a then 0 else b-a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diameter {a<..<b} = (if b < a then 0 else b - a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diameter {a<..<b} = (if b < a then 0 else b - a)
[PROOF STEP]
have "{a <..< b} = ball ((a+b)/2) ((b-a)/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<..<b} = ball ((a + b) / 2) ((b - a) / 2)
[PROOF STEP]
by (auto simp: dist_norm abs_if field_split_simps split: if_split_asm)
[PROOF STATE]
proof (state)
this:
{a<..<b} = ball ((a + b) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. diameter {a<..<b} = (if b < a then 0 else b - a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a<..<b} = ball ((a + b) / 2) ((b - a) / 2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a<..<b} = ball ((a + b) / 2) ((b - a) / 2)

goal (1 subgoal):
 1. diameter {a<..<b} = (if b < a then 0 else b - a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diameter {a<..<b} = (if b < a then 0 else b - a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma x_coord_bounds:
  assumes "(0::real) \<le> x" "x \<le> 1"
  shows "-1/2 \<le> x_coord x \<and> x_coord x \<le> 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 / 2 \<le> x_coord x \<and> x_coord x \<le> 1 / 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. - 1 / 2 \<le> x_coord x \<and> x_coord x \<le> 1 / 2
[PROOF STEP]
by(auto simp add: x_coord_def)


[STATEMENT]
lemma mset_set_subset_iff: "finite A \<Longrightarrow> mset_set A \<subseteq># B \<longleftrightarrow> A \<subseteq> set_mset B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (mset_set A \<subseteq># B) = (A \<subseteq> set_mset B)
[PROOF STEP]
by (metis finite_set_mset finite_set_mset_mset_set mset_set_set_mset_msubset
            msubset_mset_set_iff set_mset_mono subset_mset.trans)


[STATEMENT]
lemma measure_prob_cong_0:
  assumes "\<And>x. x \<in> A - B \<Longrightarrow> pmf p x = 0"
  assumes "\<And>x. x \<in> B - A \<Longrightarrow> pmf p x = 0"
  shows   "measure (measure_pmf p) A = measure (measure_pmf p) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
have "measure_pmf.prob p A = measure_pmf.prob p (A \<inter> set_pmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p (A \<inter> set_pmf p)
[PROOF STEP]
by (simp add: measure_Int_set_pmf)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = measure_pmf.prob p (A \<inter> set_pmf p)

goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = measure_pmf.prob p (A \<inter> set_pmf p)

goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
have "A \<inter> set_pmf p = B \<inter> set_pmf p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> set_pmf p = B \<inter> set_pmf p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> A - B \<Longrightarrow> pmf p ?x = 0
?x \<in> B - A \<Longrightarrow> pmf p ?x = 0

goal (1 subgoal):
 1. A \<inter> set_pmf p = B \<inter> set_pmf p
[PROOF STEP]
by (auto simp: set_pmf_eq)
[PROOF STATE]
proof (state)
this:
A \<inter> set_pmf p = B \<inter> set_pmf p

goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A \<inter> set_pmf p = B \<inter> set_pmf p

goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
have "measure_pmf.prob p \<dots> = measure_pmf.prob p B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p (B \<inter> set_pmf p) = measure_pmf.prob p B
[PROOF STEP]
by (simp add: measure_Int_set_pmf)
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p (B \<inter> set_pmf p) = measure_pmf.prob p B

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

goal (1 subgoal):
 1. measure_pmf.prob p A = measure_pmf.prob p B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
measure_pmf.prob p A = measure_pmf.prob p B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fib_2 [simp]: "fib 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib 2 = 1
[PROOF STEP]
using fib.simps(3) [of 0]
[PROOF STATE]
proof (prove)
using this:
fib (Suc (Suc 0)) = fib (Suc 0) + fib 0

goal (1 subgoal):
 1. fib 2 = 1
[PROOF STEP]
by (simp add: numeral_2_eq_2)


[STATEMENT]
lemma outer_prod_minus_left:
  fixes v::"complex Matrix.vec"
  assumes "dim_vec v = dim_vec x"
  shows "outer_prod (v - x) w = outer_prod v w - (outer_prod x w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
define paw where "paw = outer_prod (v-x) w"
[PROOF STATE]
proof (state)
this:
paw = outer_prod (v - x) w

goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
define apw where "apw = outer_prod v w - (outer_prod x w)"
[PROOF STATE]
proof (state)
this:
apw = outer_prod v w - outer_prod x w

goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
have "paw = apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. paw = apw
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
have rv: "dim_row paw = dim_vec v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row paw = dim_vec v
[PROOF STEP]
unfolding paw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (outer_prod (v - x) w) = dim_vec v
[PROOF STEP]
using outer_prod_dim assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
dim_vec v = dim_vec x

goal (1 subgoal):
 1. dim_row (outer_prod (v - x) w) = dim_vec v
[PROOF STEP]
by (metis carrier_matD(1) carrier_vec_dim_vec index_minus_vec(2) paw_def)
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_vec v

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
have "... = dim_row apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = dim_row apw
[PROOF STEP]
unfolding apw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec v = dim_row (outer_prod v w - outer_prod x w)
[PROOF STEP]
using outer_prod_dim assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
dim_vec v = dim_vec x

goal (1 subgoal):
 1. dim_vec v = dim_row (outer_prod v w - outer_prod x w)
[PROOF STEP]
by (metis carrier_matD(1) carrier_vec_dim_vec index_minus_mat(2))
[PROOF STATE]
proof (state)
this:
dim_vec v = dim_row apw

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_row paw = dim_row apw
 3. dim_col paw = dim_col apw
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_row paw = dim_row apw
[PROOF STEP]
show dr: "dim_row paw = dim_row apw"
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row apw

goal (1 subgoal):
 1. dim_row paw = dim_row apw
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_row paw = dim_row apw

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
have cw: "dim_col paw = dim_vec w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col paw = dim_vec w
[PROOF STEP]
unfolding paw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (outer_prod (v - x) w) = dim_vec w
[PROOF STEP]
using outer_prod_dim assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
dim_vec v = dim_vec x

goal (1 subgoal):
 1. dim_col (outer_prod (v - x) w) = dim_vec w
[PROOF STEP]
using carrier_vec_dim_vec
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
dim_vec v = dim_vec x
?v \<in> carrier_vec (dim_vec ?v)

goal (1 subgoal):
 1. dim_col (outer_prod (v - x) w) = dim_vec w
[PROOF STEP]
by (metis carrier_matD(2))
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_vec w

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_vec w

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
have "... = dim_col apw"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_col apw
[PROOF STEP]
unfolding apw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec w = dim_col (outer_prod v w - outer_prod x w)
[PROOF STEP]
using outer_prod_dim
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m

goal (1 subgoal):
 1. dim_vec w = dim_col (outer_prod v w - outer_prod x w)
[PROOF STEP]
by (metis apw_def carrier_matD(2) carrier_vec_dim_vec minus_carrier_mat)
[PROOF STATE]
proof (state)
this:
dim_vec w = dim_col apw

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
 2. dim_col paw = dim_col apw
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dim_col paw = dim_col apw
[PROOF STEP]
show dc: "dim_col paw = dim_col apw"
[PROOF STATE]
proof (prove)
using this:
dim_col paw = dim_col apw

goal (1 subgoal):
 1. dim_col paw = dim_col apw
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dim_col paw = dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
show "\<And>i j. i < dim_row apw \<Longrightarrow> j < dim_col apw \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
assume  "i < dim_row apw" and "j < dim_col apw"
[PROOF STATE]
proof (state)
this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
note ij = this
[PROOF STATE]
proof (state)
this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
hence "paw $$ (i,j) = (Matrix.vec_index v i - Matrix.vec_index x i) *
        cnj (Matrix.vec_index w j)"
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. paw $$ (i, j) = (v $ i - x $ i) * cnj (w $ j)
[PROOF STEP]
using dr dc
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw
dim_row paw = dim_row apw
dim_col paw = dim_col apw

goal (1 subgoal):
 1. paw $$ (i, j) = (v $ i - x $ i) * cnj (w $ j)
[PROOF STEP]
unfolding  paw_def outer_prod_def
[PROOF STATE]
proof (prove)
using this:
i < dim_row apw
j < dim_col apw
dim_row (Matrix.mat (dim_vec (v - x)) 1 (\<lambda>(i, j). (v - x) $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) = dim_row apw
dim_col (Matrix.mat (dim_vec (v - x)) 1 (\<lambda>(i, j). (v - x) $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) = dim_col apw

goal (1 subgoal):
 1. (Matrix.mat (dim_vec (v - x)) 1 (\<lambda>(i, j). (v - x) $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j) = (v $ i - x $ i) * cnj (w $ j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = (v $ i - x $ i) * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = (v $ i - x $ i) * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
have "... = Matrix.vec_index v i * cnj (Matrix.vec_index w j) -
        Matrix.vec_index x i * cnj (Matrix.vec_index w j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v $ i - x $ i) * cnj (w $ j) = v $ i * cnj (w $ j) - x $ i * cnj (w $ j)
[PROOF STEP]
by (simp add: ring_class.ring_distribs)
[PROOF STATE]
proof (state)
this:
(v $ i - x $ i) * cnj (w $ j) = v $ i * cnj (w $ j) - x $ i * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(v $ i - x $ i) * cnj (w $ j) = v $ i * cnj (w $ j) - x $ i * cnj (w $ j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
have "... = (outer_prod v w) $$ (i,j) - (outer_prod x w) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v $ i * cnj (w $ j) - x $ i * cnj (w $ j) = outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j)
[PROOF STEP]
using rv cw dr dc ij assms
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_vec v
dim_col paw = dim_vec w
dim_row paw = dim_row apw
dim_col paw = dim_col apw
i < dim_row apw
j < dim_col apw
dim_vec v = dim_vec x

goal (1 subgoal):
 1. v $ i * cnj (w $ j) - x $ i * cnj (w $ j) = outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j)
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_vec v
dim_col paw = dim_vec w
dim_row paw = dim_row apw
dim_col paw = dim_col apw
i < dim_row apw
j < dim_col apw
dim_vec v = dim_vec x

goal (1 subgoal):
 1. v $ i * cnj (w $ j) - x $ i * cnj (w $ j) = (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j) - (Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v $ i * cnj (w $ j) - x $ i * cnj (w $ j) = outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v $ i * cnj (w $ j) - x $ i * cnj (w $ j) = outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_row apw; j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
have "... = apw $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
using dr dc ij
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row apw
dim_col paw = dim_col apw
i < dim_row apw
j < dim_col apw

goal (1 subgoal):
 1. outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
unfolding apw_def outer_prod_def
[PROOF STATE]
proof (prove)
using this:
dim_row paw = dim_row (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) - Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y))
dim_col paw = dim_col (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) - Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y))
i < dim_row (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) - Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y))
j < dim_col (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) - Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y))

goal (1 subgoal):
 1. (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j) - (Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j) = (Matrix.mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) - Matrix.mat (dim_vec x) 1 (\<lambda>(i, j). x $ i) * Matrix.mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y)) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod v w $$ (i, j) - outer_prod x w $$ (i, j) = apw $$ (i, j)

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

goal (1 subgoal):
 1. paw $$ (i, j) = apw $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
paw $$ (i, j) = apw $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < dim_row apw; ?j < dim_col apw\<rbrakk> \<Longrightarrow> paw $$ (?i, ?j) = apw $$ (?i, ?j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
paw = apw

goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
paw = apw

goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
unfolding paw_def apw_def
[PROOF STATE]
proof (prove)
using this:
outer_prod (v - x) w = outer_prod v w - outer_prod x w

goal (1 subgoal):
 1. outer_prod (v - x) w = outer_prod v w - outer_prod x w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
outer_prod (v - x) w = outer_prod v w - outer_prod x w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_singleton_eq:
  assumes f: "bij_betw f A B" and g: "bij_betw g A B" and a: "a \<in> A"
  assumes eq: "(\<And>x. x \<in> A \<Longrightarrow> x \<noteq> a \<Longrightarrow> f x = g x)"
  shows "f a = g a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
have "f ` (A - {a}) = g ` (A - {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` (A - {a}) = g ` (A - {a})
[PROOF STEP]
by (intro image_cong) (simp_all add: eq)
[PROOF STATE]
proof (state)
this:
f ` (A - {a}) = g ` (A - {a})

goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` (A - {a}) = g ` (A - {a})
[PROOF STEP]
have "B - {f a} = B - {g a}"
[PROOF STATE]
proof (prove)
using this:
f ` (A - {a}) = g ` (A - {a})

goal (1 subgoal):
 1. B - {f a} = B - {g a}
[PROOF STEP]
using f g a
[PROOF STATE]
proof (prove)
using this:
f ` (A - {a}) = g ` (A - {a})
bij_betw f A B
bij_betw g A B
a \<in> A

goal (1 subgoal):
 1. B - {f a} = B - {g a}
[PROOF STEP]
by (auto simp: bij_betw_def inj_on_image_set_diff set_eq_iff)
[PROOF STATE]
proof (state)
this:
B - {f a} = B - {g a}

goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
B - {f a} = B - {g a}

goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
have "f a \<in> B" "g a \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f a \<in> B &&& g a \<in> B
[PROOF STEP]
using f g a
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B
bij_betw g A B
a \<in> A

goal (1 subgoal):
 1. f a \<in> B &&& g a \<in> B
[PROOF STEP]
by (auto simp: bij_betw_def)
[PROOF STATE]
proof (state)
this:
f a \<in> B
g a \<in> B

goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
B - {f a} = B - {g a}
f a \<in> B
g a \<in> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B - {f a} = B - {g a}
f a \<in> B
g a \<in> B

goal (1 subgoal):
 1. f a = g a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f a = g a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_four_block_mat: assumes c: "A \<in> carrier_mat nr1 nc1" "B \<in> carrier_mat nr1 nc2"
  "C \<in> carrier_mat nr2 nc1" "D \<in> carrier_mat nr2 nc2"
  shows "map_mat f (four_block_mat A B C D) = four_block_mat (map_mat f A) (map_mat f B) (map_mat f C) (map_mat f D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_mat f (four_block_mat A B C D) = four_block_mat (map_mat f A) (map_mat f B) (map_mat f C) (map_mat f D)
[PROOF STEP]
by (rule eq_matI, insert c, auto)


[STATEMENT]
lemma ereal_of_enat_less_iff[simp]: "ereal_of_enat m < ereal_of_enat n \<longleftrightarrow> m < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ereal_of_enat m < ereal_of_enat n) = (m < n)
[PROOF STEP]
by (cases m n rule: enat2_cases) auto


[STATEMENT]
lemma vector_derivative_part_circlepath:
    "vector_derivative (part_circlepath z r s t) (at x) =
       \<i> * r * (of_real t - of_real s) * exp(\<i> * linepath s t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector_derivative (part_circlepath z r s t) (at x) = \<i> * complex_of_real r * (complex_of_real t - complex_of_real s) * exp (\<i> * complex_of_real (linepath s t x))
[PROOF STEP]
using has_vector_derivative_part_circlepath vector_derivative_at
[PROOF STATE]
proof (prove)
using this:
(part_circlepath ?z ?r ?s ?t has_vector_derivative \<i> * complex_of_real ?r * (complex_of_real ?t - complex_of_real ?s) * exp (\<i> * complex_of_real (linepath ?s ?t ?x))) (at ?x within ?X)
(?f has_vector_derivative ?f') (at ?x) \<Longrightarrow> vector_derivative ?f (at ?x) = ?f'

goal (1 subgoal):
 1. vector_derivative (part_circlepath z r s t) (at x) = \<i> * complex_of_real r * (complex_of_real t - complex_of_real s) * exp (\<i> * complex_of_real (linepath s t x))
[PROOF STEP]
by blast


[STATEMENT]
lemma (in ordered_ab_group_add_abs) sum_list_abs:
  "\<bar>sum_list xs\<bar> \<le> sum_list (map abs xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sum_list xs\<bar> \<le> sum_list (map abs xs)
[PROOF STEP]
by (induct xs) (simp_all add: order_trans [OF abs_triangle_ineq])


[STATEMENT]
lemma L2_set_0': "\<forall>a\<in>A. f a = 0 \<Longrightarrow> L2_set f A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>A. f a = 0 \<Longrightarrow> L2_set f A = 0
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a\<in>A. f a = 0 \<Longrightarrow> sqrt (\<Sum>i\<in>A. (f i)\<^sup>2) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma vec_index_is_linear [simp]:
  assumes "dim_vec u = dim_vec v" and "j < dim_vec u"
  shows "(k \<cdot>\<^sub>v u + l \<cdot>\<^sub>v v) $ j = k * (u $ j) + l * (v $ j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k \<cdot>\<^sub>v u + l \<cdot>\<^sub>v v) $ j = k * u $ j + l * v $ j
[PROOF STEP]
using assms vec_index_def smult_vec_def plus_vec_def
[PROOF STATE]
proof (prove)
using this:
dim_vec u = dim_vec v
j < dim_vec u
($) \<equiv> map_fun Rep_vec id snd
?a \<cdot>\<^sub>v ?v \<equiv> vec (dim_vec ?v) (\<lambda>i. ?a * ?v $ i)
?v\<^sub>1 + ?v\<^sub>2 \<equiv> vec (dim_vec ?v\<^sub>2) (\<lambda>i. ?v\<^sub>1 $ i + ?v\<^sub>2 $ i)

goal (1 subgoal):
 1. (k \<cdot>\<^sub>v u + l \<cdot>\<^sub>v v) $ j = k * u $ j + l * v $ j
[PROOF STEP]
by simp


[STATEMENT]
lemma norm_powr_real: "w \<in> \<real> \<Longrightarrow> 0 < Re w \<Longrightarrow> norm(w powr z) = exp(Re z * ln(Re w))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<in> \<real>; 0 < Re w\<rbrakk> \<Longrightarrow> cmod (w powr z) = exp (Re z * ln (Re w))
[PROOF STEP]
using Ln_Reals_eq norm_exp_eq_Re
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> \<real>; 0 < Re ?x\<rbrakk> \<Longrightarrow> Ln ?x = complex_of_real (ln (Re ?x))
cmod (exp ?z) = exp (Re ?z)

goal (1 subgoal):
 1. \<lbrakk>w \<in> \<real>; 0 < Re w\<rbrakk> \<Longrightarrow> cmod (w powr z) = exp (Re z * ln (Re w))
[PROOF STEP]
by (auto simp: Im_Ln_eq_0 powr_def norm_complex_def)


[STATEMENT]
lemma powr_upper_bound: "\<lbrakk>(l::real) > 0; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> max (l powr z) (u powr z) \<ge> x powr z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (cases "z \<ge> 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
 2. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (rule order.trans[OF powr_mono2 max.cobounded2], simp_all) []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < l; l \<le> x; x \<le> u; \<not> 0 \<le> z\<rbrakk> \<Longrightarrow> x powr z \<le> max (l powr z) (u powr z)
[PROOF STEP]
apply (rule order.trans[OF powr_mono2' max.cobounded1], simp_all) []
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma complete_square:
  "a \<noteq> 0 \<Longrightarrow> a * x\<^sup>2 + b * x + c = 0 \<longleftrightarrow> (2 * a * x + b)\<^sup>2 = discrim a b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> (a * x\<^sup>2 + b * x + c = 0) = ((2 * a * x + b)\<^sup>2 = discrim a b c)
[PROOF STEP]
by (simp add: discrim_def) algebra


[STATEMENT]
lemma ell2_norm_SUP:
  assumes \<open>has_ell2_norm x\<close>
  shows "ell2_norm x = sqrt (SUP F\<in>{F. finite F}. sum (\<lambda>i. norm (x i)^2) F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ell2_norm x = sqrt (\<Squnion> (sum (\<lambda>i. (cmod (x i))\<^sup>2) ` {F. finite F}))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
has_ell2_norm x

goal (1 subgoal):
 1. ell2_norm x = sqrt (\<Squnion> (sum (\<lambda>i. (cmod (x i))\<^sup>2) ` {F. finite F}))
[PROOF STEP]
apply (auto simp add: ell2_norm_def has_ell2_norm_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xa. (x xa)\<^sup>2) abs_summable_on UNIV \<Longrightarrow> (\<Sum>\<^sub>\<infinity>i. (cmod (x i))\<^sup>2) = \<Squnion> (sum (\<lambda>i. (cmod (x i))\<^sup>2) ` Collect finite)
[PROOF STEP]
apply (subst infsum_nonneg_is_SUPREMUM_real)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>xa. (x xa)\<^sup>2) abs_summable_on UNIV \<Longrightarrow> (\<lambda>i. (cmod (x i))\<^sup>2) summable_on UNIV
 2. \<And>xa. \<lbrakk>(\<lambda>xa. (x xa)\<^sup>2) abs_summable_on UNIV; xa \<in> UNIV\<rbrakk> \<Longrightarrow> 0 \<le> (cmod (x xa))\<^sup>2
 3. (\<lambda>xa. (x xa)\<^sup>2) abs_summable_on UNIV \<Longrightarrow> \<Squnion> (sum (\<lambda>i. (cmod (x i))\<^sup>2) ` {F. finite F \<and> F \<subseteq> UNIV}) = \<Squnion> (sum (\<lambda>i. (cmod (x i))\<^sup>2) ` Collect finite)
[PROOF STEP]
by (auto simp: norm_power)


[STATEMENT]
lemma set_times_elim:
  assumes "x \<in> A * B"
  obtains a b where "x = a * b" and "a \<in> A" and "b \<in> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> A * B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding set_times_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a * b}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>x = a * b; a \<in> A; b \<in> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma Exists_in_sub_cp_DISJ: "Exists x Q' \<in> sub (cp (DISJ \<Q>)) \<Longrightarrow> finite \<Q> \<Longrightarrow> (\<exists>Q \<in> \<Q>. Exists x Q' \<in> sub (cp Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Exists x Q' \<in> sub (cp (DISJ \<Q>)); finite \<Q>\<rbrakk> \<Longrightarrow> \<exists>Q\<in>\<Q>. Exists x Q' \<in> sub (cp Q)
[PROOF STEP]
unfolding DISJ_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Exists x Q' \<in> sub (cp (foldr1 Disj (sorted_list_of_set \<Q>) (Bool False))); finite \<Q>\<rbrakk> \<Longrightarrow> \<exists>Q\<in>\<Q>. Exists x Q' \<in> sub (cp Q)
[PROOF STEP]
by (drule Exists_in_sub_cp_foldr1_Disj) auto


[STATEMENT]
lemma summable_norm: "summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (f n)) \<Longrightarrow> norm (suminf f) \<le> (\<Sum>n. norm (f n))
[PROOF STEP]
by (auto intro: LIMSEQ_le tendsto_norm summable_norm_cancel summable_LIMSEQ norm_sum)


[STATEMENT]
lemma col_mult2[simp]:
  assumes A: "A : carrier_mat nr n"
      and B: "B : carrier_mat n nc"
      and j: "j < nc"
  shows "col (A * B) j = A *\<^sub>v col B j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (A * B) j = A *\<^sub>v col B j
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (A *\<^sub>v col B j) \<Longrightarrow> col (A * B) j $ i = (A *\<^sub>v col B j) $ i
 2. dim_vec (col (A * B) j) = dim_vec (A *\<^sub>v col B j)
[PROOF STEP]
have AB: "A * B : carrier_mat nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B \<in> carrier_mat nr nc
[PROOF STEP]
using A B
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
B \<in> carrier_mat n nc

goal (1 subgoal):
 1. A * B \<in> carrier_mat nr nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B \<in> carrier_mat nr nc

goal (2 subgoals):
 1. \<And>i. i < dim_vec (A *\<^sub>v col B j) \<Longrightarrow> col (A * B) j $ i = (A *\<^sub>v col B j) $ i
 2. dim_vec (col (A * B) j) = dim_vec (A *\<^sub>v col B j)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec (A *\<^sub>v col B j) \<Longrightarrow> col (A * B) j $ i = (A *\<^sub>v col B j) $ i
 2. dim_vec (col (A * B) j) = dim_vec (A *\<^sub>v col B j)
[PROOF STEP]
assume i: "i < dim_vec (A *\<^sub>v col B j)"
[PROOF STATE]
proof (state)
this:
i < dim_vec (A *\<^sub>v col B j)

goal (2 subgoals):
 1. \<And>i. i < dim_vec (A *\<^sub>v col B j) \<Longrightarrow> col (A * B) j $ i = (A *\<^sub>v col B j) $ i
 2. dim_vec (col (A * B) j) = dim_vec (A *\<^sub>v col B j)
[PROOF STEP]
show "col (A * B) j $ i = (A *\<^sub>v col B j) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (A * B) j $ i = (A *\<^sub>v col B j) $ i
[PROOF STEP]
using A B AB j i
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr n
B \<in> carrier_mat n nc
A * B \<in> carrier_mat nr nc
j < nc
i < dim_vec (A *\<^sub>v col B j)

goal (1 subgoal):
 1. col (A * B) j $ i = (A *\<^sub>v col B j) $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
col (A * B) j $ i = (A *\<^sub>v col B j) $ i

goal (1 subgoal):
 1. dim_vec (col (A * B) j) = dim_vec (A *\<^sub>v col B j)
[PROOF STEP]
qed auto


[STATEMENT]
lemma abelian_monoidE:
  fixes R (structure)
  assumes "abelian_monoid R"
  shows "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> x \<oplus> y \<in> carrier R"
    and "\<zero> \<in> carrier R"
    and "\<And>x y z. \<lbrakk> x \<in> carrier R; y \<in> carrier R; z \<in> carrier R \<rbrakk> \<Longrightarrow> (x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)"
    and "\<And>x. x \<in> carrier R \<Longrightarrow> \<zero> \<oplus> x = x"
    and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<in> carrier R) &&& \<zero> \<in> carrier R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<oplus> z = x \<oplus> (y \<oplus> z)) &&& (\<And>x. x \<in> carrier R \<Longrightarrow> \<zero> \<oplus> x = x) &&& (\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
abelian_monoid R

goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<in> carrier R) &&& \<zero> \<in> carrier R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<oplus> z = x \<oplus> (y \<oplus> z)) &&& (\<And>x. x \<in> carrier R \<Longrightarrow> \<zero> \<oplus> x = x) &&& (\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x)
[PROOF STEP]
unfolding abelian_monoid_def comm_monoid_def comm_monoid_axioms_def monoid_def
[PROOF STATE]
proof (prove)
using this:
(((\<forall>x y. x \<in> carrier (add_monoid R) \<longrightarrow> y \<in> carrier (add_monoid R) \<longrightarrow> x \<otimes>\<^bsub>add_monoid R\<^esub> y \<in> carrier (add_monoid R)) \<and> (\<forall>x y z. x \<in> carrier (add_monoid R) \<longrightarrow> y \<in> carrier (add_monoid R) \<longrightarrow> z \<in> carrier (add_monoid R) \<longrightarrow> x \<otimes>\<^bsub>add_monoid R\<^esub> y \<otimes>\<^bsub>add_monoid R\<^esub> z = x \<otimes>\<^bsub>add_monoid R\<^esub> (y \<otimes>\<^bsub>add_monoid R\<^esub> z))) \<and> \<one>\<^bsub>add_monoid R\<^esub> \<in> carrier (add_monoid R) \<and> (\<forall>x. x \<in> carrier (add_monoid R) \<longrightarrow> \<one>\<^bsub>add_monoid R\<^esub> \<otimes>\<^bsub>add_monoid R\<^esub> x = x) \<and> (\<forall>x. x \<in> carrier (add_monoid R) \<longrightarrow> x \<otimes>\<^bsub>add_monoid R\<^esub> \<one>\<^bsub>add_monoid R\<^esub> = x)) \<and> (\<forall>x y. x \<in> carrier (add_monoid R) \<longrightarrow> y \<in> carrier (add_monoid R) \<longrightarrow> x \<otimes>\<^bsub>add_monoid R\<^esub> y = y \<otimes>\<^bsub>add_monoid R\<^esub> x)

goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<in> carrier R) &&& \<zero> \<in> carrier R) &&& (\<And>x y z. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y \<oplus> z = x \<oplus> (y \<oplus> z)) &&& (\<And>x. x \<in> carrier R \<Longrightarrow> \<zero> \<oplus> x = x) &&& (\<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R\<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_id_matrix:
assumes "i < nr"
shows "(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i<dim_vec v then v $ i else 0)" (is "?a $ i = ?b")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
have "?a $ i = row (id_matrix nr (dim_vec v)) i \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (id_matrix nr (dim_vec v)) i \<bullet> v
[PROOF STEP]
using index_mult_mat_vec assms id_matrix_dim
[PROOF STATE]
proof (prove)
using this:
?i < dim_row ?A \<Longrightarrow> (?A *\<^sub>v ?v) $ ?i = row ?A ?i \<bullet> ?v
i < nr
dim_row (id_matrix ?nr ?nc) = ?nr
dim_col (id_matrix ?nr ?nc) = ?nc

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (id_matrix nr (dim_vec v)) i \<bullet> v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (id_matrix nr (dim_vec v)) i \<bullet> v

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = row (id_matrix nr (dim_vec v)) i \<bullet> v

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
have "... = unit_vec (dim_vec v) i \<bullet> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (id_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) i \<bullet> v
[PROOF STEP]
using row_id_matrix assms
[PROOF STATE]
proof (prove)
using this:
?i < ?nr \<Longrightarrow> row (id_matrix ?nr ?nc) ?i = unit_vec ?nc ?i
i < nr

goal (1 subgoal):
 1. row (id_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) i \<bullet> v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row (id_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) i \<bullet> v

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
row (id_matrix nr (dim_vec v)) i \<bullet> v = unit_vec (dim_vec v) i \<bullet> v

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
have "... = ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec (dim_vec v) i \<bullet> v = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
using scalar_prod_left_unit carrier_vecI unit_eq_0 scalar_prod_left_zero
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?i < ?n\<rbrakk> \<Longrightarrow> unit_vec ?n ?i \<bullet> ?v = ?v $ ?i
dim_vec ?v = ?n \<Longrightarrow> ?v \<in> carrier_vec ?n
?n \<le> ?i \<Longrightarrow> unit_vec ?n ?i = 0\<^sub>v ?n
?v \<in> carrier_vec ?n \<Longrightarrow> 0\<^sub>v ?n \<bullet> ?v = (0::?'a)

goal (1 subgoal):
 1. unit_vec (dim_vec v) i \<bullet> v = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
unit_vec (dim_vec v) i \<bullet> v = (if i < dim_vec v then v $ i else 0)

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)

goal (1 subgoal):
 1. (id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(id_matrix nr (dim_vec v) *\<^sub>v v) $ i = (if i < dim_vec v then v $ i else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcsin_pos: "x \<in> {0<..1} \<Longrightarrow> arcsin x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {0<..1} \<Longrightarrow> 0 < arcsin x
[PROOF STEP]
using arcsin_less_arcsin[of 0 x]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- 1 \<le> 0; 0 < x; x \<le> 1\<rbrakk> \<Longrightarrow> arcsin 0 < arcsin x

goal (1 subgoal):
 1. x \<in> {0<..1} \<Longrightarrow> 0 < arcsin x
[PROOF STEP]
by simp


[STATEMENT]
lemma card_before: "distinct xs \<Longrightarrow> x : set xs \<Longrightarrow> card (before x xs) = index xs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> card (before x xs) = index xs x
[PROOF STEP]
using  index_le_size[of xs x]
[PROOF STATE]
proof (prove)
using this:
index xs x \<le> length xs

goal (1 subgoal):
 1. \<lbrakk>distinct xs; x \<in> set xs\<rbrakk> \<Longrightarrow> card (before x xs) = index xs x
[PROOF STEP]
by(simp add: before_conv_take distinct_card[OF distinct_take] min_def)


[STATEMENT]
lemma length_coeffs_primitive_part[simp]: "length (coeffs (primitive_part f)) = length (coeffs f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
proof (cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
 2. f \<noteq> 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
 2. f \<noteq> 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
hence "length (coeffs f) \<noteq> 0" "length (coeffs (primitive_part f)) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

goal (1 subgoal):
 1. length (coeffs f) \<noteq> 0 &&& length (coeffs (primitive_part f)) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (coeffs f) \<noteq> 0
length (coeffs (primitive_part f)) \<noteq> 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
 2. f \<noteq> 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
length (coeffs f) \<noteq> 0
length (coeffs (primitive_part f)) \<noteq> 0

goal (1 subgoal):
 1. length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
using degree_primitive_part[of f, unfolded degree_eq_length_coeffs]
[PROOF STATE]
proof (prove)
using this:
length (coeffs f) \<noteq> 0
length (coeffs (primitive_part f)) \<noteq> 0
length (coeffs (primitive_part f)) - 1 = length (coeffs f) - 1

goal (1 subgoal):
 1. length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
length (coeffs (primitive_part f)) = length (coeffs f)

goal (1 subgoal):
 1. f = 0 \<Longrightarrow> length (coeffs (primitive_part f)) = length (coeffs f)
[PROOF STEP]
qed simp


[STATEMENT]
lemma injective_into_1d_eq_homeomorphism:
  fixes f :: "'a::topological_space \<Rightarrow> real"
  assumes f: "continuous_on S f" and S: "path_connected S"
  shows "inj_on f S \<longleftrightarrow> (\<exists>g. homeomorphism S (f ` S) f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f S = (\<exists>g. homeomorphism S (f ` S) f g)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inj_on f S \<Longrightarrow> \<exists>g. homeomorphism S (f ` S) f g
 2. \<exists>g. homeomorphism S (f ` S) f g \<Longrightarrow> inj_on f S
[PROOF STEP]
show "\<exists>g. homeomorphism S (f ` S) f g"
    if "inj_on f S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. homeomorphism S (f ` S) f g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>g. homeomorphism S (f ` S) f g
[PROOF STEP]
have "embedding_map (top_of_set S) euclideanreal f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. embedding_map (top_of_set S) euclideanreal f
[PROOF STEP]
using that embedding_map_into_euclideanreal [of "top_of_set S" f] assms
[PROOF STATE]
proof (prove)
using this:
inj_on f S
path_connected_space (top_of_set S) \<Longrightarrow> embedding_map (top_of_set S) euclideanreal f = (continuous_map (top_of_set S) euclideanreal f \<and> inj_on f (topspace (top_of_set S)))
continuous_on S f
path_connected S

goal (1 subgoal):
 1. embedding_map (top_of_set S) euclideanreal f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
embedding_map (top_of_set S) euclideanreal f

goal (1 subgoal):
 1. \<exists>g. homeomorphism S (f ` S) f g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
embedding_map (top_of_set S) euclideanreal f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
embedding_map (top_of_set S) euclideanreal f

goal (1 subgoal):
 1. \<exists>g. homeomorphism S (f ` S) f g
[PROOF STEP]
by (simp add: embedding_map_def) (metis all_closedin_homeomorphic_image f homeomorphism_injective_closed_map that)
[PROOF STATE]
proof (state)
this:
\<exists>g. homeomorphism S (f ` S) f g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on f S \<Longrightarrow> \<exists>g. homeomorphism S (f ` S) f g

goal (1 subgoal):
 1. \<exists>g. homeomorphism S (f ` S) f g \<Longrightarrow> inj_on f S
[PROOF STEP]
qed (metis homeomorphism_def inj_onI)


[STATEMENT]
lemma real_poly_mult: fixes p :: "'a :: {idom,real_algebra_1} poly"
  assumes p: "set (coeffs p) \<subseteq> \<real>" and q: "set (coeffs q) \<subseteq> \<real>"
  shows "set (coeffs (p * q)) \<subseteq> \<real>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (p * q)) \<subseteq> \<real>
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
set (coeffs p) \<subseteq> \<real>

goal (1 subgoal):
 1. set (coeffs (p * q)) \<subseteq> \<real>
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (coeffs 0) \<subseteq> \<real> \<Longrightarrow> set (coeffs (0 * q)) \<subseteq> \<real>
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; set (coeffs p) \<subseteq> \<real> \<Longrightarrow> set (coeffs (p * q)) \<subseteq> \<real>; set (coeffs (pCons a p)) \<subseteq> \<real>\<rbrakk> \<Longrightarrow> set (coeffs (pCons a p * q)) \<subseteq> \<real>
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> p \<noteq> 0
set (coeffs p) \<subseteq> \<real> \<Longrightarrow> set (coeffs (p * q)) \<subseteq> \<real>
set (coeffs (pCons a p)) \<subseteq> \<real>

goal (2 subgoals):
 1. set (coeffs 0) \<subseteq> \<real> \<Longrightarrow> set (coeffs (0 * q)) \<subseteq> \<real>
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; set (coeffs p) \<subseteq> \<real> \<Longrightarrow> set (coeffs (p * q)) \<subseteq> \<real>; set (coeffs (pCons a p)) \<subseteq> \<real>\<rbrakk> \<Longrightarrow> set (coeffs (pCons a p * q)) \<subseteq> \<real>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (pCons a p * q)) \<subseteq> \<real>
[PROOF STEP]
unfolding mult_pCons_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (smult a q + pCons (0::'a) (p * q))) \<subseteq> \<real>
[PROOF STEP]
by (intro real_poly_add real_poly_smult real_poly_pCons pCons(2) q,
    insert pCons(1,3), auto simp: cCons_def if_splits)
[PROOF STATE]
proof (state)
this:
set (coeffs (pCons a p * q)) \<subseteq> \<real>

goal (1 subgoal):
 1. set (coeffs 0) \<subseteq> \<real> \<Longrightarrow> set (coeffs (0 * q)) \<subseteq> \<real>
[PROOF STEP]
qed simp


[STATEMENT]
lemma mat_of_rows_map [simp]:
  assumes x: "set vs \<subseteq> carrier_vec n"
  shows "mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)
[PROOF STEP]
have "\<forall>x\<in>set vs. dim_vec x = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set vs. dim_vec x = n
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
set vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. \<forall>x\<in>set vs. dim_vec x = n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set vs. dim_vec x = n

goal (1 subgoal):
 1. mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set vs. dim_vec x = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set vs. dim_vec x = n

goal (1 subgoal):
 1. mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)
[PROOF STEP]
by (auto simp add: mat_eq_iff map_vec_def mat_of_rows_def)
[PROOF STATE]
proof (state)
this:
mat_of_rows n (map (map_vec f) vs) = map_mat f (mat_of_rows n vs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_exponent_realI:
  assumes "p > (0::real)" "q > 0" "1/p + 1/q = 1"
  shows "p > 1" "q = conjugate_exponent p" "q > 1" "p = conjugate_exponent q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < p &&& q = conjugate_exponent p) &&& 1 < q &&& p = conjugate_exponent q
[PROOF STEP]
unfolding conjugate_exponent_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < p &&& q = 1 + 1 / (p - 1)) &&& 1 < q &&& p = 1 + 1 / (q - 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < p
0 < q
1 / p + 1 / q = 1

goal (1 subgoal):
 1. (1 < p &&& q = 1 + 1 / (p - 1)) &&& 1 < q &&& p = 1 + 1 / (q - 1)
[PROOF STEP]
apply (auto simp add: algebra_simps divide_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < p; 0 < q; p + q = p * q\<rbrakk> \<Longrightarrow> 1 < p
 2. \<lbrakk>0 < p; 0 < q; p + q = p * q\<rbrakk> \<Longrightarrow> 1 < q
[PROOF STEP]
apply (metis assms(3) divide_less_eq_1_pos less_add_same_cancel1 zero_less_divide_1_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < p; 0 < q; p + q = p * q\<rbrakk> \<Longrightarrow> 1 < q
[PROOF STEP]
using mult_less_cancel_left_pos
[PROOF STATE]
proof (prove)
using this:
(0::?'a) < ?c \<Longrightarrow> (?c * ?a < ?c * ?b) = (?a < ?b)

goal (1 subgoal):
 1. \<lbrakk>0 < p; 0 < q; p + q = p * q\<rbrakk> \<Longrightarrow> 1 < q
[PROOF STEP]
by fastforce


[STATEMENT]
lemma hermitian_is_normal:
  assumes "hermitian A"
  shows "A * adjoint A = adjoint A * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hermitian A

goal (1 subgoal):
 1. A * adjoint A = adjoint A * A
[PROOF STEP]
by (auto simp add: hermitian_def)


[STATEMENT]
lemma bounded_rtranclp_mono:
  fixes n :: "'x :: linorder"
  assumes "\<And>i j. R i j \<Longrightarrow> j < n \<Longrightarrow> S i j" "\<And>i j. R i j \<Longrightarrow> i \<le> j"
  shows "rtranclp R i j \<Longrightarrow> j < n \<Longrightarrow> rtranclp S i j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R\<^sup>*\<^sup>* i j; j < n\<rbrakk> \<Longrightarrow> S\<^sup>*\<^sup>* i j
[PROOF STEP]
proof (induct rule: rtranclp_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i < n \<Longrightarrow> S\<^sup>*\<^sup>* i i
 2. \<And>y z. \<lbrakk>R\<^sup>*\<^sup>* i y; R y z; y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y; z < n\<rbrakk> \<Longrightarrow> S\<^sup>*\<^sup>* i z
[PROOF STEP]
case (step y z)
[PROOF STATE]
proof (state)
this:
R\<^sup>*\<^sup>* i y
R y z
y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y
z < n

goal (2 subgoals):
 1. i < n \<Longrightarrow> S\<^sup>*\<^sup>* i i
 2. \<And>y z. \<lbrakk>R\<^sup>*\<^sup>* i y; R y z; y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y; z < n\<rbrakk> \<Longrightarrow> S\<^sup>*\<^sup>* i z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
R\<^sup>*\<^sup>* i y
R y z
y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y
z < n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
R\<^sup>*\<^sup>* i y
R y z
y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y
z < n

goal (1 subgoal):
 1. S\<^sup>*\<^sup>* i z
[PROOF STEP]
using assms(1,2)[of y z]
[PROOF STATE]
proof (prove)
using this:
R\<^sup>*\<^sup>* i y
R y z
y < n \<Longrightarrow> S\<^sup>*\<^sup>* i y
z < n
\<lbrakk>R y z; z < n\<rbrakk> \<Longrightarrow> S y z
R y z \<Longrightarrow> y \<le> z

goal (1 subgoal):
 1. S\<^sup>*\<^sup>* i z
[PROOF STEP]
by (auto elim!: rtrancl_into_rtrancl[to_pred, rotated])
[PROOF STATE]
proof (state)
this:
S\<^sup>*\<^sup>* i z

goal (1 subgoal):
 1. i < n \<Longrightarrow> S\<^sup>*\<^sup>* i i
[PROOF STEP]
qed auto


[STATEMENT]
lemma (in topology) ex_dense_closure_inter:
  assumes ssub: "S \<subseteq> carrier"
  shows "\<exists> D C. D dense \<and> C closed \<and> S = D \<inter> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
let ?D = "carrier - (closure S - S)" and
      ?C = "closure S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
from ssub
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier
[PROOF STEP]
have "?D dense"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier

goal (1 subgoal):
 1. carrier - (closure S - S) dense
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
carrier - (closure S - S) dense

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
carrier - (closure S - S) dense

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
have "?C closed"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure S closed
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
closure S closed

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closure S closed

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
from ssub
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier
[PROOF STEP]
have "(carrier - (closure S - S)) \<inter> closure S = S"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier

goal (1 subgoal):
 1. (carrier - (closure S - S)) \<inter> closure S = S
[PROOF STEP]
by (simp add: diff_diff_inter subset_closure)
[PROOF STATE]
proof (state)
this:
(carrier - (closure S - S)) \<inter> closure S = S

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
carrier - (closure S - S) dense
closure S closed
(carrier - (closure S - S)) \<inter> closure S = S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
carrier - (closure S - S) dense
closure S closed
(carrier - (closure S - S)) \<inter> closure S = S

goal (1 subgoal):
 1. \<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>D C. D dense \<and> C closed \<and> S = D \<inter> C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma abs_sin_x_le_abs_x: "\<bar>sin x\<bar> \<le> \<bar>x\<bar>"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sin x\<bar> \<le> \<bar>x\<bar>
[PROOF STEP]
using sin_x_ge_neg_x [of x] sin_x_le_x [of x] sin_x_ge_neg_x [of "-x"] sin_x_le_x [of "-x"]
[PROOF STATE]
proof (prove)
using this:
0 \<le> x \<Longrightarrow> - x \<le> sin x
0 \<le> x \<Longrightarrow> sin x \<le> x
0 \<le> - x \<Longrightarrow> - (- x) \<le> sin (- x)
0 \<le> - x \<Longrightarrow> sin (- x) \<le> - x

goal (1 subgoal):
 1. \<bar>sin x\<bar> \<le> \<bar>x\<bar>
[PROOF STEP]
by (auto simp: abs_real_def)


[STATEMENT]
lemma listsetI_nth :
  "length xs = length Xs \<Longrightarrow> \<forall>n<length xs. xs!n \<in> Xs!n \<Longrightarrow> xs \<in> listset Xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = length Xs; \<forall>n<length xs. xs ! n \<in> Xs ! n\<rbrakk> \<Longrightarrow> xs \<in> listset Xs
[PROOF STEP]
proof (induct xs Xs rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>n<length []. [] ! n \<in> [] ! n \<Longrightarrow> [] \<in> listset []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>n<length xs. xs ! n \<in> ys ! n \<Longrightarrow> xs \<in> listset ys; \<forall>n<length (x # xs). (x # xs) ! n \<in> (y # ys) ! n\<rbrakk> \<Longrightarrow> x # xs \<in> listset (y # ys)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
\<forall>n<length []. [] ! n \<in> [] ! n

goal (2 subgoals):
 1. \<forall>n<length []. [] ! n \<in> [] ! n \<Longrightarrow> [] \<in> listset []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>n<length xs. xs ! n \<in> ys ! n \<Longrightarrow> xs \<in> listset ys; \<forall>n<length (x # xs). (x # xs) ! n \<in> (y # ys) ! n\<rbrakk> \<Longrightarrow> x # xs \<in> listset (y # ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [] \<in> listset []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[] \<in> listset []

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>n<length xs. xs ! n \<in> ys ! n \<Longrightarrow> xs \<in> listset ys; \<forall>n<length (x # xs). (x # xs) ! n \<in> (y # ys) ! n\<rbrakk> \<Longrightarrow> x # xs \<in> listset (y # ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>n<length xs. xs ! n \<in> ys ! n \<Longrightarrow> xs \<in> listset ys; \<forall>n<length (x # xs). (x # xs) ! n \<in> (y # ys) ! n\<rbrakk> \<Longrightarrow> x # xs \<in> listset (y # ys)
[PROOF STEP]
case (Cons x xs X Xs)
[PROOF STATE]
proof (state)
this:
length xs = length Xs
\<forall>n<length xs. xs ! n \<in> Xs ! n \<Longrightarrow> xs \<in> listset Xs
\<forall>n<length (x # xs). (x # xs) ! n \<in> (X # Xs) ! n

goal (1 subgoal):
 1. \<And>x xs y ys. \<lbrakk>length xs = length ys; \<forall>n<length xs. xs ! n \<in> ys ! n \<Longrightarrow> xs \<in> listset ys; \<forall>n<length (x # xs). (x # xs) ! n \<in> (y # ys) ! n\<rbrakk> \<Longrightarrow> x # xs \<in> listset (y # ys)
[PROOF STEP]
thus "x#xs \<in> listset (X#Xs)"
[PROOF STATE]
proof (prove)
using this:
length xs = length Xs
\<forall>n<length xs. xs ! n \<in> Xs ! n \<Longrightarrow> xs \<in> listset Xs
\<forall>n<length (x # xs). (x # xs) ! n \<in> (X # Xs) ! n

goal (1 subgoal):
 1. x # xs \<in> listset (X # Xs)
[PROOF STEP]
using listset_ConsI[of x X xs Xs]
[PROOF STATE]
proof (prove)
using this:
length xs = length Xs
\<forall>n<length xs. xs ! n \<in> Xs ! n \<Longrightarrow> xs \<in> listset Xs
\<forall>n<length (x # xs). (x # xs) ! n \<in> (X # Xs) ! n
\<lbrakk>x \<in> X; xs \<in> listset Xs\<rbrakk> \<Longrightarrow> x # xs \<in> listset (X # Xs)

goal (1 subgoal):
 1. x # xs \<in> listset (X # Xs)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x # xs \<in> listset (X # Xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma differentiable_power_int [simp, derivative_intros]:
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_field"
  shows "f differentiable (at x within s) \<Longrightarrow> f x \<noteq> 0 \<Longrightarrow>
           (\<lambda>x. power_int (f x) n) differentiable (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f differentiable at x within s; f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. f x powi n) differentiable at x within s
[PROOF STEP]
unfolding differentiable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>D. (f has_derivative D) (at x within s); f x \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> \<exists>D. ((\<lambda>x. f x powi n) has_derivative D) (at x within s)
[PROOF STEP]
by (blast intro: has_derivative_power_int)


[STATEMENT]
lemma lower_Interval: "lower (Interval x) = fst x"
  and upper_Interval: "upper (Interval x) = snd x"
  if "fst x \<le> snd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower (Interval x) = fst x &&& upper (Interval x) = snd x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
fst x \<le> snd x

goal (1 subgoal):
 1. lower (Interval x) = fst x &&& upper (Interval x) = snd x
[PROOF STEP]
by (auto simp: lower_def upper_def Interval_inverse split_beta')


[STATEMENT]
theorem list_order_trans:
  assumes "list_ops ops"
    and "list_order ops x y"
    and "list_order ops y z"
  shows "list_order ops x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List_Spec.list_order ops x z
[PROOF STEP]
using assms list_order_trans list_ops_insertions list_order_equiv
[PROOF STATE]
proof (prove)
using this:
list_ops ops
List_Spec.list_order ops x y
List_Spec.list_order ops y z
\<lbrakk>insert_ops ?op_list; Insert_Spec.list_order ?op_list ?x ?y; Insert_Spec.list_order ?op_list ?y ?z\<rbrakk> \<Longrightarrow> Insert_Spec.list_order ?op_list ?x ?z
list_ops ?ops \<Longrightarrow> insert_ops (insertions ?ops)
List_Spec.list_order ?ops ?x ?y = Insert_Spec.list_order (insertions ?ops) ?x ?y

goal (1 subgoal):
 1. List_Spec.list_order ops x z
[PROOF STEP]
by blast


[STATEMENT]
lemma nodeOrder_eq:
     "[| i<N; j<N |] ==> ((next i, i) \<in> nodeOrder j) = (i \<noteq> j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < N; j < N\<rbrakk> \<Longrightarrow> ((next i, i) \<in> nodeOrder j) = (i \<noteq> j)
[PROOF STEP]
apply (cases \<open>i < j\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>i < N; j < N; i < j\<rbrakk> \<Longrightarrow> ((next i, i) \<in> nodeOrder j) = (i \<noteq> j)
 2. \<lbrakk>i < N; j < N; \<not> i < j\<rbrakk> \<Longrightarrow> ((next i, i) \<in> nodeOrder j) = (i \<noteq> j)
[PROOF STEP]
apply (auto simp add: nodeOrder_def next_def mod_Suc add.commute [of _ N])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < N; i < j\<rbrakk> \<Longrightarrow> (N + j - Suc i) mod N < (N + j - i) mod N
[PROOF STEP]
apply (simp only: diff_add_assoc mod_add_self1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < N; i < j\<rbrakk> \<Longrightarrow> (j - Suc i) mod N < (j - i) mod N
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma all_in_set_nths'_conv: "(\<forall>j. j \<in> set (nths' l r xs) \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < List.length xs \<longrightarrow> P (xs ! k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. j \<in> set (nths' l r xs) \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length xs \<longrightarrow> P (xs ! k))
[PROOF STEP]
unfolding set_nths'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j. j \<in> {x. \<exists>k\<ge>l. k < r \<and> k < length xs \<and> x = xs ! k} \<longrightarrow> P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length xs \<longrightarrow> P (xs ! k))
[PROOF STEP]
by blast


[STATEMENT]
lemma
  fixes f g :: "nat \<Rightarrow> real"
  fixes s :: real
  assumes "f 0 = 0" "g 0 = 0"
  assumes summable: "summable (\<lambda>n. norm (f n / real n powr s))"
                    "summable (\<lambda>n. norm (g n / real n powr s))"
  shows   summable_dirichlet_prod_real: "summable (\<lambda>n. norm (dirichlet_prod f g n / real n powr s))"
    and   suminf_dirichlet_prod_real:
            "(\<Sum>n. dirichlet_prod f g n / real n powr s) =
               (\<Sum>n. f n / nat_power n s) * (\<Sum>n. g n / real n powr s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. norm (dirichlet_prod f g n / real n powr s)) &&& (\<Sum>n. dirichlet_prod f g n / real n powr s) = (\<Sum>n. f n / nat_power n s) * (\<Sum>n. g n / real n powr s)
[PROOF STEP]
using summable_dirichlet_prod[of f g s] suminf_dirichlet_prod[of f g s] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f 0 = 0; g 0 = 0; summable (\<lambda>n. norm (f n / nat_power n s)); summable (\<lambda>n. norm (g n / nat_power n s))\<rbrakk> \<Longrightarrow> summable (\<lambda>n. norm (dirichlet_prod f g n / nat_power n s))
\<lbrakk>f 0 = 0; g 0 = 0; summable (\<lambda>n. norm (f n / nat_power n s)); summable (\<lambda>n. norm (g n / nat_power n s))\<rbrakk> \<Longrightarrow> (\<Sum>n. dirichlet_prod f g n / nat_power n s) = (\<Sum>n. f n / nat_power n s) * (\<Sum>n. g n / nat_power n s)
f 0 = 0
g 0 = 0
summable (\<lambda>n. norm (f n / real n powr s))
summable (\<lambda>n. norm (g n / real n powr s))

goal (1 subgoal):
 1. summable (\<lambda>n. norm (dirichlet_prod f g n / real n powr s)) &&& (\<Sum>n. dirichlet_prod f g n / real n powr s) = (\<Sum>n. f n / nat_power n s) * (\<Sum>n. g n / real n powr s)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma sumA_ub: "wf A \<Longrightarrow> (\<Sum>a<n. A!a) \<le> n*(n-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.wf A \<Longrightarrow> sum ((!) A) {..<n} \<le> n * (n - 1)
[PROOF STEP]
using sum_bounded_above[of "{..<n}" "((!) A)" "n-1"] wf_le_n1[of A]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i \<in> {..<n} \<Longrightarrow> A ! i \<le> n - 1) \<Longrightarrow> sum ((!) A) {..<n} \<le> of_nat (card {..<n}) * (n - 1)
\<lbrakk>local.wf A; ?a < n\<rbrakk> \<Longrightarrow> A ! ?a \<le> n - 1

goal (1 subgoal):
 1. local.wf A \<Longrightarrow> sum ((!) A) {..<n} \<le> n * (n - 1)
[PROOF STEP]
by (simp)


[STATEMENT]
lemma convexD_alt:
  assumes "convex s" "a \<in> s" "b \<in> s" "0 \<le> u" "u \<le> 1"
  shows "((1 - u) *\<^sub>R a + u *\<^sub>R b) \<in> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) *\<^sub>R a + u *\<^sub>R b \<in> s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
convex s
a \<in> s
b \<in> s
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. (1 - u) *\<^sub>R a + u *\<^sub>R b \<in> s
[PROOF STEP]
unfolding convex_alt
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> s
a \<in> s
b \<in> s
0 \<le> u
u \<le> 1

goal (1 subgoal):
 1. (1 - u) *\<^sub>R a + u *\<^sub>R b \<in> s
[PROOF STEP]
by auto


[STATEMENT]
lemma H_iso_fSup:
  fixes F :: "('a \<Rightarrow> 'b::complete_lattice) set"
  shows "F \<noteq> {} \<Longrightarrow> (\<forall>f \<in> F. x \<le> f y) \<Longrightarrow> x \<le> (\<Squnion>F) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<noteq> {}; \<forall>f\<in>F. x \<le> f y\<rbrakk> \<Longrightarrow> x \<le> (\<Squnion> F) y
[PROOF STEP]
using SUP_upper2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<in> ?A; ?u \<le> ?f ?i\<rbrakk> \<Longrightarrow> ?u \<le> \<Squnion> (?f ` ?A)

goal (1 subgoal):
 1. \<lbrakk>F \<noteq> {}; \<forall>f\<in>F. x \<le> f y\<rbrakk> \<Longrightarrow> x \<le> (\<Squnion> F) y
[PROOF STEP]
by fastforce