[STATEMENT]
lemma (in cpx_sq_mat) weighted_sum_rank_1_proj_unitary_index:
  assumes "A \<in> fc_mats"
and "B \<in> fc_mats"
and "diagonal_mat B"
and "Complex_Matrix.unitary A"
and "j < dimR"
and "k < dimR"
shows "(sum_mat (\<lambda>i. (diag_mat B)!i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..< dimR}) $$ (j,k) =
  (A * B * (Complex_Matrix.adjoint A)) $$ (j,k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "(sum_mat (\<lambda>i. (diag_mat B)!i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..< dimR}) $$ (j,k) =
    (\<Sum> i\<in> {..< dimR}. ((diag_mat B)!i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j,k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k))
[PROOF STEP]
proof (rule sum_mat_index, (auto simp add: fc_mats_carrier assms))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dimR \<Longrightarrow> diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i) \<in> carrier_mat dimR dimC
 2. k < dimC
[PROOF STEP]
show "\<And>i. i < dimR \<Longrightarrow> (diag_mat B)!i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i) \<in> carrier_mat dimR dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < dimR \<Longrightarrow> diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i) \<in> carrier_mat dimR dimC
[PROOF STEP]
using rank_1_proj_carrier assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
rank_1_proj ?v \<in> carrier_mat (dim_vec ?v) (dim_vec ?v)
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. \<And>i. i < dimR \<Longrightarrow> diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i) \<in> carrier_mat dimR dimC
[PROOF STEP]
by (metis smult_carrier_mat zero_col_col zero_col_dim)
[PROOF STATE]
proof (state)
this:
?i2 < dimR \<Longrightarrow> diag_mat B ! ?i2 \<cdot>\<^sub>m rank_1_proj (Matrix.col A ?i2) \<in> carrier_mat dimR dimC

goal (1 subgoal):
 1. k < dimC
[PROOF STEP]
show "k < dimC"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < dimC
[PROOF STEP]
using assms dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
dimR = dimC

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k))

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k))

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "... = (\<Sum> i\<in> {..< dimR}. (diag_mat B)!i* A $$ (j, i) * conjugate (A $$ (k,i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k)) = (\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i)))
[PROOF STEP]
proof (rule sum.cong, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
have idx: "\<And>x. x \<in> {..<dimR} \<Longrightarrow> (rank_1_proj (Matrix.col A x)) $$ (j, k) =
      A $$ (j, x) * conjugate (A $$ (k, x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> rank_1_proj (Matrix.col A x) $$ (j, k) = A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
using rank_1_proj_mat_col assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n ?n; ?i < ?n; ?j < ?n; ?k < ?n\<rbrakk> \<Longrightarrow> rank_1_proj (Matrix.col ?A ?i) $$ (?j, ?k) = ?A $$ (?j, ?i) * conjugate (?A $$ (?k, ?i))
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> rank_1_proj (Matrix.col A x) $$ (j, k) = A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x2 \<in> {..<dimR} \<Longrightarrow> rank_1_proj (Matrix.col A ?x2) $$ (j, k) = A $$ (j, ?x2) * conjugate (A $$ (k, ?x2))

goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
show "\<And>x. x \<in> {..<dimR} \<Longrightarrow> ((diag_mat B)!x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) =
      (diag_mat B)!x * A $$ (j, x) * conjugate (A $$ (k, x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
assume "x\<in> {..< dimR}"
[PROOF STATE]
proof (state)
this:
x \<in> {..<dimR}

goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
have "((diag_mat B)!x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) =
        (diag_mat B)!x * (rank_1_proj (Matrix.col A x)) $$ (j, k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * rank_1_proj (Matrix.col A x) $$ (j, k)
[PROOF STEP]
proof (rule index_smult_mat)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j < dim_row (rank_1_proj (Matrix.col A x))
 2. k < dim_col (rank_1_proj (Matrix.col A x))
[PROOF STEP]
show "j < dim_row (rank_1_proj (Matrix.col A x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_row (rank_1_proj (Matrix.col A x))
[PROOF STEP]
using \<open>x\<in> {..< dimR}\<close> assms fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
x \<in> {..<dimR}
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. j < dim_row (rank_1_proj (Matrix.col A x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j < dim_row (rank_1_proj (Matrix.col A x))

goal (1 subgoal):
 1. k < dim_col (rank_1_proj (Matrix.col A x))
[PROOF STEP]
show "k < dim_col (rank_1_proj (Matrix.col A x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < dim_col (rank_1_proj (Matrix.col A x))
[PROOF STEP]
using \<open>x\<in> {..< dimR}\<close> assms fc_mats_carrier
            rank_1_proj_carrier[of "Matrix.col A x"]
[PROOF STATE]
proof (prove)
using this:
x \<in> {..<dimR}
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
rank_1_proj (Matrix.col A x) \<in> carrier_mat (dim_vec (Matrix.col A x)) (dim_vec (Matrix.col A x))

goal (1 subgoal):
 1. k < dim_col (rank_1_proj (Matrix.col A x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k < dim_col (rank_1_proj (Matrix.col A x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * rank_1_proj (Matrix.col A x) $$ (j, k)

goal (1 subgoal):
 1. \<And>x. x \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
thus "((diag_mat B)!x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) =
        (diag_mat B)!x * A $$ (j, x) * conjugate (A $$ (k, x))"
[PROOF STATE]
proof (prove)
using this:
(diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * rank_1_proj (Matrix.col A x) $$ (j, k)

goal (1 subgoal):
 1. (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
using idx \<open>x\<in> {..< dimR}\<close>
[PROOF STATE]
proof (prove)
using this:
(diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * rank_1_proj (Matrix.col A x) $$ (j, k)
?x2 \<in> {..<dimR} \<Longrightarrow> rank_1_proj (Matrix.col A ?x2) $$ (j, k) = A $$ (j, ?x2) * conjugate (A $$ (k, ?x2))
x \<in> {..<dimR}

goal (1 subgoal):
 1. (diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(diag_mat B ! x \<cdot>\<^sub>m rank_1_proj (Matrix.col A x)) $$ (j, k) = diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x2 \<in> {..<dimR} \<Longrightarrow> (diag_mat B ! ?x2 \<cdot>\<^sub>m rank_1_proj (Matrix.col A ?x2)) $$ (j, k) = diag_mat B ! ?x2 * A $$ (j, ?x2) * conjugate (A $$ (k, ?x2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k)) = (\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i)))

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<dimR. (diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) $$ (j, k)) = (\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i)))

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "... = Matrix.scalar_prod (Matrix.col (Complex_Matrix.adjoint A) k) (Matrix.row (A*B) j) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i))) = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j
[PROOF STEP]
unfolding Matrix.scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i))) = (\<Sum>i = 0..<dim_vec (Matrix.row (A * B) j). Matrix.col (Complex_Matrix.adjoint A) k $ i * Matrix.row (A * B) j $ i)
[PROOF STEP]
proof (rule sum.cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {..<dimR} = {0..<dim_vec (Matrix.row (A * B) j)}
 2. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
show "{..<dimR} = {0..<dim_vec (Matrix.row (A*B) j)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<dimR} = {0..<dim_vec (Matrix.row (A * B) j)}
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. {..<dimR} = {0..<dim_vec (Matrix.row (A * B) j)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<dimR} = {0..<dim_vec (Matrix.row (A * B) j)}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
show "\<And>x. x \<in> {0..<dim_vec (Matrix.row (A*B) j)} \<Longrightarrow>
      diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) =
      Matrix.vec_index ((Matrix.col (Complex_Matrix.adjoint A) k)) x *
      Matrix.vec_index (Matrix.row (A*B) j) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
assume "x\<in> {0..<dim_vec (Matrix.row (A*B) j)}"
[PROOF STATE]
proof (state)
this:
x \<in> {0..<dim_vec (Matrix.row (A * B) j)}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
hence "x\<in> {0..<dimR}"
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<dim_vec (Matrix.row (A * B) j)}

goal (1 subgoal):
 1. x \<in> {0..<dimR}
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<dim_vec (Matrix.row (A * B) j)}
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. x \<in> {0..<dimR}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {0..<dimR}

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
have "diag_mat B ! x *A $$ (j, x) = Matrix.vec_index (Matrix.row (A*B) j) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat B ! x * A $$ (j, x) = Matrix.row (A * B) j $ x
[PROOF STEP]
proof (rule times_diag_index[symmetric, of _ dimR], (auto simp add: assms))
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A \<in> carrier_mat dimR dimR
 2. B \<in> carrier_mat dimR dimR
 3. x < dimR
[PROOF STEP]
show "A \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. A \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat dimR dimR

goal (2 subgoals):
 1. B \<in> carrier_mat dimR dimR
 2. x < dimR
[PROOF STEP]
show "B \<in> carrier_mat dimR dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat dimR dimR
[PROOF STEP]
using assms fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. B \<in> carrier_mat dimR dimR
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B \<in> carrier_mat dimR dimR

goal (1 subgoal):
 1. x < dimR
[PROOF STEP]
show "x < dimR"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < dimR
[PROOF STEP]
using \<open>x\<in>{0..< dimR}\<close>
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<dimR}

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
diag_mat B ! x * A $$ (j, x) = Matrix.row (A * B) j $ x

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
diag_mat B ! x * A $$ (j, x) = Matrix.row (A * B) j $ x

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
have "conjugate (A $$ (k, x)) =
        Matrix.vec_index ((Matrix.col (Complex_Matrix.adjoint A) k)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x
[PROOF STEP]
using \<open>x\<in> {0..<dimR}\<close> assms
        fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
x \<in> {0..<dimR}
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x
[PROOF STEP]
by (simp add: adjoint_col)
[PROOF STATE]
proof (state)
this:
conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x

goal (1 subgoal):
 1. \<And>x. x \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
diag_mat B ! x * A $$ (j, x) = Matrix.row (A * B) j $ x
conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x
[PROOF STEP]
show "diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) =
        Matrix.vec_index ((Matrix.col (Complex_Matrix.adjoint A) k)) x *
        Matrix.vec_index (Matrix.row (A*B) j) x"
[PROOF STATE]
proof (prove)
using this:
diag_mat B ! x * A $$ (j, x) = Matrix.row (A * B) j $ x
conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x

goal (1 subgoal):
 1. diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_mat B ! x * A $$ (j, x) * conjugate (A $$ (k, x)) = Matrix.col (Complex_Matrix.adjoint A) k $ x * Matrix.row (A * B) j $ x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x2 \<in> {0..<dim_vec (Matrix.row (A * B) j)} \<Longrightarrow> diag_mat B ! ?x2 * A $$ (j, ?x2) * conjugate (A $$ (k, ?x2)) = Matrix.col (Complex_Matrix.adjoint A) k $ ?x2 * Matrix.row (A * B) j $ ?x2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i))) = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<dimR. diag_mat B ! i * A $$ (j, i) * conjugate (A $$ (k, i))) = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "... = (A*B * (Complex_Matrix.adjoint A)) $$ (j,k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "Matrix.mat (dim_row (A*B)) (dim_col (Complex_Matrix.adjoint A))
     (\<lambda>(i, j). Matrix.scalar_prod (Matrix.row (A*B) i) (Matrix.col (Complex_Matrix.adjoint A) j)) $$
    (j, k) =  Matrix.scalar_prod (Matrix.row (A*B) j) (Matrix.col (Complex_Matrix.adjoint A) k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row (A * B)) (dim_col (Complex_Matrix.adjoint A)) (\<lambda>(i, j). Matrix.row (A * B) i \<bullet> Matrix.col (Complex_Matrix.adjoint A) j) $$ (j, k) = Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k
[PROOF STEP]
using assms fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. Matrix.mat (dim_row (A * B)) (dim_col (Complex_Matrix.adjoint A)) (\<lambda>(i, j). Matrix.row (A * B) i \<bullet> Matrix.col (Complex_Matrix.adjoint A) j) $$ (j, k) = Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.mat (dim_row (A * B)) (dim_col (Complex_Matrix.adjoint A)) (\<lambda>(i, j). Matrix.row (A * B) i \<bullet> Matrix.col (Complex_Matrix.adjoint A) j) $$ (j, k) = Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.mat (dim_row (A * B)) (dim_col (Complex_Matrix.adjoint A)) (\<lambda>(i, j). Matrix.row (A * B) i \<bullet> Matrix.col (Complex_Matrix.adjoint A) j) $$ (j, k) = Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
have "... = Matrix.scalar_prod (Matrix.col (Complex_Matrix.adjoint A) k) (Matrix.row (A*B) j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j
[PROOF STEP]
using assms comm_scalar_prod[of "Matrix.row (A*B) j" dimR] fc_mats_carrier dim_eq
[PROOF STATE]
proof (prove)
using this:
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
\<lbrakk>Matrix.row (A * B) j \<in> carrier_vec dimR; ?v\<^sub>2 \<in> carrier_vec dimR\<rbrakk> \<Longrightarrow> Matrix.row (A * B) j \<bullet> ?v\<^sub>2 = ?v\<^sub>2 \<bullet> Matrix.row (A * B) j
fc_mats = carrier_mat dimR dimC
dimR = dimC

goal (1 subgoal):
 1. Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j
[PROOF STEP]
by (metis adjoint_dim Matrix.col_carrier_vec row_carrier_vec cpx_sq_mat_mult)
[PROOF STATE]
proof (state)
this:
Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
using assms fc_mats_carrier
[PROOF STATE]
proof (prove)
using this:
Matrix.row (A * B) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
unfolding times_mat_def
[PROOF STATE]
proof (prove)
using this:
Matrix.row (Matrix.mat (dim_row A) (dim_col B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col B j)) j \<bullet> Matrix.col (Complex_Matrix.adjoint A) k = Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (Matrix.mat (dim_row A) (dim_col B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col B j)) j
A \<in> fc_mats
B \<in> fc_mats
diagonal_mat B
Complex_Matrix.unitary A
j < dimR
k < dimR
fc_mats = carrier_mat dimR dimC

goal (1 subgoal):
 1. Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (Matrix.mat (dim_row A) (dim_col B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col B j)) j = Matrix.mat (dim_row (Matrix.mat (dim_row A) (dim_col B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col B j))) (dim_col (Complex_Matrix.adjoint A)) (\<lambda>(i, j). Matrix.row (Matrix.mat (dim_row A) (dim_col B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col B j)) i \<bullet> Matrix.col (Complex_Matrix.adjoint A) j) $$ (j, k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Matrix.col (Complex_Matrix.adjoint A) k \<bullet> Matrix.row (A * B) j = (A * B * Complex_Matrix.adjoint A) $$ (j, k)

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)

goal (1 subgoal):
 1. local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
local.sum_mat (\<lambda>i. diag_mat B ! i \<cdot>\<^sub>m rank_1_proj (Matrix.col A i)) {..<dimR} $$ (j, k) = (A * B * Complex_Matrix.adjoint A) $$ (j, k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_slice2_nth_length_eq2: "
  \<lbrakk> length xs mod k > 0; m = length xs div k \<rbrakk> \<Longrightarrow>
  length (list_slice2 xs k ! m) = length xs mod k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < length xs mod k; m = length xs div k\<rbrakk> \<Longrightarrow> length (list_slice2 xs k ! m) = length xs mod k
[PROOF STEP]
by (simp add: list_slice2_def list_slice_length nth_append minus_div_mult_eq_mod [symmetric])


[STATEMENT]
lemma changes_sign:
  fixes p:: "real Polynomial.poly"
  shows "\<forall>x::real. \<forall> y::real. ((sign p x \<noteq> sign p y  \<and> x < y) \<longrightarrow> (\<exists>c \<in> (root_list p). x \<le> c \<and> c \<le> y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. sign p x \<noteq> sign p y \<and> x < y \<longrightarrow> (\<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y)
[PROOF STEP]
proof clarsimp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>sign p x \<noteq> sign p y; x < y\<rbrakk> \<Longrightarrow> \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>sign p x \<noteq> sign p y; x < y\<rbrakk> \<Longrightarrow> \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
assume "sign p x \<noteq> sign p y"
[PROOF STATE]
proof (state)
this:
sign p x \<noteq> sign p y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>sign p x \<noteq> sign p y; x < y\<rbrakk> \<Longrightarrow> \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
assume "x < y"
[PROOF STATE]
proof (state)
this:
x < y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>sign p x \<noteq> sign p y; x < y\<rbrakk> \<Longrightarrow> \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x < y
[PROOF STEP]
show "\<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y"
[PROOF STATE]
proof (prove)
using this:
x < y

goal (1 subgoal):
 1. \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
using poly_IVT_pos[of x y p] poly_IVT_neg[of x y p]
[PROOF STATE]
proof (prove)
using this:
x < y
\<lbrakk>x < y; poly p x < 0; 0 < poly p y\<rbrakk> \<Longrightarrow> \<exists>xa>x. xa < y \<and> poly p xa = 0
\<lbrakk>x < y; 0 < poly p x; poly p y < 0\<rbrakk> \<Longrightarrow> \<exists>xa>x. xa < y \<and> poly p xa = 0

goal (1 subgoal):
 1. \<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y
[PROOF STEP]
by (metis (mono_tags) \<open>sign p x \<noteq> sign p y\<close> less_eq_real_def linorder_neqE_linordered_idom mem_Collect_eq root_list_def sign_def)
[PROOF STATE]
proof (state)
this:
\<exists>c\<in>root_list p. x \<le> c \<and> c \<le> y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [pred_set_conv]:
  "((\<lambda>x x' y y'. ((x, x'), (y, y')) \<in> R) <= (\<lambda>x x' y y'. ((x, x'), (y, y')) \<in> S)) = (R <= S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x x' y y'. ((x, x'), y, y') \<in> R) \<le> (\<lambda>x x' y y'. ((x, x'), y, y') \<in> S)) = (R \<subseteq> S)
[PROOF STEP]
unfolding subset_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x x' y y'. ((x, x'), y, y') \<in> R) \<le> (\<lambda>x x' y y'. ((x, x'), y, y') \<in> S)) = (\<forall>x\<in>R. x \<in> S)
[PROOF STEP]
by (auto simp add: le_fun_def)


[STATEMENT]
lemma card2: assumes "finite X" and "finite Y" and "X \<inter> Y = {}" and x: "X \<union> Y \<subseteq> {0..<m}"
  shows "card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
let ?S = "{0..<m}-(X \<union> Y)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
X \<union> Y \<subseteq> {0..<m}
[PROOF STEP]
have a: "?S \<union> X \<union> Y = {0..<m}"
[PROOF STATE]
proof (prove)
using this:
X \<union> Y \<subseteq> {0..<m}

goal (1 subgoal):
 1. {0..<m} - (X \<union> Y) \<union> X \<union> Y = {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<m} - (X \<union> Y) \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have b: "?S \<inter> (X \<union> Y) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({0..<m} - (X \<union> Y)) \<inter> (X \<union> Y) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
({0..<m} - (X \<union> Y)) \<inter> (X \<union> Y) = {}

goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
apply(rule card1[where ?S="?S"])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. finite ({0..<m} - (X \<union> Y))
 2. finite X
 3. finite Y
 4. X \<inter> Y = {}
 5. ({0..<m} - (X \<union> Y)) \<inter> (X \<union> Y) = {}
 6. {0..<m} - (X \<union> Y) \<union> X \<union> Y = {0..<m}
[PROOF STEP]
by(simp_all add: assms a b)
[PROOF STATE]
proof (state)
this:
card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in deutsch) deutsch_algo_is_correct:
  shows "deutsch_algo_eval = 0 \<longrightarrow> is_const" and "deutsch_algo_eval = 1 \<longrightarrow> is_balanced"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deutsch_algo_eval = 0 \<longrightarrow> is_const &&& deutsch_algo_eval = 1 \<longrightarrow> is_balanced
[PROOF STEP]
using deutsch_algo_eval_is_sum_mod_2 sum_mod_2_cases
[PROOF STATE]
proof (prove)
using this:
deutsch_algo_eval = real ((f 0 + f 1) mod 2)
(f 0 + f 1) mod 2 = 0 \<longrightarrow> is_const
(f 0 + f 1) mod 2 = 1 \<longrightarrow> is_balanced

goal (1 subgoal):
 1. deutsch_algo_eval = 0 \<longrightarrow> is_const &&& deutsch_algo_eval = 1 \<longrightarrow> is_balanced
[PROOF STEP]
by auto


[STATEMENT]
lemma finiteUniqAndConsistentTrailsWithGivenVariableSuperset:
  fixes V :: "Variable set"
  assumes "finite V"
  shows "finite {(M::LiteralTrail). vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}" (is "finite (?trails V)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
have "{M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} =
    (\<Union> v \<in> Pow V.{M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} = (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} = (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})

goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} = (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})

goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
have "finite (\<Union> v \<in> Pow V.{M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})
[PROOF STEP]
proof (rule finite_UN_I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (Pow V)
 2. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
from \<open>finite V\<close>
[PROOF STATE]
proof (chain)
picking this:
finite V
[PROOF STEP]
show "finite (Pow V)"
[PROOF STATE]
proof (prove)
using this:
finite V

goal (1 subgoal):
 1. finite (Pow V)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (Pow V)

goal (1 subgoal):
 1. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
assume "v \<in> Pow V"
[PROOF STATE]
proof (state)
this:
v \<in> Pow V

goal (1 subgoal):
 1. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
with \<open>finite V\<close>
[PROOF STATE]
proof (chain)
picking this:
finite V
v \<in> Pow V
[PROOF STEP]
have "finite v"
[PROOF STATE]
proof (prove)
using this:
finite V
v \<in> Pow V

goal (1 subgoal):
 1. finite v
[PROOF STEP]
by (auto simp add: finite_subset)
[PROOF STATE]
proof (state)
this:
finite v

goal (1 subgoal):
 1. \<And>v. v \<in> Pow V \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
thus "finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}"
[PROOF STATE]
proof (prove)
using this:
finite v

goal (1 subgoal):
 1. finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
using finiteUniqAndConsistentTrailsWithGivenVariableSet[of "v"]
[PROOF STATE]
proof (prove)
using this:
finite v
finite v \<Longrightarrow> finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}

goal (1 subgoal):
 1. finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})

goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
{M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} = (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})
finite (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)} = (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})
finite (\<Union>v\<in>Pow V. {M. vars (elements M) = v \<and> uniq (elements M) \<and> consistent (elements M)})

goal (1 subgoal):
 1. finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {M. vars (elements M) \<subseteq> V \<and> uniq (elements M) \<and> consistent (elements M)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma test_inf:
  "test x \<Longrightarrow> test y \<Longrightarrow> test z \<Longrightarrow> z \<le> x \<sqinter> y \<longleftrightarrow> z \<le> x \<and> z \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test x; test y; test z\<rbrakk> \<Longrightarrow> (z \<le> x \<sqinter> y) = (z \<le> x \<and> z \<le> y)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>test x; test y; test z; z \<le> x \<sqinter> y\<rbrakk> \<Longrightarrow> z \<le> x \<and> z \<le> y
 2. \<lbrakk>test x; test y; test z; z \<le> x \<and> z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x \<sqinter> y
[PROOF STEP]
using dual_order.trans test_inf_left_below test_inf_right_below
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?b \<le> ?a; ?c \<le> ?b\<rbrakk> \<Longrightarrow> ?c \<le> ?a
test ?x \<Longrightarrow> ?x \<sqinter> ?y \<le> ?y
test ?x \<Longrightarrow> ?y \<sqinter> ?x \<le> ?y

goal (2 subgoals):
 1. \<lbrakk>test x; test y; test z; z \<le> x \<sqinter> y\<rbrakk> \<Longrightarrow> z \<le> x \<and> z \<le> y
 2. \<lbrakk>test x; test y; test z; z \<le> x \<and> z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x \<sqinter> y
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>test x; test y; test z; z \<le> x \<and> z \<le> y\<rbrakk> \<Longrightarrow> z \<le> x \<sqinter> y
[PROOF STEP]
by (smt il_less_eq il_sub_inf_right_isotone test_absorb_4)


[STATEMENT]
lemma prod_list_le_mono: fixes us :: "'a :: {linordered_nonzero_semiring,ordered_ring} list"
  assumes "length us = length vs"
  and "\<And> i. i < length vs \<Longrightarrow> 0 \<le> us ! i \<and> us ! i \<le> vs ! i"
shows "0 \<le> prod_list us \<and> prod_list us \<le> prod_list vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length us = length vs
?i < length vs \<Longrightarrow> (0::'a) \<le> us ! ?i \<and> us ! ?i \<le> vs ! ?i

goal (1 subgoal):
 1. (0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
[PROOF STEP]
proof (induction us vs rule: list_induct2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length ys \<Longrightarrow> (0::'a) \<le> xs ! i \<and> xs ! i \<le> ys ! i) \<Longrightarrow> (0::'a) \<le> prod_list xs \<and> prod_list xs \<le> prod_list ys; \<And>i. i < length (y # ys) \<Longrightarrow> (0::'a) \<le> (x # xs) ! i \<and> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> (0::'a) \<le> prod_list (x # xs) \<and> prod_list (x # xs) \<le> prod_list (y # ys)
[PROOF STEP]
case (Cons u us v vs)
[PROOF STATE]
proof (state)
this:
length us = length vs
(\<And>i. i < length vs \<Longrightarrow> (0::'a) \<le> us ! i \<and> us ! i \<le> vs ! i) \<Longrightarrow> (0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
?i < length (v # vs) \<Longrightarrow> (0::'a) \<le> (u # us) ! ?i \<and> (u # us) ! ?i \<le> (v # vs) ! ?i

goal (2 subgoals):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length ys \<Longrightarrow> (0::'a) \<le> xs ! i \<and> xs ! i \<le> ys ! i) \<Longrightarrow> (0::'a) \<le> prod_list xs \<and> prod_list xs \<le> prod_list ys; \<And>i. i < length (y # ys) \<Longrightarrow> (0::'a) \<le> (x # xs) ! i \<and> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> (0::'a) \<le> prod_list (x # xs) \<and> prod_list (x # xs) \<le> prod_list (y # ys)
[PROOF STEP]
have "0 \<le> prod_list us \<and> prod_list us \<le> prod_list vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
[PROOF STEP]
by (rule Cons.IH, insert Cons.prems[of "Suc i" for i], auto)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs

goal (2 subgoals):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length ys \<Longrightarrow> (0::'a) \<le> xs ! i \<and> xs ! i \<le> ys ! i) \<Longrightarrow> (0::'a) \<le> prod_list xs \<and> prod_list xs \<le> prod_list ys; \<And>i. i < length (y # ys) \<Longrightarrow> (0::'a) \<le> (x # xs) ! i \<and> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> (0::'a) \<le> prod_list (x # xs) \<and> prod_list (x # xs) \<le> prod_list (y # ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs

goal (2 subgoals):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length ys \<Longrightarrow> (0::'a) \<le> xs ! i \<and> xs ! i \<le> ys ! i) \<Longrightarrow> (0::'a) \<le> prod_list xs \<and> prod_list xs \<le> prod_list ys; \<And>i. i < length (y # ys) \<Longrightarrow> (0::'a) \<le> (x # xs) ! i \<and> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> (0::'a) \<le> prod_list (x # xs) \<and> prod_list (x # xs) \<le> prod_list (y # ys)
[PROOF STEP]
have "0 \<le> u \<and> u \<le> v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> u \<and> u \<le> v
[PROOF STEP]
using Cons.prems[of 0]
[PROOF STATE]
proof (prove)
using this:
0 < length (v # vs) \<Longrightarrow> (0::'a) \<le> (u # us) ! 0 \<and> (u # us) ! 0 \<le> (v # vs) ! 0

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

goal (2 subgoals):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
 2. \<And>x xs y ys. \<lbrakk>length xs = length ys; (\<And>i. i < length ys \<Longrightarrow> (0::'a) \<le> xs ! i \<and> xs ! i \<le> ys ! i) \<Longrightarrow> (0::'a) \<le> prod_list xs \<and> prod_list xs \<le> prod_list ys; \<And>i. i < length (y # ys) \<Longrightarrow> (0::'a) \<le> (x # xs) ! i \<and> (x # xs) ! i \<le> (y # ys) ! i\<rbrakk> \<Longrightarrow> (0::'a) \<le> prod_list (x # xs) \<and> prod_list (x # xs) \<le> prod_list (y # ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
(0::'a) \<le> u \<and> u \<le> v
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> prod_list us \<and> prod_list us \<le> prod_list vs
(0::'a) \<le> u \<and> u \<le> v

goal (1 subgoal):
 1. (0::'a) \<le> prod_list (u # us) \<and> prod_list (u # us) \<le> prod_list (v # vs)
[PROOF STEP]
by (auto intro: mult_mono)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> prod_list (u # us) \<and> prod_list (u # us) \<le> prod_list (v # vs)

goal (1 subgoal):
 1. (\<And>i. i < length [] \<Longrightarrow> (0::'a) \<le> [] ! i \<and> [] ! i \<le> [] ! i) \<Longrightarrow> (0::'a) \<le> prod_list [] \<and> prod_list [] \<le> prod_list []
[PROOF STEP]
qed simp


[STATEMENT]
lemma Amicable_Example_Pythagoras:
  shows "220 Amic 284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have a: "(2::nat)>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < 2

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have b: "prime((3::nat)*(2^(2-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2 ^ (2 - 1) - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime (3 * 2 ^ (2 - 1) - 1)

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have c: "prime((3::nat)*(2^2)-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (3 * 2\<^sup>2 - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime (3 * 2\<^sup>2 - 1)

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have d: "prime((9::nat)*(2^(2*2-1))-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (9 * 2 ^ (2 * 2 - 1) - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime (9 * 2 ^ (2 * 2 - 1) - 1)

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have e: "((2^2)*(3*(2^(2-1))-1)*(3*(2^2)-1))Amic((2^2)*(9*(2^(2*2-1))-1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2\<^sup>2 * (3 * 2 ^ (2 - 1) - 1) * (3 * 2\<^sup>2 - 1)) Amic (2\<^sup>2 * (9 * 2 ^ (2 * 2 - 1) - 1))
[PROOF STEP]
using Thabit_ibn_Qurra_Rule_Amicable a b c d
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < ?k; prime ?p; prime ?q; prime ?r; ?p = 2 ^ (?k - 1) * 3 - 1; ?q = 2 ^ ?k * 3 - 1; ?r = 2 ^ (2 * ?k - 1) * 9 - 1\<rbrakk> \<Longrightarrow> (2 ^ ?k * ?p * ?q) Amic (2 ^ ?k * ?r)
1 < 2
prime (3 * 2 ^ (2 - 1) - 1)
prime (3 * 2\<^sup>2 - 1)
prime (9 * 2 ^ (2 * 2 - 1) - 1)

goal (1 subgoal):
 1. (2\<^sup>2 * (3 * 2 ^ (2 - 1) - 1) * (3 * 2\<^sup>2 - 1)) Amic (2\<^sup>2 * (9 * 2 ^ (2 * 2 - 1) - 1))
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
(2\<^sup>2 * (3 * 2 ^ (2 - 1) - 1) * (3 * 2\<^sup>2 - 1)) Amic (2\<^sup>2 * (9 * 2 ^ (2 * 2 - 1) - 1))

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have f: "((2::nat)^2)*5*11 = 220"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2\<^sup>2 * 5 * 11 = 220
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2\<^sup>2 * 5 * 11 = 220

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
have g: "((2::nat)^2)*71 = 284"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2\<^sup>2 * 71 = 284
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2\<^sup>2 * 71 = 284

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
using  e f g
[PROOF STATE]
proof (prove)
using this:
(2\<^sup>2 * (3 * 2 ^ (2 - 1) - 1) * (3 * 2\<^sup>2 - 1)) Amic (2\<^sup>2 * (9 * 2 ^ (2 * 2 - 1) - 1))
2\<^sup>2 * 5 * 11 = 220
2\<^sup>2 * 71 = 284

goal (1 subgoal):
 1. 220 Amic 284
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
220 Amic 284

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_on_linord_of_list_subseteq_r:
  assumes "Linear_order r"
  assumes "sorted_on r xs"
  assumes "distinct xs"
  shows "linord_of_list (rev xs) \<subseteq> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Linear_order r
sorted_on r xs
distinct xs

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
proof(induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>Linear_order r; sorted_on r []; distinct []\<rbrakk> \<Longrightarrow> linord_of_list (rev []) \<subseteq> r
 2. \<And>a xs. \<lbrakk>\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r; Linear_order r; sorted_on r (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> linord_of_list (rev (a # xs)) \<subseteq> r
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r
Linear_order r
sorted_on r (x # xs)
distinct (x # xs)

goal (2 subgoals):
 1. \<lbrakk>Linear_order r; sorted_on r []; distinct []\<rbrakk> \<Longrightarrow> linord_of_list (rev []) \<subseteq> r
 2. \<And>a xs. \<lbrakk>\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r; Linear_order r; sorted_on r (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> linord_of_list (rev (a # xs)) \<subseteq> r
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r
Linear_order r
sorted_on r (x # xs)
distinct (x # xs)
[PROOF STEP]
have "linord_of_list (rev xs) \<subseteq> r"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r
Linear_order r
sorted_on r (x # xs)
distinct (x # xs)

goal (1 subgoal):
 1. linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
by (simp add: sorted_on_Cons)
[PROOF STATE]
proof (state)
this:
linord_of_list (rev xs) \<subseteq> r

goal (2 subgoals):
 1. \<lbrakk>Linear_order r; sorted_on r []; distinct []\<rbrakk> \<Longrightarrow> linord_of_list (rev []) \<subseteq> r
 2. \<And>a xs. \<lbrakk>\<lbrakk>Linear_order r; sorted_on r xs; distinct xs\<rbrakk> \<Longrightarrow> linord_of_list (rev xs) \<subseteq> r; Linear_order r; sorted_on r (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> linord_of_list (rev (a # xs)) \<subseteq> r
[PROOF STEP]
with Cons.prems
[PROOF STATE]
proof (chain)
picking this:
Linear_order r
sorted_on r (x # xs)
distinct (x # xs)
linord_of_list (rev xs) \<subseteq> r
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Linear_order r
sorted_on r (x # xs)
distinct (x # xs)
linord_of_list (rev xs) \<subseteq> r

goal (1 subgoal):
 1. linord_of_list (rev (x # xs)) \<subseteq> r
[PROOF STEP]
by (clarsimp simp: linord_of_list_append linord_of_list_singleton sorted_on_Cons)
       (meson contra_subsetD subsetI underS_incl_iff)
[PROOF STATE]
proof (state)
this:
linord_of_list (rev (x # xs)) \<subseteq> r

goal (1 subgoal):
 1. \<lbrakk>Linear_order r; sorted_on r []; distinct []\<rbrakk> \<Longrightarrow> linord_of_list (rev []) \<subseteq> r
[PROOF STEP]
qed simp


[STATEMENT]
lemma cosh_minus_sinh: "cosh x - sinh x = exp (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
have "cosh x - sinh x = (1 / 2) *\<^sub>R (exp (-x) + exp (-x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x - sinh x = (1 / 2) *\<^sub>R (exp (- x) + exp (- x))
[PROOF STEP]
by (simp add: sinh_def cosh_def algebra_simps)
[PROOF STATE]
proof (state)
this:
cosh x - sinh x = (1 / 2) *\<^sub>R (exp (- x) + exp (- x))

goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cosh x - sinh x = (1 / 2) *\<^sub>R (exp (- x) + exp (- x))

goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
have "\<dots> = exp (-x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / 2) *\<^sub>R (exp (- x) + exp (- x)) = exp (- x)
[PROOF STEP]
by (rule scaleR_half_double)
[PROOF STATE]
proof (state)
this:
(1 / 2) *\<^sub>R (exp (- x) + exp (- x)) = exp (- x)

goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cosh x - sinh x = exp (- x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cosh x - sinh x = exp (- x)

goal (1 subgoal):
 1. cosh x - sinh x = exp (- x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cosh x - sinh x = exp (- x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_is_unit_iff [simp]: "(f :: 'a :: field fps) dvd 1 \<longleftrightarrow> f $ 0 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f dvd 1) = (f $ 0 \<noteq> (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f dvd 1 \<Longrightarrow> f $ 0 \<noteq> (0::'a)
 2. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
assume "f dvd 1"
[PROOF STATE]
proof (state)
this:
f dvd 1

goal (2 subgoals):
 1. f dvd 1 \<Longrightarrow> f $ 0 \<noteq> (0::'a)
 2. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f dvd 1
[PROOF STEP]
obtain g where "1 = f * g"
[PROOF STATE]
proof (prove)
using this:
f dvd 1

goal (1 subgoal):
 1. (\<And>g. 1 = f * g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (elim dvdE)
[PROOF STATE]
proof (state)
this:
1 = f * g

goal (2 subgoals):
 1. f dvd 1 \<Longrightarrow> f $ 0 \<noteq> (0::'a)
 2. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
from this[symmetric]
[PROOF STATE]
proof (chain)
picking this:
f * g = 1
[PROOF STEP]
have "(f*g) $ 0 = 1"
[PROOF STATE]
proof (prove)
using this:
f * g = 1

goal (1 subgoal):
 1. (f * g) $ 0 = (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(f * g) $ 0 = (1::'a)

goal (2 subgoals):
 1. f dvd 1 \<Longrightarrow> f $ 0 \<noteq> (0::'a)
 2. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
thus "f $ 0 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
(f * g) $ 0 = (1::'a)

goal (1 subgoal):
 1. f $ 0 \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
assume A: "f $ 0 \<noteq> 0"
[PROOF STATE]
proof (state)
this:
f $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. f $ 0 \<noteq> (0::'a) \<Longrightarrow> f dvd 1
[PROOF STEP]
thus "f dvd 1"
[PROOF STATE]
proof (prove)
using this:
f $ 0 \<noteq> (0::'a)

goal (1 subgoal):
 1. f dvd 1
[PROOF STEP]
by (simp add: inverse_mult_eq_1[OF A, symmetric])
[PROOF STATE]
proof (state)
this:
f dvd 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma minus_of_nat_in_nonpos_Ints [simp, intro]: "- of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "- of_nat n = of_int (-int n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - of_nat n = of_int (- int n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- of_nat n = of_int (- int n)

goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- of_nat n = of_int (- int n)

goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "-int n \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - int n \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- int n \<le> 0

goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
hence "of_int (-int n) \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
using this:
- int n \<le> 0

goal (1 subgoal):
 1. of_int (- int n) \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
unfolding nonpos_Ints_def
[PROOF STATE]
proof (prove)
using this:
- int n \<le> 0

goal (1 subgoal):
 1. of_int (- int n) \<in> {of_int n |n. n \<le> 0}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
of_int (- int n) \<in> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. - of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
- of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcs_fun: "gcs s (t::'a \<Rightarrow> ('b::add_linorder)) = (\<lambda>x. min (s x) (t x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcs s t = (\<lambda>x. min (s x) (t x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcs s t = (\<lambda>x. min (s x) (t x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcs s t = (\<lambda>x. min (s x) (t x))
[PROOF STEP]
unfolding gcs_def lcs_fun_def fun_diff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. (s + t) x - max (s x) (t x)) = (\<lambda>x. min (s x) (t x))
[PROOF STEP]
proof (simp, rule)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. s x + t x - max (s x) (t x) = min (s x) (t x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. s x + t x - max (s x) (t x) = min (s x) (t x)
[PROOF STEP]
have eq: "s x + t x = max (s x) (t x) + min (s x) (t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s x + t x = max (s x) (t x) + min (s x) (t x)
[PROOF STEP]
by (metis add.commute min_def max_def)
[PROOF STATE]
proof (state)
this:
s x + t x = max (s x) (t x) + min (s x) (t x)

goal (1 subgoal):
 1. \<And>x. s x + t x - max (s x) (t x) = min (s x) (t x)
[PROOF STEP]
thus "s x + t x - max (s x) (t x) = min (s x) (t x)"
[PROOF STATE]
proof (prove)
using this:
s x + t x = max (s x) (t x) + min (s x) (t x)

goal (1 subgoal):
 1. s x + t x - max (s x) (t x) = min (s x) (t x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s x + t x - max (s x) (t x) = min (s x) (t x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcs s t = (\<lambda>x. min (s x) (t x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proots_count_pos:
  assumes "proots_count P S > 0"
  shows "\<exists>x \<in> S. poly P x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. poly P x = (0::'a)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. poly P x = (0::'a)) \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (\<exists>x\<in>S. poly P x = 0)"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>x\<in>S. poly P x = (0::'a))

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. poly P x = (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "\<And>x. x \<in> S \<Longrightarrow> poly P x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<exists>x\<in>S. poly P x = (0::'a))

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> poly P x \<noteq> (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> poly P ?x \<noteq> (0::'a)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. poly P x = (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "\<And>x. x \<in> S \<Longrightarrow> order x P = 0"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> poly P ?x \<noteq> (0::'a)

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> order x P = 0
[PROOF STEP]
using order_0I
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> poly P ?x \<noteq> (0::'a)
poly ?p ?a \<noteq> (0::?'a) \<Longrightarrow> order ?a ?p = 0

goal (1 subgoal):
 1. \<And>x. x \<in> S \<Longrightarrow> order x P = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> order ?x P = 0

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. poly P x = (0::'a)) \<Longrightarrow> False
[PROOF STEP]
hence "proots_count P S = 0"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> order ?x P = 0

goal (1 subgoal):
 1. proots_count P S = 0
[PROOF STEP]
by (force simp: proots_count_def)
[PROOF STATE]
proof (state)
this:
proots_count P S = 0

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>S. poly P x = (0::'a)) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
proots_count P S = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
proots_count P S = 0
0 < proots_count P S

goal (1 subgoal):
 1. False
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) set_mult_card_single_el_eq:
  assumes "J \<subseteq> carrier G" "x \<in> carrier G"
  shows "card (l_coset G x J) = card J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (x <# J) = card J
[PROOF STEP]
unfolding l_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
have "card ((\<otimes>) x ` J) = card J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<otimes>) x ` J) = card J
[PROOF STEP]
using inj_on_cmult[of x] card_image[of "(\<otimes>) x" J] assms inj_on_subset[of "(\<otimes>) x" "carrier G" J]
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier G \<Longrightarrow> inj_on ((\<otimes>) x) (carrier G)
inj_on ((\<otimes>) x) J \<Longrightarrow> card ((\<otimes>) x ` J) = card J
J \<subseteq> carrier G
x \<in> carrier G
\<lbrakk>inj_on ((\<otimes>) x) (carrier G); J \<subseteq> carrier G\<rbrakk> \<Longrightarrow> inj_on ((\<otimes>) x) J

goal (1 subgoal):
 1. card ((\<otimes>) x ` J) = card J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card ((\<otimes>) x ` J) = card J

goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card ((\<otimes>) x ` J) = card J

goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
have "(\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J
[PROOF STEP]
using image_def[of "(\<otimes>) x" J]
[PROOF STATE]
proof (prove)
using this:
(\<otimes>) x ` J = {y. \<exists>xa\<in>J. y = x \<otimes> xa}

goal (1 subgoal):
 1. (\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J

goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card ((\<otimes>) x ` J) = card J
(\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J
[PROOF STEP]
show "card (\<Union>h\<in>J. {x \<otimes> h}) = card J"
[PROOF STATE]
proof (prove)
using this:
card ((\<otimes>) x ` J) = card J
(\<Union>y\<in>J. {x \<otimes> y}) = (\<otimes>) x ` J

goal (1 subgoal):
 1. card (\<Union>h\<in>J. {x \<otimes> h}) = card J
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
card (\<Union>h\<in>J. {x \<otimes> h}) = card J

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma canonical_basis_length_ell2[code_unfold, simp]:
  "length (canonical_basis ::'a::enum ell2 list) = CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length canonical_basis = CARD('a)
[PROOF STEP]
unfolding canonical_basis_ell2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map ket enum_class.enum) = CARD('a)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length enum_class.enum = CARD('a)
[PROOF STEP]
using card_UNIV_length_enum
[PROOF STATE]
proof (prove)
using this:
CARD(?'a) = length enum_class.enum

goal (1 subgoal):
 1. length enum_class.enum = CARD('a)
[PROOF STEP]
by metis


[STATEMENT]
lemma prod_list_map_partition:
  assumes "List.partition f xs = (ys, zs)"
  shows "prod_list (map g xs) = prod_list (map g ys) * prod_list (map g zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (map g xs) = prod_list (map g ys) * prod_list (map g zs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
List.partition f xs = (ys, zs)

goal (1 subgoal):
 1. prod_list (map g xs) = prod_list (map g ys) * prod_list (map g zs)
[PROOF STEP]
by (subst prod_list_map_filter[symmetric, of _ f], auto simp: o_def)


[STATEMENT]
lemma invariantsHoldInValidRuns:
  fixes F0 :: Formula and decisionVars :: "Variable set"
  assumes "invariantsHoldInState stateA F0 decisionVars" and
  "(stateA, stateB) \<in> transitionRelation F0 decisionVars"
  shows "invariantsHoldInState stateB F0 decisionVars"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using transitionsPreserveInvariants
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
using rtrancl_induct[of "stateA" "stateB"
  "{(stateA, stateB). transition stateA stateB F0 decisionVars}" "\<lambda> x. invariantsHoldInState x F0 decisionVars"]
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> transitionRelation F0 decisionVars
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars
\<lbrakk>(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; invariantsHoldInState stateA F0 decisionVars; \<And>y z. \<lbrakk>(stateA, y) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; (y, z) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}; invariantsHoldInState y F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState z F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState stateB F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
unfolding transitionRelation_def
[PROOF STATE]
proof (prove)
using this:
invariantsHoldInState stateA F0 decisionVars
(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*
\<lbrakk>transition ?stateA ?stateB ?F0.0 ?decisionVars; invariantsHoldInState ?stateA ?F0.0 ?decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState ?stateB ?F0.0 ?decisionVars
\<lbrakk>(stateA, stateB) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; invariantsHoldInState stateA F0 decisionVars; \<And>y z. \<lbrakk>(stateA, y) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}\<^sup>*; (y, z) \<in> {(stateA, stateB). transition stateA stateB F0 decisionVars}; invariantsHoldInState y F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState z F0 decisionVars\<rbrakk> \<Longrightarrow> invariantsHoldInState stateB F0 decisionVars

goal (1 subgoal):
 1. invariantsHoldInState stateB F0 decisionVars
[PROOF STEP]
by auto


[STATEMENT]
lemma has_integral_subset_le:
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
  assumes "s \<subseteq> t"
    and "(f has_integral i) s"
    and "(f has_integral j) t"
    and "\<forall>x\<in>t. 0 \<le> f x"
  shows "i \<le> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j
[PROOF STEP]
using has_integral_subset_component_le[OF _ assms(1), of 1 f i j]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; (f has_integral i) s; (f has_integral j) t; \<And>x. x \<in> t \<Longrightarrow> 0 \<le> f x \<bullet> 1\<rbrakk> \<Longrightarrow> i \<bullet> 1 \<le> j \<bullet> 1

goal (1 subgoal):
 1. i \<le> j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; (f has_integral i) s; (f has_integral j) t; \<And>x. x \<in> t \<Longrightarrow> 0 \<le> f x \<bullet> 1\<rbrakk> \<Longrightarrow> i \<bullet> 1 \<le> j \<bullet> 1
s \<subseteq> t
(f has_integral i) s
(f has_integral j) t
\<forall>x\<in>t. 0 \<le> f x

goal (1 subgoal):
 1. i \<le> j
[PROOF STEP]
by auto