[STATEMENT]
lemma le_vec_pow_A_1: assumes le: "le_vec (rho *s x) (A *v x)"
  shows "le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "A1n $ i $ j \<ge> 0" for i j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> A1n $h i $h j
[PROOF STEP]
using A1n_pos[of i j]
[PROOF STATE]
proof (prove)
using this:
0 < A1n $h i $h j

goal (1 subgoal):
 1. 0 \<le> A1n $h i $h j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> A1n $h ?i $h ?j

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
from le_vec_mono_left[OF this le]
[PROOF STATE]
proof (chain)
picking this:
le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))
[PROOF STEP]
have "le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))"
[PROOF STATE]
proof (prove)
using this:
le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))

goal (1 subgoal):
 1. le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
le_vec (A1n *v (rho *s x)) (A1n *v (A *v x))

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "A1n *v (A *v x) = (A1n ** A) *v x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1n *v (A *v x) = A1n ** A *v x
[PROOF STEP]
by (simp add: matrix_vector_mul_assoc)
[PROOF STATE]
proof (state)
this:
A1n *v (A *v x) = A1n ** A *v x

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A1n *v (A *v x) = A1n ** A *v x

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "\<dots> = A *v (A1n *v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1n ** A *v x = A *v (A1n *v x)
[PROOF STEP]
unfolding A1n_commute
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** A1n *v x = A *v (A1n *v x)
[PROOF STEP]
by (simp add: matrix_vector_mul_assoc)
[PROOF STATE]
proof (state)
this:
A1n ** A *v x = A *v (A1n *v x)

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A1n ** A *v x = A *v (A1n *v x)

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "\<dots> = A *v (pow_A_1 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (A1n *v x) = A *v pow_A_1 x
[PROOF STEP]
unfolding pow_A_1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *v (A1n *v x) = A *v (A1n *v x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
A *v (A1n *v x) = A *v pow_A_1 x

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A *v (A1n *v x) = A *v pow_A_1 x

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "A1n *v (rho *s x) = rho *s (A1n *v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1n *v (rho *s x) = rho *s (A1n *v x)
[PROOF STEP]
unfolding vector_smult_distrib
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho *s (A1n *v x) = rho *s (A1n *v x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
A1n *v (rho *s x) = rho *s (A1n *v x)

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A1n *v (rho *s x) = rho *s (A1n *v x)

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
have "\<dots> = rho *s pow_A_1 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho *s (A1n *v x) = rho *s pow_A_1 x
[PROOF STEP]
unfolding pow_A_1_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho *s (A1n *v x) = rho *s (A1n *v x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
rho *s (A1n *v x) = rho *s pow_A_1 x

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
show "le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)"
[PROOF STATE]
proof (prove)
using this:
le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)

goal (1 subgoal):
 1. le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
le_vec (rho *s pow_A_1 x) (A *v pow_A_1 x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_mult_ket_carrier:
  assumes "A\<in> carrier_mat n m"
shows "A * |v\<rangle> \<in> carrier_mat n 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * |v\<rangle> \<in> carrier_mat n 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n m

goal (1 subgoal):
 1. A * |v\<rangle> \<in> carrier_mat n 1
[PROOF STEP]
by (metis bra_bra_vec bra_vec_carrier carrier_matD(1) carrier_matI dagger_of_ket_is_bra
          dim_row_of_dagger index_mult_mat(2) index_mult_mat(3))


[STATEMENT]
lemma matrix_to_iarray_Gram_Schmidt_upt_k:
  fixes A::"real^'cols::{mod_type}^'rows::{mod_type}"
  assumes k: "k<ncols A"
  shows "matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k < ncols A

goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A 0) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) 0
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < ncols A

goal (2 subgoals):
 1. 0 < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A 0) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) 0
 2. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A 0) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) 0
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def Gram_Schmidt_upt_k_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k A [0..<Suc 0]) = foldl Gram_Schmidt_column_k_iarrays (matrix_to_iarray A) [0..<Suc 0]
[PROOF STEP]
by (simp add: matrix_to_iarray_Gram_Schmidt_column_k[OF "0.prems"])
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A 0) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k
Suc k < ncols A

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
have k: "k<ncols (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

goal (1 subgoal):
 1. k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('cols)

goal (1 subgoal):
 1. k < CARD('cols)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k < ncols (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
have k2: "Suc k < ncols (Gram_Schmidt_upt_k A k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
Suc k < ncols A

goal (1 subgoal):
 1. Suc k < ncols (Gram_Schmidt_upt_k A k)
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
Suc k < CARD('cols)

goal (1 subgoal):
 1. Suc k < CARD('cols)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Suc k < ncols (Gram_Schmidt_upt_k A k)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
have list_rw: "[0..<Suc (Suc k)] = [0..<Suc k] @ [(Suc k)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
have hyp: "matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k
[PROOF STEP]
by (metis Suc.hyps Suc.prems Suc_lessD)
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < ncols A \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A k) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k; Suc k < ncols A\<rbrakk> \<Longrightarrow> matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
show "matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def Gram_Schmidt_upt_k_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k A [0..<Suc (Suc k)]) = foldl Gram_Schmidt_column_k_iarrays (matrix_to_iarray A) [0..<Suc (Suc k)]
[PROOF STEP]
unfolding list_rw
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k A ([0..<Suc k] @ [Suc k])) = foldl Gram_Schmidt_column_k_iarrays (matrix_to_iarray A) ([0..<Suc k] @ [Suc k])
[PROOF STEP]
unfolding foldl_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (foldl Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) [Suc k]) = foldl Gram_Schmidt_column_k_iarrays (foldl Gram_Schmidt_column_k_iarrays (matrix_to_iarray A) [0..<Suc k]) [Suc k]
[PROOF STEP]
unfolding foldl.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (foldl Gram_Schmidt_column_k A [0..<Suc k]) (Suc k)) = Gram_Schmidt_column_k_iarrays (foldl Gram_Schmidt_column_k_iarrays (matrix_to_iarray A) [0..<Suc k]) (Suc k)
[PROOF STEP]
unfolding Gram_Schmidt_upt_k_def[symmetric] Gram_Schmidt_upt_k_iarrays_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = Gram_Schmidt_column_k_iarrays (Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) k) (Suc k)
[PROOF STEP]
unfolding hyp[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (Gram_Schmidt_column_k (Gram_Schmidt_upt_k A k) (Suc k)) = Gram_Schmidt_column_k_iarrays (matrix_to_iarray (Gram_Schmidt_upt_k A k)) (Suc k)
[PROOF STEP]
by (rule matrix_to_iarray_Gram_Schmidt_column_k[OF k2])
[PROOF STATE]
proof (state)
this:
matrix_to_iarray (Gram_Schmidt_upt_k A (Suc k)) = Gram_Schmidt_upt_k_iarrays (matrix_to_iarray A) (Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma msetext_dersh_compat_snoc: "msetext_dersh gt ys xs \<Longrightarrow> msetext_dersh gt (ys @ [x]) (xs @ [x])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msetext_dersh gt ys xs \<Longrightarrow> msetext_dersh gt (ys @ [x]) (xs @ [x])
[PROOF STEP]
using msetext_dersh_compat_cons[of gt ys xs x]
[PROOF STATE]
proof (prove)
using this:
msetext_dersh gt ys xs \<Longrightarrow> msetext_dersh gt (x # ys) (x # xs)

goal (1 subgoal):
 1. msetext_dersh gt ys xs \<Longrightarrow> msetext_dersh gt (ys @ [x]) (xs @ [x])
[PROOF STEP]
unfolding msetext_dersh_def
[PROOF STATE]
proof (prove)
using this:
let N = mset ys; M = mset xs in \<exists>Y X. Y \<noteq> {#} \<and> Y \<subseteq># N \<and> M = N - Y + X \<and> (\<forall>x. x \<in># X \<longrightarrow> (\<exists>y. y \<in># Y \<and> gt y x)) \<Longrightarrow> let N = mset (x # ys); M = mset (x # xs) in \<exists>Y X. Y \<noteq> {#} \<and> Y \<subseteq># N \<and> M = N - Y + X \<and> (\<forall>x. x \<in># X \<longrightarrow> (\<exists>y. y \<in># Y \<and> gt y x))

goal (1 subgoal):
 1. let N = mset ys; M = mset xs in \<exists>Y X. Y \<noteq> {#} \<and> Y \<subseteq># N \<and> M = N - Y + X \<and> (\<forall>x. x \<in># X \<longrightarrow> (\<exists>y. y \<in># Y \<and> gt y x)) \<Longrightarrow> let N = mset (ys @ [x]); M = mset (xs @ [x]) in \<exists>Y X. Y \<noteq> {#} \<and> Y \<subseteq># N \<and> M = N - Y + X \<and> (\<forall>x. x \<in># X \<longrightarrow> (\<exists>y. y \<in># Y \<and> gt y x))
[PROOF STEP]
by simp


[STATEMENT]
lemma vsubset_vsingletonD:
  assumes "A \<subseteq>\<^sub>\<circ> set {x}"
  shows "A = 0 \<or> A = set {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = 0 \<or> A = set {x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq>\<^sub>\<circ> set {x}

goal (1 subgoal):
 1. A = 0 \<or> A = set {x}
[PROOF STEP]
by auto


[STATEMENT]
lemma flatten_power [simp]: "flatten (f ^ m) = flatten (f:: _ \<Rightarrow>\<^sub>0 _::comm_semiring_1) ^ m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flatten (f ^ m) = flatten f ^ m
[PROOF STEP]
by (induct m) (simp_all add: flatten_times)


[STATEMENT]
lemma deriv_deg_0:
  assumes "f \<in> carrier P"
  assumes "degree f = 0"
  assumes "a \<in> carrier R"
  shows "deriv f a = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv f a = \<zero>
[PROOF STEP]
unfolding derivative_def taylor_expansion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R f (X_poly_plus R a) 1 = \<zero>
[PROOF STEP]
using X_plus_closed assms(1) assms(2) assms(3) deg_leE sub_const
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier R \<Longrightarrow> X_poly_plus R ?a \<in> carrier P
f \<in> carrier P
deg R f = 0
a \<in> carrier R
\<lbrakk>?p \<in> carrier P; deg R ?p < ?k\<rbrakk> \<Longrightarrow> ?p ?k = \<zero>
\<lbrakk>?g \<in> carrier P; ?f \<in> carrier P; deg R ?f = 0\<rbrakk> \<Longrightarrow> Cring_Poly.compose R ?f ?g = ?f

goal (1 subgoal):
 1. Cring_Poly.compose R f (X_poly_plus R a) 1 = \<zero>
[PROOF STEP]
by force


[STATEMENT]
lemma dlex_pm_trans: "dlex_pm s t \<Longrightarrow> dlex_pm t u \<Longrightarrow> dlex_pm s u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dlex_pm s t; dlex_pm t u\<rbrakk> \<Longrightarrow> dlex_pm s u
[PROOF STEP]
unfolding dlex_pm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>dord_pm lex_pm s t; dord_pm lex_pm t u\<rbrakk> \<Longrightarrow> dord_pm lex_pm s u
[PROOF STEP]
using lex_pm_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>lex_pm ?s ?t; lex_pm ?t ?u\<rbrakk> \<Longrightarrow> lex_pm ?s ?u

goal (1 subgoal):
 1. \<lbrakk>dord_pm lex_pm s t; dord_pm lex_pm t u\<rbrakk> \<Longrightarrow> dord_pm lex_pm s u
[PROOF STEP]
by (rule dord_pm_trans)


[STATEMENT]
lemma app_invimageI2:
  assumes "a \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ> `\<^sub>\<circ> A"
  shows "a \<in>\<^sub>\<circ> r -`\<^sub>\<circ> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in>\<^sub>\<circ> r -`\<^sub>\<circ> A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ> `\<^sub>\<circ> A

goal (1 subgoal):
 1. a \<in>\<^sub>\<circ> r -`\<^sub>\<circ> A
[PROOF STEP]
unfolding invimage_def
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> r\<inverse>\<^sub>\<circ> `\<^sub>\<circ> A

goal (1 subgoal):
 1. a \<in>\<^sub>\<circ> VLambda (set {\<langle>r, A\<rangle>}) (vsplit (\<lambda>r. (`\<^sub>\<circ>) (r\<inverse>\<^sub>\<circ>)))\<lparr>\<langle>r, A\<rangle>\<rparr>
[PROOF STEP]
by simp


[STATEMENT]
theorem "\<And>(y::int) (z::int) n. Suc n < 6 \<Longrightarrow> 3 dvd z \<Longrightarrow>
    2 dvd (y::int) \<Longrightarrow> (\<exists>(x::int). 2*x = y) \<and> (\<exists>(k::int). 3*k = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y z n. \<lbrakk>Suc n < 6; 3 dvd z; even y\<rbrakk> \<Longrightarrow> (\<exists>x. 2 * x = y) \<and> (\<exists>k. 3 * k = z)
[PROOF STEP]
by cooper


[STATEMENT]
theorem universal_property:
  fixes f :: "'a \<Rightarrow> 'b::group_add"
  shows "\<exists>!g::'a freeword\<Rightarrow>'b. g \<circ> Abs_freeletter = f \<and> UGroupHom g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!g. g \<circ> Abs_freeletter = f \<and> UGroupHom g
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?a \<circ> Abs_freeletter = f \<and> UGroupHom ?a
 2. \<And>g. g \<circ> Abs_freeletter = f \<and> UGroupHom g \<Longrightarrow> g = ?a
[PROOF STEP]
define h where h: "h \<equiv> \<lambda>(s,b). if b then f s else - (f s)"
[PROOF STATE]
proof (state)
this:
h \<equiv> \<lambda>(s, b). if b then f s else - f s

goal (2 subgoals):
 1. ?a \<circ> Abs_freeletter = f \<and> UGroupHom ?a
 2. \<And>g. g \<circ> Abs_freeletter = f \<and> UGroupHom g \<Longrightarrow> g = ?a
[PROOF STEP]
define g where g: "g \<equiv> \<lambda>x. sum_list (map h (freeword x))"
[PROOF STATE]
proof (state)
this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))

goal (2 subgoals):
 1. ?a \<circ> Abs_freeletter = f \<and> UGroupHom ?a
 2. \<And>g. g \<circ> Abs_freeletter = f \<and> UGroupHom g \<Longrightarrow> g = ?a
[PROOF STEP]
from g h
[PROOF STATE]
proof (chain)
picking this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s
[PROOF STEP]
show "g \<circ> Abs_freeletter = f \<and> UGroupHom g"
[PROOF STATE]
proof (prove)
using this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s

goal (1 subgoal):
 1. g \<circ> Abs_freeletter = f \<and> UGroupHom g
[PROOF STEP]
using extend_map_to_freeword_hom1[of f] extend_map_to_freeword_hom2
[PROOF STATE]
proof (prove)
using this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s
(\<Sum>(s, b)\<leftarrow>freeword (Abs_freeletter ?s). if b then f s else - f s) = f ?s
UGroupHom (\<lambda>x. \<Sum>(s, b)\<leftarrow>freeword x. if b then ?f s else - ?f s)

goal (1 subgoal):
 1. g \<circ> Abs_freeletter = f \<and> UGroupHom g
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
g \<circ> Abs_freeletter = f \<and> UGroupHom g

goal (1 subgoal):
 1. \<And>g. g \<circ> Abs_freeletter = f \<and> UGroupHom g \<Longrightarrow> g = (\<lambda>x. \<Sum>(s, b)\<leftarrow>freeword x. if b then f s else - f s)
[PROOF STEP]
from g h
[PROOF STATE]
proof (chain)
picking this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s
[PROOF STEP]
show "\<And>k. k \<circ> Abs_freeletter = f \<and> UGroupHom k \<Longrightarrow> k = g"
[PROOF STATE]
proof (prove)
using this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s

goal (1 subgoal):
 1. \<And>k. k \<circ> Abs_freeletter = f \<and> UGroupHom k \<Longrightarrow> k = g
[PROOF STEP]
using uniqueness_of_extended_map_to_freeword_hom
[PROOF STATE]
proof (prove)
using this:
g \<equiv> \<lambda>x. sum_list (map h (freeword x))
h \<equiv> \<lambda>(s, b). if b then f s else - f s
\<lbrakk>?k \<circ> Abs_freeletter = ?f; UGroupHom ?k\<rbrakk> \<Longrightarrow> ?k = (\<lambda>x. \<Sum>(s, b)\<leftarrow>freeword x. if b then ?f s else - ?f s)

goal (1 subgoal):
 1. \<And>k. k \<circ> Abs_freeletter = f \<and> UGroupHom k \<Longrightarrow> k = g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<circ> Abs_freeletter = f \<and> UGroupHom ?k \<Longrightarrow> ?k = g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((\<lambda>x::real. root 3 (x^3 + x^2 + x + 1) - sqrt (x^2 + x + 1) * ln (exp x + x) / x)
           \<longlongrightarrow> -1/6) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. root 3 (x ^ 3 + x\<^sup>2 + x + 1) - sqrt (x\<^sup>2 + x + 1) * ln (exp x + x) / x) \<longlongrightarrow> - 1 / 6) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma ereal_complete_uminus_eq:
  fixes S :: "ereal set"
  shows "(\<forall>y\<in>uminus`S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>uminus`S. y \<le> z) \<longrightarrow> x \<le> z)
     \<longleftrightarrow> (\<forall>y\<in>S. -x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> -x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>y\<in>uminus ` S. y \<le> x) \<and> (\<forall>z. (\<forall>y\<in>uminus ` S. y \<le> z) \<longrightarrow> x \<le> z)) = ((\<forall>y\<in>S. - x \<le> y) \<and> (\<forall>z. (\<forall>y\<in>S. z \<le> y) \<longrightarrow> z \<le> - x))
[PROOF STEP]
by simp (metis ereal_minus_le_minus ereal_uminus_uminus)


[STATEMENT]
lemma mem_succ_iff [simp]: "Ord j \<Longrightarrow> succ i \<^bold>\<in> succ j \<longleftrightarrow> i \<^bold>\<in> j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord j \<Longrightarrow> (succ i \<^bold>\<in> succ j) = (i \<^bold>\<in> j)
[PROOF STEP]
by (metis Ord_in_Ord Ord_mem_iff_lt Ord_succ succ_def less_eq_insert1_iff less_hf_def succ_iff)


[STATEMENT]
lemma division_to_div: "(of_int x  :: 'a :: floor_ceiling) = of_int y / of_int z \<Longrightarrow> x = y div z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int x = of_int y / of_int z \<Longrightarrow> x = y div z
[PROOF STEP]
by (metis floor_divide_of_int_eq floor_of_int)


[STATEMENT]
lemma Digamma_one_half: "Digamma (1/2) = - euler_mascheroni - of_real (2 * ln 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Digamma ((1::'a) / (2::'a)) = - euler_mascheroni - of_real (2 * ln 2)
[PROOF STEP]
using Digamma_half_integer[of 0]
[PROOF STATE]
proof (prove)
using this:
Digamma (of_nat 0 + (1::?'a) / (2::?'a)) = (\<Sum>k<0. (2::?'a) / of_nat (2 * k + 1)) - euler_mascheroni - of_real (2 * ln 2)

goal (1 subgoal):
 1. Digamma ((1::'a) / (2::'a)) = - euler_mascheroni - of_real (2 * ln 2)
[PROOF STEP]
by simp


[STATEMENT]
lemma list_fast_rec_term1: "ts \<noteq> [] \<Longrightarrow> Leaf \<notin> set ts \<Longrightarrow>
  sum_list (map (size o left) ts) + sum_list (map (size o right) ts) < sum_list (map size ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ts \<noteq> []; \<langle>\<rangle> \<notin> set ts\<rbrakk> \<Longrightarrow> sum_list (map (size \<circ> left) ts) + sum_list (map (size \<circ> right) ts) < sum_list (map size ts)
[PROOF STEP]
apply (clarsimp simp: sum_list_addf[symmetric] sum_list_map_filter')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ts \<noteq> []; \<langle>\<rangle> \<notin> set ts\<rbrakk> \<Longrightarrow> (\<Sum>x\<leftarrow>ts. size (left x) + size (right x)) < sum_list (map size ts)
[PROOF STEP]
apply (rule sum_list_strict_mono; clarsimp?)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>ts \<noteq> []; \<langle>\<rangle> \<notin> set ts; x \<in> set ts\<rbrakk> \<Longrightarrow> size (left x) + size (right x) < size x
[PROOF STEP]
apply (case_tac x; simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arg_minus_pi2_iff:
  shows "z \<noteq> 0 \<and> Arg z = - pi / 2 \<longleftrightarrow> is_imag z \<and> Im z < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<noteq> 0 \<and> Arg z = - pi / 2) = (is_imag z \<and> Im z < 0)
[PROOF STEP]
by (smt arg_pi2_iff complex.expand divide_cancel_right pi_neq_zero is_imag_arg1 is_imag_arg2 zero_complex.simps(1) zero_complex.simps(2))


[STATEMENT]
lemma eval_polyexp_Cons:
  "eval_polyexp (x#xs) = (\<lambda>n. (case x of (a,k,b) \<Rightarrow> a * of_nat n ^ k * b ^ n) + eval_polyexp xs n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_polyexp (x # xs) = (\<lambda>n. (case x of (a, k, b) \<Rightarrow> a * of_nat n ^ k * b ^ n) + eval_polyexp xs n)
[PROOF STEP]
by (simp add: eval_polyexp_def)


[STATEMENT]
lemma closed_UN_well_ordered:
  assumes anti: "antisymmetric (\<Union> XX) (\<sqsubseteq>)"
    and XX: "\<forall>X\<in>XX. well_ordered_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union>XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X)"
  shows "well_ordered_set (\<Union>XX) (\<sqsubseteq>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. well_ordered_set (\<Union> XX) (\<sqsubseteq>)
[PROOF STEP]
apply (intro well_ordered_set.intro closed_UN_well_related anti)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>X\<in>XX. well_related_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X)
[PROOF STEP]
using XX well_ordered_set.axioms
[PROOF STATE]
proof (prove)
using this:
\<forall>X\<in>XX. well_ordered_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X)
well_ordered_set ?A ?less_eq \<Longrightarrow> antisymmetric ?A ?less_eq
well_ordered_set ?A ?less_eq \<Longrightarrow> well_related_set ?A ?less_eq

goal (1 subgoal):
 1. \<forall>X\<in>XX. well_related_set X (\<sqsubseteq>) \<and> (\<forall>x\<in>X. \<forall>y\<in>\<Union> XX. \<not> x \<sqsubseteq> y \<longrightarrow> y \<in> X)
[PROOF STEP]
by fast


[STATEMENT]
lemma f_Exec_Stream_Init_Pre_Post1: "
  \<lbrakk> n < length xs;
    c_n = f_Exec_Comp_Stream_Init trans_fun xs c ! n; x_n = xs ! n \<rbrakk> \<Longrightarrow>
  (P1 x_n \<and> P2 c_n \<longrightarrow> Q (f_Exec_Comp_Stream_Init trans_fun xs c ! Suc n)) =
  (P1 x_n \<and> P2 c_n \<longrightarrow> Q (trans_fun x_n c_n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; c_n = f_Exec_Comp_Stream_Init trans_fun xs c ! n; x_n = xs ! n\<rbrakk> \<Longrightarrow> (P1 x_n \<and> P2 c_n \<longrightarrow> Q (f_Exec_Comp_Stream_Init trans_fun xs c ! Suc n)) = (P1 x_n \<and> P2 c_n \<longrightarrow> Q (trans_fun x_n c_n))
[PROOF STEP]
by (simp add: f_Exec_Stream_Init_nth_Suc_calc)


[STATEMENT]
theorem pull_inv:"pull w1 w2 \<Longrightarrow> (kauff_mat w1) = (kauff_mat w2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pull w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
unfolding pull_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pull_posneg w1 w2 \<or> pull_negpos w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
using pull_posneg_inv pull_negpos_inv
[PROOF STATE]
proof (prove)
using this:
pull_posneg ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0
pull_negpos ?w1.0 ?w2.0 \<Longrightarrow> kauff_mat ?w1.0 = kauff_mat ?w2.0

goal (1 subgoal):
 1. pull_posneg w1 w2 \<or> pull_negpos w1 w2 \<Longrightarrow> kauff_mat w1 = kauff_mat w2
[PROOF STEP]
by auto


[STATEMENT]
lemma nfv_simps[simp]:
  "nfv (Neg \<phi>) = nfv \<phi>"
  "nfv (Or \<phi> \<psi>) = max (nfv \<phi>) (nfv \<psi>)"
  "nfv (Prev I \<phi>) = nfv \<phi>"
  "nfv (Next I \<phi>) = nfv \<phi>"
  "nfv (Since \<phi> I \<psi>) = max (nfv \<phi>) (nfv \<psi>)"
  "nfv (Until \<phi> I \<psi>) = max (nfv \<phi>) (nfv \<psi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (nfv (Neg \<phi>) = nfv \<phi> &&& nfv (Or \<phi> \<psi>) = max (nfv \<phi>) (nfv \<psi>) &&& nfv (Prev I \<phi>) = nfv \<phi>) &&& nfv (Next I \<phi>) = nfv \<phi> &&& nfv (Since \<phi> I \<psi>) = max (nfv \<phi>) (nfv \<psi>) &&& nfv (Until \<phi> I \<psi>) = max (nfv \<phi>) (nfv \<psi>)
[PROOF STEP]
unfolding nfv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Max (insert 0 (Suc ` fv (Neg \<phi>))) = Max (insert 0 (Suc ` fv \<phi>)) &&& Max (insert 0 (Suc ` fv (Or \<phi> \<psi>))) = max (Max (insert 0 (Suc ` fv \<phi>))) (Max (insert 0 (Suc ` fv \<psi>))) &&& Max (insert 0 (Suc ` fv (Prev I \<phi>))) = Max (insert 0 (Suc ` fv \<phi>))) &&& Max (insert 0 (Suc ` fv (Next I \<phi>))) = Max (insert 0 (Suc ` fv \<phi>)) &&& Max (insert 0 (Suc ` fv (Since \<phi> I \<psi>))) = max (Max (insert 0 (Suc ` fv \<phi>))) (Max (insert 0 (Suc ` fv \<psi>))) &&& Max (insert 0 (Suc ` fv (Until \<phi> I \<psi>))) = max (Max (insert 0 (Suc ` fv \<phi>))) (Max (insert 0 (Suc ` fv \<psi>)))
[PROOF STEP]
by (simp_all add: image_Un Max_Un[symmetric])


[STATEMENT]
lemma uminus_in_iff [simp]: "(\<lambda>x. -f x) \<in> L F (g) \<longleftrightarrow> f \<in> L F (g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - f x) \<in> L F g) = (f \<in> L F g)
[PROOF STEP]
using cmult_in_iff[of "-1"]
[PROOF STATE]
proof (prove)
using this:
- (1::'b) \<noteq> (0::'b) \<Longrightarrow> ((\<lambda>x. - (1::'b) * ?f x) \<in> L ?F ?g) = (?f \<in> L ?F ?g)

goal (1 subgoal):
 1. ((\<lambda>x. - f x) \<in> L F g) = (f \<in> L F g)
[PROOF STEP]
by simp


[STATEMENT]
theorem (in Yoneda) Yoneda:
  assumes 1: "A \<in> Ob"
  shows "F\<^bsub>\<o>\<^esub> A \<cong> {u. u : Hom(A,_) \<Rightarrow> F in Func(AA,Set)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F \<^bsub>\<o>\<^esub> A \<cong> {u. u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )}
[PROOF STEP]
unfolding equinumerous_def bij_betw_eq inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. (\<forall>x\<in>F \<^bsub>\<o>\<^esub> A. \<forall>y\<in>F \<^bsub>\<o>\<^esub> A. f x = f y \<longrightarrow> x = y) \<and> (\<forall>y\<in>Collect (natural_transformation AA Set Hom(A,_) F). \<exists>x\<in>F \<^bsub>\<o>\<^esub> A. f x = y) \<and> (\<forall>x\<in>F \<^bsub>\<o>\<^esub> A. f x \<in> Collect (natural_transformation AA Set Hom(A,_) F))
[PROOF STEP]
proof (intro exI conjI bexI ballI impI)
  \<comment> \<open>Sandwich is injective\<close>
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> F \<^bsub>\<o>\<^esub> A; y \<in> F \<^bsub>\<o>\<^esub> A; ?f x = ?f y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?f (?x5 y) = y
 3. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 4. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> ?f x \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
fix x and y
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> F \<^bsub>\<o>\<^esub> A; y \<in> F \<^bsub>\<o>\<^esub> A; ?f x = ?f y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?f (?x5 y) = y
 3. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 4. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> ?f x \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
assume 2: "x \<in> F\<^bsub>\<o>\<^esub> A" and 3: "y \<in> F\<^bsub>\<o>\<^esub> A"
  and 4: "\<sigma>(A,x) = \<sigma>(A,y)"
[PROOF STATE]
proof (state)
this:
x \<in> F \<^bsub>\<o>\<^esub> A
y \<in> F \<^bsub>\<o>\<^esub> A
\<sigma>(A,x) = \<sigma>(A,y)

goal (4 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> F \<^bsub>\<o>\<^esub> A; y \<in> F \<^bsub>\<o>\<^esub> A; ?f x = ?f y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?f (?x5 y) = y
 3. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 4. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> ?f x \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
hence "\<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,x)) = \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,y))"
[PROOF STATE]
proof (prove)
using this:
x \<in> F \<^bsub>\<o>\<^esub> A
y \<in> F \<^bsub>\<o>\<^esub> A
\<sigma>(A,x) = \<sigma>(A,y)

goal (1 subgoal):
 1. \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,x)) = \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,y))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,x)) = \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,y))

goal (4 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> F \<^bsub>\<o>\<^esub> A; y \<in> F \<^bsub>\<o>\<^esub> A; ?f x = ?f y\<rbrakk> \<Longrightarrow> x = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?f (?x5 y) = y
 3. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 4. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> ?f x \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
with unsandwich_left_inverse
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?A \<in> Ob; ?a \<in> F \<^bsub>\<o>\<^esub> ?A\<rbrakk> \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(?A,\<sigma>(?A,?a)) = ?a
\<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,x)) = \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,y))
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> Ob; ?a \<in> F \<^bsub>\<o>\<^esub> ?A\<rbrakk> \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(?A,\<sigma>(?A,?a)) = ?a
\<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,x)) = \<sigma>\<^sup>\<leftarrow>(A,\<sigma>(A,y))

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (simp add: 1 2 3)
[PROOF STATE]
proof (state)
this:
x = y

goal (3 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>(A,?x5 y) = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 3. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
next
  \<comment> \<open>Sandwich covers F A\<close>
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>(A,?x5 y) = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 3. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
fix u
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>(A,?x5 y) = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 3. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
assume "u \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA,Set)}"
[PROOF STATE]
proof (state)
this:
u \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA , Set )}

goal (3 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>(A,?x5 y) = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 3. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
hence 2: "u : Hom(A,_) \<Rightarrow> F in Func (AA,Set)"
[PROOF STATE]
proof (prove)
using this:
u \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA , Set )}

goal (1 subgoal):
 1. u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )

goal (3 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>(A,?x5 y) = y
 2. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> ?x5 y \<in> F \<^bsub>\<o>\<^esub> A
 3. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
A \<in> Ob
u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )
[PROOF STEP]
show "\<sigma>(A,\<sigma>\<^sup>\<leftarrow>(A,u)) = u"
[PROOF STATE]
proof (prove)
using this:
A \<in> Ob
u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )

goal (1 subgoal):
 1. \<sigma>(A,\<sigma>\<^sup>\<leftarrow>(A,u)) = u
[PROOF STEP]
by (rule unsandwich_right_inverse)
  \<comment> \<open>Sandwich is into F A\<close>
[PROOF STATE]
proof (state)
this:
\<sigma>(A,\<sigma>\<^sup>\<leftarrow>(A,u)) = u

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
(* there is really similar reasoning elsewhere*)
[PROOF STATE]
proof (state)
this:
\<sigma>(A,\<sigma>\<^sup>\<leftarrow>(A,u)) = u

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
from 1 and 2
[PROOF STATE]
proof (chain)
picking this:
A \<in> Ob
u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )
[PROOF STEP]
have "u A \<in> hom Set (Hom A A) (F\<^bsub>\<o>\<^esub> A)"
[PROOF STATE]
proof (prove)
using this:
A \<in> Ob
u : Hom(A,_) \<Rightarrow> F in Func (AA , Set )

goal (1 subgoal):
 1. u A \<in> Hom\<^bsub>Set\<^esub> (Hom A A) F \<^bsub>\<o>\<^esub> A
[PROOF STEP]
by (simp add: natural_transformation_def natural_transformation_axioms_def homf_def)
[PROOF STATE]
proof (state)
this:
u A \<in> Hom\<^bsub>Set\<^esub> (Hom A A) F \<^bsub>\<o>\<^esub> A

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
hence "u A \<in> ar Set" and "dom Set (u A) = Hom A A" and "cod Set (u A) = F\<^bsub>\<o>\<^esub> A"
[PROOF STATE]
proof (prove)
using this:
u A \<in> Hom\<^bsub>Set\<^esub> (Hom A A) F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. u A \<in> Ar\<^bsub>Set\<^esub> &&& Dom\<^bsub>Set\<^esub> u A = Hom A A &&& Cod\<^bsub>Set\<^esub> u A = F \<^bsub>\<o>\<^esub> A
[PROOF STEP]
by (simp_all add: hom_def)
[PROOF STATE]
proof (state)
this:
u A \<in> Ar\<^bsub>Set\<^esub>
Dom\<^bsub>Set\<^esub> u A = Hom A A
Cod\<^bsub>Set\<^esub> u A = F \<^bsub>\<o>\<^esub> A

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
hence uAfuncset: "set_func (u A) : (Hom A A) \<rightarrow> (F\<^bsub>\<o>\<^esub> A)"
[PROOF STATE]
proof (prove)
using this:
u A \<in> Ar\<^bsub>Set\<^esub>
Dom\<^bsub>Set\<^esub> u A = Hom A A
Cod\<^bsub>Set\<^esub> u A = F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. set_func (u A) \<in> Hom A A \<rightarrow> F \<^bsub>\<o>\<^esub> A
[PROOF STEP]
by (simp add: Set_def set_cat_def set_arrow_def)
[PROOF STATE]
proof (state)
this:
set_func (u A) \<in> Hom A A \<rightarrow> F \<^bsub>\<o>\<^esub> A

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
A \<in> Ob
[PROOF STEP]
have "Id A \<in> Hom A A"
[PROOF STATE]
proof (prove)
using this:
A \<in> Ob

goal (1 subgoal):
 1. Id A \<in> Hom A A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Id A \<in> Hom A A

goal (2 subgoals):
 1. \<And>y. y \<in> Collect (natural_transformation AA Set Hom(A,_) F) \<Longrightarrow> \<sigma>\<^sup>\<leftarrow>(A,y) \<in> F \<^bsub>\<o>\<^esub> A
 2. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
with uAfuncset
[PROOF STATE]
proof (chain)
picking this:
set_func (u A) \<in> Hom A A \<rightarrow> F \<^bsub>\<o>\<^esub> A
Id A \<in> Hom A A
[PROOF STEP]
show "\<sigma>\<^sup>\<leftarrow>(A,u) \<in> F\<^bsub>\<o>\<^esub> A"
[PROOF STATE]
proof (prove)
using this:
set_func (u A) \<in> Hom A A \<rightarrow> F \<^bsub>\<o>\<^esub> A
Id A \<in> Hom A A

goal (1 subgoal):
 1. \<sigma>\<^sup>\<leftarrow>(A,u) \<in> F \<^bsub>\<o>\<^esub> A
[PROOF STEP]
by (simp add: unsandwich_def, rule funcset_mem)
[PROOF STATE]
proof (state)
this:
\<sigma>\<^sup>\<leftarrow>(A,u) \<in> F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
assume "x \<in> F\<^bsub>\<o>\<^esub> A"
[PROOF STATE]
proof (state)
this:
x \<in> F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
A \<in> Ob
x \<in> F \<^bsub>\<o>\<^esub> A
[PROOF STEP]
have "\<sigma>(A,x) : Hom(A,_) \<Rightarrow> F in Func (AA,Set)"
[PROOF STATE]
proof (prove)
using this:
A \<in> Ob
x \<in> F \<^bsub>\<o>\<^esub> A

goal (1 subgoal):
 1. \<sigma>(A,x) : Hom(A,_) \<Rightarrow> F in Func (AA , Set )
[PROOF STEP]
by (rule sandwich_natural)
[PROOF STATE]
proof (state)
this:
\<sigma>(A,x) : Hom(A,_) \<Rightarrow> F in Func (AA , Set )

goal (1 subgoal):
 1. \<And>x. x \<in> F \<^bsub>\<o>\<^esub> A \<Longrightarrow> \<sigma>(A,x) \<in> Collect (natural_transformation AA Set Hom(A,_) F)
[PROOF STEP]
thus "\<sigma>(A,x) \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA,Set)}"
[PROOF STATE]
proof (prove)
using this:
\<sigma>(A,x) : Hom(A,_) \<Rightarrow> F in Func (AA , Set )

goal (1 subgoal):
 1. \<sigma>(A,x) \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA , Set )}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<sigma>(A,x) \<in> {y. y : Hom(A,_) \<Rightarrow> F in Func (AA , Set )}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_inv_points:
  assumes "construct_path_inv q x y D W \<and> q \<noteq> x"
  shows "point q"
    and "point (choose_point (D*q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point q &&& point (choose_point (D * q))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(is_acyclic D \<and> point x \<and> point y \<and> point q \<and> D\<^sup>\<star> * q \<le> D\<^sup>T\<^sup>\<star> * x \<and> W \<le> D \<and> terminating_path W \<and> (W = 0) = (q = y) \<and> (W \<noteq> 0) = (q = start_points W \<and> y = end_points W)) \<and> q \<noteq> x

goal (1 subgoal):
 1. point q &&& point (choose_point (D * q))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. point (choose_point (D * q))
[PROOF STEP]
by (metis assms choose_point_point comp_assoc is_vector_def point_def reachable_implies_predecessor)


[STATEMENT]
lemma polyfun_rootbound: (*COMPLEX_POLYFUN_ROOTBOUND in HOL Light*)
  fixes c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
  assumes "c k \<noteq> 0" "k\<le>n"
  shows "finite {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<and> card {z. (\<Sum>i\<le>n. c(i) * z^i) = 0} \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c k \<noteq> (0::'a)
k \<le> n

goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n
[PROOF STEP]
proof (induction n arbitrary: c k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> 0\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<le> 0
 2. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
c k \<noteq> (0::'a)
k \<le> 0

goal (2 subgoals):
 1. \<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> 0\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<le> 0
 2. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c k \<noteq> (0::'a)
k \<le> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
c k \<noteq> (0::'a)
k \<le> 0

goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>0. c i * z ^ i) = (0::'a)} \<le> 0

goal (1 subgoal):
 1. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
case (Suc m c k)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?c ?k \<noteq> (0::'a); ?k \<le> m\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>m. ?c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>m. ?c i * z ^ i) = (0::'a)} \<le> m
c k \<noteq> (0::'a)
k \<le> Suc m

goal (1 subgoal):
 1. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
let ?succase = ?case
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n c k. \<lbrakk>\<And>c k. \<lbrakk>c k \<noteq> (0::'a); k \<le> n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>n. c i * z ^ i) = (0::'a)} \<le> n; c k \<noteq> (0::'a); k \<le> Suc n\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc n. c i * z ^ i) = (0::'a)} \<le> Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
proof (cases "{z. (\<Sum>i\<le>Suc m. c(i) * z^i) = 0} = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
 2. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = {}

goal (2 subgoals):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
 2. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = {}
[PROOF STEP]
show ?succase
[PROOF STATE]
proof (prove)
using this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = {}

goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {}

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {}
[PROOF STEP]
obtain z0 where z0: "(\<Sum>i\<le>Suc m. c(i) * z0^i) = 0"
[PROOF STATE]
proof (prove)
using this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {}

goal (1 subgoal):
 1. (\<And>z0. (\<Sum>i\<le>Suc m. c i * z0 ^ i) = (0::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc m. c i * z0 ^ i) = (0::'a)

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>Suc m. c i * z0 ^ i) = (0::'a)
[PROOF STEP]
obtain b where b: "\<And>w. (\<Sum>i\<le>Suc m. c i * w^i) = (w - z0) * (\<Sum>i\<le>m. b i * w^i)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc m. c i * z0 ^ i) = (0::'a)

goal (1 subgoal):
 1. (\<And>b. (\<And>w. (\<Sum>i\<le>Suc m. c i * w ^ i) = (w - z0) * (\<Sum>i\<le>m. b i * w ^ i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using polyfun_linear_factor_root [OF z0, unfolded lessThan_Suc_atMost]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc m. c i * z0 ^ i) = (0::'a)
(\<And>b. (\<And>z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (z - z0) * (\<Sum>i\<le>m. b i * z ^ i)) \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>b. (\<And>w. (\<Sum>i\<le>Suc m. c i * w ^ i) = (w - z0) * (\<Sum>i\<le>m. b i * w ^ i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (?w - z0) * (\<Sum>i\<le>m. b i * ?w ^ i)

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (?w - z0) * (\<Sum>i\<le>m. b i * ?w ^ i)
[PROOF STEP]
have eq: "{z. (\<Sum>i\<le>Suc m. c i * z^i) = 0} = insert z0 {z. (\<Sum>i\<le>m. b i * z^i) = 0}"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (?w - z0) * (\<Sum>i\<le>m. b i * ?w ^ i)

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = insert z0 {z. (\<Sum>i\<le>m. b i * z ^ i) = (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} = insert z0 {z. (\<Sum>i\<le>m. b i * z ^ i) = (0::'a)}

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
have "\<not> (\<forall>k\<le>m. b k = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<forall>k\<le>m. b k = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>k\<le>m. b k = (0::'a) \<Longrightarrow> False
[PROOF STEP]
assume [simp]: "\<forall>k\<le>m. b k = 0"
[PROOF STATE]
proof (state)
this:
\<forall>k\<le>m. b k = (0::'a)

goal (1 subgoal):
 1. \<forall>k\<le>m. b k = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>k\<le>m. b k = (0::'a)
[PROOF STEP]
have "\<And>w. (\<Sum>i\<le>m. b i * w^i) = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>k\<le>m. b k = (0::'a)

goal (1 subgoal):
 1. \<And>w. (\<Sum>i\<le>m. b i * w ^ i) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>m. b i * ?w ^ i) = (0::'a)

goal (1 subgoal):
 1. \<forall>k\<le>m. b k = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>m. b i * ?w ^ i) = (0::'a)
[PROOF STEP]
have "\<And>w. (\<Sum>i\<le>Suc m. c i * w^i) = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>m. b i * ?w ^ i) = (0::'a)

goal (1 subgoal):
 1. \<And>w. (\<Sum>i\<le>Suc m. c i * w ^ i) = (0::'a)
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>m. b i * ?w ^ i) = (0::'a)
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (?w - z0) * (\<Sum>i\<le>m. b i * ?w ^ i)

goal (1 subgoal):
 1. \<And>w. (\<Sum>i\<le>Suc m. c i * w ^ i) = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (0::'a)

goal (1 subgoal):
 1. \<forall>k\<le>m. b k = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (0::'a)
[PROOF STEP]
have "\<And>k. k \<le> Suc m \<Longrightarrow> c k = 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (0::'a)

goal (1 subgoal):
 1. \<And>k. k \<le> Suc m \<Longrightarrow> c k = (0::'a)
[PROOF STEP]
using zero_polynom_imp_zero_coeffs
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>Suc m. c i * ?w ^ i) = (0::'a)
\<lbrakk>\<And>w. (\<Sum>i\<le>?n. ?c i * w ^ i) = (0::?'a); ?k \<le> ?n\<rbrakk> \<Longrightarrow> ?c ?k = (0::?'a)

goal (1 subgoal):
 1. \<And>k. k \<le> Suc m \<Longrightarrow> c k = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?k \<le> Suc m \<Longrightarrow> c ?k = (0::'a)

goal (1 subgoal):
 1. \<forall>k\<le>m. b k = (0::'a) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k \<le> Suc m \<Longrightarrow> c ?k = (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
?k \<le> Suc m \<Longrightarrow> c ?k = (0::'a)

goal (1 subgoal):
 1. False
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
?k \<le> Suc m \<Longrightarrow> c ?k = (0::'a)
c k \<noteq> (0::'a)
k \<le> Suc m

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>k\<le>m. b k = (0::'a))

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>k\<le>m. b k = (0::'a))
[PROOF STEP]
obtain k' where bk': "b k' \<noteq> 0" "k' \<le> m"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>k\<le>m. b k = (0::'a))

goal (1 subgoal):
 1. (\<And>k'. \<lbrakk>b k' \<noteq> (0::'a); k' \<le> m\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b k' \<noteq> (0::'a)
k' \<le> m

goal (1 subgoal):
 1. {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<noteq> {} \<Longrightarrow> finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
show ?succase
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
using Suc.IH [of b k'] bk'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b k' \<noteq> (0::'a); k' \<le> m\<rbrakk> \<Longrightarrow> finite {z. (\<Sum>i\<le>m. b i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>m. b i * z ^ i) = (0::'a)} \<le> m
b k' \<noteq> (0::'a)
k' \<le> m

goal (1 subgoal):
 1. finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m
[PROOF STEP]
by (simp add: eq card_insert_if del: sum.atMost_Suc)
[PROOF STATE]
proof (state)
this:
finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
finite {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<and> card {z. (\<Sum>i\<le>Suc m. c i * z ^ i) = (0::'a)} \<le> Suc m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_mapWithIndex[simp]: "length (mapWithIndex f xs) = length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (mapWithIndex f xs) = length xs
[PROOF STEP]
unfolding mapWithIndex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (map (\<lambda>(x, y). f x y) (enumerate 0 xs)) = length xs
[PROOF STEP]
by simp


[STATEMENT]
lemma int_card_UNION:
  assumes "finite A"
    and "\<forall>k \<in> A. finite k"
  shows "int (card (\<Union>A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter>I)))"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "?rhs = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter>I. 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I))) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I))) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I))) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (\<Sum>_\<in>\<Inter>I. (- 1) ^ (card I + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1))
[PROOF STEP]
by (subst sum_distrib_left) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * (\<Sum>_\<in>\<Inter> I. 1)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>(I, _)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} Inter. (- 1) ^ (card I + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1))
[PROOF STEP]
by (subst sum.Sigma) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. \<Sum>_\<in>\<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter>I}). (- 1) ^ (card I + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))
[PROOF STEP]
by (rule sum.reindex_cong [where l = "\<lambda>(x, y). (y, x)"]) (auto intro: inj_onI)
[PROOF STATE]
proof (state)
this:
(\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(I, uu_)\<in>Sigma {I. I \<subseteq> A \<and> I \<noteq> {}} \<Inter>. (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>(x, I)\<in>(SIGMA x:\<Union>A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter>I}). (- 1) ^ (card I + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. (\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))
[PROOF STEP]
by (auto intro!: sum.mono_neutral_cong_right finite_SigmaI2 intro: finite_subset[where B="\<Union>A"])
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, I)\<in>(SIGMA x:UNIV. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>\<Union>A. (\<Sum>I|I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter>I. (- 1) ^ (card I + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. (\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1))
[PROOF STEP]
by (subst sum.Sigma) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(x, I)\<in>(SIGMA x:\<Union> A. {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}). (- 1) ^ (card I + 1)) = (\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = (\<Sum>_\<in>\<Union>A. 1)" (is "sum ?lhs _ = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>_\<in>\<Union> A. 1)
[PROOF STEP]
proof (rule sum.cong[OF refl])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
assume x: "x \<in> \<Union>A"
[PROOF STATE]
proof (state)
this:
x \<in> \<Union> A

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
define K where "K = {X \<in> A. x \<in> X}"
[PROOF STATE]
proof (state)
this:
K = {X \<in> A. x \<in> X}

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
with \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
finite A
K = {X \<in> A. x \<in> X}
[PROOF STEP]
have K: "finite K"
[PROOF STATE]
proof (prove)
using this:
finite A
K = {X \<in> A. x \<in> X}

goal (1 subgoal):
 1. finite K
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite K

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
let ?I = "\<lambda>i. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "inj_on snd (SIGMA i:{1..card A}. ?I i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})
[PROOF STEP]
by (auto intro!: inj_onI)
[PROOF STATE]
proof (state)
this:
inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have [symmetric]: "snd ` (SIGMA i:{1..card A}. ?I i) = {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter>I}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}) = {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. snd ` (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}) = {I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I}
[PROOF STEP]
by (auto intro!: rev_image_eqI[where x="(card a, a)" for a]
        simp add: card_gt_0_iff[folded Suc_le_eq]
        dest: finite_subset intro: card_mono)
[PROOF STATE]
proof (state)
this:
{I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I} = snd ` (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})
{I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I} = snd ` (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})
[PROOF STEP]
have "?lhs x = (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. ?I i). (- 1) ^ (i + 1))"
[PROOF STATE]
proof (prove)
using this:
inj_on snd (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})
{I. I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I} = snd ` (SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I})

goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1))
[PROOF STEP]
by (rule sum.reindex_cong [where l = snd]) fastforce
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = (\<Sum>i=1..card A. (\<Sum>I|I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. (- 1) ^ (i + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. (\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1))
[PROOF STEP]
by (subst sum.Sigma) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, I)\<in>(SIGMA i:{1..card A}. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I}). (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = (\<Sum>i=1..card A. (- 1) ^ (i + 1) * (\<Sum>I|I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1))
[PROOF STEP]
by (subst sum_distrib_left) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card A. \<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. (- 1) ^ (i + 1)) = (\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = (\<Sum>i=1..card K. (- 1) ^ (i + 1) * (\<Sum>I|I \<subseteq> K \<and> card I = i. 1))"
      (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1)) = (\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1))
[PROOF STEP]
proof (rule sum.mono_neutral_cong_right[rule_format])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite {1..card A}
 2. {1..card K} \<subseteq> {1..card A}
 3. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 4. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
show "finite {1..card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {1..card A}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {1..card A}

goal (3 subgoals):
 1. {1..card K} \<subseteq> {1..card A}
 2. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 3. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
show "{1..card K} \<subseteq> {1..card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..card K} \<subseteq> {1..card A}
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. {1..card K} \<subseteq> {1..card A}
[PROOF STEP]
by (auto simp add: K_def intro: card_mono)
[PROOF STATE]
proof (state)
this:
{1..card K} \<subseteq> {1..card A}

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
assume "i \<in> {1..card A} - {1..card K}"
[PROOF STATE]
proof (state)
this:
i \<in> {1..card A} - {1..card K}

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {1..card A} - {1..card K}
[PROOF STEP]
have i: "i \<le> card A" "card K < i"
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..card A} - {1..card K}

goal (1 subgoal):
 1. i \<le> card A &&& card K < i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i \<le> card A
card K < i

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
have "{I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I} = {I. I \<subseteq> K \<and> card I = i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I} = {I. I \<subseteq> K \<and> card I = i}
[PROOF STEP]
by (auto simp add: K_def)
[PROOF STATE]
proof (state)
this:
{I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I} = {I. I \<subseteq> K \<and> card I = i}

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I} = {I. I \<subseteq> K \<and> card I = i}

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
have "\<dots> = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {I. I \<subseteq> K \<and> card I = i} = {}
[PROOF STEP]
using \<open>finite A\<close> i
[PROOF STATE]
proof (prove)
using this:
finite A
i \<le> card A
card K < i

goal (1 subgoal):
 1. {I. I \<subseteq> K \<and> card I = i} = {}
[PROOF STEP]
by (auto simp add: K_def dest: card_mono[rotated 1])
[PROOF STATE]
proof (state)
this:
{I. I \<subseteq> K \<and> card I = i} = {}

goal (2 subgoals):
 1. \<And>i. i \<in> {1..card A} - {1..card K} \<Longrightarrow> (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
 2. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
{I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I} = {}
[PROOF STEP]
show "(- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. 1 :: int) = 0"
[PROOF STATE]
proof (prove)
using this:
{I. I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I} = {}

goal (1 subgoal):
 1. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0
[PROOF STEP]
by (metis mult_zero_right sum.empty)
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = 0

goal (1 subgoal):
 1. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
have "(\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter>I. 1) = (\<Sum>I | I \<subseteq> K \<and> card I = i. 1 :: int)"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)
[PROOF STEP]
by (rule sum.cong) (auto simp add: K_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {1..card K} \<Longrightarrow> (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = xa \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (xa + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = xa. 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)
[PROOF STEP]
show "(- 1) ^ (i + 1) * ?lhs = (- 1) ^ (i + 1) * ?rhs"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)

goal (1 subgoal):
 1. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1) = (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1)) = (\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card A. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> A \<and> card I = i \<and> x \<in> \<Inter> I. 1)) = (\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1))

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "{I. I \<subseteq> K \<and> card I = 0} = {{}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {I. I \<subseteq> K \<and> card I = 0} = {{}}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
\<forall>k\<in>A. finite k

goal (1 subgoal):
 1. {I. I \<subseteq> K \<and> card I = 0} = {{}}
[PROOF STEP]
by (auto simp add: card_eq_0_iff K_def dest: finite_subset)
[PROOF STATE]
proof (state)
this:
{I. I \<subseteq> K \<and> card I = 0} = {{}}

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{I. I \<subseteq> K \<and> card I = 0} = {{}}
[PROOF STEP]
have "?rhs = (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1 :: int)) + 1"
[PROOF STATE]
proof (prove)
using this:
{I. I \<subseteq> K \<and> card I = 0} = {{}}

goal (1 subgoal):
 1. (\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) = (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1
[PROOF STEP]
by (subst (2) sum.atLeast_Suc_atMost) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) = (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) = (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = (\<Sum>i = 0..card K. (- 1) * ((- 1) ^ i * int (card K choose i))) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1 = (\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1
[PROOF STEP]
using K
[PROOF STATE]
proof (prove)
using this:
finite K

goal (1 subgoal):
 1. (\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1 = (\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1
[PROOF STEP]
by (subst n_subsets[symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1 = (\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..card K. (- 1) ^ (i + 1) * (\<Sum>I | I \<subseteq> K \<and> card I = i. 1)) + 1 = (\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1 = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1
[PROOF STEP]
by (subst sum_distrib_left[symmetric]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1 = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..card K. - 1 * ((- 1) ^ i * int (card K choose i))) + 1 = - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> =  - ((-1 + 1) ^ card K) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1 = - ((- 1 + 1) ^ card K) + 1
[PROOF STEP]
by (subst binomial_ring) (simp add: ac_simps atMost_atLeast0)
[PROOF STATE]
proof (state)
this:
- (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1 = - ((- 1 + 1) ^ card K) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- (\<Sum>i = 0..card K. (- 1) ^ i * int (card K choose i)) + 1 = - ((- 1 + 1) ^ card K) + 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - ((- 1 + 1) ^ card K) + 1 = 1
[PROOF STEP]
using x K
[PROOF STATE]
proof (prove)
using this:
x \<in> \<Union> A
finite K

goal (1 subgoal):
 1. - ((- 1 + 1) ^ card K) + 1 = 1
[PROOF STEP]
by (auto simp add: K_def card_gt_0_iff)
[PROOF STATE]
proof (state)
this:
- ((- 1 + 1) ^ card K) + 1 = 1

goal (1 subgoal):
 1. \<And>x. x \<in> \<Union> A \<Longrightarrow> (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
show "?lhs x = 1"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1

goal (1 subgoal):
 1. (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>_\<in>\<Union> A. 1)

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>\<Union> A. \<Sum>I | I \<subseteq> A \<and> I \<noteq> {} \<and> x \<in> \<Inter> I. (- 1) ^ (card I + 1)) = (\<Sum>_\<in>\<Union> A. 1)

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
have "\<dots> = int (card (\<Union>A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>_\<in>\<Union> A. 1) = int (card (\<Union> A))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>_\<in>\<Union> A. 1) = int (card (\<Union> A))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I))) = int (card (\<Union> A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I))) = int (card (\<Union> A))

goal (1 subgoal):
 1. int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
int (card (\<Union> A)) = (\<Sum>I | I \<subseteq> A \<and> I \<noteq> {}. (- 1) ^ (card I + 1) * int (card (\<Inter> I)))

goal:
No subgoals!
[PROOF STEP]
qed