[STATEMENT]
lemma swap_set_in:
  assumes a: "a \<in> S" "b \<notin> S" "sort_of a = sort_of b"
  shows "(a \<rightleftharpoons> b) \<bullet> S \<noteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<rightleftharpoons> b) \<bullet> S \<noteq> S
[PROOF STEP]
unfolding permute_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(a \<rightleftharpoons> b) \<bullet> x |x. x \<in> S} \<noteq> S
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<notin> S
sort_of a = sort_of b

goal (1 subgoal):
 1. {(a \<rightleftharpoons> b) \<bullet> x |x. x \<in> S} \<noteq> S
[PROOF STEP]
by (auto simp: swap_atom)


[STATEMENT]
lemma card_lists_length_eq:
  shows "card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
 2. \<not> ?P \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
assume "finite B"
[PROOF STATE]
proof (state)
this:
finite B

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
 2. \<not> ?P \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite B

goal (1 subgoal):
 1. card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
by (rule card_lists_length_eq)
[PROOF STATE]
proof (state)
this:
card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n

goal (1 subgoal):
 1. infinite B \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite B \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
assume "infinite B"
[PROOF STATE]
proof (state)
this:
infinite B

goal (1 subgoal):
 1. infinite B \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite B

goal (1 subgoal):
 1. card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>infinite B; ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
 2. \<lbrakk>infinite B; \<not> ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
assume "n = 0"
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. \<lbrakk>infinite B; ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
 2. \<lbrakk>infinite B; \<not> ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
have "{xs. set xs \<subseteq> B \<and> length xs = n} = {[]}"
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. {xs. set xs \<subseteq> B \<and> length xs = n} = {[]}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. set xs \<subseteq> B \<and> length xs = n} = {[]}

goal (2 subgoals):
 1. \<lbrakk>infinite B; ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
 2. \<lbrakk>infinite B; \<not> ?P1\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
from this \<open>n = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
{xs. set xs \<subseteq> B \<and> length xs = n} = {[]}
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{xs. set xs \<subseteq> B \<and> length xs = n} = {[]}
n = 0

goal (1 subgoal):
 1. card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n

goal (1 subgoal):
 1. \<lbrakk>infinite B; n \<noteq> 0\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>infinite B; n \<noteq> 0\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
assume "n \<noteq> 0"
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. \<lbrakk>infinite B; n \<noteq> 0\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
from this \<open>infinite B\<close>
[PROOF STATE]
proof (chain)
picking this:
n \<noteq> 0
infinite B
[PROOF STEP]
have "infinite {xs. set xs \<subseteq> B \<and> length xs = n}"
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0
infinite B

goal (1 subgoal):
 1. infinite {xs. set xs \<subseteq> B \<and> length xs = n}
[PROOF STEP]
by (simp add: finite_lists_length_eq_iff)
[PROOF STATE]
proof (state)
this:
infinite {xs. set xs \<subseteq> B \<and> length xs = n}

goal (1 subgoal):
 1. \<lbrakk>infinite B; n \<noteq> 0\<rbrakk> \<Longrightarrow> card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
from this \<open>infinite B\<close>
[PROOF STATE]
proof (chain)
picking this:
infinite {xs. set xs \<subseteq> B \<and> length xs = n}
infinite B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite {xs. set xs \<subseteq> B \<and> length xs = n}
infinite B

goal (1 subgoal):
 1. card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {xs. set xs \<subseteq> B \<and> length xs = n} = card B ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cons_prefix_Cons [simp]: "(x#xs <= y#ys) = (x=y & xs<=ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs \<le> y # ys) = (x = y \<and> xs \<le> ys)
[PROOF STEP]
by (simp add: prefix_def)


[STATEMENT]
lemma gauss_int_norm_0 [simp]: "gauss_int_norm 0 = 0"
  and gauss_int_norm_1 [simp]: "gauss_int_norm 1 = 1"
  and gauss_int_norm_i [simp]: "gauss_int_norm \<i>\<^sub>\<int> = 1"
  and gauss_int_norm_cnj [simp]: "gauss_int_norm (gauss_cnj z) = gauss_int_norm z"
  and gauss_int_norm_of_nat [simp]: "gauss_int_norm (of_nat n) = n ^ 2"
  and gauss_int_norm_of_int [simp]: "gauss_int_norm (of_int m) = nat (m ^ 2)"
  and gauss_int_norm_of_numeral [simp]: "gauss_int_norm (numeral n') = numeral (Num.sqr n')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (gauss_int_norm 0 = 0 &&& gauss_int_norm 1 = 1 &&& gauss_int_norm \<i>\<^sub>\<int> = 1) &&& (gauss_int_norm (gauss_cnj z) = gauss_int_norm z &&& gauss_int_norm (of_nat n) = n\<^sup>2) &&& gauss_int_norm (of_int m) = nat (m\<^sup>2) &&& gauss_int_norm (numeral n') = numeral (Num.sqr n')
[PROOF STEP]
by (simp_all add: gauss_int_norm_def nat_power_eq)


[STATEMENT]
lemma numeral_le_ceiling [simp]: "numeral v \<le> \<lceil>x\<rceil> \<longleftrightarrow> numeral v - 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral v \<le> \<lceil>x\<rceil>) = (numeral v - (1::'a) < x)
[PROOF STEP]
by (simp add: le_ceiling_iff)


[STATEMENT]
lemma closure_hull: "closure S = closed hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure S = closed hull S
[PROOF STEP]
by (auto simp: hull_def closure_interior interior_def)


[STATEMENT]
lemma factorize_polys_map_distinct:
  assumes "factorize_polys ps = (fs,data)"
  assumes "fss =  map real_of_rat_poly fs"
  shows "distinct fss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct fss
[PROOF STEP]
using factorize_polys_irreducible_monic[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
distinct fs
?f \<in> set fs \<Longrightarrow> irreducible ?f \<and> monic ?f

goal (1 subgoal):
 1. distinct fss
[PROOF STEP]
unfolding assms(2)
[PROOF STATE]
proof (prove)
using this:
distinct fs
?f \<in> set fs \<Longrightarrow> irreducible ?f \<and> monic ?f

goal (1 subgoal):
 1. distinct (map real_of_rat_poly fs)
[PROOF STEP]
apply (simp add: distinct_conv_nth)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i<length fs. \<forall>j<length fs. i \<noteq> j \<longrightarrow> fs ! i \<noteq> fs ! j; \<And>f. f \<in> set fs \<Longrightarrow> irreducible f \<and> monic f\<rbrakk> \<Longrightarrow> \<forall>i<length fs. \<forall>j<length fs. i \<noteq> j \<longrightarrow> real_of_rat_poly (fs ! i) \<noteq> real_of_rat_poly (fs ! j)
[PROOF STEP]
by (metis of_rat_eq_iff of_rat_hom.coeff_map_poly_hom poly_eqI)


[STATEMENT]
lemma uncountable_minus_countable:
  "uncountable A \<Longrightarrow> countable B \<Longrightarrow> uncountable (A - B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>uncountable A; countable B\<rbrakk> \<Longrightarrow> uncountable (A - B)
[PROOF STEP]
using countable_Un[of B "A - B"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>countable B; countable (A - B)\<rbrakk> \<Longrightarrow> countable (B \<union> (A - B))

goal (1 subgoal):
 1. \<lbrakk>uncountable A; countable B\<rbrakk> \<Longrightarrow> uncountable (A - B)
[PROOF STEP]
by auto


[STATEMENT]
lemma all_lt_Max_imp_lt_mset: "N \<noteq> {#} \<Longrightarrow> (\<forall>a \<in># M. a < Max (set_mset N)) \<Longrightarrow> M < N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<noteq> {#}; \<forall>a\<in>#M. a < Max_mset N\<rbrakk> \<Longrightarrow> M < N
[PROOF STEP]
by (meson Max_in[OF finite_set_mset] ex_gt_imp_less_multiset set_mset_eq_empty_iff)


[STATEMENT]
lemma upset_set_prop_var: "\<Up>X = (\<Union>x \<in> X. \<up>x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Up> X = \<Union> (\<up> ` X)
[PROOF STEP]
by (simp add: image_Union downset_set_prop_var upset_set_to_downset_set2 upset_to_downset2)


[STATEMENT]
lemma collinear_imp_coplanar:
  "collinear s ==> coplanar s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear s \<Longrightarrow> coplanar s
[PROOF STEP]
by (metis collinear_affine_hull coplanar_def insert_absorb2)


[STATEMENT]
lemma degree_divisor: assumes "irreducible (f :: 'a :: prime_card mod_ring poly)" "degree f = d"
  shows "f dvd (monom 1 1)^(CARD('a)^d) - monom 1 1"
  and "1 \<le> c \<Longrightarrow> c < d \<Longrightarrow> \<not> f dvd (monom 1 1)^(CARD('a)^c) - monom 1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f dvd monom 1 1 ^ CARD('a) ^ d - monom 1 1 &&& (\<lbrakk>1 \<le> c; c < d\<rbrakk> \<Longrightarrow> \<not> f dvd monom 1 1 ^ CARD('a) ^ c - monom 1 1)
[PROOF STEP]
using assms degree_divisor1 degree_divisor2
[PROOF STATE]
proof (prove)
using this:
irreducible f
degree f = d
\<lbrakk>irreducible ?f; degree ?f = ?d\<rbrakk> \<Longrightarrow> ?f dvd monom 1 1 ^ CARD(?'a) ^ ?d - monom 1 1
\<lbrakk>irreducible ?f; degree ?f = ?d; 1 \<le> ?c; ?c < ?d\<rbrakk> \<Longrightarrow> \<not> ?f dvd monom 1 1 ^ CARD(?'a) ^ ?c - monom 1 1

goal (1 subgoal):
 1. f dvd monom 1 1 ^ CARD('a) ^ d - monom 1 1 &&& (\<lbrakk>1 \<le> c; c < d\<rbrakk> \<Longrightarrow> \<not> f dvd monom 1 1 ^ CARD('a) ^ c - monom 1 1)
[PROOF STEP]
by blast+


[STATEMENT]
lemma set_offending_flows_simp:
    "\<lbrakk> wf_graph G \<rbrakk> \<Longrightarrow>
      set_offending_flows G nP = {F. F \<subseteq> edges G \<and>
        (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and>
        (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_graph G \<Longrightarrow> set_offending_flows G nP = {F. F \<subseteq> edges G \<and> (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and> (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)}
[PROOF STEP]
apply(simp only: set_offending_flows_def is_offending_flows_min_set_def
      is_offending_flows_def delete_edges_simp2 add_edge_def graph.select_convs)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_graph G \<Longrightarrow> {F. F \<subseteq> edges G \<and> (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and> (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G \<union> {e1, e2}, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)} = {F. F \<subseteq> edges G \<and> (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and> (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)}
[PROOF STEP]
apply(subgoal_tac "\<And>F e1 e2. F \<subseteq> edges G \<Longrightarrow> (e1, e2) \<in> F \<Longrightarrow> nodes G \<union> {e1, e2} = nodes G")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>wf_graph G; \<And>F e1 e2. \<lbrakk>F \<subseteq> edges G; (e1, e2) \<in> F\<rbrakk> \<Longrightarrow> nodes G \<union> {e1, e2} = nodes G\<rbrakk> \<Longrightarrow> {F. F \<subseteq> edges G \<and> (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and> (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G \<union> {e1, e2}, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)} = {F. F \<subseteq> edges G \<and> (\<not> sinvar G nP \<and> sinvar \<lparr>nodes = nodes G, edges = edges G - F\<rparr> nP) \<and> (\<forall>(e1, e2)\<in>F. \<not> sinvar \<lparr>nodes = nodes G, edges = {(e1, e2)} \<union> (edges G - F)\<rparr> nP)}
 2. \<And>F e1 e2. \<lbrakk>wf_graph G; F \<subseteq> edges G; (e1, e2) \<in> F\<rbrakk> \<Longrightarrow> nodes G \<union> {e1, e2} = nodes G
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F e1 e2. \<lbrakk>wf_graph G; F \<subseteq> edges G; (e1, e2) \<in> F\<rbrakk> \<Longrightarrow> nodes G \<union> {e1, e2} = nodes G
[PROOF STEP]
apply(simp add: wf_graph_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>F e1 e2. \<lbrakk>fst ` edges G \<subseteq> nodes G \<and> snd ` edges G \<subseteq> nodes G \<and> finite (edges G) \<and> finite (nodes G); F \<subseteq> edges G; (e1, e2) \<in> F\<rbrakk> \<Longrightarrow> insert e1 (insert e2 (nodes G)) = nodes G
[PROOF STEP]
by (metis fst_conv imageI in_mono insert_absorb snd_conv)


[STATEMENT]
lemma integrable_sinc':
  "interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)
[PROOF STEP]
have *: "interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. \<theta> * sinc (t * \<theta>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. \<theta> * sinc (t * \<theta>))
[PROOF STEP]
by (intro interval_lebesgue_integrable_mult_right interval_integrable_isCont continuous_within_compose3 [OF isCont_sinc])
       auto
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. \<theta> * sinc (t * \<theta>))

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)
[PROOF STEP]
by (rule interval_lebesgue_integrable_cong_AE[THEN iffD1, OF _ _ _ *])
       (insert AE_lborel_singleton[of 0], auto)
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integrable lborel (ereal 0) (ereal T) (\<lambda>t. sin (t * \<theta>) / t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma blaschke_unit_circle_fix [simp]:
  assumes "cmod a \<noteq> 1"
  shows "unit_circle_fix (blaschke a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_circle_fix (blaschke a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cmod a \<noteq> 1

goal (1 subgoal):
 1. unit_circle_fix (blaschke a)
[PROOF STEP]
by (transfer, transfer) (simp add: unitary11_gen_def mat_adj_def mat_cnj_def)


[STATEMENT]
lemma multiplicity_characterization_int: "S = {p. 0 < f (p::int)} \<Longrightarrow>
    finite S \<Longrightarrow> \<forall>p\<in>S. prime p \<Longrightarrow> prime p \<Longrightarrow> n = (\<Prod>p\<in>S. p ^ f p) \<Longrightarrow> multiplicity p n = f p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S = {p. 0 < f p}; finite S; \<forall>p\<in>S. prime p; prime p; n = (\<Prod>p\<in>S. p ^ f p)\<rbrakk> \<Longrightarrow> multiplicity p n = f p
[PROOF STEP]
by (frule prime_factorization_unique_int [of S f n, THEN conjunct2, rule_format, symmetric])
     (auto simp: abs_prod power_abs prime_ge_0_int intro!: prod.cong)


[STATEMENT]
lemma take_bit_Suc_minus_bit0:
  \<open>take_bit (Suc n) (- numeral (Num.Bit0 k)) = take_bit n (- numeral k) * (2 :: int)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (Suc n) (- numeral (num.Bit0 k)) = take_bit n (- numeral k) * 2
[PROOF STEP]
by (simp add: take_bit_Suc numeral_Bit0_div_2)


[STATEMENT]
lemma fill_gholes_arbitrary:
  assumes lCs: "length Cs = length ts"
    and lss: "length ss = length ts"
    and rec: "\<And> i. i < length ts \<Longrightarrow> num_gholes (Cs ! i) = length (ss ! i) \<and> f (Cs ! i) (ss ! i) = ts ! i"
  shows "map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0 ..< length Cs] = ts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
have "sum_list (map num_gholes Cs) = length (concat ss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map num_gholes Cs) = length (concat ss)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length Cs = length ts
length ss = length ts
?i < length ts \<Longrightarrow> num_gholes (Cs ! ?i) = length (ss ! ?i) \<and> f (Cs ! ?i) (ss ! ?i) = ts ! ?i

goal (1 subgoal):
 1. sum_list (map num_gholes Cs) = length (concat ss)
[PROOF STEP]
by (auto simp: length_concat map_nth_eq_conv intro: arg_cong[of _ _ "sum_list"])
[PROOF STATE]
proof (state)
this:
sum_list (map num_gholes Cs) = length (concat ss)

goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum_list (map num_gholes Cs) = length (concat ss)

goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
have "partition_gholes (concat ss) Cs = ss"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partition_gholes (concat ss) Cs = ss
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length Cs = length ts
length ss = length ts
?i < length ts \<Longrightarrow> num_gholes (Cs ! ?i) = length (ss ! ?i) \<and> f (Cs ! ?i) (ss ! ?i) = ts ! ?i

goal (1 subgoal):
 1. partition_gholes (concat ss) Cs = ss
[PROOF STEP]
by (auto intro: partition_by_concat_id)
[PROOF STATE]
proof (state)
this:
partition_gholes (concat ss) Cs = ss

goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum_list (map num_gholes Cs) = length (concat ss)
partition_gholes (concat ss) Cs = ss
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (map num_gholes Cs) = length (concat ss)
partition_gholes (concat ss) Cs = ss

goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sum_list (map num_gholes Cs) = length (concat ss)
partition_gholes (concat ss) Cs = ss
length Cs = length ts
length ss = length ts
?i < length ts \<Longrightarrow> num_gholes (Cs ! ?i) = length (ss ! ?i) \<and> f (Cs ! ?i) (ss ! ?i) = ts ! ?i

goal (1 subgoal):
 1. map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts
[PROOF STEP]
by (auto intro: nth_equalityI)
[PROOF STATE]
proof (state)
this:
map (\<lambda>i. f (Cs ! i) (partition_gholes (concat ss) Cs ! i)) [0..<length Cs] = ts

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma not_real_square_gt_zero [simp]: "\<not> 0 < x * x \<longleftrightarrow> x = 0"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> 0 < x * x) = (x = 0)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> 0 < x * x \<Longrightarrow> x = 0
[PROOF STEP]
using linorder_less_linear [where x = x and y = 0]
[PROOF STATE]
proof (prove)
using this:
x < 0 \<or> x = 0 \<or> 0 < x

goal (1 subgoal):
 1. \<not> 0 < x * x \<Longrightarrow> x = 0
[PROOF STEP]
apply (simp add: zero_less_mult_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma two_less_eq_exp_length [simp]:
  \<open>2 \<le> 2 ^ LENGTH('b::len)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2::'a) \<le> (2::'a) ^ LENGTH('b)
[PROOF STEP]
using mult_left_mono [of 1 \<open>2 ^ (LENGTH('b::len) - 1)\<close> 2]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(1::'a) \<le> (2::'a) ^ (LENGTH('b) - 1); (0::'a) \<le> (2::'a)\<rbrakk> \<Longrightarrow> (2::'a) * (1::'a) \<le> (2::'a) * (2::'a) ^ (LENGTH('b) - 1)

goal (1 subgoal):
 1. (2::'a) \<le> (2::'a) ^ LENGTH('b)
[PROOF STEP]
by (cases \<open>LENGTH('b::len)\<close>) simp_all


[STATEMENT]
lemma sqmatrix_mult_assoc:
  "(A::('a::{semiring_0,monoid_mult},'m) sqmatrix) * B * C = A * (B * C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<cdot> B \<cdot> C = A \<cdot> (B \<cdot> C)
[PROOF STEP]
apply (cases A)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. A = SqMatrix x \<Longrightarrow> A \<cdot> B \<cdot> C = A \<cdot> (B \<cdot> C)
[PROOF STEP]
apply (cases B)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<lbrakk>A = SqMatrix x; B = SqMatrix xa\<rbrakk> \<Longrightarrow> A \<cdot> B \<cdot> C = A \<cdot> (B \<cdot> C)
[PROOF STEP]
apply (cases C)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa xb. \<lbrakk>A = SqMatrix x; B = SqMatrix xa; C = SqMatrix xb\<rbrakk> \<Longrightarrow> A \<cdot> B \<cdot> C = A \<cdot> (B \<cdot> C)
[PROOF STEP]
apply (simp add: sum_distrib_right sum_distrib_left mult.assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa xb. \<lbrakk>A = SqMatrix x; B = SqMatrix xa; C = SqMatrix xb\<rbrakk> \<Longrightarrow> (\<lambda>i j. \<Sum>k\<in>UNIV. \<Sum>n\<in>UNIV. x i n \<cdot> (xa n k \<cdot> xb k j)) = (\<lambda>i j. \<Sum>k\<in>UNIV. \<Sum>n\<in>UNIV. x i k \<cdot> (xa k n \<cdot> xb n j))
[PROOF STEP]
apply (subst sum.swap)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa xb. \<lbrakk>A = SqMatrix x; B = SqMatrix xa; C = SqMatrix xb\<rbrakk> \<Longrightarrow> (\<lambda>i j. \<Sum>ja\<in>UNIV. \<Sum>ia\<in>UNIV. x i ja \<cdot> (xa ja ia \<cdot> xb ia j)) = (\<lambda>i j. \<Sum>k\<in>UNIV. \<Sum>n\<in>UNIV. x i k \<cdot> (xa k n \<cdot> xb n j))
[PROOF STEP]
apply (rule refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eval_at_point_smult:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "A \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "k \<in> carrier R"
  shows "eval_at_point R a (k \<odot>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> A) = k \<otimes>\<^bsub>R\<^esub> (eval_at_point R a A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_at_point R a (k \<odot>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> A) = k \<otimes> eval_at_point R a A
[PROOF STEP]
by (metis R.Pring_smult assms(1) assms(2) assms(3) coord_ring_def eval_at_point_scalar_mult)


[STATEMENT]
lemma mat_det_mult_sm [simp]:
  shows "mat_det (k *\<^sub>s\<^sub>m A) = (k*k) * mat_det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_det (k *\<^sub>s\<^sub>m A) = k * k * mat_det A
[PROOF STEP]
by (cases A) (auto simp add: field_simps)


[STATEMENT]
lemma algebraic_prod [intro]:
  "(\<And>x. x \<in> A \<Longrightarrow> algebraic (f x)) \<Longrightarrow> algebraic (prod f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> algebraic (f x)) \<Longrightarrow> algebraic (prod f A)
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: algebraic_times)


[STATEMENT]
lemma times_cfs_val_mono:
  assumes "u \<in> Units Q\<^sub>p"
  assumes "a \<in> carrier Q\<^sub>p"
  assumes "b \<in> carrier Q\<^sub>p"
  assumes "val (u \<otimes> a) \<le> val (u \<otimes> b)"
  shows "val a \<le> val b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val a \<le> val b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. val a \<le> val b
[PROOF STEP]
have "eint (ord u) + val a \<le> eint (ord u) + val b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eint (ord u) + val a \<le> eint (ord u) + val b
[PROOF STEP]
using assms val_ord  val_mult Qp.Units_nonzero Qp.nonzero_closed Units_eq_nonzero
[PROOF STATE]
proof (prove)
using this:
u \<in> Units Q\<^sub>p
a \<in> carrier Q\<^sub>p
b \<in> carrier Q\<^sub>p
val (u \<otimes> a) \<le> val (u \<otimes> b)
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> val ?a = eint (ord ?a)
\<lbrakk>?x \<in> carrier Q\<^sub>p; ?y \<in> carrier Q\<^sub>p\<rbrakk> \<Longrightarrow> val (?x \<otimes> ?y) = val ?x + val ?y
\<lbrakk>?u \<in> Units Q\<^sub>p; \<one> \<noteq> \<zero>\<rbrakk> \<Longrightarrow> ?u \<in> nonzero Q\<^sub>p
?a \<in> nonzero Q\<^sub>p \<Longrightarrow> ?a \<in> carrier Q\<^sub>p
Units Q\<^sub>p = nonzero Q\<^sub>p

goal (1 subgoal):
 1. eint (ord u) + val a \<le> eint (ord u) + val b
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
eint (ord u) + val a \<le> eint (ord u) + val b

goal (1 subgoal):
 1. val a \<le> val b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
eint (ord u) + val a \<le> eint (ord u) + val b

goal (1 subgoal):
 1. val a \<le> val b
[PROOF STEP]
apply(induction "val a")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>int. \<lbrakk>eint int = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
 2. \<lbrakk>\<infinity> = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
[PROOF STEP]
using add_cancel_eint_geq
[PROOF STATE]
proof (prove)
using this:
eint ?a + ?y \<le> eint ?a + ?x \<Longrightarrow> ?y \<le> ?x

goal (2 subgoals):
 1. \<And>int. \<lbrakk>eint int = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
 2. \<lbrakk>\<infinity> = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<infinity> = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
[PROOF STEP]
using add_cancel_eint_geq
[PROOF STATE]
proof (prove)
using this:
eint ?a + ?y \<le> eint ?a + ?x \<Longrightarrow> ?y \<le> ?x

goal (1 subgoal):
 1. \<lbrakk>\<infinity> = val a; eint (ord u) + val a \<le> eint (ord u) + val b\<rbrakk> \<Longrightarrow> val a \<le> val b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
val a \<le> val b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_lt_Max_imp_lt_mset: "N \<noteq> {#} \<Longrightarrow> (\<forall>a \<in># M. a < Max (set_mset N)) \<Longrightarrow> M < N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>N \<noteq> {#}; \<forall>a\<in>#M. a < Max_mset N\<rbrakk> \<Longrightarrow> M < N
[PROOF STEP]
by (meson Max_in[OF finite_set_mset] ex_gt_imp_less_multiset set_mset_eq_empty_iff)


[STATEMENT]
lemma multiset_of_subseqs: "mset ` set (subseqs xs) = { ps. ps \<subseteq># mset xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ` set (subseqs xs) = {ps. ps \<subseteq># mset xs}
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mset ` set (subseqs []) = {ps. ps \<subseteq># mset []}
 2. \<And>a xs. mset ` set (subseqs xs) = {ps. ps \<subseteq># mset xs} \<Longrightarrow> mset ` set (subseqs (a # xs)) = {ps. ps \<subseteq># mset (a # xs)}
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
mset ` set (subseqs xs) = {ps. ps \<subseteq># mset xs}

goal (2 subgoals):
 1. mset ` set (subseqs []) = {ps. ps \<subseteq># mset []}
 2. \<And>a xs. mset ` set (subseqs xs) = {ps. ps \<subseteq># mset xs} \<Longrightarrow> mset ` set (subseqs (a # xs)) = {ps. ps \<subseteq># mset (a # xs)}
[PROOF STEP]
show ?case (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}
[PROOF STEP]
have id: "?r = {ps. ps \<subseteq># mset xs} \<union> (add_mset x) ` {ps. ps \<subseteq># mset xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {ps. ps \<subseteq># mset (x # xs)} = {ps. ps \<subseteq># mset xs} \<union> add_mset x ` {ps. ps \<subseteq># mset xs}
[PROOF STEP]
by (simp add: multiset_subset_insert)
[PROOF STATE]
proof (state)
this:
{ps. ps \<subseteq># mset (x # xs)} = {ps. ps \<subseteq># mset xs} \<union> add_mset x ` {ps. ps \<subseteq># mset xs}

goal (1 subgoal):
 1. mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}
[PROOF STEP]
unfolding id Cons[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset ` set (subseqs (x # xs)) = mset ` set (subseqs xs) \<union> add_mset x ` mset ` set (subseqs xs)
[PROOF STEP]
by (auto simp add: Let_def) (metis UnCI image_iff mset.simps(2))
[PROOF STATE]
proof (state)
this:
mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mset ` set (subseqs (x # xs)) = {ps. ps \<subseteq># mset (x # xs)}

goal (1 subgoal):
 1. mset ` set (subseqs []) = {ps. ps \<subseteq># mset []}
[PROOF STEP]
qed simp


[STATEMENT]
lemma "4 * (x::int) ^ 5 * y ^ 3 * x ^ 2 * 3 + x * z + 3 ^ 5 = 12 * x ^ 7 * y ^ 3 + z * x + 243"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 * x ^ 5 * y ^ 3 * x\<^sup>2 * 3 + x * z + 3 ^ 5 = 12 * x ^ 7 * y ^ 3 + z * x + 243
[PROOF STEP]
by ring


[STATEMENT]
lemma monom_inj:
  "inj_on (\<lambda>a. monom P a n) (carrier R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>a. monom P a n) (carrier R)
[PROOF STEP]
proof (rule inj_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R; monom P x n = monom P y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R; monom P x n = monom P y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume R: "x \<in> carrier R" "y \<in> carrier R" and eq: "monom P x n = monom P y n"
[PROOF STATE]
proof (state)
this:
x \<in> carrier R
y \<in> carrier R
monom P x n = monom P y n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R; monom P x n = monom P y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
monom P x n = monom P y n
[PROOF STEP]
have "coeff P (monom P x n) n = coeff P (monom P y n) n"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
monom P x n = monom P y n

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

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> carrier R; y \<in> carrier R; monom P x n = monom P y n\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
with R
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
coeff P (monom P x n) n = coeff P (monom P y n) n
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
coeff P (monom P x n) n = coeff P (monom P y n) n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_sorted_list_lem1:
  assumes
  "sorted xs"
  "sorted ys"
  "distinct xs"
  "distinct ys"
  " \<forall> x \<in> set xs. x < e"
  " \<forall> y \<in> set ys. e < y"
  shows
  "sorted (xs @ e # ys)"
  "distinct (xs @ e # ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (xs @ e # ys) &&& distinct (xs @ e # ys)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sorted (xs @ e # ys)
 2. distinct (xs @ e # ys)
[PROOF STEP]
from assms (5,6)
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set xs. x < e
\<forall>y\<in>set ys. e < y
[PROOF STEP]
have "\<forall>x\<in>set xs. \<forall>y\<in>set ys. x \<le> y"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. x < e
\<forall>y\<in>set ys. e < y

goal (1 subgoal):
 1. \<forall>x\<in>set xs. \<forall>y\<in>set ys. x \<le> y
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set xs. \<forall>y\<in>set ys. x \<le> y

goal (2 subgoals):
 1. sorted (xs @ e # ys)
 2. distinct (xs @ e # ys)
[PROOF STEP]
thus "sorted (xs @ e # ys)"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. \<forall>y\<in>set ys. x \<le> y

goal (1 subgoal):
 1. sorted (xs @ e # ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. \<forall>y\<in>set ys. x \<le> y
sorted xs
sorted ys
distinct xs
distinct ys
\<forall>x\<in>set xs. x < e
\<forall>y\<in>set ys. e < y

goal (1 subgoal):
 1. sorted (xs @ e # ys)
[PROOF STEP]
by (auto simp add: sorted_append)
[PROOF STATE]
proof (state)
this:
sorted (xs @ e # ys)

goal (1 subgoal):
 1. distinct (xs @ e # ys)
[PROOF STEP]
have "set xs \<inter> set ys = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set xs \<inter> set ys = {}
[PROOF STEP]
using assms (5,6)
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set xs. x < e
\<forall>y\<in>set ys. e < y

goal (1 subgoal):
 1. set xs \<inter> set ys = {}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
set xs \<inter> set ys = {}

goal (1 subgoal):
 1. distinct (xs @ e # ys)
[PROOF STEP]
thus "distinct (xs @ e # ys)"
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys = {}

goal (1 subgoal):
 1. distinct (xs @ e # ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<inter> set ys = {}
sorted xs
sorted ys
distinct xs
distinct ys
\<forall>x\<in>set xs. x < e
\<forall>y\<in>set ys. e < y

goal (1 subgoal):
 1. distinct (xs @ e # ys)
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
distinct (xs @ e # ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma right_inverse:
  assumes "a \<in> U"
  shows "a +\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) = 0\<^sub>o\<^sub>w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
a \<in> U
[PROOF STEP]
have "a +\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a)"
[PROOF STATE]
proof (prove)
using this:
a \<in> U

goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a
[PROOF STEP]
by (simp add: inverse_inverse)
[PROOF STATE]
proof (state)
this:
a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a

goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a

goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
have "\<dots> = 0\<^sub>o\<^sub>w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
by (rule left_inverse[OF uminus_closed[OF assms]])
[PROOF STATE]
proof (state)
this:
-\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w

goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a
-\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = -\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a
-\<^sub>o\<^sub>w (-\<^sub>o\<^sub>w a) +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w

goal (1 subgoal):
 1. a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a +\<^sub>o\<^sub>w -\<^sub>o\<^sub>w a = 0\<^sub>o\<^sub>w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma id_function_tuple_is_function_tuple:
"\<And>k. k \<ge> n \<Longrightarrow> is_function_tuple R k (id_function_tuple R n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n)
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>k. 0 \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R 0)
 2. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
apply (simp add: is_function_tupleI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
fix n k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
assume IH: "(\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n))"
[PROOF STATE]
proof (state)
this:
n \<le> ?k \<Longrightarrow> is_function_tuple R ?k (id_function_tuple R n)

goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
assume A: "Suc n \<le> k"
[PROOF STATE]
proof (state)
this:
Suc n \<le> k

goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
have 0: "(\<lambda>a. a!n) \<in> carrier (R\<^bsup>k\<^esup>)  \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a. a ! n) \<in> carrier (R\<^bsup>k\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
using A cartesian_power_car_memE'
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> k
\<lbrakk>?as \<in> carrier (?R\<^bsup>?n\<^esup>); ?i < ?n\<rbrakk> \<Longrightarrow> ?as ! ?i \<in> carrier ?R

goal (1 subgoal):
 1. (\<lambda>a. a ! n) \<in> carrier (R\<^bsup>k\<^esup>) \<rightarrow> carrier R
[PROOF STEP]
by (metis Pi_I Suc_le_lessD)
[PROOF STATE]
proof (state)
this:
(\<lambda>a. a ! n) \<in> carrier (R\<^bsup>k\<^esup>) \<rightarrow> carrier R

goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
have 1: " is_function_tuple R k (id_function_tuple R n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_function_tuple R k (id_function_tuple R n)
[PROOF STEP]
using A IH  Suc_leD
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> k
n \<le> ?k \<Longrightarrow> is_function_tuple R ?k (id_function_tuple R n)
Suc ?m \<le> ?n \<Longrightarrow> ?m \<le> ?n

goal (1 subgoal):
 1. is_function_tuple R k (id_function_tuple R n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_function_tuple R k (id_function_tuple R n)

goal (1 subgoal):
 1. \<And>n k. \<lbrakk>\<And>k. n \<le> k \<Longrightarrow> is_function_tuple R k (id_function_tuple R n); Suc n \<le> k\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_function_tuple R k (id_function_tuple R n)
[PROOF STEP]
show "is_function_tuple R k (id_function_tuple R (Suc n))"
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R k (id_function_tuple R n)

goal (1 subgoal):
 1. is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
using A  0 id_function_tuple.simps(2)[of R n]
          is_function_tuple_snoc[of R k "id_function_tuple R n" "\<lambda>a. a!n" ]
[PROOF STATE]
proof (prove)
using this:
is_function_tuple R k (id_function_tuple R n)
Suc n \<le> k
(\<lambda>a. a ! n) \<in> carrier (R\<^bsup>k\<^esup>) \<rightarrow> carrier R
id_function_tuple R (Suc n) = id_function_tuple R n @ [\<lambda>x. x ! n]
\<lbrakk>is_function_tuple R k (id_function_tuple R n); (\<lambda>a. a ! n) \<in> carrier (R\<^bsup>k\<^esup>) \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> is_function_tuple R k (id_function_tuple R n @ [\<lambda>a. a ! n])

goal (1 subgoal):
 1. is_function_tuple R k (id_function_tuple R (Suc n))
[PROOF STEP]
by (simp add: "0")
[PROOF STATE]
proof (state)
this:
is_function_tuple R k (id_function_tuple R (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_sumset_leq:
  assumes "A \<subseteq> G"
  shows "card(sumset A A) \<le> Suc(card A) choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> G

goal (1 subgoal):
 1. card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
proof (induction "card A" arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = card A
A \<subseteq> G

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
 2. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = card A
A \<subseteq> G
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = card A
A \<subseteq> G

goal (1 subgoal):
 1. card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
by (metis card_sumset_0_iff zero_le)
[PROOF STATE]
proof (state)
this:
card (sumset A A) \<le> Suc (card A) choose 2

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
case (Suc n A)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = card ?A; ?A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset ?A ?A) \<le> Suc (card ?A) choose 2
Suc n = card A
A \<subseteq> G

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = card ?A; ?A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset ?A ?A) \<le> Suc (card ?A) choose 2
Suc n = card A
A \<subseteq> G
[PROOF STEP]
obtain a A' where a: "a \<in> A" "A' = A - {a}" "a \<in> G"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card ?A; ?A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset ?A ?A) \<le> Suc (card ?A) choose 2
Suc n = card A
A \<subseteq> G

goal (1 subgoal):
 1. (\<And>a A'. \<lbrakk>a \<in> A; A' = A - {a}; a \<in> G\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis Zero_neq_Suc card_eq_0_iff subset_empty subset_eq)
[PROOF STATE]
proof (state)
this:
a \<in> A
A' = A - {a}
a \<in> G

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
A' = A - {a}
a \<in> G
[PROOF STEP]
have n: "card A' = n"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
A' = A - {a}
a \<in> G

goal (1 subgoal):
 1. card A' = n
[PROOF STEP]
by (metis Suc(2) card_Diff_singleton diff_Suc_Suc minus_nat.diff_0 One_nat_def)
[PROOF STATE]
proof (state)
this:
card A' = n

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
have "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
by (metis Suc(2) Zero_neq_Suc card.infinite)
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
have "card (sumset A A) \<le> card (sumset A' A') + card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset A A) \<le> card (sumset A' A') + card A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (sumset A A) \<le> card (sumset A' A') + card A
[PROOF STEP]
have A: "A = A' \<union> {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = A' \<union> {a}
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
a \<in> A
A' = A - {a}
a \<in> G

goal (1 subgoal):
 1. A = A' \<union> {a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A = A' \<union> {a}

goal (1 subgoal):
 1. card (sumset A A) \<le> card (sumset A' A') + card A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A = A' \<union> {a}
[PROOF STEP]
have "sumset A A = (sumset A' A') \<union> (sumset A {a})"
[PROOF STATE]
proof (prove)
using this:
A = A' \<union> {a}

goal (1 subgoal):
 1. sumset A A = sumset A' A' \<union> sumset A {a}
[PROOF STEP]
by (auto simp: sumset_eq commutative)
[PROOF STATE]
proof (state)
this:
sumset A A = sumset A' A' \<union> sumset A {a}

goal (1 subgoal):
 1. card (sumset A A) \<le> card (sumset A' A') + card A
[PROOF STEP]
with a \<open>finite A\<close> card_sumset_le
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
A' = A - {a}
a \<in> G
finite A
finite ?A \<Longrightarrow> card (sumset ?A {?a}) \<le> card ?A
sumset A A = sumset A' A' \<union> sumset A {a}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> A
A' = A - {a}
a \<in> G
finite A
finite ?A \<Longrightarrow> card (sumset ?A {?a}) \<le> card ?A
sumset A A = sumset A' A' \<union> sumset A {a}

goal (1 subgoal):
 1. card (sumset A A) \<le> card (sumset A' A') + card A
[PROOF STEP]
by (simp add: order_trans[OF card_Un_le])
[PROOF STATE]
proof (state)
this:
card (sumset A A) \<le> card (sumset A' A') + card A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (sumset A A) \<le> card (sumset A' A') + card A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (sumset A A) \<le> card (sumset A' A') + card A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
have "\<dots> \<le> (card A) choose 2 + card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (sumset A' A') + card A \<le> card A choose 2 + card A
[PROOF STEP]
using Suc a
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = card ?A; ?A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset ?A ?A) \<le> Suc (card ?A) choose 2
Suc n = card A
A \<subseteq> G
a \<in> A
A' = A - {a}
a \<in> G

goal (1 subgoal):
 1. card (sumset A' A') + card A \<le> card A choose 2 + card A
[PROOF STEP]
by (metis add_le_mono1 insert_Diff_single insert_absorb insert_subset n)
[PROOF STATE]
proof (state)
this:
card (sumset A' A') + card A \<le> card A choose 2 + card A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (sumset A' A') + card A \<le> card A choose 2 + card A

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
have "\<dots> \<le> Suc (card A) choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A choose 2 + card A \<le> Suc (card A) choose 2
[PROOF STEP]
by (simp add: numeral_2_eq_2)
[PROOF STATE]
proof (state)
this:
card A choose 2 + card A \<le> Suc (card A) choose 2

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>\<And>A. \<lbrakk>x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2; Suc x = card A; A \<subseteq> G\<rbrakk> \<Longrightarrow> card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (sumset A A) \<le> Suc (card A) choose 2

goal (1 subgoal):
 1. card (sumset A A) \<le> Suc (card A) choose 2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card (sumset A A) \<le> Suc (card A) choose 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insertion_pow : "insertion f (p^i) = (insertion f p)^i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (p ^ i) = insertion f p ^ i
[PROOF STEP]
proof (induction i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. insertion f (p ^ 0) = insertion f p ^ 0
 2. \<And>i. insertion f (p ^ i) = insertion f p ^ i \<Longrightarrow> insertion f (p ^ Suc i) = insertion f p ^ Suc i
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. insertion f (p ^ 0) = insertion f p ^ 0
 2. \<And>i. insertion f (p ^ i) = insertion f p ^ i \<Longrightarrow> insertion f (p ^ Suc i) = insertion f p ^ Suc i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (p ^ 0) = insertion f p ^ 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insertion f (p ^ 0) = insertion f p ^ 0

goal (1 subgoal):
 1. \<And>i. insertion f (p ^ i) = insertion f p ^ i \<Longrightarrow> insertion f (p ^ Suc i) = insertion f p ^ Suc i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. insertion f (p ^ i) = insertion f p ^ i \<Longrightarrow> insertion f (p ^ Suc i) = insertion f p ^ Suc i
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
insertion f (p ^ n) = insertion f p ^ n

goal (1 subgoal):
 1. \<And>i. insertion f (p ^ i) = insertion f p ^ i \<Longrightarrow> insertion f (p ^ Suc i) = insertion f p ^ Suc i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insertion f (p ^ n) = insertion f p ^ n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
insertion f (p ^ n) = insertion f p ^ n

goal (1 subgoal):
 1. insertion f (p ^ Suc n) = insertion f p ^ Suc n
[PROOF STEP]
by (simp add: insertion_mult)
[PROOF STATE]
proof (state)
this:
insertion f (p ^ Suc n) = insertion f p ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed