[STATEMENT]
lemma mem_is_intervalI:
  assumes "is_interval s"
    and "a \<in> s" "b \<in> s"
    and "\<And>i. i \<in> Basis \<Longrightarrow> a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i \<or> b \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> a \<bullet> i"
  shows "x \<in> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> s
[PROOF STEP]
by (rule assms(1)[simplified is_interval_def, rule_format, OF assms(2,3,4)])


[STATEMENT]
lemma linear_continuous_at:
  assumes "bounded_linear f"
  shows "continuous (at a) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f a
[PROOF STEP]
unfolding continuous_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> f a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bounded_linear f

goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow> f a
[PROOF STEP]
apply (rule bounded_linear.tendsto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x) \<midarrow>a\<rightarrow> a
[PROOF STEP]
apply (rule tendsto_ident_at)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ex_inverse_of_nat_less:
  fixes x :: "'a::archimedean_field"
  assumes "0 < x"
  shows "\<exists>n>0. inverse (of_nat n) < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n>0. inverse (of_nat n) < x
[PROOF STEP]
using reals_Archimedean [OF \<open>0 < x\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>n. inverse (of_nat (Suc n)) < x

goal (1 subgoal):
 1. \<exists>n>0. inverse (of_nat n) < x
[PROOF STEP]
by auto


[STATEMENT]
lemma unique_Cons [simp]: "unique ((x,y)#l) = (unique l & (\<forall>y. (x,y) \<notin> set l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unique ((x, y) # l) = (unique l \<and> (\<forall>y. (x, y) \<notin> set l))
[PROOF STEP]
by (auto simp: unique_def dest: fst_in_set_lemma)


[STATEMENT]
theorem invariance_of_dimension_Euclidean_space:
   "Euclidean_space m homeomorphic_space Euclidean_space n \<longleftrightarrow> m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
proof (cases m n rule: linorder_cases)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. m < n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 3. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
m < n

goal (3 subgoals):
 1. m < n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 3. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m < n
[PROOF STEP]
have *: "topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)"
[PROOF STATE]
proof (prove)
using this:
m < n

goal (1 subgoal):
 1. topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
by (meson le_cases not_le subset_Euclidean_space)
[PROOF STATE]
proof (state)
this:
topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)

goal (3 subgoals):
 1. m < n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 3. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
have "Euclidean_space m = subtopology (Euclidean_space n) (topspace(Euclidean_space m))"
[PROOF STATE]
proof (prove)
using this:
topspace (Euclidean_space m) \<subseteq> topspace (Euclidean_space n)

goal (1 subgoal):
 1. Euclidean_space m = subtopology (Euclidean_space n) (topspace (Euclidean_space m))
[PROOF STEP]
by (simp add: Euclidean_space_def inf.absorb_iff2 subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
Euclidean_space m = subtopology (Euclidean_space n) (topspace (Euclidean_space m))

goal (3 subgoals):
 1. m < n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 3. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Euclidean_space m = subtopology (Euclidean_space n) (topspace (Euclidean_space m))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Euclidean_space m = subtopology (Euclidean_space n) (topspace (Euclidean_space m))

goal (1 subgoal):
 1. (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
by (metis (no_types, lifting) * Euclidean_space_def closedin_Euclidean_space closedin_closed_subtopology eq_iff invariance_of_dimension_closedin_Euclidean_space subset_Euclidean_space topspace_Euclidean_space)
[PROOF STATE]
proof (state)
this:
(Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)

goal (2 subgoals):
 1. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
case equal
[PROOF STATE]
proof (state)
this:
m = n

goal (2 subgoals):
 1. m = n \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
 2. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m = n

goal (1 subgoal):
 1. (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
by (simp add: homeomorphic_space_refl)
[PROOF STATE]
proof (state)
this:
(Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)

goal (1 subgoal):
 1. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
case greater
[PROOF STATE]
proof (state)
this:
n < m

goal (1 subgoal):
 1. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < m
[PROOF STEP]
have *: "topspace (Euclidean_space n) \<subseteq> topspace (Euclidean_space m)"
[PROOF STATE]
proof (prove)
using this:
n < m

goal (1 subgoal):
 1. topspace (Euclidean_space n) \<subseteq> topspace (Euclidean_space m)
[PROOF STEP]
by (meson le_cases not_le subset_Euclidean_space)
[PROOF STATE]
proof (state)
this:
topspace (Euclidean_space n) \<subseteq> topspace (Euclidean_space m)

goal (1 subgoal):
 1. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
topspace (Euclidean_space n) \<subseteq> topspace (Euclidean_space m)
[PROOF STEP]
have "Euclidean_space n = subtopology (Euclidean_space m) (topspace(Euclidean_space n))"
[PROOF STATE]
proof (prove)
using this:
topspace (Euclidean_space n) \<subseteq> topspace (Euclidean_space m)

goal (1 subgoal):
 1. Euclidean_space n = subtopology (Euclidean_space m) (topspace (Euclidean_space n))
[PROOF STEP]
by (simp add: Euclidean_space_def inf.absorb_iff2 subtopology_subtopology)
[PROOF STATE]
proof (state)
this:
Euclidean_space n = subtopology (Euclidean_space m) (topspace (Euclidean_space n))

goal (1 subgoal):
 1. n < m \<Longrightarrow> (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Euclidean_space n = subtopology (Euclidean_space m) (topspace (Euclidean_space n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Euclidean_space n = subtopology (Euclidean_space m) (topspace (Euclidean_space n))

goal (1 subgoal):
 1. (Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)
[PROOF STEP]
by (metis (no_types, lifting) "*" Euclidean_space_def closedin_Euclidean_space closedin_closed_subtopology eq_iff homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subset_Euclidean_space topspace_Euclidean_space)
[PROOF STATE]
proof (state)
this:
(Euclidean_space m homeomorphic_space Euclidean_space n) = (m = n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_mset_Minus_gen:
  assumes BIU: "bi_unique A"
  assumes "rel_mset A m m'"
  assumes "rel_mset A n n'"
  shows "rel_mset A (m-n) (m'-n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_mset A (m - n) (m' - n')
[PROOF STEP]
using assms(3,2)
[PROOF STATE]
proof (prove)
using this:
rel_mset A n n'
rel_mset A m m'

goal (1 subgoal):
 1. rel_mset A (m - n) (m' - n')
[PROOF STEP]
apply (induction R\<equiv>A _ _ rule: rel_mset_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. rel_mset A m m' \<Longrightarrow> rel_mset A (m - {#}) (m' - {#})
 2. \<And>a b M N. \<lbrakk>A a b; rel_mset A M N; rel_mset A m m' \<Longrightarrow> rel_mset A (m - M) (m' - N); rel_mset A m m'\<rbrakk> \<Longrightarrow> rel_mset A (m - add_mset a M) (m' - add_mset b N)
[PROOF STEP]
apply (auto dest: rel_mset_Minus[OF BIU] simp: algebra_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem Hmap_cong: "\<lbrakk>\<And>z. z \<in> Hset1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> Hset2 x \<Longrightarrow> f2 z = g2 z\<rbrakk> \<Longrightarrow>
  Hmap f1 f2 x = Hmap g1 g2 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>z. z \<in> Hset1 x \<Longrightarrow> f1 z = g1 z; \<And>z. z \<in> Hset2 x \<Longrightarrow> f2 z = g2 z\<rbrakk> \<Longrightarrow> Hmap f1 f2 x = Hmap g1 g2 x
[PROOF STEP]
by (tactic \<open>BNF_Comp_Tactics.mk_comp_map_cong0_tac @{context}
  [] @{thms Hset1_alt Hset2_alt} @{thm G.map_cong0} @{thms F1.map_cong0 F2.map_cong0 F3.map_cong0}\<close>)


[STATEMENT]
lemma bin_rest_NOT [simp]: "(\<lambda>k::int. k div 2) (NOT x) = NOT ((\<lambda>k::int. k div 2) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NOT x div 2 = NOT (x div 2)
[PROOF STEP]
by (fact not_int_div_2)


[STATEMENT]
lemma triangle_ineq_sumsets_aux:
  fixes X B Y :: "'a set"
  assumes hX: "finite X" and hB: "finite B" and hXG: "X \<subseteq> G" and hBG: "B \<subseteq> G" and
    hXne: "X \<noteq> {}" and hYX: "\<And> Y. Y \<subseteq> X \<Longrightarrow> Y \<noteq> {} \<Longrightarrow> card (sumset Y B) / card Y \<ge>
    card (sumset X B) / card X" and hC: "finite C" and hCne: "C \<noteq> {}" and hCG: "C \<subseteq> G"
  shows "card (sumset X (sumset C B)) / card (sumset X C) \<le> card (sumset X B) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
using hC hCne hCG
[PROOF STATE]
proof (prove)
using this:
finite C
C \<noteq> {}
C \<subseteq> G

goal (1 subgoal):
 1. real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
proof (induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>{} \<noteq> {}; {} \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset {} B))) / real (card (sumset X {})) \<le> real (card (sumset X B)) / real (card X)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
{} \<noteq> {}
{} \<subseteq> G

goal (2 subgoals):
 1. \<lbrakk>{} \<noteq> {}; {} \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset {} B))) / real (card (sumset X {})) \<le> real (card (sumset X B)) / real (card X)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{} \<noteq> {}
{} \<subseteq> G
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
{} \<noteq> {}
{} \<subseteq> G

goal (1 subgoal):
 1. real (card (sumset X (sumset {} B))) / real (card (sumset X {})) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {} B))) / real (card (sumset X {})) \<le> real (card (sumset X B)) / real (card X)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
case hcase: (insert c C)
[PROOF STATE]
proof (state)
this:
finite C
c \<notin> C
\<lbrakk>C \<noteq> {}; C \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
insert c C \<noteq> {}
insert c C \<subseteq> G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hc : "c \<in> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> G
[PROOF STEP]
using hcase
[PROOF STATE]
proof (prove)
using this:
finite C
c \<notin> C
\<lbrakk>C \<noteq> {}; C \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
insert c C \<noteq> {}
insert c C \<subseteq> G

goal (1 subgoal):
 1. c \<in> G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c \<in> G

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>F \<noteq> {}; F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset F B))) / real (card (sumset X F)) \<le> real (card (sumset X B)) / real (card X); insert x F \<noteq> {}; insert x F \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset (insert x F) B))) / real (card (sumset X (insert x F))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
show "card (sumset X B) / card X \<ge>
    card (sumset X (sumset (insert c C) B)) / card (sumset X (insert c C))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
proof(cases "C = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. C = {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
 2. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
C = {}

goal (2 subgoals):
 1. C = {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
 2. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
C = {}
[PROOF STEP]
have "card (sumset X (insert c C)) = card X"
[PROOF STATE]
proof (prove)
using this:
C = {}

goal (1 subgoal):
 1. card (sumset X (insert c C)) = card X
[PROOF STEP]
using hc hXG hX
[PROOF STATE]
proof (prove)
using this:
C = {}
c \<in> G
X \<subseteq> G
finite X

goal (1 subgoal):
 1. card (sumset X (insert c C)) = card X
[PROOF STEP]
by (simp add: card_sumset_singleton_eq le_iff_inf)
[PROOF STATE]
proof (state)
this:
card (sumset X (insert c C)) = card X

goal (2 subgoals):
 1. C = {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
 2. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (sumset X (insert c C)) = card X

goal (2 subgoals):
 1. C = {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
 2. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have "card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)
[PROOF STEP]
using hX hB hBG hXG
      hc
[PROOF STATE]
proof (prove)
using this:
finite X
finite B
B \<subseteq> G
X \<subseteq> G
c \<in> G

goal (1 subgoal):
 1. card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)
[PROOF STEP]
by (metis True card_sumset_le finite_sumset sumset_assoc sumset_commute)
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)

goal (2 subgoals):
 1. C = {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
 2. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (sumset X (insert c C)) = card X
card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (sumset X (insert c C)) = card X
card (sumset X (sumset (insert c C) B)) \<le> card (sumset X B)

goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
by (simp add: divide_right_mono)
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
case hCne: False
[PROOF STATE]
proof (state)
this:
C \<noteq> {}

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hCG : "C \<subseteq> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<subseteq> G
[PROOF STEP]
using hcase
[PROOF STATE]
proof (prove)
using this:
finite C
c \<notin> C
\<lbrakk>C \<noteq> {}; C \<subseteq> G\<rbrakk> \<Longrightarrow> real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
insert c C \<noteq> {}
insert c C \<subseteq> G

goal (1 subgoal):
 1. C \<subseteq> G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C \<subseteq> G

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hstep: "card (sumset X (sumset {c} B) - sumset X (sumset C B)) \<le>
      card (sumset X B) * card (sumset X {c} - sumset X C) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
let ?Y = "{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have hYX : "?Y \<subseteq> X" and hY: "finite ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<subseteq> X &&& finite {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
[PROOF STEP]
using finite_subset hX
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite X

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<subseteq> X &&& finite {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<subseteq> X
finite {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have hsub1: "sumset X (sumset {c} B) - sumset X (sumset C B) \<subseteq>
        sumset (sumset X {c} - sumset X C) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset X (sumset {c} B) - sumset X (sumset C B) \<subseteq> sumset (sumset X {c} - sumset X C) B
[PROOF STEP]
by (metis Diff_subset_conv Un_Diff_cancel sumset_assoc sumset_subset_Un1 sup.cobounded2)
[PROOF STATE]
proof (state)
this:
sumset X (sumset {c} B) - sumset X (sumset C B) \<subseteq> sumset (sumset X {c} - sumset X C) B

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have hcard1 : "card (sumset X B) = card (sumset X (sumset {c} B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset X B) = card (sumset X (sumset {c} B))
[PROOF STEP]
by (metis card_sumset_singleton_eq finite_sumset hB hX hc sumset_Int_carrier sumset_assoc
            sumset_commute)
[PROOF STATE]
proof (state)
this:
card (sumset X B) = card (sumset X (sumset {c} B))

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have hcard2 : "card (sumset ?Y B) = card (sumset (sumset ?Y {c}) B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
[PROOF STEP]
using card_sumset_singleton_eq finite_sumset hB hY hc sumset_Int_carrier sumset_assoc
        sumset_commute
[PROOF STATE]
proof (prove)
using this:
finite ?A \<Longrightarrow> card (sumset ?A {?a}) = (if ?a \<in> G then card (?A \<inter> G) else 0)
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite B
finite {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
c \<in> G
sumset ?A ?B \<inter> G = sumset ?A ?B
sumset (sumset ?A ?B) ?C = sumset ?A (sumset ?B ?C)
sumset ?A ?B = sumset ?B ?A

goal (1 subgoal):
 1. card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
[PROOF STEP]
by (smt (verit, ccfv_threshold))
[PROOF STATE]
proof (state)
this:
card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have "sumset (sumset ?Y {c}) B \<subseteq> sumset X (sumset C B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset X (sumset C B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<Longrightarrow> x \<in> sumset X (sumset C B)
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<Longrightarrow> x \<in> sumset X (sumset C B)
[PROOF STEP]
assume "d \<in> sumset (sumset ?Y {c}) B"
[PROOF STATE]
proof (state)
this:
d \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B

goal (1 subgoal):
 1. \<And>x. x \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<Longrightarrow> x \<in> sumset X (sumset C B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B
[PROOF STEP]
obtain a b where ha: "a \<in> ?Y" and "b \<in> B" and hd: "d = a \<oplus> c \<oplus> b"
[PROOF STATE]
proof (prove)
using this:
d \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}; b \<in> B; d = a \<oplus> c \<oplus> b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt (verit) empty_iff insert_iff sumset.cases)
[PROOF STATE]
proof (state)
this:
a \<in> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
b \<in> B
d = a \<oplus> c \<oplus> b

goal (1 subgoal):
 1. \<And>x. x \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<Longrightarrow> x \<in> sumset X (sumset C B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
b \<in> B
d = a \<oplus> c \<oplus> b
[PROOF STEP]
have "a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)"
[PROOF STATE]
proof (prove)
using this:
a \<in> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
b \<in> B
d = a \<oplus> c \<oplus> b

goal (1 subgoal):
 1. a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)
[PROOF STEP]
by (smt (verit) associative composition_closed hBG hXG hc insertCI mem_Collect_eq subsetD
            sumset.sumsetI)
[PROOF STATE]
proof (state)
this:
a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)

goal (1 subgoal):
 1. \<And>x. x \<in> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<Longrightarrow> x \<in> sumset X (sumset C B)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)
[PROOF STEP]
show "d \<in> sumset X (sumset C B)"
[PROOF STATE]
proof (prove)
using this:
a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)

goal (1 subgoal):
 1. d \<in> sumset X (sumset C B)
[PROOF STEP]
using ha hd
[PROOF STATE]
proof (prove)
using this:
a \<oplus> c \<oplus> b \<in> sumset {a} (sumset {c} B)
a \<in> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
d = a \<oplus> c \<oplus> b

goal (1 subgoal):
 1. d \<in> sumset X (sumset C B)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d \<in> sumset X (sumset C B)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset X (sumset C B)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset X (sumset C B)
[PROOF STEP]
have hdisj : "disjnt ((sumset X (sumset {c} B)) - (sumset X (sumset C B)))
        (sumset (sumset ?Y {c}) B)"
[PROOF STATE]
proof (prove)
using this:
sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset X (sumset C B)

goal (1 subgoal):
 1. disjnt (sumset X (sumset {c} B) - sumset X (sumset C B)) (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
[PROOF STEP]
by (auto simp add : disjnt_iff)
[PROOF STATE]
proof (state)
this:
disjnt (sumset X (sumset {c} B) - sumset X (sumset C B)) (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have hsub2 : "sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset ?Y {c}) B \<subseteq>
        sumset (sumset X {c}) B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B
[PROOF STEP]
by (simp add: sumset_mono)
[PROOF STATE]
proof (state)
this:
sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B
[PROOF STEP]
have ineq1: "card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset ?Y B) \<le>
        card (sumset X B)"
[PROOF STATE]
proof (prove)
using this:
sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B

goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B \<Longrightarrow> card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
have "card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset ?Y B) =
        card ((sumset X (sumset {c} B) - sumset X (sumset C B)) \<union> sumset (sumset ?Y {c}) B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
[PROOF STEP]
using hdisj hcard2 card_Un_disjnt finite_sumset hX hYX finite_subset hB
[PROOF STATE]
proof (prove)
using this:
disjnt (sumset X (sumset {c} B) - sumset X (sumset C B)) (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
\<lbrakk>finite ?A; finite ?B; disjnt ?A ?B\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite X
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<subseteq> X
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
finite B

goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)
[PROOF STEP]
by (metis (no_types, lifting) finite.emptyI finite.insertI finite_Diff)
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)

goal (1 subgoal):
 1. sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B \<Longrightarrow> card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) = card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B)

goal (1 subgoal):
 1. sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B \<Longrightarrow> card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
have "... \<le> card (sumset X (sumset {c} B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B) \<le> card (sumset X (sumset {c} B))
[PROOF STEP]
using card_mono finite_sumset hX hB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite X
finite B

goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B) \<le> card (sumset X (sumset {c} B))
[PROOF STEP]
by (metis (no_types, lifting) Diff_subset Un_subset_iff finite.emptyI finite.insertI
            hsub2 sumset_assoc)
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset {c} B) - sumset X (sumset C B) \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B) \<le> card (sumset X (sumset {c} B))

goal (1 subgoal):
 1. sumset (sumset X {c} - sumset X C) B \<union> sumset (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} {c}) B \<subseteq> sumset (sumset X {c}) B \<Longrightarrow> card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X (sumset {c} B))
[PROOF STEP]
show "card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset ?Y B) \<le>
        card (sumset X B)"
[PROOF STATE]
proof (prove)
using this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X (sumset {c} B))

goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
using hcard1
[PROOF STATE]
proof (prove)
using this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X (sumset {c} B))
card (sumset X B) = card (sumset X (sumset {c} B))

goal (1 subgoal):
 1. card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have ineq2: "card (sumset X {c} - sumset X C)  \<ge> card X - card ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
let ?Z = "{x \<in> X. sumset {x} {c} \<subseteq> sumset X C}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have hZY: "?Z \<subseteq> ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<subseteq> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
[PROOF STEP]
by (smt (verit, del_insts) Collect_mono_iff subset_refl sumset_assoc sumset_mono)
[PROOF STATE]
proof (state)
this:
{x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<subseteq> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have hinj: "inj_on (\<lambda> x. x \<oplus> c) (X - ?Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. x \<oplus> c) (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
proof (intro inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; x \<oplus> c = y \<oplus> c\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; x \<oplus> c = y \<oplus> c\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "x \<in> X - ?Z" and "y \<in> X - ?Z" and h: "x \<oplus> c = y \<oplus> c"
[PROOF STATE]
proof (state)
this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
x \<oplus> c = y \<oplus> c

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; x \<oplus> c = y \<oplus> c\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
x \<oplus> c = y \<oplus> c
[PROOF STEP]
have "x \<in> G" and "y \<in> G"
[PROOF STATE]
proof (prove)
using this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
x \<oplus> c = y \<oplus> c

goal (1 subgoal):
 1. x \<in> G &&& y \<in> G
[PROOF STEP]
using hXG
[PROOF STATE]
proof (prove)
using this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
x \<oplus> c = y \<oplus> c
X \<subseteq> G

goal (1 subgoal):
 1. x \<in> G &&& y \<in> G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> G
y \<in> G

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; y \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}; x \<oplus> c = y \<oplus> c\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> G
y \<in> G
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> G
y \<in> G

goal (1 subgoal):
 1. x = y
[PROOF STEP]
using h hc
[PROOF STATE]
proof (prove)
using this:
x \<in> G
y \<in> G
x \<oplus> c = y \<oplus> c
c \<in> G

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. x \<oplus> c) (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have himage: "(\<lambda> x. x \<oplus> c) ` (X - ?Z) = sumset X {c} - sumset X C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = sumset X {c} - sumset X C
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<subseteq> sumset X {c} - sumset X C
 2. sumset X {c} - sumset X C \<subseteq> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
show "(\<lambda>x. x \<oplus> c) ` (X - ?Z) \<subseteq> sumset X {c} - sumset X C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<subseteq> sumset X {c} - sumset X C
[PROOF STEP]
proof(intro image_subsetI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
assume hx: "x \<in> X - ?Z"
[PROOF STATE]
proof (state)
this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}

goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
[PROOF STEP]
have hxG : "x \<in> G"
[PROOF STATE]
proof (prove)
using this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}

goal (1 subgoal):
 1. x \<in> G
[PROOF STEP]
using hXG
[PROOF STATE]
proof (prove)
using this:
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
X \<subseteq> G

goal (1 subgoal):
 1. x \<in> G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> G

goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> G
[PROOF STEP]
have hxc1: "x \<oplus> c \<in> sumset X {c}"
[PROOF STATE]
proof (prove)
using this:
x \<in> G

goal (1 subgoal):
 1. x \<oplus> c \<in> sumset X {c}
[PROOF STEP]
using hXG hc hx
[PROOF STATE]
proof (prove)
using this:
x \<in> G
X \<subseteq> G
c \<in> G
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}

goal (1 subgoal):
 1. x \<oplus> c \<in> sumset X {c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<oplus> c \<in> sumset X {c}

goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
have "x \<oplus> c \<in> sumset {x} {c}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<oplus> c \<in> sumset {x} {c}
[PROOF STEP]
using hxG hc
[PROOF STATE]
proof (prove)
using this:
x \<in> G
c \<in> G

goal (1 subgoal):
 1. x \<oplus> c \<in> sumset {x} {c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<oplus> c \<in> sumset {x} {c}

goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<oplus> c \<in> sumset {x} {c}
[PROOF STEP]
have hxc2: "x \<oplus> c \<notin> sumset X C"
[PROOF STATE]
proof (prove)
using this:
x \<oplus> c \<in> sumset {x} {c}

goal (1 subgoal):
 1. x \<oplus> c \<notin> sumset X C
[PROOF STEP]
using hx hXG hc hCG
[PROOF STATE]
proof (prove)
using this:
x \<oplus> c \<in> sumset {x} {c}
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
X \<subseteq> G
c \<in> G
C \<subseteq> G

goal (1 subgoal):
 1. x \<oplus> c \<notin> sumset X C
[PROOF STEP]
using DiffD2 sumset.simps sumset.sumsetI
[PROOF STATE]
proof (prove)
using this:
x \<oplus> c \<in> sumset {x} {c}
x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}
X \<subseteq> G
c \<in> G
C \<subseteq> G
\<lbrakk>?c \<in> ?A - ?B; ?c \<in> ?B\<rbrakk> \<Longrightarrow> ?P
(?a \<in> sumset ?A ?B) = (\<exists>a b. ?a = a \<oplus> b \<and> a \<in> ?A \<and> a \<in> G \<and> b \<in> ?B \<and> b \<in> G)
\<lbrakk>?a \<in> ?A; ?a \<in> G; ?b \<in> ?B; ?b \<in> G\<rbrakk> \<Longrightarrow> ?a \<oplus> ?b \<in> sumset ?A ?B

goal (1 subgoal):
 1. x \<oplus> c \<notin> sumset X C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<oplus> c \<notin> sumset X C

goal (1 subgoal):
 1. \<And>x. x \<in> X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<Longrightarrow> x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<oplus> c \<notin> sumset X C
[PROOF STEP]
show "x \<oplus> c \<in> sumset X {c} - sumset X C"
[PROOF STATE]
proof (prove)
using this:
x \<oplus> c \<notin> sumset X C

goal (1 subgoal):
 1. x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
using hxc1 hxc2
[PROOF STATE]
proof (prove)
using this:
x \<oplus> c \<notin> sumset X C
x \<oplus> c \<in> sumset X {c}
x \<oplus> c \<notin> sumset X C

goal (1 subgoal):
 1. x \<oplus> c \<in> sumset X {c} - sumset X C
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<oplus> c \<in> sumset X {c} - sumset X C

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<subseteq> sumset X {c} - sumset X C

goal (1 subgoal):
 1. sumset X {c} - sumset X C \<subseteq> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
show "sumset X {c} - sumset X C \<subseteq> (\<lambda>x. x \<oplus> c) ` (X - ?Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumset X {c} - sumset X C \<subseteq> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sumset X {c} - sumset X C \<Longrightarrow> x \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
fix d
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sumset X {c} - sumset X C \<Longrightarrow> x \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
assume "d \<in> sumset X {c} - sumset X C"
[PROOF STATE]
proof (state)
this:
d \<in> sumset X {c} - sumset X C

goal (1 subgoal):
 1. \<And>x. x \<in> sumset X {c} - sumset X C \<Longrightarrow> x \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d \<in> sumset X {c} - sumset X C
[PROOF STEP]
obtain x where hd: "d = x \<oplus> c" and hxc: "x \<oplus> c \<notin> sumset X C" and hx: "x \<in> X"
[PROOF STATE]
proof (prove)
using this:
d \<in> sumset X {c} - sumset X C

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>d = x \<oplus> c; x \<oplus> c \<notin> sumset X C; x \<in> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sumset.cases
[PROOF STATE]
proof (prove)
using this:
d \<in> sumset X {c} - sumset X C
\<lbrakk>?a \<in> sumset ?A ?B; \<And>a b. \<lbrakk>?a = a \<oplus> b; a \<in> ?A; a \<in> G; b \<in> ?B; b \<in> G\<rbrakk> \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>d = x \<oplus> c; x \<oplus> c \<notin> sumset X C; x \<in> X\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
d = x \<oplus> c
x \<oplus> c \<notin> sumset X C
x \<in> X

goal (1 subgoal):
 1. \<And>x. x \<in> sumset X {c} - sumset X C \<Longrightarrow> x \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d = x \<oplus> c
x \<oplus> c \<notin> sumset X C
x \<in> X
[PROOF STEP]
show "d \<in> (\<lambda>x. x \<oplus> c) ` (X - ?Z)"
[PROOF STATE]
proof (prove)
using this:
d = x \<oplus> c
x \<oplus> c \<notin> sumset X C
x \<in> X

goal (1 subgoal):
 1. d \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
using hd hxc hx hXG hc
[PROOF STATE]
proof (prove)
using this:
d = x \<oplus> c
x \<oplus> c \<notin> sumset X C
x \<in> X
d = x \<oplus> c
x \<oplus> c \<notin> sumset X C
x \<in> X
X \<subseteq> G
c \<in> G

goal (1 subgoal):
 1. d \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<in> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sumset X {c} - sumset X C \<subseteq> (\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = sumset X {c} - sumset X C

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have hcard3: "card (X - ?Z) = card (sumset X {c} - sumset X C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = card (sumset X {c} - sumset X C)
[PROOF STEP]
using card_image hinj himage
[PROOF STATE]
proof (prove)
using this:
inj_on ?f ?A \<Longrightarrow> card (?f ` ?A) = card ?A
inj_on (\<lambda>x. x \<oplus> c) (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
(\<lambda>x. x \<oplus> c) ` (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = sumset X {c} - sumset X C

goal (1 subgoal):
 1. card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = card (sumset X {c} - sumset X C)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = card (sumset X {c} - sumset X C)

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have "card X = card ?Z + card (X - ?Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card X = card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})
[PROOF STEP]
by (simp add: card_Diff_subset card_mono hX)
[PROOF STATE]
proof (state)
this:
card X = card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card X = card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C})

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
have "... \<le> card ?Y + card (sumset X {c} - sumset X C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<le> card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} + card (sumset X {c} - sumset X C)
[PROOF STEP]
using hcard3 card_mono hZY hY
[PROOF STATE]
proof (prove)
using this:
card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) = card (sumset X {c} - sumset X C)
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B
{x \<in> X. sumset {x} {c} \<subseteq> sumset X C} \<subseteq> {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}
finite {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}

goal (1 subgoal):
 1. card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<le> card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} + card (sumset X {c} - sumset X C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {x \<in> X. sumset {x} {c} \<subseteq> sumset X C} + card (X - {x \<in> X. sumset {x} {c} \<subseteq> sumset X C}) \<le> card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} + card (sumset X {c} - sumset X C)

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card X \<le> card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} + card (sumset X {c} - sumset X C)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card X \<le> card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} + card (sumset X {c} - sumset X C)

goal (1 subgoal):
 1. card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have ineq3: "card (sumset X B) - card (sumset ?Y B) \<le>
      card (sumset X B) * (card X - card ?Y) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
proof(cases "?Y = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
 2. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {}

goal (2 subgoals):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
 2. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {}

goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
using card_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} = {}
(card ?A = 0) = (?A = {} \<or> infinite ?A)

goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
by (smt (verit) hX hXne minus_nat.diff_0 nonzero_mult_div_cancel_right of_nat_eq_0_iff
        of_nat_mult sumset_empty(2))
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
case hYne: False
[PROOF STATE]
proof (state)
this:
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {}

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
have "card (sumset ?Y B) \<ge> card (sumset X B) / card X * card ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
[PROOF STEP]
using assms(6)[OF hYX hYne]
        hX hYne hX hYX finite_subset divide_le_eq
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X B)) / real (card X) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) / real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})
finite X
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {}
finite X
{x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<subseteq> X
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
(?b / ?c \<le> ?a) = (if (0::?'a) < ?c then ?b \<le> ?a * ?c else if ?c < (0::?'a) then ?a * ?c \<le> ?b else (0::?'a) \<le> ?a)

goal (1 subgoal):
 1. real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
[PROOF STEP]
by (smt (z3) card_gt_0_iff hY mult_imp_div_pos_less of_nat_0_less_iff)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
have "card (sumset X B) / card X * card ?Y = (card (sumset X B) * card ?Y) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
have "card (sumset X B) * card ?Y / card X  * card X = card (sumset X B) * card ?Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})
[PROOF STEP]
using hX
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)
real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})
[PROOF STEP]
have "card (sumset ?Y B) * card X \<ge> card (sumset X B) * card ?Y"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)
real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})

goal (1 subgoal):
 1. card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) * card X
[PROOF STEP]
using hX hXne of_nat_0_less_iff le_divide_eq
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) \<le> real (card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
real (card (sumset X B)) / real (card X) * real (card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X)
real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}) / real (card X) * real (card X) = real (card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})
finite X
X \<noteq> {}
((0::?'a) < of_nat ?n) = (0 < ?n)
(?a \<le> ?b / ?c) = (if (0::?'a) < ?c then ?a * ?c \<le> ?b else if ?c < (0::?'a) then ?b \<le> ?a * ?c else ?a \<le> (0::?'a))

goal (1 subgoal):
 1. card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) * card X
[PROOF STEP]
by (smt (z3) card_sumset_0_iff hBG hXG mult_cancel1 mult_cancel2 of_nat_le_0_iff
        of_nat_le_iff of_nat_mult)
[PROOF STATE]
proof (state)
this:
card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) * card X

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) * card X
[PROOF STEP]
have "real ((card (sumset X B) - card (sumset ?Y B)) * card X) \<le>
        card (sumset X B) * (card X - card ?Y)"
[PROOF STATE]
proof (prove)
using this:
card (sumset X B) * card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) * card X

goal (1 subgoal):
 1. real ((card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) * card X) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}))
[PROOF STEP]
by (simp add: diff_mult_distrib diff_mult_distrib2)
[PROOF STATE]
proof (state)
this:
real ((card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) * card X) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}))

goal (1 subgoal):
 1. {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<noteq> {} \<Longrightarrow> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
real ((card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) * card X) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}))

goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
using le_divide_eq card_eq_0_iff hX hXne
[PROOF STATE]
proof (prove)
using this:
real ((card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) * card X) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)}))
(?a \<le> ?b / ?c) = (if (0::?'a) < ?c then ?a * ?c \<le> ?b else if ?c < (0::?'a) then ?b \<le> ?a * ?c else ?a \<le> (0::?'a))
(card ?A = 0) = (?A = {} \<or> infinite ?A)
finite X
X \<noteq> {}

goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
by (smt (z3) of_nat_le_0_iff of_nat_mult)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have "real (card ((sumset X (sumset {c} B)) - (sumset X (sumset C B)))) \<le>
        card (sumset X B) - card (sumset ?Y B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
[PROOF STEP]
using ineq1
[PROOF STATE]
proof (prove)
using this:
card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B) \<le> card (sumset X B)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B))

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have "... \<le> card (sumset X B) * (card X - card ?Y) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
using ineq3
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) - card (sumset {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} B)) \<le> real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
have "... \<le> card (sumset X B) * card (sumset X {c} - sumset X C) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
using ineq2
        divide_le_cancel of_nat_less_0_iff of_nat_mono
[PROOF STATE]
proof (prove)
using this:
card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)} \<le> card (sumset X {c} - sumset X C)
(?a / ?c \<le> ?b / ?c) = (((0::?'a) < ?c \<longrightarrow> ?a \<le> ?b) \<and> (?c < (0::?'a) \<longrightarrow> ?b \<le> ?a))
\<not> of_nat ?m < (0::?'a)
?i \<le> ?j \<Longrightarrow> of_nat ?i \<le> of_nat ?j

goal (1 subgoal):
 1. real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
by (smt (verit, del_insts) mult_le_mono2)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B) * (card X - card {x \<in> X. sumset {x} (sumset {c} B) \<subseteq> sumset X (sumset C B)})) / real (card X) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hinsert: "real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) =
  (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) /
  (card (sumset X {c} - sumset X C) + card (sumset X C))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) = real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C))
[PROOF STEP]
using sumset_insert2 card_Un_disjoint finite_sumset hX hB hC Diff_disjoint Int_commute
    Un_commute finite.emptyI finite.insertI finite_Diff hcase.hyps(1)
[PROOF STATE]
proof (prove)
using this:
NO_MATCH {} ?B \<Longrightarrow> sumset ?A (insert ?x ?B) = sumset ?A {?x} \<union> sumset ?A ?B
\<lbrakk>finite ?A; finite ?B; ?A \<inter> ?B = {}\<rbrakk> \<Longrightarrow> card (?A \<union> ?B) = card ?A + card ?B
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
finite X
finite B
finite C
?A \<inter> (?B - ?A) = {}
?A \<inter> ?B = ?B \<inter> ?A
?A \<union> ?B = ?B \<union> ?A
finite {}
finite ?A \<Longrightarrow> finite (insert ?a ?A)
finite ?A \<Longrightarrow> finite (?A - ?B)
finite C

goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) = real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C))
[PROOF STEP]
by (smt (verit) Un_Diff_cancel2 insert_is_Un sumset_commute sumset_subset_Un2)
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) = real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C))

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hsplit: "real (card (sumset X B)) * (card (sumset X {c} - sumset X C) + card (sumset X C)) / card X =
  real (card (sumset X B)) * card (sumset X {c} - sumset X C) / card X +
  card (sumset X B) * card (sumset X C) / card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X) = real (card (sumset X B)) * real (card (sumset X {c} - sumset X C)) / real (card X) + real (card (sumset X B) * card (sumset X C)) / real (card X)
[PROOF STEP]
by (smt (verit, ccfv_threshold) add_divide_distrib add_mult_distrib2 of_nat_add of_nat_mult)
[PROOF STATE]
proof (state)
this:
real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X) = real (card (sumset X B)) * real (card (sumset X {c} - sumset X C)) / real (card X) + real (card (sumset X B) * card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have hind: "card (sumset X B) * card (sumset X C) / card X \<ge> card (sumset X (sumset C B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X C)) / real (card X)
[PROOF STEP]
using hcase(3)[OF hCne hCG] hXne hCne hcase(1) hX finite_sumset card_gt_0_iff
    add_mult_distrib2 of_nat_mult card_eq_0_iff card_sumset_0_iff hCG
    hXG of_nat_0_less_iff
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset C B))) / real (card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
X \<noteq> {}
C \<noteq> {}
finite C
finite X
\<lbrakk>finite ?A; finite ?B\<rbrakk> \<Longrightarrow> finite (sumset ?A ?B)
(0 < card ?A) = (?A \<noteq> {} \<and> finite ?A)
?k * (?m + ?n) = ?k * ?m + ?k * ?n
of_nat (?m * ?n) = of_nat ?m * of_nat ?n
(card ?A = 0) = (?A = {} \<or> infinite ?A)
\<lbrakk>?A \<subseteq> G; ?B \<subseteq> G\<rbrakk> \<Longrightarrow> (card (sumset ?A ?B) = 0) = (card ?A = 0 \<or> card ?B = 0)
C \<subseteq> G
X \<subseteq> G
((0::?'a) < of_nat ?n) = (0 < ?n)

goal (1 subgoal):
 1. real (card (sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X C)) / real (card X)
[PROOF STEP]
by (metis (no_types, opaque_lifting) divide_le_eq times_divide_eq_left)
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
have "real (card (sumset X B)) * (card (sumset X {c} - sumset X C) + card (sumset X C)) / card X \<ge>
  (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)
[PROOF STEP]
using hsplit hind hstep
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X) = real (card (sumset X B)) * real (card (sumset X {c} - sumset X C)) / real (card X) + real (card (sumset X B) * card (sumset X C)) / real (card X)
real (card (sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X C)) / real (card X)
real (card (sumset X (sumset {c} B) - sumset X (sumset C B))) \<le> real (card (sumset X B) * card (sumset X {c} - sumset X C)) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)
[PROOF STEP]
have "card (sumset X B) / card X \<ge>
    (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) /
    (card (sumset X {c} - sumset X C) + card (sumset X C))"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
using card_sumset_0_iff hCG hXG
    card_eq_0_iff hC hX hXne hCne divide_self le_divide_eq
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) \<le> real (card (sumset X B)) * real (card (sumset X {c} - sumset X C) + card (sumset X C)) / real (card X)
\<lbrakk>?A \<subseteq> G; ?B \<subseteq> G\<rbrakk> \<Longrightarrow> (card (sumset ?A ?B) = 0) = (card ?A = 0 \<or> card ?B = 0)
C \<subseteq> G
X \<subseteq> G
(card ?A = 0) = (?A = {} \<or> infinite ?A)
finite C
finite X
X \<noteq> {}
C \<noteq> {}
?a \<noteq> (0::?'a) \<Longrightarrow> ?a / ?a = (1::?'a)
(?a \<le> ?b / ?c) = (if (0::?'a) < ?c then ?a * ?c \<le> ?b else if ?c < (0::?'a) then ?b \<le> ?a * ?c else ?a \<le> (0::?'a))

goal (1 subgoal):
 1. real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
by (smt (z3) add_is_0 hcase.hyps(1) of_nat_le_0_iff times_divide_eq_left)
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)

goal (1 subgoal):
 1. C \<noteq> {} \<Longrightarrow> real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
thus "real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le>
    real (card (sumset X B)) / real (card X)"
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)

goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
using hinsert
[PROOF STATE]
proof (prove)
using this:
real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C)) \<le> real (card (sumset X B)) / real (card X)
real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) = real (card (sumset X (sumset {c} B) - sumset X (sumset C B)) + card (sumset X (sumset C B))) / real (card (sumset X {c} - sumset X C) + card (sumset X C))

goal (1 subgoal):
 1. real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (card (sumset X (sumset (insert c C) B))) / real (card (sumset X (insert c C))) \<le> real (card (sumset X B)) / real (card X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_solution_set_0:
  fixes A::"'a::{field}^'n::{mod_type}^'rows::{mod_type}"
  shows "(vec.dim (solution_set A 0) = 0) = (solution_set A 0 = {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec.dim (solution_set A 0) = 0) = (solution_set A 0 = {0})
[PROOF STEP]
using homogeneous_solution_set_subspace vec.dim_zero_subspace_eq
[PROOF STATE]
proof (prove)
using this:
vec.subspace (solution_set ?A 0)
vec.subspace ?A \<Longrightarrow> (vec.dim ?A = 0) = (?A = {0})

goal (1 subgoal):
 1. (vec.dim (solution_set A 0) = 0) = (solution_set A 0 = {0})
[PROOF STEP]
by auto


[STATEMENT]
lemma subdegree_div_unit':
  fixes   p q :: "'a :: {ab_group_add,mult_zero,inverse} fps"
  assumes "q $ 0 \<noteq> 0" "p $ subdegree p * inverse (q $ 0) \<noteq> 0"
  shows   "subdegree (p div q) = subdegree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subdegree (p / q) = subdegree p
[PROOF STEP]
using   assms subdegree_mult'[of p "inverse q"]
[PROOF STATE]
proof (prove)
using this:
q $ 0 \<noteq> (0::'a)
p $ subdegree p * inverse (q $ 0) \<noteq> (0::'a)
p $ subdegree p * inverse q $ subdegree (inverse q) \<noteq> (0::'a) \<Longrightarrow> subdegree (p * inverse q) = subdegree p + subdegree (inverse q)

goal (1 subgoal):
 1. subdegree (p / q) = subdegree p
[PROOF STEP]
by      (auto simp add: fps_divide_unit)


[STATEMENT]
theorem rbt_insertwk_is_rbt:
  assumes inv: "is_rbt t"
  shows "is_rbt (rbt_insert_with_key f k x t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_rbt (rbt_insert_with_key f k x t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_rbt t

goal (1 subgoal):
 1. is_rbt (rbt_insert_with_key f k x t)
[PROOF STEP]
unfolding rbt_insert_with_key_def is_rbt_def
[PROOF STATE]
proof (prove)
using this:
inv1 t \<and> inv2 t \<and> color_of t = B \<and> rbt_sorted t

goal (1 subgoal):
 1. inv1 (paint B (rbt_ins f k x t)) \<and> inv2 (paint B (rbt_ins f k x t)) \<and> color_of (paint B (rbt_ins f k x t)) = B \<and> rbt_sorted (paint B (rbt_ins f k x t))
[PROOF STEP]
by (auto simp: ins_inv1_inv2)


[STATEMENT]
lemma (in information_space) conditional_entropy_eq_entropy_simple:
  assumes X: "simple_function M X" and Y: "simple_function M Y"
  shows "\<H>(X | Y) = entropy b (count_space (X`space M) \<Otimes>\<^sub>M count_space (Y`space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<H>(X | Y) = entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<H>(X | Y) = entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)
[PROOF STEP]
have "count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X`space M \<times> Y`space M)"
    (is "?P = ?C")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)
[PROOF STEP]
using X Y
[PROOF STATE]
proof (prove)
using this:
simple_function M X
simple_function M Y

goal (1 subgoal):
 1. count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)
[PROOF STEP]
by (simp add: simple_functionD pair_measure_count_space)
[PROOF STATE]
proof (state)
this:
count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M) = count_space (X ` space M \<times> Y ` space M)

goal (1 subgoal):
 1. \<H>(X | Y) = entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<H>(X | Y) = entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)
[PROOF STEP]
by (rule conditional_entropy_eq_entropy sigma_finite_measure_count_space_finite
             simple_functionD  X Y simple_distributed simple_distributedI[OF _ _ refl]
             simple_distributed_joint simple_function_Pair integrable_count_space measure_nonneg)+
       (auto simp: \<open>?P = ?C\<close> measure_nonneg intro!: integrable_count_space simple_functionD  X Y)
[PROOF STATE]
proof (state)
this:
\<H>(X | Y) = entropy b (count_space (X ` space M) \<Otimes>\<^sub>M count_space (Y ` space M)) (\<lambda>x. (X x, Y x)) - \<H>(Y)

goal:
No subgoals!
[PROOF STEP]
qed