[STATEMENT]
lemma (in PolynRg) polyn_expr_restrict1:"\<lbrakk>pol_coeff S (n, f);
    pol_coeff S (Suc (m + n), g)\<rbrakk> \<Longrightarrow>
    polyn_expr R X (m + n) (add_cf S (n, f) (m + n, g)) =
    polyn_expr R X (m + n) (m + n, snd (add_cf S (n, f) (Suc (m + n), g)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g)\<rbrakk> \<Longrightarrow> polyn_expr R X (m + n) (add_cf S (n, f) (m + n, g)) = polyn_expr R X (m + n) (m + n, snd (add_cf S (n, f) (Suc (m + n), g)))
[PROOF STEP]
apply (frule pol_coeff_pre[of "m+n" g])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g)\<rbrakk> \<Longrightarrow> polyn_expr R X (m + n) (add_cf S (n, f) (m + n, g)) = polyn_expr R X (m + n) (m + n, snd (add_cf S (n, f) (Suc (m + n), g)))
[PROOF STEP]
apply (frule add_cf_pol_coeff[of "(n, f)" "(Suc (m + n), g)"], assumption+,
       frule add_cf_pol_coeff[of "(n, f)" "(m + n, g)"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> polyn_expr R X (m + n) (add_cf S (n, f) (m + n, g)) = polyn_expr R X (m + n) (m + n, snd (add_cf S (n, f) (Suc (m + n), g)))
[PROOF STEP]
apply (rule polyn_exprs_eq[of "add_cf S (n, f) (m + n, g)"
       "(m + n, snd (add_cf S (n, f) (Suc (m + n), g)))" "m + n"], assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> pol_coeff S (m + n, snd (add_cf S (n, f) (Suc (m + n), g)))
 2. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> m + n \<le> min (fst (add_cf S (n, f) (m + n, g))) (fst (m + n, snd (add_cf S (n, f) (Suc (m + n), g))))
 3. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> \<forall>j\<le>m + n. snd (add_cf S (n, f) (m + n, g)) j = snd (m + n, snd (add_cf S (n, f) (Suc (m + n), g))) j
[PROOF STEP]
apply (rule split_pol_coeff[of "add_cf S (n, f) (Suc (m + n), g)" "m + n"],
         assumption, simp add:add_cf_len)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> m + n \<le> min (fst (add_cf S (n, f) (m + n, g))) (fst (m + n, snd (add_cf S (n, f) (Suc (m + n), g))))
 2. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> \<forall>j\<le>m + n. snd (add_cf S (n, f) (m + n, g)) j = snd (m + n, snd (add_cf S (n, f) (Suc (m + n), g))) j
[PROOF STEP]
apply (simp add:add_cf_len)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g))\<rbrakk> \<Longrightarrow> \<forall>j\<le>m + n. snd (add_cf S (n, f) (m + n, g)) j = snd (m + n, snd (add_cf S (n, f) (Suc (m + n), g))) j
[PROOF STEP]
apply (rule allI, rule impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>pol_coeff S (n, f); pol_coeff S (Suc (m + n), g); pol_coeff S (m + n, g); pol_coeff S (add_cf S (n, f) (Suc (m + n), g)); pol_coeff S (add_cf S (n, f) (m + n, g)); j \<le> m + n\<rbrakk> \<Longrightarrow> snd (add_cf S (n, f) (m + n, g)) j = snd (m + n, snd (add_cf S (n, f) (Suc (m + n), g))) j
[PROOF STEP]
apply (simp add:add_cf_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma of_rat_less_1_iff [simp]: "(of_rat r :: 'a::linordered_field) < 1 \<longleftrightarrow> r < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_rat r < (1::'a)) = (r < 1)
[PROOF STEP]
using of_rat_less [of r 1]
[PROOF STATE]
proof (prove)
using this:
(of_rat r < of_rat 1) = (r < 1)

goal (1 subgoal):
 1. (of_rat r < (1::'a)) = (r < 1)
[PROOF STEP]
by simp


[STATEMENT]
lemma smcf_cn_comp_ArrMap_vsv[smc_cn_cs_intros]:
  assumes "\<GG> : \<BB> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<^sub>S\<^sub>M\<^sub>C\<mapsto>\<mapsto>\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)
[PROOF STEP]
interpret L: is_semifunctor \<alpha> \<open>op_smc \<BB>\<close> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : op_smc \<BB> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)
[PROOF STEP]
interpret R: is_semifunctor \<alpha> \<open>op_smc \<AA>\<close> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : op_smc \<AA> \<mapsto>\<mapsto>\<^sub>S\<^sub>M\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)
[PROOF STEP]
by
      (
        rule dghm_cn_cov_comp_ArrMap_vsv
          [
            OF
              L.smcf_is_dghm[unfolded slicing_commute[symmetric]]
              R.smcf_is_dghm[unfolded slicing_commute[symmetric]],
            unfolded slicing_commute slicing_simps
          ]
      )
[PROOF STATE]
proof (state)
this:
vsv ((\<GG> \<^sub>S\<^sub>M\<^sub>C\<^sub>F\<circ> \<FF>)\<lparr>ArrMap\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_graph_countable [simp]: "countable (dom f) \<Longrightarrow> countable (map_graph f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (dom f) \<Longrightarrow> countable (map_graph f)
[PROOF STEP]
apply (auto simp add:map_graph_def countable_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>fa. inj_on fa (dom f) \<Longrightarrow> \<exists>fa. inj_on fa {(x, y). f x = Some y}
[PROOF STEP]
apply (rename_tac f')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f'. inj_on f' (dom f) \<Longrightarrow> \<exists>fa. inj_on fa {(x, y). f x = Some y}
[PROOF STEP]
apply (rule_tac x="f' \<circ> fst" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f'. inj_on f' (dom f) \<Longrightarrow> inj_on (f' \<circ> fst) {(x, y). f x = Some y}
[PROOF STEP]
apply (auto simp add:inj_on_def dom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>f' a b aa ba. \<lbrakk>\<forall>x. (\<exists>y. f x = Some y) \<longrightarrow> (\<forall>y. (\<exists>ya. f y = Some ya) \<longrightarrow> f' x = f' y \<longrightarrow> x = y); f a = Some b; f aa = Some ba; f' a = f' aa\<rbrakk> \<Longrightarrow> b = ba
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma at_least2_Suc: assumes "2 \<le> k"
  obtains k' where "k = Suc(Suc k')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k'. k = Suc (Suc k') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc3_eq_add_3  less_eqE[OF assms]
[PROOF STATE]
proof (prove)
using this:
Suc (Suc (Suc ?n)) = 3 + ?n
(\<And>c. k = 2 + c \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>k'. k = Suc (Suc k') \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma n_dist_var2: "n (n x \<cdot> n y \<oplus> t x \<cdot> n z) = n x \<cdot> t y \<oplus> t x \<cdot> t z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n (n x \<cdot> n y \<oplus> t x \<cdot> n z) = n x \<cdot> t y \<oplus> t x \<cdot> t z
[PROOF STEP]
by (metis (no_types) n_add_op_def n_dist_var1 n_t_closed)


[STATEMENT]
lemma cindex_poly_combine:
  assumes "a<b" "b<c"
  shows "cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
proof (cases "p\<noteq>0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
define A B C D where "A = {x. poly p x = 0 \<and> a < x \<and> x < c}"
                and "B = {x. poly p x = 0 \<and> a < x \<and> x < b}"
                and "C = (if poly p b = 0 then {b} else {})"
                and "D = {x. poly p x = 0 \<and> b < x \<and> x < c}"
[PROOF STATE]
proof (state)
this:
A = {x. poly p x = 0 \<and> a < x \<and> x < c}
B = {x. poly p x = 0 \<and> a < x \<and> x < b}
C = (if poly p b = 0 then {b} else {})
D = {x. poly p x = 0 \<and> b < x \<and> x < c}

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
let ?sum="sum (\<lambda>x. jump_poly q p x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
have "cindex_poly a c q p = ?sum A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_poly a c q p = sum (jump_poly q p) A
[PROOF STEP]
unfolding cindex_poly_def A_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < c. jump_poly q p x) = (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < c. jump_poly q p x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cindex_poly a c q p = sum (jump_poly q p) A

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cindex_poly a c q p = sum (jump_poly q p) A

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
have "... = ?sum (B \<union> C \<union> D)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (jump_poly q p) A = sum (jump_poly q p) (B \<union> C \<union> D)
[PROOF STEP]
apply (rule arg_cong2[where f=sum])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. jump_poly q p = jump_poly q p
 2. A = B \<union> C \<union> D
[PROOF STEP]
unfolding A_def B_def C_def D_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. jump_poly q p = jump_poly q p
 2. {x. poly p x = 0 \<and> a < x \<and> x < c} = {x. poly p x = 0 \<and> a < x \<and> x < b} \<union> (if poly p b = 0 then {b} else {}) \<union> {x. poly p x = 0 \<and> b < x \<and> x < c}
[PROOF STEP]
using less_linear assms
[PROOF STATE]
proof (prove)
using this:
?x < ?y \<or> ?x = ?y \<or> ?y < ?x
a < b
b < c

goal (2 subgoals):
 1. jump_poly q p = jump_poly q p
 2. {x. poly p x = 0 \<and> a < x \<and> x < c} = {x. poly p x = 0 \<and> a < x \<and> x < b} \<union> (if poly p b = 0 then {b} else {}) \<union> {x. poly p x = 0 \<and> b < x \<and> x < c}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) A = sum (jump_poly q p) (B \<union> C \<union> D)

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) A = sum (jump_poly q p) (B \<union> C \<union> D)

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
have "... = ?sum B + ?sum C + ?sum D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
have "finite B" "finite C" "finite D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B &&& finite C &&& finite D
[PROOF STEP]
unfolding B_def C_def D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. poly p x = 0 \<and> a < x \<and> x < b} &&& finite (if poly p b = 0 then {b} else {}) &&& finite {x. poly p x = 0 \<and> b < x \<and> x < c}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. finite {x. poly p x = 0 \<and> a < x \<and> x < b} &&& finite (if poly p b = 0 then {b} else {}) &&& finite {x. poly p x = 0 \<and> b < x \<and> x < c}
[PROOF STEP]
by (auto simp add: poly_roots_finite)
[PROOF STATE]
proof (state)
this:
finite B
finite C
finite D

goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite B
finite C
finite D

goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
have "B \<inter> C = {}" "C \<inter> D = {}" "B \<inter> D = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<inter> C = {} &&& C \<inter> D = {} &&& B \<inter> D = {}
[PROOF STEP]
unfolding B_def C_def D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = 0 \<and> a < x \<and> x < b} \<inter> (if poly p b = 0 then {b} else {}) = {} &&& (if poly p b = 0 then {b} else {}) \<inter> {x. poly p x = 0 \<and> b < x \<and> x < c} = {} &&& {x. poly p x = 0 \<and> a < x \<and> x < b} \<inter> {x. poly p x = 0 \<and> b < x \<and> x < c} = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
b < c

goal (1 subgoal):
 1. {x. poly p x = 0 \<and> a < x \<and> x < b} \<inter> (if poly p b = 0 then {b} else {}) = {} &&& (if poly p b = 0 then {b} else {}) \<inter> {x. poly p x = 0 \<and> b < x \<and> x < c} = {} &&& {x. poly p x = 0 \<and> a < x \<and> x < b} \<inter> {x. poly p x = 0 \<and> b < x \<and> x < c} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<inter> C = {}
C \<inter> D = {}
B \<inter> D = {}

goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite B
finite C
finite D
B \<inter> C = {}
C \<inter> D = {}
B \<inter> D = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite B
finite C
finite D
B \<inter> C = {}
C \<inter> D = {}
B \<inter> D = {}

goal (1 subgoal):
 1. sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D
[PROOF STEP]
by (subst sum.union_disjoint;auto)+
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) (B \<union> C \<union> D) = sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
have "... = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p
[PROOF STEP]
have "?sum C = jump_poly q p b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (jump_poly q p) C = jump_poly q p b
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (jump_poly q p) (if poly p b = 0 then {b} else {}) = jump_poly q p b
[PROOF STEP]
using jump_poly_not_root
[PROOF STATE]
proof (prove)
using this:
poly ?p ?x \<noteq> 0 \<Longrightarrow> jump_poly ?q ?p ?x = 0

goal (1 subgoal):
 1. sum (jump_poly q p) (if poly p b = 0 then {b} else {}) = jump_poly q p b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) C = jump_poly q p b

goal (1 subgoal):
 1. sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sum (jump_poly q p) C = jump_poly q p b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum (jump_poly q p) C = jump_poly q p b

goal (1 subgoal):
 1. sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p
[PROOF STEP]
unfolding cindex_poly_def B_def D_def
[PROOF STATE]
proof (prove)
using this:
sum (jump_poly q p) C = jump_poly q p b

goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x) + sum (jump_poly q p) C + (\<Sum>x | poly p x = 0 \<and> b < x \<and> x < c. jump_poly q p x) = (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x) + jump_poly q p b + (\<Sum>x | poly p x = 0 \<and> b < x \<and> x < c. jump_poly q p x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum (jump_poly q p) B + sum (jump_poly q p) C + sum (jump_poly q p) D = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p

goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
 2. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cindex_poly a c q p = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cindex_poly a c q p = cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p

goal (1 subgoal):
 1. cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p

goal (1 subgoal):
 1. \<not> p \<noteq> 0 \<Longrightarrow> cindex_poly a b q p + jump_poly q p b + cindex_poly b c q p = cindex_poly a c q p
[PROOF STEP]
qed auto


[STATEMENT]
lemma prodinf_le:
  assumes f: "f has_prod a" and g: "g has_prod b" and le: "\<And>n. 0 \<le> f n \<and> f n \<le> g n"
  shows "prodinf f \<le> prodinf g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prodinf f \<le> prodinf g
[PROOF STEP]
using has_prod_le [OF assms] has_prod_unique f g
[PROOF STATE]
proof (prove)
using this:
a \<le> b
?f has_prod ?s \<Longrightarrow> ?s = prodinf ?f
f has_prod a
g has_prod b

goal (1 subgoal):
 1. prodinf f \<le> prodinf g
[PROOF STEP]
by blast


[STATEMENT]
lemma lconjby_uminus: "lconjby x (-y) = - lconjby x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjby x (- y) = - lconjby x y
[PROOF STEP]
using minus_unique[of "lconjby x y", THEN sym]
[PROOF STATE]
proof (prove)
using this:
lconjby x y + ?t = (0::'a) \<Longrightarrow> ?t = - lconjby x y

goal (1 subgoal):
 1. lconjby x (- y) = - lconjby x y
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma ipv6_unparsed_compressed_to_preferred_identity1:
   "ipv6_unparsed_compressed_to_preferred (ipv6addr_syntax_compressed_to_list ipv6compressed) = Some ipv6prferred
    \<longleftrightarrow> ipv6addr_c2p ipv6compressed = ipv6prferred"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ipv6_unparsed_compressed_to_preferred (ipv6addr_syntax_compressed_to_list ipv6compressed) = Some ipv6prferred) = (ipv6addr_c2p ipv6compressed = ipv6prferred)
[PROOF STEP]
by (cases ipv6compressed) (simp_all add: ipv6_unparsed_compressed_to_preferred_def numeral_eq_Suc)


[STATEMENT]
lemma vec_first_smult:
  "\<lbrakk> m \<le> n; x \<in> carrier_vec n \<rbrakk> \<Longrightarrow> vec_first (c \<cdot>\<^sub>v x) m = c \<cdot>\<^sub>v vec_first x m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; x \<in> carrier_vec n\<rbrakk> \<Longrightarrow> vec_first (c \<cdot>\<^sub>v x) m = c \<cdot>\<^sub>v vec_first x m
[PROOF STEP]
unfolding vec_first_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; x \<in> carrier_vec n\<rbrakk> \<Longrightarrow> vec m (($) (c \<cdot>\<^sub>v x)) = c \<cdot>\<^sub>v vec m (($) x)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in is_ntcf) ntcf_of_ntcf_arrow_is_ntcf':
  assumes "\<NN>' = ntcf_arrow \<NN>" and "\<AA>' = \<AA>" and "\<BB>' = \<BB>"
  shows "ntcf_of_ntcf_arrow \<AA> \<BB> \<NN>' : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ntcf_of_ntcf_arrow \<AA> \<BB> \<NN>' : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ntcf_of_ntcf_arrow \<AA> \<BB> (ntcf_arrow \<NN>) : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule ntcf_of_ntcf_arrow_is_ntcf)


[STATEMENT]
lemma UP_pre_univ_prop_fact:
"UP_pre_univ_prop R R (\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. UP_pre_univ_prop R R (\<lambda>x. x)
[PROOF STEP]
unfolding UP_pre_univ_prop_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring R R (\<lambda>x. x) \<and> UP_cring R
[PROOF STEP]
by (simp add: UP_cring_def R_cring  id_is_hom)


[STATEMENT]
lemma vimage_set_iff: "b \<in>\<^sub>\<circ> r `\<^sub>\<circ> A \<longleftrightarrow> (\<exists>a\<in>\<^sub>\<circ>A \<inter>\<^sub>\<circ> \<D>\<^sub>\<circ> r. r\<lparr>a\<rparr> = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in>\<^sub>\<circ> r `\<^sub>\<circ> A) = (\<exists>a\<in>elts (A \<inter>\<^sub>\<circ> \<D>\<^sub>\<circ> r). r\<lparr>a\<rparr> = b)
[PROOF STEP]
unfolding vimage_set_eq_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in>\<^sub>\<circ> r `\<^sub>\<circ> A) = (\<exists>a\<in>elts (A \<inter>\<^sub>\<circ> \<D>\<^sub>\<circ> r). r\<lparr>a\<rparr> = b)
[PROOF STEP]
using vsv_vimage_iff
[PROOF STATE]
proof (prove)
using this:
(?b \<in>\<^sub>\<circ> r `\<^sub>\<circ> ?A) = (\<exists>a. a \<in>\<^sub>\<circ> ?A \<and> a \<in>\<^sub>\<circ> \<D>\<^sub>\<circ> r \<and> r\<lparr>a\<rparr> = ?b)

goal (1 subgoal):
 1. (b \<in>\<^sub>\<circ> r `\<^sub>\<circ> A) = (\<exists>a\<in>elts (A \<inter>\<^sub>\<circ> \<D>\<^sub>\<circ> r). r\<lparr>a\<rparr> = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma card_convert_triangle_rep_bound:
  fixes t :: real
  assumes "card {(x, y, z) \<in> X \<times> Y \<times> Z . (triangle_in_graph x y z)} \<ge> t"
  assumes "X \<subseteq> V" and "Y \<subseteq> V" and "Z \<subseteq> V"
  shows "card (triangle_set) \<ge> 1/6 *t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
define t' where "t' \<equiv> card {(x, y, z) \<in> X \<times> Y \<times> Z . (triangle_in_graph x y z)}"
[PROOF STATE]
proof (state)
this:
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z}

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
have "t' \<ge> t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<le> real t'
[PROOF STEP]
using assms t'_def
[PROOF STATE]
proof (prove)
using this:
t \<le> real (card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z})
X \<subseteq> V
Y \<subseteq> V
Z \<subseteq> V
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z}

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

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t \<le> real t'
[PROOF STEP]
have tgt: "1/6 * t' \<ge> 1/6 * t"
[PROOF STATE]
proof (prove)
using this:
t \<le> real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> 1 / 6 * real t'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 6 * t \<le> 1 / 6 * real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
have "card (triangle_set) \<ge> 1/6 *t'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / 6 * real t' \<le> real (card triangle_set)
[PROOF STEP]
using t'_def card_convert_triangle_rep assms
[PROOF STATE]
proof (prove)
using this:
t' \<equiv> card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z}
\<lbrakk>?X \<subseteq> V; ?Y \<subseteq> V; ?Z \<subseteq> V\<rbrakk> \<Longrightarrow> 1 / 6 * real (card {(x, y, z). (x, y, z) \<in> ?X \<times> ?Y \<times> ?Z \<and> triangle_in_graph x y z}) \<le> real (card triangle_set)
t \<le> real (card {(x, y, z). (x, y, z) \<in> X \<times> Y \<times> Z \<and> triangle_in_graph x y z})
X \<subseteq> V
Y \<subseteq> V
Z \<subseteq> V

goal (1 subgoal):
 1. 1 / 6 * real t' \<le> real (card triangle_set)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 / 6 * real t' \<le> real (card triangle_set)

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / 6 * real t' \<le> real (card triangle_set)

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
using tgt
[PROOF STATE]
proof (prove)
using this:
1 / 6 * real t' \<le> real (card triangle_set)
1 / 6 * t \<le> 1 / 6 * real t'

goal (1 subgoal):
 1. 1 / 6 * t \<le> real (card triangle_set)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
1 / 6 * t \<le> real (card triangle_set)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) generate_is_subgroup:
  assumes "H \<subseteq> carrier G" shows "subgroup (generate G H) G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (generate G H) G
[PROOF STEP]
using subgroup.intro[OF generate_incl eng one generate_m_inv_closed] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?H2 \<subseteq> carrier G; \<And>x y. \<lbrakk>x \<in> generate G ?H2; y \<in> generate G ?H2\<rbrakk> \<Longrightarrow> x \<in> generate G ?H2; \<And>x y. \<lbrakk>x \<in> generate G ?H2; y \<in> generate G ?H2\<rbrakk> \<Longrightarrow> y \<in> generate G ?H2; \<And>x. x \<in> generate G ?H2 \<Longrightarrow> ?H2 \<subseteq> carrier G; \<And>x. x \<in> generate G ?H2 \<Longrightarrow> x \<in> generate G ?H2\<rbrakk> \<Longrightarrow> subgroup (generate G ?H2) G
H \<subseteq> carrier G

goal (1 subgoal):
 1. subgroup (generate G H) G
[PROOF STEP]
by auto


[STATEMENT]
lemma coshr_zero [simp]: "coshr 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coshr 0 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coshr 0 = 1
[PROOF STEP]
have "\<forall>x>1. 1 = sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, x, \<lambda>n. cos_coeff n * 0 ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x>1. 1 = sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, x, \<lambda>n. cos_coeff n * 0 ^ n)
[PROOF STEP]
unfolding sumhr_app
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x>1. 1 = (*f2* (\<lambda>m n. \<Sum>n = m..<n. cos_coeff n * 0 ^ n)) 0 1 + (*f2* (\<lambda>m n. \<Sum>n = m..<n. cos_coeff n * 0 ^ n)) 1 x
[PROOF STEP]
by transfer (simp add: power_0_left)
[PROOF STATE]
proof (state)
this:
\<forall>x>1. 1 = sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, x, \<lambda>n. cos_coeff n * 0 ^ n)

goal (1 subgoal):
 1. coshr 0 = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x>1. 1 = sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, x, \<lambda>n. cos_coeff n * 0 ^ n)
[PROOF STEP]
have "sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>x>1. 1 = sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, x, \<lambda>n. cos_coeff n * 0 ^ n)

goal (1 subgoal):
 1. sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1

goal (1 subgoal):
 1. coshr 0 = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1

goal (1 subgoal):
 1. coshr 0 = 1
[PROOF STEP]
unfolding coshr_def
[PROOF STATE]
proof (prove)
using this:
sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1

goal (1 subgoal):
 1. st (sumhr (0, whn, \<lambda>n. cos_coeff n * 0 ^ n)) = 1
[PROOF STEP]
using sumhr_split_add [OF hypnat_one_less_hypnat_omega] st_unique
[PROOF STATE]
proof (prove)
using this:
sumhr (0, 1, \<lambda>n. cos_coeff n * 0 ^ n) + sumhr (1, whn, \<lambda>n. cos_coeff n * 0 ^ n) \<approx> 1
sumhr (0, 1, ?f) + sumhr (1, whn, ?f) = sumhr (0, whn, ?f)
\<lbrakk>?r \<in> \<real>; ?r \<approx> ?x\<rbrakk> \<Longrightarrow> st ?x = ?r

goal (1 subgoal):
 1. st (sumhr (0, whn, \<lambda>n. cos_coeff n * 0 ^ n)) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
coshr 0 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma col_mat_plus: assumes wf1: "mat nr nc m1"
  and wf2: "mat nr nc m2"
  and i: "i < nc"
  shows "col (mat_plusI pl m1 m2) i = vec_plusI pl (col m1 i) (col m2 i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (mat_plusI pl m1 m2) i = vec_plusI pl (col m1 i) (col m2 i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat nr nc m1
mat nr nc m2
i < nc

goal (1 subgoal):
 1. col (mat_plusI pl m1 m2) i = vec_plusI pl (col m1 i) (col m2 i)
[PROOF STEP]
unfolding mat_plusI_def col_def mat_def
[PROOF STATE]
proof (prove)
using this:
length m1 = nc \<and> Ball (set m1) (vec nr)
length m2 = nc \<and> Ball (set m2) (vec nr)
i < nc

goal (1 subgoal):
 1. map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 m2) ! i = vec_plusI pl (m1 ! i) (m2 ! i)
[PROOF STEP]
proof (induct m1 arbitrary: m2 nc i, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a m1 m2 nc i. \<lbrakk>\<And>m2 nc i. \<lbrakk>length m1 = nc \<and> Ball (set m1) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 m2) ! i = vec_plusI pl (m1 ! i) (m2 ! i); length (a # m1) = nc \<and> Ball (set (a # m1)) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (a # m1) m2) ! i = vec_plusI pl ((a # m1) ! i) (m2 ! i)
[PROOF STEP]
case (Cons v m1)
[PROOF STATE]
proof (state)
this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc

goal (1 subgoal):
 1. \<And>a m1 m2 nc i. \<lbrakk>\<And>m2 nc i. \<lbrakk>length m1 = nc \<and> Ball (set m1) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 m2) ! i = vec_plusI pl (m1 ! i) (m2 ! i); length (a # m1) = nc \<and> Ball (set (a # m1)) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (a # m1) m2) ! i = vec_plusI pl ((a # m1) ! i) (m2 ! i)
[PROOF STEP]
from Cons
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc
[PROOF STEP]
obtain v2 m22 where m2: "m2 = v2 # m22"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc

goal (1 subgoal):
 1. (\<And>v2 m22. m2 = v2 # m22 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases m2, auto)
[PROOF STATE]
proof (state)
this:
m2 = v2 # m22

goal (1 subgoal):
 1. \<And>a m1 m2 nc i. \<lbrakk>\<And>m2 nc i. \<lbrakk>length m1 = nc \<and> Ball (set m1) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 m2) ! i = vec_plusI pl (m1 ! i) (m2 ! i); length (a # m1) = nc \<and> Ball (set (a # m1)) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (a # m1) m2) ! i = vec_plusI pl ((a # m1) ! i) (m2 ! i)
[PROOF STEP]
from m2 Cons
[PROOF STATE]
proof (chain)
picking this:
m2 = v2 # m22
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc
[PROOF STEP]
obtain ncc where nc: "nc = Suc ncc"
[PROOF STATE]
proof (prove)
using this:
m2 = v2 # m22
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc

goal (1 subgoal):
 1. (\<And>ncc. nc = Suc ncc \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
nc = Suc ncc

goal (1 subgoal):
 1. \<And>a m1 m2 nc i. \<lbrakk>\<And>m2 nc i. \<lbrakk>length m1 = nc \<and> Ball (set m1) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 m2) ! i = vec_plusI pl (m1 ! i) (m2 ! i); length (a # m1) = nc \<and> Ball (set (a # m1)) (vec nr); length m2 = nc \<and> Ball (set m2) (vec nr); i < nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (a # m1) m2) ! i = vec_plusI pl ((a # m1) ! i) (m2 ! i)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)
[PROOF STEP]
proof (cases i, simp add: m2)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)
[PROOF STEP]
case (Suc ii)
[PROOF STATE]
proof (state)
this:
i = Suc ii

goal (1 subgoal):
 1. \<And>nat. i = Suc nat \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc
i = Suc ii
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc
i = Suc ii

goal (1 subgoal):
 1. map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)
[PROOF STEP]
using m2 nc
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length m1 = ?nc \<and> (\<forall>a\<in>set m1. vec nr a); length ?m2.0 = ?nc \<and> (\<forall>a\<in>set ?m2.0. vec nr a); ?i < ?nc\<rbrakk> \<Longrightarrow> map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip m1 ?m2.0) ! ?i = vec_plusI pl (m1 ! ?i) (?m2.0 ! ?i)
length (v # m1) = nc \<and> (\<forall>a\<in>set (v # m1). vec nr a)
length m2 = nc \<and> (\<forall>a\<in>set m2. vec nr a)
i < nc
i = Suc ii
m2 = v2 # m22
nc = Suc ncc

goal (1 subgoal):
 1. map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
map (\<lambda>uv. vec_plusI pl (fst uv) (snd uv)) (zip (v # m1) m2) ! i = vec_plusI pl ((v # m1) ! i) (m2 ! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fls_left_inverse_eq_inverse:
  fixes   f :: "'a::division_ring fls"
  shows   "fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
proof (cases "f=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
 2. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f = 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
 2. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
hence "fls_left_inverse f (inverse (f $$ fls_subdegree f)) = fls_const (0::'a)"
[PROOF STATE]
proof (prove)
using this:
f = 0

goal (1 subgoal):
 1. fls_left_inverse f (inverse (f $$ fls_subdegree f)) = fls_const (0::'a)
[PROOF STEP]
by (simp add: fls_lr_inverse_zero(1)[symmetric])
[PROOF STATE]
proof (state)
this:
fls_left_inverse f (inverse (f $$ fls_subdegree f)) = fls_const (0::'a)

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
 2. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
f = 0
fls_left_inverse f (inverse (f $$ fls_subdegree f)) = fls_const (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f = 0
fls_left_inverse f (inverse (f $$ fls_subdegree f)) = fls_const (0::'a)

goal (1 subgoal):
 1. fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0

goal (1 subgoal):
 1. fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
using fls_left_inverse_eq_fls_right_inverse[of "inverse (f $$ fls_subdegree f)"]
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0
\<lbrakk>inverse (f $$ fls_subdegree f) * ?f $$ fls_subdegree ?f = (1::'a); ?f $$ fls_subdegree ?f * ?y = (1::'a)\<rbrakk> \<Longrightarrow> fls_left_inverse ?f (inverse (f $$ fls_subdegree f)) = fls_right_inverse ?f ?y

goal (1 subgoal):
 1. fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f
[PROOF STEP]
by    (auto simp add: fls_inverse_def')
[PROOF STATE]
proof (state)
this:
fls_left_inverse f (inverse (f $$ fls_subdegree f)) = inverse f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_ls_insls:
  assumes "1 < length l"
  shows "1 < length (ls_insls ls l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length (ls_insls ls l)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < length l

goal (1 subgoal):
 1. 1 < length (ls_insls ls l)
[PROOF STEP]
proof (induct l rule: ls_insls.induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l. 1 < length l \<Longrightarrow> 1 < length (ls_insls [] l)
 2. \<And>k v ls l. \<lbrakk>1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l)); 1 < length l\<rbrakk> \<Longrightarrow> 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
1 < length l_

goal (2 subgoals):
 1. \<And>l. 1 < length l \<Longrightarrow> 1 < length (ls_insls [] l)
 2. \<And>k v ls l. \<lbrakk>1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l)); 1 < length l\<rbrakk> \<Longrightarrow> 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < length l_
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 < length l_

goal (1 subgoal):
 1. 1 < length (ls_insls [] l_)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < length (ls_insls [] l_)

goal (1 subgoal):
 1. \<And>k v ls l. \<lbrakk>1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l)); 1 < length l\<rbrakk> \<Longrightarrow> 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k v ls l. \<lbrakk>1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l)); 1 < length l\<rbrakk> \<Longrightarrow> 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
case (2 k v ls l)
[PROOF STATE]
proof (state)
this:
1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l))
1 < length l

goal (1 subgoal):
 1. \<And>k v ls l. \<lbrakk>1 < length (abs_update k v l) \<Longrightarrow> 1 < length (ls_insls ls (abs_update k v l)); 1 < length l\<rbrakk> \<Longrightarrow> 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
from 2(1)[OF length_update[OF 2(2), of k v]]
[PROOF STATE]
proof (chain)
picking this:
1 < length (ls_insls ls (abs_update k v l))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 < length (ls_insls ls (abs_update k v l))

goal (1 subgoal):
 1. 1 < length (ls_insls ((k, v) # ls) l)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < length (ls_insls ((k, v) # ls) l)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Order) ord_isom_less:"\<lbrakk>Order E; ord_isom D E f;
      a \<in> carrier D; b \<in> carrier D\<rbrakk> \<Longrightarrow> (a \<prec>\<^bsub>D\<^esub> b) = ((f a) \<prec>\<^bsub>E\<^esub> (f b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Order E; ord_isom D E f; a \<in> carrier D; b \<in> carrier D\<rbrakk> \<Longrightarrow> a \<prec> b = f a \<prec>\<^bsub>E\<^esub> f b
[PROOF STEP]
by (simp add:ord_isom_def ord_inj_less)


[STATEMENT]
lemma dotprod_le_drop:
  assumes "length a = length b"
    and "k \<le> length a"
  shows "drop k a \<bullet> drop k b \<le> a \<bullet> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop k a \<bullet> drop k b \<le> a \<bullet> b
[PROOF STEP]
using assms and append_take_drop_id [of k a] and append_take_drop_id [of k b]
[PROOF STATE]
proof (prove)
using this:
length a = length b
k \<le> length a
take k a @ drop k a = a
take k b @ drop k b = b

goal (1 subgoal):
 1. drop k a \<bullet> drop k b \<le> a \<bullet> b
[PROOF STEP]
by (metis dotprod_append length_take order_refl trans_le_add2)


[STATEMENT]
lemma RNG001_3:
 "(\<forall>X. sum(additive_identity::'a,X,X)) &
  (\<forall>X. sum(additive_inverse(X),X,additive_identity)) &
  (\<forall>Y U Z X V W. sum(X::'a,Y,U) & sum(Y::'a,Z,V) & sum(U::'a,Z,W) --> sum(X::'a,V,W)) &
  (\<forall>Y X V U Z W. sum(X::'a,Y,U) & sum(Y::'a,Z,V) & sum(X::'a,V,W) --> sum(U::'a,Z,W)) &
  (\<forall>X Y. product(X::'a,Y,multiply(X::'a,Y))) &
  (\<forall>Y Z X V3 V1 V2 V4. product(X::'a,Y,V1) & product(X::'a,Z,V2) & sum(Y::'a,Z,V3) & product(X::'a,V3,V4) --> sum(V1::'a,V2,V4)) &
  (\<forall>Y Z V1 V2 X V3 V4. product(X::'a,Y,V1) & product(X::'a,Z,V2) & sum(Y::'a,Z,V3) & sum(V1::'a,V2,V4) --> product(X::'a,V3,V4)) &
  (~product(a::'a,additive_identity,additive_identity)) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>X. sum (additive_identity, X, X)) \<and> (\<forall>X. sum (additive_inverse X, X, additive_identity)) \<and> (\<forall>Y U Z X V W. sum (X, Y, U) \<and> sum (Y, Z, V) \<and> sum (U, Z, W) \<longrightarrow> sum (X, V, W)) \<and> (\<forall>Y X V U Z W. sum (X, Y, U) \<and> sum (Y, Z, V) \<and> sum (X, V, W) \<longrightarrow> sum (U, Z, W)) \<and> (\<forall>X Y. product (X, Y, multiply (X, Y))) \<and> (\<forall>Y Z X V3 V1 V2 V4. product (X, Y, V1) \<and> product (X, Z, V2) \<and> sum (Y, Z, V3) \<and> product (X, V3, V4) \<longrightarrow> sum (V1, V2, V4)) \<and> (\<forall>Y Z V1 V2 X V3 V4. product (X, Y, V1) \<and> product (X, Z, V2) \<and> sum (Y, Z, V3) \<and> sum (V1, V2, V4) \<longrightarrow> product (X, V3, V4)) \<and> \<not> product (a, additive_identity, additive_identity) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma Qp_funs_Units_memE:
  assumes "f \<in> (Units (Fun\<^bsub>n\<^esub> Q\<^sub>p))"
  shows "f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> inv\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f = \<one>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub>"
        "inv\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f = \<one>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub>"
        "\<And> x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow>  f x \<noteq> \<zero>\<^bsub>Q\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> &&& inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> &&& (\<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>)
[PROOF STEP]
using monoid.Units_r_inv[of "Fun\<^bsub>n\<^esub> Q\<^sub>p" f ] assms  Qp_funs_is_monoid
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p); f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)\<rbrakk> \<Longrightarrow> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)

goal (1 subgoal):
 1. f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> &&& inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> &&& (\<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
 2. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
using monoid.Units_l_inv[of "Fun\<^bsub>n\<^esub> Q\<^sub>p" f ] assms  Qp_funs_is_monoid
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p); f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)\<rbrakk> \<Longrightarrow> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)

goal (2 subgoals):
 1. inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
 2. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
obtain g where g_def: "g = inv\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. g = inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g = inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
show "\<And> x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow>  f x \<noteq> \<zero>\<^bsub>Q\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
assume A: "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (state)
this:
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
have "f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> g = \<one>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
[PROOF STEP]
using assms g_def Qp_funs_is_monoid
        \<open>\<lbrakk>Group.monoid (Fun\<^bsub>n\<^esub> Q\<^sub>p); f \<in> Units (Fun\<^bsub>n\<^esub> Q\<^sub>p)\<rbrakk> \<Longrightarrow> f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> inv\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> f = \<one>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub>\<close>
[PROOF STATE]
proof (prove)
using this:
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
g = inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f
Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)
\<lbrakk>Group.monoid (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p); f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)\<rbrakk> \<Longrightarrow> f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>

goal (1 subgoal):
 1. f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
[PROOF STEP]
have 0: "f x \<otimes> g x = \<one>"
[PROOF STATE]
proof (prove)
using this:
f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>

goal (1 subgoal):
 1. f x \<otimes> g x = \<one>
[PROOF STEP]
using A assms g_def Qp_funs_mult'[of x n f g] Qp_funs_one[of n]
[PROOF STATE]
proof (prove)
using this:
f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = \<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub>
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
g = inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f
\<lbrakk>x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>); f \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p); g \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)\<rbrakk> \<Longrightarrow> (f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g) x = f x \<otimes> g x
\<one>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). \<one>)

goal (1 subgoal):
 1. f x \<otimes> g x = \<one>
[PROOF STEP]
by (metis Qp_funs_is_monoid monoid.Units_closed monoid.Units_inv_closed restrict_apply)
[PROOF STATE]
proof (state)
this:
f x \<otimes> g x = \<one>

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
have 1: "g x \<in> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x \<in> carrier Q\<^sub>p
[PROOF STEP]
using g_def A assms local.function_ring_car_closed
[PROOF STATE]
proof (prove)
using this:
g = inv\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> f
x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f \<in> Units (function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p)
\<lbrakk>?a \<in> carrier (Q\<^sub>p\<^bsup>?n\<^esup>); ?f \<in> carrier (function_ring (carrier (Q\<^sub>p\<^bsup>?n\<^esup>)) Q\<^sub>p)\<rbrakk> \<Longrightarrow> ?f ?a \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. g x \<in> carrier Q\<^sub>p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g x \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. \<And>x. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f x \<noteq> \<zero>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g x \<in> carrier Q\<^sub>p
[PROOF STEP]
show "f x \<noteq> \<zero>\<^bsub>Q\<^sub>p\<^esub>"
[PROOF STATE]
proof (prove)
using this:
g x \<in> carrier Q\<^sub>p

goal (1 subgoal):
 1. f x \<noteq> \<zero>
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
g x \<in> carrier Q\<^sub>p
f x \<otimes> g x = \<one>

goal (1 subgoal):
 1. f x \<noteq> \<zero>
[PROOF STEP]
by (metis Qp.l_null local.one_neq_zero)
[PROOF STATE]
proof (state)
this:
f x \<noteq> \<zero>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x5 \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<Longrightarrow> f ?x5 \<noteq> \<zero>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wadjust_correctness_helper_1:
  assumes "Suc (Suc rs) = a" " wadjust_loop_right_move2 m rs (c, Bk # list)"
  shows "a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list))))
                 < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))
[PROOF STEP]
have "ml + mr = Suc rs \<Longrightarrow> 0 < mr \<Longrightarrow>
       rs - (ml + length (takeWhile (\<lambda>a. a = Oc) list))
       < Suc rs -
         (ml +
          length
           (takeWhile (\<lambda>a. a = Oc)
             (Bk \<up> ln @ Bk # Bk # Oc \<up> mr @ Bk \<up> rn))) "
    for ml mr ln rn
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ml + mr = Suc rs; 0 < mr\<rbrakk> \<Longrightarrow> rs - (ml + length (takeWhile (\<lambda>a. a = Oc) list)) < Suc rs - (ml + length (takeWhile (\<lambda>a. a = Oc) (Bk \<up> ln @ Bk # Bk # Oc \<up> mr @ Bk \<up> rn)))
[PROOF STEP]
by(cases ln, auto)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?ml + ?mr = Suc rs; 0 < ?mr\<rbrakk> \<Longrightarrow> rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) list)) < Suc rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) (Bk \<up> ?ln @ Bk # Bk # Oc \<up> ?mr @ Bk \<up> ?rn)))

goal (1 subgoal):
 1. a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?ml + ?mr = Suc rs; 0 < ?mr\<rbrakk> \<Longrightarrow> rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) list)) < Suc rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) (Bk \<up> ?ln @ Bk # Bk # Oc \<up> ?mr @ Bk \<up> ?rn)))

goal (1 subgoal):
 1. a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?ml + ?mr = Suc rs; 0 < ?mr\<rbrakk> \<Longrightarrow> rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) list)) < Suc rs - (?ml + length (takeWhile (\<lambda>a. a = Oc) (Bk \<up> ?ln @ Bk # Bk # Oc \<up> ?mr @ Bk \<up> ?rn)))
Suc (Suc rs) = a
wadjust_loop_right_move2 m rs (c, Bk # list)

goal (1 subgoal):
 1. a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))
[PROOF STEP]
by (auto simp: wadjust_loop_right_move2.simps dropWhile_exp1 takeWhile_exp1)
[PROOF STATE]
proof (state)
this:
a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Oc # list)))) < a - length (takeWhile (\<lambda>a. a = Oc) (tl (dropWhile (\<lambda>a. a = Oc) (rev c @ Bk # list))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pos_poly_pCons: "pos_poly (pCons a p) \<longleftrightarrow> pos_poly p \<or> (p = 0 \<and> 0 < a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pos_poly (pCons a p) = (pos_poly p \<or> p = 0 \<and> (0::'a) < a)
[PROOF STEP]
by (simp add: pos_poly_def)


[STATEMENT]
lemma hyperpow_Suc_le_self2: "(0::hypreal) \<le> r \<Longrightarrow> r < 1 \<Longrightarrow> r pow (n + (1::hypnat)) \<le> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> r; r < 1\<rbrakk> \<Longrightarrow> r pow (n + 1) \<le> r
[PROOF STEP]
by (metis hyperpow_less_le hyperpow_one hypnat_add_self_le le_less)


[STATEMENT]
lemma edge_density_partition:
  assumes "finite_graph_partition U P n"
  shows "edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * card X) / card U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
proof (cases "finite U")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
 2. infinite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite U

goal (2 subgoals):
 1. finite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
 2. infinite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have "finite P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite P
[PROOF STEP]
using assms finite_graph_partition_def
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition U P n
finite_graph_partition ?V ?P ?n \<equiv> partition_on ?V ?P \<and> finite ?P \<and> card ?P = ?n

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

goal (2 subgoals):
 1. finite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
 2. infinite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite P
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite P

goal (1 subgoal):
 1. edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
using True assms
[PROOF STATE]
proof (prove)
using this:
finite P
finite U
finite_graph_partition U P n

goal (1 subgoal):
 1. edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
proof (induction P arbitrary: n U)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n U. \<lbrakk>finite U; finite_graph_partition U {} n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>{}. edge_density X W G * real (card X)) / real (card U)
 2. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
finite U
finite_graph_partition U {} n

goal (2 subgoals):
 1. \<And>n U. \<lbrakk>finite U; finite_graph_partition U {} n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>{}. edge_density X W G * real (card X)) / real (card U)
 2. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite U
finite_graph_partition U {} n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite U
finite_graph_partition U {} n

goal (1 subgoal):
 1. edge_density U W G = (\<Sum>X\<in>{}. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
by (simp add: edge_density_def finite_graph_partition_def partition_on_def)
[PROOF STATE]
proof (state)
this:
edge_density U W G = (\<Sum>X\<in>{}. edge_density X W G * real (card X)) / real (card U)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
case (insert X P)
[PROOF STATE]
proof (state)
this:
finite P
X \<notin> P
\<lbrakk>finite ?U; finite_graph_partition ?U P ?n\<rbrakk> \<Longrightarrow> edge_density ?U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card ?U)
finite U
finite_graph_partition U (insert X P) n

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite P
X \<notin> P
\<lbrakk>finite ?U; finite_graph_partition ?U P ?n\<rbrakk> \<Longrightarrow> edge_density ?U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card ?U)
finite U
finite_graph_partition U (insert X P) n
[PROOF STEP]
have "n > 0"
[PROOF STATE]
proof (prove)
using this:
finite P
X \<notin> P
\<lbrakk>finite ?U; finite_graph_partition ?U P ?n\<rbrakk> \<Longrightarrow> edge_density ?U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card ?U)
finite U
finite_graph_partition U (insert X P) n

goal (1 subgoal):
 1. 0 < n
[PROOF STEP]
by (metis finite_graph_partition_0 gr_zeroI insert_not_empty)
[PROOF STATE]
proof (state)
this:
0 < n

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
with insert.prems insert.hyps
[PROOF STATE]
proof (chain)
picking this:
finite U
finite_graph_partition U (insert X P) n
finite P
X \<notin> P
0 < n
[PROOF STEP]
have UX: "finite_graph_partition (U-X) P (n-1)"
[PROOF STATE]
proof (prove)
using this:
finite U
finite_graph_partition U (insert X P) n
finite P
X \<notin> P
0 < n

goal (1 subgoal):
 1. finite_graph_partition (U - X) P (n - 1)
[PROOF STEP]
by (auto simp: finite_graph_partition_def partition_on_def disjnt_iff pairwise_insert)
[PROOF STATE]
proof (state)
this:
finite_graph_partition (U - X) P (n - 1)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite_graph_partition (U - X) P (n - 1)
[PROOF STEP]
have finU: "finite (\<Union>P)"
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition (U - X) P (n - 1)

goal (1 subgoal):
 1. finite (\<Union> P)
[PROOF STEP]
by (simp add: finite_graph_partition_equals insert)
[PROOF STATE]
proof (state)
this:
finite (\<Union> P)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union> P)
[PROOF STEP]
have sumXP: "card U = card X + card (\<Union>P)"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union> P)

goal (1 subgoal):
 1. card U = card X + card (\<Union> P)
[PROOF STEP]
by (metis UX card_finite_graph_partition finite_graph_partition_equals insert.hyps insert.prems sum.insert)
[PROOF STATE]
proof (state)
this:
card U = card X + card (\<Union> P)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have FUX: "finite (U - X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (U - X)
[PROOF STEP]
by (simp add: insert.prems)
[PROOF STATE]
proof (state)
this:
finite (U - X)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have XUP: "X \<union> (\<Union>P) = U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<union> \<Union> P = U
[PROOF STEP]
using finite_graph_partition_equals insert.prems(2)
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition ?V ?P ?n \<Longrightarrow> \<Union> ?P = ?V
finite_graph_partition U (insert X P) n

goal (1 subgoal):
 1. X \<union> \<Union> P = U
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X \<union> \<Union> P = U

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
X \<union> \<Union> P = U
[PROOF STEP]
have "edge_density U W G = edge_density (X \<union> \<Union>P) W G"
[PROOF STATE]
proof (prove)
using this:
X \<union> \<Union> P = U

goal (1 subgoal):
 1. edge_density U W G = edge_density (X \<union> \<Union> P) W G
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
edge_density U W G = edge_density (X \<union> \<Union> P) W G

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
edge_density U W G = edge_density (X \<union> \<Union> P) W G

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have "\<dots> = (edge_density X W G * card X + edge_density (\<Union>P) W G * card (\<Union>P))
                  / (card X + card (\<Union>P))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. edge_density (X \<union> \<Union> P) W G = (edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P))
[PROOF STEP]
proof (rule edge_density_Un)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. disjnt X (\<Union> P)
 2. finite X
 3. finite (\<Union> P)
[PROOF STEP]
show "disjnt X (\<Union>P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjnt X (\<Union> P)
[PROOF STEP]
using UX disjnt_iff finite_graph_partition_equals
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition (U - X) P (n - 1)
disjnt ?A ?B = (\<forall>x. \<not> (x \<in> ?A \<and> x \<in> ?B))
finite_graph_partition ?V ?P ?n \<Longrightarrow> \<Union> ?P = ?V

goal (1 subgoal):
 1. disjnt X (\<Union> P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
disjnt X (\<Union> P)

goal (2 subgoals):
 1. finite X
 2. finite (\<Union> P)
[PROOF STEP]
show "finite X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite X
[PROOF STEP]
using XUP \<open>finite U\<close>
[PROOF STATE]
proof (prove)
using this:
X \<union> \<Union> P = U
finite U

goal (1 subgoal):
 1. finite X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite X

goal (1 subgoal):
 1. finite (\<Union> P)
[PROOF STEP]
qed (use finU in auto)
[PROOF STATE]
proof (state)
this:
edge_density (X \<union> \<Union> P) W G = (edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P))

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
edge_density (X \<union> \<Union> P) W G = (edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P))

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have "\<dots> = (edge_density X W G * card X + edge_density (U-X) W G * card (\<Union>P))
                  / card U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P)) = (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U)
[PROOF STEP]
using UX card_finite_graph_partition finite_graph_partition_equals insert.prems(1) insert.prems(2) sumXP
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition (U - X) P (n - 1)
\<lbrakk>finite_graph_partition ?V ?P ?k; finite ?V\<rbrakk> \<Longrightarrow> sum card ?P = card ?V
finite_graph_partition ?V ?P ?n \<Longrightarrow> \<Union> ?P = ?V
finite U
finite_graph_partition U (insert X P) n
card U = card X + card (\<Union> P)

goal (1 subgoal):
 1. (edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P)) = (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P)) = (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(edge_density X W G * real (card X) + edge_density (\<Union> P) W G * real (card (\<Union> P))) / real (card X + card (\<Union> P)) = (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
have "\<dots> = (\<Sum>Y \<in> insert X P. edge_density Y W G * card Y) / card U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U) = (\<Sum>Y\<in>insert X P. edge_density Y W G * real (card Y)) / real (card U)
[PROOF STEP]
using UX insert.prems insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite_graph_partition (U - X) P (n - 1)
finite U
finite_graph_partition U (insert X P) n
finite P
X \<notin> P

goal (1 subgoal):
 1. (edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U) = (\<Sum>Y\<in>insert X P. edge_density Y W G * real (card Y)) / real (card U)
[PROOF STEP]
apply (simp add: insert.IH [OF FUX UX] divide_simps algebra_simps finite_graph_partition_equals)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite_graph_partition (U - X) P (n - Suc 0); finite U; finite_graph_partition U (insert X P) n; finite P; X \<notin> P\<rbrakk> \<Longrightarrow> U \<subseteq> X \<longrightarrow> U \<noteq> {} \<longrightarrow> (\<Sum>Y\<in>P. real (card Y) * edge_density Y W G) = 0
[PROOF STEP]
by (metis (no_types, lifting) Diff_eq_empty_iff finite_graph_partition_empty sum.empty)
[PROOF STATE]
proof (state)
this:
(edge_density X W G * real (card X) + edge_density (U - X) W G * real (card (\<Union> P))) / real (card U) = (\<Sum>Y\<in>insert X P. edge_density Y W G * real (card Y)) / real (card U)

goal (1 subgoal):
 1. \<And>x F n U. \<lbrakk>finite F; x \<notin> F; \<And>n U. \<lbrakk>finite U; finite_graph_partition U F n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>F. edge_density X W G * real (card X)) / real (card U); finite U; finite_graph_partition U (insert x F) n\<rbrakk> \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>insert x F. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
edge_density U W G = (\<Sum>Y\<in>insert X P. edge_density Y W G * real (card Y)) / real (card U)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
edge_density U W G = (\<Sum>Y\<in>insert X P. edge_density Y W G * real (card Y)) / real (card U)

goal (1 subgoal):
 1. edge_density U W G = (\<Sum>X\<in>insert X P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
edge_density U W G = (\<Sum>X\<in>insert X P. edge_density X W G * real (card X)) / real (card U)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)

goal (1 subgoal):
 1. infinite U \<Longrightarrow> edge_density U W G = (\<Sum>X\<in>P. edge_density X W G * real (card X)) / real (card U)
[PROOF STEP]
qed (simp add: edge_density_def)


[STATEMENT]
lemma Cons_nth_in_Joints2:
  assumes "xs \<in> Joints XS"
  assumes "i < length XS"
  assumes "j < length XS"
  shows "((xs ! i) #(xs ! j) # xs) \<in> Joints ((XS ! i)#(XS ! j) # XS)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs ! i # xs ! j # xs \<in> Joints (XS ! i # XS ! j # XS)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
xs \<in> Joints XS
i < length XS
j < length XS

goal (1 subgoal):
 1. xs ! i # xs ! j # xs \<in> Joints (XS ! i # XS ! j # XS)
[PROOF STEP]
by (force simp: Joints_def valuate_def)


[STATEMENT]
lemma circline_equation:
  assumes "H = mk_circline A B C D" and "(A, B, C, D) \<in> hermitean_nonzero"
  shows "of_complex z \<in> circline_set H \<longleftrightarrow> circline_equation A B C D z 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_complex z \<in> circline_set H) = circline_equation A B C D z 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
H = mk_circline A B C D
(A, B, C, D) \<in> hermitean_nonzero

goal (1 subgoal):
 1. (of_complex z \<in> circline_set H) = circline_equation A B C D z 1
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
H = mk_circline A B C D
(A, B, C, D) \<in> hermitean_nonzero

goal (1 subgoal):
 1. (of_complex z \<in> Collect (on_circline H)) = circline_equation A B C D z 1
[PROOF STEP]
by simp (transfer, transfer, simp add: vec_cnj_def field_simps)


[STATEMENT]
theorem (in group_hom) FactGroup_iso_set:
  "h ` carrier G = carrier H
   \<Longrightarrow> (\<lambda>X. the_elem (h`X)) \<in> iso (G Mod (kernel G H h)) H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h ` carrier G = carrier H \<Longrightarrow> (\<lambda>X. the_elem (h ` X)) \<in> Group.iso (G Mod kernel G H h) H
[PROOF STEP]
by (simp add: iso_def FactGroup_hom FactGroup_inj_on bij_betw_def
              FactGroup_onto)


[STATEMENT]
lemma coprime_cong_mult_nat:
  "[a = b] (mod m) \<Longrightarrow> [a = b] (mod n) \<Longrightarrow> coprime m n \<Longrightarrow> [a = b] (mod m * n)"
  for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>[a = b] (mod m); [a = b] (mod n); coprime m n\<rbrakk> \<Longrightarrow> [a = b] (mod m * n)
[PROOF STEP]
by (simp add: cong_altdef_nat' divides_mult)


[STATEMENT]
lemma UP_r_distr:
  assumes R: "p \<in> carrier P" "q \<in> carrier P" "r \<in> carrier P"
  shows "r \<otimes>\<^bsub>P\<^esub> (p \<oplus>\<^bsub>P\<^esub> q) = (r \<otimes>\<^bsub>P\<^esub> p) \<oplus>\<^bsub>P\<^esub> (r \<otimes>\<^bsub>P\<^esub> q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<otimes>\<^bsub>P\<^esub> (p \<oplus>\<^bsub>P\<^esub> q) = r \<otimes>\<^bsub>P\<^esub> p \<oplus>\<^bsub>P\<^esub> r \<otimes>\<^bsub>P\<^esub> q
[PROOF STEP]
by (rule up_eqI) (simp add: r_distr R Pi_def, simp_all add: R)


[STATEMENT]
lemma uniform_limit_sequentially_iff:
  "uniform_limit S f l sequentially \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x \<in> S. dist (f n x) (l x) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit S f l sequentially = (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. dist (f n x) (l x) < e)
[PROOF STEP]
unfolding uniform_limit_iff eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. dist (f n x) (l x) < e) = (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x\<in>S. dist (f n x) (l x) < e)
[PROOF STEP]
..


[STATEMENT]
lemma sum_map_sq_matrix: "(\<Sum>i\<in>I. map_sq_matrix (f i) A) = map_sq_matrix (\<lambda>x. \<Sum>i\<in>I. f i x) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>I. map_sq_matrix (f i) A) = map_sq_matrix (\<lambda>x. \<Sum>i\<in>I. f i x) A
[PROOF STEP]
by (induction I rule: infinite_finite_induct) (simp_all add: add_map_sq_matrix)


[STATEMENT]
lemma weak_ring_morphismI:
  assumes "ideal I R" and "\<And>a b. \<lbrakk> a \<in> carrier R; b \<in> carrier R \<rbrakk> \<Longrightarrow> f a = f b \<longleftrightarrow> a \<ominus>\<^bsub>R\<^esub> b \<in> I"
  shows "weak_ring_morphism f I R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_ring_morphism f I R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
ideal I R
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> (f ?a = f ?b) = (?a \<ominus>\<^bsub>R\<^esub> ?b \<in> I)

goal (1 subgoal):
 1. weak_ring_morphism f I R
[PROOF STEP]
unfolding weak_ring_morphism_def weak_ring_morphism_axioms_def
[PROOF STATE]
proof (prove)
using this:
ideal I R
\<lbrakk>?a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> (f ?a = f ?b) = (?a \<ominus>\<^bsub>R\<^esub> ?b \<in> I)

goal (1 subgoal):
 1. ideal I R \<and> (\<forall>a b. a \<in> carrier R \<longrightarrow> b \<in> carrier R \<longrightarrow> (f a = f b) = (a \<ominus>\<^bsub>R\<^esub> b \<in> I))
[PROOF STEP]
by auto


[STATEMENT]
lemma i_shrink_last_assoc: "f \<div>\<^bsub>il\<^esub> a \<div>\<^bsub>il\<^esub> b = f \<div>\<^bsub>il\<^esub> (a * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<div>\<^sub>l a \<div>\<^sub>l b = f \<div>\<^sub>l (a * b)
[PROOF STEP]
apply (unfold i_shrink_last_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i_aggregate (i_aggregate f a last) b last = i_aggregate f (a * b) last
[PROOF STEP]
apply (case_tac "b = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<noteq> 0 \<Longrightarrow> i_aggregate (i_aggregate f a last) b last = i_aggregate f (a * b) last
[PROOF STEP]
apply (case_tac "a = 0", simp add: i_aggregate_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>b \<noteq> 0; a \<noteq> 0\<rbrakk> \<Longrightarrow> i_aggregate (i_aggregate f a last) b last = i_aggregate f (a * b) last
[PROOF STEP]
apply (simp add: i_aggregate_assoc f_shrink_last_last[unfolded f_shrink_last_def])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma le_int_of_uint32: "(x \<le> y) = (int_of_uint32 x \<le> int_of_uint32 y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<le> y) = (int_of_uint32 x \<le> int_of_uint32 y)
[PROOF STEP]
by (transfer, simp add: word_le_def)


[STATEMENT]
lemma sin_pi_divide_n_ge_0 [simp]:
  assumes "n \<noteq> 0"
  shows "0 \<le> sin (pi / real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sin (pi / real n)
[PROOF STEP]
by (rule sin_ge_zero) (use assms in \<open>simp_all add: field_split_simps\<close>)


[STATEMENT]
lemma (in Group) s_top_elem1:"\<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; a \<in> H; b \<in> K\<rbrakk> \<Longrightarrow>
                    a \<cdot> b \<in> H \<diamondop>\<^bsub>G\<^esub> K "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<subseteq> carrier G; K \<subseteq> carrier G; a \<in> H; b \<in> K\<rbrakk> \<Longrightarrow> a \<cdot> b \<in> H \<diamondop> K
[PROOF STEP]
by (simp add:s_top_def, blast)


[STATEMENT]
lemma inducedHOMTr0_1:"\<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow>
                        (f\<dieresis>\<^bsub>F,G\<^esub>) \<in>  set_rcs F (gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier G
[PROOF STEP]
apply (rule Pi_I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x \<in> carrier G
[PROOF STEP]
apply (simp add:set_rcs_def, erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<in> carrier G
[PROOF STEP]
apply (subst inducedHOMTr0[of "F" "G" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x a. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a\<rbrakk> \<Longrightarrow> f a \<in> carrier G
[PROOF STEP]
apply (simp add:gHom_mem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma C_greater_zero: "y \<in> C \<Longrightarrow> 0 < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> C \<Longrightarrow> 0 < y
[PROOF STEP]
by (auto simp add: C_def B_mod_greater_zero)


[STATEMENT]
lemma iso_functor_refl:
  assumes "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
  shows "\<FF> \<approx>\<^sub>C\<^sub>F\<^bsub>\<alpha>\<^esub> \<FF>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> \<approx>\<^sub>C\<^sub>F\<^bsub>\<alpha>\<^esub> \<FF>
[PROOF STEP]
proof(rule iso_functorI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ?\<NN> : \<FF> \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>i\<^sub>s\<^sub>o \<FF> : ?\<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> ?\<BB>
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
show "ntcf_id \<FF> : \<FF> \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>i\<^sub>s\<^sub>o \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>"
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal (1 subgoal):
 1. ntcf_id \<FF> : \<FF> \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>i\<^sub>s\<^sub>o \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (cs_concl cs_shallow cs_intro: ntcf_cs_intros)
[PROOF STATE]
proof (state)
this:
ntcf_id \<FF> : \<FF> \<mapsto>\<^sub>C\<^sub>F\<^sub>.\<^sub>i\<^sub>s\<^sub>o \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem factorial_condition_two: (* Jacobson theorem 2.22 *)
  "divisor_chain_condition_monoid G \<and> gcd_condition_monoid G \<longleftrightarrow> factorial_monoid G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (divisor_chain_condition_monoid G \<and> gcd_condition_monoid G) = factorial_monoid G
[PROOF STEP]
proof (rule iffI, clarify)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>divisor_chain_condition_monoid G; gcd_condition_monoid G\<rbrakk> \<Longrightarrow> factorial_monoid G
 2. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
assume dcc: "divisor_chain_condition_monoid G"
    and gc: "gcd_condition_monoid G"
[PROOF STATE]
proof (state)
this:
divisor_chain_condition_monoid G
gcd_condition_monoid G

goal (2 subgoals):
 1. \<lbrakk>divisor_chain_condition_monoid G; gcd_condition_monoid G\<rbrakk> \<Longrightarrow> factorial_monoid G
 2. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
interpret divisor_chain_condition_monoid "G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_chain_condition_monoid G
[PROOF STEP]
by (rule dcc)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>divisor_chain_condition_monoid G; gcd_condition_monoid G\<rbrakk> \<Longrightarrow> factorial_monoid G
 2. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
interpret gcd_condition_monoid "G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd_condition_monoid G
[PROOF STEP]
by (rule gc)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>divisor_chain_condition_monoid G; gcd_condition_monoid G\<rbrakk> \<Longrightarrow> factorial_monoid G
 2. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
show "factorial_monoid G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. factorial_monoid G
[PROOF STEP]
by (simp add: factorial_condition_one[symmetric], rule, unfold_locales)
[PROOF STATE]
proof (state)
this:
factorial_monoid G

goal (1 subgoal):
 1. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
assume "factorial_monoid G"
[PROOF STATE]
proof (state)
this:
factorial_monoid G

goal (1 subgoal):
 1. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
factorial_monoid G
[PROOF STEP]
interpret factorial_monoid "G"
[PROOF STATE]
proof (prove)
using this:
factorial_monoid G

goal (1 subgoal):
 1. factorial_monoid G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. factorial_monoid G \<Longrightarrow> divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
show "divisor_chain_condition_monoid G \<and> gcd_condition_monoid G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. divisor_chain_condition_monoid G \<and> gcd_condition_monoid G
[PROOF STEP]
by rule unfold_locales
[PROOF STATE]
proof (state)
this:
divisor_chain_condition_monoid G \<and> gcd_condition_monoid G

goal:
No subgoals!
[PROOF STEP]
qed