[STATEMENT]
lemma sqrt_unique:
  assumes "m^2 \<le> n" "n < (Suc m)^2"
  shows   "Discrete.sqrt n = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sqrt n = m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.sqrt n = m
[PROOF STEP]
have "m' \<le> m" if "m'^2 \<le> n" for m'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
note that
[PROOF STATE]
proof (state)
this:
m'\<^sup>2 \<le> n

goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m'\<^sup>2 \<le> n

goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
note assms(2)
[PROOF STATE]
proof (state)
this:
n < (Suc m)\<^sup>2

goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
m'\<^sup>2 < (Suc m)\<^sup>2
[PROOF STEP]
have "m' < Suc m"
[PROOF STATE]
proof (prove)
using this:
m'\<^sup>2 < (Suc m)\<^sup>2

goal (1 subgoal):
 1. m' < Suc m
[PROOF STEP]
by (rule power_less_imp_less_base) simp_all
[PROOF STATE]
proof (state)
this:
m' < Suc m

goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
thus "m' \<le> m"
[PROOF STATE]
proof (prove)
using this:
m' < Suc m

goal (1 subgoal):
 1. m' \<le> m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m' \<le> m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?m'\<^sup>2 \<le> n \<Longrightarrow> ?m' \<le> m

goal (1 subgoal):
 1. local.sqrt n = m
[PROOF STEP]
with \<open>m^2 \<le> n\<close> sqrt_aux[of n]
[PROOF STATE]
proof (chain)
picking this:
m\<^sup>2 \<le> n
finite {m. m\<^sup>2 \<le> n}
{m. m\<^sup>2 \<le> n} \<noteq> {}
?m'\<^sup>2 \<le> n \<Longrightarrow> ?m' \<le> m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m\<^sup>2 \<le> n
finite {m. m\<^sup>2 \<le> n}
{m. m\<^sup>2 \<le> n} \<noteq> {}
?m'\<^sup>2 \<le> n \<Longrightarrow> ?m' \<le> m

goal (1 subgoal):
 1. local.sqrt n = m
[PROOF STEP]
unfolding Discrete.sqrt_def
[PROOF STATE]
proof (prove)
using this:
m\<^sup>2 \<le> n
finite {m. m\<^sup>2 \<le> n}
{m. m\<^sup>2 \<le> n} \<noteq> {}
?m'\<^sup>2 \<le> n \<Longrightarrow> ?m' \<le> m

goal (1 subgoal):
 1. Max {m. m\<^sup>2 \<le> n} = m
[PROOF STEP]
by (intro antisym Max.boundedI Max.coboundedI) simp_all
[PROOF STATE]
proof (state)
this:
local.sqrt n = m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fds_at_1: "eval_fds f 1 = (\<Sum>n. fds_nth f n / of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_fds f (1::'a) = (\<Sum>n. fds_nth f n / of_nat n)
[PROOF STEP]
using eval_fds_at_nat[of f 1]
[PROOF STATE]
proof (prove)
using this:
eval_fds f (of_nat 1) = (\<Sum>n. fds_nth f n / of_nat n ^ 1)

goal (1 subgoal):
 1. eval_fds f (1::'a) = (\<Sum>n. fds_nth f n / of_nat n)
[PROOF STEP]
by simp


[STATEMENT]
lemma null_char:
    shows "null = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. null = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. null = {}
[PROOF STEP]
let ?P = "\<lambda>n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. null = {}
[PROOF STEP]
have "?P {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}
[PROOF STEP]
using comp_def not_ARR_empty
[PROOF STATE]
proof (prove)
using this:
?f \<cdot> ?g \<equiv> if ARR ?f \<and> ARR ?g \<and> DOM ?f = COD ?g then mkarr (rep ?f \<^bold>\<cdot> rep ?g) else {}
\<not> ARR {}

goal (1 subgoal):
 1. \<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}

goal (1 subgoal):
 1. null = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}

goal (1 subgoal):
 1. null = {}
[PROOF STEP]
have "\<exists>!n. ?P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n
[PROOF STEP]
using ex_un_null
[PROOF STATE]
proof (prove)
using this:
\<exists>!n. \<forall>f. n \<cdot> f = n \<and> f \<cdot> n = n

goal (1 subgoal):
 1. \<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n

goal (1 subgoal):
 1. null = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}
\<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}
\<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n

goal (1 subgoal):
 1. null = {}
[PROOF STEP]
using null_def theI_unique [of ?P "{}"]
[PROOF STATE]
proof (prove)
using this:
\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}
\<exists>!n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n
null = (THE n. \<forall>f. n \<cdot> f = n \<and> f \<cdot> n = n)
\<exists>!x. \<forall>f. f \<cdot> x = x \<and> x \<cdot> f = x \<Longrightarrow> (\<forall>f. f \<cdot> {} = {} \<and> {} \<cdot> f = {}) = ({} = (THE n. \<forall>f. f \<cdot> n = n \<and> n \<cdot> f = n))

goal (1 subgoal):
 1. null = {}
[PROOF STEP]
by (metis comp_null(2))
[PROOF STATE]
proof (state)
this:
null = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Span_eq_generate:
  assumes "set Us \<subseteq> carrier R" shows "Span K Us = generate (add_monoid R) (K <#> (set Us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K Us = generate (add_monoid R) (K <#> set Us)
[PROOF STEP]
proof (rule add.generateI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. subgroup (Span K Us) (add_monoid R)
 2. K <#> set Us \<subseteq> Span K Us
 3. \<And>Ka. \<lbrakk>subgroup Ka (add_monoid R); K <#> set Us \<subseteq> Ka\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> Ka
[PROOF STEP]
show "subgroup (Span K Us) (add_monoid R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (Span K Us) (add_monoid R)
[PROOF STEP]
using Span_is_add_subgroup[OF assms]
[PROOF STATE]
proof (prove)
using this:
subgroup (Span K Us) (add_monoid R)

goal (1 subgoal):
 1. subgroup (Span K Us) (add_monoid R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
subgroup (Span K Us) (add_monoid R)

goal (2 subgoals):
 1. K <#> set Us \<subseteq> Span K Us
 2. \<And>Ka. \<lbrakk>subgroup Ka (add_monoid R); K <#> set Us \<subseteq> Ka\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> Ka
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. K <#> set Us \<subseteq> Span K Us
 2. \<And>Ka. \<lbrakk>subgroup Ka (add_monoid R); K <#> set Us \<subseteq> Ka\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> Ka
[PROOF STEP]
show "\<And>E. \<lbrakk> subgroup E (add_monoid R); K <#> set Us \<subseteq> E \<rbrakk> \<Longrightarrow> Span K Us \<subseteq> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>E. \<lbrakk>subgroup E (add_monoid R); K <#> set Us \<subseteq> E\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> E
[PROOF STEP]
using Span_min assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set ?Us \<subseteq> carrier R; subgroup ?E (add_monoid R); K <#> set ?Us \<subseteq> ?E\<rbrakk> \<Longrightarrow> Span K ?Us \<subseteq> ?E
set Us \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>E. \<lbrakk>subgroup E (add_monoid R); K <#> set Us \<subseteq> E\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> E
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>subgroup ?E (add_monoid R); K <#> set Us \<subseteq> ?E\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> ?E

goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K Us
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K Us
[PROOF STEP]
show "K <#> set Us \<subseteq> Span K Us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K Us
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set Us \<subseteq> carrier R

goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K Us
[PROOF STEP]
proof (induct Us)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> K <#> set [] \<subseteq> Span K []
 2. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
set [] \<subseteq> carrier R

goal (2 subgoals):
 1. set [] \<subseteq> carrier R \<Longrightarrow> K <#> set [] \<subseteq> Span K []
 2. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R

goal (1 subgoal):
 1. K <#> set [] \<subseteq> Span K []
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
using this:
set [] \<subseteq> carrier R

goal (1 subgoal):
 1. (\<Union>h\<in>K. \<Union>k\<in>set []. {h \<otimes> k}) \<subseteq> Span K []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
K <#> set [] \<subseteq> Span K []

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
case (Cons u Us)
[PROOF STATE]
proof (state)
this:
set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us
set (u # Us) \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
have "K <#> set (u # Us) = (K <#> { u }) \<union> (K <#> set Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>h\<in>K. \<Union>k\<in>set (u # Us). {h \<otimes> k}) = (\<Union>h\<in>K. \<Union>k\<in>{u}. {h \<otimes> k}) \<union> (\<Union>h\<in>K. \<Union>k\<in>set Us. {h \<otimes> k})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
have "\<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
assume k: "k \<in> K"
[PROOF STATE]
proof (state)
this:
k \<in> K

goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
hence "combine [ k ] (u # Us) \<in> Span K (u # Us)"
[PROOF STATE]
proof (prove)
using this:
k \<in> K

goal (1 subgoal):
 1. combine [k] (u # Us) \<in> Span K (u # Us)
[PROOF STEP]
using Span_eq_combine_set[OF Cons(2)]
[PROOF STATE]
proof (prove)
using this:
k \<in> K
Span K (u # Us) = {combine Ks (u # Us) |Ks. set Ks \<subseteq> K}

goal (1 subgoal):
 1. combine [k] (u # Us) \<in> Span K (u # Us)
[PROOF STEP]
by (auto simp del: combine.simps)
[PROOF STATE]
proof (state)
this:
combine [k] (u # Us) \<in> Span K (u # Us)

goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
combine [k] (u # Us) \<in> Span K (u # Us)

goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
have "k \<in> carrier R" and "u \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<in> carrier R &&& u \<in> carrier R
[PROOF STEP]
using Cons(2) k subring_props(1)
[PROOF STATE]
proof (prove)
using this:
set (u # Us) \<subseteq> carrier R
k \<in> K
K \<subseteq> carrier R

goal (1 subgoal):
 1. k \<in> carrier R &&& u \<in> carrier R
[PROOF STEP]
by (blast, auto)
[PROOF STATE]
proof (state)
this:
k \<in> carrier R
u \<in> carrier R

goal (1 subgoal):
 1. \<And>k. k \<in> K \<Longrightarrow> k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
combine [k] (u # Us) \<in> Span K (u # Us)
k \<in> carrier R
u \<in> carrier R
[PROOF STEP]
show "k \<otimes> u \<in> Span K (u # Us)"
[PROOF STATE]
proof (prove)
using this:
combine [k] (u # Us) \<in> Span K (u # Us)
k \<in> carrier R
u \<in> carrier R

goal (1 subgoal):
 1. k \<otimes> u \<in> Span K (u # Us)
[PROOF STEP]
by (auto simp del: Span.simps)
[PROOF STATE]
proof (state)
this:
k \<otimes> u \<in> Span K (u # Us)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?k \<in> K \<Longrightarrow> ?k \<otimes> u \<in> Span K (u # Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
hence "K <#> { u } \<subseteq> Span K (u # Us)"
[PROOF STATE]
proof (prove)
using this:
?k \<in> K \<Longrightarrow> ?k \<otimes> u \<in> Span K (u # Us)

goal (1 subgoal):
 1. K <#> {u} \<subseteq> Span K (u # Us)
[PROOF STEP]
unfolding set_mult_def
[PROOF STATE]
proof (prove)
using this:
?k \<in> K \<Longrightarrow> ?k \<otimes> u \<in> Span K (u # Us)

goal (1 subgoal):
 1. (\<Union>h\<in>K. \<Union>k\<in>{u}. {h \<otimes> k}) \<subseteq> Span K (u # Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
K <#> {u} \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
K <#> {u} \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
have "K <#> set Us \<subseteq> Span K (u # Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K (u # Us)
[PROOF STEP]
using mono_Span[of Us u] Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>set Us \<subseteq> carrier R; u \<in> carrier R\<rbrakk> \<Longrightarrow> Span K Us \<subseteq> Span K (u # Us)
set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us
set (u # Us) \<subseteq> carrier R

goal (1 subgoal):
 1. K <#> set Us \<subseteq> Span K (u # Us)
[PROOF STEP]
by (auto simp del: Span.simps)
[PROOF STATE]
proof (state)
this:
K <#> set Us \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. \<And>a Us. \<lbrakk>set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us; set (a # Us) \<subseteq> carrier R\<rbrakk> \<Longrightarrow> K <#> set (a # Us) \<subseteq> Span K (a # Us)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)
K <#> {u} \<subseteq> Span K (u # Us)
K <#> set Us \<subseteq> Span K (u # Us)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)
K <#> {u} \<subseteq> Span K (u # Us)
K <#> set Us \<subseteq> Span K (u # Us)

goal (1 subgoal):
 1. K <#> set (u # Us) \<subseteq> Span K (u # Us)
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
K <#> set (u # Us) = (K <#> {u}) \<union> (K <#> set Us)
K <#> {u} \<subseteq> Span K (u # Us)
K <#> set Us \<subseteq> Span K (u # Us)
set Us \<subseteq> carrier R \<Longrightarrow> K <#> set Us \<subseteq> Span K Us
set (u # Us) \<subseteq> carrier R

goal (1 subgoal):
 1. K <#> set (u # Us) \<subseteq> Span K (u # Us)
[PROOF STEP]
by (auto simp del: Span.simps)
[PROOF STATE]
proof (state)
this:
K <#> set (u # Us) \<subseteq> Span K (u # Us)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
K <#> set Us \<subseteq> Span K Us

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powser_split_head:
  fixes f :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
  assumes "summable (\<lambda>n. f n * z ^ n)"
  shows "suminf (\<lambda>n. f n * z ^ n) = f 0 + suminf (\<lambda>n. f (Suc n) * z ^ n) * z"
    and "suminf (\<lambda>n. f (Suc n) * z ^ n) * z = suminf (\<lambda>n. f n * z ^ n) - f 0"
    and "summable (\<lambda>n. f (Suc n) * z ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z &&& (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0 &&& summable (\<lambda>n. f (Suc n) * z ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
 2. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
 3. summable (\<lambda>n. f (Suc n) * z ^ n)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. f n * z ^ n)
[PROOF STEP]
show "summable (\<lambda>n. f (Suc n) * z ^ n)"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. f n * z ^ n)

goal (1 subgoal):
 1. summable (\<lambda>n. f (Suc n) * z ^ n)
[PROOF STEP]
by (subst summable_powser_split_head)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. f (Suc n) * z ^ n)

goal (2 subgoals):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
 2. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
from suminf_mult2[OF this, of z]
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ n * z)
[PROOF STEP]
have "(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ Suc n)"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ n * z)

goal (1 subgoal):
 1. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ Suc n)
[PROOF STEP]
by (simp add: power_commutes algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ Suc n)

goal (2 subgoals):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
 2. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f (Suc n) * z ^ Suc n)

goal (2 subgoals):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
 2. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. f n * z ^ n)
[PROOF STEP]
have "\<dots> = suminf (\<lambda>n. f n * z ^ n) - f 0"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. f n * z ^ n)

goal (1 subgoal):
 1. (\<Sum>n. f (Suc n) * z ^ Suc n) = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
by (subst suminf_split_head) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f (Suc n) * z ^ Suc n) = (\<Sum>n. f n * z ^ n) - f 0

goal (2 subgoals):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
 2. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
show "suminf (\<lambda>n. f n * z ^ n) = f 0 + suminf (\<lambda>n. f (Suc n) * z ^ n) * z"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0

goal (1 subgoal):
 1. (\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z

goal (1 subgoal):
 1. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z
[PROOF STEP]
show "suminf (\<lambda>n. f (Suc n) * z ^ n) * z = suminf (\<lambda>n. f n * z ^ n) - f 0"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. f n * z ^ n) = f 0 + (\<Sum>n. f (Suc n) * z ^ n) * z

goal (1 subgoal):
 1. (\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>n. f (Suc n) * z ^ n) * z = (\<Sum>n. f n * z ^ n) - f 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma radius_lt_eccentricity: "v \<in> V \<Longrightarrow> radius \<le> eccentricity v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> V \<Longrightarrow> radius \<le> eccentricity v
[PROOF STEP]
using radius_def
[PROOF STATE]
proof (prove)
using this:
radius \<equiv> Inf (eccentricity ` V)

goal (1 subgoal):
 1. v \<in> V \<Longrightarrow> radius \<le> eccentricity v
[PROOF STEP]
by (simp add: INF_lower)


[STATEMENT]
lemma lsc_hull_same_inf:
  fixes f :: "'a::metric_space \<Rightarrow> ereal"
  shows "(INF x. lsc_hull f x) = (INF x. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
have "(INF x. f x) \<le> (INF y\<in>ball x 1. f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (range f) \<le> Inf (f ` ball x 1)
[PROOF STEP]
apply (subst INF_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. m \<in> ball x 1 \<Longrightarrow> \<exists>n\<in>UNIV. f n \<le> f m
 2. True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> Inf (f ` ball x 1)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> Inf (f ` ball x 1)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
have "\<dots> \<le> min (f x) (Liminf (at x) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` ball x 1) \<le> min (f x) (Liminf (at x) f)
[PROOF STEP]
unfolding min_Liminf_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` ball x 1) \<le> (SUP e\<in>{0<..}. Inf (f ` ball x e))
[PROOF STEP]
by (auto intro: SUP_upper)
[PROOF STATE]
proof (state)
this:
Inf (f ` ball x 1) \<le> min (f x) (Liminf (at x) f)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Inf (f ` ball x 1) \<le> min (f x) (Liminf (at x) f)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
have "\<dots>=(lsc_hull f) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (f x) (Liminf (at x) f) = lsc_hull f x
[PROOF STEP]
using lsc_hull_liminf_at[of f]
[PROOF STATE]
proof (prove)
using this:
\<forall>x. lsc_hull f x = min (f x) (Liminf (at x) f)

goal (1 subgoal):
 1. min (f x) (Liminf (at x) f) = lsc_hull f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
min (f x) (Liminf (at x) f) = lsc_hull f x

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Inf (range f) \<le> lsc_hull f x
[PROOF STEP]
have "(INF x. f x) \<le> (lsc_hull f) x"
[PROOF STATE]
proof (prove)
using this:
Inf (range f) \<le> lsc_hull f x

goal (1 subgoal):
 1. Inf (range f) \<le> lsc_hull f x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> lsc_hull f x

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> lsc_hull f ?x2

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
hence "(INF x. f x) \<le> (INF x. lsc_hull f x)"
[PROOF STATE]
proof (prove)
using this:
Inf (range f) \<le> lsc_hull f ?x2

goal (1 subgoal):
 1. Inf (range f) \<le> Inf (range (lsc_hull f))
[PROOF STEP]
apply (subst INF_greatest)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. \<lbrakk>\<And>x. Inf (range f) \<le> lsc_hull f x; i \<in> UNIV\<rbrakk> \<Longrightarrow> Inf (range f) \<le> lsc_hull f i
 2. (\<And>x. Inf (range f) \<le> lsc_hull f x) \<Longrightarrow> True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> Inf (range (lsc_hull f))

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Inf (range f) \<le> Inf (range (lsc_hull f))

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
have "(INF x. lsc_hull f x) \<le> (INF x. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (range (lsc_hull f)) \<le> Inf (range f)
[PROOF STEP]
apply (subst INF_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m. m \<in> UNIV \<Longrightarrow> \<exists>n\<in>UNIV. lsc_hull f n \<le> f m
 2. True
[PROOF STEP]
using lsc_hull_le
[PROOF STATE]
proof (prove)
using this:
lsc_hull ?f ?x \<le> ?f ?x

goal (2 subgoals):
 1. \<And>m. m \<in> UNIV \<Longrightarrow> \<exists>n\<in>UNIV. lsc_hull f n \<le> f m
 2. True
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (range (lsc_hull f)) \<le> Inf (range f)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Inf (range f) \<le> Inf (range (lsc_hull f))
Inf (range (lsc_hull f)) \<le> Inf (range f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Inf (range f) \<le> Inf (range (lsc_hull f))
Inf (range (lsc_hull f)) \<le> Inf (range f)

goal (1 subgoal):
 1. Inf (range (lsc_hull f)) = Inf (range f)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Inf (range (lsc_hull f)) = Inf (range f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_confine_eq_Int:
  assumes "finite I"
  shows "sum (confine f A) I = (\<Sum>i \<in> I \<inter> A. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (confine f A) I = sum f (I \<inter> A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (confine f A) I = sum f (I \<inter> A)
[PROOF STEP]
have "sum f(I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else (0::'b))
[PROOF STEP]
using assms sum.inter_restrict
[PROOF STATE]
proof (prove)
using this:
finite I
finite ?A \<Longrightarrow> sum ?g (?A \<inter> ?B) = (\<Sum>x\<in>?A. if x \<in> ?B then ?g x else (0::?'a))

goal (1 subgoal):
 1. sum f (I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else (0::'b))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum f (I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else (0::'b))

goal (1 subgoal):
 1. sum (confine f A) I = sum f (I \<inter> A)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum f (I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else (0::'b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f (I \<inter> A) = (\<Sum>a\<in>I. if a \<in> A then f a else (0::'b))

goal (1 subgoal):
 1. sum (confine f A) I = sum f (I \<inter> A)
[PROOF STEP]
by (auto simp: confine_def)
[PROOF STATE]
proof (state)
this:
sum (confine f A) I = sum f (I \<inter> A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma adjust_idx_length:
  assumes i: "i < length xs"
    and j: "j < length (remove_nth i xs)"
  shows "adjust_idx i j < length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjust_idx i j < length xs
[PROOF STEP]
using j
[PROOF STATE]
proof (prove)
using this:
j < length (remove_nth i xs)

goal (1 subgoal):
 1. adjust_idx i j < length xs
[PROOF STEP]
unfolding remove_nth_len[OF i] adjust_idx_def
[PROOF STATE]
proof (prove)
using this:
j < length (remove_nth i xs)

goal (1 subgoal):
 1. (if j < i then j else Suc j) < Suc (length (remove_nth i xs))
[PROOF STEP]
by (cases "j < i", auto)


[STATEMENT]
lemma inorder_del: "\<lbrakk> complete t ; sorted1(inorder t) \<rbrakk> \<Longrightarrow>
  inorder(treeD (del x t)) = del_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complete t; sorted1 (inorder t)\<rbrakk> \<Longrightarrow> inorder (treeD (Tree23_Map.del x t)) = AList_Upd_Del.del_list x (inorder t)
[PROOF STEP]
by(induction t rule: del.induct)
  (auto simp: del_list_simps inorder_nodes split_minD split!: if_split prod.splits)


[STATEMENT]
lemma finite_supp_map_bset_Not [simp]:
  assumes "finite (supp xset)"
  shows "finite (supp (map_bset Not xset))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
have "eqvt map_bset" and "eqvt Not"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eqvt map_bset &&& eqvt Formula.Not
[PROOF STEP]
by (simp add: eqvtI)+
[PROOF STATE]
proof (state)
this:
eqvt map_bset
eqvt Formula.Not

goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eqvt map_bset
eqvt Formula.Not
[PROOF STEP]
have "supp (map_bset Not) = {}"
[PROOF STATE]
proof (prove)
using this:
eqvt map_bset
eqvt Formula.Not

goal (1 subgoal):
 1. supp (map_bset Formula.Not) = {}
[PROOF STEP]
using supp_fun_eqvt supp_fun_app_eqvt
[PROOF STATE]
proof (prove)
using this:
eqvt map_bset
eqvt Formula.Not
eqvt ?f \<Longrightarrow> supp ?f = {}
eqvt ?f \<Longrightarrow> supp (?f ?x) \<subseteq> supp ?x

goal (1 subgoal):
 1. supp (map_bset Formula.Not) = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp (map_bset Formula.Not) = {}

goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
supp (map_bset Formula.Not) = {}
[PROOF STEP]
have "supp (map_bset Not xset) \<subseteq> supp xset"
[PROOF STATE]
proof (prove)
using this:
supp (map_bset Formula.Not) = {}

goal (1 subgoal):
 1. supp (map_bset Formula.Not xset) \<subseteq> supp xset
[PROOF STEP]
using supp_fun_app
[PROOF STATE]
proof (prove)
using this:
supp (map_bset Formula.Not) = {}
supp (?f ?x) \<subseteq> supp ?f \<union> supp ?x

goal (1 subgoal):
 1. supp (map_bset Formula.Not xset) \<subseteq> supp xset
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp (map_bset Formula.Not xset) \<subseteq> supp xset

goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite (supp xset)
supp (map_bset Formula.Not xset) \<subseteq> supp xset
[PROOF STEP]
show "finite (supp (map_bset Not xset))"
[PROOF STATE]
proof (prove)
using this:
finite (supp xset)
supp (map_bset Formula.Not xset) \<subseteq> supp xset

goal (1 subgoal):
 1. finite (supp (map_bset Formula.Not xset))
[PROOF STEP]
by (metis finite_subset)
[PROOF STATE]
proof (state)
this:
finite (supp (map_bset Formula.Not xset))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Pring_add_comm:
  assumes "a \<in> carrier (Pring R I)"
  assumes "b \<in> carrier (Pring R I)"
  shows "a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a
[PROOF STEP]
have "a \<Oplus> b = b \<Oplus> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<Oplus> b = b \<Oplus> a
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (a \<Oplus> b) x = (b \<Oplus> a) x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (a \<Oplus> b) x = (b \<Oplus> a) x
[PROOF STEP]
show "(a \<Oplus> b) x = (b \<Oplus> a) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<Oplus> b) x = (b \<Oplus> a) x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
b \<in> carrier (Pring R I)

goal (1 subgoal):
 1. (a \<Oplus> b) x = (b \<Oplus> a) x
[PROOF STEP]
by (metis abelian_monoid.a_comm abelian_monoid_axioms
          indexed_padd_def local.ring_axioms ring.Pring_carrier_coeff')
[PROOF STATE]
proof (state)
this:
(a \<Oplus> b) x = (b \<Oplus> a) x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a \<Oplus> b = b \<Oplus> a

goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<Oplus> b = b \<Oplus> a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<Oplus> b = b \<Oplus> a

goal (1 subgoal):
 1. a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a
[PROOF STEP]
by (simp add: Pring_add)
[PROOF STATE]
proof (state)
this:
a \<oplus>\<^bsub>Pring R I\<^esub> b = b \<oplus>\<^bsub>Pring R I\<^esub> a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cyclic_integer_group [simp]: "cyclic_group integer_group"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cyclic_group integer_group
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cyclic_group integer_group
[PROOF STEP]
have *: "int n \<in> generate integer_group {1}" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int n \<in> generate integer_group {1}
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. int 0 \<in> generate integer_group {1}
 2. \<And>n. int n \<in> generate integer_group {1} \<Longrightarrow> int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. int 0 \<in> generate integer_group {1}
 2. \<And>n. int n \<in> generate integer_group {1} \<Longrightarrow> int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int 0 \<in> generate integer_group {1}
[PROOF STEP]
using generate.simps
[PROOF STATE]
proof (prove)
using this:
(?a \<in> generate ?G ?H) = (?a = \<one>\<^bsub>?G\<^esub> \<or> (\<exists>h. ?a = h \<and> h \<in> ?H) \<or> (\<exists>h. ?a = inv\<^bsub>?G\<^esub> h \<and> h \<in> ?H) \<or> (\<exists>h1 h2. ?a = h1 \<otimes>\<^bsub>?G\<^esub> h2 \<and> h1 \<in> generate ?G ?H \<and> h2 \<in> generate ?G ?H))

goal (1 subgoal):
 1. int 0 \<in> generate integer_group {1}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
int 0 \<in> generate integer_group {1}

goal (1 subgoal):
 1. \<And>n. int n \<in> generate integer_group {1} \<Longrightarrow> int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. int n \<in> generate integer_group {1} \<Longrightarrow> int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
int n \<in> generate integer_group {1}

goal (1 subgoal):
 1. \<And>n. int n \<in> generate integer_group {1} \<Longrightarrow> int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
int n \<in> generate integer_group {1}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
int n \<in> generate integer_group {1}

goal (1 subgoal):
 1. int (Suc n) \<in> generate integer_group {1}
[PROOF STEP]
by simp (metis generate.simps insert_subset integer_group_def monoid.simps(1) subsetI)
[PROOF STATE]
proof (state)
this:
int (Suc n) \<in> generate integer_group {1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
int ?n \<in> generate integer_group {1}

goal (1 subgoal):
 1. cyclic_group integer_group
[PROOF STEP]
have **: "i \<in> generate integer_group {1}" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> generate integer_group {1}
[PROOF STEP]
proof (cases i rule: int_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n. i = int n \<Longrightarrow> i \<in> generate integer_group {1}
 2. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
case (nonneg n)
[PROOF STATE]
proof (state)
this:
i = int n

goal (2 subgoals):
 1. \<And>n. i = int n \<Longrightarrow> i \<in> generate integer_group {1}
 2. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = int n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i = int n

goal (1 subgoal):
 1. i \<in> generate integer_group {1}
[PROOF STEP]
by (simp add: *)
[PROOF STATE]
proof (state)
this:
i \<in> generate integer_group {1}

goal (1 subgoal):
 1. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
case (neg n)
[PROOF STATE]
proof (state)
this:
i = - int (Suc n)

goal (1 subgoal):
 1. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i = - int (Suc n)
[PROOF STEP]
have "-i \<in> generate integer_group {1}"
[PROOF STATE]
proof (prove)
using this:
i = - int (Suc n)

goal (1 subgoal):
 1. - i \<in> generate integer_group {1}
[PROOF STEP]
by (metis "*" add.inverse_inverse)
[PROOF STATE]
proof (state)
this:
- i \<in> generate integer_group {1}

goal (1 subgoal):
 1. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- i \<in> generate integer_group {1}
[PROOF STEP]
have "- (-i) \<in> generate integer_group {1}"
[PROOF STATE]
proof (prove)
using this:
- i \<in> generate integer_group {1}

goal (1 subgoal):
 1. - (- i) \<in> generate integer_group {1}
[PROOF STEP]
by (metis UNIV_I group.generate_m_inv_closed group_integer_group integer_group_def inv_integer_group partial_object.select_convs(1) subsetI)
[PROOF STATE]
proof (state)
this:
- (- i) \<in> generate integer_group {1}

goal (1 subgoal):
 1. \<And>n. i = - int (Suc n) \<Longrightarrow> i \<in> generate integer_group {1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- (- i) \<in> generate integer_group {1}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- (- i) \<in> generate integer_group {1}

goal (1 subgoal):
 1. i \<in> generate integer_group {1}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<in> generate integer_group {1}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i \<in> generate integer_group {1}

goal (1 subgoal):
 1. cyclic_group integer_group
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cyclic_group integer_group
[PROOF STEP]
unfolding cyclic_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>carrier integer_group. subgroup_generated integer_group {x} = integer_group
[PROOF STEP]
by (rule_tac x=1 in bexI)
       (auto simp: carrier_subgroup_generated ** intro: monoid.equality)
[PROOF STATE]
proof (state)
this:
cyclic_group integer_group

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_restriction_inext_singleton_eq: "
  \<lbrakk> set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I \<rbrakk> \<Longrightarrow>
  {inext n (interval_fun I)} = interval_fun {inext n I}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I\<rbrakk> \<Longrightarrow> {inext n (interval_fun I)} = interval_fun {inext n I}
[PROOF STEP]
apply (case_tac "n \<notin> I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I; n \<notin> I\<rbrakk> \<Longrightarrow> {inext n (interval_fun I)} = interval_fun {inext n I}
 2. \<lbrakk>set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I; \<not> n \<notin> I\<rbrakk> \<Longrightarrow> {inext n (interval_fun I)} = interval_fun {inext n I}
[PROOF STEP]
apply (blast dest: set_restriction_not_in_imp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I; \<not> n \<notin> I\<rbrakk> \<Longrightarrow> {inext n (interval_fun I)} = interval_fun {inext n I}
[PROOF STEP]
apply (frule set_restrictionD, erule exE, rename_tac P)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>set_restriction interval_fun; n \<in> interval_fun I; inext n I \<in> interval_fun I; \<not> n \<notin> I; \<forall>A. interval_fun A = {x \<in> A. P x}\<rbrakk> \<Longrightarrow> {inext n (interval_fun I)} = interval_fun {inext n I}
[PROOF STEP]
apply (simp add: singleton_iff set_eq_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>set_restriction interval_fun; n \<in> I \<and> P n; inext n I \<in> I \<and> P (inext n I); \<forall>A x. (x \<in> interval_fun A) = (x \<in> A \<and> P x)\<rbrakk> \<Longrightarrow> \<forall>x. (x = inext n (interval_fun I)) = (x = inext n I \<and> P x)
[PROOF STEP]
by (metis set_restriction_inext_eq)


[STATEMENT]
lemma ccard_inc:
  assumes "p (Suc n')"
    and "n' \<ge> n"
  shows "ccard n (Suc n') p = Suc (ccard n n' p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
let ?A = "{i. i > n \<and> i \<le> n' \<and> p i}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
have "finite ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
have "Suc n' \<notin> ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n' \<notin> {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc n' \<notin> {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {i. n < i \<and> i \<le> n' \<and> p i}
Suc n' \<notin> {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
have "card (insert (Suc n') ?A) = Suc (card ?A)"
[PROOF STATE]
proof (prove)
using this:
finite {i. n < i \<and> i \<le> n' \<and> p i}
Suc n' \<notin> {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
using card_insert_disjoint[of ?A]
[PROOF STATE]
proof (prove)
using this:
finite {i. n < i \<and> i \<le> n' \<and> p i}
Suc n' \<notin> {i. n < i \<and> i \<le> n' \<and> p i}
\<lbrakk>finite {i. n < i \<and> i \<le> n' \<and> p i}; ?x \<notin> {i. n < i \<and> i \<le> n' \<and> p i}\<rbrakk> \<Longrightarrow> card (insert ?x {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})

goal (1 subgoal):
 1. card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
have "insert (Suc n') ?A = {i. i>n \<and> i \<le> (Suc n') \<and> p i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} = {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<subseteq> {i. n < i \<and> i \<le> Suc n' \<and> p i}
 2. {i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
show "insert (Suc n') ?A \<subseteq> {i. n < i \<and> i \<le> Suc n' \<and> p i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<subseteq> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
assume "x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}"
[PROOF STATE]
proof (state)
this:
x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. \<And>x. x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
hence "x=Suc n' \<or> n < x \<and> x \<le> n' \<and> p x"
[PROOF STATE]
proof (prove)
using this:
x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. x = Suc n' \<or> n < x \<and> x \<le> n' \<and> p x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x = Suc n' \<or> n < x \<and> x \<le> n' \<and> p x

goal (1 subgoal):
 1. \<And>x. x \<in> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
thus "x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}"
[PROOF STATE]
proof (prove)
using this:
x = Suc n' \<or> n < x \<and> x \<le> n' \<and> p x

goal (1 subgoal):
 1. x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = Suc n' \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
 2. n < x \<and> x \<le> n' \<and> p x \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
assume "x = Suc n'"
[PROOF STATE]
proof (state)
this:
x = Suc n'

goal (2 subgoals):
 1. x = Suc n' \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
 2. n < x \<and> x \<le> n' \<and> p x \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
with assms (1) assms (2)
[PROOF STATE]
proof (chain)
picking this:
p (Suc n')
n \<le> n'
x = Suc n'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p (Suc n')
n \<le> n'
x = Suc n'

goal (1 subgoal):
 1. x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal (1 subgoal):
 1. n < x \<and> x \<le> n' \<and> p x \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n < x \<and> x \<le> n' \<and> p x \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
assume "n < x \<and> x \<le> n' \<and> p x"
[PROOF STATE]
proof (state)
this:
n < x \<and> x \<le> n' \<and> p x

goal (1 subgoal):
 1. n < x \<and> x \<le> n' \<and> p x \<Longrightarrow> x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n < x \<and> x \<le> n' \<and> p x

goal (1 subgoal):
 1. x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} \<subseteq> {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal (1 subgoal):
 1. {i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
show "{i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') ?A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i. n < i \<and> i \<le> Suc n' \<and> p i} \<subseteq> insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} = {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} = {i. n < i \<and> i \<le> Suc n' \<and> p i}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i}) = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
insert (Suc n') {i. n < i \<and> i \<le> n' \<and> p i} = {i. n < i \<and> i \<le> Suc n' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> Suc n' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n' \<and> p i})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bijections_in_domain_and_range_permutation:
  assumes "finite A" "finite B"
  assumes "card A = card B"
  shows "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
finite B
card A = card B
[PROOF STEP]
obtain f where f: "f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
card A = card B

goal (1 subgoal):
 1. (\<And>f. f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis finite_same_card_bij_on_ext_funcset mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
have proj_f: "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = domain_and_range_permutation A B `` {f}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> domain_and_range_permutation A B `` {f}
 2. domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "id permutes A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. id permutes A
[PROOF STEP]
by (simp add: permutes_id)
[PROOF STATE]
proof (state)
this:
id permutes A

goal (2 subgoals):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> domain_and_range_permutation A B `` {f}
 2. domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from f this
[PROOF STATE]
proof (chain)
picking this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
id permutes A
[PROOF STEP]
show "{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
id permutes A

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> domain_and_range_permutation A B `` {f}
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
id permutes A

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))} `` {f}
[PROOF STEP]
by (fastforce elim: obtain_range_permutation_for_two_bijections)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<subseteq> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
show "domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
fix f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
assume "f' \<in> domain_and_range_permutation A B `` {f}"
[PROOF STATE]
proof (state)
this:
f' \<in> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "(f', f) \<in> domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f', f) \<in> domain_and_range_permutation A B
[PROOF STEP]
using \<open>f' \<in> domain_and_range_permutation A B `` {f}\<close> equiv_domain_and_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
f' \<in> domain_and_range_permutation A B `` {f}
equiv (A \<rightarrow>\<^sub>E B) (domain_and_range_permutation A B)

goal (1 subgoal):
 1. (f', f) \<in> domain_and_range_permutation A B
[PROOF STEP]
by (simp add: equiv_class_eq_iff)
[PROOF STATE]
proof (state)
this:
(f', f) \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(f', f) \<in> domain_and_range_permutation A B
[PROOF STEP]
obtain p\<^sub>A p\<^sub>B where "p\<^sub>A permutes A" "p\<^sub>B permutes B"
        and "\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))"
[PROOF STATE]
proof (prove)
using this:
(f', f) \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
(f', f) \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))}

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))
[PROOF STEP]
have "bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B"
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))

goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B
[PROOF STEP]
using bij_betw_comp_iff f permutes_imp_bij
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))
bij_betw ?f ?A ?A' \<Longrightarrow> bij_betw ?f' ?A' ?A'' = bij_betw (?f' \<circ> ?f) ?A ?A''
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
?p permutes ?S \<Longrightarrow> bij_betw ?p ?S ?S

goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B
[PROOF STEP]
by (metis (no_types, lifting) mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B
[PROOF STEP]
have "bij_betw f' A B"
[PROOF STATE]
proof (prove)
using this:
bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B

goal (1 subgoal):
 1. bij_betw f' A B
[PROOF STEP]
using \<open>\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))\<close>
[PROOF STATE]
proof (prove)
using this:
bij_betw (p\<^sub>B \<circ> f \<circ> p\<^sub>A) A B
\<forall>x\<in>A. f' x = p\<^sub>B (f (p\<^sub>A x))

goal (1 subgoal):
 1. bij_betw f' A B
[PROOF STEP]
by (auto intro: bij_betw_congI)
[PROOF STATE]
proof (state)
this:
bij_betw f' A B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bij_betw f' A B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
have "f' \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
using \<open>f' \<in> domain_and_range_permutation A B `` {f}\<close>
[PROOF STATE]
proof (prove)
using this:
f' \<in> domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
f' \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))} `` {f}

goal (1 subgoal):
 1. f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>x. x \<in> domain_and_range_permutation A B `` {f} \<Longrightarrow> x \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bij_betw f' A B
f' \<in> A \<rightarrow>\<^sub>E B
[PROOF STEP]
show "f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}"
[PROOF STATE]
proof (prove)
using this:
bij_betw f' A B
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f' \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
domain_and_range_permutation A B `` {f} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = domain_and_range_permutation A B `` {f}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B}
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} = domain_and_range_permutation A B `` {f}

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B
[PROOF STEP]
by (simp add: quotientI)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} \<in> {f \<in> A \<rightarrow>\<^sub>E B. bij_betw f A B} // domain_and_range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sup_minus_bot:
  assumes chain: "Complete_Partial_Order.chain (\<le>) A"
  shows "\<Squnion>(A - {\<Squnion>{}}) = \<Squnion>A"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (A - {\<Squnion> {}}) = \<Squnion> A
[PROOF STEP]
proof (rule order.antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Squnion> (A - {\<Squnion> {}}) \<le> \<Squnion> A
 2. \<Squnion> A \<le> \<Squnion> (A - {\<Squnion> {}})
[PROOF STEP]
show "?lhs \<le> ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (A - {\<Squnion> {}}) \<le> \<Squnion> A
[PROOF STEP]
by (blast intro: ccpo_Sup_least chain_Diff[OF chain] ccpo_Sup_upper[OF chain])
[PROOF STATE]
proof (state)
this:
\<Squnion> (A - {\<Squnion> {}}) \<le> \<Squnion> A

goal (1 subgoal):
 1. \<Squnion> A \<le> \<Squnion> (A - {\<Squnion> {}})
[PROOF STEP]
show "?rhs \<le> ?lhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> A \<le> \<Squnion> (A - {\<Squnion> {}})
[PROOF STEP]
proof (rule ccpo_Sup_least [OF chain])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> A \<Longrightarrow> x \<le> \<Squnion> (A - {\<Squnion> {}})
[PROOF STEP]
show "x \<in> A \<Longrightarrow> x \<le> ?lhs" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> A \<Longrightarrow> x \<le> \<Squnion> (A - {\<Squnion> {}})
[PROOF STEP]
by (cases "x = \<Squnion>{}")
        (blast intro: ccpo_Sup_least chain_empty ccpo_Sup_upper[OF chain_Diff[OF chain]])+
[PROOF STATE]
proof (state)
this:
?x \<in> A \<Longrightarrow> ?x \<le> \<Squnion> (A - {\<Squnion> {}})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Squnion> A \<le> \<Squnion> (A - {\<Squnion> {}})

goal:
No subgoals!
[PROOF STEP]
qed