[STATEMENT]
lemma int_bit_count_est:
  assumes "\<bar>n\<bar> \<le> r"
  shows "bit_count (I\<^sub>e n) \<le> 2 * log 2 (2*r+1) +1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
have "bit_count (I\<^sub>e n) \<le> 2 * log 2 (2*\<bar>n\<bar>+1) +1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1)
[PROOF STEP]
by (simp add:int_bit_count)
[PROOF STATE]
proof (state)
this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1)

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1)

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
have "... \<le> 2 * log 2 (2* r + 1) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<bar>n\<bar> \<le> r

goal (1 subgoal):
 1. ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ereal (2 * log 2 (real_of_int (2 * \<bar>n\<bar> + 1)) + 1) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)

goal (1 subgoal):
 1. bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bit_count (I\<^sub>e n) \<le> ereal (2 * log 2 (real_of_int (2 * r + 1)) + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bigomega_real_nat_transfer:
  "(f :: real \<Rightarrow> real) \<in> \<Omega>(g) \<Longrightarrow> (\<lambda>x::nat. f (real x)) \<in> \<Omega>(\<lambda>x. g (real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> \<Omega>(g) \<Longrightarrow> (\<lambda>x. f (real x)) \<in> \<Omega>(\<lambda>x. g (real x))
[PROOF STEP]
by (rule landau_omega.big.compose[OF _ filterlim_real_sequentially])


[STATEMENT]
lemma n_intersect_num_subset_def: "b1 |\<inter>|\<^sub>n b2 = card {x . x \<subseteq> b1 \<inter> b2 \<and> card x = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b1 |\<inter>|\<^sub>n b2) = card {x. x \<subseteq> b1 \<inter> b2 \<and> card x = n}
[PROOF STEP]
using n_intersect_number_def
[PROOF STATE]
proof (prove)
using this:
?b1.0 |\<inter>|\<^sub>?n ?b2.0 \<equiv> card {x \<in> Pow (?b1.0 \<inter> ?b2.0). card x = ?n}

goal (1 subgoal):
 1. (b1 |\<inter>|\<^sub>n b2) = card {x. x \<subseteq> b1 \<inter> b2 \<and> card x = n}
[PROOF STEP]
by auto


[STATEMENT]
lemma surj_on_mult:
  assumes coprime: "coprime x (q::nat)"
    and inj: "inj_on (\<lambda> b. x*b mod q) {..<q}"
  shows "(\<lambda> b. x*b mod q) ` {..< q} = {..< q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. x * b mod q) ` {..<q} = {..<q}
[PROOF STEP]
apply(rule endo_inj_surj)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. x * b mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. x * b mod q) {..<q}
[PROOF STEP]
using coprime inj
[PROOF STATE]
proof (prove)
using this:
coprime x q
inj_on (\<lambda>b. x * b mod q) {..<q}

goal (3 subgoals):
 1. finite {..<q}
 2. (\<lambda>b. x * b mod q) ` {..<q} \<subseteq> {..<q}
 3. inj_on (\<lambda>b. x * b mod q) {..<q}
[PROOF STEP]
by auto


[STATEMENT]
lemma mpoly_to_poly_add: "mpoly_to_poly v (p1 + p2) = mpoly_to_poly v p1 + mpoly_to_poly v p2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_to_poly v (p1 + p2) = mpoly_to_poly v p1 + mpoly_to_poly v p2
[PROOF STEP]
unfolding  Polynomial.plus_poly.abs_eq More_MPoly_Type.coeff_add coeff_mpoly_to_poly
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_to_poly v (p1 + p2) = Abs_poly (\<lambda>n. MPoly_Type.coeff (p1 + p2) (Poly_Mapping.single v n))
[PROOF STEP]
using mpoly_to_poly_def
[PROOF STATE]
proof (prove)
using this:
mpoly_to_poly ?v ?p = Abs_poly (\<lambda>k. MPoly_Type.coeff ?p (Poly_Mapping.single ?v k))

goal (1 subgoal):
 1. mpoly_to_poly v (p1 + p2) = Abs_poly (\<lambda>n. MPoly_Type.coeff (p1 + p2) (Poly_Mapping.single v n))
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_mult_distrib_left:
  "(A::('a::{comm_monoid_add,semiring},'m,'n::len) matrix) *\<^sub>M (B + C) = A *\<^sub>M B + A *\<^sub>M C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>M (B + C) = A *\<^sub>M B + A *\<^sub>M C
[PROOF STEP]
by (cases A, cases B, cases C, simp add: distrib_left sum.distrib)


[STATEMENT]
lemma topological_basis_closed:
  assumes "topological_basis_ow U \<tau> B"
  shows "B \<subseteq> Pow U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> Pow U
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
on U with \<tau> : \<guillemotleft>topological_basis\<guillemotright> B

goal (1 subgoal):
 1. B \<subseteq> Pow U
[PROOF STEP]
unfolding topological_basis_ow_def
[PROOF STATE]
proof (prove)
using this:
\<Union> B = U \<and> Ball B \<tau> \<and> (\<forall>q\<subseteq>U. \<tau> q \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union> B' = q))

goal (1 subgoal):
 1. B \<subseteq> Pow U
[PROOF STEP]
by auto


[STATEMENT]
lemma id_sum_mod_2:
  assumes "f = id"
  shows "(f 0 + f 1) mod 2 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f = id

goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma join_subpaths_middle: "subpath (0) ((1 / 2)) p +++ subpath ((1 / 2)) 1 p = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subpath 0 (1 / 2) p +++ subpath (1 / 2) 1 p = p
[PROOF STEP]
by (rule ext) (simp add: joinpaths_def subpath_def field_split_simps)


[STATEMENT]
lemma homotopic_with_imp_continuous_maps:
    assumes "homotopic_with P X Y f g"
    shows "continuous_map X Y f \<and> continuous_map X Y g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
obtain h :: "real \<times> 'a \<Rightarrow> 'b"
    where conth: "continuous_map (prod_topology (top_of_set {0..1}) X) Y h"
      and h: "\<forall>x. h (0, x) = f x" "\<forall>x. h (1, x) = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_map (prod_topology (top_of_set {0..1}) X) Y h; \<forall>x. h (0, x) = f x; \<forall>x. h (1, x) = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homotopic_with P X Y f g

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>continuous_map (prod_topology (top_of_set {0..1}) X) Y h; \<forall>x. h (0, x) = f x; \<forall>x. h (1, x) = g x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: homotopic_with_def)
[PROOF STATE]
proof (state)
this:
continuous_map (prod_topology (top_of_set {0..1}) X) Y h
\<forall>x. h (0, x) = f x
\<forall>x. h (1, x) = g x

goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
have *: "t \<in> {0..1} \<Longrightarrow> continuous_map X Y (h \<circ> (\<lambda>x. (t,x)))" for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> {0..1} \<Longrightarrow> continuous_map X Y (h \<circ> Pair t)
[PROOF STEP]
by (rule continuous_map_compose [OF _ conth]) (simp add: o_def continuous_map_pairwise)
[PROOF STATE]
proof (state)
this:
?t \<in> {0..1} \<Longrightarrow> continuous_map X Y (h \<circ> Pair ?t)

goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
using h *[of 0] *[of 1]
[PROOF STATE]
proof (prove)
using this:
\<forall>x. h (0, x) = f x
\<forall>x. h (1, x) = g x
0 \<in> {0..1} \<Longrightarrow> continuous_map X Y (h \<circ> Pair 0)
1 \<in> {0..1} \<Longrightarrow> continuous_map X Y (h \<circ> Pair 1)

goal (1 subgoal):
 1. continuous_map X Y f \<and> continuous_map X Y g
[PROOF STEP]
by (simp add: continuous_map_eq)
[PROOF STATE]
proof (state)
this:
continuous_map X Y f \<and> continuous_map X Y g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scalar_right_zero: "scalar_prod v (vec0 nn) = zero"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_prod v (vec0 nn) = (0::'a)
[PROOF STEP]
unfolding vec0I_def scalar_prodI_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>(x, y). (+) (x * y)) (zip v (replicate nn (0::'a))) (0::'a) = (0::'a)
[PROOF STEP]
proof (induct v arbitrary: nn)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>nn. foldr (\<lambda>(x, y). (+) (x * y)) (zip [] (replicate nn (0::'a))) (0::'a) = (0::'a)
 2. \<And>a v nn. (\<And>nn. foldr (\<lambda>(x, y). (+) (x * y)) (zip v (replicate nn (0::'a))) (0::'a) = (0::'a)) \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip (a # v) (replicate nn (0::'a))) (0::'a) = (0::'a)
[PROOF STEP]
case (Cons a vv)
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip vv (replicate ?nn1 (0::'a))) (0::'a) = (0::'a)

goal (2 subgoals):
 1. \<And>nn. foldr (\<lambda>(x, y). (+) (x * y)) (zip [] (replicate nn (0::'a))) (0::'a) = (0::'a)
 2. \<And>a v nn. (\<And>nn. foldr (\<lambda>(x, y). (+) (x * y)) (zip v (replicate nn (0::'a))) (0::'a) = (0::'a)) \<Longrightarrow> foldr (\<lambda>(x, y). (+) (x * y)) (zip (a # v) (replicate nn (0::'a))) (0::'a) = (0::'a)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip vv (replicate ?nn1 (0::'a))) (0::'a) = (0::'a)

goal (1 subgoal):
 1. foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip (a # vv) (replicate nn (0::'a))) (0::'a) = (0::'a)
[PROOF STEP]
by (cases nn, auto)
[PROOF STATE]
proof (state)
this:
foldr (\<lambda>a. case a of (x, y) \<Rightarrow> (+) (x * y)) (zip (a # vv) (replicate nn (0::'a))) (0::'a) = (0::'a)

goal (1 subgoal):
 1. \<And>nn. foldr (\<lambda>(x, y). (+) (x * y)) (zip [] (replicate nn (0::'a))) (0::'a) = (0::'a)
[PROOF STEP]
qed simp


[STATEMENT]
lemma exp_of_real:
  fixes x:: real
  shows "exp (\<i> * x) = cos x + \<i> * (sin x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (\<i> * complex_of_real x) = complex_of_real (cos x) + \<i> * complex_of_real (sin x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Re (exp (\<i> * complex_of_real x)) = Re (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
 2. Im (exp (\<i> * complex_of_real x)) = Im (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
show "Re (exp (\<i> * x)) = Re ((cos x) + \<i> * (sin x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (exp (\<i> * complex_of_real x)) = Re (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
using Re_exp
[PROOF STATE]
proof (prove)
using this:
Re (exp ?z) = exp (Re ?z) * cos (Im ?z)

goal (1 subgoal):
 1. Re (exp (\<i> * complex_of_real x)) = Re (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Re (exp (\<i> * complex_of_real x)) = Re (complex_of_real (cos x) + \<i> * complex_of_real (sin x))

goal (1 subgoal):
 1. Im (exp (\<i> * complex_of_real x)) = Im (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
show "Im (exp (\<i> * x)) = Im ((cos x) + \<i> * (sin x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (exp (\<i> * complex_of_real x)) = Im (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
using Im_exp
[PROOF STATE]
proof (prove)
using this:
Im (exp ?z) = exp (Re ?z) * sin (Im ?z)

goal (1 subgoal):
 1. Im (exp (\<i> * complex_of_real x)) = Im (complex_of_real (cos x) + \<i> * complex_of_real (sin x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Im (exp (\<i> * complex_of_real x)) = Im (complex_of_real (cos x) + \<i> * complex_of_real (sin x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "((\<lambda>x::real. max x (exp x) / ln (min (exp (-x)) (exp (-exp x)))) \<longlongrightarrow> -1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. max x (exp x) / ln (min (exp (- x)) (exp (- exp x)))) \<longlongrightarrow> - 1) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma delete_sorted_correct :
  "sorted xs \<Longrightarrow> distinct xs \<Longrightarrow>
   distinct (delete_sorted x xs) \<and>
   sorted (delete_sorted x xs) \<and>
   set (delete_sorted x xs) = set xs - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>sorted xs; distinct xs\<rbrakk> \<Longrightarrow> distinct (delete_sorted x xs) \<and> sorted (delete_sorted x xs) \<and> set (delete_sorted x xs) = set xs - {x}
[PROOF STEP]
apply (induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>sorted []; distinct []\<rbrakk> \<Longrightarrow> distinct (delete_sorted x []) \<and> sorted (delete_sorted x []) \<and> set (delete_sorted x []) = set [] - {x}
 2. \<And>a xs. \<lbrakk>\<lbrakk>sorted xs; distinct xs\<rbrakk> \<Longrightarrow> distinct (delete_sorted x xs) \<and> sorted (delete_sorted x xs) \<and> set (delete_sorted x xs) = set xs - {x}; sorted (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (delete_sorted x (a # xs)) \<and> sorted (delete_sorted x (a # xs)) \<and> set (delete_sorted x (a # xs)) = set (a # xs) - {x}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>sorted xs; distinct xs\<rbrakk> \<Longrightarrow> distinct (delete_sorted x xs) \<and> sorted (delete_sorted x xs) \<and> set (delete_sorted x xs) = set xs - {x}; sorted (a # xs); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (delete_sorted x (a # xs)) \<and> sorted (delete_sorted x (a # xs)) \<and> set (delete_sorted x (a # xs)) = set (a # xs) - {x}
[PROOF STEP]
apply (simp add: Ball_def set_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>distinct (delete_sorted x xs) \<and> sorted (delete_sorted x xs) \<and> (\<forall>xa. (xa \<in> set (delete_sorted x xs)) = (xa \<in> set xs \<and> xa \<noteq> x)); (\<forall>x. x \<in> set xs \<longrightarrow> a \<le> x) \<and> sorted xs; a \<notin> set xs \<and> distinct xs\<rbrakk> \<Longrightarrow> (x = a \<longrightarrow> (\<forall>x. (x \<in> set xs) = ((x = a \<or> x \<in> set xs) \<and> x \<noteq> a))) \<and> (x \<noteq> a \<longrightarrow> (a < x \<longrightarrow> (\<forall>xa. (xa = a \<or> xa \<in> set xs \<and> xa \<noteq> x) = ((xa = a \<or> xa \<in> set xs) \<and> xa \<noteq> x))) \<and> (\<not> a < x \<longrightarrow> (\<forall>xa. (xa = a \<or> xa \<in> set xs) = ((xa = a \<or> xa \<in> set xs) \<and> xa \<noteq> x))))
[PROOF STEP]
apply (metis order_less_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma even_and_odd_parts:
  fixes n::nat
  assumes \<open>n \<noteq> 0\<close>
  shows \<open>\<exists> k q::nat. n = (2::nat)^k*q \<and> odd q\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k q. n = 2 ^ k * q \<and> odd q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k q. n = 2 ^ k * q \<and> odd q
[PROOF STEP]
have \<open>prime (2::nat)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prime 2

goal (1 subgoal):
 1. \<exists>k q. n = 2 ^ k * q \<and> odd q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prime 2

goal (1 subgoal):
 1. \<exists>k q. n = 2 ^ k * q \<and> odd q
[PROOF STEP]
using prime_power_canonical[where p = "2" and m = "n"]
      assms semiring_normalization_rules(7)
[PROOF STATE]
proof (prove)
using this:
prime 2
\<lbrakk>prime 2; 0 < n\<rbrakk> \<Longrightarrow> \<exists>k na. odd na \<and> n = na * 2 ^ k
n \<noteq> 0
?a * ?b = ?b * ?a

goal (1 subgoal):
 1. \<exists>k q. n = 2 ^ k * q \<and> odd q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>k q. n = 2 ^ k * q \<and> odd q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Greatest_le:
    fixes k :: nat
    assumes "P k" "\<And> k. P k \<Longrightarrow> k \<le> l"
    shows "k \<le> (GREATEST k. P k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> (GREATEST k. P k)
[PROOF STEP]
proof (rule Greatest_le_nat)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. P k
 2. \<And>y. P y \<Longrightarrow> y \<le> ?b
[PROOF STEP]
show "P k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P k
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
P k

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

goal (1 subgoal):
 1. \<And>y. P y \<Longrightarrow> y \<le> ?b
[PROOF STEP]
show "k \<le> l" if "P k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> l
[PROOF STEP]
using assms(2) that
[PROOF STATE]
proof (prove)
using this:
P ?k \<Longrightarrow> ?k \<le> l
P k

goal (1 subgoal):
 1. k \<le> l
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
P ?k \<Longrightarrow> ?k \<le> l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unfold_rtrancl2:
 "R\<^sup>* = Id \<union> (R O R\<^sup>*)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R\<^sup>* = Id \<union> R O R\<^sup>*
[PROOF STEP]
apply (rule set_eqI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. (x \<in> R\<^sup>*) = (x \<in> Id \<union> R O R\<^sup>*)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. ((a, b) \<in> R\<^sup>*) = (a = b \<or> (a, b) \<in> R O R\<^sup>*)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b. (a, b) \<in> R\<^sup>* \<Longrightarrow> a = b \<or> (a, b) \<in> R O R\<^sup>*
 2. \<And>a b. a = b \<or> (a, b) \<in> R O R\<^sup>* \<Longrightarrow> (a, b) \<in> R\<^sup>*
[PROOF STEP]
apply (erule rtrancl_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>a b. a = a \<or> (a, a) \<in> R O R\<^sup>*
 2. \<And>a b y z. \<lbrakk>(a, y) \<in> R\<^sup>*; (y, z) \<in> R; a = y \<or> (a, y) \<in> R O R\<^sup>*\<rbrakk> \<Longrightarrow> a = z \<or> (a, z) \<in> R O R\<^sup>*
 3. \<And>a b. a = b \<or> (a, b) \<in> R O R\<^sup>* \<Longrightarrow> (a, b) \<in> R\<^sup>*
[PROOF STEP]
apply (blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b y z. \<lbrakk>(a, y) \<in> R\<^sup>*; (y, z) \<in> R; a = y \<or> (a, y) \<in> R O R\<^sup>*\<rbrakk> \<Longrightarrow> a = z \<or> (a, z) \<in> R O R\<^sup>*
 2. \<And>a b. a = b \<or> (a, b) \<in> R O R\<^sup>* \<Longrightarrow> (a, b) \<in> R\<^sup>*
[PROOF STEP]
apply (blast intro: rtrancl_into_rtrancl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. a = b \<or> (a, b) \<in> R O R\<^sup>* \<Longrightarrow> (a, b) \<in> R\<^sup>*
[PROOF STEP]
apply (blast intro: converse_rtrancl_into_rtrancl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma nats_of_boolss_mod2:
  assumes bs: "length bs = n" and bss: "list_all (is_alph n) bss"
  shows "map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map nat_of_bool bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map of_bool bs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map of_bool bs
[PROOF STEP]
from bs bss
[PROOF STATE]
proof (chain)
picking this:
length bs = n
list_all (is_alph n) bss
[PROOF STEP]
have "map nat_of_bool (map fst (zip bs (nats_of_boolss n bss))) = map nat_of_bool bs"
[PROOF STATE]
proof (prove)
using this:
length bs = n
list_all (is_alph n) bss

goal (1 subgoal):
 1. map of_bool (map fst (zip bs (nats_of_boolss n bss))) = map of_bool bs
[PROOF STEP]
by (simp add: nats_of_boolss_length)
[PROOF STATE]
proof (state)
this:
map of_bool (map fst (zip bs (nats_of_boolss n bss))) = map of_bool bs

goal (1 subgoal):
 1. map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map of_bool bs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
map of_bool (map fst (zip bs (nats_of_boolss n bss))) = map of_bool bs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
map of_bool (map fst (zip bs (nats_of_boolss n bss))) = map of_bool bs

goal (1 subgoal):
 1. map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map of_bool bs
[PROOF STEP]
by (simp add: split_def o_def nat_of_bool_bound)
[PROOF STATE]
proof (state)
this:
map (\<lambda>x. x mod 2) (nats_of_boolss n (bs # bss)) = map of_bool bs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card1: "finite S \<Longrightarrow> finite X \<Longrightarrow> finite Y \<Longrightarrow> X \<inter> Y = {} \<Longrightarrow> S \<inter> (X \<union> Y) = {} \<Longrightarrow> S\<union>X\<union>Y={0..<m} \<Longrightarrow>
    card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i)  \<and> length xs = m} = 2^(m - card X - card Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; finite X; finite Y; X \<inter> Y = {}; S \<inter> (X \<union> Y) = {}; S \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>i\<in>X. xs ! i) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
proof(induct arbitrary: X Y rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
finite X
finite Y
X \<inter> Y = {}
{} \<inter> (X \<union> Y) = {}
{} \<union> X \<union> Y = {0..<m}

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite X
finite Y
X \<inter> Y = {}
{} \<inter> (X \<union> Y) = {}
{} \<union> X \<union> Y = {0..<m}
[PROOF STEP]
have x: "X \<subseteq> {0..<m}" and y: "Y \<subseteq> {0..<m}" and xy: "X\<union> Y = {0..<m}"
[PROOF STATE]
proof (prove)
using this:
finite X
finite Y
X \<inter> Y = {}
{} \<inter> (X \<union> Y) = {}
{} \<union> X \<union> Y = {0..<m}

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

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> {0..<m}
Y \<subseteq> {0..<m}
X \<union> Y = {0..<m}
[PROOF STEP]
have "card (X \<union> Y) = m"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> {0..<m}
Y \<subseteq> {0..<m}
X \<union> Y = {0..<m}

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

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
with empty(3)
[PROOF STATE]
proof (chain)
picking this:
X \<inter> Y = {}
card (X \<union> Y) = m
[PROOF STEP]
have cardXY: "card X + card Y = m"
[PROOF STATE]
proof (prove)
using this:
X \<inter> Y = {}
card (X \<union> Y) = m

goal (1 subgoal):
 1. card X + card Y = m
[PROOF STEP]
using card_Un_Int[OF empty(1) empty(2)]
[PROOF STATE]
proof (prove)
using this:
X \<inter> Y = {}
card (X \<union> Y) = m
card X + card Y = card (X \<union> Y) + card (X \<inter> Y)

goal (1 subgoal):
 1. card X + card Y = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card X + card Y = m

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
from empty
[PROOF STATE]
proof (chain)
picking this:
finite X
finite Y
X \<inter> Y = {}
{} \<inter> (X \<union> Y) = {}
{} \<union> X \<union> Y = {0..<m}
[PROOF STEP]
have ents: "\<forall>i<m. (i\<in>Y) = (i\<notin>X)"
[PROOF STATE]
proof (prove)
using this:
finite X
finite Y
X \<inter> Y = {}
{} \<inter> (X \<union> Y) = {}
{} \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. \<forall>i<m. (i \<in> Y) = (i \<notin> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i<m. (i \<in> Y) = (i \<notin> X)

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "(\<exists>! w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and>  length w = m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m
[PROOF STEP]
proof (rule ex1I, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<forall>i\<in>X. ?a ! i) \<and> (\<forall>i\<in>Y. \<not> ?a ! i) \<and> length ?a = m
 2. \<And>w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> w = ?a
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<forall>i\<in>X. ?a ! i) \<and> (\<forall>i\<in>Y. \<not> ?a ! i) \<and> length ?a = m
 2. \<And>w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> w = ?a
[PROOF STEP]
show "(\<forall>i\<in>X. (witness X m) ! i) \<and> (\<forall>i\<in>Y. \<not> (witness X m) ! i) \<and> length (witness X m) = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>X. witness X m ! i) \<and> (\<forall>i\<in>Y. \<not> witness X m ! i) \<and> length (witness X m) = m
[PROOF STEP]
proof (safe, goal_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. \<And>i. \<lbrakk>i \<in> Y; witness X m ! i\<rbrakk> \<Longrightarrow> False
 3. length (witness X m) = m
[PROOF STEP]
case (2 i)
[PROOF STATE]
proof (state)
this:
i \<in> Y
witness X m ! i

goal (3 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. \<And>i. \<lbrakk>i \<in> Y; witness X m ! i\<rbrakk> \<Longrightarrow> False
 3. length (witness X m) = m
[PROOF STEP]
with y
[PROOF STATE]
proof (chain)
picking this:
Y \<subseteq> {0..<m}
i \<in> Y
witness X m ! i
[PROOF STEP]
have a: "i < m"
[PROOF STATE]
proof (prove)
using this:
Y \<subseteq> {0..<m}
i \<in> Y
witness X m ! i

goal (1 subgoal):
 1. i < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < m

goal (3 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. \<And>i. \<lbrakk>i \<in> Y; witness X m ! i\<rbrakk> \<Longrightarrow> False
 3. length (witness X m) = m
[PROOF STEP]
with iswitness
[PROOF STATE]
proof (chain)
picking this:
?r < ?n \<Longrightarrow> witness ?X ?n ! ?r = (?r \<in> ?X)
i < m
[PROOF STEP]
have "witness X m ! i = (i \<in> X)"
[PROOF STATE]
proof (prove)
using this:
?r < ?n \<Longrightarrow> witness ?X ?n ! ?r = (?r \<in> ?X)
i < m

goal (1 subgoal):
 1. witness X m ! i = (i \<in> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
witness X m ! i = (i \<in> X)

goal (3 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. \<And>i. \<lbrakk>i \<in> Y; witness X m ! i\<rbrakk> \<Longrightarrow> False
 3. length (witness X m) = m
[PROOF STEP]
with a ents 2
[PROOF STATE]
proof (chain)
picking this:
i < m
\<forall>i<m. (i \<in> Y) = (i \<notin> X)
i \<in> Y
witness X m ! i
witness X m ! i = (i \<in> X)
[PROOF STEP]
have "~ witness X m ! i"
[PROOF STATE]
proof (prove)
using this:
i < m
\<forall>i<m. (i \<in> Y) = (i \<notin> X)
i \<in> Y
witness X m ! i
witness X m ! i = (i \<in> X)

goal (1 subgoal):
 1. \<not> witness X m ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> witness X m ! i

goal (3 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. \<And>i. \<lbrakk>i \<in> Y; witness X m ! i\<rbrakk> \<Longrightarrow> False
 3. length (witness X m) = m
[PROOF STEP]
with 2(2)
[PROOF STATE]
proof (chain)
picking this:
witness X m ! i
\<not> witness X m ! i
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
witness X m ! i
\<not> witness X m ! i

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

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. length (witness X m) = m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. length (witness X m) = m
[PROOF STEP]
case (1 i)
[PROOF STATE]
proof (state)
this:
i \<in> X

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. length (witness X m) = m
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
X \<subseteq> {0..<m}
i \<in> X
[PROOF STEP]
have a: "i < m"
[PROOF STATE]
proof (prove)
using this:
X \<subseteq> {0..<m}
i \<in> X

goal (1 subgoal):
 1. i < m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < m

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. length (witness X m) = m
[PROOF STEP]
with iswitness
[PROOF STATE]
proof (chain)
picking this:
?r < ?n \<Longrightarrow> witness ?X ?n ! ?r = (?r \<in> ?X)
i < m
[PROOF STEP]
have "witness X m ! i = (i \<in> X)"
[PROOF STATE]
proof (prove)
using this:
?r < ?n \<Longrightarrow> witness ?X ?n ! ?r = (?r \<in> ?X)
i < m

goal (1 subgoal):
 1. witness X m ! i = (i \<in> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
witness X m ! i = (i \<in> X)

goal (2 subgoals):
 1. \<And>i. i \<in> X \<Longrightarrow> witness X m ! i
 2. length (witness X m) = m
[PROOF STEP]
with a ents 1
[PROOF STATE]
proof (chain)
picking this:
i < m
\<forall>i<m. (i \<in> Y) = (i \<notin> X)
i \<in> X
witness X m ! i = (i \<in> X)
[PROOF STEP]
show "witness X m ! i"
[PROOF STATE]
proof (prove)
using this:
i < m
\<forall>i<m. (i \<in> Y) = (i \<notin> X)
i \<in> X
witness X m ! i = (i \<in> X)

goal (1 subgoal):
 1. witness X m ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
witness X m ! i

goal (1 subgoal):
 1. length (witness X m) = m
[PROOF STEP]
qed (rule witness_length)
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>X. witness X m ! i) \<and> (\<forall>i\<in>Y. \<not> witness X m ! i) \<and> length (witness X m) = m

goal (1 subgoal):
 1. \<And>w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> w = witness X m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> w = witness X m
[PROOF STEP]
case (2 w)
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (1 subgoal):
 1. \<And>w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> w = witness X m
[PROOF STEP]
show "w = witness X m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w = witness X m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w = witness X m
[PROOF STEP]
have "(length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = (witness X m) ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
(\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (1 subgoal):
 1. length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)
[PROOF STEP]
apply(simp add: witness_length)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> \<forall>i<m. w ! i = witness X m ! i
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
assume as: "(\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and>  length w = m"
[PROOF STATE]
proof (state)
this:
(\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (1 subgoal):
 1. \<And>i. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
have "i < m \<longrightarrow> (witness X m) ! i = (i \<in> X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < m \<longrightarrow> witness X m ! i = (i \<in> X)
[PROOF STEP]
using iswitness
[PROOF STATE]
proof (prove)
using this:
?r < ?n \<Longrightarrow> witness ?X ?n ! ?r = (?r \<in> ?X)

goal (1 subgoal):
 1. i < m \<longrightarrow> witness X m ! i = (i \<in> X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < m \<longrightarrow> witness X m ! i = (i \<in> X)

goal (1 subgoal):
 1. \<And>i. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m \<Longrightarrow> i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < m \<longrightarrow> witness X m ! i = (i \<in> X)
[PROOF STEP]
show "i < m \<longrightarrow> w ! i = (witness X m) ! i"
[PROOF STATE]
proof (prove)
using this:
i < m \<longrightarrow> witness X m ! i = (i \<in> X)

goal (1 subgoal):
 1. i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
using ents as
[PROOF STATE]
proof (prove)
using this:
i < m \<longrightarrow> witness X m ! i = (i \<in> X)
\<forall>i<m. (i \<in> Y) = (i \<notin> X)
(\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (1 subgoal):
 1. i < m \<longrightarrow> w ! i = witness X m ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < m \<longrightarrow> w ! i = witness X m ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)

goal (1 subgoal):
 1. w = witness X m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)

goal (1 subgoal):
 1. w = witness X m
[PROOF STEP]
using list_eq_iff_nth_eq
[PROOF STATE]
proof (prove)
using this:
length w = length (witness X m) \<and> (\<forall>i<length w. w ! i = witness X m ! i)
(?xs = ?ys) = (length ?xs = length ?ys \<and> (\<forall>i<length ?xs. ?xs ! i = ?ys ! i))

goal (1 subgoal):
 1. w = witness X m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w = witness X m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w = witness X m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>!w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>!w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m
[PROOF STEP]
obtain w where " {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i)  \<and> length xs = m}
         = { w }"
[PROOF STATE]
proof (prove)
using this:
\<exists>!w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m

goal (1 subgoal):
 1. (\<And>w. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = {w} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Nitpick.Ex1_unfold[where P="(\<lambda>xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i)  \<and> length xs = m)"]
[PROOF STATE]
proof (prove)
using this:
\<exists>!w. (\<forall>i\<in>X. w ! i) \<and> (\<forall>i\<in>Y. \<not> w ! i) \<and> length w = m
\<exists>!xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<equiv> \<exists>x. {x. Ball X ((!) x) \<and> (\<forall>i\<in>Y. \<not> x ! i) \<and> length x = m} = {x}

goal (1 subgoal):
 1. (\<And>w. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = {w} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = {w}

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = {w}
[PROOF STEP]
have "card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i)  \<and> length xs = m} = card { w }"
[PROOF STATE]
proof (prove)
using this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = {w}

goal (1 subgoal):
 1. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {w}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {w}

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {w}

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {w} = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {w} = 1

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {w} = 1

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2^(m - card X - card Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = 2 ^ (m - card X - card Y)
[PROOF STEP]
using cardXY
[PROOF STATE]
proof (prove)
using this:
card X + card Y = m

goal (1 subgoal):
 1. 1 = 2 ^ (m - card X - card Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 = 2 ^ (m - card X - card Y)

goal (2 subgoals):
 1. \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; {} \<inter> (X \<union> Y) = {}; {} \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
 2. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)

goal (1 subgoal):
 1. card {xs. (\<forall>a\<in>X. xs ! a) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {xs. (\<forall>a\<in>X. xs ! a) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
case (insert e S)
[PROOF STATE]
proof (state)
this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}
[PROOF STEP]
have eX: "e \<notin> X" and eY: "e \<notin> Y"
[PROOF STATE]
proof (prove)
using this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. e \<notin> X &&& e \<notin> Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e \<notin> X
e \<notin> Y

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
from insert(8)
[PROOF STATE]
proof (chain)
picking this:
insert e S \<union> X \<union> Y = {0..<m}
[PROOF STEP]
have "insert e S \<subseteq> {0..<m}"
[PROOF STATE]
proof (prove)
using this:
insert e S \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. insert e S \<subseteq> {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert e S \<subseteq> {0..<m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insert e S \<subseteq> {0..<m}
[PROOF STEP]
have ebetween0m: "e\<in>{0..<m}"
[PROOF STATE]
proof (prove)
using this:
insert e S \<subseteq> {0..<m}

goal (1 subgoal):
 1. e \<in> {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e \<in> {0..<m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have fm: "finite {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {0..<m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {0..<m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have cardm: "card {0..<m} =   m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0..<m} = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {0..<m} = m

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
from insert(8) eX eY ebetween0m
[PROOF STATE]
proof (chain)
picking this:
insert e S \<union> X \<union> Y = {0..<m}
e \<notin> X
e \<notin> Y
e \<in> {0..<m}
[PROOF STEP]
have sub: "X \<union> Y \<subset> {0..<m}"
[PROOF STATE]
proof (prove)
using this:
insert e S \<union> X \<union> Y = {0..<m}
e \<notin> X
e \<notin> Y
e \<in> {0..<m}

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

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
from insert
[PROOF STATE]
proof (chain)
picking this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}
[PROOF STEP]
have "card (X \<inter> Y) = 0"
[PROOF STATE]
proof (prove)
using this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}

goal (1 subgoal):
 1. card (X \<inter> Y) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (X \<inter> Y) = 0

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (X \<inter> Y) = 0
[PROOF STEP]
have cardXY: "card (X \<union> Y) = card X + card Y"
[PROOF STATE]
proof (prove)
using this:
card (X \<inter> Y) = 0

goal (1 subgoal):
 1. card (X \<union> Y) = card X + card Y
[PROOF STEP]
using card_Un_Int[OF insert(4) insert(5)]
[PROOF STATE]
proof (prove)
using this:
card (X \<inter> Y) = 0
card X + card Y = card (X \<union> Y) + card (X \<inter> Y)

goal (1 subgoal):
 1. card (X \<union> Y) = card X + card Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (X \<union> Y) = card X + card Y

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "  m > card X + card Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card X + card Y < m
[PROOF STEP]
using psubset_card_mono[OF fm sub] cardm cardXY
[PROOF STATE]
proof (prove)
using this:
card (X \<union> Y) < card {0..<m}
card {0..<m} = m
card (X \<union> Y) = card X + card Y

goal (1 subgoal):
 1. card X + card Y < m
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
card X + card Y < m

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card X + card Y < m
[PROOF STEP]
have carde: "1 + (  m - card X - card Y - 1) =   m - card X - card Y"
[PROOF STATE]
proof (prove)
using this:
card X + card Y < m

goal (1 subgoal):
 1. 1 + (m - card X - card Y - 1) = m - card X - card Y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 + (m - card X - card Y - 1) = m - card X - card Y

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have is1: "{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> xs!e}
          = {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} = {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} = {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have is2: "{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> ~xs!e}
          = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>(insert e Y). \<not> xs ! i) \<and> length xs =   m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have 2: "{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> xs!e}
        \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> ~xs!e}
          = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have 3: "{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> xs!e}
      \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m \<and> ~xs!e} = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have fX: "finite (insert e X)"
    and disjeXY: "insert e X \<inter> Y = {}"
    and cutX: "S \<inter> (insert e X \<union> Y) = {}"
    and uniX: "S \<union> insert e X \<union> Y = {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (insert e X) &&& insert e X \<inter> Y = {}) &&& S \<inter> (insert e X \<union> Y) = {} &&& S \<union> insert e X \<union> Y = {0..<m}
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}

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

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have fY: "finite (insert e Y)"
    and disjXeY: "X \<inter> (insert e Y) = {}"
    and cutY: "S \<inter> (X \<union> insert e Y) = {}"
    and uniY: "S \<union>  X \<union> insert e Y = {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (finite (insert e Y) &&& X \<inter> insert e Y = {}) &&& S \<inter> (X \<union> insert e Y) = {} &&& S \<union> X \<union> insert e Y = {0..<m}
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite S
e \<notin> S
\<lbrakk>finite ?X; finite ?Y; ?X \<inter> ?Y = {}; S \<inter> (?X \<union> ?Y) = {}; S \<union> ?X \<union> ?Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. (\<forall>a\<in>?X. xs ! a) \<and> (\<forall>i\<in>?Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card ?X - card ?Y)
finite X
finite Y
X \<inter> Y = {}
insert e S \<inter> (X \<union> Y) = {}
insert e S \<union> X \<union> Y = {0..<m}

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

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}
      = card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs!e}
        + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> ~xs!e}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}
[PROOF STEP]
apply(subst card_Un_Int)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e}
 2. finite {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}
 3. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}) + card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e})
[PROOF STEP]
apply(rule fbool)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}
 2. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}) + card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e})
[PROOF STEP]
apply(rule fbool)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}) + card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e})
[PROOF STEP]
using 2 3
[PROOF STATE]
proof (prove)
using this:
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m}
{xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = {}

goal (1 subgoal):
 1. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<union> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}) + card ({xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} \<inter> {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs =   m}
        + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>(insert e Y). \<not> xs ! i) \<and> length xs =   m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m}
[PROOF STEP]
by (simp only: is1 is2)
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> xs ! e} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m \<and> \<not> xs ! e} = card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m}

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2 ^ (  m - card (insert e X) - card Y)
        + 2 ^ (  m - card X - card (insert e Y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y))
[PROOF STEP]
apply(simp only: insert(3)[of "insert e X" Y, OF fX insert(5) disjeXY cutX uniX])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (m - card (insert e X) - card Y) + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y))
[PROOF STEP]
by(simp only: insert(3)[of "X" "insert e Y", OF insert(4) fY disjXeY cutY uniY])
[PROOF STATE]
proof (state)
this:
card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y))

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {xs. Ball (insert e X) ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} + card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>insert e Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y))

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2 ^ (  m - card X - card Y - 1)
        + 2 ^ (  m - card X - card Y - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y)) = 2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1)
[PROOF STEP]
using insert(4,5) eX eY
[PROOF STATE]
proof (prove)
using this:
finite X
finite Y
e \<notin> X
e \<notin> Y

goal (1 subgoal):
 1. 2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y)) = 2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y)) = 2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ (m - card (insert e X) - card Y) + 2 ^ (m - card X - card (insert e Y)) = 2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2 * 2 ^ (  m - card X - card Y - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1) = 2 * 2 ^ (m - card X - card Y - 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1) = 2 * 2 ^ (m - card X - card Y - 1)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 ^ (m - card X - card Y - 1) + 2 ^ (m - card X - card Y - 1) = 2 * 2 ^ (m - card X - card Y - 1)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2 ^ (1 + (  m - card X - card Y - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * 2 ^ (m - card X - card Y - 1) = 2 ^ (1 + (m - card X - card Y - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 * 2 ^ (m - card X - card Y - 1) = 2 ^ (1 + (m - card X - card Y - 1))

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 * 2 ^ (m - card X - card Y - 1) = 2 ^ (1 + (m - card X - card Y - 1))

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
have "\<dots> = 2 ^ (  m - card X - card Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (1 + (m - card X - card Y - 1)) = 2 ^ (m - card X - card Y)
[PROOF STEP]
using carde
[PROOF STATE]
proof (prove)
using this:
1 + (m - card X - card Y - 1) = m - card X - card Y

goal (1 subgoal):
 1. 2 ^ (1 + (m - card X - card Y - 1)) = 2 ^ (m - card X - card Y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ (1 + (m - card X - card Y - 1)) = 2 ^ (m - card X - card Y)

goal (1 subgoal):
 1. \<And>x F X Y. \<lbrakk>finite F; x \<notin> F; \<And>X Y. \<lbrakk>finite X; finite Y; X \<inter> Y = {}; F \<inter> (X \<union> Y) = {}; F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y); finite X; finite Y; X \<inter> Y = {}; insert x F \<inter> (X \<union> Y) = {}; insert x F \<union> X \<union> Y = {0..<m}\<rbrakk> \<Longrightarrow> card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {xs. Ball X ((!) xs) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)

goal (1 subgoal):
 1. card {xs. (\<forall>a\<in>X. xs ! a) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {xs. (\<forall>a\<in>X. xs ! a) \<and> (\<forall>i\<in>Y. \<not> xs ! i) \<and> length xs = m} = 2 ^ (m - card X - card Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_Un_intro:
assumes "A1 = B1 Un C1" and "A2 = B2 Un C2" and
"finite A1" and "finite A2" and
"B1 Int C1 = {}" and "B2 Int C2 = {}" and
"sum f1 B1 = sum f2 B2" and "sum f1 C1 = sum f2 C2"
shows "sum f1 A1 = sum f2 A2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f1 A1 = sum f2 A2
[PROOF STEP]
by (metis assms finite_Un sum.union_disjoint)


[STATEMENT]
lemma "eq (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) (Odd_Succ (Even_Succ (Odd_Succ Even_Zero)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq (Odd_Succ (Even_Succ (Odd_Succ Even_Zero))) (Odd_Succ (Even_Succ (Odd_Succ Even_Zero)))
[PROOF STEP]
by eval


[STATEMENT]
lemma zmod_eq_imp_diff_mod_0:
  "a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0" for a b m :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod m = b mod m \<Longrightarrow> (b - a) mod m = 0
[PROOF STEP]
by (simp add: mod_diff_cong)


[STATEMENT]
lemma monom_list_degree: "eval_monom_list (\<lambda> _. x) m = x ^ monom_list_degree m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom_list (\<lambda>_. x) m = x ^ monom_list_degree m
[PROOF STEP]
unfolding monom_list_degree_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m)
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. eval_monom_list (\<lambda>_. x) [] = x ^ sum_list (map snd [])
 2. \<And>a m. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m) \<Longrightarrow> eval_monom_list (\<lambda>_. x) (a # m) = x ^ sum_list (map snd (a # m))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. eval_monom_list (\<lambda>_. x) [] = x ^ sum_list (map snd [])
 2. \<And>a m. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m) \<Longrightarrow> eval_monom_list (\<lambda>_. x) (a # m) = x ^ sum_list (map snd (a # m))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_monom_list (\<lambda>_. x) [] = x ^ sum_list (map snd [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_monom_list (\<lambda>_. x) [] = x ^ sum_list (map snd [])

goal (1 subgoal):
 1. \<And>a m. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m) \<Longrightarrow> eval_monom_list (\<lambda>_. x) (a # m) = x ^ sum_list (map snd (a # m))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m) \<Longrightarrow> eval_monom_list (\<lambda>_. x) (a # m) = x ^ sum_list (map snd (a # m))
[PROOF STEP]
case (Cons mc m)
[PROOF STATE]
proof (state)
this:
eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m)

goal (1 subgoal):
 1. \<And>a m. eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m) \<Longrightarrow> eval_monom_list (\<lambda>_. x) (a # m) = x ^ sum_list (map snd (a # m))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
eval_monom_list (\<lambda>_. x) m = x ^ sum_list (map snd m)

goal (1 subgoal):
 1. eval_monom_list (\<lambda>_. x) (mc # m) = x ^ sum_list (map snd (mc # m))
[PROOF STEP]
by (cases mc, auto simp: power_add field_simps)
[PROOF STATE]
proof (state)
this:
eval_monom_list (\<lambda>_. x) (mc # m) = x ^ sum_list (map snd (mc # m))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_at_top_within_iff:
  fixes f::"'a::linorder_topology \<Rightarrow> 'b::metric_space"
  assumes "s \<noteq> {}"
  shows "(f \<longlongrightarrow> l) (at_top_within s) \<longleftrightarrow> (\<forall>e>0. \<exists>x0 \<in> s. \<forall>x \<in> {x0..} \<inter> s. dist (f x) l < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> l) (at_top_within s) = (\<forall>e>0. \<exists>x0\<in>s. \<forall>x\<in>{x0..} \<inter> s. dist (f x) l < e)
[PROOF STEP]
by (auto intro!: tendsto_at_top_withinI[OF \<open>s \<noteq> {}\<close>] elim!: tendsto_at_top_withinE[OF \<open>s \<noteq> {}\<close>])