[STATEMENT]
lemma tensor_mat_adjoint:
  assumes "m1 \<in> carrier_mat r1 c1"
    and "m2 \<in> carrier_mat r2 c2"
    and "0 < c1"
    and "0 < c2"
and "0 < r1"
and "0 < r2"
  shows "Complex_Matrix.adjoint (tensor_mat m1 m2) =
  tensor_mat (Complex_Matrix.adjoint m1) (Complex_Matrix.adjoint m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (m1 \<Otimes> m2) = Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
assume "i < dim_col m1 * dim_col m2" and "j < dim_row m1 * dim_row m2"
[PROOF STATE]
proof (state)
this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2

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

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have c1: "dim_col m1 = c1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col m1 = c1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. dim_col m1 = c1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col m1 = c1

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have r1: "dim_row m1 = r1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row m1 = r1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. dim_row m1 = r1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row m1 = r1

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have c2: "dim_col m2 = c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col m2 = c2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. dim_col m2 = c2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_col m2 = c2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have r2: "dim_row m2 = r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row m2 = r2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. dim_row m2 = r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row m2 = r2

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = conjugate ((m1 \<Otimes> m2) $$ (j, i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = conjugate ((m1 \<Otimes> m2) $$ (j, i))
[PROOF STEP]
using  ij
[PROOF STATE]
proof (prove)
using this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2

goal (1 subgoal):
 1. Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = conjugate ((m1 \<Otimes> m2) $$ (j, i))
[PROOF STEP]
by (simp add: adjoint_eval)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = conjugate ((m1 \<Otimes> m2) $$ (j, i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = conjugate ((m1 \<Otimes> m2) $$ (j, i))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "... = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
have "(m1 \<Otimes> m2) $$ (j, i) = m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m1 \<Otimes> m2) $$ (j, i) = m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)
[PROOF STEP]
proof (rule index_tensor_mat[of m1 r1 c1 m2 r2 c2 j i], (auto simp add: assms ij c1 c2 r1 r2))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j < r1 * r2
 2. i < c1 * c2
[PROOF STEP]
show "j < r1 * r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < r1 * r2
[PROOF STEP]
using ij r1 r2
[PROOF STATE]
proof (prove)
using this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2
dim_row m1 = r1
dim_row m2 = r2

goal (1 subgoal):
 1. j < r1 * r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < r1 * r2

goal (1 subgoal):
 1. i < c1 * c2
[PROOF STEP]
show "i < c1 * c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < c1 * c2
[PROOF STEP]
using ij c1 c2
[PROOF STATE]
proof (prove)
using this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2
dim_col m1 = c1
dim_col m2 = c2

goal (1 subgoal):
 1. i < c1 * c2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < c1 * c2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(m1 \<Otimes> m2) $$ (j, i) = m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)

goal (1 subgoal):
 1. conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(m1 \<Otimes> m2) $$ (j, i) = m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)

goal (1 subgoal):
 1. conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate ((m1 \<Otimes> m2) $$ (j, i)) = conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "... = conjugate (m1 $$ (j div r2, i div c2)) * conjugate ( m2 $$ (j mod r2, i mod c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)) = conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)) = conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate (m1 $$ (j div r2, i div c2) * m2 $$ (j mod r2, i mod c2)) = conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "... = (Complex_Matrix.adjoint m1) $$ (i div c2, j div r2) *
    conjugate ( m2 $$ (j mod r2, i mod c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2))
[PROOF STEP]
by (metis adjoint_eval c2 ij less_mult_imp_div_less r2)
[PROOF STATE]
proof (state)
this:
conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conjugate (m1 $$ (j div r2, i div c2)) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "... = (Complex_Matrix.adjoint m1) $$ (i div c2, j div r2) *
    (Complex_Matrix.adjoint m2) $$ (i mod c2, j mod r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * Complex_Matrix.adjoint m2 $$ (i mod c2, j mod r2)
[PROOF STEP]
by (metis Euclidean_Division.div_eq_0_iff adjoint_eval assms(4) bits_mod_div_trivial c2
        gr_implies_not_zero ij(2) mult_not_zero r2)
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * Complex_Matrix.adjoint m2 $$ (i mod c2, j mod r2)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * conjugate (m2 $$ (j mod r2, i mod c2)) = Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * Complex_Matrix.adjoint m2 $$ (i mod c2, j mod r2)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < dim_col m1 * dim_col m2; j < dim_row m1 * dim_row m2\<rbrakk> \<Longrightarrow> Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
have "... = (tensor_mat (Complex_Matrix.adjoint m1) (Complex_Matrix.adjoint m2)) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * Complex_Matrix.adjoint m2 $$ (i mod c2, j mod r2) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
proof (rule index_tensor_mat[symmetric], (simp add: ij c1 c2 r1 r2) +)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. i < c1 * c2
 2. j < r1 * r2
 3. 0 < r1
 4. 0 < r2
[PROOF STEP]
show "i < c1 * c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < c1 * c2
[PROOF STEP]
using ij c1 c2
[PROOF STATE]
proof (prove)
using this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2
dim_col m1 = c1
dim_col m2 = c2

goal (1 subgoal):
 1. i < c1 * c2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < c1 * c2

goal (3 subgoals):
 1. j < r1 * r2
 2. 0 < r1
 3. 0 < r2
[PROOF STEP]
show "j < r1 * r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < r1 * r2
[PROOF STEP]
using ij r1 r2
[PROOF STATE]
proof (prove)
using this:
i < dim_col m1 * dim_col m2
j < dim_row m1 * dim_row m2
dim_row m1 = r1
dim_row m2 = r2

goal (1 subgoal):
 1. j < r1 * r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < r1 * r2

goal (2 subgoals):
 1. 0 < r1
 2. 0 < r2
[PROOF STEP]
show "0 < r1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < r1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. 0 < r1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < r1

goal (1 subgoal):
 1. 0 < r2
[PROOF STEP]
show "0 < r2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < r2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat r1 c1
m2 \<in> carrier_mat r2 c2
0 < c1
0 < c2
0 < r1
0 < r2

goal (1 subgoal):
 1. 0 < r2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < r2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint m1 $$ (i div c2, j div r2) * Complex_Matrix.adjoint m2 $$ (i mod c2, j mod r2) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)

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

goal (1 subgoal):
 1. Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Complex_Matrix.adjoint (m1 \<Otimes> m2) $$ (i, j) = (Complex_Matrix.adjoint m1 \<Otimes> Complex_Matrix.adjoint m2) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_reduced_homology_by_contractible:
   "\<lbrakk>contractible_space(subtopology X S); topspace X \<inter> S \<noteq> {}\<rbrakk>
      \<Longrightarrow> (hom_induced p X {} X S id) \<in> iso (reduced_homology_group p X) (relative_homology_group p X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>contractible_space (subtopology X S); topspace X \<inter> S \<noteq> {}\<rbrakk> \<Longrightarrow> hom_induced p X {} X S id \<in> Group.iso (reduced_homology_group p X) (relative_homology_group p X S)
[PROOF STEP]
using very_short_exact_sequence
    [of "reduced_homology_group (p - 1) (subtopology X S)"
        "relative_homology_group p X S"
        "reduced_homology_group p X"
        "reduced_homology_group p (subtopology X S)"
        "hom_boundary p X S"
        "hom_induced p X {} X S id"
        "hom_induced p (subtopology X S) {} X {} id"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>exact_seq ([reduced_homology_group (p - 1) (subtopology X S), relative_homology_group p X S, reduced_homology_group p X, reduced_homology_group p (subtopology X S)], [hom_boundary p X S, hom_induced p X {} X S id, hom_induced p (subtopology X S) {} X {} id]); trivial_group (reduced_homology_group p (subtopology X S)); trivial_group (reduced_homology_group (p - 1) (subtopology X S))\<rbrakk> \<Longrightarrow> hom_induced p X {} X S id \<in> Group.iso (reduced_homology_group p X) (relative_homology_group p X S)

goal (1 subgoal):
 1. \<lbrakk>contractible_space (subtopology X S); topspace X \<inter> S \<noteq> {}\<rbrakk> \<Longrightarrow> hom_induced p X {} X S id \<in> Group.iso (reduced_homology_group p X) (relative_homology_group p X S)
[PROOF STEP]
by (meson exact_seq_cons_iff homology_exactness_reduced_1 homology_exactness_reduced_3 trivial_reduced_homology_group_contractible_space)


[STATEMENT]
lemma padic_mult_assoc0:
assumes "prime p"
shows  "padic_mult p (padic_mult p x y) z = padic_mult p x (padic_mult p y z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_mult p (padic_mult p x y) z = padic_mult p x (padic_mult p y z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. padic_mult p (padic_mult p x y) z = padic_mult p x (padic_mult p y z)
[PROOF STEP]
unfolding padic_mult_def
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. (\<lambda>n. x n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> y n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> z n) = (\<lambda>n. x n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> (y n \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> z n))
[PROOF STEP]
by (simp add: padic_integers.residue_mult_assoc padic_integers_def)


[STATEMENT]
lemma monoI: "(\<And>f g x. (\<And>x. le (f x) (g x)) \<Longrightarrow> le (B f x) (B g x))
      \<Longrightarrow> monotone (fun_ord le) (fun_ord le) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g x. (\<And>x. le (f x) (g x)) \<Longrightarrow> le (B f x) (B g x)) \<Longrightarrow> monotone (fun_ord le) (fun_ord le) B
[PROOF STEP]
unfolding monotone_def fun_ord_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g x. (\<And>x. le (f x) (g x)) \<Longrightarrow> le (B f x) (B g x)) \<Longrightarrow> \<forall>x y. (\<forall>xa. le (x xa) (y xa)) \<longrightarrow> (\<forall>xa. le (B x xa) (B y xa))
[PROOF STEP]
by blast


[STATEMENT]
lemma sin_tan: "\<bar>x\<bar> < pi/2 \<Longrightarrow> sin x = tan x / sqrt (1 + tan x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> < pi / 2 \<Longrightarrow> sin x = tan x / sqrt (1 + (tan x)\<^sup>2)
[PROOF STEP]
using cos_gt_zero [of "x"] cos_gt_zero [of "-x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < x; x < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos x
\<lbrakk>0 < - x; - x < pi / 2\<rbrakk> \<Longrightarrow> 0 < cos (- x)

goal (1 subgoal):
 1. \<bar>x\<bar> < pi / 2 \<Longrightarrow> sin x = tan x / sqrt (1 + (tan x)\<^sup>2)
[PROOF STEP]
by (force simp: field_split_simps tan_def real_sqrt_divide abs_if split: if_split_asm)


[STATEMENT]
lemma gauss_jordan_integer_inverse: fixes fs gs :: "int vec list"
  assumes gs: "set gs \<subseteq> carrier_vec n"
  and len_gs: "length gs = n"
  and fs: "set fs \<subseteq> carrier_vec n"
  and len_fs: "length fs = n"
  and gauss: "gauss_jordan_integer_inverse n (map_mat rat_of_int (mat_of_cols n fs))
    (map_mat rat_of_int (mat_of_cols n gs)) (1\<^sub>m n)" (is "gauss_jordan_integer_inverse _ ?fs ?gs _")
shows "\<exists> U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have fs': "?fs \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n fs) \<in> carrier_mat n n
[PROOF STEP]
using fs len_fs
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
length fs = n

goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n fs) \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n fs) \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have gs': "?gs \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n gs) \<in> carrier_mat n n
[PROOF STEP]
using gs len_gs
[PROOF STATE]
proof (prove)
using this:
set gs \<subseteq> carrier_vec n
length gs = n

goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n gs) \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n gs) \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
note gauss = gauss[unfolded gauss_jordan_integer_inverse_def]
[PROOF STATE]
proof (state)
this:
case gauss_jordan (of_int_hom.mat_hom (mat_of_cols n fs)) (of_int_hom.mat_hom (mat_of_cols n gs)) of (C, D) \<Rightarrow> C = 1\<^sub>m n \<and> list_all is_int_rat (concat (mat_to_list D))

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
from gauss
[PROOF STATE]
proof (chain)
picking this:
case gauss_jordan (of_int_hom.mat_hom (mat_of_cols n fs)) (of_int_hom.mat_hom (mat_of_cols n gs)) of (C, D) \<Rightarrow> C = 1\<^sub>m n \<and> list_all is_int_rat (concat (mat_to_list D))
[PROOF STEP]
obtain A where gauss: "gauss_jordan ?fs ?gs = (1\<^sub>m n, A)"
   and int: "list_all is_int_rat (concat (mat_to_list A))"
[PROOF STATE]
proof (prove)
using this:
case gauss_jordan (of_int_hom.mat_hom (mat_of_cols n fs)) (of_int_hom.mat_hom (mat_of_cols n gs)) of (C, D) \<Rightarrow> C = 1\<^sub>m n \<and> list_all is_int_rat (concat (mat_to_list D))

goal (1 subgoal):
 1. (\<And>A. \<lbrakk>gauss_jordan (of_int_hom.mat_hom (mat_of_cols n fs)) (of_int_hom.mat_hom (mat_of_cols n gs)) = (1\<^sub>m n, A); list_all is_int_rat (concat (mat_to_list A))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauss_jordan (of_int_hom.mat_hom (mat_of_cols n fs)) (of_int_hom.mat_hom (mat_of_cols n gs)) = (1\<^sub>m n, A)
list_all is_int_rat (concat (mat_to_list A))

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
note gauss = gauss_jordan[OF fs' gs' gauss]
[PROOF STATE]
proof (state)
this:
?x \<in> Rn \<Longrightarrow> (of_int_hom.mat_hom (mat_of_cols n fs) *\<^sub>v ?x = 0\<^sub>v n) = (1\<^sub>m n *\<^sub>v ?x = 0\<^sub>v n)
?X \<in> carrier_mat n n \<Longrightarrow> (of_int_hom.mat_hom (mat_of_cols n fs) * ?X = of_int_hom.mat_hom (mat_of_cols n gs)) = (1\<^sub>m n * ?X = A)
1\<^sub>m n \<in> carrier_mat n n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
note A = gauss(4)
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
let ?A = "map_mat int_of_rat A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
from gauss(2)[OF A] A
[PROOF STATE]
proof (chain)
picking this:
(of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)) = (1\<^sub>m n * A = A)
A \<in> carrier_mat n n
[PROOF STEP]
have id: "?fs * A = ?gs"
[PROOF STATE]
proof (prove)
using this:
(of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)) = (1\<^sub>m n * A = A)
A \<in> carrier_mat n n

goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
let ?U = "(map_mat int_of_rat A)\<^sup>T"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat n n
[PROOF STEP]
have U: "?U \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (map_mat int_of_rat A)\<^sup>T \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(map_mat int_of_rat A)\<^sup>T \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have "A = map_mat of_int ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = of_int_hom.mat_hom (map_mat int_of_rat A)
[PROOF STEP]
using int[unfolded list_all_iff] A
[PROOF STATE]
proof (prove)
using this:
Ball (set (concat (mat_to_list A))) is_int_rat
A \<in> carrier_mat n n

goal (1 subgoal):
 1. A = of_int_hom.mat_hom (map_mat int_of_rat A)
[PROOF STEP]
by (intro eq_matI, auto simp: mat_to_list_def)
[PROOF STATE]
proof (state)
this:
A = of_int_hom.mat_hom (map_mat int_of_rat A)

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
with id
[PROOF STATE]
proof (chain)
picking this:
of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)
A = of_int_hom.mat_hom (map_mat int_of_rat A)
[PROOF STEP]
have "?gs = ?fs * map_mat of_int ?A"
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom (mat_of_cols n fs) * A = of_int_hom.mat_hom (mat_of_cols n gs)
A = of_int_hom.mat_hom (map_mat int_of_rat A)

goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs) * of_int_hom.mat_hom (map_mat int_of_rat A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs) * of_int_hom.mat_hom (map_mat int_of_rat A)

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs) * of_int_hom.mat_hom (map_mat int_of_rat A)

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have "\<dots> = map_mat of_int (mat_of_cols n fs * ?A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_hom.mat_hom (mat_of_cols n fs) * of_int_hom.mat_hom (map_mat int_of_rat A) = of_int_hom.mat_hom (mat_of_cols n fs * map_mat int_of_rat A)
[PROOF STEP]
by (rule of_int_hom.mat_hom_mult[symmetric], insert fs' A, auto)
[PROOF STATE]
proof (state)
this:
of_int_hom.mat_hom (mat_of_cols n fs) * of_int_hom.mat_hom (map_mat int_of_rat A) = of_int_hom.mat_hom (mat_of_cols n fs * map_mat int_of_rat A)

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs * map_mat int_of_rat A)
[PROOF STEP]
have "mat_of_cols n fs * ?A = mat_of_cols n gs"
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs * map_mat int_of_rat A)

goal (1 subgoal):
 1. mat_of_cols n fs * map_mat int_of_rat A = mat_of_cols n gs
[PROOF STEP]
using of_int_hom.mat_hom_inj
[PROOF STATE]
proof (prove)
using this:
of_int_hom.mat_hom (mat_of_cols n gs) = of_int_hom.mat_hom (mat_of_cols n fs * map_mat int_of_rat A)
of_int_hom.mat_hom ?A = of_int_hom.mat_hom ?B \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. mat_of_cols n fs * map_mat int_of_rat A = mat_of_cols n gs
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
mat_of_cols n fs * map_mat int_of_rat A = mat_of_cols n gs

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
hence "(mat_of_cols n gs)\<^sup>T = (mat_of_cols n fs * ?A)\<^sup>T"
[PROOF STATE]
proof (prove)
using this:
mat_of_cols n fs * map_mat int_of_rat A = mat_of_cols n gs

goal (1 subgoal):
 1. (mat_of_cols n gs)\<^sup>T = (mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(mat_of_cols n gs)\<^sup>T = (mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_cols n gs)\<^sup>T = (mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have "\<dots> = ?U * (mat_of_cols n fs)\<^sup>T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T = (map_mat int_of_rat A)\<^sup>T * (mat_of_cols n fs)\<^sup>T
[PROOF STEP]
by (rule transpose_mult, insert fs' A, auto)
[PROOF STATE]
proof (state)
this:
(mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T = (map_mat int_of_rat A)\<^sup>T * (mat_of_cols n fs)\<^sup>T

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_cols n fs * map_mat int_of_rat A)\<^sup>T = (map_mat int_of_rat A)\<^sup>T * (mat_of_cols n fs)\<^sup>T

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have "(mat_of_cols n fs)\<^sup>T = mat_of_rows n fs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_cols n fs)\<^sup>T = mat_of_rows n fs
[PROOF STEP]
using fs len_fs
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
length fs = n

goal (1 subgoal):
 1. (mat_of_cols n fs)\<^sup>T = mat_of_rows n fs
[PROOF STEP]
unfolding mat_of_rows_def mat_of_cols_def
[PROOF STATE]
proof (prove)
using this:
set fs \<subseteq> carrier_vec n
length fs = n

goal (1 subgoal):
 1. (mat n (length fs) (\<lambda>(i, j). fs ! j $ i))\<^sup>T = mat (length fs) n (\<lambda>(i, y). fs ! i $ y)
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
(mat_of_cols n fs)\<^sup>T = mat_of_rows n fs

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(mat_of_cols n fs)\<^sup>T = mat_of_rows n fs

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
have "(mat_of_cols n gs)\<^sup>T = mat_of_rows n gs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mat_of_cols n gs)\<^sup>T = mat_of_rows n gs
[PROOF STEP]
using gs len_gs
[PROOF STATE]
proof (prove)
using this:
set gs \<subseteq> carrier_vec n
length gs = n

goal (1 subgoal):
 1. (mat_of_cols n gs)\<^sup>T = mat_of_rows n gs
[PROOF STEP]
unfolding mat_of_rows_def mat_of_cols_def
[PROOF STATE]
proof (prove)
using this:
set gs \<subseteq> carrier_vec n
length gs = n

goal (1 subgoal):
 1. (mat n (length gs) (\<lambda>(i, j). gs ! j $ i))\<^sup>T = mat (length gs) n (\<lambda>(i, y). gs ! i $ y)
[PROOF STEP]
by (intro eq_matI, auto)
[PROOF STATE]
proof (state)
this:
(mat_of_cols n gs)\<^sup>T = mat_of_rows n gs

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
mat_of_rows n gs = (map_mat int_of_rat A)\<^sup>T * mat_of_rows n fs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n gs = (map_mat int_of_rat A)\<^sup>T * mat_of_rows n fs

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
using U
[PROOF STATE]
proof (prove)
using this:
mat_of_rows n gs = (map_mat int_of_rat A)\<^sup>T * mat_of_rows n fs
(map_mat int_of_rat A)\<^sup>T \<in> carrier_mat n n

goal (1 subgoal):
 1. \<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>U. U \<in> carrier_mat n n \<and> mat_of_rows n gs = U * mat_of_rows n fs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_prefix_eq_proper_prefix: "is_prefix a b = (a = b \<or> is_proper_prefix a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_prefix a b = (a = b \<or> is_proper_prefix a b)
[PROOF STEP]
by (metis append_Nil2 is_prefix_def is_proper_prefix_def)


[STATEMENT]
lemma vderiv_npowI[poly_derivatives]:
  fixes f::"real \<Rightarrow> real"
  assumes "n \<ge> 1" and "D f = f' on T" and "g = (\<lambda>t. n * (f' t) * (f t)^(n-1))"
  shows "D (\<lambda>t. (f t)^n) = g on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1.  D (\<lambda>t. f t ^ n) = g on T
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
 D f = f' on T
g = (\<lambda>t. real n * f' t * f t ^ (n - 1))

goal (1 subgoal):
 1.  D (\<lambda>t. f t ^ n) = g on T
[PROOF STEP]
unfolding has_vderiv_on_def has_vector_derivative_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
\<forall>x\<in>T. D f \<mapsto> (\<lambda>xa. xa *\<^sub>R f' x) at x within T
g = (\<lambda>t. real n * f' t * f t ^ (n - 1))

goal (1 subgoal):
 1. \<forall>x\<in>T. D (\<lambda>t. f t ^ n) \<mapsto> (\<lambda>xa. xa *\<^sub>R g x) at x within T
[PROOF STEP]
by (auto intro: derivative_eq_intros simp: field_simps)


[STATEMENT]
lemma uncountable_UNIV_complex: "uncountable (UNIV :: complex set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uncountable UNIV
[PROOF STEP]
using complex_non_denum
[PROOF STATE]
proof (prove)
using this:
\<nexists>f. surj f

goal (1 subgoal):
 1. uncountable UNIV
[PROOF STEP]
unfolding uncountable_def
[PROOF STATE]
proof (prove)
using this:
\<nexists>f. surj f

goal (1 subgoal):
 1. UNIV \<noteq> {} \<and> (\<nexists>f. surj f)
[PROOF STEP]
by auto


[STATEMENT]
lemma bigo_mult6: "\<forall>x. f x \<noteq> 0 \<Longrightarrow> O(f * g) = f *o O(g)"
  for f :: "'a \<Rightarrow> 'b::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> O(f * g) = f *o O(g)
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> O(f * g) \<subseteq> f *o O(g)
 2. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> f *o O(g) \<subseteq> O(f * g)
[PROOF STEP]
apply (erule bigo_mult5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> f *o O(g) \<subseteq> O(f * g)
[PROOF STEP]
apply (rule bigo_mult2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_ccINF_iff: "countable A \<Longrightarrow> u \<le> (INF i \<in> A. f i) \<longleftrightarrow> (\<forall>i\<in>A. u \<le> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> (u \<le> Inf (f ` A)) = (\<forall>i\<in>A. u \<le> f i)
[PROOF STEP]
using le_ccInf_iff [of "f ` A"]
[PROOF STATE]
proof (prove)
using this:
countable (f ` A) \<Longrightarrow> (?b \<le> Inf (f ` A)) = (\<forall>a\<in>f ` A. ?b \<le> a)

goal (1 subgoal):
 1. countable A \<Longrightarrow> (u \<le> Inf (f ` A)) = (\<forall>i\<in>A. u \<le> f i)
[PROOF STEP]
by simp


[STATEMENT]
lemma Y_inv [simp]:
  "Y * Y = 1\<^sub>m 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y * Y = 1\<^sub>m 2
[PROOF STEP]
apply(simp add: Y_def times_mat_def one_mat_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat 2 2 (\<lambda>(i, j). row (mat 2 2 (\<lambda>(i, j). if i = j then 0 else if i = 0 then - \<i> else \<i>)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i = j then 0 else if i = 0 then - \<i> else \<i>)) j) = mat 2 2 (\<lambda>(i, j). if i = j then 1 else 0)
[PROOF STEP]
apply(rule cong_mat)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. 2 = 2
 2. 2 = 2
 3. \<And>i j. \<lbrakk>i < 2; j < 2\<rbrakk> \<Longrightarrow> (case (i, j) of (i, j) \<Rightarrow> row (mat 2 2 (\<lambda>(i, j). if i = j then 0 else if i = 0 then - \<i> else \<i>)) i \<bullet> col (mat 2 2 (\<lambda>(i, j). if i = j then 0 else if i = 0 then - \<i> else \<i>)) j) = (case (i, j) of (i, j) \<Rightarrow> if i = j then 1 else 0)
[PROOF STEP]
by(auto simp: scalar_prod_def)


[STATEMENT]
lemma max_depth_Suc: "max_depth \<phi> = Suc n = ((\<exists>\<psi>. \<phi> = Neg \<psi> \<and> max_depth \<psi> = n) \<or>
  (\<exists>\<psi>1 \<psi>2. \<phi> = Conj \<psi>1 \<psi>2 \<and> max (max_depth \<psi>1) (max_depth \<psi>2) = n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (max_depth \<phi> = Suc n) = ((\<exists>\<psi>. \<phi> = Neg \<psi> \<and> max_depth \<psi> = n) \<or> (\<exists>\<psi>1 \<psi>2. \<phi> = Conj \<psi>1 \<psi>2 \<and> max (max_depth \<psi>1) (max_depth \<psi>2) = n))
[PROOF STEP]
by (cases \<phi>) auto


[STATEMENT]
lemma angle_eqI:
  assumes "a \<noteq> b" "a \<noteq> c" "d \<noteq> e" "d \<noteq> f"
  assumes "((b-a) \<bullet> (c-a)) * dist d e * dist d f = ((e-d) \<bullet> (f-d)) * dist a b * dist a c"
  shows   "angle b a c = angle e d f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. angle b a c = angle e d f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
a \<noteq> c
d \<noteq> e
d \<noteq> f
(b - a) \<bullet> (c - a) * dist d e * dist d f = (e - d) \<bullet> (f - d) * dist a b * dist a c

goal (1 subgoal):
 1. angle b a c = angle e d f
[PROOF STEP]
unfolding angle_def
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
a \<noteq> c
d \<noteq> e
d \<noteq> f
(b - a) \<bullet> (c - a) * dist d e * dist d f = (e - d) \<bullet> (f - d) * dist a b * dist a c

goal (1 subgoal):
 1. vangle (b - a) (c - a) = vangle (e - d) (f - d)
[PROOF STEP]
by (intro vangle_eqI) (simp_all add: dist_norm norm_minus_commute)


[STATEMENT]
lemma fref_compI:
    "fref P R1 R2 O fref Q S1 S2 \<subseteq>
      fref (\<lambda>x. Q x \<and> (\<forall>y. (y,x)\<in>S1 \<longrightarrow> P y)) (R1 O S1) (R2 O S2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([P]\<^sub>f R1 \<rightarrow> R2) O ([Q]\<^sub>f S1 \<rightarrow> S2) \<subseteq> [\<lambda>x. Q x \<and> (\<forall>y. (y, x) \<in> S1 \<longrightarrow> P y)]\<^sub>f R1 O S1 \<rightarrow> R2 O S2
[PROOF STEP]
unfolding fref_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(f, g). \<forall>x y. P y \<and> (x, y) \<in> R1 \<longrightarrow> (f x, g y) \<in> R2} O {(f, g). \<forall>x y. Q y \<and> (x, y) \<in> S1 \<longrightarrow> (f x, g y) \<in> S2} \<subseteq> {(f, g). \<forall>x y. (Q y \<and> (\<forall>ya. (ya, y) \<in> S1 \<longrightarrow> P ya)) \<and> (x, y) \<in> R1 O S1 \<longrightarrow> (f x, g y) \<in> R2 O S2}
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z xb yb za. \<lbrakk>\<forall>xa ya. P ya \<and> (xa, ya) \<in> R1 \<longrightarrow> (x xa, y ya) \<in> R2; \<forall>x ya. Q ya \<and> (x, ya) \<in> S1 \<longrightarrow> (y x, z ya) \<in> S2; Q za; \<forall>y. (y, za) \<in> S1 \<longrightarrow> P y; (xb, yb) \<in> R1; (yb, za) \<in> S1\<rbrakk> \<Longrightarrow> (x xb, z za) \<in> R2 O S2
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma powa_less_mono:
  assumes "r < s" and "a > 1"
  shows "a powa r < a powa s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
obtain q where "r < real_of_rat q" "real_of_rat q < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>q. \<lbrakk>r < real_of_rat q; real_of_rat q < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) of_rat_dense
[PROOF STATE]
proof (prove)
using this:
r < s
?x < ?y \<Longrightarrow> \<exists>q. ?x < real_of_rat q \<and> real_of_rat q < ?y

goal (1 subgoal):
 1. (\<And>q. \<lbrakk>r < real_of_rat q; real_of_rat q < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
r < real_of_rat q
real_of_rat q < s

goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
r < real_of_rat q
real_of_rat q < s

goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
obtain qa where "real_of_rat q < real_of_rat qa" "real_of_rat qa < s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>qa. \<lbrakk>real_of_rat q < real_of_rat qa; real_of_rat qa < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using of_rat_dense calculation(2)
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<Longrightarrow> \<exists>q. ?x < real_of_rat q \<and> real_of_rat q < ?y
real_of_rat q < s

goal (1 subgoal):
 1. (\<And>qa. \<lbrakk>real_of_rat q < real_of_rat qa; real_of_rat qa < s\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real_of_rat q < real_of_rat qa
real_of_rat qa < s

goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
r < real_of_rat q
real_of_rat q < s
real_of_rat q < real_of_rat qa
real_of_rat qa < s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r < real_of_rat q
real_of_rat q < s
real_of_rat q < real_of_rat qa
real_of_rat qa < s

goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r < real_of_rat q
real_of_rat q < s
real_of_rat q < real_of_rat qa
real_of_rat qa < s
r < s
1 < a

goal (1 subgoal):
 1. a powa r < a powa s
[PROOF STEP]
by (metis (full_types) antisym less_eq_real_def less_imp_not_eq2 powa_le_mono
        powa_powrat_eq powrat_inject_exp)
[PROOF STATE]
proof (state)
this:
a powa r < a powa s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tanh_real_le_iff [simp]: "tanh x \<le> tanh y \<longleftrightarrow> x \<le> (y::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (tanh x \<le> tanh y) = (x \<le> y)
[PROOF STEP]
using tanh_real_strict_mono
[PROOF STATE]
proof (prove)
using this:
strict_mono tanh

goal (1 subgoal):
 1. (tanh x \<le> tanh y) = (x \<le> y)
[PROOF STEP]
by (simp add: strict_mono_less_eq)


[STATEMENT]
lemma representation_neg:
  "independent basis \<Longrightarrow> v \<in> span basis \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)
[PROOF STEP]
using representation_diff[of basis v 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>independent basis; v \<in> span basis; (0::'b) \<in> span basis\<rbrakk> \<Longrightarrow> representation basis ((0::'b) - v) = (\<lambda>b. representation basis (0::'b) b - representation basis v b)

goal (1 subgoal):
 1. \<lbrakk>independent basis; v \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (- v) = (\<lambda>b. - representation basis v b)
[PROOF STEP]
by (simp add: representation_zero span_zero)


[STATEMENT]
lemma hcpow_not_zero [simp,intro]: "\<And>r n. r \<noteq> 0 \<Longrightarrow> r pow n \<noteq> (0::hcomplex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r n. r \<noteq> 0 \<Longrightarrow> r pow n \<noteq> 0
[PROOF STEP]
by (fact hyperpow_not_zero)


[STATEMENT]
lemma Max_Int_le: "\<lbrakk> (A \<inter> B) \<noteq> {}; finite A; finite B \<rbrakk> \<Longrightarrow>
  Max (A \<inter> B) \<le> min (Max A) (Max B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<inter> B \<noteq> {}; finite A; finite B\<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> min (Max A) (Max B)
[PROOF STEP]
apply (rule conj_le_imp_min)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<inter> B \<noteq> {}; finite A; finite B\<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> Max A
 2. \<lbrakk>A \<inter> B \<noteq> {}; finite A; finite B\<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> Max B
[PROOF STEP]
apply (rule Max_Int_le1, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<inter> B \<noteq> {}; finite A; finite B\<rbrakk> \<Longrightarrow> Max (A \<inter> B) \<le> Max B
[PROOF STEP]
apply (rule Max_Int_le2, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem Pluennecke_Ruzsa_ineq_alt:
  assumes "finite A" "A \<subseteq> G"
    and "card (sumset A A) \<le> K * real (card A)" "r > 0" "s > 0"
  shows "card (differenceset (sumset_iterated A r) (sumset_iterated A s)) \<le> K^(r+s) * real(card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
proof (cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
 2. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
 2. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = {}
[PROOF STEP]
have "sumset_iterated A r = {}" if "r>0" for r
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. sumset_iterated A r = {}
[PROOF STEP]
using sumset_iterated_empty that
[PROOF STATE]
proof (prove)
using this:
A = {}
0 < ?r \<Longrightarrow> sumset_iterated {} ?r = {}
0 < r

goal (1 subgoal):
 1. sumset_iterated A r = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < ?r \<Longrightarrow> sumset_iterated A ?r = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
 2. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> G
real (card (sumset A A)) \<le> K * real (card A)
0 < r
0 < s
0 < ?r \<Longrightarrow> sumset_iterated A ?r = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> G
real (card (sumset A A)) \<le> K * real (card A)
0 < r
0 < s
0 < ?r \<Longrightarrow> sumset_iterated A ?r = {}

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
by (auto simp: True)
[PROOF STATE]
proof (state)
this:
real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
with assms Pluennecke_Ruzsa_ineq
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<subseteq> G
real (card (sumset A A)) \<le> K * real (card A)
0 < r
0 < s
\<lbrakk>real (card (sumset ?A ?B)) \<le> ?K * real (card ?A); finite ?A; ?A \<subseteq> G; ?A \<noteq> {}; finite ?B; ?B \<subseteq> G; 0 < ?r; 0 < ?s\<rbrakk> \<Longrightarrow> real (card (differenceset (sumset_iterated ?B ?r) (sumset_iterated ?B ?s))) \<le> ?K ^ (?r + ?s) * real (card ?A)
A \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A
A \<subseteq> G
real (card (sumset A A)) \<le> K * real (card A)
0 < r
0 < s
\<lbrakk>real (card (sumset ?A ?B)) \<le> ?K * real (card ?A); finite ?A; ?A \<subseteq> G; ?A \<noteq> {}; finite ?B; ?B \<subseteq> G; 0 < ?r; 0 < ?s\<rbrakk> \<Longrightarrow> real (card (differenceset (sumset_iterated ?B ?r) (sumset_iterated ?B ?s))) \<le> ?K ^ (?r + ?s) * real (card ?A)
A \<noteq> {}

goal (1 subgoal):
 1. real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
real (card (differenceset (sumset_iterated A r) (sumset_iterated A s))) \<le> K ^ (r + s) * real (card A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma normal_eq_commuting:
  assumes "carrier G \<subseteq> A <#> B" "A \<inter> B \<subseteq> {\<one>}"
  shows "A \<lhd> G \<and> B \<lhd> G \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A \<lhd> G \<and> B \<lhd> G) = (\<forall>x\<in>A. \<forall>y\<in>B. x \<otimes> y = y \<otimes> x)
[PROOF STEP]
by (metis assms commuting_imp_normal1 commuting_imp_normal2 normal_imp_commuting)


[STATEMENT]
lemma proj_psi_trace:
  "trace (proj_psi) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace proj_psi = 1
[PROOF STEP]
unfolding proj_psi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (outer_prod \<psi> \<psi>) = 1
[PROOF STEP]
apply (subst trace_outer_prod[of _ N])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<psi> \<in> carrier_vec N
 2. inner_prod \<psi> \<psi> = 1
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> \<in> carrier_vec N
[PROOF STEP]
unfolding \<psi>_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec N (\<lambda>x. complex_of_real (1 / sqrt (real N))) \<in> carrier_vec N
[PROOF STEP]
by auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod \<psi> \<psi> = 1
[PROOF STEP]
using norm_psi
[PROOF STATE]
proof (prove)
using this:
inner_prod \<psi> \<psi> = 1

goal (1 subgoal):
 1. inner_prod \<psi> \<psi> = 1
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_negations:
  assumes "convex S"
  shows "convex ((\<lambda>x. - x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (uminus ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex (uminus ` S)
[PROOF STEP]
have "linear (\<lambda>x. - x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear uminus
[PROOF STEP]
by (simp add: linearI)
[PROOF STATE]
proof (state)
this:
linear uminus

goal (1 subgoal):
 1. convex (uminus ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear uminus
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linear uminus

goal (1 subgoal):
 1. convex (uminus ` S)
[PROOF STEP]
using \<open>convex S\<close>
[PROOF STATE]
proof (prove)
using this:
linear uminus
convex S

goal (1 subgoal):
 1. convex (uminus ` S)
[PROOF STEP]
by (rule convex_linear_image)
[PROOF STATE]
proof (state)
this:
convex (uminus ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_setdist_iff:
        "d \<le> setdist S T \<longleftrightarrow>
        (\<forall>x \<in> S. \<forall>y \<in> T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d \<le> setdist S T) = ((\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0))
[PROOF STEP]
apply (cases "S = {} \<or> T = {}")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> (d \<le> setdist S T) = ((\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0))
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> (d \<le> setdist S T) = ((\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0))
[PROOF STEP]
apply (force simp add: setdist_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (S = {} \<or> T = {}) \<Longrightarrow> (d \<le> setdist S T) = ((\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0))
[PROOF STEP]
apply (intro iffI conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<not> (S = {} \<or> T = {}); d \<le> setdist S T\<rbrakk> \<Longrightarrow> \<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y
 2. \<lbrakk>\<not> (S = {} \<or> T = {}); d \<le> setdist S T\<rbrakk> \<Longrightarrow> S = {} \<or> T = {} \<longrightarrow> d \<le> 0
 3. \<lbrakk>\<not> (S = {} \<or> T = {}); (\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)\<rbrakk> \<Longrightarrow> d \<le> setdist S T
[PROOF STEP]
using setdist_le_dist
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> ?s; ?y \<in> ?t\<rbrakk> \<Longrightarrow> setdist ?s ?t \<le> dist ?x ?y

goal (3 subgoals):
 1. \<lbrakk>\<not> (S = {} \<or> T = {}); d \<le> setdist S T\<rbrakk> \<Longrightarrow> \<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y
 2. \<lbrakk>\<not> (S = {} \<or> T = {}); d \<le> setdist S T\<rbrakk> \<Longrightarrow> S = {} \<or> T = {} \<longrightarrow> d \<le> 0
 3. \<lbrakk>\<not> (S = {} \<or> T = {}); (\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)\<rbrakk> \<Longrightarrow> d \<le> setdist S T
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<not> (S = {} \<or> T = {}); d \<le> setdist S T\<rbrakk> \<Longrightarrow> S = {} \<or> T = {} \<longrightarrow> d \<le> 0
 2. \<lbrakk>\<not> (S = {} \<or> T = {}); (\<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)\<rbrakk> \<Longrightarrow> d \<le> setdist S T
[PROOF STEP]
apply (auto simp: intro: le_setdistI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma real_powr_at_bot_neg:
  assumes "(a::real) > 0" "a < 1"
  shows   "filterlim (\<lambda>x. a powr x) at_top at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
a < 1
[PROOF STEP]
have "LIM x at_bot. ln (inverse a) * -x :> at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1

goal (1 subgoal):
 1. LIM x at_bot. ln (inverse a) * - x :> at_top
[PROOF STEP]
by (intro filterlim_tendsto_pos_mult_at_top[OF tendsto_const] filterlim_uminus_at_top_at_bot)
       (simp_all add: ln_inverse)
[PROOF STATE]
proof (state)
this:
LIM x at_bot. ln (inverse a) * - x :> at_top

goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < a
a < 1
LIM x at_bot. ln (inverse a) * - x :> at_top
[PROOF STEP]
have "LIM x at_bot. x * ln a :> at_top"
[PROOF STATE]
proof (prove)
using this:
0 < a
a < 1
LIM x at_bot. ln (inverse a) * - x :> at_top

goal (1 subgoal):
 1. LIM x at_bot. x * ln a :> at_top
[PROOF STEP]
by (subst (asm) ln_inverse) (simp_all add: mult.commute)
[PROOF STATE]
proof (state)
this:
LIM x at_bot. x * ln a :> at_top

goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
hence "LIM x at_bot. exp (x * ln a) :> at_top"
[PROOF STATE]
proof (prove)
using this:
LIM x at_bot. x * ln a :> at_top

goal (1 subgoal):
 1. LIM x at_bot. exp (x * ln a) :> at_top
[PROOF STEP]
by (intro filterlim_compose[OF exp_at_top]) simp
[PROOF STATE]
proof (state)
this:
LIM x at_bot. exp (x * ln a) :> at_top

goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x at_bot. exp (x * ln a) :> at_top

goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
LIM x at_bot. exp (x * ln a) :> at_top
0 < a
a < 1

goal (1 subgoal):
 1. filterlim ((powr) a) at_top at_bot
[PROOF STEP]
unfolding powr_def
[PROOF STATE]
proof (prove)
using this:
LIM x at_bot. exp (x * ln a) :> at_top
0 < a
a < 1

goal (1 subgoal):
 1. LIM x at_bot. if a = 0 then 0 else exp (x * ln a) :> at_top
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
filterlim ((powr) a) at_top at_bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mset_le_add_iff2:
  "i \<le> (j::nat) \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j-i) u + n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)
[PROOF STEP]
assume "i \<le> j"
[PROOF STATE]
proof (state)
this:
i \<le> j

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<le> j
[PROOF STEP]
have "i + (j - i) = j"
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. i + (j - i) = j
[PROOF STEP]
using le_add_diff_inverse
[PROOF STATE]
proof (prove)
using this:
i \<le> j
?b \<le> ?a \<Longrightarrow> ?b + (?a - ?b) = ?a

goal (1 subgoal):
 1. i + (j - i) = j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i + (j - i) = j

goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i + (j - i) = j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i + (j - i) = j

goal (1 subgoal):
 1. (repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)
[PROOF STEP]
by (metis (no_types) add_le_cancel_left left_add_mult_distrib_mset)
[PROOF STATE]
proof (state)
this:
(repeat_mset i u + m \<le> repeat_mset j u + n) = (m \<le> repeat_mset (j - i) u + n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem mss_kadane: "mss_kadane xs = Max {s. \<exists>as bs cs. xs = as @ bs @ cs \<and> s = sum_list bs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mss_kadane xs = Max {s. \<exists>as bs cs. xs = as @ bs @ cs \<and> s = sum_list bs}
[PROOF STEP]
using mss_kadane_mid_sums mid_sums
[PROOF STATE]
proof (prove)
using this:
mss_kadane ?xs = Max (mid_sums ?xs)
mid_sums ?xs = {s. \<exists>as bs cs. ?xs = as @ bs @ cs \<and> s = sum_list bs}

goal (1 subgoal):
 1. mss_kadane xs = Max {s. \<exists>as bs cs. xs = as @ bs @ cs \<and> s = sum_list bs}
[PROOF STEP]
by auto


[STATEMENT]
lemma neg_le_minus_divideC_eq [field_simps]:
  "a \<le> - (b /\<^sub>C c) \<longleftrightarrow> - b \<le> c *\<^sub>C a" if "c < 0"
    for a b :: "'a :: ordered_complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> - (b /\<^sub>C c)) = (- b \<le> c *\<^sub>C a)
[PROOF STEP]
using that pos_le_minus_divideC_eq [of "- c" a "- b"]
[PROOF STATE]
proof (prove)
using this:
c < 0
0 < - c \<Longrightarrow> (a \<le> - (- b /\<^sub>C - c)) = (- c *\<^sub>C a \<le> - (- b))

goal (1 subgoal):
 1. (a \<le> - (b /\<^sub>C c)) = (- b \<le> c *\<^sub>C a)
[PROOF STEP]
by (metis neg_le_divideC_eq complex_vector.scale_minus_right)


[STATEMENT]
lemma ereal_closed_mono_set:
  fixes S :: "ereal set"
  shows "closed S \<and> mono_set S \<longleftrightarrow> S = {} \<or> S = {Inf S ..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (closed S \<and> mono_set S) = (S = {} \<or> S = {Inf S..})
[PROOF STEP]
by (metis Inf_UNIV atLeast_eq_UNIV_iff closed_ereal_atLeast
    ereal_open_closed mono_empty mono_set_iff open_ereal_greaterThan)


[STATEMENT]
lemma permutation_similar_mat: assumes A: "A \<in> carrier_mat n n" and p: "p permutes {..<n}"
  shows "similar_mat A (Matrix.mat n n (\<lambda> (i,j). A $$ (p i, p j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. similar_mat A (Matrix.mat n n (\<lambda>(i, j). A $$ (p i, p j)))
[PROOF STEP]
by (rule similar_matI[OF _ permutation_mat_id_1[OF p] permutation_mat_id_2[OF p]
  permutation_mat_both[symmetric, OF A p]], insert A, auto)


[STATEMENT]
lemma convex_rel_open_linear_image:
  fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
  assumes "linear f"
    and "convex S"
    and "rel_open S"
  shows "convex (f ` S) \<and> rel_open (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex (f ` S) \<and> rel_open (f ` S)
[PROOF STEP]
by (metis assms convex_linear_image rel_interior_convex_linear_image rel_open_def)


[STATEMENT]
lemma aux2_digit_wise_gen_equiv: "(\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> (a mod b^k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0
[PROOF STEP]
proof(induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<forall>r<0. nth_digit a r b = 0) \<longrightarrow> a mod b ^ 0 = 0
 2. \<And>k. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0 \<Longrightarrow> (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<forall>r<0. nth_digit a r b = 0) \<longrightarrow> a mod b ^ 0 = 0
 2. \<And>k. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0 \<Longrightarrow> (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>r<0. nth_digit a r b = 0) \<longrightarrow> a mod b ^ 0 = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>r<0. nth_digit a r b = 0) \<longrightarrow> a mod b ^ 0 = 0

goal (1 subgoal):
 1. \<And>k. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0 \<Longrightarrow> (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0 \<Longrightarrow> (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
(\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0

goal (1 subgoal):
 1. \<And>k. (\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0 \<Longrightarrow> (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<forall>r<k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ k = 0

goal (1 subgoal):
 1. (\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0
[PROOF STEP]
apply(auto simp add: nth_digit_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>r<Suc k. a div b ^ r mod b = 0; b ^ k dvd a\<rbrakk> \<Longrightarrow> a mod (b * b ^ k) = 0
[PROOF STEP]
using dvd_imp_mod_0 dvd_mult_div_cancel dvd_refl
        lessI minus_mod_eq_div_mult minus_mod_eq_mult_div mult_dvd_mono
[PROOF STATE]
proof (prove)
using this:
?a dvd ?b \<Longrightarrow> ?b mod ?a = (0::?'a)
?a dvd ?b \<Longrightarrow> ?a * (?b div ?a) = ?b
?a dvd ?a
?n < Suc ?n
?a - ?a mod ?b = ?a div ?b * ?b
?a - ?a mod ?b = ?b * (?a div ?b)
\<lbrakk>?a dvd ?b; ?c dvd ?d\<rbrakk> \<Longrightarrow> ?a * ?c dvd ?b * ?d

goal (1 subgoal):
 1. \<lbrakk>\<forall>r<Suc k. a div b ^ r mod b = 0; b ^ k dvd a\<rbrakk> \<Longrightarrow> a mod (b * b ^ k) = 0
[PROOF STEP]
by (metis mod_0_imp_dvd)
[PROOF STATE]
proof (state)
this:
(\<forall>r<Suc k. nth_digit a r b = 0) \<longrightarrow> a mod b ^ Suc k = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_setdiff:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  assumes "f integrable_on S" "f integrable_on T" "negligible(T - S)"
 shows "integral (S - T) f = integral S f - integral T f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (S - T) f = integral S f - integral T f
[PROOF STEP]
by (rule integral_unique) (simp add: assms has_integral_setdiff integrable_integral)


[STATEMENT]
lemma fib_gcd: "fib (gcd m n) = gcd (fib m) (fib n)"  \<comment> \<open>Law 6.111\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fib (gcd m n) = gcd (fib m) (fib n)
[PROOF STEP]
by (induct m n rule: gcd_nat_induct) (simp_all add: gcd_non_0_nat gcd.commute gcd_fib_mod)


[STATEMENT]
lemma prime_nonzero:  "prime (p::nat) \<Longrightarrow> p \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> p \<noteq> 0
[PROOF STEP]
by (force simp add: prime_nat_iff)


[STATEMENT]
lemma convex_scaling:
  assumes "convex S"
  shows "convex ((\<lambda>x. c *\<^sub>R x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex ((*\<^sub>R) c ` S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convex ((*\<^sub>R) c ` S)
[PROOF STEP]
have "linear (\<lambda>x. c *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear ((*\<^sub>R) c)
[PROOF STEP]
by (simp add: linearI scaleR_add_right)
[PROOF STATE]
proof (state)
this:
linear ((*\<^sub>R) c)

goal (1 subgoal):
 1. convex ((*\<^sub>R) c ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
linear ((*\<^sub>R) c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linear ((*\<^sub>R) c)

goal (1 subgoal):
 1. convex ((*\<^sub>R) c ` S)
[PROOF STEP]
using \<open>convex S\<close>
[PROOF STATE]
proof (prove)
using this:
linear ((*\<^sub>R) c)
convex S

goal (1 subgoal):
 1. convex ((*\<^sub>R) c ` S)
[PROOF STEP]
by (rule convex_linear_image)
[PROOF STATE]
proof (state)
this:
convex ((*\<^sub>R) c ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_mult_ge_mono: assumes "p1 \<ge>p p2" and "q \<ge>p zero_poly"
  shows "poly_mult p1 q \<ge>p poly_mult p2 q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult p1 q \<ge>p poly_mult p2 q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p1 \<ge>p p2
q \<ge>p zero_poly

goal (1 subgoal):
 1. poly_mult p1 q \<ge>p poly_mult p2 q
[PROOF STEP]
unfolding poly_ge_def zero_poly_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> p2 \<le> eval_poly \<alpha> p1
\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> [] \<le> eval_poly \<alpha> q

goal (1 subgoal):
 1. \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> (poly_mult p2 q) \<le> eval_poly \<alpha> (poly_mult p1 q)
[PROOF STEP]
by (auto simp: times_left_mono)


[STATEMENT]
lemma card_finite_graph_partition:
  assumes "finite_graph_partition V P k" "finite V"
  shows "(\<Sum>X\<in>P. card X) = card V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum card P = card V
[PROOF STEP]
by (metis assms finite_graph_partition_def finite_graph_partition_finite product_partition)


[STATEMENT]
lemma pow_res_nat_pow:
  assumes "n > 0"
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "b \<in> carrier Q\<^sub>p"
  assumes "pow_res n a = pow_res n b"
  shows "pow_res n (a[^](k::nat)) = pow_res n (b[^]k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pow_res n (a [^] k) = pow_res n (b [^] k)
[PROOF STEP]
apply(induction k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. pow_res n (a [^] 0) = pow_res n (b [^] 0)
 2. \<And>k. pow_res n (a [^] k) = pow_res n (b [^] k) \<Longrightarrow> pow_res n (a [^] Suc k) = pow_res n (b [^] Suc k)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
pow_res n a = pow_res n b

goal (2 subgoals):
 1. pow_res n (a [^] 0) = pow_res n (b [^] 0)
 2. \<And>k. pow_res n (a [^] k) = pow_res n (b [^] k) \<Longrightarrow> pow_res n (a [^] Suc k) = pow_res n (b [^] Suc k)
[PROOF STEP]
apply (metis Group.nat_pow_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. pow_res n (a [^] k) = pow_res n (b [^] k) \<Longrightarrow> pow_res n (a [^] Suc k) = pow_res n (b [^] Suc k)
[PROOF STEP]
using assms pow_res_mult
[PROOF STATE]
proof (prove)
using this:
0 < n
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
pow_res n a = pow_res n b
\<lbrakk>0 < ?n; ?a \<in> carrier Q\<^sub>p; ?b \<in> carrier Q\<^sub>p; ?c \<in> carrier Q\<^sub>p; ?d \<in> carrier Q\<^sub>p; pow_res ?n ?a = pow_res ?n ?c; pow_res ?n ?b = pow_res ?n ?d\<rbrakk> \<Longrightarrow> pow_res ?n (?a \<otimes> ?b) = pow_res ?n (?c \<otimes> ?d)

goal (1 subgoal):
 1. \<And>k. pow_res n (a [^] k) = pow_res n (b [^] k) \<Longrightarrow> pow_res n (a [^] Suc k) = pow_res n (b [^] Suc k)
[PROOF STEP]
by (smt Qp.nat_pow_Suc2 Qp.nat_pow_closed)


[STATEMENT]
lemma fps_cos_nth_add_2:
  "fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
 2. \<And>nat. n = Suc nat \<Longrightarrow> fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
case (Suc n')
[PROOF STATE]
proof (state)
this:
n = Suc n'

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
 2. \<And>nat. n = Suc nat \<Longrightarrow> fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = Suc n'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = Suc n'

goal (1 subgoal):
 1. fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
unfolding fps_cos_def
[PROOF STATE]
proof (prove)
using this:
n = Suc n'

goal (1 subgoal):
 1. Abs_fps (\<lambda>n. if even n then (- (1::'a)) ^ (n div 2) * c ^ n / of_nat (fact n) else (0::'a)) $ (n + 2) = - (c * c * Abs_fps (\<lambda>n. if even n then (- (1::'a)) ^ (n div 2) * c ^ n / of_nat (fact n) else (0::'a)) $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> fps_cos c $ (n + 2) = - (c * c * fps_cos c $ n / (of_nat (n + 1) * of_nat (n + 2)))
[PROOF STEP]
qed (auto simp: fps_cos_def)


[STATEMENT]
lemma content_iff: "x dvd content p \<longleftrightarrow> (\<forall> c \<in> set (coeffs p). x dvd c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x dvd content p) = (\<forall>c\<in>set (coeffs p). x dvd c)
[PROOF STEP]
by (simp add: content_def dvd_gcd_list_iff)


[STATEMENT]
lemma Least_True_nat[intro, simp]: "(LEAST i::nat. True) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST i. True) = 0
[PROOF STEP]
by (metis (lifting) One_nat_def less_one not_less_Least not_less_eq)


[STATEMENT]
theorem pred_correct: "invar_vebt t n \<Longrightarrow> vebt_pred t x = Some sx \<longleftrightarrow>is_pred_in_set (set_vebt t) x sx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invar_vebt t n \<Longrightarrow> (vebt_pred t x = Some sx) = is_pred_in_set (set_vebt t) x sx
[PROOF STEP]
by (simp add: pred_corr set_vebt_set_vebt'_valid)


[STATEMENT]
lemma deriv_power [simp]:
  "deriv (\<lambda>x. x ^ n) x = of_nat n * x ^ (n - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) x = of_nat n * x ^ (n - 1)
[PROOF STEP]
using DERIV_power[of "\<lambda>x. x" 1] DERIV_imp_deriv
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. x) has_field_derivative (1::?'b1)) (at ?x within ?s) \<Longrightarrow> ((\<lambda>x. x ^ ?n) has_field_derivative of_nat ?n * ((1::?'b1) * ?x ^ (?n - Suc 0))) (at ?x within ?s)
(?f has_field_derivative ?f') (at ?x) \<Longrightarrow> deriv ?f ?x = ?f'

goal (1 subgoal):
 1. deriv (\<lambda>x. x ^ n) x = of_nat n * x ^ (n - 1)
[PROOF STEP]
by force


[STATEMENT]
lemma eigen_equation:
  shows "eigenval k H \<longleftrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0" (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenval k H = (k\<^sup>2 - mat_trace H * k + mat_det H = 0)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eigenval k H = (k\<^sup>2 - mat_trace H * k + mat_det H = 0)
[PROOF STEP]
obtain A B C D where HH: "H = (A, B, C, D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B C D. H = (A, B, C, D) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases H) auto
[PROOF STATE]
proof (state)
this:
H = (A, B, C, D)

goal (1 subgoal):
 1. eigenval k H = (k\<^sup>2 - mat_trace H * k + mat_det H = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenval k H = (k\<^sup>2 - mat_trace H * k + mat_det H = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
eigenval k H

goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eigenval k H
[PROOF STEP]
obtain v where "v \<noteq> vec_zero" "H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v"
[PROOF STATE]
proof (prove)
using this:
eigenval k H

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<noteq> vec_zero; H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eigenval_def
[PROOF STATE]
proof (prove)
using this:
\<exists>v. v \<noteq> vec_zero \<and> H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<noteq> vec_zero; H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<noteq> vec_zero
H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v

goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
obtain v1 v2 where vv: "v = (v1, v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v1 v2. v = (v1, v2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases v) auto
[PROOF STATE]
proof (state)
this:
v = (v1, v2)

goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
from \<open>H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v\<close>
[PROOF STATE]
proof (chain)
picking this:
H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v
[PROOF STEP]
have "(H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) *\<^sub>m\<^sub>v v = vec_zero"
[PROOF STATE]
proof (prove)
using this:
H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v

goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
[PROOF STEP]
using HH vv
[PROOF STATE]
proof (prove)
using this:
H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v
H = (A, B, C, D)
v = (v1, v2)

goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence "mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0"
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
using \<open>v \<noteq> vec_zero\<close> vv HH
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
v \<noteq> vec_zero
v = (v1, v2)
H = (A, B, C, D)

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
using regular_homogenous_system[of "A - k" B C "D - k" v1 v2]
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
v \<noteq> vec_zero
v = (v1, v2)
H = (A, B, C, D)
\<lbrakk>det2 (A - k) B C (D - k) \<noteq> 0; (A - k) * v1 + B * v2 = 0; C * v1 + (D - k) * v2 = 0\<rbrakk> \<Longrightarrow> v1 = 0 \<and> v2 = 0

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
unfolding det2_def
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
v \<noteq> vec_zero
v = (v1, v2)
H = (A, B, C, D)
\<lbrakk>(A - k) * (D - k) - B * C \<noteq> 0; (A - k) * v1 + B * v2 = 0; C * v1 + (D - k) * v2 = 0\<rbrakk> \<Longrightarrow> v1 = 0 \<and> v2 = 0

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0

goal (2 subgoals):
 1. eigenval k H \<Longrightarrow> k\<^sup>2 - mat_trace H * k + mat_det H = 0
 2. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
thus ?rhs
[PROOF STATE]
proof (prove)
using this:
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0

goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
H = (A, B, C, D)

goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0
[PROOF STEP]
by (auto simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
k\<^sup>2 - mat_trace H * k + mat_det H = 0

goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
k\<^sup>2 - mat_trace H * k + mat_det H = 0

goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence *: "mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0"
[PROOF STATE]
proof (prove)
using this:
k\<^sup>2 - mat_trace H * k + mat_det H = 0

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
k\<^sup>2 - mat_trace H * k + mat_det H = 0
H = (A, B, C, D)

goal (1 subgoal):
 1. mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
[PROOF STEP]
by (auto simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0

goal (1 subgoal):
 1. k\<^sup>2 - mat_trace H * k + mat_det H = 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
proof (cases "H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero \<Longrightarrow> eigenval k H
 2. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero

goal (2 subgoals):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero \<Longrightarrow> eigenval k H
 2. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) = mat_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
by (auto) (rule_tac x=1 in exI, simp)
[PROOF STATE]
proof (state)
this:
eigenval k H

goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero

goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
hence "(A - k \<noteq> 0 \<or> B \<noteq> 0) \<or> (D - k \<noteq> 0 \<or> C \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero

goal (1 subgoal):
 1. (A - k \<noteq> 0 \<or> B \<noteq> 0) \<or> D - k \<noteq> 0 \<or> C \<noteq> 0
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. (A - k \<noteq> 0 \<or> B \<noteq> 0) \<or> D - k \<noteq> 0 \<or> C \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A - k \<noteq> 0 \<or> B \<noteq> 0) \<or> D - k \<noteq> 0 \<or> C \<noteq> 0

goal (1 subgoal):
 1. H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) \<noteq> mat_zero \<Longrightarrow> eigenval k H
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(A - k \<noteq> 0 \<or> B \<noteq> 0) \<or> D - k \<noteq> 0 \<or> C \<noteq> 0

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A - k \<noteq> 0 \<or> B \<noteq> 0 \<Longrightarrow> eigenval k H
 2. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
assume "A - k \<noteq> 0 \<or> B \<noteq> 0"
[PROOF STATE]
proof (state)
this:
A - k \<noteq> 0 \<or> B \<noteq> 0

goal (2 subgoals):
 1. A - k \<noteq> 0 \<or> B \<noteq> 0 \<Longrightarrow> eigenval k H
 2. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence "C * B + (D - k) * (k - A) = 0"
[PROOF STATE]
proof (prove)
using this:
A - k \<noteq> 0 \<or> B \<noteq> 0

goal (1 subgoal):
 1. C * B + (D - k) * (k - A) = 0
[PROOF STEP]
using * singular_system[of "A-k" "D-k" B C "(0, 0)" 0 0  "(B, k-A)"] HH
[PROOF STATE]
proof (prove)
using this:
A - k \<noteq> 0 \<or> B \<noteq> 0
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
\<lbrakk>det2 (A - k) (D - k) B C = 0; A - k \<noteq> 0 \<or> D - k \<noteq> 0; (A - k) * fst (0, 0) + (D - k) * snd (0, 0) = 0; B * fst (0, 0) + C * snd (0, 0) = 0; (A - k) * fst (B, k - A) + (D - k) * snd (B, k - A) = 0\<rbrakk> \<Longrightarrow> B * fst (B, k - A) + C * snd (B, k - A) = 0
H = (A, B, C, D)

goal (1 subgoal):
 1. C * B + (D - k) * (k - A) = 0
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
C * B + (D - k) * (k - A) = 0

goal (2 subgoals):
 1. A - k \<noteq> 0 \<or> B \<noteq> 0 \<Longrightarrow> eigenval k H
 2. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence  "(B, k-A) \<noteq> vec_zero" "(H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) *\<^sub>m\<^sub>v (B, k-A) = vec_zero"
[PROOF STATE]
proof (prove)
using this:
C * B + (D - k) * (k - A) = 0

goal (1 subgoal):
 1. (B, k - A) \<noteq> vec_zero &&& H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (B, k - A) = vec_zero
[PROOF STEP]
using HH \<open>A - k \<noteq> 0 \<or> B \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
C * B + (D - k) * (k - A) = 0
H = (A, B, C, D)
A - k \<noteq> 0 \<or> B \<noteq> 0

goal (1 subgoal):
 1. (B, k - A) \<noteq> vec_zero &&& H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (B, k - A) = vec_zero
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(B, k - A) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (B, k - A) = vec_zero

goal (2 subgoals):
 1. A - k \<noteq> 0 \<or> B \<noteq> 0 \<Longrightarrow> eigenval k H
 2. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(B, k - A) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (B, k - A) = vec_zero
[PROOF STEP]
obtain v where "v \<noteq> vec_zero \<and> (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) *\<^sub>m\<^sub>v v = vec_zero"
[PROOF STATE]
proof (prove)
using this:
(B, k - A) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (B, k - A) = vec_zero

goal (1 subgoal):
 1. (\<And>v. v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (2 subgoals):
 1. A - k \<noteq> 0 \<or> B \<noteq> 0 \<Longrightarrow> eigenval k H
 2. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
unfolding eigenval_def
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. \<exists>v. v \<noteq> vec_zero \<and> H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v
[PROOF STEP]
by (rule_tac x="v" in exI) (case_tac v, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
eigenval k H

goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
assume "D - k \<noteq> 0 \<or> C \<noteq> 0"
[PROOF STATE]
proof (state)
this:
D - k \<noteq> 0 \<or> C \<noteq> 0

goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence "C * B + (D - k) * (k - A) = 0"
[PROOF STATE]
proof (prove)
using this:
D - k \<noteq> 0 \<or> C \<noteq> 0

goal (1 subgoal):
 1. C * B + (D - k) * (k - A) = 0
[PROOF STEP]
using * singular_system[of "D-k" "A-k" C B "(0, 0)" 0 0  "(C, k-D)"] HH
[PROOF STATE]
proof (prove)
using this:
D - k \<noteq> 0 \<or> C \<noteq> 0
mat_det (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) = 0
\<lbrakk>det2 (D - k) (A - k) C B = 0; D - k \<noteq> 0 \<or> A - k \<noteq> 0; (D - k) * fst (0, 0) + (A - k) * snd (0, 0) = 0; C * fst (0, 0) + B * snd (0, 0) = 0; (D - k) * fst (C, k - D) + (A - k) * snd (C, k - D) = 0\<rbrakk> \<Longrightarrow> C * fst (C, k - D) + B * snd (C, k - D) = 0
H = (A, B, C, D)

goal (1 subgoal):
 1. C * B + (D - k) * (k - A) = 0
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
C * B + (D - k) * (k - A) = 0

goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
hence  "(k-D, C) \<noteq> vec_zero" "(H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) *\<^sub>m\<^sub>v (k-D, C) = vec_zero"
[PROOF STATE]
proof (prove)
using this:
C * B + (D - k) * (k - A) = 0

goal (1 subgoal):
 1. (k - D, C) \<noteq> vec_zero &&& H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (k - D, C) = vec_zero
[PROOF STEP]
using HH \<open>D - k \<noteq> 0 \<or> C \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
C * B + (D - k) * (k - A) = 0
H = (A, B, C, D)
D - k \<noteq> 0 \<or> C \<noteq> 0

goal (1 subgoal):
 1. (k - D, C) \<noteq> vec_zero &&& H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (k - D, C) = vec_zero
[PROOF STEP]
by (auto simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(k - D, C) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (k - D, C) = vec_zero

goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(k - D, C) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (k - D, C) = vec_zero
[PROOF STEP]
obtain v where "v \<noteq> vec_zero \<and> (H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye)) *\<^sub>m\<^sub>v v = vec_zero"
[PROOF STATE]
proof (prove)
using this:
(k - D, C) \<noteq> vec_zero
H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v (k - D, C) = vec_zero

goal (1 subgoal):
 1. (\<And>v. v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (1 subgoal):
 1. D - k \<noteq> 0 \<or> C \<noteq> 0 \<Longrightarrow> eigenval k H
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
using HH
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. eigenval k H
[PROOF STEP]
unfolding eigenval_def
[PROOF STATE]
proof (prove)
using this:
v \<noteq> vec_zero \<and> H -\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m eye) *\<^sub>m\<^sub>v v = vec_zero
H = (A, B, C, D)

goal (1 subgoal):
 1. \<exists>v. v \<noteq> vec_zero \<and> H *\<^sub>m\<^sub>v v = k *\<^sub>s\<^sub>v v
[PROOF STEP]
by (rule_tac x="v" in exI) (case_tac v, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
eigenval k H

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
eigenval k H

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
eigenval k H

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
eigenval k H = (k\<^sup>2 - mat_trace H * k + mat_det H = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_incident_sedges_neighborhood: "card (incident_edges v) = card (neighborhood v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (incident_edges v) = card (neighborhood v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (incident_edges v) = card (neighborhood v)
[PROOF STEP]
have "bij_betw (\<lambda> u . {v, u}) (neighborhood v) (incident_edges v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>u. {v, u}) (neighborhood v) (incident_edges v)
[PROOF STEP]
by(intro bij_betw_imageI inj_onI, simp_all add:incident_edges_neighbors_img)(metis doubleton_eq_iff)
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>u. {v, u}) (neighborhood v) (incident_edges v)

goal (1 subgoal):
 1. card (incident_edges v) = card (neighborhood v)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw (\<lambda>u. {v, u}) (neighborhood v) (incident_edges v)

goal (1 subgoal):
 1. card (incident_edges v) = card (neighborhood v)
[PROOF STEP]
by (metis bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card (incident_edges v) = card (neighborhood v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ord0_Lim_le:
"\<forall>n. f n \<le> g n \<Longrightarrow> ord0_Lim f \<le> ord0_Lim g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f n \<le> g n \<Longrightarrow> ord0_Lim f \<le> ord0_Lim g
[PROOF STEP]
apply (rule ord0_leI[rule_format])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>\<forall>n. f n \<le> g n; a < ord0_Lim f\<rbrakk> \<Longrightarrow> a < ord0_Lim g
[PROOF STEP]
apply (drule less_ord0_LimD, clarify)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. \<lbrakk>\<forall>n. f n \<le> g n; a \<le> f n\<rbrakk> \<Longrightarrow> a < ord0_Lim g
[PROOF STEP]
apply (erule ord0_le_less_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. \<forall>n. f n \<le> g n \<Longrightarrow> f n < ord0_Lim g
[PROOF STEP]
apply (drule_tac x=n in spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. f n \<le> g n \<Longrightarrow> f n < ord0_Lim g
[PROOF STEP]
apply (erule ord0_le_less_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. g n < ord0_Lim g
[PROOF STEP]
apply (rule less_ord0_LimI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma openin_subtopology_Int_subset:
   "\<lbrakk>openin (top_of_set u) (u \<inter> S); v \<subseteq> u\<rbrakk> \<Longrightarrow> openin (top_of_set v) (v \<inter> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin (top_of_set u) (u \<inter> S); v \<subseteq> u\<rbrakk> \<Longrightarrow> openin (top_of_set v) (v \<inter> S)
[PROOF STEP]
by (auto simp: openin_subtopology)