[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


[STATEMENT]
lemma maddux_3_19:
  "(-x \<sqinter> y) \<squnion> (x \<sqinter> z) = (x \<squnion> y) \<sqinter> (-x \<squnion> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<sqinter> y \<squnion> x \<sqinter> z = (x \<squnion> y) \<sqinter> (- x \<squnion> z)
[PROOF STEP]
using maddux_3_19_pp
[PROOF STATE]
proof (prove)
using this:
- ?x \<sqinter> ?y \<squnion> - - ?x \<sqinter> ?z = (- - ?x \<squnion> ?y) \<sqinter> (- ?x \<squnion> ?z)

goal (1 subgoal):
 1. - x \<sqinter> y \<squnion> x \<sqinter> z = (x \<squnion> y) \<sqinter> (- x \<squnion> z)
[PROOF STEP]
by auto


[STATEMENT]
lemma lcm_int_int_eq [simp]:
  "lcm (int m) (int n) = int (lcm m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm (int m) (int n) = int (lcm m n)
[PROOF STEP]
by (simp add: lcm_int_def)


[STATEMENT]
lemma not_distinct_map: "a\<in>set l \<Longrightarrow> b\<in>set l \<Longrightarrow> a\<noteq>b \<Longrightarrow> \<alpha> a = \<alpha> b \<Longrightarrow> \<not> distinct (map \<alpha> l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> set l; b \<in> set l; a \<noteq> b; \<alpha> a = \<alpha> b\<rbrakk> \<Longrightarrow> \<not> distinct (map \<alpha> l)
[PROOF STEP]
by (meson distinct_map_eq)


[STATEMENT]
lemma infsum_uminus:
  fixes f :: \<open>'a \<Rightarrow> 'b::{topological_ab_group_add, t2_space}\<close>
  shows \<open>infsum (\<lambda>x. - f x) A = - infsum f A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^sub>\<infinity>x\<in>A. - f x) = - infsum f A
[PROOF STEP]
by (metis (full_types) add.inverse_inverse add.inverse_neutral infsumI infsum_def has_sum_infsum has_sum_uminus)


[STATEMENT]
lemma coplanar_4_bis :
  assumes "rk {A, B, C} = 3" and "rk {A, C, \<beta>} = 2"
  shows "rk {A, B, C, \<beta>} = 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {A, B, C, \<beta>} = 3
[PROOF STEP]
by (smt assms(1) assms(2) coplanar_4 insert_commute)


[STATEMENT]
lemma (in CRR_market) delta_hedging_trading_strat:
  assumes "N = bernoulli_stream q"
  and "0 < q"
and "q < 1"
and "der \<in> borel_measurable (G matur)"
  shows "trading_strategy (delta_hedging N der matur)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trading_strategy (delta_hedging N der matur)
[PROOF STEP]
unfolding delta_hedging_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trading_strategy (self_fin_delta_pf N der matur (integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)))
[PROOF STEP]
by (simp add: assms self_fin_delta_pf_trad_strat)


[STATEMENT]
lemma rel_list_all2_nthD:
  "\<lbrakk> list_all2 (fun_of S) xs ys; p < size xs \<rbrakk> \<Longrightarrow> (xs!p,ys!p) \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
by (drule list_all2_nthD) auto


[STATEMENT]
lemma distinct_sortet_list_app:
  "\<lbrakk>sorted xs; distinct xs; xs = as @ b # cs\<rbrakk>
  \<Longrightarrow> \<forall> x\<in> set cs. b < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; distinct xs; xs = as @ b # cs\<rbrakk> \<Longrightarrow> \<forall>x\<in>set cs. b < x
[PROOF STEP]
by (metis distinct.simps(2) distinct_append
    antisym_conv2 sorted_wrt.simps(2) sorted_append)


[STATEMENT]
lemma ack2_le_ack1 [iff]: "ack i (Suc j) \<le> ack (Suc i) j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack i (Suc j) \<le> ack (Suc i) j
[PROOF STEP]
proof (induct j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ack i (Suc 0) \<le> ack (Suc i) 0
 2. \<And>j. ack i (Suc j) \<le> ack (Suc i) j \<Longrightarrow> ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ack i (Suc 0) \<le> ack (Suc i) 0
 2. \<And>j. ack i (Suc j) \<le> ack (Suc i) j \<Longrightarrow> ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack i (Suc 0) \<le> ack (Suc i) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ack i (Suc 0) \<le> ack (Suc i) 0

goal (1 subgoal):
 1. \<And>j. ack i (Suc j) \<le> ack (Suc i) j \<Longrightarrow> ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. ack i (Suc j) \<le> ack (Suc i) j \<Longrightarrow> ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
ack i (Suc j) \<le> ack (Suc i) j

goal (1 subgoal):
 1. \<And>j. ack i (Suc j) \<le> ack (Suc i) j \<Longrightarrow> ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)
[PROOF STEP]
by (metis Suc ack.simps(3) ack_le_mono2 le_trans less_ack2 less_eq_Suc_le)
[PROOF STATE]
proof (state)
this:
ack i (Suc (Suc j)) \<le> ack (Suc i) (Suc j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_isotone:
  "w \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> w * x \<le> y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>w \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> w * x \<le> y * z
[PROOF STEP]
using order_trans mult_left_isotone mult_right_isotone
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z
?x \<le> ?y \<Longrightarrow> ?x * ?z \<le> ?y * ?z
?x \<le> ?y \<Longrightarrow> ?z * ?x \<le> ?z * ?y

goal (1 subgoal):
 1. \<lbrakk>w \<le> y; x \<le> z\<rbrakk> \<Longrightarrow> w * x \<le> y * z
[PROOF STEP]
by blast


[STATEMENT]
lemma GF_advice_nested_prop_atoms_card:
  "card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)
[PROOF STEP]
have "card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)
[PROOF STEP]
by (simp add: nested_prop_atoms\<^sub>\<nu>_finite GF_advice_nested_prop_atoms\<^sub>\<nu> card_mono)
[PROOF STATE]
proof (state)
this:
card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)

goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)

goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)
[PROOF STEP]
using nested_prop_atoms\<^sub>\<nu>_card le_trans
[PROOF STATE]
proof (prove)
using this:
card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms\<^sub>\<nu> \<phi> X)
card (nested_prop_atoms\<^sub>\<nu> ?\<phi> ?X) \<le> card (nested_prop_atoms ?\<phi>)
\<lbrakk>?i \<le> ?j; ?j \<le> ?k\<rbrakk> \<Longrightarrow> ?i \<le> ?k

goal (1 subgoal):
 1. card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
card (nested_prop_atoms (\<phi>[X]\<^sub>\<nu>)) \<le> card (nested_prop_atoms \<phi>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma connectedin_iff_connected [simp]: "connectedin euclidean S \<longleftrightarrow> connected S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connectedin euclidean S = connected S
[PROOF STEP]
by (simp add: connected_def connectedin)


[STATEMENT]
lemma adds_zero: "s adds 0 \<longleftrightarrow> (s = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s adds (0::'a)) = (s = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. s adds (0::'a) \<Longrightarrow> s = (0::'a)
 2. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
assume "s adds 0"
[PROOF STATE]
proof (state)
this:
s adds (0::'a)

goal (2 subgoals):
 1. s adds (0::'a) \<Longrightarrow> s = (0::'a)
 2. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
s adds (0::'a)
[PROOF STEP]
obtain k where "0 = s + k"
[PROOF STATE]
proof (prove)
using this:
s adds (0::'a)

goal (1 subgoal):
 1. (\<And>k. (0::'a) = s + k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding adds_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. (0::'a) = s + k

goal (1 subgoal):
 1. (\<And>k. (0::'a) = s + k \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(0::'a) = s + k

goal (2 subgoals):
 1. s adds (0::'a) \<Longrightarrow> s = (0::'a)
 2. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
from this plus_eq_zero[of s k]
[PROOF STATE]
proof (chain)
picking this:
(0::'a) = s + k
s + k = (0::'a) \<Longrightarrow> s = (0::'a)
[PROOF STEP]
show "s = 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) = s + k
s + k = (0::'a) \<Longrightarrow> s = (0::'a)

goal (1 subgoal):
 1. s = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
s = (0::'a)

goal (1 subgoal):
 1. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
assume "s = 0"
[PROOF STATE]
proof (state)
this:
s = (0::'a)

goal (1 subgoal):
 1. s = (0::'a) \<Longrightarrow> s adds (0::'a)
[PROOF STEP]
thus "s adds 0"
[PROOF STATE]
proof (prove)
using this:
s = (0::'a)

goal (1 subgoal):
 1. s adds (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
s adds (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hyp_add_divide_distrib:
  fixes a b c :: "('a :: {inverse, comm_ring_1, division_ring}) hyperdual"
  shows "(a + b) / c = a/c + b/c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a + b) / c = a / c + b / c
[PROOF STEP]
by (simp add: distrib_right hyp_divide_inverse)


[STATEMENT]
lemma indiff_trans [simp]: "x \<approx> y \<Longrightarrow> y \<approx> z \<Longrightarrow> x \<approx> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<succeq> y \<and> y \<succeq> x; y \<succeq> z \<and> z \<succeq> y\<rbrakk> \<Longrightarrow> x \<succeq> z \<and> z \<succeq> x
[PROOF STEP]
by (meson transE transitivity)


[STATEMENT]
lemma length_concat_merge_adj:
  "length (concat (merge_adj xss)) = length (concat xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (concat (merge_adj xss)) = length (concat xss)
[PROOF STEP]
by (induct xss rule: merge_adj.induct) (simp_all add: length_merge)


[STATEMENT]
lemma right_adjoint_preserved_by_iso:
    assumes "is_right_adjoint g"
    and "\<guillemotleft>\<phi> : g \<Rightarrow> g'\<guillemotright>" and "iso \<phi>"
    shows "is_right_adjoint g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
obtain f where f: "adjoint_pair f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. adjoint_pair f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_right_adjoint g
\<guillemotleft>\<phi> : g \<Rightarrow> g'\<guillemotright>
local.iso \<phi>

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

goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
have "adjoint_pair f g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint_pair f g'
[PROOF STEP]
using assms f adjoint_pair_preserved_by_iso [of f g f f \<phi> g']
              adjoint_pair_antipar [of f g]
[PROOF STATE]
proof (prove)
using this:
is_right_adjoint g
\<guillemotleft>\<phi> : g \<Rightarrow> g'\<guillemotright>
local.iso \<phi>
adjoint_pair f g
\<lbrakk>adjoint_pair f g; \<guillemotleft>f : f \<Rightarrow> f\<guillemotright>; local.iso f; \<guillemotleft>\<phi> : g \<Rightarrow> g'\<guillemotright>; local.iso \<phi>\<rbrakk> \<Longrightarrow> adjoint_pair f g'
adjoint_pair f g \<Longrightarrow> ide f
adjoint_pair f g \<Longrightarrow> ide g
adjoint_pair f g \<Longrightarrow> src f = trg g
adjoint_pair f g \<Longrightarrow> src g = trg f

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

goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
adjoint_pair f g'

goal (1 subgoal):
 1. is_right_adjoint g'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_right_adjoint g'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rQuot_rev_lQuot: "rQuot x A = rev ` lQuot x (rev ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rQuot x A = rev ` lQuot x (rev ` A)
[PROOF STEP]
unfolding rQuot_def lQuot_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. xs @ [x] \<in> A} = rev ` {xs. x # xs \<in> rev ` A}
[PROOF STEP]
by (auto simp: rev_swap[symmetric])


[STATEMENT]
lemma decseq_eq_incseq: "decseq X = incseq (\<lambda>n. - X n)"
  for X :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decseq X = incseq (\<lambda>n. - X n)
[PROOF STEP]
by (simp add: decseq_def incseq_def)


[STATEMENT]
lemma matrix_to_iarray_interchange_rows[code_unfold]:
  fixes A::"'a::{semiring_1}^'columns::{mod_type}^'rows::{mod_type}"
  shows "matrix_to_iarray (interchange_rows A i j) = interchange_rows_iarray (matrix_to_iarray A) (to_nat i) (to_nat j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_to_iarray (interchange_rows A i j) = interchange_rows_iarray (matrix_to_iarray A) (mod_type_class.to_nat i) (mod_type_class.to_nat j)
[PROOF STEP]
proof (unfold matrix_to_iarray_def interchange_rows_iarray_def o_def map_vec_to_iarray_rw, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
assume x_less_card: "x < CARD('rows)"
    and x_not_j: "x \<noteq> to_nat j" and x_not_i: "x \<noteq> to_nat i"
[PROOF STATE]
proof (state)
this:
x < CARD('rows)
x \<noteq> mod_type_class.to_nat j
x \<noteq> mod_type_class.to_nat i

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x < CARD('rows); x \<noteq> mod_type_class.to_nat j; x \<noteq> mod_type_class.to_nat i\<rbrakk> \<Longrightarrow> vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
show "vec_to_iarray (interchange_rows A i j $ from_nat x) = vec_to_iarray (A $ from_nat x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)
[PROOF STEP]
by (metis interchange_rows_preserves to_nat_from_nat_id x_less_card x_not_i x_not_j)
[PROOF STATE]
proof (state)
this:
vec_to_iarray (interchange_rows A i j $ mod_type_class.from_nat x) = vec_to_iarray (A $ mod_type_class.from_nat x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_PiM_Collect:
  assumes space: "f \<in> space N \<rightarrow> (\<Pi>\<^sub>E i\<in>I. space (M i))"
  assumes sets: "\<And>X J. J \<noteq> {} \<or> I = {} \<Longrightarrow> finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)) \<Longrightarrow>
    {\<omega>\<in>space N. \<forall>i\<in>J. f \<omega> i \<in> X i} \<in> sets N"
  shows "f \<in> measurable N (PiM I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M I M
[PROOF STEP]
using sets_PiM prod_algebra_sets_into_space space
[PROOF STATE]
proof (prove)
using this:
sets (Pi\<^sub>M ?I ?M) = sigma_sets (\<Pi>\<^sub>E i\<in>?I. space (?M i)) (prod_algebra ?I ?M)
prod_algebra ?I ?M \<subseteq> Pow (\<Pi>\<^sub>E i\<in>?I. space (?M i))
f \<in> space N \<rightarrow> (\<Pi>\<^sub>E i\<in>I. space (M i))

goal (1 subgoal):
 1. f \<in> N \<rightarrow>\<^sub>M Pi\<^sub>M I M
[PROOF STEP]
proof (rule measurable_sigma_sets)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
assume "A \<in> prod_algebra I M"
[PROOF STATE]
proof (state)
this:
A \<in> prod_algebra I M

goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
from prod_algebraE[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>J E. \<lbrakk>A = prod_emb I M J (Pi\<^sub>E J E); finite J; J \<noteq> {} \<or> I = {}; J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> E i \<in> sets (M i)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain J X
    where X:
      "A = prod_emb I M J (Pi\<^sub>E J X)"
      "finite J"
      "J \<noteq> {} \<or> I = {}"
      "J \<subseteq> I"
      "\<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)"
[PROOF STATE]
proof (prove)
using this:
(\<And>J E. \<lbrakk>A = prod_emb I M J (Pi\<^sub>E J E); finite J; J \<noteq> {} \<or> I = {}; J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> E i \<in> sets (M i)\<rbrakk> \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>J X. \<lbrakk>A = prod_emb I M J (Pi\<^sub>E J X); finite J; J \<noteq> {} \<or> I = {}; J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> X i \<in> sets (M i)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = prod_emb I M J (Pi\<^sub>E J X)
finite J
J \<noteq> {} \<or> I = {}
J \<subseteq> I
?i \<in> J \<Longrightarrow> X ?i \<in> sets (M ?i)

goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = prod_emb I M J (Pi\<^sub>E J X)
finite J
J \<noteq> {} \<or> I = {}
J \<subseteq> I
?i \<in> J \<Longrightarrow> X ?i \<in> sets (M ?i)
[PROOF STEP]
have "f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}"
[PROOF STATE]
proof (prove)
using this:
A = prod_emb I M J (Pi\<^sub>E J X)
finite J
J \<noteq> {} \<or> I = {}
J \<subseteq> I
?i \<in> J \<Longrightarrow> X ?i \<in> sets (M ?i)

goal (1 subgoal):
 1. f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}
[PROOF STEP]
using space
[PROOF STATE]
proof (prove)
using this:
A = prod_emb I M J (Pi\<^sub>E J X)
finite J
J \<noteq> {} \<or> I = {}
J \<subseteq> I
?i \<in> J \<Longrightarrow> X ?i \<in> sets (M ?i)
f \<in> space N \<rightarrow> (\<Pi>\<^sub>E i\<in>I. space (M i))

goal (1 subgoal):
 1. f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}
[PROOF STEP]
by (auto simp: prod_emb_def del: PiE_I)
[PROOF STATE]
proof (state)
this:
f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}

goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f -` A \<inter> space N = {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i}

goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
have "\<dots> \<in> sets N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i} \<in> sets N
[PROOF STEP]
using X(3,2,4,5)
[PROOF STATE]
proof (prove)
using this:
J \<noteq> {} \<or> I = {}
finite J
J \<subseteq> I
?i \<in> J \<Longrightarrow> X ?i \<in> sets (M ?i)

goal (1 subgoal):
 1. {\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i} \<in> sets N
[PROOF STEP]
by (rule sets)
[PROOF STATE]
proof (state)
this:
{\<omega> \<in> space N. \<forall>i\<in>J. f \<omega> i \<in> X i} \<in> sets N

goal (1 subgoal):
 1. \<And>y. y \<in> prod_algebra I M \<Longrightarrow> f -` y \<inter> space N \<in> sets N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f -` A \<inter> space N \<in> sets N
[PROOF STEP]
show "f -` A \<inter> space N \<in> sets N"
[PROOF STATE]
proof (prove)
using this:
f -` A \<inter> space N \<in> sets N

goal (1 subgoal):
 1. f -` A \<inter> space N \<in> sets N
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f -` A \<inter> space N \<in> sets N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma split_indicator: "P (indicator S x) \<longleftrightarrow> ((x \<in> S \<longrightarrow> P 1) \<and> (x \<notin> S \<longrightarrow> P 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (indicator S x) = ((x \<in> S \<longrightarrow> P (1::'a)) \<and> (x \<notin> S \<longrightarrow> P (0::'a)))
[PROOF STEP]
unfolding indicator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (of_bool (x \<in> S)) = ((x \<in> S \<longrightarrow> P (1::'a)) \<and> (x \<notin> S \<longrightarrow> P (0::'a)))
[PROOF STEP]
by auto


[STATEMENT]
lemma mset_take_subseteq: "mset (take n xs) \<subseteq># mset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (take n xs) \<subseteq># mset xs
[PROOF STEP]
apply (induct xs arbitrary: n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. mset (take n []) \<subseteq># mset []
 2. \<And>a xs n. (\<And>n. mset (take n xs) \<subseteq># mset xs) \<Longrightarrow> mset (take n (a # xs)) \<subseteq># mset (a # xs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs n. (\<And>n. mset (take n xs) \<subseteq># mset xs) \<Longrightarrow> mset (take n (a # xs)) \<subseteq># mset (a # xs)
[PROOF STEP]
by (case_tac n) simp_all


[STATEMENT]
lemma quasi_ordered_set_cong:
  assumes r: "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> r a b \<longleftrightarrow> r' a b"
  shows "quasi_ordered_set A r \<longleftrightarrow> quasi_ordered_set A r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasi_ordered_set A r = quasi_ordered_set A r'
[PROOF STEP]
by (simp add: quasi_ordered_set_def r cong: reflexive_cong transitive_cong)


[STATEMENT]
lemma llength_lconcat_eqI:
  fixes xss :: "'a llist llist" and yss :: "'b llist llist"
  assumes "llist_all2 (\<lambda>xs ys. llength xs = llength ys) xss yss"
  shows "llength (lconcat xss) = llength (lconcat yss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength (lconcat xss) = llength (lconcat yss)
[PROOF STEP]
apply(rule llist_all2_llengthD[where P="\<lambda>_ _. True"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 (\<lambda>_ _. True) (lconcat xss) (lconcat yss)
[PROOF STEP]
apply(rule llist_all2_lconcatI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 (llist_all2 (\<lambda>_ _. True)) xss yss
[PROOF STEP]
apply(simp add: llist_all2_True[abs_def] assms)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma affine_bounded_eq_trivial:
  fixes S :: "'a::real_normed_vector set"
  assumes "affine S"
    shows "bounded S \<longleftrightarrow> S = {} \<or> (\<exists>a. S = {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
 2. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
 2. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S = {}

goal (1 subgoal):
 1. bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bounded S = (S = {} \<or> (\<exists>a. S = {a}))

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
[PROOF STEP]
obtain b where "b \<in> S"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

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

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
with False assms
[PROOF STATE]
proof (chain)
picking this:
S \<noteq> {}
affine S
b \<in> S
[PROOF STEP]
have "bounded S \<Longrightarrow> S = {b}"
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
affine S
b \<in> S

goal (1 subgoal):
 1. bounded S \<Longrightarrow> S = {b}
[PROOF STEP]
using affine_diffs_subspace [OF assms \<open>b \<in> S\<close>]
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}
affine S
b \<in> S
subspace ((+) (- b) ` S)

goal (1 subgoal):
 1. bounded S \<Longrightarrow> S = {b}
[PROOF STEP]
by (metis (no_types, lifting) ab_group_add_class.ab_left_minus bounded_translation image_empty image_insert subspace_bounded_eq_trivial translation_invert)
[PROOF STATE]
proof (state)
this:
bounded S \<Longrightarrow> S = {b}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
bounded S \<Longrightarrow> S = {b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bounded S \<Longrightarrow> S = {b}

goal (1 subgoal):
 1. bounded S = (S = {} \<or> (\<exists>a. S = {a}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bounded S = (S = {} \<or> (\<exists>a. S = {a}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_all2_set1:
  "\<forall>x\<in>set xs. \<exists>xa\<in>set as. P x xa" if "list_all2 P xs as"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<exists>xa\<in>set as. P x xa
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
list_all2 P xs as

goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<exists>xa\<in>set as. P x xa
[PROOF STEP]
proof (induction xs arbitrary: as)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>as. list_all2 P [] as \<Longrightarrow> \<forall>x\<in>set []. Bex (set as) (P x)
 2. \<And>a xs as. \<lbrakk>\<And>as. list_all2 P xs as \<Longrightarrow> \<forall>x\<in>set xs. Bex (set as) (P x); list_all2 P (a # xs) as\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (a # xs). Bex (set as) (P x)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
list_all2 P [] as

goal (2 subgoals):
 1. \<And>as. list_all2 P [] as \<Longrightarrow> \<forall>x\<in>set []. Bex (set as) (P x)
 2. \<And>a xs as. \<lbrakk>\<And>as. list_all2 P xs as \<Longrightarrow> \<forall>x\<in>set xs. Bex (set as) (P x); list_all2 P (a # xs) as\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (a # xs). Bex (set as) (P x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all2 P [] as
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
list_all2 P [] as

goal (1 subgoal):
 1. \<forall>x\<in>set []. \<exists>a\<in>set as. P x a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set []. \<exists>a\<in>set as. P x a

goal (1 subgoal):
 1. \<And>a xs as. \<lbrakk>\<And>as. list_all2 P xs as \<Longrightarrow> \<forall>x\<in>set xs. Bex (set as) (P x); list_all2 P (a # xs) as\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (a # xs). Bex (set as) (P x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs as. \<lbrakk>\<And>as. list_all2 P xs as \<Longrightarrow> \<forall>x\<in>set xs. Bex (set as) (P x); list_all2 P (a # xs) as\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (a # xs). Bex (set as) (P x)
[PROOF STEP]
case (Cons a xs as)
[PROOF STATE]
proof (state)
this:
list_all2 P xs ?as \<Longrightarrow> \<forall>x\<in>set xs. \<exists>a\<in>set ?as. P x a
list_all2 P (a # xs) as

goal (1 subgoal):
 1. \<And>a xs as. \<lbrakk>\<And>as. list_all2 P xs as \<Longrightarrow> \<forall>x\<in>set xs. Bex (set as) (P x); list_all2 P (a # xs) as\<rbrakk> \<Longrightarrow> \<forall>x\<in>set (a # xs). Bex (set as) (P x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
list_all2 P xs ?as \<Longrightarrow> \<forall>x\<in>set xs. \<exists>a\<in>set ?as. P x a
list_all2 P (a # xs) as
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
list_all2 P xs ?as \<Longrightarrow> \<forall>x\<in>set xs. \<exists>a\<in>set ?as. P x a
list_all2 P (a # xs) as

goal (1 subgoal):
 1. \<forall>x\<in>set (a # xs). \<exists>a\<in>set as. P x a
[PROOF STEP]
by (cases as) auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set (a # xs). \<exists>a\<in>set as. P x a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Left_Coset_eq_sumset:
  assumes "x \<in> G"
  shows "sumset {x} H = x \<cdot>| H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset {x} H = x \<cdot>| H
[PROOF STEP]
using assms Left_Coset_memI sumset.simps
[PROOF STATE]
proof (prove)
using this:
x \<in> G
?h \<in> ?H \<Longrightarrow> ?x \<oplus> ?h \<in> ?x \<cdot>| ?H
(?a \<in> sumset ?A ?B) = (\<exists>a b. ?a = a \<oplus> b \<and> a \<in> ?A \<and> a \<in> G \<and> b \<in> ?B \<and> b \<in> G)

goal (1 subgoal):
 1. sumset {x} H = x \<cdot>| H
[PROOF STEP]
by fastforce


[STATEMENT]
lemma ct_suffix_to_ct_prefix [code]: "ct_suffix xs ys = ct_prefix (rev xs) (rev ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ct_suffix xs ys = ct_prefix (rev xs) (rev ys)
[PROOF STEP]
unfolding ct_suffix_def ct_prefix_def ct_list_eq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>as bs. ys = as @ bs \<and> list_all2 ct_eq bs xs) = (\<exists>as bs. rev ys = as @ bs \<and> list_all2 ct_eq as (rev xs))
[PROOF STEP]
by (metis list_all2_rev1 rev_append rev_rev_ident)


[STATEMENT]
lemma three_stepE:
  "\<lbrakk> three_step r = 0 \<Longrightarrow> P; three_step r = 1 \<Longrightarrow> P; three_step r = 2 \<Longrightarrow> P \<rbrakk> \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>three_step r = 0 \<Longrightarrow> P; three_step r = 1 \<Longrightarrow> P; three_step r = 2 \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by(unfold three_step_def, arith)


[STATEMENT]
lemma finiteVarsClause:
  fixes c :: Clause
  shows "finite (vars c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (vars c)
[PROOF STEP]
by (induct c) auto


[STATEMENT]
lemma funpow_less_iter:
  fixes f :: "('a::order) \<Rightarrow> 'a"
  assumes mono: "\<And>k. k < f k" and m_lt_n: "m < n"
  shows "(f ^^ m) k < (f ^^ n) k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ^^ m) k < (f ^^ n) k
[PROOF STEP]
using m_lt_n
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. (f ^^ m) k < (f ^^ n) k
[PROOF STEP]
by (induct n) (auto, blast intro: mono less_trans dest: less_antisym)


[STATEMENT]
lemma univariate_power_list: assumes "monom_inv m" "univariate_power_list x m = Some n"
  shows "sum_var_list m = (\<lambda> y. if x = y then n else 0)"
   "eval_monom_list \<alpha> m = ((\<alpha> x)^n)"
   "n \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_var_list m = (\<lambda>y. if x = y then n else 0) &&& eval_monom_list \<alpha> m = \<alpha> x ^ n &&& 1 \<le> n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. sum_var_list m = (\<lambda>y. if x = y then n else 0)
 2. eval_monom_list \<alpha> m = \<alpha> x ^ n
 3. 1 \<le> n
[PROOF STEP]
have m: "m = [(x,n)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = [(x, n)]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
monom_inv m
univariate_power_list x m = Some n

goal (1 subgoal):
 1. m = [(x, n)]
[PROOF STEP]
by (induct x m rule: univariate_power_list.induct, auto split: if_splits)
[PROOF STATE]
proof (state)
this:
m = [(x, n)]

goal (3 subgoals):
 1. sum_var_list m = (\<lambda>y. if x = y then n else 0)
 2. eval_monom_list \<alpha> m = \<alpha> x ^ n
 3. 1 \<le> n
[PROOF STEP]
show "eval_monom_list \<alpha> m = ((\<alpha> x)^n)" "sum_var_list m = (\<lambda> y. if x = y then n else 0)"
    "n \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom_list \<alpha> m = \<alpha> x ^ n &&& sum_var_list m = (\<lambda>y. if x = y then n else 0) &&& 1 \<le> n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
monom_inv m

goal (1 subgoal):
 1. eval_monom_list \<alpha> m = \<alpha> x ^ n &&& sum_var_list m = (\<lambda>y. if x = y then n else 0) &&& 1 \<le> n
[PROOF STEP]
unfolding m monom_inv_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>(x, n)\<in>set [(x, n)]. 1 \<le> n) \<and> distinct (map fst [(x, n)]) \<and> sorted (map fst [(x, n)])

goal (1 subgoal):
 1. eval_monom_list \<alpha> [(x, n)] = \<alpha> x ^ n &&& sum_var_list [(x, n)] = (\<lambda>y. if x = y then n else 0) &&& 1 \<le> n
[PROOF STEP]
by (auto simp: sum_var_list_def)
[PROOF STATE]
proof (state)
this:
eval_monom_list \<alpha> m = \<alpha> x ^ n
sum_var_list m = (\<lambda>y. if x = y then n else 0)
1 \<le> n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_list_all2_nthD:
  "\<lbrakk> list_all2 (fun_of S) xs ys; p < size xs \<rbrakk> \<Longrightarrow> (xs!p,ys!p) \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all2 (fun_of S) xs ys; p < length xs\<rbrakk> \<Longrightarrow> (xs ! p, ys ! p) \<in> S
[PROOF STEP]
by (drule list_all2_nthD) auto


[STATEMENT]
lemma nlists_not_empty:
assumes "A \<noteq> {}"
shows "nlists A n \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nlists A n \<noteq> {}
[PROOF STEP]
proof(induct n, simp add: nlists_0)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. nlists A n \<noteq> {} \<Longrightarrow> nlists A (Suc n) \<noteq> {}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. nlists A n \<noteq> {} \<Longrightarrow> nlists A (Suc n) \<noteq> {}
[PROOF STEP]
assume "nlists A n \<noteq> {}"
[PROOF STATE]
proof (state)
this:
nlists A n \<noteq> {}

goal (1 subgoal):
 1. \<And>n. nlists A n \<noteq> {} \<Longrightarrow> nlists A (Suc n) \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nlists A n \<noteq> {}
[PROOF STEP]
obtain a and l where "a \<in> A \<and> l \<in> nlists A n"
[PROOF STATE]
proof (prove)
using this:
nlists A n \<noteq> {}

goal (1 subgoal):
 1. (\<And>a l. a \<in> A \<and> l \<in> nlists A n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
nlists A n \<noteq> {}
A \<noteq> {}

goal (1 subgoal):
 1. (\<And>a l. a \<in> A \<and> l \<in> nlists A n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> A \<and> l \<in> nlists A n

goal (1 subgoal):
 1. \<And>n. nlists A n \<noteq> {} \<Longrightarrow> nlists A (Suc n) \<noteq> {}
[PROOF STEP]
hence "a # l \<in> nlists A (Suc n)"
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<and> l \<in> nlists A n

goal (1 subgoal):
 1. a # l \<in> nlists A (Suc n)
[PROOF STEP]
unfolding nlists_def
[PROOF STATE]
proof (prove)
using this:
a \<in> A \<and> l \<in> {l. set l \<subseteq> A \<and> length l = n}

goal (1 subgoal):
 1. a # l \<in> {l. set l \<subseteq> A \<and> length l = Suc n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a # l \<in> nlists A (Suc n)

goal (1 subgoal):
 1. \<And>n. nlists A n \<noteq> {} \<Longrightarrow> nlists A (Suc n) \<noteq> {}
[PROOF STEP]
thus "nlists A (Suc n) \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
a # l \<in> nlists A (Suc n)

goal (1 subgoal):
 1. nlists A (Suc n) \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nlists A (Suc n) \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_subset_fset_eq:
  shows "xs |\<subseteq>| ys \<Longrightarrow> card_fset ys \<le> card_fset xs \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs |\<subseteq>| ys; card_fset ys \<le> card_fset xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
unfolding card_fset subset_fset
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fset xs \<subseteq> fset ys; card (fset ys) \<le> card (fset xs)\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by (auto dest: card_seteq[OF finite_fset] simp add: fset_cong)


[STATEMENT]
lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) \<Longrightarrow> monoseq X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. X n \<le> X (Suc n) \<Longrightarrow> monoseq X
[PROOF STEP]
by (simp add: monoseq_Suc)


[STATEMENT]
lemma gauss_jordan_take_cols:
  assumes "gauss_jordan A (take_cols A inds) = (C,D)"
  shows "D = take_cols C inds"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
obtain nr nc where A: "A  \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>nr nc. A \<in> carrier_mat nr nc \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat nr nc

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
from take_cols_carrier_mat[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<And>n. take_cols A ?inds \<in> carrier_mat nr n \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis
[PROOF STEP]
obtain n where B: "take_cols A inds \<in> carrier_mat nr n"
[PROOF STATE]
proof (prove)
using this:
(\<And>n. take_cols A ?inds \<in> carrier_mat nr n \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>n. take_cols A inds \<in> carrier_mat nr n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
take_cols A inds \<in> carrier_mat nr n

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
from gauss_jordan_transform[OF A B assms, of undefined]
[PROOF STATE]
proof (chain)
picking this:
\<exists>P\<in>Units (ring_mat TYPE('a) nr undefined). C = P * A \<and> D = P * take_cols A inds
[PROOF STEP]
obtain P where PP:"P\<in>Units (ring_mat TYPE('a) nr undefined)" and
    CD: "C = P * A" "D = P * take_cols A inds"
[PROOF STATE]
proof (prove)
using this:
\<exists>P\<in>Units (ring_mat TYPE('a) nr undefined). C = P * A \<and> D = P * take_cols A inds

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>P \<in> Units (ring_mat TYPE('a) nr undefined); C = P * A; D = P * take_cols A inds\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P \<in> Units (ring_mat TYPE('a) nr undefined)
C = P * A
D = P * take_cols A inds

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
have P: "P \<in> carrier_mat nr nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<in> carrier_mat nr nr
[PROOF STEP]
by (metis (no_types, lifting) Units_def PP mem_Collect_eq partial_object.select_convs(1) ring_mat_def)
[PROOF STATE]
proof (state)
this:
P \<in> carrier_mat nr nr

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
from take_cols_mat_mul[OF P A]
[PROOF STATE]
proof (chain)
picking this:
P * take_cols A ?inds = take_cols (P * A) ?inds
[PROOF STEP]
have "P * take_cols A inds = take_cols (P * A) inds"
[PROOF STATE]
proof (prove)
using this:
P * take_cols A ?inds = take_cols (P * A) ?inds

goal (1 subgoal):
 1. P * take_cols A inds = take_cols (P * A) inds
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
P * take_cols A inds = take_cols (P * A) inds

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
P * take_cols A inds = take_cols (P * A) inds

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
using CD
[PROOF STATE]
proof (prove)
using this:
P * take_cols A inds = take_cols (P * A) inds
C = P * A
D = P * take_cols A inds

goal (1 subgoal):
 1. D = take_cols C inds
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
D = take_cols C inds

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_cnf_encode_sum_0_1_main: assumes "cnf_encode_sum_0_1_main vars = (conds, one, zero)"
  and "vars \<noteq> []"
  shows "sum_list (map size_cnf conds) = 26 * length vars - 20"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map size_cnf conds) = 26 * length vars - 20
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cnf_encode_sum_0_1_main vars = (conds, one, zero)
vars \<noteq> []

goal (1 subgoal):
 1. sum_list (map size_cnf conds) = 26 * length vars - 20
[PROOF STEP]
proof (induct vars arbitrary: conds one zero rule: cnf_encoder.encode_sum_0_1_main.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x zero one conds onea zeroa. \<lbrakk>cnf_encode_sum_0_1_main [(x, zero, one)] = (conds, onea, zeroa); [(x, zero, one)] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [(x, zero, one)] - 20
 2. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 3. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
case (1 x zero' one' conds zero one)
[PROOF STATE]
proof (state)
this:
cnf_encode_sum_0_1_main [(x, zero', one')] = (conds, zero, one)
[(x, zero', one')] \<noteq> []

goal (3 subgoals):
 1. \<And>x zero one conds onea zeroa. \<lbrakk>cnf_encode_sum_0_1_main [(x, zero, one)] = (conds, onea, zeroa); [(x, zero, one)] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [(x, zero, one)] - 20
 2. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 3. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
hence "conds =  [[[(zero, True), (one, True)], [(zero, False), (one, False)]]]"
[PROOF STATE]
proof (prove)
using this:
cnf_encode_sum_0_1_main [(x, zero', one')] = (conds, zero, one)
[(x, zero', one')] \<noteq> []

goal (1 subgoal):
 1. conds = [[[(zero, True), (one, True)], [(zero, False), (one, False)]]]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
conds = [[[(zero, True), (one, True)], [(zero, False), (one, False)]]]

goal (3 subgoals):
 1. \<And>x zero one conds onea zeroa. \<lbrakk>cnf_encode_sum_0_1_main [(x, zero, one)] = (conds, onea, zeroa); [(x, zero, one)] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [(x, zero, one)] - 20
 2. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 3. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
hence "sum_list (map size_cnf conds) = 6"
[PROOF STATE]
proof (prove)
using this:
conds = [[[(zero, True), (one, True)], [(zero, False), (one, False)]]]

goal (1 subgoal):
 1. sum_list (map size_cnf conds) = 6
[PROOF STEP]
by (simp add: size_cnf_def)
[PROOF STATE]
proof (state)
this:
sum_list (map size_cnf conds) = 6

goal (3 subgoals):
 1. \<And>x zero one conds onea zeroa. \<lbrakk>cnf_encode_sum_0_1_main [(x, zero, one)] = (conds, onea, zeroa); [(x, zero, one)] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [(x, zero, one)] - 20
 2. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 3. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sum_list (map size_cnf conds) = 6

goal (1 subgoal):
 1. sum_list (map size_cnf conds) = 26 * length [(x, zero', one')] - 20
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map size_cnf conds) = 26 * length [(x, zero', one')] - 20

goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
case Cons: (2 x zero one r rr conds' zero' one')
[PROOF STATE]
proof (state)
this:
\<lbrakk>cnf_encode_sum_0_1_main (r # rr) = (?conds, ?one, ?zero); r # rr \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf ?conds) = 26 * length (r # rr) - 20
cnf_encode_sum_0_1_main ((x, zero, one) # r # rr) = (conds', zero', one')
(x, zero, one) # r # rr \<noteq> []

goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
let ?triple = "(x,zero,one)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
let ?rest = "r # rr"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
obtain conds fzero fone where res: "cnf_encode_sum_0_1_main ?rest = (conds, fzero, fone)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>conds fzero fone. cnf_encode_sum_0_1_main (r # rr) = (conds, fzero, fone) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases "cnf_encode_sum_0_1_main ?rest", auto)
[PROOF STATE]
proof (state)
this:
cnf_encode_sum_0_1_main (r # rr) = (conds, fzero, fone)

goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
from Cons(2)[unfolded cnf_encoder.encode_sum_0_1_main.simps res split Let_def]
[PROOF STATE]
proof (chain)
picking this:
([[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] # [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)], [(one, False), (x, True), (fone, True)]] # conds, zero, one) = (conds', zero', one')
[PROOF STEP]
have conds': "conds' = [[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] #
    [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)],
    [(one, False), (x, True), (fone, True)]] #
    conds"
[PROOF STATE]
proof (prove)
using this:
([[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] # [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)], [(one, False), (x, True), (fone, True)]] # conds, zero, one) = (conds', zero', one')

goal (1 subgoal):
 1. conds' = [[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] # [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)], [(one, False), (x, True), (fone, True)]] # conds
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
conds' = [[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] # [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)], [(one, False), (x, True), (fone, True)]] # conds

goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
have "sum_list (map size_cnf conds') = 26 + sum_list (map size_cnf conds)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map size_cnf conds') = 26 + sum_list (map size_cnf conds)
[PROOF STEP]
unfolding conds'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map size_cnf ([[(zero, False), (fzero, True)], [(zero, False), (x, False)], [(zero, True), (fzero, False), (x, True)]] # [[(one, True), (x, True), (fone, False)], [(one, True), (x, False), (fzero, False)], [(one, False), (x, False), (fzero, True)], [(one, False), (x, True), (fone, True)]] # conds)) = 26 + sum_list (map size_cnf conds)
[PROOF STEP]
by (simp add: size_cnf_def)
[PROOF STATE]
proof (state)
this:
sum_list (map size_cnf conds') = 26 + sum_list (map size_cnf conds)

goal (2 subgoals):
 1. \<And>x zero one v va conds onea zeroa. \<lbrakk>\<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main (v # va) = (conds, one, zero); v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (v # va) - 20; cnf_encode_sum_0_1_main ((x, zero, one) # v # va) = (conds, onea, zeroa); (x, zero, one) # v # va \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length ((x, zero, one) # v # va) - 20
 2. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
with Cons(1)[OF res]
[PROOF STATE]
proof (chain)
picking this:
r # rr \<noteq> [] \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (r # rr) - 20
sum_list (map size_cnf conds') = 26 + sum_list (map size_cnf conds)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
r # rr \<noteq> [] \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length (r # rr) - 20
sum_list (map size_cnf conds') = 26 + sum_list (map size_cnf conds)

goal (1 subgoal):
 1. sum_list (map size_cnf conds') = 26 * length ((x, zero, one) # r # rr) - 20
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_list (map size_cnf conds') = 26 * length ((x, zero, one) # r # rr) - 20

goal (1 subgoal):
 1. \<And>conds one zero. \<lbrakk>cnf_encode_sum_0_1_main [] = (conds, one, zero); [] \<noteq> []\<rbrakk> \<Longrightarrow> sum_list (map size_cnf conds) = 26 * length [] - 20
[PROOF STEP]
qed auto


[STATEMENT]
lemma sum_upto_add_nat:
  "a \<le> b \<Longrightarrow> sum f {..<(a :: nat)} + sum f {a..<b} = sum f {..<b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> sum f {..<a} + sum f {a..<b} = sum f {..<b}
[PROOF STEP]
by (metis atLeast0LessThan le0 sum.atLeastLessThan_concat)


[STATEMENT]
lemma (in group) trivial_normal_series:
  shows "normal_series G [{\<one>}, carrier G]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normal_series G [{\<one>}, carrier G]
[PROOF STEP]
unfolding normal_series_def normal_series_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G \<and> ([{\<one>}, carrier G] \<noteq> [] \<and> hd [{\<one>}, carrier G] = {\<one>}) \<and> last [{\<one>}, carrier G] = carrier G \<and> (\<forall>i. i + 1 < length [{\<one>}, carrier G] \<longrightarrow> [{\<one>}, carrier G] ! i \<lhd> G\<lparr>carrier := [{\<one>}, carrier G] ! (i + 1)\<rparr>)
[PROOF STEP]
using is_group trivial_subgroup_is_normal
[PROOF STATE]
proof (prove)
using this:
Group.group G
{\<one>} \<lhd> G

goal (1 subgoal):
 1. Group.group G \<and> ([{\<one>}, carrier G] \<noteq> [] \<and> hd [{\<one>}, carrier G] = {\<one>}) \<and> last [{\<one>}, carrier G] = carrier G \<and> (\<forall>i. i + 1 < length [{\<one>}, carrier G] \<longrightarrow> [{\<one>}, carrier G] ! i \<lhd> G\<lparr>carrier := [{\<one>}, carrier G] ! (i + 1)\<rparr>)
[PROOF STEP]
by auto


[STATEMENT]
lemma pathin_canon_iff: "pathin (top_of_set T) g \<longleftrightarrow> path g \<and> g ` {0..1} \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathin (top_of_set T) g = (path g \<and> g ` {0..1} \<subseteq> T)
[PROOF STEP]
by (simp add: path_def pathin_def)


[STATEMENT]
lemma partJoin_commute:
"partJoin P Q = partJoin Q P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partJoin P Q = partJoin Q P
[PROOF STEP]
unfolding partJoin_def partGen_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {gen (P \<union> Q) I |I. I \<in> P \<union> Q} = {gen (Q \<union> P) I |I. I \<in> Q \<union> P}
[PROOF STEP]
using Un_commute
[PROOF STATE]
proof (prove)
using this:
?A \<union> ?B = ?B \<union> ?A

goal (1 subgoal):
 1. {gen (P \<union> Q) I |I. I \<in> P \<union> Q} = {gen (Q \<union> P) I |I. I \<in> Q \<union> P}
[PROOF STEP]
by metis


[STATEMENT]
lemma dims_A'_pow:
shows "dim_row (A' ws) = (last rs) ^ N_half" "dim_col (A' ws) = (last rs) ^ N_half"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (A' ws) = last rs ^ N_half &&& dim_col (A' ws) = last rs ^ N_half
[PROOF STEP]
unfolding dims_A' dims_A nths_replicate set_le_in card_even card_odd prod_list_replicate
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last rs ^ N_half = last rs ^ N_half &&& last rs ^ N_half = last rs ^ N_half
[PROOF STEP]
by simp_all


[STATEMENT]
lemma set_spmf_mk_lossless [simp]: "set_spmf (mk_lossless p) = set_spmf p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_spmf (mk_lossless p) = set_spmf p
[PROOF STEP]
by(simp add: mk_lossless_def set_scale_spmf measure_spmf_zero_iff zero_less_measure_iff)


[STATEMENT]
lemma subdegree_0 [simp]: "subdegree 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdegree 0 = 0
[PROOF STEP]
by (simp add: subdegree_def)


[STATEMENT]
lemma sum_eq_empty_iff:
  assumes "finite A"
  shows "sum f A = {#} \<longleftrightarrow> (\<forall>a\<in>A. f a = {#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum f A = {#}) = (\<forall>a\<in>A. f a = {#})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (sum f A = {#}) = (\<forall>a\<in>A. f a = {#})
[PROOF STEP]
by induct simp_all


[STATEMENT]
lemma subset_inext_in_iff: "A \<subseteq> B \<Longrightarrow> (inext n A \<in> B) = (n \<in> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<Longrightarrow> (inext n A \<in> B) = (n \<in> B)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> B; inext n A \<in> B\<rbrakk> \<Longrightarrow> n \<in> B
 2. \<lbrakk>A \<subseteq> B; n \<in> B\<rbrakk> \<Longrightarrow> inext n A \<in> B
[PROOF STEP]
apply (rule subset_inext_in_imp_in, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; n \<in> B\<rbrakk> \<Longrightarrow> inext n A \<in> B
[PROOF STEP]
apply (rule subset_inext_closed, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bin_nth_conv_AND:
  fixes x :: int shows
  "(bit :: int \<Rightarrow> nat \<Rightarrow> bool) x n \<longleftrightarrow> x AND (push_bit n 1) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit x n = (x AND push_bit n 1 \<noteq> 0)
[PROOF STEP]
by (fact bit_iff_and_push_bit_not_eq_0)