[STATEMENT]
lemma times_diag_index:
  fixes A::"'a::comm_ring Matrix.mat"
  assumes "A \<in> carrier_mat n n"
and "B\<in> carrier_mat n n"
and "diagonal_mat B"
and "j < n"
and "i < n"
shows "Matrix.vec_index (Matrix.row (A*B) j) i = diag_mat B ! i *A $$ (j, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "Matrix.vec_index (Matrix.row (A*B) j) i = (A*B) $$ (j,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = (A * B) $$ (j, i)
[PROOF STEP]
using Matrix.row_def[of "A*B" ] assms
[PROOF STATE]
proof (prove)
using this:
Matrix.row (A * B) ?i = Matrix.vec (dim_col (A * B)) (\<lambda>j. (A * B) $$ (?i, j))
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = (A * B) $$ (j, i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Matrix.row (A * B) j $ i = (A * B) $$ (j, i)

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.row (A * B) j $ i = (A * B) $$ (j, i)

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = Matrix.scalar_prod (Matrix.row A j) (Matrix.col B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B) $$ (j, i) = Matrix.row A j \<bullet> Matrix.col B i
[PROOF STEP]
using assms
      times_mat_def[of A]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n
A * ?B \<equiv> Matrix.mat (dim_row A) (dim_col ?B) (\<lambda>(i, j). Matrix.row A i \<bullet> Matrix.col ?B j)

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

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(A * B) $$ (j, i) = Matrix.row A j \<bullet> Matrix.col B i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = Matrix.scalar_prod (Matrix.col B i) (Matrix.row A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.row A j \<bullet> Matrix.col B i = Matrix.col B i \<bullet> Matrix.row A j
[PROOF STEP]
using comm_scalar_prod[of "Matrix.row A j" n] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Matrix.row A j \<in> carrier_vec n; ?v\<^sub>2 \<in> carrier_vec n\<rbrakk> \<Longrightarrow> Matrix.row A j \<bullet> ?v\<^sub>2 = ?v\<^sub>2 \<bullet> Matrix.row A j
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. Matrix.row A j \<bullet> Matrix.col B i = Matrix.col B i \<bullet> Matrix.row A j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Matrix.row A j \<bullet> Matrix.col B i = Matrix.col B i \<bullet> Matrix.row A j

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.row A j \<bullet> Matrix.col B i = Matrix.col B i \<bullet> Matrix.row A j

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = (Matrix.vec_index (Matrix.col B i) i) * (Matrix.vec_index  (Matrix.row A j) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.col B i \<bullet> Matrix.row A j = Matrix.col B i $ i * Matrix.row A j $ i
[PROOF STEP]
unfolding Matrix.scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>ia = 0..<dim_vec (Matrix.row A j). Matrix.col B i $ ia * Matrix.row A j $ ia) = Matrix.col B i $ i * Matrix.row A j $ i
[PROOF STEP]
proof (rule sum_but_one)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.col B i $ ia = (0::'a)
 2. i < dim_vec (Matrix.row A j)
[PROOF STEP]
show "i < dim_vec (Matrix.row A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_vec (Matrix.row A j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. i < dim_vec (Matrix.row A j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < dim_vec (Matrix.row A j)

goal (1 subgoal):
 1. \<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.col B i $ ia = (0::'a)
[PROOF STEP]
show "\<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.vec_index (Matrix.col B i) ia = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.col B i $ ia = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. \<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.col B i $ ia = (0::'a)
[PROOF STEP]
by (metis carrier_matD(1) carrier_matD(2) diagonal_mat_def index_col index_row(2))
[PROOF STATE]
proof (state)
this:
\<forall>ia<dim_vec (Matrix.row A j). ia \<noteq> i \<longrightarrow> Matrix.col B i $ ia = (0::'a)

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

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.col B i \<bullet> Matrix.row A j = Matrix.col B i $ i * Matrix.row A j $ i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = B $$(i,i) * (Matrix.vec_index  (Matrix.row A j) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.col B i $ i * Matrix.row A j $ i = B $$ (i, i) * Matrix.row A j $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. Matrix.col B i $ i * Matrix.row A j $ i = B $$ (i, i) * Matrix.row A j $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Matrix.col B i $ i * Matrix.row A j $ i = B $$ (i, i) * Matrix.row A j $ i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Matrix.col B i $ i * Matrix.row A j $ i = B $$ (i, i) * Matrix.row A j $ i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = diag_mat B ! i * (Matrix.vec_index  (Matrix.row A j) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, i) * Matrix.row A j $ i = diag_mat B ! i * Matrix.row A j $ i
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, i) * Matrix.row A j $ i = map (\<lambda>i. B $$ (i, i)) [0..<dim_row B] ! i * Matrix.row A j $ i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

goal (1 subgoal):
 1. B $$ (i, i) * Matrix.row A j $ i = map (\<lambda>i. B $$ (i, i)) [0..<dim_row B] ! i * Matrix.row A j $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B $$ (i, i) * Matrix.row A j $ i = diag_mat B ! i * Matrix.row A j $ i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B $$ (i, i) * Matrix.row A j $ i = diag_mat B ! i * Matrix.row A j $ i

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
have "... = diag_mat B ! i * A $$ (j, i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_mat B ! i * Matrix.row A j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
B \<in> carrier_mat n n
diagonal_mat B
j < n
i < n

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

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)

goal (1 subgoal):
 1. Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Matrix.row (A * B) j $ i = diag_mat B ! i * A $$ (j, i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma commute_diag_mat_zero_comp:
  fixes D::"'a::{field} Matrix.mat"
  assumes "diagonal_mat D"
  and "D\<in> carrier_mat n n"
  and "B\<in> carrier_mat n n"
  and" B* D = D * B"
  and "i < n"
  and "j < n"
  and "D$$(i,i) \<noteq> D$$(j,j)"
shows "B $$(i,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
have "B$$(i,j) * D$$(j,j) = (B*D) $$(i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, j) * D $$ (j, j) = (B * D) $$ (i, j)
[PROOF STEP]
using diagonal_mat_mult_index'[of B n D] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>B \<in> carrier_mat n n; D \<in> carrier_mat n n; diagonal_mat D; ?j < n; ?i < n\<rbrakk> \<Longrightarrow> (B * D) $$ (?i, ?j) = D $$ (?j, ?j) * B $$ (?i, ?j)
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
B * D = D * B
i < n
j < n
D $$ (i, i) \<noteq> D $$ (j, j)

goal (1 subgoal):
 1. B $$ (i, j) * D $$ (j, j) = (B * D) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B $$ (i, j) * D $$ (j, j) = (B * D) $$ (i, j)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
B $$ (i, j) * D $$ (j, j) = (B * D) $$ (i, j)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
have "... = (D*B) $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B * D) $$ (i, j) = (D * B) $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
B * D = D * B
i < n
j < n
D $$ (i, i) \<noteq> D $$ (j, j)

goal (1 subgoal):
 1. (B * D) $$ (i, j) = (D * B) $$ (i, j)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(B * D) $$ (i, j) = (D * B) $$ (i, j)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(B * D) $$ (i, j) = (D * B) $$ (i, j)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
have "... = B$$(i,j) * D$$(i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (D * B) $$ (i, j) = B $$ (i, j) * D $$ (i, i)
[PROOF STEP]
using diagonal_mat_mult_index  assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>diagonal_mat ?A; ?A \<in> carrier_mat ?n ?n; ?B \<in> carrier_mat ?n ?n; ?i < ?n; ?j < ?n\<rbrakk> \<Longrightarrow> (?A * ?B) $$ (?i, ?j) = ?A $$ (?i, ?i) * ?B $$ (?i, ?j)
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
B * D = D * B
i < n
j < n
D $$ (i, i) \<noteq> D $$ (j, j)

goal (1 subgoal):
 1. (D * B) $$ (i, j) = B $$ (i, j) * D $$ (i, i)
[PROOF STEP]
by (metis Groups.mult_ac(2))
[PROOF STATE]
proof (state)
this:
(D * B) $$ (i, j) = B $$ (i, j) * D $$ (i, i)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
B $$ (i, j) * D $$ (j, j) = B $$ (i, j) * D $$ (i, i)
[PROOF STEP]
have "B$$(i,j) * D$$(j,j) = B$$(i,j) * D$$(i,i)"
[PROOF STATE]
proof (prove)
using this:
B $$ (i, j) * D $$ (j, j) = B $$ (i, j) * D $$ (i, i)

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

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
hence "B$$(i,j) * (D$$(j,j) - D$$(i,i)) = 0"
[PROOF STATE]
proof (prove)
using this:
B $$ (i, j) * D $$ (j, j) = B $$ (i, j) * D $$ (i, i)

goal (1 subgoal):
 1. B $$ (i, j) * (D $$ (j, j) - D $$ (i, i)) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B $$ (i, j) * (D $$ (j, j) - D $$ (i, i)) = (0::'a)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
thus "B$$(i,j) = 0"
[PROOF STATE]
proof (prove)
using this:
B $$ (i, j) * (D $$ (j, j) - D $$ (i, i)) = (0::'a)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B $$ (i, j) * (D $$ (j, j) - D $$ (i, i)) = (0::'a)
diagonal_mat D
D \<in> carrier_mat n n
B \<in> carrier_mat n n
B * D = D * B
i < n
j < n
D $$ (i, i) \<noteq> D $$ (j, j)

goal (1 subgoal):
 1. B $$ (i, j) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B $$ (i, j) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unat_ucast:
  "unat (ucast x :: ('a :: len) word) = unat x mod 2 ^ (LENGTH('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
have \<open>2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))

goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))

goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
have \<open>unat (ucast x :: 'a word) = unat x mod nat (2 ^ LENGTH('a))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (ucast x) = unat x mod nat (2 ^ LENGTH('a))
[PROOF STEP]
by transfer (simp flip: nat_mod_distrib take_bit_eq_mod)
[PROOF STATE]
proof (state)
this:
unat (ucast x) = unat x mod nat (2 ^ LENGTH('a))

goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))
unat (ucast x) = unat x mod nat (2 ^ LENGTH('a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 ^ LENGTH('a) = nat (2 ^ LENGTH('a))
unat (ucast x) = unat x mod nat (2 ^ LENGTH('a))

goal (1 subgoal):
 1. unat (ucast x) = unat x mod 2 ^ LENGTH('a)
[PROOF STEP]
by (simp only:)
[PROOF STATE]
proof (state)
this:
unat (ucast x) = unat x mod 2 ^ LENGTH('a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_indets: "finite (indets p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (indets p)
[PROOF STEP]
by (simp only: indets_def, rule finite_UN_I, (rule finite_keys)+)


[STATEMENT]
lemma keys_swap: "keys (swap0 b i m) = swap b i ` keys m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. keys (swap0 b i m) = swap b i ` keys m
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> keys (swap0 b i m) \<Longrightarrow> x \<in> swap b i ` keys m
 2. \<And>x xa. xa \<in> keys m \<Longrightarrow> swap b i xa \<in> keys (swap0 b i m)
[PROOF STEP]
subgoal for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> keys (swap0 b i m) \<Longrightarrow> x \<in> swap b i ` keys m
[PROOF STEP]
unfolding swap0_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> keys (map_fun id (map_fun id (map_fun lookup Abs_poly_mapping)) (\<lambda>b i p x. p (swap b i x)) b i m) \<Longrightarrow> x \<in> swap b i ` keys m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> keys (Abs_poly_mapping (\<lambda>x. lookup m (swap b i x))) \<Longrightarrow> x \<in> swap b i ` keys m
[PROOF STEP]
unfolding keys.abs_eq[OF eq_onp_swap]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {k. lookup m (swap b i k) \<noteq> (0::'a)} \<Longrightarrow> x \<in> swap b i ` keys m
[PROOF STEP]
by (metis (mono_tags, lifting) Reindex.swap_swap image_eqI lookupNotIn mem_Collect_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. xa \<in> keys m \<Longrightarrow> swap b i xa \<in> keys (swap0 b i m)
[PROOF STEP]
subgoal for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> keys m \<Longrightarrow> swap b i y \<in> keys (swap0 b i m)
[PROOF STEP]
unfolding swap0_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> keys m \<Longrightarrow> swap b i y \<in> keys (map_fun id (map_fun id (map_fun lookup Abs_poly_mapping)) (\<lambda>b i p x. p (swap b i x)) b i m)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> keys m \<Longrightarrow> swap b i y \<in> keys (Abs_poly_mapping (\<lambda>x. lookup m (swap b i x)))
[PROOF STEP]
unfolding keys.abs_eq[OF eq_onp_swap]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> keys m \<Longrightarrow> swap b i y \<in> {k. lookup m (swap b i k) \<noteq> (0::'a)}
[PROOF STEP]
by (metis (mono_tags, lifting) Reindex.swap_swap lookup_eq_zero_in_keys_contradict mem_Collect_eq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fSup_subdistl_var:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows  "mono f \<Longrightarrow> (\<Squnion>g \<in> G. f \<circ> g) \<le> f \<circ> \<Squnion>G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> \<Squnion> ((\<circ>) f ` G) \<le> f \<circ> \<Squnion> G
[PROOF STEP]
by (simp add: fun_isol mono_Sup)


[STATEMENT]
lemma rfb_rbb_conjugation: "((fb\<^sub>\<R> R X) \<union> Y = UNIV) = (X \<union> (bb\<^sub>\<R> R Y) = UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fb\<^sub>\<R> R X \<union> Y = UNIV) = (X \<union> bb\<^sub>\<R> R Y = UNIV)
[PROOF STEP]
by (simp add: rfb_def rbb_def ffb_fbb_conjugation)


[STATEMENT]
lemma aasc_seqn:"\<lbrakk>a \<in> A; \<not> (\<exists>m. m\<in>A \<and> (\<forall>x\<in>A. x \<le> m))\<rbrakk> \<Longrightarrow>
                         (aasc_seq A a n) < (aasc_seq A a (Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> aasc_seq A a n < aasc_seq A a (Suc n)
[PROOF STEP]
apply (frule aasc_seq_mem [of "a" "A" "n"], assumption+,
       simp add:aneg_le,
       frule_tac a = "aasc_seq A a n" in forall_spec, assumption+,
       thin_tac "\<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x)", rule someI2_ex, blast, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma i_set_Minus_closed: "
  \<lbrakk> I \<in> i_set; iMin I \<le> k \<rbrakk> \<Longrightarrow> k \<ominus> I \<in> i_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<in> i_set; iMin I \<le> k\<rbrakk> \<Longrightarrow> k \<ominus> I \<in> i_set
[PROOF STEP]
apply (simp add: i_set_i_set_ind_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I \<in> i_set_ind; iMin I \<le> k\<rbrakk> \<Longrightarrow> k \<ominus> I \<in> i_set_ind
[PROOF STEP]
apply (induct rule: i_set_ind.induct)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>n. iMin [n\<dots>] \<le> k \<Longrightarrow> k \<ominus> [n\<dots>] \<in> i_set_ind
 2. \<And>n. iMin [\<dots>n] \<le> k \<Longrightarrow> k \<ominus> [\<dots>n] \<in> i_set_ind
 3. \<And>n d. iMin [n\<dots>,d] \<le> k \<Longrightarrow> k \<ominus> [n\<dots>,d] \<in> i_set_ind
 4. \<And>r m. iMin [ r, mod m ] \<le> k \<Longrightarrow> k \<ominus> [ r, mod m ] \<in> i_set_ind
 5. \<And>r m c. iMin [ r, mod m, c ] \<le> k \<Longrightarrow> k \<ominus> [ r, mod m, c ] \<in> i_set_ind
[PROOF STEP]
apply (fastforce simp: iT_Min iT_sub)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma distrib: "F (image_mset (\<lambda>x. g x \<^bold>* h x) A) = F (image_mset g A) \<^bold>* F (image_mset h A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F {#g x \<^bold>* h x. x \<in># A#} = F (image_mset g A) \<^bold>* F (image_mset h A)
[PROOF STEP]
by (induction A) (auto simp: ac_simps)


[STATEMENT]
lemma prod: "f (prod g A) = (\<Prod>x\<in>A. f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (prod g A) = (\<Prod>x\<in>A. f (g x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (simp_all add: mult)


[STATEMENT]
lemma length_int_lt0: "i < 0 ==> length_int i = Suc (length_nat (nat (- i) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < 0 \<Longrightarrow> length_int i = Suc (length_nat (nat (- i) - 1))
[PROOF STEP]
by (simp add: length_int_def nat_diff_distrib)


[STATEMENT]
lemma InfCard_le_cadd_eq: "\<lbrakk>InfCard \<kappa>; \<mu> \<le> \<kappa>\<rbrakk> \<Longrightarrow> \<kappa> \<oplus> \<mu> = \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>InfCard \<kappa>; \<mu> \<le> \<kappa>\<rbrakk> \<Longrightarrow> \<kappa> \<oplus> \<mu> = \<kappa>
[PROOF STEP]
by (metis InfCard_cdouble_eq InfCard_def antisym cadd_le_mono cadd_le_self)


[STATEMENT]
lemma even_conv_AND:
  \<open>even i \<longleftrightarrow> i AND 1 = 0\<close> for i :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. even i = (i AND 1 = 0)
[PROOF STEP]
by (simp add: and_one_eq mod2_eq_if)


[STATEMENT]
lemma collinear_subset: "\<lbrakk>collinear T; S \<subseteq> T\<rbrakk> \<Longrightarrow> collinear S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>collinear T; S \<subseteq> T\<rbrakk> \<Longrightarrow> collinear S
[PROOF STEP]
by (meson collinear_def subsetCE)


[STATEMENT]
lemma sum_enn2ereal[simp]: "(\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Sum>i\<in>I. enn2ereal (f i)) = enn2ereal (sum f I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i) \<Longrightarrow> (\<Sum>i\<in>I. enn2ereal (f i)) = enn2ereal (sum f I)
[PROOF STEP]
by (induction I rule: infinite_finite_induct) (auto simp: sum_nonneg zero_ennreal.rep_eq plus_ennreal.rep_eq)


[STATEMENT]
lemma  ant_int_na:"\<lbrakk>0 \<le> a; a \<noteq> \<infinity> \<rbrakk> \<Longrightarrow> ant (int (na a)) = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; a \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> ant (int (na a)) = a
[PROOF STEP]
by (frule an_na[of "a"], assumption, simp add:an_def)


[STATEMENT]
lemma neg_iff_div_unit: "(\<exists>a. negation_constant a) \<longleftrightarrow> (\<exists>b. division_unit b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a. negation_constant a) = (\<exists>b. division_unit b)
[PROOF STEP]
unfolding negation_constant_def division_unit_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x) = (\<exists>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x \<Longrightarrow> \<exists>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b
 2. \<And>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> \<exists>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x
[PROOF STEP]
apply (rule_tac x="-a" in exI, auto)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a x. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x \<Longrightarrow> x = inv_resr (- a) x
 2. \<And>a x. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x \<Longrightarrow> x = inv_resl x (- a)
 3. \<And>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> \<exists>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x
[PROOF STEP]
apply (metis local.dn1 local.dn2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a x. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x \<Longrightarrow> x = inv_resl x (- a)
 2. \<And>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> \<exists>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x
[PROOF STEP]
apply (metis local.dn2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> \<exists>a. \<forall>x. -' x = inv_resr x a \<and> - x = inv_resl a x
[PROOF STEP]
apply (rule_tac x="-b" in exI, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b x. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> -' x = inv_resr x (- b)
 2. \<And>b x. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> - x = - (x \<cdot> b)
[PROOF STEP]
apply (metis local.contraposition)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b x. \<forall>x. x = inv_resr b x \<and> x = inv_resl x b \<Longrightarrow> - x = - (x \<cdot> b)
[PROOF STEP]
apply (metis local.dn2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem factorization_unique_aux:
  "\<forall>p\<in>#M. prime p \<Longrightarrow> \<forall>p\<in>#N. prime p \<Longrightarrow> (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i) \<Longrightarrow> M \<subseteq># N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@strong_induct M arbitrary N
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@case "M = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@obtain M' m where "M = M' + {#m#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@have "m dvd (\<Prod>i\<in>#M. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@obtain n where "n \<in># N" "m dvd n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@obtain N' where "N = N' + {#n#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@have "m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@have "(\<Prod>i\<in>#M'. i) dvd (\<Prod>i\<in>#N'. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@apply_induct_hyp M' N'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>#M. prime p; \<forall>p\<in>#N. prime p; (\<Prod>i\<in>#M. i) dvd (\<Prod>i\<in>#N. i)\<rbrakk> \<Longrightarrow> M \<subseteq># N
[PROOF STEP]
@qed


[STATEMENT]
lemma length_Bernstein_coeffs_01: "length (Bernstein_coeffs_01 p P) = p + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (Bernstein_coeffs_01 p P) = p + 1
[PROOF STEP]
by (auto simp: Bernstein_coeffs_01_def)


[STATEMENT]
lemma planeN4: "inv g \<Longrightarrow> f \<in> \<F> g \<Longrightarrow> 3 \<le> |vertices f|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Invariants.inv g; f \<in> \<F> g\<rbrakk> \<Longrightarrow> 3 \<le> |vertices f|
[PROOF STEP]
apply(subgoal_tac "2 < | vertices f |")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Invariants.inv g; f \<in> \<F> g; 2 < |vertices f|\<rbrakk> \<Longrightarrow> 3 \<le> |vertices f|
 2. \<lbrakk>Invariants.inv g; f \<in> \<F> g\<rbrakk> \<Longrightarrow> 2 < |vertices f|
[PROOF STEP]
apply arith
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Invariants.inv g; f \<in> \<F> g\<rbrakk> \<Longrightarrow> 2 < |vertices f|
[PROOF STEP]
apply(drule inv_mgp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> \<F> g; minGraphProps g\<rbrakk> \<Longrightarrow> 2 < |vertices f|
[PROOF STEP]
apply (erule (1) minGraphProps2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma negligibleD:
  "\<lbrakk> negligible f; c > 0 \<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. inverse (x powr c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>negligible f; 0 < c\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
unfolding negligible_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>c>0. f \<in> o(\<lambda>x. inverse (real x powr c)); 0 < c\<rbrakk> \<Longrightarrow> f \<in> o(\<lambda>x. inverse (real x powr c))
[PROOF STEP]
by(simp)


[STATEMENT]
lemma num_INDUCTION:
  "\<forall>P. P 0 \<and> (\<forall>n. P n \<longrightarrow> P (Suc n)) \<longrightarrow> (\<forall>n. P n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. P 0 \<and> (\<forall>n. P n \<longrightarrow> P (Suc n)) \<longrightarrow> (\<forall>n. P n)
[PROOF STEP]
by (auto intro: nat.induct)


[STATEMENT]
lemma Dom_AB_eq_pred:
  assumes
    "Domainp A = (\<lambda>x. x \<in> \<UU>A)" "bi_unique A" "right_total A"
    "Domainp B = (\<lambda>x. x \<in> \<UU>B)" "bi_unique B" "right_total B"
  shows "(Domainp (A ===> B) f) = (f ` \<UU>A \<subseteq> \<UU>B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Domainp (A ===> B) f = (f ` \<UU>A \<subseteq> \<UU>B)
[PROOF STEP]
using Dom_fun_eq_set[OF assms]
[PROOF STATE]
proof (prove)
using this:
{f. f ` \<UU>A \<subseteq> \<UU>B} = Collect (Domainp (A ===> B))

goal (1 subgoal):
 1. Domainp (A ===> B) f = (f ` \<UU>A \<subseteq> \<UU>B)
[PROOF STEP]
by blast


[STATEMENT]
lemma prod_A:
  "(\<Prod>i = 0..< n. A i ^ Suc i) = (\<Prod>(a, i)\<in> as \<inter> UNIV \<times> {0 ..< n}. a ^ Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {0..<n}. a ^ Suc i)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
 2. \<And>n. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i) \<Longrightarrow> (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i)

goal (2 subgoals):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
 2. \<And>n. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i) \<Longrightarrow> (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
have id: "{0 ..< Suc n} = insert n {0 ..< n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc n} = insert n {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{0..<Suc n} = insert n {0..<n}

goal (2 subgoals):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
 2. \<And>n. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i) \<Longrightarrow> (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
have id2: "as \<inter> UNIV \<times> {0 ..< Suc n} = as \<inter> UNIV \<times> {n} \<union> as \<inter> UNIV \<times> {0 ..< n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. as \<inter> UNIV \<times> {0..<Suc n} = as \<inter> UNIV \<times> {n} \<union> as \<inter> UNIV \<times> {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
as \<inter> UNIV \<times> {0..<Suc n} = as \<inter> UNIV \<times> {n} \<union> as \<inter> UNIV \<times> {0..<n}

goal (2 subgoals):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
 2. \<And>n. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i) \<Longrightarrow> (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
have cong: "\<And> x y z. x = y \<Longrightarrow> x * z = y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y z. x = y \<Longrightarrow> x * z = y * z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x = ?y \<Longrightarrow> ?x * ?z = ?y * ?z

goal (2 subgoals):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
 2. \<And>n. (\<Prod>i = 0..<n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i) \<Longrightarrow> (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
unfolding id2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {n} \<union> as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i\<in>insert n {0..<n}. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {n} \<union> as \<inter> UNIV \<times> {0..<n}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
proof (subst prod.insert; (subst prod.union_disjoint)?; (unfold Suc)?;
    (unfold A, rule cong)?)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. finite {0..<n}
 2. n \<notin> {0..<n}
 3. finite (as \<inter> UNIV \<times> {n})
 4. finite (as \<inter> UNIV \<times> {0..<n})
 5. as \<inter> UNIV \<times> {n} \<inter> (as \<inter> UNIV \<times> {0..<n}) = {}
 6. (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a) ^ Suc n = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a ^ Suc i)
[PROOF STEP]
show "(\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a) ^ Suc n = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a ^ Suc i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a) ^ Suc n = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a ^ Suc i)
[PROOF STEP]
unfolding prod_power_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>as \<inter> UNIV \<times> {n}. (case x of (a, i) \<Rightarrow> a) ^ Suc n) = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a ^ Suc i)
[PROOF STEP]
by (rule prod.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a) ^ Suc n = (\<Prod>(a, i)\<in>as \<inter> UNIV \<times> {n}. a ^ Suc i)

goal (5 subgoals):
 1. finite {0..<n}
 2. n \<notin> {0..<n}
 3. finite (as \<inter> UNIV \<times> {n})
 4. finite (as \<inter> UNIV \<times> {0..<n})
 5. as \<inter> UNIV \<times> {n} \<inter> (as \<inter> UNIV \<times> {0..<n}) = {}
[PROOF STEP]
qed (insert fin, auto)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<Suc n. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<Suc n}. case a of (a, i) \<Rightarrow> a ^ Suc i)

goal (1 subgoal):
 1. (\<Prod>i = 0..<0. A i ^ Suc i) = (\<Prod>a\<in>as \<inter> UNIV \<times> {0..<0}. case a of (a, i) \<Rightarrow> a ^ Suc i)
[PROOF STEP]
qed simp


[STATEMENT]
lemma "(\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<and>
       (\<forall>x y z. Q x y \<and> Q y z \<longrightarrow> Q x z) \<and>
       (\<forall>x y. P x y \<longrightarrow> P y x) \<and>
       (\<forall>x y. P x y \<or> Q x y)
       \<longrightarrow> (\<forall>x y. P x y) \<or> (\<forall>x y. Q x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<and> (\<forall>x y z. Q x y \<and> Q y z \<longrightarrow> Q x z) \<and> (\<forall>x y. P x y \<longrightarrow> P y x) \<and> (\<forall>x y. P x y \<or> Q x y) \<longrightarrow> (\<forall>x y. P x y) \<or> (\<forall>x y. Q x y)
[PROOF STEP]
by meson


[STATEMENT]
lemma one_idem_mult [simp]: "1 ; 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 ; 1 = 1
[PROOF STEP]
by (metis compl_eq_compl_iff galois_aux2 inf.commute inf_top_right mult_1_left mult_isor top_greatest)


[STATEMENT]
theorem (in pair_sigma_finite) Fubini:
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)"
  shows "(\<integral>\<^sup>+ y. (\<integral>\<^sup>+ x. f (x, y) \<partial>M1) \<partial>M2) = (\<integral>\<^sup>+ x. (\<integral>\<^sup>+ y. f (x, y) \<partial>M2) \<partial>M1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ y. \<integral>\<^sup>+ x. f (x, y) \<partial>M1 \<partial>M2 = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f (x, y) \<partial>M2 \<partial>M1
[PROOF STEP]
unfolding nn_integral_snd[OF assms] M2.nn_integral_fst[OF assms]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (M1 \<Otimes>\<^sub>M M2) f = integral\<^sup>N (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
..


[STATEMENT]
lemma mersenne_mod_nonneg [simp]: "k \<ge> 0 \<Longrightarrow> mersenne_mod k n \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k \<Longrightarrow> 0 \<le> mersenne_mod k n
[PROOF STEP]
unfolding mersenne_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> k \<Longrightarrow> 0 \<le> k mod 2 ^ n + k div 2 ^ n
[PROOF STEP]
by (intro add_nonneg_nonneg) (simp_all add: pos_imp_zdiv_nonneg_iff)


[STATEMENT]
lemma separation_closedin_Un_gen:
     "separatedin X S T \<longleftrightarrow>
        S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> disjnt S T \<and>
        closedin (subtopology X (S \<union> T)) S \<and>
        closedin (subtopology X (S \<union> T)) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. separatedin X S T = (S \<subseteq> topspace X \<and> T \<subseteq> topspace X \<and> disjnt S T \<and> closedin (subtopology X (S \<union> T)) S \<and> closedin (subtopology X (S \<union> T)) T)
[PROOF STEP]
by (auto simp add: separatedin_def closedin_Int_closure_of disjnt_iff dest: closure_of_subset)


[STATEMENT]
lemma power_2_mult_step_le:
  "\<lbrakk>n' \<le> n; 2 ^ n' * k' < 2 ^ n * k\<rbrakk> \<Longrightarrow> 2 ^ n' * (k' + 1) \<le> 2 ^ n * (k::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n' \<le> n; 2 ^ n' * k' < 2 ^ n * k\<rbrakk> \<Longrightarrow> 2 ^ n' * (k' + 1) \<le> 2 ^ n * k
[PROOF STEP]
apply (cases "n'=n", simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>k' < k; n' = n\<rbrakk> \<Longrightarrow> 2 ^ n + 2 ^ n * k' \<le> 2 ^ n * k
 2. \<lbrakk>n' \<le> n; 2 ^ n' * k' < 2 ^ n * k; n' \<noteq> n\<rbrakk> \<Longrightarrow> 2 ^ n' * (k' + 1) \<le> 2 ^ n * k
[PROOF STEP]
apply (metis Suc_leI le_refl mult_Suc_right mult_le_mono semiring_normalization_rules(7))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n' \<le> n; 2 ^ n' * k' < 2 ^ n * k; n' \<noteq> n\<rbrakk> \<Longrightarrow> 2 ^ n' * (k' + 1) \<le> 2 ^ n * k
[PROOF STEP]
apply (drule (1) le_neq_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' \<noteq> n; n' < n\<rbrakk> \<Longrightarrow> 2 ^ n' * (k' + 1) \<le> 2 ^ n * k
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n\<rbrakk> \<Longrightarrow> 2 ^ n' + 2 ^ n' * k' \<le> 2 ^ n * k
[PROOF STEP]
apply (subgoal_tac "\<exists>m. n = n' + m")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n; \<exists>m. n = n' + m\<rbrakk> \<Longrightarrow> 2 ^ n' + 2 ^ n' * k' \<le> 2 ^ n * k
 2. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n\<rbrakk> \<Longrightarrow> \<exists>m. n = n' + m
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n\<rbrakk> \<Longrightarrow> \<exists>m. n = n' + m
 2. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n; \<exists>m. n = n' + m\<rbrakk> \<Longrightarrow> 2 ^ n' + 2 ^ n' * k' \<le> 2 ^ n * k
[PROOF STEP]
apply (simp add: le_Suc_ex)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 ^ n' * k' < 2 ^ n * k; n' < n; \<exists>m. n = n' + m\<rbrakk> \<Longrightarrow> 2 ^ n' + 2 ^ n' * k' \<le> 2 ^ n * k
[PROOF STEP]
apply (clarsimp simp: power_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>k' < 2 ^ m * k; 0 < m; n = n' + m\<rbrakk> \<Longrightarrow> 2 ^ n' + 2 ^ n' * k' \<le> 2 ^ n' * 2 ^ m * k
[PROOF STEP]
apply (metis Suc_leI mult.assoc mult_Suc_right nat_mult_le_cancel_disj)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma strict_sorted_simps: "sorted_wrt (<) [] = True" "sorted_wrt (<) (x # ys) = ((\<forall>y \<in> set ys. x<y) \<and> sorted_wrt (<) ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<) [] = True &&& sorted_wrt (<) (x # ys) = ((\<forall>y\<in>set ys. x < y) \<and> sorted_wrt (<) ys)
[PROOF STEP]
by auto


[STATEMENT]
lemma null_set_Diff:
  assumes "B \<in> null_sets M" "A \<in> sets M" shows "B - A \<in> null_sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B - A \<in> null_sets M
[PROOF STEP]
proof (intro CollectI conjI null_setsI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. emeasure M (B - A) = 0
 2. B - A \<in> sets M
[PROOF STEP]
show "emeasure M (B - A) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (B - A) = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B \<in> null_sets M
A \<in> sets M

goal (1 subgoal):
 1. emeasure M (B - A) = 0
[PROOF STEP]
by (intro emeasure_eq_0[of B _ "B - A"]) auto
[PROOF STATE]
proof (state)
this:
emeasure M (B - A) = 0

goal (1 subgoal):
 1. B - A \<in> sets M
[PROOF STEP]
qed (insert assms, auto)


[STATEMENT]
lemma cmod_diff_le:
  shows "cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
have "(cmod (b + c))\<^sup>2 + (1/2*Im(b*cnj c - c*cnj b))\<^sup>2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> (cmod (b + c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> (cmod (b + c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence "(cmod (b + c))\<^sup>2 \<ge> - (1/2*Im(b*cnj c - c*cnj b))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
0 \<le> (cmod (b + c))\<^sup>2 + (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2

goal (1 subgoal):
 1. - (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b + c))\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b + c))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence "(cmod (b + c))\<^sup>2 \<ge> (1/2*Re(b*cnj c + c*cnj b))\<^sup>2 - Re(b*cnj b*c*cnj c) "
[PROOF STATE]
proof (prove)
using this:
- (1 / 2 * Im (b * cnj c - c * cnj b))\<^sup>2 \<le> (cmod (b + c))\<^sup>2

goal (1 subgoal):
 1. (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b + c))\<^sup>2
[PROOF STEP]
by (auto simp add: power2_eq_square field_simps)
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b + c))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence "Re ((b + c)*(cnj b + cnj c)) \<ge> (1/2*Re(b*cnj c + c*cnj b))\<^sup>2 - Re(b*cnj b*c*cnj c)"
[PROOF STATE]
proof (prove)
using this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> (cmod (b + c))\<^sup>2

goal (1 subgoal):
 1. (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b + c) * (cnj b + cnj c))
[PROOF STEP]
by (subst (asm) cmod_square) simp
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b + c) * (cnj b + cnj c))

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b + c) * (cnj b + cnj c))

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
have "(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re(b*cnj b) + Re(c*cnj c) + Re(b*cnj b*c*cnj c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
[PROOF STEP]
by (subst cmod_square)+ (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
have ++: "2*Re(scalprod b c) = Re(b*cnj c + c*cnj b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * Re (scalprod b c) = Re (b * cnj c + c * cnj b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * Re (scalprod b c) = Re (b * cnj c + c * cnj b)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
have "(1 - Re (scalprod b c))\<^sup>2 = 1 - 2*Re(scalprod b c) + ((Re (scalprod b c))\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - Re (scalprod b c))\<^sup>2 = 1 - 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2
[PROOF STEP]
by (subst power2_diff) simp
[PROOF STATE]
proof (state)
this:
(1 - Re (scalprod b c))\<^sup>2 = 1 - 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence "(1 - Re (scalprod b c))\<^sup>2 = 1 - Re(b*cnj c + c*cnj b) + (1/2 * Re (b*cnj c + c*cnj b))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(1 - Re (scalprod b c))\<^sup>2 = 1 - 2 * Re (scalprod b c) + (Re (scalprod b c))\<^sup>2

goal (1 subgoal):
 1. (1 - Re (scalprod b c))\<^sup>2 = 1 - Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2
[PROOF STEP]
by (subst ++[symmetric]) simp
[PROOF STATE]
proof (state)
this:
(1 - Re (scalprod b c))\<^sup>2 = 1 - Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b + c) * (cnj b + cnj c))
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
(1 - Re (scalprod b c))\<^sup>2 = 1 - Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2
[PROOF STEP]
have "(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) \<ge> (1 - Re (scalprod b c))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
(1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2 - Re (b * cnj b * c * cnj c) \<le> Re ((b + c) * (cnj b + cnj c))
(1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2) = 1 + Re (b * cnj b) + Re (c * cnj c) + Re (b * cnj b * c * cnj c)
(1 - Re (scalprod b c))\<^sup>2 = 1 - Re (b * cnj c + c * cnj b) + (1 / 2 * Re (b * cnj c + c * cnj b))\<^sup>2

goal (1 subgoal):
 1. (1 - Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
(1 - Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(1 - Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
have "sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (metis one_power2 real_sqrt_sum_squares_mult_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(1 - Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
have "sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)) \<ge> 1 - Re (scalprod b c)"
[PROOF STATE]
proof (prove)
using this:
(1 - Re (scalprod b c))\<^sup>2 \<le> (1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)
0 \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. 1 - Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (metis power2_le_imp_le real_sqrt_ge_0_iff real_sqrt_pow2_iff)
[PROOF STATE]
proof (state)
this:
1 - Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence "Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c*cnj c) + 1 + Re (b*cnj b) + 2*sqrt((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))"
[PROOF STATE]
proof (prove)
using this:
1 - Re (scalprod b c) \<le> sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
hence *: "(cmod (b - c))\<^sup>2 \<le> (sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))

goal (1 subgoal):
 1. (cmod (b - c))\<^sup>2 \<le> (sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2))\<^sup>2
[PROOF STEP]
apply (subst cmod_square)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2)); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + (cmod b)\<^sup>2) * (1 + (cmod c)\<^sup>2))\<rbrakk> \<Longrightarrow> Re ((b - c) * cnj (b - c)) \<le> (sqrt (1 + Re (b * cnj b)) + sqrt (1 + Re (c * cnj c)))\<^sup>2
[PROOF STEP]
apply (subst (asm) cmod_square)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c)))\<rbrakk> \<Longrightarrow> Re ((b - c) * cnj (b - c)) \<le> (sqrt (1 + Re (b * cnj b)) + sqrt (1 + Re (c * cnj c)))\<^sup>2
[PROOF STEP]
apply (subst power2_sum)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c)))\<rbrakk> \<Longrightarrow> Re ((b - c) * cnj (b - c)) \<le> (sqrt (1 + Re (b * cnj b)))\<^sup>2 + (sqrt (1 + Re (c * cnj c)))\<^sup>2 + 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c))
[PROOF STEP]
apply (subst real_sqrt_pow2, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c)))\<rbrakk> \<Longrightarrow> Re ((b - c) * cnj (b - c)) \<le> 1 + Re (b * cnj b) + (sqrt (1 + Re (c * cnj c)))\<^sup>2 + 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c))
[PROOF STEP]
apply (subst real_sqrt_pow2, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c))); Re ((b - c) * (cnj b - cnj c)) \<le> 1 + Re (c * cnj c) + 1 + Re (b * cnj b) + 2 * sqrt ((1 + Re (b * cnj b)) * (1 + Re (c * cnj c)))\<rbrakk> \<Longrightarrow> Re ((b - c) * cnj (b - c)) \<le> 1 + Re (b * cnj b) + (1 + Re (c * cnj c)) + 2 * sqrt (1 + Re (b * cnj b)) * sqrt (1 + Re (c * cnj c))
[PROOF STEP]
apply (simp add: real_sqrt_mult)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(cmod (b - c))\<^sup>2 \<le> (sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(cmod (b - c))\<^sup>2 \<le> (sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
using power2_le_imp_le[OF *]
[PROOF STATE]
proof (prove)
using this:
(cmod (b - c))\<^sup>2 \<le> (sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2))\<^sup>2
0 \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2) \<Longrightarrow> cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)

goal (1 subgoal):
 1. cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cmod (b - c) \<le> sqrt (1 + (cmod b)\<^sup>2) + sqrt (1 + (cmod c)\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_prod_eq:
  assumes "finite I" and "\<And>i. i \<in> I \<Longrightarrow> f i \<noteq> 0"
  shows "Polynomial.degree (prod f I :: _::semiring_no_zero_divisors poly) = (\<Sum>i\<in>I. Polynomial.degree (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod f I) = (\<Sum>i\<in>I. degree (f i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> f ?i \<noteq> 0

goal (1 subgoal):
 1. degree (prod f I) = (\<Sum>i\<in>I. degree (f i))
[PROOF STEP]
proof (induct I)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f {}) = (\<Sum>i\<in>{}. degree (f i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
?i \<in> {} \<Longrightarrow> f ?i \<noteq> 0

goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f {}) = (\<Sum>i\<in>{}. degree (f i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod f {}) = (\<Sum>i\<in>{}. degree (f i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (prod f {}) = (\<Sum>i\<in>{}. degree (f i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
case (insert j J)
[PROOF STATE]
proof (state)
this:
finite J
j \<notin> J
(\<And>i. i \<in> J \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f J) = (\<Sum>i\<in>J. degree (f i))
?i \<in> insert j J \<Longrightarrow> f ?i \<noteq> 0

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
have 1: "f i \<noteq> 0" if "i \<in> J" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i \<noteq> 0
[PROOF STEP]
proof (rule insert.prems)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<in> insert j J
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
i \<in> J
[PROOF STEP]
show "i \<in> insert j J"
[PROOF STATE]
proof (prove)
using this:
i \<in> J

goal (1 subgoal):
 1. i \<in> insert j J
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<in> insert j J

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> J \<Longrightarrow> f ?i \<noteq> 0

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
hence eq: "Polynomial.degree (prod f J) = (\<Sum>i\<in>J. Polynomial.degree (f i))"
[PROOF STATE]
proof (prove)
using this:
?i \<in> J \<Longrightarrow> f ?i \<noteq> 0

goal (1 subgoal):
 1. degree (prod f J) = (\<Sum>i\<in>J. degree (f i))
[PROOF STEP]
by (rule insert.hyps)
[PROOF STATE]
proof (state)
this:
degree (prod f J) = (\<Sum>i\<in>J. degree (f i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
from insert.hyps(1, 2)
[PROOF STATE]
proof (chain)
picking this:
finite J
j \<notin> J
[PROOF STEP]
have "Polynomial.degree (prod f (insert j J)) = Polynomial.degree (f j * prod f J)"
[PROOF STATE]
proof (prove)
using this:
finite J
j \<notin> J

goal (1 subgoal):
 1. degree (prod f (insert j J)) = degree (f j * prod f J)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (prod f (insert j J)) = degree (f j * prod f J)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (prod f (insert j J)) = degree (f j * prod f J)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
have "\<dots> = Polynomial.degree (f j) + Polynomial.degree (prod f J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (f j * prod f J) = degree (f j) + degree (prod f J)
[PROOF STEP]
proof (rule degree_mult_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f j \<noteq> 0
 2. prod f J \<noteq> 0
[PROOF STEP]
show "f j \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f j \<noteq> 0
[PROOF STEP]
by (rule insert.prems) simp
[PROOF STATE]
proof (state)
this:
f j \<noteq> 0

goal (1 subgoal):
 1. prod f J \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod f J \<noteq> 0
[PROOF STEP]
show "prod f J \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f J \<noteq> 0
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod f J = 0 \<Longrightarrow> False
[PROOF STEP]
assume "prod f J = 0"
[PROOF STATE]
proof (state)
this:
prod f J = 0

goal (1 subgoal):
 1. prod f J = 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prod f J = 0
[PROOF STEP]
obtain i where "i \<in> J" and "f i = 0"
[PROOF STATE]
proof (prove)
using this:
prod f J = 0

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> J; f i = 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule prod_eq_zeroE)
[PROOF STATE]
proof (state)
this:
i \<in> J
f i = 0

goal (1 subgoal):
 1. prod f J = 0 \<Longrightarrow> False
[PROOF STEP]
from this(1)
[PROOF STATE]
proof (chain)
picking this:
i \<in> J
[PROOF STEP]
have "f i \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
i \<in> J

goal (1 subgoal):
 1. f i \<noteq> 0
[PROOF STEP]
by (rule 1)
[PROOF STATE]
proof (state)
this:
f i \<noteq> 0

goal (1 subgoal):
 1. prod f J = 0 \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
f i \<noteq> 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using \<open>f i = 0\<close>
[PROOF STATE]
proof (prove)
using this:
f i \<noteq> 0
f i = 0

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
prod f J \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (f j * prod f J) = degree (f j) + degree (prod f J)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (f j * prod f J) = degree (f j) + degree (prod f J)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
from insert.hyps(1, 2)
[PROOF STATE]
proof (chain)
picking this:
finite J
j \<notin> J
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>insert j J. Polynomial.degree (f i))"
[PROOF STATE]
proof (prove)
using this:
finite J
j \<notin> J

goal (1 subgoal):
 1. degree (f j) + degree (prod f J) = (\<Sum>i\<in>insert j J. degree (f i))
[PROOF STEP]
by (simp add: eq)
[PROOF STATE]
proof (state)
this:
degree (f j) + degree (prod f J) = (\<Sum>i\<in>insert j J. degree (f i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> f i \<noteq> 0) \<Longrightarrow> degree (prod f F) = (\<Sum>i\<in>F. degree (f i)); \<And>i. i \<in> insert x F \<Longrightarrow> f i \<noteq> 0\<rbrakk> \<Longrightarrow> degree (prod f (insert x F)) = (\<Sum>i\<in>insert x F. degree (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (prod f (insert j J)) = (\<Sum>i\<in>insert j J. degree (f i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
degree (prod f (insert j J)) = (\<Sum>i\<in>insert j J. degree (f i))

goal (1 subgoal):
 1. degree (prod f (insert j J)) = (\<Sum>i\<in>insert j J. degree (f i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
degree (prod f (insert j J)) = (\<Sum>i\<in>insert j J. degree (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_gt_0_diff_singleton:
  assumes "card S > 0" and "x \<in> S"
  shows "card (S - {x}) = card S - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S - {x}) = card S - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (S - {x}) = card S - 1
[PROOF STEP]
from \<open>card S > 0\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < card S
[PROOF STEP]
have "finite S"
[PROOF STATE]
proof (prove)
using this:
0 < card S

goal (1 subgoal):
 1. finite S
[PROOF STEP]
by (rule card_ge_0_finite)
[PROOF STATE]
proof (state)
this:
finite S

goal (1 subgoal):
 1. card (S - {x}) = card S - 1
[PROOF STEP]
with \<open>x \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> S
finite S
[PROOF STEP]
show "card (S - {x}) = card S - 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> S
finite S

goal (1 subgoal):
 1. card (S - {x}) = card S - 1
[PROOF STEP]
by (simp add: card_Diff_singleton)
[PROOF STATE]
proof (state)
this:
card (S - {x}) = card S - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gdelta_imp_fsigma: "gdelta S \<Longrightarrow> fsigma (- S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gdelta S \<Longrightarrow> fsigma (- S)
[PROOF STEP]
proof (induction rule: gdelta.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>F. (\<And>n. open (F n)) \<Longrightarrow> fsigma (- \<Inter> (range F))
[PROOF STEP]
case (1 F)
[PROOF STATE]
proof (state)
this:
open (F ?n)

goal (1 subgoal):
 1. \<And>F. (\<And>n. open (F n)) \<Longrightarrow> fsigma (- \<Inter> (range F))
[PROOF STEP]
have "- \<Inter>(F ` UNIV) = (\<Union>i. -(F i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Inter> (range F) = (\<Union>i. - F i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- \<Inter> (range F) = (\<Union>i. - F i)

goal (1 subgoal):
 1. \<And>F. (\<And>n. open (F n)) \<Longrightarrow> fsigma (- \<Inter> (range F))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- \<Inter> (range F) = (\<Union>i. - F i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
- \<Inter> (range F) = (\<Union>i. - F i)

goal (1 subgoal):
 1. fsigma (- \<Inter> (range F))
[PROOF STEP]
by (simp add: fsigma.intros closed_Compl 1)
[PROOF STATE]
proof (state)
this:
fsigma (- \<Inter> (range F))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_eqpoll_insertD: "\<lbrakk>insert u A \<approx> insert v B; u \<notin> A; v \<notin> B\<rbrakk> \<Longrightarrow> A \<approx> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>insert u A \<approx> insert v B; u \<notin> A; v \<notin> B\<rbrakk> \<Longrightarrow> A \<approx> B
[PROOF STEP]
by (meson insert_lepoll_insertD eqpoll_imp_lepoll eqpoll_sym lepoll_antisym)


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

goal (1 subgoal):
 1. filterlim ((*) (ln a)) at_bot at_bot
[PROOF STEP]
by (intro filterlim_tendsto_pos_mult_at_bot[OF tendsto_const _ filterlim_ident]) auto
[PROOF STATE]
proof (state)
this:
filterlim ((*) (ln a)) at_bot at_bot

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_bot
[PROOF STEP]
hence "((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_bot"
[PROOF STATE]
proof (prove)
using this:
filterlim ((*) (ln a)) at_bot at_bot

goal (1 subgoal):
 1. ((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_bot
[PROOF STEP]
by (intro filterlim_compose[OF exp_at_bot]) (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_bot

goal (1 subgoal):
 1. ((powr) a \<longlongrightarrow> 0) at_bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. exp (x * ln a)) \<longlongrightarrow> 0) at_bot

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

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_ins:
  "sorted(inorder t) \<Longrightarrow> inorder(treeI(ins x t)) = ins_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (inorder t) \<Longrightarrow> inorder (treeI (ins x t)) = ins_list x (inorder t)
[PROOF STEP]
by(induction t) (auto simp: ins_list_simps split: upI.splits)


[STATEMENT]
lemma formula_signs_induct: "[|
  ! p vs. P (FAtom Pos p vs);
  ! p vs. P (FAtom Neg p vs);
  !! A B  . [| P A; P B |] ==> P (FConj Pos A B);
  !! A B  . [| P A; P B |] ==> P (FConj Neg A B);
  !! A    . [| P A |] ==> P (FAll  Pos A);
  !! A    . [| P A |] ==> P (FAll  Neg A)
  |]
  ==> P A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p vs. P (FAtom Pos p vs); \<forall>p vs. P (FAtom Neg p vs); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Pos A B); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Neg A B); \<And>A. P A \<Longrightarrow> P (FAll Pos A); \<And>A. P A \<Longrightarrow> P (FAll Neg A)\<rbrakk> \<Longrightarrow> P A
[PROOF STEP]
apply(induct_tac A)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x1 x2 x3. \<lbrakk>\<forall>p vs. P (FAtom Pos p vs); \<forall>p vs. P (FAtom Neg p vs); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Pos A B); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Neg A B); \<And>A. P A \<Longrightarrow> P (FAll Pos A); \<And>A. P A \<Longrightarrow> P (FAll Neg A)\<rbrakk> \<Longrightarrow> P (FAtom x1 x2 x3)
 2. \<And>x1 x2 x3. \<lbrakk>\<forall>p vs. P (FAtom Pos p vs); \<forall>p vs. P (FAtom Neg p vs); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Pos A B); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Neg A B); \<And>A. P A \<Longrightarrow> P (FAll Pos A); \<And>A. P A \<Longrightarrow> P (FAll Neg A); P x2; P x3\<rbrakk> \<Longrightarrow> P (FConj x1 x2 x3)
 3. \<And>x1 x2. \<lbrakk>\<forall>p vs. P (FAtom Pos p vs); \<forall>p vs. P (FAtom Neg p vs); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Pos A B); \<And>A B. \<lbrakk>P A; P B\<rbrakk> \<Longrightarrow> P (FConj Neg A B); \<And>A. P A \<Longrightarrow> P (FAll Pos A); \<And>A. P A \<Longrightarrow> P (FAll Neg A); P x2\<rbrakk> \<Longrightarrow> P (FAll x1 x2)
[PROOF STEP]
apply(rule signs.induct, force, force)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma strict_prefix_map_inj_eq [simp]:
  "inj_on f (set xs \<union> set ys) \<Longrightarrow>
   strict_prefix (map f xs) (map f ys) \<longleftrightarrow> strict_prefix xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (set xs \<union> set ys) \<Longrightarrow> strict_prefix (map f xs) (map f ys) = strict_prefix xs ys
[PROOF STEP]
by (simp add: inj_on_map_eq_map strict_prefix_def)


[STATEMENT]
lemma gauss_cnj_dvd:
  assumes "a dvd b"
  shows   "gauss_cnj a dvd gauss_cnj b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_cnj a dvd gauss_cnj b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauss_cnj a dvd gauss_cnj b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a dvd b
[PROOF STEP]
obtain c where "b = a * c"
[PROOF STATE]
proof (prove)
using this:
a dvd b

goal (1 subgoal):
 1. (\<And>c. b = a * c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b = a * c

goal (1 subgoal):
 1. gauss_cnj a dvd gauss_cnj b
[PROOF STEP]
hence "gauss_cnj b = gauss_cnj a * gauss_cnj c"
[PROOF STATE]
proof (prove)
using this:
b = a * c

goal (1 subgoal):
 1. gauss_cnj b = gauss_cnj a * gauss_cnj c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gauss_cnj b = gauss_cnj a * gauss_cnj c

goal (1 subgoal):
 1. gauss_cnj a dvd gauss_cnj b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
gauss_cnj b = gauss_cnj a * gauss_cnj c

goal (1 subgoal):
 1. gauss_cnj a dvd gauss_cnj b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gauss_cnj a dvd gauss_cnj b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_list_union[simp]: "set (list_union xs ys) = set xs \<union> set ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (list_union xs ys) = set xs \<union> set ys
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (list_union [] ys) = set [] \<union> set ys
 2. \<And>a xs. set (list_union xs ys) = set xs \<union> set ys \<Longrightarrow> set (list_union (a # xs) ys) = set (a # xs) \<union> set ys
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
set (list_union xs ys) = set xs \<union> set ys

goal (2 subgoals):
 1. set (list_union [] ys) = set [] \<union> set ys
 2. \<And>a xs. set (list_union xs ys) = set xs \<union> set ys \<Longrightarrow> set (list_union (a # xs) ys) = set (a # xs) \<union> set ys
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set (list_union xs ys) = set xs \<union> set ys

goal (1 subgoal):
 1. set (list_union (x # xs) ys) = set (x # xs) \<union> set ys
[PROOF STEP]
by (cases "x \<in> set (list_union xs ys)") (auto)
[PROOF STATE]
proof (state)
this:
set (list_union (x # xs) ys) = set (x # xs) \<union> set ys

goal (1 subgoal):
 1. set (list_union [] ys) = set [] \<union> set ys
[PROOF STEP]
qed simp


[STATEMENT]
lemma perm_map_is_struct_map:
  assumes "\<sigma> permutes {..<n}"
  shows "perm_map R n \<sigma> \<in> struct_maps (R\<^bsup>n\<^esup>) (R\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. perm_map R n \<sigma> \<in> struct_maps (R\<^bsup>n\<^esup>) (R\<^bsup>n\<^esup>)
[PROOF STEP]
apply(rule struct_maps_memI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> perm_map R n \<sigma> x \<in> carrier (R\<^bsup>n\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> perm_map R n \<sigma> x = undefined
[PROOF STEP]
unfolding perm_map_def restrict_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (if x \<in> carrier (R\<^bsup>n\<^esup>) then permute_list \<sigma> x else undefined) \<in> carrier (R\<^bsup>n\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (if x \<in> carrier (R\<^bsup>n\<^esup>) then permute_list \<sigma> x else undefined) = undefined
[PROOF STEP]
using assms permute_list_closed[of _ n \<sigma>]
[PROOF STATE]
proof (prove)
using this:
\<sigma> permutes {..<n}
\<lbrakk>?a \<in> carrier (R\<^bsup>n\<^esup>); \<sigma> permutes {..<n}\<rbrakk> \<Longrightarrow> permute_list \<sigma> ?a \<in> carrier (R\<^bsup>n\<^esup>)

goal (2 subgoals):
 1. \<And>x. x \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (if x \<in> carrier (R\<^bsup>n\<^esup>) then permute_list \<sigma> x else undefined) \<in> carrier (R\<^bsup>n\<^esup>)
 2. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (if x \<in> carrier (R\<^bsup>n\<^esup>) then permute_list \<sigma> x else undefined) = undefined
[PROOF STEP]
apply metis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<notin> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> (if x \<in> carrier (R\<^bsup>n\<^esup>) then permute_list \<sigma> x else undefined) = undefined
[PROOF STEP]
by metis


[STATEMENT]
lemma AE_finite_all:
  assumes f: "finite S" shows "(AE x in M. \<forall>i\<in>S. P i x) \<longleftrightarrow> (\<forall>i\<in>S. AE x in M. P i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (AE x in M. \<forall>i\<in>S. P i x) = (\<forall>i\<in>S. almost_everywhere M (P i))
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. (AE x in M. \<forall>i\<in>S. P i x) = (\<forall>i\<in>S. almost_everywhere M (P i))
[PROOF STEP]
by induct auto


[STATEMENT]
lemma satPB_UN[simp]: "satPB \<xi> (\<Union> i \<in> I. \<Phi> i) \<longleftrightarrow> (\<forall> i \<in> I. satPB \<xi> (\<Phi> i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. satPB \<xi> (\<Union> (\<Phi> ` I)) = (\<forall>i\<in>I. satPB \<xi> (\<Phi> i))
[PROOF STEP]
unfolding satPB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>c\<in>\<Union> (\<Phi> ` I). satC \<xi> c) = (\<forall>i\<in>I. \<forall>c\<in>\<Phi> i. satC \<xi> c)
[PROOF STEP]
by auto


[STATEMENT]
lemma zero_ne_eSuc [simp]: "0 \<noteq> eSuc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> eSuc n
[PROOF STEP]
by (rule eSuc_ne_0 [symmetric])


[STATEMENT]
lemma polyadd_different_degree:
  "isnpolyh p n0 \<Longrightarrow> isnpolyh q n1 \<Longrightarrow> degree p \<noteq> degree q \<Longrightarrow>
    degree (polyadd p q) = max (degree p) (degree q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>isnpolyh p n0; isnpolyh q n1; Polynomial_Expression.degree p \<noteq> Polynomial_Expression.degree q\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (p +\<^sub>p q) = max (Polynomial_Expression.degree p) (Polynomial_Expression.degree q)
[PROOF STEP]
by (simp add: degree_eq_degreen0 polyadd_different_degreen)


[STATEMENT]
lemma inner_prod_with_itself_Im [simp]:
  "Im (\<langle>u|u\<rangle>) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im \<langle>u|u\<rangle> = 0
[PROOF STEP]
using inner_prod_cnj
[PROOF STATE]
proof (prove)
using this:
dim_vec ?u = dim_vec ?v \<Longrightarrow> \<langle>?v|?u\<rangle> = cnj \<langle>?u|?v\<rangle>

goal (1 subgoal):
 1. Im \<langle>u|u\<rangle> = 0
[PROOF STEP]
by (metis Reals_cnj_iff complex_is_Real_iff)


[STATEMENT]
lemma stationary_distributionD_emeasure:
  assumes N: "stationary_distribution N"
  shows "emeasure N A = (\<integral>\<^sup>+s. emeasure (K s) A \<partial>N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N
[PROOF STEP]
have "prob_space (measure_pmf N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob_space (measure_pmf N)
[PROOF STEP]
by intro_locales
[PROOF STATE]
proof (state)
this:
prob_space (measure_pmf N)

goal (1 subgoal):
 1. emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prob_space (measure_pmf N)
[PROOF STEP]
interpret subprob_space "measure_pmf N"
[PROOF STATE]
proof (prove)
using this:
prob_space (measure_pmf N)

goal (1 subgoal):
 1. subprob_space (measure_pmf N)
[PROOF STEP]
by (rule prob_space_imp_subprob_space)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N
[PROOF STEP]
unfolding measure_pmf.emeasure_eq_measure
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (measure_pmf.prob N A) = \<integral>\<^sup>+ s. ennreal (measure_pmf.prob (K s) A) \<partial>measure_pmf N
[PROOF STEP]
apply (subst N[unfolded stationary_distribution_def])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (measure_pmf.prob (N \<bind> K) A) = \<integral>\<^sup>+ s. ennreal (measure_pmf.prob (K s) A) \<partial>measure_pmf N
[PROOF STEP]
apply (simp add: measure_pmf_bind)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (Sigma_Algebra.measure (measure_pmf N \<bind> (\<lambda>x. measure_pmf (K x))) A) = \<integral>\<^sup>+ s. ennreal (measure_pmf.prob (K s) A) \<partial>measure_pmf N
[PROOF STEP]
apply (subst measure_pmf.measure_bind[where N="count_space UNIV"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. measure_pmf.random_variable N (subprob_algebra (count_space UNIV)) (\<lambda>x. measure_pmf (K x))
 2. A \<in> sets (count_space UNIV)
 3. ennreal (measure_pmf.expectation N (\<lambda>x. measure_pmf.prob (K x) A)) = \<integral>\<^sup>+ s. ennreal (measure_pmf.prob (K s) A) \<partial>measure_pmf N
[PROOF STEP]
apply (rule measurable_compose[OF _ measurable_measure_pmf])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. measure_pmf.random_variable N (count_space UNIV) K
 2. A \<in> sets (count_space UNIV)
 3. ennreal (measure_pmf.expectation N (\<lambda>x. measure_pmf.prob (K x) A)) = \<integral>\<^sup>+ s. ennreal (measure_pmf.prob (K s) A) \<partial>measure_pmf N
[PROOF STEP]
apply (auto intro!: nn_integral_eq_integral[symmetric] measure_pmf.integrable_const_bound[where B=1])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
emeasure (measure_pmf N) A = \<integral>\<^sup>+ s. emeasure (measure_pmf (K s)) A \<partial>measure_pmf N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arccos_ubound_abs [simp]:
  "\<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos y \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos y \<le> pi
[PROOF STEP]
by (simp add: arccos_ubound)


[STATEMENT]
lemma map_us_prop: "map_us f \<circ> (us::'a::complete_lattice_with_dual \<Rightarrow> 'a upset) = us \<circ> id f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_us f \<circ> us = us \<circ> id f
[PROOF STEP]
unfolding map_us_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. us \<circ> f \<circ> IInf \<circ> us = us \<circ> id f
[PROOF STEP]
by (simp add: IInf_us_inv comp_assoc)


[STATEMENT]
lemma ln_mono: "0 < x \<Longrightarrow> 0 < y \<Longrightarrow> x \<le> y \<Longrightarrow> ln (x::real) \<le> ln y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 < y; x \<le> y\<rbrakk> \<Longrightarrow> ln x \<le> ln y
[PROOF STEP]
by (subst ln_le_cancel_iff) simp_all


[STATEMENT]
lemma poly_rel_inj: "poly_rel x y \<Longrightarrow> poly_rel x z \<Longrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>poly_rel x y; poly_rel x z\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
using list.bi_unique_rel[OF bi_unique]
[PROOF STATE]
proof (prove)
using this:
bi_unique (list_all2 R)

goal (1 subgoal):
 1. \<lbrakk>poly_rel x y; poly_rel x z\<rbrakk> \<Longrightarrow> y = z
[PROOF STEP]
unfolding poly_rel_def coeffs_eq_iff bi_unique_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x y z. list_all2 R x y \<longrightarrow> list_all2 R x z \<longrightarrow> y = z) \<and> (\<forall>x y z. list_all2 R x z \<longrightarrow> list_all2 R y z \<longrightarrow> x = y)

goal (1 subgoal):
 1. \<lbrakk>list_all2 R x (coeffs y); list_all2 R x (coeffs z)\<rbrakk> \<Longrightarrow> coeffs y = coeffs z
[PROOF STEP]
by auto


[STATEMENT]
lemma degree_polyneg:
  assumes "isnpolyh p n"
  shows "degree (polyneg p) = degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial_Expression.degree (~\<^sub>p p) = Polynomial_Expression.degree p
[PROOF STEP]
apply (induct p rule: polyneg.induct)
[PROOF STATE]
proof (prove)
goal (8 subgoals):
 1. \<And>c. Polynomial_Expression.degree (~\<^sub>p (c)\<^sub>p) = Polynomial_Expression.degree (c)\<^sub>p
 2. \<And>c n p. \<lbrakk>Polynomial_Expression.degree (~\<^sub>p c) = Polynomial_Expression.degree c; Polynomial_Expression.degree (~\<^sub>p p) = Polynomial_Expression.degree p\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (~\<^sub>p (CN c n p)) = Polynomial_Expression.degree (CN c n p)
 3. \<And>v. Polynomial_Expression.degree (~\<^sub>p (Bound v)) = Polynomial_Expression.degree (Bound v)
 4. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Add v va)) = Polynomial_Expression.degree (Add v va)
 5. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Sub v va)) = Polynomial_Expression.degree (Sub v va)
 6. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Mul v va)) = Polynomial_Expression.degree (Mul v va)
 7. \<And>v. Polynomial_Expression.degree (~\<^sub>p (Neg v)) = Polynomial_Expression.degree (Neg v)
 8. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Pw v va)) = Polynomial_Expression.degree (Pw v va)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isnpolyh p n

goal (8 subgoals):
 1. \<And>c. Polynomial_Expression.degree (~\<^sub>p (c)\<^sub>p) = Polynomial_Expression.degree (c)\<^sub>p
 2. \<And>c n p. \<lbrakk>Polynomial_Expression.degree (~\<^sub>p c) = Polynomial_Expression.degree c; Polynomial_Expression.degree (~\<^sub>p p) = Polynomial_Expression.degree p\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (~\<^sub>p (CN c n p)) = Polynomial_Expression.degree (CN c n p)
 3. \<And>v. Polynomial_Expression.degree (~\<^sub>p (Bound v)) = Polynomial_Expression.degree (Bound v)
 4. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Add v va)) = Polynomial_Expression.degree (Add v va)
 5. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Sub v va)) = Polynomial_Expression.degree (Sub v va)
 6. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Mul v va)) = Polynomial_Expression.degree (Mul v va)
 7. \<And>v. Polynomial_Expression.degree (~\<^sub>p (Neg v)) = Polynomial_Expression.degree (Neg v)
 8. \<And>v va. Polynomial_Expression.degree (~\<^sub>p (Pw v va)) = Polynomial_Expression.degree (Pw v va)
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>c na pa. \<lbrakk>Polynomial_Expression.degree (~\<^sub>p c) = Polynomial_Expression.degree c; Polynomial_Expression.degree (~\<^sub>p pa) = Polynomial_Expression.degree pa; isnpolyh p n\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (CN (~\<^sub>p c) na (~\<^sub>p pa)) = Polynomial_Expression.degree (CN c na pa)
[PROOF STEP]
apply (case_tac na)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>c na pa. \<lbrakk>Polynomial_Expression.degree (~\<^sub>p c) = Polynomial_Expression.degree c; Polynomial_Expression.degree (~\<^sub>p pa) = Polynomial_Expression.degree pa; isnpolyh p n; na = 0\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (CN (~\<^sub>p c) na (~\<^sub>p pa)) = Polynomial_Expression.degree (CN c na pa)
 2. \<And>c na pa nat. \<lbrakk>Polynomial_Expression.degree (~\<^sub>p c) = Polynomial_Expression.degree c; Polynomial_Expression.degree (~\<^sub>p pa) = Polynomial_Expression.degree pa; isnpolyh p n; na = Suc nat\<rbrakk> \<Longrightarrow> Polynomial_Expression.degree (CN (~\<^sub>p c) na (~\<^sub>p pa)) = Polynomial_Expression.degree (CN c na pa)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ex_subset:
  assumes "\<exists>x \<in> A. P x"
  assumes "A \<subseteq> B"
  shows "\<exists>x \<in> B. P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>B. P x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>A. P x
A \<subseteq> B

goal (1 subgoal):
 1. \<exists>x\<in>B. P x
[PROOF STEP]
by auto


[STATEMENT]
lemma map_family_triangle4:"\<lbrakk>\<forall>j\<in>I. aGroup (A j); aGroup S;
                \<forall>j\<in>I. f j \<in> aHom S (A j)\<rbrakk> \<Longrightarrow>
               \<forall>j\<in>I. compos S (f j) (ag_idmap S) = f j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>j\<in>I. aGroup (A j); aGroup S; \<forall>j\<in>I. f j \<in> aHom S (A j)\<rbrakk> \<Longrightarrow> \<forall>j\<in>I. compos S (f j) aI\<^bsub>S\<^esub> = f j
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>\<forall>j\<in>I. aGroup (A j); aGroup S; \<forall>j\<in>I. f j \<in> aHom S (A j); j \<in> I\<rbrakk> \<Longrightarrow> compos S (f j) aI\<^bsub>S\<^esub> = f j
[PROOF STEP]
apply (frule_tac x = j in bspec, assumption,
       thin_tac "\<forall>j\<in>I. aGroup (A j)",
       frule_tac x = j in bspec, assumption,
       thin_tac "\<forall>j\<in>I. f j \<in> aHom S (A j)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>aGroup S; j \<in> I; aGroup (A j); f j \<in> aHom S (A j)\<rbrakk> \<Longrightarrow> compos S (f j) aI\<^bsub>S\<^esub> = f j
[PROOF STEP]
apply (simp add:compos_aI_r)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pmat_extension_add:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d1 d1"
  shows "pmat_extension (m1 + m2) = pmat_extension m1 + pmat_extension m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pmat_extension (m1 + m2) = pmat_extension m1 + pmat_extension m2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d1 d1

goal (1 subgoal):
 1. pmat_extension (m1 + m2) = pmat_extension m1 + pmat_extension m2
[PROOF STEP]
by (simp add: pmat_extension_def ptensor_mat_add)


[STATEMENT]
lemma inverse_scaleC_times [simp]:
  fixes a :: "'a::complex_algebra_1"
  shows "(1 / numeral v) *\<^sub>C (numeral w * a) = (numeral w / numeral v) *\<^sub>C a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 / numeral v) *\<^sub>C (numeral w * a) = (numeral w / numeral v) *\<^sub>C a
[PROOF STEP]
by (metis divide_inverse_commute inverse_eq_divide of_complex_numeral scaleC_conv_of_complex scaleC_scaleC)


[STATEMENT]
lemma complex_inner_i_left [simp]: "inner \<i> x = Im x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner \<i> x = Im x
[PROOF STEP]
unfolding inner_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re \<i> * Re x + Im \<i> * Im x = Im x
[PROOF STEP]
by simp


[STATEMENT]
lemma binomial_maximum: "n choose k \<le> n choose (n div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
have "k \<le> n div 2 \<longleftrightarrow> 2*k \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (k \<le> n div 2) = (2 * k \<le> n)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(k \<le> n div 2) = (2 * k \<le> n)

goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
consider "2*k \<le> n" | "2*k \<ge> n" "k \<le> n" | "k > n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>2 * k \<le> n \<Longrightarrow> thesis; \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> thesis; n < k \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>2 * k \<le> n \<Longrightarrow> ?thesis; \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> ?thesis; n < k \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>2 * k \<le> n \<Longrightarrow> ?thesis; \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> ?thesis; n < k \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 2 * k \<le> n \<Longrightarrow> n choose k \<le> n choose n div 2
 2. \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> n choose k \<le> n choose n div 2
 3. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
2 * k \<le> n

goal (3 subgoals):
 1. 2 * k \<le> n \<Longrightarrow> n choose k \<le> n choose n div 2
 2. \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> n choose k \<le> n choose n div 2
 3. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
2 * k \<le> n

goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
by (intro binomial_mono) linarith+
[PROOF STATE]
proof (state)
this:
n choose k \<le> n choose n div 2

goal (2 subgoals):
 1. \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> n choose k \<le> n choose n div 2
 2. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> n choose k \<le> n choose n div 2
 2. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
n \<le> 2 * k
k \<le> n

goal (2 subgoals):
 1. \<lbrakk>n \<le> 2 * k; k \<le> n\<rbrakk> \<Longrightarrow> n choose k \<le> n choose n div 2
 2. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n \<le> 2 * k
k \<le> n

goal (1 subgoal):
 1. n choose k \<le> n choose n div 2
[PROOF STEP]
by (intro binomial_antimono) simp_all
[PROOF STATE]
proof (state)
this:
n choose k \<le> n choose n div 2

goal (1 subgoal):
 1. n < k \<Longrightarrow> n choose k \<le> n choose n div 2
[PROOF STEP]
qed (simp_all add: binomial_eq_0)
[PROOF STATE]
proof (state)
this:
n choose k \<le> n choose n div 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma paths_singles': "xs \<in> paths (singles S) \<longleftrightarrow> (\<forall>x \<in> (set xs \<inter> S). one_call_in_path x xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs \<in> paths (singles S)) = (\<forall>x\<in>set xs \<inter> S. one_call_in_path x xs)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs S. (xs \<in> {xs. \<forall>x\<in>S. length (filter (\<lambda>x'. x' = x) xs) \<le> 1}) = (\<forall>x\<in>set xs \<inter> S. one_call_in_path x xs)
[PROOF STEP]
apply (auto simp add: one_call_in_path_filter_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs S x. \<lbrakk>\<forall>x\<in>set xs \<inter> S. length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0; x \<in> S\<rbrakk> \<Longrightarrow> length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0
[PROOF STEP]
apply (erule_tac x = x in ballE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>xs S x. \<lbrakk>x \<in> S; length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0\<rbrakk> \<Longrightarrow> length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0
 2. \<And>xs S x. \<lbrakk>x \<in> S; x \<notin> set xs \<inter> S\<rbrakk> \<Longrightarrow> length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs S x. \<lbrakk>x \<in> S; x \<notin> set xs\<rbrakk> \<Longrightarrow> length (filter (\<lambda>x'. x' = x) xs) \<le> Suc 0
[PROOF STEP]
by (metis (poly_guards_query) filter_empty_conv le0 length_0_conv)